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,
236 #define ESINT64VAL 258
237 #define EUINT64VAL 259
238 #define ESAPINTVAL 260
239 #define EUAPINTVAL 261
240 #define LOCALVAL_ID 262
241 #define GLOBALVAL_ID 263
249 #define PPC_FP128 271
253 #define GLOBALVAR 275
255 #define STRINGCONSTANT 277
256 #define ATSTRINGCONSTANT 278
257 #define PCTSTRINGCONSTANT 279
258 #define ZEROINITIALIZER 280
270 #define THREAD_LOCAL 292
272 #define DOTDOTDOT 294
278 #define APPENDING 300
279 #define DLLIMPORT 301
280 #define DLLEXPORT 302
281 #define EXTERN_WEAK 303
288 #define ADDRSPACE 310
294 #define SIDEEFFECT 316
297 #define FASTCC_TOK 319
298 #define COLDCC_TOK 320
299 #define X86_STDCALLCC_TOK 321
300 #define X86_FASTCALLCC_TOK 322
301 #define DATALAYOUT 323
307 #define UNREACHABLE 329
352 #define GETELEMENTPTR 374
368 #define EXTRACTELEMENT 390
369 #define INSERTELEMENT 391
370 #define SHUFFLEVECTOR 392
371 #define GETRESULT 393
372 #define EXTRACTVALUE 394
373 #define INSERTVALUE 395
388 #define ALWAYSINLINE 410
391 #define PROTECTED 413
396 /* Copy the first part of user declarations. */
397 #line 14 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
399 #include "ParserInternals.h"
400 #include "llvm/CallingConv.h"
401 #include "llvm/InlineAsm.h"
402 #include "llvm/Instructions.h"
403 #include "llvm/Module.h"
404 #include "llvm/ValueSymbolTable.h"
405 #include "llvm/AutoUpgrade.h"
406 #include "llvm/Support/GetElementPtrTypeIterator.h"
407 #include "llvm/Support/CommandLine.h"
408 #include "llvm/ADT/SmallVector.h"
409 #include "llvm/ADT/STLExtras.h"
410 #include "llvm/Support/MathExtras.h"
411 #include "llvm/Support/Streams.h"
417 // The following is a gross hack. In order to rid the libAsmParser library of
418 // exceptions, we have to have a way of getting the yyparse function to go into
419 // an error situation. So, whenever we want an error to occur, the GenerateError
420 // function (see bottom of file) sets TriggerError. Then, at the end of each
421 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
422 // (a goto) to put YACC in error state. Furthermore, several calls to
423 // GenerateError are made from inside productions and they must simulate the
424 // previous exception behavior by exiting the production immediately. We have
425 // replaced these with the GEN_ERROR macro which calls GeneratError and then
426 // immediately invokes YYERROR. This would be so much cleaner if it was a
427 // recursive descent parser.
428 static bool TriggerError = false;
429 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
430 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
432 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
433 int yylex(); // declaration" of xxx warnings.
435 using namespace llvm;
437 static Module *ParserResult;
439 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
440 // relating to upreferences in the input stream.
442 //#define DEBUG_UPREFS 1
444 #define UR_OUT(X) cerr << X
449 #define YYERROR_VERBOSE 1
451 static GlobalVariable *CurGV;
454 // This contains info used when building the body of a function. It is
455 // destroyed when the function is completed.
457 typedef std::vector<Value *> ValueList; // Numbered defs
460 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
462 static struct PerModuleInfo {
463 Module *CurrentModule;
464 ValueList Values; // Module level numbered definitions
465 ValueList LateResolveValues;
466 std::vector<PATypeHolder> Types;
467 std::map<ValID, PATypeHolder> LateResolveTypes;
469 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
470 /// how they were referenced and on which line of the input they came from so
471 /// that we can resolve them later and print error messages as appropriate.
472 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
474 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
475 // references to global values. Global values may be referenced before they
476 // are defined, and if so, the temporary object that they represent is held
477 // here. This is used for forward references of GlobalValues.
479 typedef std::map<std::pair<const PointerType *,
480 ValID>, GlobalValue*> GlobalRefsType;
481 GlobalRefsType GlobalRefs;
484 // If we could not resolve some functions at function compilation time
485 // (calls to functions before they are defined), resolve them now... Types
486 // are resolved when the constant pool has been completely parsed.
488 ResolveDefinitions(LateResolveValues);
492 // Check to make sure that all global value forward references have been
495 if (!GlobalRefs.empty()) {
496 std::string UndefinedReferences = "Unresolved global references exist:\n";
498 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
500 UndefinedReferences += " " + I->first.first->getDescription() + " " +
501 I->first.second.getName() + "\n";
503 GenerateError(UndefinedReferences);
507 // Look for intrinsic functions and CallInst that need to be upgraded
508 for (Module::iterator FI = CurrentModule->begin(),
509 FE = CurrentModule->end(); FI != FE; )
510 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
512 Values.clear(); // Clear out function local definitions
517 // GetForwardRefForGlobal - Check to see if there is a forward reference
518 // for this global. If so, remove it from the GlobalRefs map and return it.
519 // If not, just return null.
520 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
521 // Check to see if there is a forward reference to this global variable...
522 // if there is, eliminate it and patch the reference to use the new def'n.
523 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
524 GlobalValue *Ret = 0;
525 if (I != GlobalRefs.end()) {
532 bool TypeIsUnresolved(PATypeHolder* PATy) {
533 // If it isn't abstract, its resolved
534 const Type* Ty = PATy->get();
535 if (!Ty->isAbstract())
537 // Traverse the type looking for abstract types. If it isn't abstract then
538 // we don't need to traverse that leg of the type.
539 std::vector<const Type*> WorkList, SeenList;
540 WorkList.push_back(Ty);
541 while (!WorkList.empty()) {
542 const Type* Ty = WorkList.back();
543 SeenList.push_back(Ty);
545 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
546 // Check to see if this is an unresolved type
547 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
548 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
549 for ( ; I != E; ++I) {
550 if (I->second.get() == OpTy)
553 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
554 const Type* TheTy = SeqTy->getElementType();
555 if (TheTy->isAbstract() && TheTy != Ty) {
556 std::vector<const Type*>::iterator I = SeenList.begin(),
562 WorkList.push_back(TheTy);
564 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
565 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
566 const Type* TheTy = StrTy->getElementType(i);
567 if (TheTy->isAbstract() && TheTy != Ty) {
568 std::vector<const Type*>::iterator I = SeenList.begin(),
574 WorkList.push_back(TheTy);
583 static struct PerFunctionInfo {
584 Function *CurrentFunction; // Pointer to current function being created
586 ValueList Values; // Keep track of #'d definitions
588 ValueList LateResolveValues;
589 bool isDeclare; // Is this function a forward declararation?
590 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
591 GlobalValue::VisibilityTypes Visibility;
593 /// BBForwardRefs - When we see forward references to basic blocks, keep
594 /// track of them here.
595 std::map<ValID, BasicBlock*> BBForwardRefs;
597 inline PerFunctionInfo() {
600 Linkage = GlobalValue::ExternalLinkage;
601 Visibility = GlobalValue::DefaultVisibility;
604 inline void FunctionStart(Function *M) {
609 void FunctionDone() {
610 // Any forward referenced blocks left?
611 if (!BBForwardRefs.empty()) {
612 GenerateError("Undefined reference to label " +
613 BBForwardRefs.begin()->second->getName());
617 // Resolve all forward references now.
618 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
620 Values.clear(); // Clear out function local definitions
621 BBForwardRefs.clear();
624 Linkage = GlobalValue::ExternalLinkage;
625 Visibility = GlobalValue::DefaultVisibility;
627 } CurFun; // Info for the current function...
629 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
632 //===----------------------------------------------------------------------===//
633 // Code to handle definitions of all the types
634 //===----------------------------------------------------------------------===//
636 /// InsertValue - Insert a value into the value table. If it is named, this
637 /// returns -1, otherwise it returns the slot number for the value.
638 static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
639 // Things that have names or are void typed don't get slot numbers
640 if (V->hasName() || (V->getType() == Type::VoidTy))
643 // In the case of function values, we have to allow for the forward reference
644 // of basic blocks, which are included in the numbering. Consequently, we keep
645 // track of the next insertion location with NextValNum. When a BB gets
646 // inserted, it could change the size of the CurFun.Values vector.
647 if (&ValueTab == &CurFun.Values) {
648 if (ValueTab.size() <= CurFun.NextValNum)
649 ValueTab.resize(CurFun.NextValNum+1);
650 ValueTab[CurFun.NextValNum++] = V;
651 return CurFun.NextValNum-1;
653 // For all other lists, its okay to just tack it on the back of the vector.
654 ValueTab.push_back(V);
655 return ValueTab.size()-1;
658 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
660 case ValID::LocalID: // Is it a numbered definition?
661 // Module constants occupy the lowest numbered slots...
662 if (D.Num < CurModule.Types.size())
663 return CurModule.Types[D.Num];
665 case ValID::LocalName: // Is it a named definition?
666 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
667 D.destroy(); // Free old strdup'd memory...
672 GenerateError("Internal parser error: Invalid symbol type reference");
676 // If we reached here, we referenced either a symbol that we don't know about
677 // or an id number that hasn't been read yet. We may be referencing something
678 // forward, so just create an entry to be resolved later and get to it...
680 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
683 if (inFunctionScope()) {
684 if (D.Type == ValID::LocalName) {
685 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
688 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
693 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
694 if (I != CurModule.LateResolveTypes.end())
697 Type *Typ = OpaqueType::get();
698 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
702 // getExistingVal - Look up the value specified by the provided type and
703 // the provided ValID. If the value exists and has already been defined, return
704 // it. Otherwise return null.
706 static Value *getExistingVal(const Type *Ty, const ValID &D) {
707 if (isa<FunctionType>(Ty)) {
708 GenerateError("Functions are not values and "
709 "must be referenced as pointers");
714 case ValID::LocalID: { // Is it a numbered definition?
715 // Check that the number is within bounds.
716 if (D.Num >= CurFun.Values.size())
718 Value *Result = CurFun.Values[D.Num];
719 if (Ty != Result->getType()) {
720 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
721 Result->getType()->getDescription() + "' does not match "
722 "expected type, '" + Ty->getDescription() + "'");
727 case ValID::GlobalID: { // Is it a numbered definition?
728 if (D.Num >= CurModule.Values.size())
730 Value *Result = CurModule.Values[D.Num];
731 if (Ty != Result->getType()) {
732 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
733 Result->getType()->getDescription() + "' does not match "
734 "expected type, '" + Ty->getDescription() + "'");
740 case ValID::LocalName: { // Is it a named definition?
741 if (!inFunctionScope())
743 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
744 Value *N = SymTab.lookup(D.getName());
747 if (N->getType() != Ty)
750 D.destroy(); // Free old strdup'd memory...
753 case ValID::GlobalName: { // Is it a named definition?
754 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
755 Value *N = SymTab.lookup(D.getName());
758 if (N->getType() != Ty)
761 D.destroy(); // Free old strdup'd memory...
765 // Check to make sure that "Ty" is an integral type, and that our
766 // value will fit into the specified type...
767 case ValID::ConstSIntVal: // Is it a constant pool reference??
768 if (!isa<IntegerType>(Ty) ||
769 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
770 GenerateError("Signed integral constant '" +
771 itostr(D.ConstPool64) + "' is invalid for type '" +
772 Ty->getDescription() + "'");
775 return ConstantInt::get(Ty, D.ConstPool64, true);
777 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
778 if (isa<IntegerType>(Ty) &&
779 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
780 return ConstantInt::get(Ty, D.UConstPool64);
782 if (!isa<IntegerType>(Ty) ||
783 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
784 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
785 "' is invalid or out of range for type '" +
786 Ty->getDescription() + "'");
789 // This is really a signed reference. Transmogrify.
790 return ConstantInt::get(Ty, D.ConstPool64, true);
792 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
793 if (!isa<IntegerType>(Ty)) {
794 GenerateError("Integral constant '" + D.getName() +
795 "' is invalid or out of range for type '" +
796 Ty->getDescription() + "'");
801 APSInt Tmp = *D.ConstPoolInt;
802 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
803 return ConstantInt::get(Tmp);
806 case ValID::ConstFPVal: // Is it a floating point const pool reference?
807 if (!Ty->isFloatingPoint() ||
808 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
809 GenerateError("FP constant invalid for type");
812 // Lexer has no type info, so builds all float and double FP constants
813 // as double. Fix this here. Long double does not need this.
814 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
816 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
817 return ConstantFP::get(*D.ConstPoolFP);
819 case ValID::ConstNullVal: // Is it a null value?
820 if (!isa<PointerType>(Ty)) {
821 GenerateError("Cannot create a a non pointer null");
824 return ConstantPointerNull::get(cast<PointerType>(Ty));
826 case ValID::ConstUndefVal: // Is it an undef value?
827 return UndefValue::get(Ty);
829 case ValID::ConstZeroVal: // Is it a zero value?
830 return Constant::getNullValue(Ty);
832 case ValID::ConstantVal: // Fully resolved constant?
833 if (D.ConstantValue->getType() != Ty) {
834 GenerateError("Constant expression type different from required type");
837 return D.ConstantValue;
839 case ValID::InlineAsmVal: { // Inline asm expression
840 const PointerType *PTy = dyn_cast<PointerType>(Ty);
841 const FunctionType *FTy =
842 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
843 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
844 GenerateError("Invalid type for asm constraint string");
847 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
848 D.IAD->HasSideEffects);
849 D.destroy(); // Free InlineAsmDescriptor.
853 assert(0 && "Unhandled case!");
857 assert(0 && "Unhandled case!");
861 // getVal - This function is identical to getExistingVal, except that if a
862 // value is not already defined, it "improvises" by creating a placeholder var
863 // that looks and acts just like the requested variable. When the value is
864 // defined later, all uses of the placeholder variable are replaced with the
867 static Value *getVal(const Type *Ty, const ValID &ID) {
868 if (Ty == Type::LabelTy) {
869 GenerateError("Cannot use a basic block here");
873 // See if the value has already been defined.
874 Value *V = getExistingVal(Ty, ID);
876 if (TriggerError) return 0;
878 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
879 GenerateError("Invalid use of a non-first-class type");
883 // If we reached here, we referenced either a symbol that we don't know about
884 // or an id number that hasn't been read yet. We may be referencing something
885 // forward, so just create an entry to be resolved later and get to it...
888 case ValID::GlobalName:
889 case ValID::GlobalID: {
890 const PointerType *PTy = dyn_cast<PointerType>(Ty);
892 GenerateError("Invalid type for reference to global" );
895 const Type* ElTy = PTy->getElementType();
896 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
897 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
899 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
900 (Module*)0, false, PTy->getAddressSpace());
904 V = new Argument(Ty);
907 // Remember where this forward reference came from. FIXME, shouldn't we try
908 // to recycle these things??
909 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
912 if (inFunctionScope())
913 InsertValue(V, CurFun.LateResolveValues);
915 InsertValue(V, CurModule.LateResolveValues);
919 /// defineBBVal - This is a definition of a new basic block with the specified
920 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
921 static BasicBlock *defineBBVal(const ValID &ID) {
922 assert(inFunctionScope() && "Can't get basic block at global scope!");
926 // First, see if this was forward referenced
928 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
929 if (BBI != CurFun.BBForwardRefs.end()) {
931 // The forward declaration could have been inserted anywhere in the
932 // function: insert it into the correct place now.
933 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
934 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
936 // We're about to erase the entry, save the key so we can clean it up.
937 ValID Tmp = BBI->first;
939 // Erase the forward ref from the map as its no longer "forward"
940 CurFun.BBForwardRefs.erase(ID);
942 // The key has been removed from the map but so we don't want to leave
943 // strdup'd memory around so destroy it too.
946 // If its a numbered definition, bump the number and set the BB value.
947 if (ID.Type == ValID::LocalID) {
948 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
952 // We haven't seen this BB before and its first mention is a definition.
953 // Just create it and return it.
954 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
955 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
956 if (ID.Type == ValID::LocalID) {
957 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
966 /// getBBVal - get an existing BB value or create a forward reference for it.
968 static BasicBlock *getBBVal(const ValID &ID) {
969 assert(inFunctionScope() && "Can't get basic block at global scope!");
973 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
974 if (BBI != CurFun.BBForwardRefs.end()) {
976 } if (ID.Type == ValID::LocalName) {
977 std::string Name = ID.getName();
978 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
980 if (N->getType()->getTypeID() == Type::LabelTyID)
981 BB = cast<BasicBlock>(N);
983 GenerateError("Reference to label '" + Name + "' is actually of type '"+
984 N->getType()->getDescription() + "'");
986 } else if (ID.Type == ValID::LocalID) {
987 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
988 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
989 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
991 GenerateError("Reference to label '%" + utostr(ID.Num) +
992 "' is actually of type '"+
993 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
996 GenerateError("Illegal label reference " + ID.getName());
1000 // If its already been defined, return it now.
1002 ID.destroy(); // Free strdup'd memory.
1006 // Otherwise, this block has not been seen before, create it.
1008 if (ID.Type == ValID::LocalName)
1009 Name = ID.getName();
1010 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
1012 // Insert it in the forward refs map.
1013 CurFun.BBForwardRefs[ID] = BB;
1019 //===----------------------------------------------------------------------===//
1020 // Code to handle forward references in instructions
1021 //===----------------------------------------------------------------------===//
1023 // This code handles the late binding needed with statements that reference
1024 // values not defined yet... for example, a forward branch, or the PHI node for
1027 // This keeps a table (CurFun.LateResolveValues) of all such forward references
1028 // and back patchs after we are done.
1031 // ResolveDefinitions - If we could not resolve some defs at parsing
1032 // time (forward branches, phi functions for loops, etc...) resolve the
1036 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1037 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1038 while (!LateResolvers.empty()) {
1039 Value *V = LateResolvers.back();
1040 LateResolvers.pop_back();
1042 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1043 CurModule.PlaceHolderInfo.find(V);
1044 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1046 ValID &DID = PHI->second.first;
1048 Value *TheRealValue = getExistingVal(V->getType(), DID);
1052 V->replaceAllUsesWith(TheRealValue);
1054 CurModule.PlaceHolderInfo.erase(PHI);
1055 } else if (FutureLateResolvers) {
1056 // Functions have their unresolved items forwarded to the module late
1058 InsertValue(V, *FutureLateResolvers);
1060 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1061 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1062 "' of type '" + V->getType()->getDescription() + "'",
1063 PHI->second.second);
1066 GenerateError("Reference to an invalid definition: #" +
1067 itostr(DID.Num) + " of type '" +
1068 V->getType()->getDescription() + "'",
1069 PHI->second.second);
1074 LateResolvers.clear();
1077 // ResolveTypeTo - A brand new type was just declared. This means that (if
1078 // name is not null) things referencing Name can be resolved. Otherwise, things
1079 // refering to the number can be resolved. Do this now.
1081 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1084 D = ValID::createLocalName(*Name);
1086 D = ValID::createLocalID(CurModule.Types.size());
1088 std::map<ValID, PATypeHolder>::iterator I =
1089 CurModule.LateResolveTypes.find(D);
1090 if (I != CurModule.LateResolveTypes.end()) {
1091 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1092 CurModule.LateResolveTypes.erase(I);
1096 // setValueName - Set the specified value to the name given. The name may be
1097 // null potentially, in which case this is a noop. The string passed in is
1098 // assumed to be a malloc'd string buffer, and is free'd by this function.
1100 static void setValueName(Value *V, std::string *NameStr) {
1101 if (!NameStr) return;
1102 std::string Name(*NameStr); // Copy string
1103 delete NameStr; // Free old string
1105 if (V->getType() == Type::VoidTy) {
1106 GenerateError("Can't assign name '" + Name+"' to value with void type");
1110 assert(inFunctionScope() && "Must be in function scope!");
1111 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1112 if (ST.lookup(Name)) {
1113 GenerateError("Redefinition of value '" + Name + "' of type '" +
1114 V->getType()->getDescription() + "'");
1122 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1123 /// this is a declaration, otherwise it is a definition.
1124 static GlobalVariable *
1125 ParseGlobalVariable(std::string *NameStr,
1126 GlobalValue::LinkageTypes Linkage,
1127 GlobalValue::VisibilityTypes Visibility,
1128 bool isConstantGlobal, const Type *Ty,
1129 Constant *Initializer, bool IsThreadLocal,
1130 unsigned AddressSpace = 0) {
1131 if (isa<FunctionType>(Ty)) {
1132 GenerateError("Cannot declare global vars of function type");
1135 if (Ty == Type::LabelTy) {
1136 GenerateError("Cannot declare global vars of label type");
1140 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1144 Name = *NameStr; // Copy string
1145 delete NameStr; // Free old string
1148 // See if this global value was forward referenced. If so, recycle the
1151 if (!Name.empty()) {
1152 ID = ValID::createGlobalName(Name);
1154 ID = ValID::createGlobalID(CurModule.Values.size());
1157 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1158 // Move the global to the end of the list, from whereever it was
1159 // previously inserted.
1160 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1161 CurModule.CurrentModule->getGlobalList().remove(GV);
1162 CurModule.CurrentModule->getGlobalList().push_back(GV);
1163 GV->setInitializer(Initializer);
1164 GV->setLinkage(Linkage);
1165 GV->setVisibility(Visibility);
1166 GV->setConstant(isConstantGlobal);
1167 GV->setThreadLocal(IsThreadLocal);
1168 InsertValue(GV, CurModule.Values);
1172 // If this global has a name
1173 if (!Name.empty()) {
1174 // if the global we're parsing has an initializer (is a definition) and
1175 // has external linkage.
1176 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1177 // If there is already a global with external linkage with this name
1178 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1179 // If we allow this GVar to get created, it will be renamed in the
1180 // symbol table because it conflicts with an existing GVar. We can't
1181 // allow redefinition of GVars whose linking indicates that their name
1182 // must stay the same. Issue the error.
1183 GenerateError("Redefinition of global variable named '" + Name +
1184 "' of type '" + Ty->getDescription() + "'");
1189 // Otherwise there is no existing GV to use, create one now.
1190 GlobalVariable *GV =
1191 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1192 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1193 GV->setVisibility(Visibility);
1194 InsertValue(GV, CurModule.Values);
1198 // setTypeName - Set the specified type to the name given. The name may be
1199 // null potentially, in which case this is a noop. The string passed in is
1200 // assumed to be a malloc'd string buffer, and is freed by this function.
1202 // This function returns true if the type has already been defined, but is
1203 // allowed to be redefined in the specified context. If the name is a new name
1204 // for the type plane, it is inserted and false is returned.
1205 static bool setTypeName(const Type *T, std::string *NameStr) {
1206 assert(!inFunctionScope() && "Can't give types function-local names!");
1207 if (NameStr == 0) return false;
1209 std::string Name(*NameStr); // Copy string
1210 delete NameStr; // Free old string
1212 // We don't allow assigning names to void type
1213 if (T == Type::VoidTy) {
1214 GenerateError("Can't assign name '" + Name + "' to the void type");
1218 // Set the type name, checking for conflicts as we do so.
1219 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1221 if (AlreadyExists) { // Inserting a name that is already defined???
1222 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1223 assert(Existing && "Conflict but no matching type?!");
1225 // There is only one case where this is allowed: when we are refining an
1226 // opaque type. In this case, Existing will be an opaque type.
1227 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1228 // We ARE replacing an opaque type!
1229 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1233 // Otherwise, this is an attempt to redefine a type. That's okay if
1234 // the redefinition is identical to the original. This will be so if
1235 // Existing and T point to the same Type object. In this one case we
1236 // allow the equivalent redefinition.
1237 if (Existing == T) return true; // Yes, it's equal.
1239 // Any other kind of (non-equivalent) redefinition is an error.
1240 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1241 T->getDescription() + "'");
1247 //===----------------------------------------------------------------------===//
1248 // Code for handling upreferences in type names...
1251 // TypeContains - Returns true if Ty directly contains E in it.
1253 static bool TypeContains(const Type *Ty, const Type *E) {
1254 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1255 E) != Ty->subtype_end();
1259 struct UpRefRecord {
1260 // NestingLevel - The number of nesting levels that need to be popped before
1261 // this type is resolved.
1262 unsigned NestingLevel;
1264 // LastContainedTy - This is the type at the current binding level for the
1265 // type. Every time we reduce the nesting level, this gets updated.
1266 const Type *LastContainedTy;
1268 // UpRefTy - This is the actual opaque type that the upreference is
1269 // represented with.
1270 OpaqueType *UpRefTy;
1272 UpRefRecord(unsigned NL, OpaqueType *URTy)
1273 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1277 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1278 static std::vector<UpRefRecord> UpRefs;
1280 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1281 /// called. It loops through the UpRefs vector, which is a list of the
1282 /// currently active types. For each type, if the up reference is contained in
1283 /// the newly completed type, we decrement the level count. When the level
1284 /// count reaches zero, the upreferenced type is the type that is passed in:
1285 /// thus we can complete the cycle.
1287 static PATypeHolder HandleUpRefs(const Type *ty) {
1288 // If Ty isn't abstract, or if there are no up-references in it, then there is
1289 // nothing to resolve here.
1290 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1292 PATypeHolder Ty(ty);
1293 UR_OUT("Type '" << Ty->getDescription() <<
1294 "' newly formed. Resolving upreferences.\n" <<
1295 UpRefs.size() << " upreferences active!\n");
1297 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1298 // to zero), we resolve them all together before we resolve them to Ty. At
1299 // the end of the loop, if there is anything to resolve to Ty, it will be in
1301 OpaqueType *TypeToResolve = 0;
1303 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1304 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1305 << UpRefs[i].second->getDescription() << ") = "
1306 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1307 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1308 // Decrement level of upreference
1309 unsigned Level = --UpRefs[i].NestingLevel;
1310 UpRefs[i].LastContainedTy = Ty;
1311 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1312 if (Level == 0) { // Upreference should be resolved!
1313 if (!TypeToResolve) {
1314 TypeToResolve = UpRefs[i].UpRefTy;
1316 UR_OUT(" * Resolving upreference for "
1317 << UpRefs[i].second->getDescription() << "\n";
1318 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1319 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1320 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1321 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1323 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1324 --i; // Do not skip the next element...
1329 if (TypeToResolve) {
1330 UR_OUT(" * Resolving upreference for "
1331 << UpRefs[i].second->getDescription() << "\n";
1332 std::string OldName = TypeToResolve->getDescription());
1333 TypeToResolve->refineAbstractTypeTo(Ty);
1339 //===----------------------------------------------------------------------===//
1340 // RunVMAsmParser - Define an interface to this parser
1341 //===----------------------------------------------------------------------===//
1343 static Module* RunParser(Module * M);
1345 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1347 Module *M = RunParser(new Module(LLLgetFilename()));
1354 /* Enabling traces. */
1359 /* Enabling verbose error messages. */
1360 #ifdef YYERROR_VERBOSE
1361 # undef YYERROR_VERBOSE
1362 # define YYERROR_VERBOSE 1
1364 # define YYERROR_VERBOSE 0
1367 /* Enabling the token table. */
1368 #ifndef YYTOKEN_TABLE
1369 # define YYTOKEN_TABLE 0
1372 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1373 typedef union YYSTYPE
1374 #line 970 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
1376 llvm::Module *ModuleVal;
1377 llvm::Function *FunctionVal;
1378 llvm::BasicBlock *BasicBlockVal;
1379 llvm::TerminatorInst *TermInstVal;
1380 llvm::Instruction *InstVal;
1381 llvm::Constant *ConstVal;
1383 const llvm::Type *PrimType;
1384 std::list<llvm::PATypeHolder> *TypeList;
1385 llvm::PATypeHolder *TypeVal;
1386 llvm::Value *ValueVal;
1387 std::vector<llvm::Value*> *ValueList;
1388 std::vector<unsigned> *ConstantList;
1389 llvm::ArgListType *ArgList;
1390 llvm::TypeWithAttrs TypeWithAttrs;
1391 llvm::TypeWithAttrsList *TypeWithAttrsList;
1392 llvm::ParamList *ParamList;
1394 // Represent the RHS of PHI node
1395 std::list<std::pair<llvm::Value*,
1396 llvm::BasicBlock*> > *PHIList;
1397 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1398 std::vector<llvm::Constant*> *ConstVector;
1400 llvm::GlobalValue::LinkageTypes Linkage;
1401 llvm::GlobalValue::VisibilityTypes Visibility;
1402 llvm::Attributes Attributes;
1403 llvm::APInt *APIntVal;
1408 llvm::APFloat *FPVal;
1411 std::string *StrVal; // This memory must be deleted
1412 llvm::ValID ValIDVal;
1414 llvm::Instruction::BinaryOps BinaryOpVal;
1415 llvm::Instruction::TermOps TermOpVal;
1416 llvm::Instruction::MemoryOps MemOpVal;
1417 llvm::Instruction::CastOps CastOpVal;
1418 llvm::Instruction::OtherOps OtherOpVal;
1419 llvm::ICmpInst::Predicate IPredicate;
1420 llvm::FCmpInst::Predicate FPredicate;
1422 /* Line 187 of yacc.c. */
1423 #line 1424 "llvmAsmParser.tab.c"
1425 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1426 # define YYSTYPE_IS_DECLARED 1
1427 # define YYSTYPE_IS_TRIVIAL 1
1432 /* Copy the second part of user declarations. */
1435 /* Line 216 of yacc.c. */
1436 #line 1437 "llvmAsmParser.tab.c"
1443 typedef YYTYPE_UINT8 yytype_uint8;
1445 typedef unsigned char yytype_uint8;
1449 typedef YYTYPE_INT8 yytype_int8;
1450 #elif (defined __STDC__ || defined __C99__FUNC__ \
1451 || defined __cplusplus || defined _MSC_VER)
1452 typedef signed char yytype_int8;
1454 typedef short int yytype_int8;
1457 #ifdef YYTYPE_UINT16
1458 typedef YYTYPE_UINT16 yytype_uint16;
1460 typedef unsigned short int yytype_uint16;
1464 typedef YYTYPE_INT16 yytype_int16;
1466 typedef short int yytype_int16;
1470 # ifdef __SIZE_TYPE__
1471 # define YYSIZE_T __SIZE_TYPE__
1472 # elif defined size_t
1473 # define YYSIZE_T size_t
1474 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1475 || defined __cplusplus || defined _MSC_VER)
1476 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1477 # define YYSIZE_T size_t
1479 # define YYSIZE_T unsigned int
1483 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1488 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1489 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1493 # define YY_(msgid) msgid
1497 /* Suppress unused-variable warnings by "using" E. */
1498 #if ! defined lint || defined __GNUC__
1499 # define YYUSE(e) ((void) (e))
1501 # define YYUSE(e) /* empty */
1504 /* Identity function, used to suppress warnings about constant conditions. */
1506 # define YYID(n) (n)
1508 #if (defined __STDC__ || defined __C99__FUNC__ \
1509 || defined __cplusplus || defined _MSC_VER)
1522 #if ! defined yyoverflow || YYERROR_VERBOSE
1524 /* The parser invokes alloca or malloc; define the necessary symbols. */
1526 # ifdef YYSTACK_USE_ALLOCA
1527 # if YYSTACK_USE_ALLOCA
1529 # define YYSTACK_ALLOC __builtin_alloca
1530 # elif defined __BUILTIN_VA_ARG_INCR
1531 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1533 # define YYSTACK_ALLOC __alloca
1534 # elif defined _MSC_VER
1535 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1536 # define alloca _alloca
1538 # define YYSTACK_ALLOC alloca
1539 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1540 || defined __cplusplus || defined _MSC_VER)
1541 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1543 # define _STDLIB_H 1
1550 # ifdef YYSTACK_ALLOC
1551 /* Pacify GCC's `empty if-body' warning. */
1552 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1553 # ifndef YYSTACK_ALLOC_MAXIMUM
1554 /* The OS might guarantee only one guard page at the bottom of the stack,
1555 and a page size can be as small as 4096 bytes. So we cannot safely
1556 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1557 to allow for a few compiler-allocated temporary stack slots. */
1558 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1561 # define YYSTACK_ALLOC YYMALLOC
1562 # define YYSTACK_FREE YYFREE
1563 # ifndef YYSTACK_ALLOC_MAXIMUM
1564 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1566 # if (defined __cplusplus && ! defined _STDLIB_H \
1567 && ! ((defined YYMALLOC || defined malloc) \
1568 && (defined YYFREE || defined free)))
1569 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1571 # define _STDLIB_H 1
1575 # define YYMALLOC malloc
1576 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1577 || defined __cplusplus || defined _MSC_VER)
1578 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1582 # define YYFREE free
1583 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585 void free (void *); /* INFRINGES ON USER NAME SPACE */
1589 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1592 #if (! defined yyoverflow \
1593 && (! defined __cplusplus \
1594 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1596 /* A type that is properly aligned for any stack member. */
1603 /* The size of the maximum gap between one aligned stack and the next. */
1604 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1606 /* The size of an array large to enough to hold all stacks, each with
1608 # define YYSTACK_BYTES(N) \
1609 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1610 + YYSTACK_GAP_MAXIMUM)
1612 /* Copy COUNT objects from FROM to TO. The source and destination do
1615 # if defined __GNUC__ && 1 < __GNUC__
1616 # define YYCOPY(To, From, Count) \
1617 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1619 # define YYCOPY(To, From, Count) \
1623 for (yyi = 0; yyi < (Count); yyi++) \
1624 (To)[yyi] = (From)[yyi]; \
1630 /* Relocate STACK from its old location to the new one. The
1631 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1632 elements in the stack, and YYPTR gives the new location of the
1633 stack. Advance YYPTR to a properly aligned location for the next
1635 # define YYSTACK_RELOCATE(Stack) \
1638 YYSIZE_T yynewbytes; \
1639 YYCOPY (&yyptr->Stack, Stack, yysize); \
1640 Stack = &yyptr->Stack; \
1641 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1642 yyptr += yynewbytes / sizeof (*yyptr); \
1648 /* YYFINAL -- State number of the termination state. */
1650 /* YYLAST -- Last index in YYTABLE. */
1653 /* YYNTOKENS -- Number of terminals. */
1654 #define YYNTOKENS 173
1655 /* YYNNTS -- Number of nonterminals. */
1657 /* YYNRULES -- Number of rules. */
1658 #define YYNRULES 354
1659 /* YYNRULES -- Number of states. */
1660 #define YYNSTATES 717
1662 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1663 #define YYUNDEFTOK 2
1664 #define YYMAXUTOK 413
1666 #define YYTRANSLATE(YYX) \
1667 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1669 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1670 static const yytype_uint8 yytranslate[] =
1672 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1674 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1676 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
1677 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1678 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
1679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1684 166, 2, 2, 170, 2, 171, 2, 2, 2, 2,
1685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1698 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1699 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1700 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1701 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1702 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1703 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1704 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1705 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1706 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1707 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1708 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1709 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1710 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1711 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1712 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1717 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1719 static const yytype_uint16 yyprhs[] =
1721 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1722 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1723 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1724 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1725 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1726 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1727 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1728 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1729 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1730 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
1731 197, 198, 200, 202, 204, 206, 208, 211, 213, 215,
1732 217, 219, 221, 223, 225, 227, 229, 232, 233, 236,
1733 238, 240, 242, 243, 246, 248, 250, 252, 254, 256,
1734 258, 260, 262, 264, 266, 267, 270, 271, 274, 275,
1735 278, 279, 283, 286, 287, 289, 290, 294, 296, 299,
1736 301, 303, 305, 307, 309, 311, 313, 315, 317, 321,
1737 323, 326, 332, 338, 344, 350, 354, 357, 363, 368,
1738 371, 373, 375, 377, 381, 383, 387, 389, 390, 392,
1739 396, 401, 405, 409, 414, 419, 423, 430, 436, 439,
1740 442, 445, 448, 451, 454, 457, 460, 463, 466, 469,
1741 472, 479, 485, 494, 501, 508, 516, 524, 532, 540,
1742 547, 556, 565, 571, 579, 583, 585, 587, 589, 591,
1743 592, 595, 602, 604, 605, 607, 610, 611, 615, 616,
1744 620, 624, 628, 632, 633, 642, 643, 653, 654, 664,
1745 670, 673, 677, 679, 683, 687, 691, 695, 697, 698,
1746 704, 708, 710, 714, 716, 717, 729, 731, 733, 738,
1747 740, 742, 745, 749, 750, 752, 754, 756, 758, 760,
1748 762, 764, 766, 768, 770, 772, 776, 780, 783, 786,
1749 790, 793, 799, 804, 806, 812, 814, 816, 818, 820,
1750 822, 824, 827, 829, 833, 836, 839, 843, 847, 850,
1751 851, 853, 856, 859, 863, 873, 883, 892, 908, 910,
1752 912, 919, 925, 928, 931, 938, 946, 951, 956, 963,
1753 970, 971, 972, 976, 979, 983, 986, 988, 994, 1000,
1754 1007, 1014, 1021, 1028, 1033, 1040, 1045, 1050, 1057, 1064,
1755 1067, 1077, 1079, 1081, 1082, 1086, 1093, 1097, 1104, 1107,
1756 1113, 1121, 1127, 1132, 1137
1759 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1760 static const yytype_int16 yyrhs[] =
1762 222, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1763 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1764 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1765 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1766 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1767 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1768 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1769 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1770 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1771 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1772 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
1773 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1774 -1, 19, -1, 22, -1, 24, -1, 181, -1, -1,
1775 55, 159, 4, 160, -1, -1, 181, 161, -1, -1,
1776 7, 161, -1, 20, -1, 23, -1, 188, -1, -1,
1777 186, 161, -1, 42, -1, 44, -1, 43, -1, 45,
1778 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
1779 -1, -1, 156, -1, 157, -1, 158, -1, -1, 46,
1780 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1781 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
1782 64, -1, 65, -1, 66, -1, 67, -1, 62, 4,
1783 -1, 142, -1, 121, -1, 141, -1, 122, -1, 144,
1784 -1, 145, -1, 147, -1, 148, -1, 149, -1, 54,
1785 4, -1, -1, 197, 196, -1, 144, -1, 142, -1,
1786 141, -1, -1, 199, 198, -1, 143, -1, 146, -1,
1787 144, -1, 142, -1, 141, -1, 150, -1, 151, -1,
1788 154, -1, 155, -1, 153, -1, -1, 201, 200, -1,
1789 -1, 152, 22, -1, -1, 54, 4, -1, -1, 162,
1790 54, 4, -1, 34, 22, -1, -1, 205, -1, -1,
1791 162, 208, 207, -1, 205, -1, 54, 4, -1, 11,
1792 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1793 -1, 17, -1, 50, -1, 209, -1, 210, 183, 163,
1794 -1, 244, -1, 164, 4, -1, 210, 159, 214, 160,
1795 201, -1, 10, 159, 214, 160, 201, -1, 165, 4,
1796 166, 210, 167, -1, 168, 4, 166, 210, 169, -1,
1797 170, 215, 171, -1, 170, 171, -1, 168, 170, 215,
1798 171, 169, -1, 168, 170, 171, 169, -1, 210, 197,
1799 -1, 210, -1, 10, -1, 211, -1, 213, 162, 211,
1800 -1, 213, -1, 213, 162, 39, -1, 39, -1, -1,
1801 210, -1, 215, 162, 210, -1, 210, 165, 218, 167,
1802 -1, 210, 165, 167, -1, 210, 172, 22, -1, 210,
1803 168, 218, 169, -1, 210, 170, 218, 171, -1, 210,
1804 170, 171, -1, 210, 168, 170, 218, 171, 169, -1,
1805 210, 168, 170, 171, 169, -1, 210, 40, -1, 210,
1806 41, -1, 210, 244, -1, 210, 217, -1, 210, 25,
1807 -1, 179, 3, -1, 179, 5, -1, 179, 4, -1,
1808 179, 6, -1, 11, 26, -1, 11, 27, -1, 180,
1809 9, -1, 176, 159, 216, 38, 210, 160, -1, 119,
1810 159, 216, 256, 160, -1, 133, 159, 216, 162, 216,
1811 162, 216, 160, -1, 174, 159, 216, 162, 216, 160,
1812 -1, 175, 159, 216, 162, 216, 160, -1, 90, 177,
1813 159, 216, 162, 216, 160, -1, 91, 178, 159, 216,
1814 162, 216, 160, -1, 92, 177, 159, 216, 162, 216,
1815 160, -1, 93, 178, 159, 216, 162, 216, 160, -1,
1816 135, 159, 216, 162, 216, 160, -1, 136, 159, 216,
1817 162, 216, 162, 216, 160, -1, 137, 159, 216, 162,
1818 216, 162, 216, 160, -1, 139, 159, 216, 257, 160,
1819 -1, 140, 159, 216, 162, 216, 257, 160, -1, 218,
1820 162, 216, -1, 216, -1, 32, -1, 33, -1, 37,
1821 -1, -1, 212, 244, -1, 125, 159, 221, 38, 210,
1822 160, -1, 223, -1, -1, 224, -1, 223, 224, -1,
1823 -1, 31, 225, 240, -1, -1, 30, 226, 241, -1,
1824 60, 59, 230, -1, 184, 18, 210, -1, 184, 18,
1825 10, -1, -1, 187, 191, 220, 219, 216, 183, 227,
1826 207, -1, -1, 187, 189, 191, 220, 219, 216, 183,
1827 228, 207, -1, -1, 187, 190, 191, 220, 219, 210,
1828 183, 229, 207, -1, 187, 191, 35, 194, 221, -1,
1829 52, 231, -1, 56, 161, 232, -1, 22, -1, 53,
1830 161, 22, -1, 68, 161, 22, -1, 165, 233, 167,
1831 -1, 233, 162, 22, -1, 22, -1, -1, 234, 162,
1832 210, 197, 182, -1, 210, 197, 182, -1, 234, -1,
1833 234, 162, 39, -1, 39, -1, -1, 195, 199, 212,
1834 186, 159, 235, 160, 201, 206, 203, 202, -1, 28,
1835 -1, 170, -1, 193, 191, 236, 237, -1, 29, -1,
1836 171, -1, 248, 239, -1, 192, 191, 236, -1, -1,
1837 61, -1, 3, -1, 4, -1, 5, -1, 6, -1,
1838 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1839 25, -1, 168, 218, 169, -1, 165, 218, 167, -1,
1840 165, 167, -1, 172, 22, -1, 170, 218, 171, -1,
1841 170, 171, -1, 168, 170, 218, 171, 169, -1, 168,
1842 170, 171, 169, -1, 217, -1, 59, 242, 22, 162,
1843 22, -1, 7, -1, 8, -1, 181, -1, 186, -1,
1844 244, -1, 243, -1, 210, 245, -1, 246, -1, 247,
1845 162, 246, -1, 248, 249, -1, 238, 249, -1, 250,
1846 184, 251, -1, 250, 185, 251, -1, 250, 253, -1,
1847 -1, 21, -1, 69, 247, -1, 69, 10, -1, 70,
1848 17, 245, -1, 70, 11, 245, 162, 17, 245, 162,
1849 17, 245, -1, 71, 179, 245, 162, 17, 245, 165,
1850 252, 167, -1, 71, 179, 245, 162, 17, 245, 165,
1851 167, -1, 72, 195, 199, 212, 245, 159, 255, 160,
1852 201, 38, 17, 245, 73, 17, 245, -1, 73, -1,
1853 74, -1, 252, 179, 243, 162, 17, 245, -1, 179,
1854 243, 162, 17, 245, -1, 184, 259, -1, 185, 259,
1855 -1, 210, 165, 245, 162, 245, 167, -1, 254, 162,
1856 165, 245, 162, 245, 167, -1, 210, 197, 245, 197,
1857 -1, 17, 197, 245, 197, -1, 255, 162, 210, 197,
1858 245, 197, -1, 255, 162, 17, 197, 245, 197, -1,
1859 -1, -1, 256, 162, 246, -1, 162, 4, -1, 257,
1860 162, 4, -1, 58, 57, -1, 57, -1, 174, 210,
1861 245, 162, 245, -1, 175, 210, 245, 162, 245, -1,
1862 90, 177, 210, 245, 162, 245, -1, 91, 178, 210,
1863 245, 162, 245, -1, 92, 177, 210, 245, 162, 245,
1864 -1, 93, 178, 210, 245, 162, 245, -1, 176, 246,
1865 38, 210, -1, 133, 246, 162, 246, 162, 246, -1,
1866 134, 246, 162, 210, -1, 135, 246, 162, 246, -1,
1867 136, 246, 162, 246, 162, 246, -1, 137, 246, 162,
1868 246, 162, 246, -1, 132, 254, -1, 258, 195, 199,
1869 212, 245, 159, 255, 160, 201, -1, 261, -1, 36,
1870 -1, -1, 114, 210, 204, -1, 114, 210, 162, 11,
1871 245, 204, -1, 115, 210, 204, -1, 115, 210, 162,
1872 11, 245, 204, -1, 116, 246, -1, 260, 117, 210,
1873 245, 204, -1, 260, 118, 246, 162, 210, 245, 204,
1874 -1, 138, 210, 245, 162, 4, -1, 119, 210, 245,
1875 256, -1, 139, 210, 245, 257, -1, 140, 210, 245,
1876 162, 210, 245, 257, -1
1879 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1880 static const yytype_uint16 yyrline[] =
1882 0, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136,
1883 1136, 1137, 1137, 1137, 1137, 1137, 1137, 1138, 1138, 1138,
1884 1138, 1138, 1138, 1139, 1139, 1139, 1139, 1139, 1139, 1142,
1885 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1150,
1886 1150, 1151, 1151, 1152, 1152, 1153, 1153, 1154, 1154, 1155,
1887 1155, 1156, 1156, 1157, 1158, 1163, 1164, 1164, 1164, 1164,
1888 1164, 1166, 1166, 1166, 1167, 1167, 1169, 1170, 1174, 1178,
1889 1183, 1189, 1189, 1191, 1192, 1197, 1203, 1204, 1205, 1206,
1890 1207, 1208, 1212, 1213, 1214, 1218, 1219, 1220, 1221, 1225,
1891 1226, 1227, 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1241,
1892 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1257, 1258, 1259,
1893 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1270, 1271, 1276,
1894 1277, 1278, 1281, 1282, 1288, 1289, 1290, 1291, 1292, 1293,
1895 1294, 1295, 1296, 1297, 1300, 1301, 1307, 1308, 1315, 1316,
1896 1322, 1323, 1332, 1340, 1341, 1346, 1347, 1348, 1353, 1366,
1897 1366, 1366, 1366, 1366, 1366, 1366, 1369, 1373, 1377, 1384,
1898 1389, 1397, 1426, 1451, 1456, 1466, 1476, 1480, 1490, 1497,
1899 1506, 1513, 1518, 1523, 1530, 1531, 1538, 1545, 1553, 1559,
1900 1571, 1599, 1615, 1642, 1670, 1696, 1716, 1742, 1762, 1774,
1901 1781, 1847, 1857, 1867, 1873, 1883, 1889, 1899, 1905, 1911,
1902 1924, 1936, 1957, 1965, 1971, 1982, 1987, 1992, 1997, 2002,
1903 2008, 2014, 2020, 2028, 2039, 2043, 2051, 2051, 2054, 2054,
1904 2057, 2069, 2090, 2095, 2103, 2104, 2108, 2108, 2112, 2112,
1905 2115, 2118, 2142, 2154, 2153, 2165, 2164, 2174, 2173, 2184,
1906 2224, 2227, 2233, 2243, 2247, 2252, 2254, 2259, 2264, 2273,
1907 2283, 2294, 2298, 2307, 2316, 2321, 2470, 2470, 2472, 2481,
1908 2481, 2483, 2488, 2500, 2504, 2509, 2513, 2517, 2522, 2527,
1909 2531, 2535, 2539, 2543, 2547, 2551, 2573, 2595, 2601, 2614,
1910 2626, 2631, 2643, 2649, 2653, 2663, 2667, 2671, 2676, 2683,
1911 2683, 2689, 2698, 2703, 2708, 2712, 2721, 2730, 2743, 2752,
1912 2756, 2764, 2784, 2788, 2793, 2804, 2823, 2832, 2936, 2940,
1913 2947, 2958, 2971, 2980, 2993, 3004, 3014, 3025, 3033, 3043,
1914 3050, 3053, 3054, 3062, 3068, 3077, 3081, 3086, 3102, 3119,
1915 3131, 3143, 3157, 3171, 3183, 3204, 3211, 3217, 3223, 3229,
1916 3244, 3354, 3359, 3363, 3370, 3377, 3387, 3394, 3404, 3412,
1917 3426, 3443, 3457, 3472, 3487
1921 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1922 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1923 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1924 static const char *const yytname[] =
1926 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1927 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1928 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1929 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1930 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1931 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1932 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1933 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1934 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
1935 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1936 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1937 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1938 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1939 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1940 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1941 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1942 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1943 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1944 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1945 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1946 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1947 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1948 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1949 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1950 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1951 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1952 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1953 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1954 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1955 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1956 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1957 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
1958 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1959 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1960 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1961 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1962 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1963 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1964 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1965 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1966 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1967 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1968 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1969 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1970 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
1971 "OptVolatile", "MemoryInst", 0
1976 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1978 static const yytype_uint16 yytoknum[] =
1980 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1981 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1982 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1983 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1984 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1985 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1986 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1987 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1988 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1989 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1990 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1991 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1992 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1993 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1994 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1995 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
1996 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
2001 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2002 static const yytype_uint16 yyr1[] =
2004 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2005 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2006 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2007 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2008 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
2009 178, 178, 178, 178, 178, 179, 180, 180, 180, 180,
2010 180, 181, 181, 181, 182, 182, 183, 183, 184, 184,
2011 185, 186, 186, 187, 187, 188, 189, 189, 189, 189,
2012 189, 189, 190, 190, 190, 191, 191, 191, 191, 192,
2013 192, 192, 193, 193, 193, 193, 193, 194, 194, 194,
2014 195, 195, 195, 195, 195, 195, 195, 196, 196, 196,
2015 196, 196, 196, 196, 196, 196, 196, 197, 197, 198,
2016 198, 198, 199, 199, 200, 200, 200, 200, 200, 200,
2017 200, 200, 200, 200, 201, 201, 202, 202, 203, 203,
2018 204, 204, 205, 206, 206, 207, 207, 208, 208, 209,
2019 209, 209, 209, 209, 209, 209, 210, 210, 210, 210,
2020 210, 210, 210, 210, 210, 210, 210, 210, 210, 211,
2021 212, 212, 213, 213, 214, 214, 214, 214, 215, 215,
2022 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2023 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2024 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
2025 217, 217, 217, 217, 218, 218, 219, 219, 220, 220,
2026 221, 221, 222, 222, 223, 223, 225, 224, 226, 224,
2027 224, 224, 224, 227, 224, 228, 224, 229, 224, 224,
2028 224, 224, 230, 231, 231, 232, 233, 233, 233, 234,
2029 234, 235, 235, 235, 235, 236, 237, 237, 238, 239,
2030 239, 240, 241, 242, 242, 243, 243, 243, 243, 243,
2031 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2032 243, 243, 243, 243, 243, 244, 244, 244, 244, 245,
2033 245, 246, 247, 247, 248, 248, 249, 249, 250, 250,
2034 250, 251, 251, 251, 251, 251, 251, 251, 251, 251,
2035 252, 252, 253, 253, 254, 254, 255, 255, 255, 255,
2036 255, 256, 256, 257, 257, 258, 258, 259, 259, 259,
2037 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
2038 259, 259, 260, 260, 261, 261, 261, 261, 261, 261,
2039 261, 261, 261, 261, 261
2042 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2043 static const yytype_uint8 yyr2[] =
2045 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2046 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2047 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2048 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2049 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2050 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2051 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2052 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2054 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
2055 0, 1, 1, 1, 1, 1, 2, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 2, 0, 2, 1,
2057 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2059 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2060 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2061 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2062 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2063 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2064 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2065 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2066 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2067 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2068 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2069 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2070 3, 1, 3, 1, 0, 11, 1, 1, 4, 1,
2071 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2072 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2073 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2074 1, 2, 1, 3, 2, 2, 3, 3, 2, 0,
2075 1, 2, 2, 3, 9, 9, 8, 15, 1, 1,
2076 6, 5, 2, 2, 6, 7, 4, 4, 6, 6,
2077 0, 0, 3, 2, 3, 2, 1, 5, 5, 6,
2078 6, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2079 9, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2083 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2084 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2085 means the default is an error. */
2086 static const yytype_uint16 yydefact[] =
2088 74, 61, 71, 62, 72, 63, 228, 226, 0, 0,
2089 0, 0, 0, 0, 85, 73, 0, 74, 224, 89,
2090 92, 0, 0, 240, 0, 0, 68, 0, 75, 76,
2091 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
2092 88, 85, 85, 219, 1, 225, 90, 91, 85, 229,
2093 93, 94, 95, 96, 85, 299, 227, 299, 0, 0,
2094 248, 241, 242, 230, 285, 286, 232, 149, 150, 151,
2095 154, 153, 152, 155, 156, 0, 0, 0, 0, 287,
2096 288, 157, 231, 159, 219, 219, 97, 218, 0, 100,
2097 100, 300, 295, 69, 259, 260, 261, 294, 243, 244,
2098 247, 0, 177, 160, 0, 0, 0, 0, 166, 178,
2099 0, 0, 177, 0, 0, 0, 99, 98, 0, 216,
2100 217, 0, 0, 101, 102, 103, 104, 105, 122, 262,
2101 0, 0, 343, 343, 298, 0, 245, 176, 117, 172,
2102 174, 0, 0, 0, 0, 0, 0, 165, 0, 0,
2103 158, 0, 0, 171, 0, 170, 0, 239, 149, 150,
2104 151, 154, 153, 152, 0, 0, 67, 67, 106, 0,
2105 256, 257, 258, 70, 342, 326, 0, 0, 0, 0,
2106 100, 308, 309, 2, 3, 4, 5, 6, 7, 8,
2107 9, 10, 14, 15, 16, 11, 12, 13, 0, 0,
2108 0, 0, 0, 0, 0, 0, 17, 18, 19, 20,
2109 21, 22, 23, 24, 25, 26, 27, 28, 0, 0,
2110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 296, 100, 312, 0, 341, 297, 313, 246, 169, 0,
2112 134, 67, 67, 168, 0, 179, 0, 134, 67, 67,
2113 0, 220, 197, 198, 193, 195, 194, 196, 199, 192,
2114 188, 189, 0, 0, 0, 0, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 191, 190, 233, 121, 120, 119, 123, 0, 325, 302,
2117 67, 292, 301, 0, 0, 55, 0, 122, 29, 30,
2118 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
2119 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
2120 44, 45, 46, 47, 48, 0, 0, 0, 140, 140,
2121 348, 67, 67, 339, 0, 0, 0, 0, 0, 67,
2122 67, 67, 67, 67, 0, 122, 0, 0, 0, 108,
2123 110, 109, 107, 111, 112, 113, 114, 115, 118, 175,
2124 173, 162, 163, 164, 167, 66, 161, 235, 237, 0,
2125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2126 0, 181, 215, 0, 0, 0, 185, 0, 182, 0,
2127 0, 0, 145, 0, 265, 266, 267, 268, 269, 274,
2128 270, 271, 272, 273, 263, 0, 0, 0, 0, 283,
2129 290, 289, 291, 0, 0, 303, 0, 0, 67, 67,
2130 67, 67, 0, 344, 0, 346, 321, 0, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 67, 0, 116, 128, 127, 124, 126, 125, 129,
2133 130, 133, 131, 132, 135, 145, 145, 0, 0, 0,
2134 0, 0, 321, 0, 0, 0, 0, 0, 0, 0,
2135 180, 166, 178, 0, 183, 184, 0, 0, 0, 0,
2136 234, 254, 264, 0, 277, 0, 0, 0, 280, 0,
2137 278, 293, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 352, 0, 0, 0, 335, 336, 0, 0,
2139 0, 0, 353, 0, 0, 0, 333, 0, 140, 0,
2140 236, 238, 67, 0, 0, 0, 0, 0, 0, 0,
2141 0, 0, 0, 0, 214, 187, 0, 0, 0, 0,
2142 0, 0, 147, 145, 253, 117, 251, 0, 0, 276,
2143 166, 0, 275, 279, 0, 0, 0, 0, 0, 0,
2144 0, 140, 141, 140, 0, 0, 0, 0, 0, 0,
2145 351, 323, 0, 67, 327, 328, 0, 0, 349, 67,
2146 221, 0, 0, 0, 0, 201, 0, 0, 0, 0,
2147 212, 0, 186, 0, 0, 67, 142, 148, 146, 65,
2148 0, 134, 0, 282, 0, 0, 0, 320, 329, 330,
2149 331, 332, 345, 347, 322, 0, 0, 334, 337, 338,
2150 324, 0, 320, 140, 0, 0, 0, 0, 0, 209,
2151 0, 0, 0, 203, 204, 200, 64, 250, 252, 117,
2152 143, 284, 281, 0, 0, 117, 117, 0, 314, 0,
2153 354, 0, 350, 205, 206, 207, 208, 0, 0, 0,
2154 213, 65, 144, 138, 0, 306, 0, 0, 0, 0,
2155 134, 0, 315, 134, 202, 210, 211, 249, 0, 136,
2156 304, 0, 305, 0, 108, 110, 117, 117, 0, 117,
2157 117, 340, 139, 0, 255, 0, 0, 317, 316, 0,
2158 0, 0, 137, 0, 0, 0, 117, 117, 311, 0,
2159 0, 319, 318, 310, 0, 0, 307
2162 /* YYDEFGOTO[NTERM-NUM]. */
2163 static const yytype_int16 yydefgoto[] =
2165 -1, 277, 278, 279, 308, 325, 164, 165, 79, 637,
2166 113, 12, 133, 80, 14, 15, 41, 42, 43, 48,
2167 54, 118, 128, 358, 238, 286, 169, 454, 361, 694,
2168 679, 423, 542, 663, 480, 543, 81, 166, 139, 156,
2169 140, 141, 110, 382, 409, 383, 121, 88, 157, 16,
2170 17, 18, 20, 19, 392, 455, 456, 63, 23, 61,
2171 101, 546, 547, 129, 172, 55, 96, 56, 49, 483,
2172 410, 83, 412, 291, 292, 57, 92, 93, 230, 667,
2173 134, 333, 647, 502, 512, 231, 232, 233, 234
2176 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2178 #define YYPACT_NINF -620
2179 static const yytype_int16 yypact[] =
2181 484, -620, -620, -620, -620, -620, -620, -620, -14, -116,
2182 -6, -83, 104, -31, 24, -620, 161, 528, -620, 238,
2183 204, 43, 49, -620, 5, 196, -620, 1912, -620, -620,
2184 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2185 -620, 173, 173, 227, -620, -620, -620, -620, 173, -620,
2186 -620, -620, -620, -620, 173, 202, -620, -9, 234, 243,
2187 246, -620, -620, -620, -620, -620, 67, -620, -620, -620,
2188 -620, -620, -620, -620, -620, 273, 285, 3, 624, -620,
2189 -620, -620, 4, -620, 201, 201, 253, -620, 81, 240,
2190 240, -620, -620, 39, -620, -620, -620, -620, -620, -620,
2191 -620, -59, 1564, -620, 128, 132, 643, 67, -620, 4,
2192 -114, 165, 1564, 145, 81, 81, -620, -620, 1605, -620,
2193 -620, 2014, 324, -620, -620, -620, -620, -620, -620, -620,
2194 -13, 188, 2299, 2299, -620, 328, -620, -620, 4, -620,
2195 189, 194, 2076, 2076, 186, -111, 2076, -620, 352, 205,
2196 -620, 2014, 2076, 67, 208, 4, 247, -620, 216, 351,
2197 355, 359, 365, 368, 269, 372, 1625, 306, -620, 1517,
2198 -620, -620, -620, -620, -620, -620, 325, 2094, 38, 373,
2199 240, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2200 -620, -620, -620, -620, -620, -620, -620, -620, 298, 336,
2201 298, 336, 2076, 2076, 2076, 2076, -620, -620, -620, -620,
2202 -620, -620, -620, -620, -620, -620, -620, -620, 2076, 2076,
2203 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076,
2204 -620, 240, -620, 66, -620, -620, -620, -620, 231, 1791,
2205 -620, -17, -21, -620, 214, 4, 225, -620, 306, -5,
2206 1605, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2207 -620, -620, 298, 336, 298, 336, 229, 230, 249, 250,
2208 251, 252, 256, 1809, 2117, 690, 364, 257, 259, 261,
2209 -620, -620, -620, -620, -620, -620, -620, 114, -620, 67,
2210 1019, -620, 262, 1189, 1189, -620, 1189, -620, -620, -620,
2211 -620, -620, -620, -620, -620, -620, -620, -620, 2076, -620,
2212 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2213 -620, -620, -620, -620, -620, 2076, 2076, 2076, -23, 28,
2214 -620, 1019, -18, 265, 266, 268, 272, 288, 289, 1019,
2215 1019, 1019, 1019, 1019, 383, -620, 2076, 2076, 398, -620,
2216 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2217 -620, 137, -620, -620, -620, -620, 137, -620, 145, 385,
2218 293, 294, 295, 297, 2014, 2014, 2014, 2014, 2014, 2014,
2219 2014, -620, -620, -56, 1069, -74, -620, -80, -620, 2014,
2220 2014, 2014, 296, 300, -620, -620, -620, -620, -620, -620,
2221 -620, -620, -620, -620, 396, 1832, 2135, 1239, 403, -620,
2222 -620, -620, -620, 2076, 299, -620, 301, 1517, 1019, 1019,
2223 1019, 1019, 8, -620, 33, -620, -620, 1189, 303, 2076,
2224 2076, 2076, 2076, 2076, 302, 304, 307, 308, 309, 2076,
2225 1517, 1019, 312, -620, -620, -620, -620, -620, -620, -620,
2226 -620, -620, -620, -620, -620, 296, 296, 2076, 2014, 2014,
2227 2014, 2014, -620, 317, 318, 319, 320, 304, 323, 2014,
2228 -620, 326, 1471, -77, -620, -620, 327, 330, 424, 2,
2229 -620, 1850, -620, 443, -620, -52, 1280, -73, -620, -72,
2230 -620, -620, 469, 471, 1189, 332, 334, 337, 338, 1189,
2231 494, 1189, 339, 343, 1189, 347, 4, -620, 348, 349,
2232 508, 519, 362, 2076, 1189, 1189, 4, 1189, 363, 2076,
2233 -620, -620, 26, 367, 375, 377, 387, 149, 2014, 2014,
2234 2014, 2014, 157, 2014, -620, -620, 357, 2014, 2014, 2076,
2235 505, 526, -620, 296, -620, 4, 391, 394, 393, -620,
2236 366, -62, -620, -620, 1189, 1189, 386, 1189, 1189, 1189,
2237 1189, 363, -620, 363, 2076, 1189, 395, 2076, 2076, 2076,
2238 -620, -620, 552, 1019, -620, -620, 405, 511, -620, 1019,
2239 -620, 2014, 2014, 2014, 2014, -620, 400, 406, 407, 408,
2240 -620, 304, -620, 411, 412, 57, -620, -620, -620, 11,
2241 1891, -620, 545, -620, 399, 413, 414, 2179, -620, -620,
2242 -620, -620, -620, -620, -620, 409, 1189, -620, -620, -620,
2243 -620, 304, 2179, 363, 417, 418, 423, 425, 2014, -620,
2244 2014, 2014, 180, -620, -620, -620, -620, -620, -620, 4,
2245 172, -620, -620, 556, -3, 46, 4, 181, -620, 422,
2246 362, 184, -620, -620, -620, -620, -620, 430, 431, 432,
2247 -620, 11, -620, 539, 1189, -620, 1337, -1, 865, 865,
2248 -620, 2197, -620, -620, -620, -620, -620, -620, 590, 445,
2249 -620, 433, -620, 1337, 446, 453, -620, -620, 86, 46,
2250 4, 137, -620, 582, -620, 596, 452, 231, 231, 598,
2251 865, 865, -620, 1189, 599, 1189, -620, -620, -620, 1189,
2252 544, 231, 231, -620, 603, 1189, -620
2255 /* YYPGOTO[NTERM-NUM]. */
2256 static const yytype_int16 yypgoto[] =
2258 -620, 42, 112, 200, -160, -158, -177, -620, 0, -39,
2259 -151, 531, -620, 9, -620, -620, -620, -620, 77, -620,
2260 -620, -620, -152, -620, -518, -620, -268, -620, -244, -620,
2261 -620, -311, -15, -620, -414, -620, -620, -26, 389, -164,
2262 -620, 514, 523, 142, -162, -261, 220, 263, 380, -620,
2263 -620, 625, -620, -620, -620, -620, -620, -620, -620, -620,
2264 -620, -620, -620, 559, -620, -620, -620, -620, -620, -620,
2265 -619, -82, 267, -198, -620, -620, 595, -620, 535, -620,
2266 -620, -620, 47, 215, -456, -620, 543, -620, -620
2269 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2270 positive, shift that token. If negative, reduce the rule which
2271 number is the opposite. If zero, do what YYDEFACT says.
2272 If YYTABLE_NINF, syntax error. */
2273 #define YYTABLE_NINF -224
2274 static const yytype_int16 yytable[] =
2276 11, 82, 296, 366, 280, 287, 330, 105, 295, 13,
2277 295, 532, 91, 385, 387, 170, 282, 11, 425, 499,
2278 94, 334, 335, 336, 337, 338, 13, 599, 297, 417,
2279 1, 344, 111, 3, 111, 5, 540, 111, 111, 21,
2280 326, 520, 521, 327, 501, 24, 131, 681, 146, 293,
2281 111, 146, 109, 25, 22, 294, 541, 147, 1, 111,
2282 244, 3, 500, 5, 696, 348, 29, 30, 31, 32,
2283 33, 34, 35, 36, 251, 37, 138, 440, 26, 345,
2284 109, 111, 469, 111, 281, 469, 138, 500, 469, 469,
2285 469, 475, 155, 11, 536, 474, 552, 367, 368, 553,
2286 469, -155, 370, 135, 372, 371, 469, 373, 136, 604,
2287 469, 470, 111, 119, 120, 549, 241, 242, 84, 85,
2288 245, 661, 27, 473, 699, 89, 249, 668, 669, 598,
2289 28, 90, 349, 350, 2, 632, 112, 4, 112, 422,
2290 -67, 112, 112, 155, 485, 487, 489, 427, 363, 442,
2291 362, 290, 351, 352, 112, 353, 354, 171, 355, 356,
2292 357, 44, 95, 112, 665, 650, 682, -67, 697, 698,
2293 60, 700, 701, 106, 227, 227, 328, 329, 290, 331,
2294 38, 39, 40, 346, 347, 112, 580, 112, 711, 712,
2295 424, -67, 332, 290, 290, 290, 290, 290, 339, 340,
2296 341, 342, 343, 290, 58, -155, 540, 578, 411, -155,
2297 59, 411, 411, 138, 411, 491, 112, 635, 62, -55,
2298 -55, -55, -55, 91, 155, 551, 102, 444, 445, 446,
2299 447, 505, 448, 507, 508, 509, 449, 450, 87, 451,
2300 452, 453, 252, 253, 228, 228, 50, 51, 52, 411,
2301 612, 53, 613, 494, 64, 65, 98, 411, 411, 411,
2302 411, 411, 86, 167, 87, 99, 1, 2, 100, 3,
2303 4, 5, 254, 255, 256, 257, 517, 103, 444, 445,
2304 446, 447, 418, 448, 46, 348, 47, 449, 450, 104,
2305 451, 452, 453, 248, 142, 116, 393, 117, 143, 419,
2306 420, 421, 122, 123, 124, 125, 126, 127, 150, 585,
2307 280, 564, 652, 444, 445, 446, 447, 590, 448, 572,
2308 441, 290, 449, 450, 148, 451, 452, 453, 168, 38,
2309 39, 40, 229, 229, 151, 152, 411, 411, 411, 411,
2310 660, 670, 572, 671, 673, 411, 671, 114, 115, 173,
2311 237, 239, 349, 350, 240, 243, 246, 640, 472, 411,
2312 -56, 111, 309, 310, -57, 247, 614, 250, -60, 617,
2313 618, 619, 351, 352, -59, 353, 354, -58, 355, 356,
2314 357, 258, 288, 364, 295, 365, 388, 290, 374, 375,
2315 281, 155, 298, 299, 300, 301, 302, 303, 304, 305,
2316 306, 307, 443, 290, 506, 290, 290, 290, 376, 377,
2317 378, 379, 411, 516, 155, 380, 389, 411, 390, 411,
2318 391, 439, 411, 457, 413, 490, 688, 428, 429, 691,
2319 430, 522, 411, 411, 431, 411, 311, 312, 313, 314,
2320 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2321 432, 433, 458, 459, 460, 545, 461, 482, 479, 481,
2322 472, 492, 539, 493, 510, 548, 511, 666, 504, 513,
2323 514, 515, 411, 411, 519, 411, 411, 411, 411, 528,
2324 529, 530, 531, 411, -223, 533, 554, 573, 555, 537,
2325 683, 411, 538, 579, 557, 535, 558, 411, 562, 559,
2326 560, 564, -69, 1, 2, 565, 3, 4, 5, 567,
2327 568, 569, 570, 595, 6, 7, 462, 463, 464, 465,
2328 466, 467, 468, 571, 572, 577, 592, 596, -222, 581,
2329 597, 476, 477, 478, 411, 603, 8, 582, 290, 583,
2330 9, 290, 290, 290, 10, 607, -69, 1, 2, 584,
2331 3, 4, 5, 600, 601, 602, 620, 616, 6, 7,
2332 414, 415, 628, 416, 622, 500, 629, 641, 642, 630,
2333 631, 633, 634, 664, 639, 643, 648, 653, 654, 644,
2334 8, 646, 411, 655, 9, 656, 411, 411, 10, 672,
2335 674, 675, 676, 678, 692, 695, 646, 693, 426, 636,
2336 523, 524, 525, 526, 702, -18, 434, 435, 436, 437,
2337 438, 534, -19, 703, 704, 705, 709, 714, 411, 411,
2338 715, 411, 677, 411, 132, 662, 149, 411, 360, 145,
2339 369, 64, 65, 411, 107, 67, 68, 69, 70, 71,
2340 72, 73, 45, 1, 2, 690, 3, 4, 5, 130,
2341 64, 65, 97, 107, 67, 68, 69, 70, 71, 72,
2342 73, 636, 1, 2, 0, 3, 4, 5, 235, 651,
2343 586, 587, 588, 589, 74, 591, 236, 527, 0, 593,
2344 594, 0, 0, 0, 0, 495, 496, 497, 498, 0,
2345 0, 0, 0, 74, 503, 0, 0, 64, 65, 0,
2346 107, 158, 159, 160, 161, 162, 163, 73, 518, 1,
2347 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2348 0, 0, 0, 624, 625, 626, 627, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2350 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2351 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2352 0, 556, 0, 0, 0, 0, 561, 0, 563, 0,
2353 657, 566, 658, 659, 0, 0, 0, 0, 0, 0,
2354 0, 574, 575, 0, 576, 0, 0, 0, 75, 76,
2355 0, 0, 77, 0, 78, 108, 0, 0, 0, 0,
2356 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2357 0, 77, 0, 78, 144, 0, 0, 0, 0, 0,
2358 0, 605, 606, 0, 608, 609, 610, 611, 0, 0,
2359 0, 0, 615, 0, 0, 0, 0, 0, 0, 0,
2360 621, 0, 0, 0, 0, 0, 623, 0, 0, 0,
2361 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2362 78, 386, 0, 0, 0, 0, 0, 0, 394, 395,
2363 396, 397, 64, 65, 398, 0, 0, 0, 0, 0,
2364 0, 0, 0, 649, 1, 2, 0, 3, 4, 5,
2365 399, 400, 401, 0, 0, 0, 0, 0, 0, 0,
2366 0, 0, 0, 0, 0, 402, 403, 0, 0, 0,
2367 0, 0, 0, 0, 0, 0, 0, 0, 0, 348,
2368 0, 0, 0, 0, 404, 0, 0, 0, 0, 0,
2369 0, 680, 0, 0, 0, 686, 687, 0, 0, 0,
2370 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2371 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2372 0, 0, 0, 0, 0, 0, 0, 706, 707, 0,
2373 708, 0, 710, 0, 0, 0, 713, 0, 0, 0,
2374 0, 0, 716, 0, 266, 206, 684, 685, 209, 210,
2375 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2376 268, 269, 270, 0, 271, 272, 351, 352, 0, 353,
2377 354, 0, 355, 356, 357, 0, 0, 0, 0, 0,
2378 0, 0, 394, 395, 396, 397, 64, 65, 398, 0,
2379 405, 0, 0, 406, 0, 407, 0, 408, 1, 2,
2380 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2382 403, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2383 0, 0, 0, 0, 111, 0, 64, 65, 404, 107,
2384 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2385 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2386 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2387 263, 264, 265, 0, 0, 0, 0, 0, 0, 74,
2388 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2389 0, 0, 0, 0, 0, 0, 0, 0, 266, 206,
2390 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2391 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
2392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2393 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2394 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2395 0, 408, 394, 395, 396, 397, 64, 65, 398, 0,
2396 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2397 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2398 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2399 403, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2400 471, 0, 0, 0, 0, 0, 64, 65, 404, 107,
2401 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2402 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2403 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2404 263, 264, 265, 0, 0, 0, 0, 64, 65, 74,
2405 107, 158, 159, 160, 161, 162, 163, 73, 0, 1,
2406 2, 0, 3, 4, 5, 0, 0, 0, 266, 206,
2407 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2408 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
2409 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2410 394, 395, 396, 397, 0, 0, 398, 0, 0, 0,
2411 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2412 0, 408, 399, 400, 401, 0, 0, 0, 0, 0,
2413 0, 0, 0, 0, 0, 0, 0, 402, 403, 0,
2414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 0, 0, 0, 0, 0, 404, 0, 0, 0,
2416 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2417 488, 0, 183, 184, 185, 186, 187, 188, 189, 190,
2418 191, 192, 193, 194, 195, 196, 197, 262, 263, 264,
2419 265, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2420 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2421 78, 550, 0, 0, 0, 0, 266, 206, 207, 208,
2422 209, 210, 211, 212, 213, 214, 215, 216, 217, 0,
2423 267, 0, 268, 269, 270, 0, 271, 272, 64, 65,
2424 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2425 1, 2, 0, 3, 4, 5, 259, 0, 0, 0,
2426 0, 0, 405, 0, 0, 406, 0, 407, 0, 408,
2427 0, 260, 261, 0, 0, 0, 0, 0, 0, 0,
2428 0, 0, 0, 0, 64, 65, 111, 153, 67, 68,
2429 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2430 4, 5, 0, 0, 0, 0, 183, 184, 185, 186,
2431 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
2432 197, 262, 263, 264, 265, 0, 0, 74, 0, 0,
2433 0, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2434 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2435 266, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2436 215, 216, 217, 137, 267, 0, 268, 269, 270, 0,
2437 271, 272, 64, 65, 74, 153, 67, 68, 69, 70,
2438 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2439 112, 0, 64, 65, -67, 0, 273, 0, 0, 274,
2440 0, 275, 0, 276, 1, 2, 0, 3, 4, 5,
2441 259, 0, 0, 0, 0, 74, 0, 0, 283, 284,
2442 0, 285, 0, 0, 0, 260, 261, 0, 0, 0,
2443 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2444 111, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2446 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2447 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2448 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2449 154, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2450 0, 0, 0, 0, 266, 206, 207, 208, 209, 210,
2451 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2452 268, 269, 270, 0, 271, 272, 0, 0, 0, 75,
2453 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2454 0, 0, 0, 0, 112, 0, 0, 0, 0, 0,
2455 273, 0, 0, 274, 0, 275, 0, 276, 64, 65,
2456 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2457 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2458 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2459 359, 3, 4, 5, 0, 0, 0, 0, 0, 64,
2460 65, 74, 107, 158, 159, 160, 161, 162, 163, 73,
2461 0, 1, 2, 0, 3, 4, 5, 64, 65, 74,
2462 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2463 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2464 0, 0, 74, 0, 0, 0, 0, 0, 0, 544,
2465 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2466 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2467 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2468 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
2469 638, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2470 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2471 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2472 0, 78, 74, 0, 0, 0, 0, 0, 0, 0,
2473 0, 0, 0, 75, 76, 0, 381, 77, 0, 78,
2474 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2475 0, 0, 0, 0, 0, 0, 75, 76, 0, 484,
2476 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2477 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2478 78, 64, 65, 0, 107, 158, 159, 160, 161, 162,
2479 163, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2480 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2481 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2482 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2483 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2484 77, 0, 78, 64, 65, 0, 107, 67, 68, 69,
2485 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2486 5, 64, 65, 0, 289, 67, 68, 69, 70, 71,
2487 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2488 0, 0, 0, 0, 64, 65, 74, 107, 158, 159,
2489 160, 161, 162, 163, 73, 0, 1, 2, 0, 3,
2490 4, 5, 64, 65, 74, 107, 158, 159, 160, 161,
2491 162, 163, 73, 0, 1, 2, 0, 3, 4, 5,
2492 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2493 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2494 0, 0, 77, 0, 78, 74, 64, 65, 0, 107,
2495 67, 68, 69, 70, 71, 72, 645, 0, 1, 2,
2496 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
2497 69, 70, 71, 72, 689, 0, 1, 2, 0, 3,
2498 4, 5, 0, 0, 0, 0, 0, 0, 0, 74,
2499 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2500 75, 76, 0, 0, 77, 0, 78, 74, 0, 0,
2501 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2502 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2503 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2504 0, 75, 76, 0, 0, 77, 0, 384, 0, 0,
2505 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2506 76, 0, 0, 77, 0, 486, 0, 0, 0, 0,
2507 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2508 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2509 0, 0, 0, 0, 0, 174, 0, 0, 0, 0,
2510 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2511 0, 0, 0, 0, 0, 0, 175, 176, 0, 0,
2512 0, 75, 76, 0, 0, 77, 0, 78, 177, 178,
2513 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2514 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2515 199, 200, 201, 0, 0, 0, 0, 0, 0, 0,
2516 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2517 0, 0, 0, 202, 203, 204, 0, 0, 205, 206,
2518 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2519 217, 218, 219, 220, 221, 222, 223, 224, 225, 226
2522 static const yytype_int16 yycheck[] =
2524 0, 27, 179, 247, 166, 169, 204, 4, 11, 0,
2525 11, 467, 21, 274, 275, 28, 167, 17, 329, 11,
2526 29, 219, 220, 221, 222, 223, 17, 545, 180, 297,
2527 19, 229, 55, 22, 55, 24, 34, 55, 55, 53,
2528 200, 455, 456, 201, 11, 161, 7, 666, 162, 11,
2529 55, 162, 78, 59, 68, 17, 54, 171, 19, 55,
2530 171, 22, 54, 24, 683, 54, 42, 43, 44, 45,
2531 46, 47, 48, 49, 156, 51, 102, 345, 161, 231,
2532 106, 55, 162, 55, 166, 162, 112, 54, 162, 162,
2533 162, 171, 118, 93, 171, 169, 169, 248, 249, 171,
2534 162, 55, 262, 162, 264, 263, 162, 265, 167, 171,
2535 162, 167, 55, 32, 33, 167, 142, 143, 41, 42,
2536 146, 639, 18, 384, 38, 48, 152, 645, 646, 543,
2537 161, 54, 121, 122, 20, 591, 159, 23, 159, 162,
2538 163, 159, 159, 169, 405, 406, 407, 165, 169, 347,
2539 167, 177, 141, 142, 159, 144, 145, 170, 147, 148,
2540 149, 0, 171, 159, 167, 621, 167, 163, 686, 687,
2541 165, 689, 690, 170, 132, 133, 202, 203, 204, 205,
2542 156, 157, 158, 117, 118, 159, 160, 159, 706, 707,
2543 162, 163, 218, 219, 220, 221, 222, 223, 224, 225,
2544 226, 227, 228, 229, 161, 159, 34, 518, 290, 163,
2545 161, 293, 294, 239, 296, 413, 159, 160, 22, 3,
2546 4, 5, 6, 21, 250, 486, 159, 141, 142, 143,
2547 144, 429, 146, 431, 432, 433, 150, 151, 37, 153,
2548 154, 155, 26, 27, 132, 133, 42, 43, 44, 331,
2549 561, 47, 563, 417, 7, 8, 22, 339, 340, 341,
2550 342, 343, 35, 121, 37, 22, 19, 20, 22, 22,
2551 23, 24, 3, 4, 5, 6, 440, 4, 141, 142,
2552 143, 144, 308, 146, 46, 54, 48, 150, 151, 4,
2553 153, 154, 155, 151, 166, 42, 287, 44, 166, 325,
2554 326, 327, 62, 63, 64, 65, 66, 67, 163, 160,
2555 472, 162, 623, 141, 142, 143, 144, 160, 146, 162,
2556 346, 347, 150, 151, 159, 153, 154, 155, 4, 156,
2557 157, 158, 132, 133, 114, 115, 418, 419, 420, 421,
2558 160, 160, 162, 162, 160, 427, 162, 84, 85, 161,
2559 22, 162, 121, 122, 160, 169, 4, 601, 384, 441,
2560 9, 55, 26, 27, 9, 160, 564, 159, 9, 567,
2561 568, 569, 141, 142, 9, 144, 145, 9, 147, 148,
2562 149, 9, 57, 169, 11, 160, 22, 413, 159, 159,
2563 472, 417, 94, 95, 96, 97, 98, 99, 100, 101,
2564 102, 103, 4, 429, 430, 431, 432, 433, 159, 159,
2565 159, 159, 494, 439, 440, 159, 159, 499, 159, 501,
2566 159, 38, 504, 38, 162, 22, 670, 162, 162, 673,
2567 162, 457, 514, 515, 162, 517, 100, 101, 102, 103,
2568 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
2569 162, 162, 159, 159, 159, 481, 159, 61, 162, 159,
2570 486, 162, 38, 162, 162, 22, 162, 644, 165, 162,
2571 162, 162, 554, 555, 162, 557, 558, 559, 560, 162,
2572 162, 162, 162, 565, 0, 162, 17, 513, 17, 162,
2573 667, 573, 162, 519, 162, 169, 162, 579, 4, 162,
2574 162, 162, 18, 19, 20, 162, 22, 23, 24, 162,
2575 162, 162, 4, 539, 30, 31, 374, 375, 376, 377,
2576 378, 379, 380, 4, 162, 162, 169, 22, 0, 162,
2577 4, 389, 390, 391, 616, 169, 52, 162, 564, 162,
2578 56, 567, 568, 569, 60, 159, 18, 19, 20, 162,
2579 22, 23, 24, 162, 160, 162, 4, 162, 30, 31,
2580 293, 294, 162, 296, 159, 54, 160, 22, 169, 162,
2581 162, 160, 160, 17, 600, 162, 167, 160, 160, 165,
2582 52, 607, 664, 160, 56, 160, 668, 669, 60, 167,
2583 160, 160, 160, 54, 4, 162, 622, 152, 331, 599,
2584 458, 459, 460, 461, 22, 159, 339, 340, 341, 342,
2585 343, 469, 159, 17, 162, 17, 17, 73, 700, 701,
2586 17, 703, 661, 705, 93, 640, 112, 709, 239, 106,
2587 250, 7, 8, 715, 10, 11, 12, 13, 14, 15,
2588 16, 17, 17, 19, 20, 671, 22, 23, 24, 90,
2589 7, 8, 57, 10, 11, 12, 13, 14, 15, 16,
2590 17, 661, 19, 20, -1, 22, 23, 24, 133, 622,
2591 528, 529, 530, 531, 50, 533, 133, 462, -1, 537,
2592 538, -1, -1, -1, -1, 418, 419, 420, 421, -1,
2593 -1, -1, -1, 50, 427, -1, -1, 7, 8, -1,
2594 10, 11, 12, 13, 14, 15, 16, 17, 441, 19,
2595 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2596 -1, -1, -1, 581, 582, 583, 584, -1, -1, -1,
2597 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2598 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2599 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2600 -1, 494, -1, -1, -1, -1, 499, -1, 501, -1,
2601 628, 504, 630, 631, -1, -1, -1, -1, -1, -1,
2602 -1, 514, 515, -1, 517, -1, -1, -1, 164, 165,
2603 -1, -1, 168, -1, 170, 171, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, -1, -1, 164, 165, -1,
2605 -1, 168, -1, 170, 171, -1, -1, -1, -1, -1,
2606 -1, 554, 555, -1, 557, 558, 559, 560, -1, -1,
2607 -1, -1, 565, -1, -1, -1, -1, -1, -1, -1,
2608 573, -1, -1, -1, -1, -1, 579, -1, -1, -1,
2609 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2610 170, 171, -1, -1, -1, -1, -1, -1, 3, 4,
2611 5, 6, 7, 8, 9, -1, -1, -1, -1, -1,
2612 -1, -1, -1, 616, 19, 20, -1, 22, 23, 24,
2613 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2614 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2615 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2616 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2617 -1, 664, -1, -1, -1, 668, 669, -1, -1, -1,
2618 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2619 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2620 -1, -1, -1, -1, -1, -1, -1, 700, 701, -1,
2621 703, -1, 705, -1, -1, -1, 709, -1, -1, -1,
2622 -1, -1, 715, -1, 119, 120, 121, 122, 123, 124,
2623 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2624 135, 136, 137, -1, 139, 140, 141, 142, -1, 144,
2625 145, -1, 147, 148, 149, -1, -1, -1, -1, -1,
2626 -1, -1, 3, 4, 5, 6, 7, 8, 9, -1,
2627 165, -1, -1, 168, -1, 170, -1, 172, 19, 20,
2628 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2629 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2630 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2631 -1, -1, -1, -1, 55, -1, 7, 8, 59, 10,
2632 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2633 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2634 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2635 91, 92, 93, -1, -1, -1, -1, -1, -1, 50,
2636 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2637 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2638 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2639 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2640 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2641 -1, -1, -1, -1, -1, -1, -1, -1, 159, -1,
2642 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2643 -1, 172, 3, 4, 5, 6, 7, 8, 9, -1,
2644 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2645 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2646 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2647 41, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2648 171, -1, -1, -1, -1, -1, 7, 8, 59, 10,
2649 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2650 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2651 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2652 91, 92, 93, -1, -1, -1, -1, 7, 8, 50,
2653 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2654 20, -1, 22, 23, 24, -1, -1, -1, 119, 120,
2655 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2656 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2657 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2658 3, 4, 5, 6, -1, -1, 9, -1, -1, -1,
2659 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2660 -1, 172, 25, 26, 27, -1, -1, -1, -1, -1,
2661 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2662 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2663 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2664 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2665 171, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2666 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2667 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2668 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2669 170, 171, -1, -1, -1, -1, 119, 120, 121, 122,
2670 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2671 133, -1, 135, 136, 137, -1, 139, 140, 7, 8,
2672 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2673 19, 20, -1, 22, 23, 24, 25, -1, -1, -1,
2674 -1, -1, 165, -1, -1, 168, -1, 170, -1, 172,
2675 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2676 -1, -1, -1, -1, 7, 8, 55, 10, 11, 12,
2677 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2678 23, 24, -1, -1, -1, -1, 75, 76, 77, 78,
2679 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2680 89, 90, 91, 92, 93, -1, -1, 50, -1, -1,
2681 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2682 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2683 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2684 129, 130, 131, 39, 133, -1, 135, 136, 137, -1,
2685 139, 140, 7, 8, 50, 10, 11, 12, 13, 14,
2686 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2687 159, -1, 7, 8, 163, -1, 165, -1, -1, 168,
2688 -1, 170, -1, 172, 19, 20, -1, 22, 23, 24,
2689 25, -1, -1, -1, -1, 50, -1, -1, 141, 142,
2690 -1, 144, -1, -1, -1, 40, 41, -1, -1, -1,
2691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 55, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2693 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2694 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2695 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2696 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2697 125, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2698 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2699 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2700 135, 136, 137, -1, 139, 140, -1, -1, -1, 164,
2701 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
2702 -1, -1, -1, -1, 159, -1, -1, -1, -1, -1,
2703 165, -1, -1, 168, -1, 170, -1, 172, 7, 8,
2704 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2705 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2706 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2707 39, 22, 23, 24, -1, -1, -1, -1, -1, 7,
2708 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2709 -1, 19, 20, -1, 22, 23, 24, 7, 8, 50,
2710 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2711 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2712 -1, -1, 50, -1, -1, -1, -1, -1, -1, 39,
2713 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2714 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2715 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2716 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2717 39, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2718 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2719 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2720 -1, 170, 50, -1, -1, -1, -1, -1, -1, -1,
2721 -1, -1, -1, 164, 165, -1, 167, 168, -1, 170,
2722 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2723 -1, -1, -1, -1, -1, -1, 164, 165, -1, 167,
2724 168, -1, 170, -1, -1, -1, -1, -1, -1, -1,
2725 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2726 170, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2727 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2728 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2729 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2730 -1, 170, -1, -1, 50, -1, -1, -1, -1, -1,
2731 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2732 168, -1, 170, 7, 8, -1, 10, 11, 12, 13,
2733 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2734 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2735 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2736 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2737 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2738 23, 24, 7, 8, 50, 10, 11, 12, 13, 14,
2739 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2740 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2741 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2742 -1, -1, 168, -1, 170, 50, 7, 8, -1, 10,
2743 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2744 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2745 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2746 23, 24, -1, -1, -1, -1, -1, -1, -1, 50,
2747 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2748 164, 165, -1, -1, 168, -1, 170, 50, -1, -1,
2749 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2750 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2751 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2752 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2753 -1, -1, -1, -1, -1, -1, -1, -1, -1, 164,
2754 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
2755 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2756 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2757 -1, -1, -1, -1, -1, 36, -1, -1, -1, -1,
2758 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2759 -1, -1, -1, -1, -1, -1, 57, 58, -1, -1,
2760 -1, 164, 165, -1, -1, 168, -1, 170, 69, 70,
2761 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2762 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2763 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
2764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2765 -1, -1, -1, 114, 115, 116, -1, -1, 119, 120,
2766 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2767 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
2770 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2771 symbol of state STATE-NUM. */
2772 static const yytype_uint16 yystos[] =
2774 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2775 60, 181, 184, 186, 187, 188, 222, 223, 224, 226,
2776 225, 53, 68, 231, 161, 59, 161, 18, 161, 42,
2777 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
2778 158, 189, 190, 191, 0, 224, 46, 48, 192, 241,
2779 42, 43, 44, 47, 193, 238, 240, 248, 161, 161,
2780 165, 232, 22, 230, 7, 8, 10, 11, 12, 13,
2781 14, 15, 16, 17, 50, 164, 165, 168, 170, 181,
2782 186, 209, 210, 244, 191, 191, 35, 37, 220, 191,
2783 191, 21, 249, 250, 29, 171, 239, 249, 22, 22,
2784 22, 233, 159, 4, 4, 4, 170, 10, 171, 210,
2785 215, 55, 159, 183, 220, 220, 42, 44, 194, 32,
2786 33, 219, 62, 63, 64, 65, 66, 67, 195, 236,
2787 236, 7, 184, 185, 253, 162, 167, 39, 210, 211,
2788 213, 214, 166, 166, 171, 215, 162, 171, 159, 214,
2789 163, 219, 219, 10, 125, 210, 212, 221, 11, 12,
2790 13, 14, 15, 16, 179, 180, 210, 216, 4, 199,
2791 28, 170, 237, 161, 36, 57, 58, 69, 70, 71,
2792 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2793 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2794 92, 93, 114, 115, 116, 119, 120, 121, 122, 123,
2795 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
2796 134, 135, 136, 137, 138, 139, 140, 174, 175, 176,
2797 251, 258, 259, 260, 261, 251, 259, 22, 197, 162,
2798 160, 210, 210, 169, 171, 210, 4, 160, 216, 210,
2799 159, 244, 26, 27, 3, 4, 5, 6, 9, 25,
2800 40, 41, 90, 91, 92, 93, 119, 133, 135, 136,
2801 137, 139, 140, 165, 168, 170, 172, 174, 175, 176,
2802 217, 244, 183, 141, 142, 144, 198, 212, 57, 10,
2803 210, 246, 247, 11, 17, 11, 179, 195, 94, 95,
2804 96, 97, 98, 99, 100, 101, 102, 103, 177, 26,
2805 27, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2806 109, 110, 111, 112, 113, 178, 177, 178, 210, 210,
2807 246, 210, 210, 254, 246, 246, 246, 246, 246, 210,
2808 210, 210, 210, 210, 246, 195, 117, 118, 54, 121,
2809 122, 141, 142, 144, 145, 147, 148, 149, 196, 39,
2810 211, 201, 167, 169, 169, 160, 201, 183, 183, 221,
2811 177, 178, 177, 178, 159, 159, 159, 159, 159, 159,
2812 159, 167, 216, 218, 170, 218, 171, 218, 22, 159,
2813 159, 159, 227, 186, 3, 4, 5, 6, 9, 25,
2814 26, 27, 40, 41, 59, 165, 168, 170, 172, 217,
2815 243, 244, 245, 162, 245, 245, 245, 199, 210, 210,
2816 210, 210, 162, 204, 162, 204, 245, 165, 162, 162,
2817 162, 162, 162, 162, 245, 245, 245, 245, 245, 38,
2818 199, 210, 246, 4, 141, 142, 143, 144, 146, 150,
2819 151, 153, 154, 155, 200, 228, 229, 38, 159, 159,
2820 159, 159, 216, 216, 216, 216, 216, 216, 216, 162,
2821 167, 171, 210, 218, 169, 171, 216, 216, 216, 162,
2822 207, 159, 61, 242, 167, 218, 170, 218, 171, 218,
2823 22, 246, 162, 162, 212, 245, 245, 245, 245, 11,
2824 54, 11, 256, 245, 165, 246, 210, 246, 246, 246,
2825 162, 162, 257, 162, 162, 162, 210, 212, 245, 162,
2826 207, 207, 210, 216, 216, 216, 216, 256, 162, 162,
2827 162, 162, 257, 162, 216, 169, 171, 162, 162, 38,
2828 34, 54, 205, 208, 39, 210, 234, 235, 22, 167,
2829 171, 218, 169, 171, 17, 17, 245, 162, 162, 162,
2830 162, 245, 4, 245, 162, 162, 245, 162, 162, 162,
2831 4, 4, 162, 210, 245, 245, 245, 162, 204, 210,
2832 160, 162, 162, 162, 162, 160, 216, 216, 216, 216,
2833 160, 216, 169, 216, 216, 210, 22, 4, 207, 197,
2834 162, 160, 162, 169, 171, 245, 245, 159, 245, 245,
2835 245, 245, 204, 204, 246, 245, 162, 246, 246, 246,
2836 4, 245, 159, 245, 216, 216, 216, 216, 162, 160,
2837 162, 162, 257, 160, 160, 160, 181, 182, 39, 210,
2838 201, 22, 169, 162, 165, 17, 210, 255, 167, 245,
2839 257, 255, 204, 160, 160, 160, 160, 216, 216, 216,
2840 160, 197, 205, 206, 17, 167, 179, 252, 197, 197,
2841 160, 162, 167, 160, 160, 160, 160, 182, 54, 203,
2842 245, 243, 167, 179, 121, 122, 245, 245, 201, 17,
2843 210, 201, 4, 152, 202, 162, 243, 197, 197, 38,
2844 197, 197, 22, 17, 162, 17, 245, 245, 245, 17,
2845 245, 197, 197, 245, 73, 17, 245
2848 #define yyerrok (yyerrstatus = 0)
2849 #define yyclearin (yychar = YYEMPTY)
2850 #define YYEMPTY (-2)
2853 #define YYACCEPT goto yyacceptlab
2854 #define YYABORT goto yyabortlab
2855 #define YYERROR goto yyerrorlab
2858 /* Like YYERROR except do call yyerror. This remains here temporarily
2859 to ease the transition to the new meaning of YYERROR, for GCC.
2860 Once GCC version 2 has supplanted version 1, this can go. */
2862 #define YYFAIL goto yyerrlab
2864 #define YYRECOVERING() (!!yyerrstatus)
2866 #define YYBACKUP(Token, Value) \
2868 if (yychar == YYEMPTY && yylen == 1) \
2872 yytoken = YYTRANSLATE (yychar); \
2878 yyerror (YY_("syntax error: cannot back up")); \
2885 #define YYERRCODE 256
2888 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2889 If N is 0, then set CURRENT to the empty location which ends
2890 the previous symbol: RHS[0] (always defined). */
2892 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2893 #ifndef YYLLOC_DEFAULT
2894 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2898 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2899 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2900 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2901 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2905 (Current).first_line = (Current).last_line = \
2906 YYRHSLOC (Rhs, 0).last_line; \
2907 (Current).first_column = (Current).last_column = \
2908 YYRHSLOC (Rhs, 0).last_column; \
2914 /* YY_LOCATION_PRINT -- Print the location on the stream.
2915 This macro was not mandated originally: define only if we know
2916 we won't break user code: when these are the locations we know. */
2918 #ifndef YY_LOCATION_PRINT
2919 # if YYLTYPE_IS_TRIVIAL
2920 # define YY_LOCATION_PRINT(File, Loc) \
2921 fprintf (File, "%d.%d-%d.%d", \
2922 (Loc).first_line, (Loc).first_column, \
2923 (Loc).last_line, (Loc).last_column)
2925 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2930 /* YYLEX -- calling `yylex' with the right arguments. */
2933 # define YYLEX yylex (YYLEX_PARAM)
2935 # define YYLEX yylex ()
2938 /* Enable debugging if requested. */
2942 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2943 # define YYFPRINTF fprintf
2946 # define YYDPRINTF(Args) \
2952 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2956 YYFPRINTF (stderr, "%s ", Title); \
2957 yy_symbol_print (stderr, \
2959 YYFPRINTF (stderr, "\n"); \
2964 /*--------------------------------.
2965 | Print this symbol on YYOUTPUT. |
2966 `--------------------------------*/
2969 #if (defined __STDC__ || defined __C99__FUNC__ \
2970 || defined __cplusplus || defined _MSC_VER)
2972 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2975 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2978 YYSTYPE const * const yyvaluep;
2984 if (yytype < YYNTOKENS)
2985 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2997 /*--------------------------------.
2998 | Print this symbol on YYOUTPUT. |
2999 `--------------------------------*/
3001 #if (defined __STDC__ || defined __C99__FUNC__ \
3002 || defined __cplusplus || defined _MSC_VER)
3004 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3007 yy_symbol_print (yyoutput, yytype, yyvaluep)
3010 YYSTYPE const * const yyvaluep;
3013 if (yytype < YYNTOKENS)
3014 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3016 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
3018 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3019 YYFPRINTF (yyoutput, ")");
3022 /*------------------------------------------------------------------.
3023 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
3025 `------------------------------------------------------------------*/
3027 #if (defined __STDC__ || defined __C99__FUNC__ \
3028 || defined __cplusplus || defined _MSC_VER)
3030 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3033 yy_stack_print (bottom, top)
3034 yytype_int16 *bottom;
3038 YYFPRINTF (stderr, "Stack now");
3039 for (; bottom <= top; ++bottom)
3040 YYFPRINTF (stderr, " %d", *bottom);
3041 YYFPRINTF (stderr, "\n");
3044 # define YY_STACK_PRINT(Bottom, Top) \
3047 yy_stack_print ((Bottom), (Top)); \
3051 /*------------------------------------------------.
3052 | Report that the YYRULE is going to be reduced. |
3053 `------------------------------------------------*/
3055 #if (defined __STDC__ || defined __C99__FUNC__ \
3056 || defined __cplusplus || defined _MSC_VER)
3058 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3061 yy_reduce_print (yyvsp, yyrule)
3066 int yynrhs = yyr2[yyrule];
3068 unsigned long int yylno = yyrline[yyrule];
3069 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3071 /* The symbols being reduced. */
3072 for (yyi = 0; yyi < yynrhs; yyi++)
3074 fprintf (stderr, " $%d = ", yyi + 1);
3075 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3076 &(yyvsp[(yyi + 1) - (yynrhs)])
3078 fprintf (stderr, "\n");
3082 # define YY_REDUCE_PRINT(Rule) \
3085 yy_reduce_print (yyvsp, Rule); \
3088 /* Nonzero means print parse trace. It is left uninitialized so that
3089 multiple parsers can coexist. */
3091 #else /* !YYDEBUG */
3092 # define YYDPRINTF(Args)
3093 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3094 # define YY_STACK_PRINT(Bottom, Top)
3095 # define YY_REDUCE_PRINT(Rule)
3096 #endif /* !YYDEBUG */
3099 /* YYINITDEPTH -- initial size of the parser's stacks. */
3101 # define YYINITDEPTH 200
3104 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3105 if the built-in stack extension method is used).
3107 Do not make this value too large; the results are undefined if
3108 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3109 evaluated with infinite-precision integer arithmetic. */
3112 # define YYMAXDEPTH 10000
3120 # if defined __GLIBC__ && defined _STRING_H
3121 # define yystrlen strlen
3123 /* Return the length of YYSTR. */
3124 #if (defined __STDC__ || defined __C99__FUNC__ \
3125 || defined __cplusplus || defined _MSC_VER)
3127 yystrlen (const char *yystr)
3135 for (yylen = 0; yystr[yylen]; yylen++)
3143 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3144 # define yystpcpy stpcpy
3146 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3148 #if (defined __STDC__ || defined __C99__FUNC__ \
3149 || defined __cplusplus || defined _MSC_VER)
3151 yystpcpy (char *yydest, const char *yysrc)
3154 yystpcpy (yydest, yysrc)
3160 const char *yys = yysrc;
3162 while ((*yyd++ = *yys++) != '\0')
3171 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3172 quotes and backslashes, so that it's suitable for yyerror. The
3173 heuristic is that double-quoting is unnecessary unless the string
3174 contains an apostrophe, a comma, or backslash (other than
3175 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3176 null, do not copy; instead, return the length of what the result
3179 yytnamerr (char *yyres, const char *yystr)
3184 char const *yyp = yystr;
3191 goto do_not_strip_quotes;
3195 goto do_not_strip_quotes;
3208 do_not_strip_quotes: ;
3212 return yystrlen (yystr);
3214 return yystpcpy (yyres, yystr) - yyres;
3218 /* Copy into YYRESULT an error message about the unexpected token
3219 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3220 including the terminating null byte. If YYRESULT is null, do not
3221 copy anything; just return the number of bytes that would be
3222 copied. As a special case, return 0 if an ordinary "syntax error"
3223 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3224 size calculation. */
3226 yysyntax_error (char *yyresult, int yystate, int yychar)
3228 int yyn = yypact[yystate];
3230 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3234 int yytype = YYTRANSLATE (yychar);
3235 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3236 YYSIZE_T yysize = yysize0;
3238 int yysize_overflow = 0;
3239 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3240 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3244 /* This is so xgettext sees the translatable formats that are
3245 constructed on the fly. */
3246 YY_("syntax error, unexpected %s");
3247 YY_("syntax error, unexpected %s, expecting %s");
3248 YY_("syntax error, unexpected %s, expecting %s or %s");
3249 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3250 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3254 static char const yyunexpected[] = "syntax error, unexpected %s";
3255 static char const yyexpecting[] = ", expecting %s";
3256 static char const yyor[] = " or %s";
3257 char yyformat[sizeof yyunexpected
3258 + sizeof yyexpecting - 1
3259 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3260 * (sizeof yyor - 1))];
3261 char const *yyprefix = yyexpecting;
3263 /* Start YYX at -YYN if negative to avoid negative indexes in
3265 int yyxbegin = yyn < 0 ? -yyn : 0;
3267 /* Stay within bounds of both yycheck and yytname. */
3268 int yychecklim = YYLAST - yyn + 1;
3269 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3272 yyarg[0] = yytname[yytype];
3273 yyfmt = yystpcpy (yyformat, yyunexpected);
3275 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3276 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3278 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3282 yyformat[sizeof yyunexpected - 1] = '\0';
3285 yyarg[yycount++] = yytname[yyx];
3286 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3287 yysize_overflow |= (yysize1 < yysize);
3289 yyfmt = yystpcpy (yyfmt, yyprefix);
3293 yyf = YY_(yyformat);
3294 yysize1 = yysize + yystrlen (yyf);
3295 yysize_overflow |= (yysize1 < yysize);
3298 if (yysize_overflow)
3299 return YYSIZE_MAXIMUM;
3303 /* Avoid sprintf, as that infringes on the user's name space.
3304 Don't have undefined behavior even if the translation
3305 produced a string with the wrong number of "%s"s. */
3306 char *yyp = yyresult;
3308 while ((*yyp = *yyf) != '\0')
3310 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3312 yyp += yytnamerr (yyp, yyarg[yyi++]);
3325 #endif /* YYERROR_VERBOSE */
3328 /*-----------------------------------------------.
3329 | Release the memory associated to this symbol. |
3330 `-----------------------------------------------*/
3333 #if (defined __STDC__ || defined __C99__FUNC__ \
3334 || defined __cplusplus || defined _MSC_VER)
3336 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3339 yydestruct (yymsg, yytype, yyvaluep)
3349 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3360 /* Prevent warnings from -Wmissing-prototypes. */
3362 #ifdef YYPARSE_PARAM
3363 #if defined __STDC__ || defined __cplusplus
3364 int yyparse (void *YYPARSE_PARAM);
3368 #else /* ! YYPARSE_PARAM */
3369 #if defined __STDC__ || defined __cplusplus
3374 #endif /* ! YYPARSE_PARAM */
3378 /* The look-ahead symbol. */
3381 /* The semantic value of the look-ahead symbol. */
3384 /* Number of syntax errors so far. */
3393 #ifdef YYPARSE_PARAM
3394 #if (defined __STDC__ || defined __C99__FUNC__ \
3395 || defined __cplusplus || defined _MSC_VER)
3397 yyparse (void *YYPARSE_PARAM)
3400 yyparse (YYPARSE_PARAM)
3401 void *YYPARSE_PARAM;
3403 #else /* ! YYPARSE_PARAM */
3404 #if (defined __STDC__ || defined __C99__FUNC__ \
3405 || defined __cplusplus || defined _MSC_VER)
3419 /* Number of tokens to shift before error messages enabled. */
3421 /* Look-ahead token as an internal (translated) token number. */
3424 /* Buffer for error messages, and its allocated size. */
3426 char *yymsg = yymsgbuf;
3427 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3430 /* Three stacks and their tools:
3431 `yyss': related to states,
3432 `yyvs': related to semantic values,
3433 `yyls': related to locations.
3435 Refer to the stacks thru separate pointers, to allow yyoverflow
3436 to reallocate them elsewhere. */
3438 /* The state stack. */
3439 yytype_int16 yyssa[YYINITDEPTH];
3440 yytype_int16 *yyss = yyssa;
3441 yytype_int16 *yyssp;
3443 /* The semantic value stack. */
3444 YYSTYPE yyvsa[YYINITDEPTH];
3445 YYSTYPE *yyvs = yyvsa;
3450 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3452 YYSIZE_T yystacksize = YYINITDEPTH;
3454 /* The variables used to return semantic value and location from the
3459 /* The number of symbols on the RHS of the reduced rule.
3460 Keep to zero when no symbol should be popped. */
3463 YYDPRINTF ((stderr, "Starting parse\n"));
3468 yychar = YYEMPTY; /* Cause a token to be read. */
3470 /* Initialize stack pointers.
3471 Waste one element of value and location stack
3472 so that they stay on the same level as the state stack.
3473 The wasted elements are never initialized. */
3480 /*------------------------------------------------------------.
3481 | yynewstate -- Push a new state, which is found in yystate. |
3482 `------------------------------------------------------------*/
3484 /* In all cases, when you get here, the value and location stacks
3485 have just been pushed. So pushing a state here evens the stacks. */
3491 if (yyss + yystacksize - 1 <= yyssp)
3493 /* Get the current used size of the three stacks, in elements. */
3494 YYSIZE_T yysize = yyssp - yyss + 1;
3498 /* Give user a chance to reallocate the stack. Use copies of
3499 these so that the &'s don't force the real ones into
3501 YYSTYPE *yyvs1 = yyvs;
3502 yytype_int16 *yyss1 = yyss;
3505 /* Each stack pointer address is followed by the size of the
3506 data in use in that stack, in bytes. This used to be a
3507 conditional around just the two extra args, but that might
3508 be undefined if yyoverflow is a macro. */
3509 yyoverflow (YY_("memory exhausted"),
3510 &yyss1, yysize * sizeof (*yyssp),
3511 &yyvs1, yysize * sizeof (*yyvsp),
3518 #else /* no yyoverflow */
3519 # ifndef YYSTACK_RELOCATE
3520 goto yyexhaustedlab;
3522 /* Extend the stack our own way. */
3523 if (YYMAXDEPTH <= yystacksize)
3524 goto yyexhaustedlab;
3526 if (YYMAXDEPTH < yystacksize)
3527 yystacksize = YYMAXDEPTH;
3530 yytype_int16 *yyss1 = yyss;
3531 union yyalloc *yyptr =
3532 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3534 goto yyexhaustedlab;
3535 YYSTACK_RELOCATE (yyss);
3536 YYSTACK_RELOCATE (yyvs);
3538 # undef YYSTACK_RELOCATE
3540 YYSTACK_FREE (yyss1);
3543 #endif /* no yyoverflow */
3545 yyssp = yyss + yysize - 1;
3546 yyvsp = yyvs + yysize - 1;
3549 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3550 (unsigned long int) yystacksize));
3552 if (yyss + yystacksize - 1 <= yyssp)
3556 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3565 /* Do appropriate processing given the current state. Read a
3566 look-ahead token if we need one and don't already have one. */
3568 /* First try to decide what to do without reference to look-ahead token. */
3569 yyn = yypact[yystate];
3570 if (yyn == YYPACT_NINF)
3573 /* Not known => get a look-ahead token if don't already have one. */
3575 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3576 if (yychar == YYEMPTY)
3578 YYDPRINTF ((stderr, "Reading a token: "));
3582 if (yychar <= YYEOF)
3584 yychar = yytoken = YYEOF;
3585 YYDPRINTF ((stderr, "Now at end of input.\n"));
3589 yytoken = YYTRANSLATE (yychar);
3590 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3593 /* If the proper action on seeing token YYTOKEN is to reduce or to
3594 detect an error, take that action. */
3596 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3601 if (yyn == 0 || yyn == YYTABLE_NINF)
3610 /* Count tokens shifted since error; after three, turn off error
3615 /* Shift the look-ahead token. */
3616 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3618 /* Discard the shifted token unless it is eof. */
3619 if (yychar != YYEOF)
3628 /*-----------------------------------------------------------.
3629 | yydefault -- do the default action for the current state. |
3630 `-----------------------------------------------------------*/
3632 yyn = yydefact[yystate];
3638 /*-----------------------------.
3639 | yyreduce -- Do a reduction. |
3640 `-----------------------------*/
3642 /* yyn is the number of a rule to reduce with. */
3645 /* If YYLEN is nonzero, implement the default value of the action:
3648 Otherwise, the following line sets YYVAL to garbage.
3649 This behavior is undocumented and Bison
3650 users should not rely upon it. Assigning to YYVAL
3651 unconditionally makes the parser a bit smaller, and it avoids a
3652 GCC warning that YYVAL may be used uninitialized. */
3653 yyval = yyvsp[1-yylen];
3656 YY_REDUCE_PRINT (yyn);
3660 #line 1142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3661 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3665 #line 1142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3666 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3670 #line 1143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3671 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3675 #line 1143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3676 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3680 #line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3681 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3685 #line 1144 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3686 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3690 #line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3691 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3695 #line 1145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3696 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3700 #line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3701 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3705 #line 1146 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3706 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3710 #line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3711 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3715 #line 1150 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3716 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3720 #line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3721 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3725 #line 1151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3726 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3730 #line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3731 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3735 #line 1152 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3736 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3740 #line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3741 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3745 #line 1153 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3746 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3750 #line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3751 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3755 #line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3756 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3760 #line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3761 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3765 #line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3766 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3770 #line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3771 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3775 #line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3776 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3780 #line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3781 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3785 #line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3786 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3790 #line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3791 { (yyval.StrVal) = 0; ;}
3795 #line 1169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3796 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3800 #line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3801 { (yyval.UIntVal)=0; ;}
3805 #line 1174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3807 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3813 #line 1178 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3821 #line 1183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3823 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3829 #line 1192 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3837 #line 1197 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3839 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3845 #line 1203 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3846 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3850 #line 1204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3851 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3855 #line 1205 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3856 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3860 #line 1206 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3861 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3865 #line 1207 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3866 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3870 #line 1208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3871 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
3875 #line 1212 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3876 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3880 #line 1213 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3881 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3885 #line 1214 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3886 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3890 #line 1218 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3891 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3895 #line 1219 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3896 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3900 #line 1220 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3901 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3905 #line 1221 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3906 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3910 #line 1225 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3911 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3915 #line 1226 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3916 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3920 #line 1227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3921 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3925 #line 1231 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3926 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3930 #line 1232 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3931 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3935 #line 1233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3936 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3940 #line 1234 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3941 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3945 #line 1235 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3946 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3950 #line 1239 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3951 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3955 #line 1240 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3956 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3960 #line 1241 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3961 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3965 #line 1244 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3966 { (yyval.UIntVal) = CallingConv::C; ;}
3970 #line 1245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3971 { (yyval.UIntVal) = CallingConv::C; ;}
3975 #line 1246 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3976 { (yyval.UIntVal) = CallingConv::Fast; ;}
3980 #line 1247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3981 { (yyval.UIntVal) = CallingConv::Cold; ;}
3985 #line 1248 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3986 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3990 #line 1249 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3991 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3995 #line 1250 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3997 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3998 GEN_ERROR("Calling conv too large");
3999 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4005 #line 1257 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4006 { (yyval.Attributes) = Attribute::ZExt; ;}
4010 #line 1258 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4011 { (yyval.Attributes) = Attribute::ZExt; ;}
4015 #line 1259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4016 { (yyval.Attributes) = Attribute::SExt; ;}
4020 #line 1260 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4021 { (yyval.Attributes) = Attribute::SExt; ;}
4025 #line 1261 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4026 { (yyval.Attributes) = Attribute::InReg; ;}
4030 #line 1262 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4031 { (yyval.Attributes) = Attribute::StructRet; ;}
4035 #line 1263 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4036 { (yyval.Attributes) = Attribute::NoAlias; ;}
4040 #line 1264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4041 { (yyval.Attributes) = Attribute::ByVal; ;}
4045 #line 1265 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4046 { (yyval.Attributes) = Attribute::Nest; ;}
4050 #line 1266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4051 { (yyval.Attributes) =
4052 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4056 #line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4057 { (yyval.Attributes) = Attribute::None; ;}
4061 #line 1271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4063 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4068 #line 1276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4069 { (yyval.Attributes) = Attribute::InReg; ;}
4073 #line 1277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4074 { (yyval.Attributes) = Attribute::ZExt; ;}
4078 #line 1278 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4079 { (yyval.Attributes) = Attribute::SExt; ;}
4083 #line 1281 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4084 { (yyval.Attributes) = Attribute::None; ;}
4088 #line 1282 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4090 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4095 #line 1288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4096 { (yyval.Attributes) = Attribute::NoReturn; ;}
4100 #line 1289 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4101 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4105 #line 1290 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4106 { (yyval.Attributes) = Attribute::InReg; ;}
4110 #line 1291 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4111 { (yyval.Attributes) = Attribute::ZExt; ;}
4115 #line 1292 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4116 { (yyval.Attributes) = Attribute::SExt; ;}
4120 #line 1293 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4121 { (yyval.Attributes) = Attribute::ReadNone; ;}
4125 #line 1294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4126 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4130 #line 1295 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4131 { (yyval.Attributes) = Attribute::NoInline ;}
4135 #line 1296 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4136 { (yyval.Attributes) = Attribute::AlwaysInline ;}
4140 #line 1297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4141 { (yyval.Attributes) = Attribute::OptimizeForSize ;}
4145 #line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4146 { (yyval.Attributes) = Attribute::None; ;}
4150 #line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4152 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4157 #line 1307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4158 { (yyval.StrVal) = 0; ;}
4162 #line 1308 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4164 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4169 #line 1315 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4170 { (yyval.UIntVal) = 0; ;}
4174 #line 1316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4176 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4177 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4178 GEN_ERROR("Alignment must be a power of two");
4184 #line 1322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4185 { (yyval.UIntVal) = 0; ;}
4189 #line 1323 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4191 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4192 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4193 GEN_ERROR("Alignment must be a power of two");
4199 #line 1332 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4201 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4202 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
4203 GEN_ERROR("Invalid character in section name");
4204 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4210 #line 1340 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4211 { (yyval.StrVal) = 0; ;}
4215 #line 1341 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4216 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4220 #line 1346 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4225 #line 1347 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4230 #line 1348 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4232 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4233 delete (yyvsp[(1) - (1)].StrVal);
4239 #line 1353 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4241 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4242 GEN_ERROR("Alignment must be a power of two");
4243 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4249 #line 1369 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4251 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4257 #line 1373 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4259 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4265 #line 1377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4267 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4268 GEN_ERROR("Cannot form a pointer to a basic block");
4269 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4270 delete (yyvsp[(1) - (3)].TypeVal);
4276 #line 1384 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4277 { // Named types are also simple types...
4278 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4280 (yyval.TypeVal) = new PATypeHolder(tmp);
4285 #line 1389 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4286 { // Type UpReference
4287 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4288 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4289 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4290 (yyval.TypeVal) = new PATypeHolder(OT);
4291 UR_OUT("New Upreference!\n");
4297 #line 1397 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4299 // Allow but ignore attributes on function types; this permits auto-upgrade.
4300 // FIXME: remove in LLVM 3.0.
4301 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4302 if (!FunctionType::isValidReturnType(RetTy))
4303 GEN_ERROR("Invalid result type for LLVM function");
4305 std::vector<const Type*> Params;
4306 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4307 for (; I != E; ++I ) {
4308 const Type *Ty = I->Ty->get();
4309 Params.push_back(Ty);
4312 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4313 if (isVarArg) Params.pop_back();
4315 for (unsigned i = 0; i != Params.size(); ++i)
4316 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4317 GEN_ERROR("Function arguments must be value types!");
4321 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4322 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4323 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4324 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4330 #line 1426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4332 // Allow but ignore attributes on function types; this permits auto-upgrade.
4333 // FIXME: remove in LLVM 3.0.
4334 std::vector<const Type*> Params;
4335 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4336 for ( ; I != E; ++I ) {
4337 const Type* Ty = I->Ty->get();
4338 Params.push_back(Ty);
4341 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4342 if (isVarArg) Params.pop_back();
4344 for (unsigned i = 0; i != Params.size(); ++i)
4345 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4346 GEN_ERROR("Function arguments must be value types!");
4350 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4351 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4352 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4358 #line 1451 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4359 { // Sized array type?
4360 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
4361 delete (yyvsp[(4) - (5)].TypeVal);
4367 #line 1456 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4369 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4370 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4371 GEN_ERROR("Unsigned result not equal to signed result");
4372 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4373 GEN_ERROR("Element type of a VectorType must be primitive");
4374 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4375 delete (yyvsp[(4) - (5)].TypeVal);
4381 #line 1466 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4382 { // Structure type?
4383 std::vector<const Type*> Elements;
4384 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4385 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4386 Elements.push_back(*I);
4388 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4389 delete (yyvsp[(2) - (3)].TypeList);
4395 #line 1476 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4396 { // Empty structure type?
4397 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4403 #line 1480 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4405 std::vector<const Type*> Elements;
4406 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4407 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4408 Elements.push_back(*I);
4410 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4411 delete (yyvsp[(3) - (5)].TypeList);
4417 #line 1490 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4418 { // Empty structure type?
4419 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4425 #line 1497 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4427 // Allow but ignore attributes on function types; this permits auto-upgrade.
4428 // FIXME: remove in LLVM 3.0.
4429 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4430 (yyval.TypeWithAttrs).Attrs = Attribute::None;
4435 #line 1506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4437 if (!UpRefs.empty())
4438 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4439 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4440 GEN_ERROR("LLVM functions cannot return aggregate types");
4441 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4446 #line 1513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4448 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4453 #line 1518 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4455 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4456 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4462 #line 1523 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4464 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4470 #line 1531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4472 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4473 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
4474 TWA.Ty = new PATypeHolder(Type::VoidTy);
4475 (yyval.TypeWithAttrsList)->push_back(TWA);
4481 #line 1538 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4483 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4484 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
4485 TWA.Ty = new PATypeHolder(Type::VoidTy);
4486 (yyval.TypeWithAttrsList)->push_back(TWA);
4492 #line 1545 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4494 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4500 #line 1553 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4502 (yyval.TypeList) = new std::list<PATypeHolder>();
4503 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4504 delete (yyvsp[(1) - (1)].TypeVal);
4510 #line 1559 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4512 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4513 delete (yyvsp[(3) - (3)].TypeVal);
4519 #line 1571 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4520 { // Nonempty unsized arr
4521 if (!UpRefs.empty())
4522 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4523 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4525 GEN_ERROR("Cannot make array constant with type: '" +
4526 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4527 const Type *ETy = ATy->getElementType();
4528 uint64_t NumElements = ATy->getNumElements();
4530 // Verify that we have the correct size...
4531 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
4532 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4533 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4534 utostr(NumElements) + "");
4536 // Verify all elements are correct type!
4537 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4538 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4539 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4540 ETy->getDescription() +"' as required!\nIt is of type '"+
4541 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4544 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4545 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4551 #line 1599 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4553 if (!UpRefs.empty())
4554 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4555 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4557 GEN_ERROR("Cannot make array constant with type: '" +
4558 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4560 uint64_t NumElements = ATy->getNumElements();
4561 if (NumElements != uint64_t(-1) && NumElements != 0)
4562 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4563 " arguments, but has size of " + utostr(NumElements) +"");
4564 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4565 delete (yyvsp[(1) - (3)].TypeVal);
4571 #line 1615 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4573 if (!UpRefs.empty())
4574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4575 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4577 GEN_ERROR("Cannot make array constant with type: '" +
4578 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4580 uint64_t NumElements = ATy->getNumElements();
4581 const Type *ETy = ATy->getElementType();
4582 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
4583 GEN_ERROR("Can't build string constant of size " +
4584 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4585 " when array has size " + utostr(NumElements) + "");
4586 std::vector<Constant*> Vals;
4587 if (ETy == Type::Int8Ty) {
4588 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4589 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4591 delete (yyvsp[(3) - (3)].StrVal);
4592 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4594 delete (yyvsp[(3) - (3)].StrVal);
4595 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4596 delete (yyvsp[(1) - (3)].TypeVal);
4602 #line 1642 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4603 { // Nonempty unsized arr
4604 if (!UpRefs.empty())
4605 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4606 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4608 GEN_ERROR("Cannot make packed constant with type: '" +
4609 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4610 const Type *ETy = PTy->getElementType();
4611 unsigned NumElements = PTy->getNumElements();
4613 // Verify that we have the correct size...
4614 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
4615 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4616 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4617 utostr(NumElements) + "");
4619 // Verify all elements are correct type!
4620 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4621 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4622 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4623 ETy->getDescription() +"' as required!\nIt is of type '"+
4624 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4627 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4628 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4634 #line 1670 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4636 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4638 GEN_ERROR("Cannot make struct constant with type: '" +
4639 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4641 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4642 GEN_ERROR("Illegal number of initializers for structure type");
4644 // Check to ensure that constants are compatible with the type initializer!
4645 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4646 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4647 GEN_ERROR("Expected type '" +
4648 STy->getElementType(i)->getDescription() +
4649 "' for element #" + utostr(i) +
4650 " of structure initializer");
4652 // Check to ensure that Type is not packed
4653 if (STy->isPacked())
4654 GEN_ERROR("Unpacked Initializer to vector type '" +
4655 STy->getDescription() + "'");
4657 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4658 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4664 #line 1696 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4666 if (!UpRefs.empty())
4667 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4668 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4670 GEN_ERROR("Cannot make struct constant with type: '" +
4671 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4673 if (STy->getNumContainedTypes() != 0)
4674 GEN_ERROR("Illegal number of initializers for structure type");
4676 // Check to ensure that Type is not packed
4677 if (STy->isPacked())
4678 GEN_ERROR("Unpacked Initializer to vector type '" +
4679 STy->getDescription() + "'");
4681 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4682 delete (yyvsp[(1) - (3)].TypeVal);
4688 #line 1716 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4690 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4692 GEN_ERROR("Cannot make struct constant with type: '" +
4693 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4695 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4696 GEN_ERROR("Illegal number of initializers for structure type");
4698 // Check to ensure that constants are compatible with the type initializer!
4699 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4700 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4701 GEN_ERROR("Expected type '" +
4702 STy->getElementType(i)->getDescription() +
4703 "' for element #" + utostr(i) +
4704 " of structure initializer");
4706 // Check to ensure that Type is packed
4707 if (!STy->isPacked())
4708 GEN_ERROR("Vector initializer to non-vector type '" +
4709 STy->getDescription() + "'");
4711 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4712 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4718 #line 1742 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4720 if (!UpRefs.empty())
4721 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4722 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4724 GEN_ERROR("Cannot make struct constant with type: '" +
4725 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4727 if (STy->getNumContainedTypes() != 0)
4728 GEN_ERROR("Illegal number of initializers for structure type");
4730 // Check to ensure that Type is packed
4731 if (!STy->isPacked())
4732 GEN_ERROR("Vector initializer to non-vector type '" +
4733 STy->getDescription() + "'");
4735 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4736 delete (yyvsp[(1) - (5)].TypeVal);
4742 #line 1762 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4744 if (!UpRefs.empty())
4745 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4746 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4748 GEN_ERROR("Cannot make null pointer constant with type: '" +
4749 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4751 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4752 delete (yyvsp[(1) - (2)].TypeVal);
4758 #line 1774 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4760 if (!UpRefs.empty())
4761 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4762 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4763 delete (yyvsp[(1) - (2)].TypeVal);
4769 #line 1781 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4771 if (!UpRefs.empty())
4772 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4773 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4775 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4777 // ConstExprs can exist in the body of a function, thus creating
4778 // GlobalValues whenever they refer to a variable. Because we are in
4779 // the context of a function, getExistingVal will search the functions
4780 // symbol table instead of the module symbol table for the global symbol,
4781 // which throws things all off. To get around this, we just tell
4782 // getExistingVal that we are at global scope here.
4784 Function *SavedCurFn = CurFun.CurrentFunction;
4785 CurFun.CurrentFunction = 0;
4787 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4790 CurFun.CurrentFunction = SavedCurFn;
4792 // If this is an initializer for a constant pointer, which is referencing a
4793 // (currently) undefined variable, create a stub now that shall be replaced
4794 // in the future with the right type of variable.
4797 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4798 const PointerType *PT = cast<PointerType>(Ty);
4800 // First check to see if the forward references value is already created!
4801 PerModuleInfo::GlobalRefsType::iterator I =
4802 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4804 if (I != CurModule.GlobalRefs.end()) {
4805 V = I->second; // Placeholder already exists, use it...
4806 (yyvsp[(2) - (2)].ValIDVal).destroy();
4809 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4810 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4811 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4812 GEN_ERROR("Invalid reference to global");
4814 // Create the forward referenced global.
4816 if (const FunctionType *FTy =
4817 dyn_cast<FunctionType>(PT->getElementType())) {
4818 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4819 CurModule.CurrentModule);
4821 GV = new GlobalVariable(PT->getElementType(), false,
4822 GlobalValue::ExternalWeakLinkage, 0,
4823 Name, CurModule.CurrentModule);
4826 // Keep track of the fact that we have a forward ref to recycle it
4827 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4832 (yyval.ConstVal) = cast<GlobalValue>(V);
4833 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4839 #line 1847 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4841 if (!UpRefs.empty())
4842 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4843 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4844 GEN_ERROR("Mismatched types for constant expression: " +
4845 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4846 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4847 delete (yyvsp[(1) - (2)].TypeVal);
4853 #line 1857 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4855 if (!UpRefs.empty())
4856 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4857 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4858 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4859 GEN_ERROR("Cannot create a null initialized value of this type");
4860 (yyval.ConstVal) = Constant::getNullValue(Ty);
4861 delete (yyvsp[(1) - (2)].TypeVal);
4867 #line 1867 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4868 { // integral constants
4869 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4870 GEN_ERROR("Constant value doesn't fit in type");
4871 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4877 #line 1873 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4878 { // arbitrary precision integer constants
4879 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4880 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4881 GEN_ERROR("Constant value does not fit in type");
4883 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4884 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4885 delete (yyvsp[(2) - (2)].APIntVal);
4891 #line 1883 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4892 { // integral constants
4893 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4894 GEN_ERROR("Constant value doesn't fit in type");
4895 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4901 #line 1889 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4902 { // arbitrary precision integer constants
4903 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4904 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4905 GEN_ERROR("Constant value does not fit in type");
4907 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4908 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4909 delete (yyvsp[(2) - (2)].APIntVal);
4915 #line 1899 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4916 { // Boolean constants
4917 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4918 GEN_ERROR("Constant true must have type i1");
4919 (yyval.ConstVal) = ConstantInt::getTrue();
4925 #line 1905 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4926 { // Boolean constants
4927 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4928 GEN_ERROR("Constant false must have type i1");
4929 (yyval.ConstVal) = ConstantInt::getFalse();
4935 #line 1911 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4936 { // Floating point constants
4937 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4938 GEN_ERROR("Floating point constant invalid for type");
4939 // Lexer has no type info, so builds all float and double FP constants
4940 // as double. Fix this here. Long double is done right.
4941 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4942 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4943 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4944 delete (yyvsp[(2) - (2)].FPVal);
4950 #line 1924 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4952 if (!UpRefs.empty())
4953 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4954 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4955 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4956 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4957 GEN_ERROR("invalid cast opcode for cast from '" +
4958 Val->getType()->getDescription() + "' to '" +
4959 DestTy->getDescription() + "'");
4960 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4961 delete (yyvsp[(5) - (6)].TypeVal);
4966 #line 1936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4968 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4969 GEN_ERROR("GetElementPtr requires a pointer operand");
4972 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4974 GEN_ERROR("Index list invalid for constant getelementptr");
4976 SmallVector<Constant*, 8> IdxVec;
4977 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4978 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4979 IdxVec.push_back(C);
4981 GEN_ERROR("Indices to constant getelementptr must be constants");
4983 delete (yyvsp[(4) - (5)].ValueList);
4985 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4991 #line 1957 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4993 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4994 GEN_ERROR("Select condition must be of boolean type");
4995 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4996 GEN_ERROR("Select operand types must match");
4997 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5003 #line 1965 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5005 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
5006 GEN_ERROR("Binary operator types must match");
5008 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5013 #line 1971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5015 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
5016 GEN_ERROR("Logical operator types must match");
5017 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
5018 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
5019 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
5020 GEN_ERROR("Logical operator requires integral operands");
5022 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5028 #line 1982 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5030 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5031 GEN_ERROR("icmp operand types must match");
5032 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5037 #line 1987 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5039 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5040 GEN_ERROR("fcmp operand types must match");
5041 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5046 #line 1992 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5048 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5049 GEN_ERROR("vicmp operand types must match");
5050 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5055 #line 1997 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5057 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5058 GEN_ERROR("vfcmp operand types must match");
5059 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5064 #line 2002 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5066 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
5067 GEN_ERROR("Invalid extractelement operands");
5068 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5074 #line 2008 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5076 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
5077 GEN_ERROR("Invalid insertelement operands");
5078 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5084 #line 2014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5086 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
5087 GEN_ERROR("Invalid shufflevector operands");
5088 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5094 #line 2020 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5096 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5097 GEN_ERROR("ExtractValue requires an aggregate operand");
5099 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5100 delete (yyvsp[(4) - (5)].ConstantList);
5106 #line 2028 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5108 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5109 GEN_ERROR("InsertValue requires an aggregate operand");
5111 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5112 delete (yyvsp[(6) - (7)].ConstantList);
5118 #line 2039 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5120 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
5126 #line 2043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5128 (yyval.ConstVector) = new std::vector<Constant*>();
5129 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
5135 #line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5136 { (yyval.BoolVal) = false; ;}
5140 #line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5141 { (yyval.BoolVal) = true; ;}
5145 #line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5146 { (yyval.BoolVal) = true; ;}
5150 #line 2054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5151 { (yyval.BoolVal) = false; ;}
5155 #line 2057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5157 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5158 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
5160 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5162 GEN_ERROR("Aliases can be created only to global values");
5164 (yyval.ConstVal) = Aliasee;
5166 delete (yyvsp[(1) - (2)].TypeVal);
5171 #line 2069 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5173 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5174 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5175 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
5176 GEN_ERROR("invalid cast opcode for cast from '" +
5177 Val->getType()->getDescription() + "' to '" +
5178 DestTy->getDescription() + "'");
5180 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5182 delete (yyvsp[(5) - (6)].TypeVal);
5187 #line 2090 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5189 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5190 CurModule.ModuleDone();
5196 #line 2095 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5198 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5199 CurModule.ModuleDone();
5205 #line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5206 { CurFun.isDeclare = false; ;}
5210 #line 2108 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5212 CurFun.FunctionDone();
5218 #line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5219 { CurFun.isDeclare = true; ;}
5223 #line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5230 #line 2115 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5237 #line 2118 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5239 if (!UpRefs.empty())
5240 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
5241 // Eagerly resolve types. This is not an optimization, this is a
5242 // requirement that is due to the fact that we could have this:
5244 // %list = type { %list * }
5245 // %list = type { %list * } ; repeated type decl
5247 // If types are not resolved eagerly, then the two types will not be
5248 // determined to be the same type!
5250 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5252 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5254 // If this is a named type that is not a redefinition, add it to the slot
5256 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5259 delete (yyvsp[(3) - (3)].TypeVal);
5265 #line 2142 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5267 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5269 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5271 // If this is a named type that is not a redefinition, add it to the slot
5273 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5280 #line 2154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5282 /* "Externally Visible" Linkage */
5283 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5284 GEN_ERROR("Global value initializer is not a constant");
5285 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5286 (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));
5292 #line 2161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5299 #line 2165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5301 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5302 GEN_ERROR("Global value initializer is not a constant");
5303 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));
5309 #line 2170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5316 #line 2174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5318 if (!UpRefs.empty())
5319 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5320 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));
5322 delete (yyvsp[(6) - (7)].TypeVal);
5327 #line 2180 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5335 #line 2184 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5338 if ((yyvsp[(1) - (5)].StrVal)) {
5339 Name = *(yyvsp[(1) - (5)].StrVal);
5340 delete (yyvsp[(1) - (5)].StrVal);
5343 GEN_ERROR("Alias name cannot be empty");
5345 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5347 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5349 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5350 CurModule.CurrentModule);
5351 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5352 InsertValue(GA, CurModule.Values);
5355 // If there was a forward reference of this alias, resolve it now.
5359 ID = ValID::createGlobalName(Name);
5361 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5363 if (GlobalValue *FWGV =
5364 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5365 // Replace uses of the fwdref with the actual alias.
5366 FWGV->replaceAllUsesWith(GA);
5367 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5368 GV->eraseFromParent();
5370 cast<Function>(FWGV)->eraseFromParent();
5379 #line 2224 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5386 #line 2227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5393 #line 2233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5395 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5396 if (AsmSoFar.empty())
5397 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5399 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5400 delete (yyvsp[(1) - (1)].StrVal);
5406 #line 2243 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5408 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5409 delete (yyvsp[(3) - (3)].StrVal);
5414 #line 2247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5416 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5417 delete (yyvsp[(3) - (3)].StrVal);
5422 #line 2254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5424 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5425 delete (yyvsp[(3) - (3)].StrVal);
5431 #line 2259 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5433 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5434 delete (yyvsp[(1) - (1)].StrVal);
5440 #line 2264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5447 #line 2273 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5449 if (!UpRefs.empty())
5450 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5451 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5452 GEN_ERROR("Argument types must be first-class");
5453 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].Attributes); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5454 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5455 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5461 #line 2283 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5463 if (!UpRefs.empty())
5464 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5465 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5466 GEN_ERROR("Argument types must be first-class");
5467 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].Attributes); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5468 (yyval.ArgList) = new ArgListType;
5469 (yyval.ArgList)->push_back(E);
5475 #line 2294 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5477 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5483 #line 2298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5485 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5486 struct ArgListEntry E;
5487 E.Ty = new PATypeHolder(Type::VoidTy);
5489 E.Attrs = Attribute::None;
5490 (yyval.ArgList)->push_back(E);
5496 #line 2307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5498 (yyval.ArgList) = new ArgListType;
5499 struct ArgListEntry E;
5500 E.Ty = new PATypeHolder(Type::VoidTy);
5502 E.Attrs = Attribute::None;
5503 (yyval.ArgList)->push_back(E);
5509 #line 2316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5511 (yyval.ArgList) = 0;
5517 #line 2322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5519 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5520 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
5522 // Check the function result for abstractness if this is a define. We should
5523 // have no abstract types at this point
5524 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5525 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
5527 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
5528 GEN_ERROR("Invalid result type for LLVM function");
5530 std::vector<const Type*> ParamTypeList;
5531 SmallVector<AttributeWithIndex, 8> Attrs;
5532 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5534 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5535 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5536 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
5537 RetAttrs = RetAttrs | Attribute::ZExt;
5538 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
5540 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
5541 RetAttrs = RetAttrs | Attribute::SExt;
5542 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
5544 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
5545 RetAttrs = RetAttrs | Attribute::InReg;
5546 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
5549 if (RetAttrs != Attribute::None)
5550 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5551 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
5553 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
5554 const Type* Ty = I->Ty->get();
5555 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5556 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5557 ParamTypeList.push_back(Ty);
5558 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5559 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
5562 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5563 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
5565 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5566 if (isVarArg) ParamTypeList.pop_back();
5570 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
5572 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
5573 const PointerType *PFT = PointerType::getUnqual(FT);
5574 delete (yyvsp[(3) - (11)].TypeVal);
5577 if (!FunctionName.empty()) {
5578 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5580 ID = ValID::createGlobalID(CurModule.Values.size());
5584 // See if this function was forward referenced. If so, recycle the object.
5585 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5586 // Move the function to the end of the list, from whereever it was
5587 // previously inserted.
5588 Fn = cast<Function>(FWRef);
5589 assert(Fn->getAttributes().isEmpty() &&
5590 "Forward reference has parameter attributes!");
5591 CurModule.CurrentModule->getFunctionList().remove(Fn);
5592 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5593 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5594 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5595 if (Fn->getFunctionType() != FT ) {
5596 // The existing function doesn't have the same type. This is an overload
5598 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5599 } else if (Fn->getAttributes() != PAL) {
5600 // The existing function doesn't have the same parameter attributes.
5601 // This is an overload error.
5602 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5603 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5604 // Neither the existing or the current function is a declaration and they
5605 // have the same name and same type. Clearly this is a redefinition.
5606 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5607 } else if (Fn->isDeclaration()) {
5608 // Make sure to strip off any argument names so we can't get conflicts.
5609 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5613 } else { // Not already defined?
5614 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5615 CurModule.CurrentModule);
5616 InsertValue(Fn, CurModule.Values);
5620 CurFun.FunctionStart(Fn);
5622 if (CurFun.isDeclare) {
5623 // If we have declaration, always overwrite linkage. This will allow us to
5624 // correctly handle cases, when pointer to function is passed as argument to
5625 // another function.
5626 Fn->setLinkage(CurFun.Linkage);
5627 Fn->setVisibility(CurFun.Visibility);
5629 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
5630 Fn->setAttributes(PAL);
5631 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5632 if ((yyvsp[(9) - (11)].StrVal)) {
5633 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5634 delete (yyvsp[(9) - (11)].StrVal);
5636 if ((yyvsp[(11) - (11)].StrVal)) {
5637 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5638 delete (yyvsp[(11) - (11)].StrVal);
5641 // Add all of the arguments we parsed to the function...
5642 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
5643 if (isVarArg) { // Nuke the last entry
5644 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
5645 "Not a varargs marker!");
5646 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5647 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
5649 Function::arg_iterator ArgIt = Fn->arg_begin();
5650 Function::arg_iterator ArgEnd = Fn->arg_end();
5652 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5653 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5654 delete I->Ty; // Delete the typeholder...
5655 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5661 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
5668 #line 2472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5670 (yyval.FunctionVal) = CurFun.CurrentFunction;
5672 // Make sure that we keep track of the linkage type even if there was a
5673 // previous "declare".
5674 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5675 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5680 #line 2483 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5682 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5688 #line 2488 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5690 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5691 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5692 (yyval.FunctionVal) = CurFun.CurrentFunction;
5693 CurFun.FunctionDone();
5699 #line 2500 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5701 (yyval.BoolVal) = false;
5707 #line 2504 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5709 (yyval.BoolVal) = true;
5715 #line 2509 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5716 { // A reference to a direct constant
5717 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5723 #line 2513 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5725 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5731 #line 2517 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5732 { // arbitrary precision integer constants
5733 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5734 delete (yyvsp[(1) - (1)].APIntVal);
5740 #line 2522 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5741 { // arbitrary precision integer constants
5742 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5743 delete (yyvsp[(1) - (1)].APIntVal);
5749 #line 2527 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5750 { // Perhaps it's an FP constant?
5751 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5757 #line 2531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5759 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5765 #line 2535 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5767 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5773 #line 2539 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5775 (yyval.ValIDVal) = ValID::createNull();
5781 #line 2543 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5783 (yyval.ValIDVal) = ValID::createUndef();
5789 #line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5790 { // A vector zero constant.
5791 (yyval.ValIDVal) = ValID::createZeroInit();
5797 #line 2551 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5798 { // Nonempty unsized packed vector
5799 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5800 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5802 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5803 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
5805 VectorType* pt = VectorType::get(ETy, NumElements);
5806 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
5808 // Verify all elements are correct type!
5809 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5810 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5811 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5812 ETy->getDescription() +"' as required!\nIt is of type '" +
5813 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5816 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5817 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5823 #line 2573 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5824 { // Nonempty unsized arr
5825 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5826 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5828 if (!ETy->isFirstClassType())
5829 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5831 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5832 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5834 // Verify all elements are correct type!
5835 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5836 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5837 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5838 ETy->getDescription() +"' as required!\nIt is of type '"+
5839 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5842 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5843 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5849 #line 2595 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5851 // Use undef instead of an array because it's inconvenient to determine
5852 // the element type at this point, there being no elements to examine.
5853 (yyval.ValIDVal) = ValID::createUndef();
5859 #line 2601 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5861 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
5862 const Type *ETy = Type::Int8Ty;
5864 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5866 std::vector<Constant*> Vals;
5867 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5868 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5869 delete (yyvsp[(2) - (2)].StrVal);
5870 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5876 #line 2614 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5878 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5879 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5880 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5882 const StructType *STy = StructType::get(Elements);
5883 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5885 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5886 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5892 #line 2626 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5894 const StructType *STy = StructType::get(std::vector<const Type*>());
5895 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5901 #line 2631 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5903 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5904 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5905 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5907 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5908 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5910 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5911 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5917 #line 2643 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5919 const StructType *STy = StructType::get(std::vector<const Type*>(),
5921 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5927 #line 2649 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5929 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5935 #line 2653 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5937 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5938 delete (yyvsp[(3) - (5)].StrVal);
5939 delete (yyvsp[(5) - (5)].StrVal);
5945 #line 2663 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5946 { // Is it an integer reference...?
5947 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5953 #line 2667 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5955 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5961 #line 2671 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5962 { // Is it a named reference...?
5963 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5964 delete (yyvsp[(1) - (1)].StrVal);
5970 #line 2676 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5971 { // Is it a named reference...?
5972 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5973 delete (yyvsp[(1) - (1)].StrVal);
5979 #line 2689 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5981 if (!UpRefs.empty())
5982 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5983 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5984 delete (yyvsp[(1) - (2)].TypeVal);
5990 #line 2698 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
5992 (yyval.ValueList) = new std::vector<Value *>();
5993 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5999 #line 2703 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6001 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
6007 #line 2708 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6009 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
6015 #line 2712 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6016 { // Do not allow functions with 0 basic blocks
6017 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
6023 #line 2721 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6025 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
6027 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6028 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6029 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6035 #line 2730 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6038 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6039 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6040 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6041 " is incorrect, expected %" + utostr((unsigned)ValNum));
6043 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6044 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6050 #line 2743 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6052 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
6053 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6054 if (CI2->getParent() == 0)
6055 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6056 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6057 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
6063 #line 2752 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6064 { // Empty space between instruction lists
6065 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
6071 #line 2756 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6072 { // Labelled (named) basic block
6073 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6074 delete (yyvsp[(1) - (1)].StrVal);
6081 #line 2764 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6082 { // Return with a result...
6083 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6084 assert(!VL.empty() && "Invalid ret operands!");
6085 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6086 if (VL.size() > 1 ||
6087 (isa<StructType>(ReturnType) &&
6088 (VL.empty() || VL[0]->getType() != ReturnType))) {
6089 Value *RV = UndefValue::get(ReturnType);
6090 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6091 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6092 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6095 (yyval.TermInstVal) = ReturnInst::Create(RV);
6097 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6099 delete (yyvsp[(2) - (2)].ValueList);
6105 #line 2784 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6106 { // Return with no result...
6107 (yyval.TermInstVal) = ReturnInst::Create();
6113 #line 2788 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6114 { // Unconditional Branch...
6115 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6117 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6122 #line 2793 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6124 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6125 GEN_ERROR("Branch condition must have type i1");
6126 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6128 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6130 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6132 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6137 #line 2804 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6139 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6141 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6143 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6144 (yyval.TermInstVal) = S;
6146 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6147 E = (yyvsp[(8) - (9)].JumpTable)->end();
6148 for (; I != E; ++I) {
6149 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6150 S->addCase(CI, I->second);
6152 GEN_ERROR("Switch case is constant, but not a simple integer");
6154 delete (yyvsp[(8) - (9)].JumpTable);
6160 #line 2823 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6162 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
6164 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
6166 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
6167 (yyval.TermInstVal) = S;
6173 #line 2833 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6176 // Handle the short syntax
6177 const PointerType *PFTy = 0;
6178 const FunctionType *Ty = 0;
6179 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
6180 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6181 // Pull out the types of all of the arguments...
6182 std::vector<const Type*> ParamTypes;
6183 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
6184 for (; I != E; ++I) {
6185 const Type *Ty = I->Val->getType();
6186 if (Ty == Type::VoidTy)
6187 GEN_ERROR("Short call syntax cannot be used with varargs");
6188 ParamTypes.push_back(Ty);
6191 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
6192 GEN_ERROR("Invalid result type for LLVM function");
6194 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
6195 PFTy = PointerType::getUnqual(Ty);
6198 delete (yyvsp[(4) - (15)].TypeVal);
6200 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
6202 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
6204 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
6207 SmallVector<AttributeWithIndex, 8> Attrs;
6208 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6210 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6211 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6212 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
6213 RetAttrs = RetAttrs | Attribute::ZExt;
6214 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
6216 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
6217 RetAttrs = RetAttrs | Attribute::SExt;
6218 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
6220 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
6221 RetAttrs = RetAttrs | Attribute::InReg;
6222 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
6225 if (RetAttrs != Attribute::None)
6226 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
6228 // Check the arguments
6230 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
6231 // Make sure no arguments is a good thing!
6232 if (Ty->getNumParams() != 0)
6233 GEN_ERROR("No arguments passed to a function that "
6234 "expects arguments");
6235 } else { // Has arguments?
6236 // Loop through FunctionType's arguments and ensure they are specified
6238 FunctionType::param_iterator I = Ty->param_begin();
6239 FunctionType::param_iterator E = Ty->param_end();
6240 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
6243 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6244 if (ArgI->Val->getType() != *I)
6245 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6246 (*I)->getDescription() + "'");
6247 Args.push_back(ArgI->Val);
6248 if (ArgI->Attrs != Attribute::None)
6249 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6252 if (Ty->isVarArg()) {
6254 for (; ArgI != ArgE; ++ArgI, ++index) {
6255 Args.push_back(ArgI->Val); // push the remaining varargs
6256 if (ArgI->Attrs != Attribute::None)
6257 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6259 } else if (I != E || ArgI != ArgE)
6260 GEN_ERROR("Invalid number of parameters detected");
6262 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6263 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
6266 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
6268 // Create the InvokeInst
6269 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6270 Args.begin(), Args.end());
6271 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
6272 II->setAttributes(PAL);
6273 (yyval.TermInstVal) = II;
6274 delete (yyvsp[(7) - (15)].ParamList);
6280 #line 2936 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6282 (yyval.TermInstVal) = new UnwindInst();
6288 #line 2940 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6290 (yyval.TermInstVal) = new UnreachableInst();
6296 #line 2947 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6298 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6299 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
6302 GEN_ERROR("May only switch on a constant pool value");
6304 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
6306 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6311 #line 2958 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6313 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6314 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
6318 GEN_ERROR("May only switch on a constant pool value");
6320 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
6322 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6327 #line 2971 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6329 // Is this definition named?? if so, assign the name...
6330 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
6332 InsertValue((yyvsp[(2) - (2)].InstVal));
6333 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6339 #line 2980 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6342 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
6344 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6345 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6346 " is incorrect, expected %" + utostr((unsigned)ValNum));
6348 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6354 #line 2993 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6355 { // Used for PHI nodes
6356 if (!UpRefs.empty())
6357 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6358 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6359 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
6361 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6363 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6364 delete (yyvsp[(1) - (6)].TypeVal);
6369 #line 3004 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6371 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6372 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
6374 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
6376 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6381 #line 3014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6383 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6384 if (!UpRefs.empty())
6385 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
6386 // Used for call and invoke instructions
6387 (yyval.ParamList) = new ParamList();
6388 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6389 (yyval.ParamList)->push_back(E);
6390 delete (yyvsp[(1) - (4)].TypeVal);
6396 #line 3025 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6398 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6399 // Labels are only valid in ASMs
6400 (yyval.ParamList) = new ParamList();
6401 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6402 (yyval.ParamList)->push_back(E);
6408 #line 3033 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6410 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6411 if (!UpRefs.empty())
6412 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6413 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6414 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6415 (yyval.ParamList)->push_back(E);
6416 delete (yyvsp[(3) - (6)].TypeVal);
6422 #line 3043 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6424 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6425 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6426 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6427 (yyval.ParamList)->push_back(E);
6433 #line 3050 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6434 { (yyval.ParamList) = new ParamList(); ;}
6438 #line 3053 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6439 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6443 #line 3054 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6445 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6446 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6452 #line 3062 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6454 (yyval.ConstantList) = new std::vector<unsigned>();
6455 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6456 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6457 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6462 #line 3068 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6464 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6465 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6466 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6467 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6473 #line 3077 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6475 (yyval.BoolVal) = true;
6481 #line 3081 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6483 (yyval.BoolVal) = false;
6489 #line 3086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6491 if (!UpRefs.empty())
6492 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6493 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6494 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6496 "Arithmetic operator requires integer, FP, or packed operands");
6497 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6499 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6501 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6502 if ((yyval.InstVal) == 0)
6503 GEN_ERROR("binary operator returned null");
6504 delete (yyvsp[(2) - (5)].TypeVal);
6509 #line 3102 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6511 if (!UpRefs.empty())
6512 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6513 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6514 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6515 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6516 GEN_ERROR("Logical operator requires integral operands");
6518 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6520 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6522 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6523 if ((yyval.InstVal) == 0)
6524 GEN_ERROR("binary operator returned null");
6525 delete (yyvsp[(2) - (5)].TypeVal);
6530 #line 3119 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6532 if (!UpRefs.empty())
6533 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6534 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6536 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6538 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6539 if ((yyval.InstVal) == 0)
6540 GEN_ERROR("icmp operator returned null");
6541 delete (yyvsp[(3) - (6)].TypeVal);
6546 #line 3131 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6548 if (!UpRefs.empty())
6549 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6550 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6552 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6554 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6555 if ((yyval.InstVal) == 0)
6556 GEN_ERROR("fcmp operator returned null");
6557 delete (yyvsp[(3) - (6)].TypeVal);
6562 #line 3143 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6564 if (!UpRefs.empty())
6565 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6566 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6567 GEN_ERROR("Scalar types not supported by vicmp instruction");
6568 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6570 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6572 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6573 if ((yyval.InstVal) == 0)
6574 GEN_ERROR("vicmp operator returned null");
6575 delete (yyvsp[(3) - (6)].TypeVal);
6580 #line 3157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6582 if (!UpRefs.empty())
6583 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6584 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6585 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6586 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6588 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6590 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6591 if ((yyval.InstVal) == 0)
6592 GEN_ERROR("vfcmp operator returned null");
6593 delete (yyvsp[(3) - (6)].TypeVal);
6598 #line 3171 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6600 if (!UpRefs.empty())
6601 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6602 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6603 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6604 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6605 GEN_ERROR("invalid cast opcode for cast from '" +
6606 Val->getType()->getDescription() + "' to '" +
6607 DestTy->getDescription() + "'");
6608 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6609 delete (yyvsp[(4) - (4)].TypeVal);
6614 #line 3183 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6616 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6618 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6619 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6620 GEN_ERROR("vector select value types must be vector types");
6621 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6622 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6623 if (cond_type->getElementType() != Type::Int1Ty)
6624 GEN_ERROR("vector select condition element type must be boolean");
6625 if (cond_type->getNumElements() != select_type->getNumElements())
6626 GEN_ERROR("vector select number of elements must be the same");
6628 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6629 GEN_ERROR("select condition must be boolean");
6631 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6632 GEN_ERROR("select value types must match");
6633 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6639 #line 3204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6641 if (!UpRefs.empty())
6642 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6643 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6644 delete (yyvsp[(4) - (4)].TypeVal);
6650 #line 3211 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6652 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6653 GEN_ERROR("Invalid extractelement operands");
6654 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6660 #line 3217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6662 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6663 GEN_ERROR("Invalid insertelement operands");
6664 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6670 #line 3223 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6672 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6673 GEN_ERROR("Invalid shufflevector operands");
6674 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6680 #line 3229 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6682 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6683 if (!Ty->isFirstClassType())
6684 GEN_ERROR("PHI node operands must be of first class type");
6685 (yyval.InstVal) = PHINode::Create(Ty);
6686 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6687 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6688 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6689 GEN_ERROR("All elements of a PHI node must be of the same type");
6690 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6691 (yyvsp[(2) - (2)].PHIList)->pop_front();
6693 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6699 #line 3245 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6702 // Handle the short syntax
6703 const PointerType *PFTy = 0;
6704 const FunctionType *Ty = 0;
6705 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
6706 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6707 // Pull out the types of all of the arguments...
6708 std::vector<const Type*> ParamTypes;
6709 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
6710 for (; I != E; ++I) {
6711 const Type *Ty = I->Val->getType();
6712 if (Ty == Type::VoidTy)
6713 GEN_ERROR("Short call syntax cannot be used with varargs");
6714 ParamTypes.push_back(Ty);
6717 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
6718 GEN_ERROR("Invalid result type for LLVM function");
6720 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
6721 PFTy = PointerType::getUnqual(Ty);
6724 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
6727 // Check for call to invalid intrinsic to avoid crashing later.
6728 if (Function *theF = dyn_cast<Function>(V)) {
6729 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6730 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6731 !theF->getIntrinsicID(true))
6732 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6733 theF->getName() + "'");
6736 // Set up the Attributes for the function
6737 SmallVector<AttributeWithIndex, 8> Attrs;
6738 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6740 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6741 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6742 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
6743 RetAttrs = RetAttrs | Attribute::ZExt;
6744 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
6746 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
6747 RetAttrs = RetAttrs | Attribute::SExt;
6748 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
6750 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
6751 RetAttrs = RetAttrs | Attribute::InReg;
6752 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
6755 if (RetAttrs != Attribute::None)
6756 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
6758 // Check the arguments
6760 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
6761 // Make sure no arguments is a good thing!
6762 if (Ty->getNumParams() != 0)
6763 GEN_ERROR("No arguments passed to a function that "
6764 "expects arguments");
6765 } else { // Has arguments?
6766 // Loop through FunctionType's arguments and ensure they are specified
6767 // correctly. Also, gather any parameter attributes.
6768 FunctionType::param_iterator I = Ty->param_begin();
6769 FunctionType::param_iterator E = Ty->param_end();
6770 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
6773 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6774 if (ArgI->Val->getType() != *I)
6775 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6776 (*I)->getDescription() + "'");
6777 Args.push_back(ArgI->Val);
6778 if (ArgI->Attrs != Attribute::None)
6779 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6781 if (Ty->isVarArg()) {
6783 for (; ArgI != ArgE; ++ArgI, ++index) {
6784 Args.push_back(ArgI->Val); // push the remaining varargs
6785 if (ArgI->Attrs != Attribute::None)
6786 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6788 } else if (I != E || ArgI != ArgE)
6789 GEN_ERROR("Invalid number of parameters detected");
6791 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6792 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
6794 // Finish off the Attributes and check them
6797 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
6799 // Create the call node
6800 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6801 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6802 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
6803 CI->setAttributes(PAL);
6804 (yyval.InstVal) = CI;
6805 delete (yyvsp[(7) - (9)].ParamList);
6806 delete (yyvsp[(4) - (9)].TypeVal);
6812 #line 3354 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6814 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6820 #line 3359 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6822 (yyval.BoolVal) = true;
6828 #line 3363 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6830 (yyval.BoolVal) = false;
6836 #line 3370 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6838 if (!UpRefs.empty())
6839 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6840 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6841 delete (yyvsp[(2) - (3)].TypeVal);
6847 #line 3377 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6849 if (!UpRefs.empty())
6850 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6851 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6852 GEN_ERROR("Malloc array size is not a 32-bit integer!");
6853 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6855 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6856 delete (yyvsp[(2) - (6)].TypeVal);
6861 #line 3387 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6863 if (!UpRefs.empty())
6864 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6865 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6866 delete (yyvsp[(2) - (3)].TypeVal);
6872 #line 3394 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6874 if (!UpRefs.empty())
6875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6876 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6877 GEN_ERROR("Alloca array size is not a 32-bit integer!");
6878 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6880 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6881 delete (yyvsp[(2) - (6)].TypeVal);
6886 #line 3404 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6888 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6889 GEN_ERROR("Trying to free nonpointer type " +
6890 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6891 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6897 #line 3412 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6899 if (!UpRefs.empty())
6900 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6901 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6902 GEN_ERROR("Can't load from nonpointer type: " +
6903 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6904 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6905 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6906 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6907 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6909 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6910 delete (yyvsp[(3) - (5)].TypeVal);
6915 #line 3426 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6917 if (!UpRefs.empty())
6918 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6919 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6921 GEN_ERROR("Can't store to a nonpointer type: " +
6922 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6923 const Type *ElTy = PT->getElementType();
6924 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6925 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6926 "' into space of type '" + ElTy->getDescription() + "'");
6928 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6930 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6931 delete (yyvsp[(5) - (7)].TypeVal);
6936 #line 3443 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6938 if (!UpRefs.empty())
6939 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6940 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6941 GEN_ERROR("getresult insn requires an aggregate operand");
6942 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6943 GEN_ERROR("Invalid getresult index for type '" +
6944 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6946 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6948 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6949 delete (yyvsp[(2) - (5)].TypeVal);
6954 #line 3457 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6956 if (!UpRefs.empty())
6957 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6958 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6959 GEN_ERROR("getelementptr insn requires pointer operand");
6961 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6962 GEN_ERROR("Invalid getelementptr indices for type '" +
6963 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6964 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6966 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6967 delete (yyvsp[(2) - (4)].TypeVal);
6968 delete (yyvsp[(4) - (4)].ValueList);
6973 #line 3472 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6975 if (!UpRefs.empty())
6976 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6977 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6978 GEN_ERROR("extractvalue insn requires an aggregate operand");
6980 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
6981 GEN_ERROR("Invalid extractvalue indices for type '" +
6982 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6983 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6985 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
6986 delete (yyvsp[(2) - (4)].TypeVal);
6987 delete (yyvsp[(4) - (4)].ConstantList);
6992 #line 3487 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
6994 if (!UpRefs.empty())
6995 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6996 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6997 GEN_ERROR("extractvalue insn requires an aggregate operand");
6999 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
7000 GEN_ERROR("Invalid insertvalue indices for type '" +
7001 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7002 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7003 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7005 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
7006 delete (yyvsp[(2) - (7)].TypeVal);
7007 delete (yyvsp[(5) - (7)].TypeVal);
7008 delete (yyvsp[(7) - (7)].ConstantList);
7013 /* Line 1267 of yacc.c. */
7014 #line 7015 "llvmAsmParser.tab.c"
7017 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7021 YY_STACK_PRINT (yyss, yyssp);
7026 /* Now `shift' the result of the reduction. Determine what state
7027 that goes to, based on the state we popped back to and the rule
7028 number reduced by. */
7032 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7033 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
7034 yystate = yytable[yystate];
7036 yystate = yydefgoto[yyn - YYNTOKENS];
7041 /*------------------------------------.
7042 | yyerrlab -- here on detecting error |
7043 `------------------------------------*/
7045 /* If not already recovering from an error, report this error. */
7049 #if ! YYERROR_VERBOSE
7050 yyerror (YY_("syntax error"));
7053 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7054 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7056 YYSIZE_T yyalloc = 2 * yysize;
7057 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7058 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7059 if (yymsg != yymsgbuf)
7060 YYSTACK_FREE (yymsg);
7061 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7063 yymsg_alloc = yyalloc;
7067 yymsg_alloc = sizeof yymsgbuf;
7071 if (0 < yysize && yysize <= yymsg_alloc)
7073 (void) yysyntax_error (yymsg, yystate, yychar);
7078 yyerror (YY_("syntax error"));
7080 goto yyexhaustedlab;
7088 if (yyerrstatus == 3)
7090 /* If just tried and failed to reuse look-ahead token after an
7091 error, discard it. */
7093 if (yychar <= YYEOF)
7095 /* Return failure if at end of input. */
7096 if (yychar == YYEOF)
7101 yydestruct ("Error: discarding",
7107 /* Else will try to reuse look-ahead token after shifting the error
7112 /*---------------------------------------------------.
7113 | yyerrorlab -- error raised explicitly by YYERROR. |
7114 `---------------------------------------------------*/
7117 /* Pacify compilers like GCC when the user code never invokes
7118 YYERROR and the label yyerrorlab therefore never appears in user
7120 if (/*CONSTCOND*/ 0)
7123 /* Do not reclaim the symbols of the rule which action triggered
7127 YY_STACK_PRINT (yyss, yyssp);
7132 /*-------------------------------------------------------------.
7133 | yyerrlab1 -- common code for both syntax error and YYERROR. |
7134 `-------------------------------------------------------------*/
7136 yyerrstatus = 3; /* Each real token shifted decrements this. */
7140 yyn = yypact[yystate];
7141 if (yyn != YYPACT_NINF)
7144 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7152 /* Pop the current state because it cannot handle the error token. */
7157 yydestruct ("Error: popping",
7158 yystos[yystate], yyvsp);
7161 YY_STACK_PRINT (yyss, yyssp);
7170 /* Shift the error token. */
7171 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
7177 /*-------------------------------------.
7178 | yyacceptlab -- YYACCEPT comes here. |
7179 `-------------------------------------*/
7184 /*-----------------------------------.
7185 | yyabortlab -- YYABORT comes here. |
7186 `-----------------------------------*/
7192 /*-------------------------------------------------.
7193 | yyexhaustedlab -- memory exhaustion comes here. |
7194 `-------------------------------------------------*/
7196 yyerror (YY_("memory exhausted"));
7202 if (yychar != YYEOF && yychar != YYEMPTY)
7203 yydestruct ("Cleanup: discarding lookahead",
7205 /* Do not reclaim the symbols of the rule which action triggered
7206 this YYABORT or YYACCEPT. */
7208 YY_STACK_PRINT (yyss, yyssp);
7209 while (yyssp != yyss)
7211 yydestruct ("Cleanup: popping",
7212 yystos[*yyssp], yyvsp);
7217 YYSTACK_FREE (yyss);
7220 if (yymsg != yymsgbuf)
7221 YYSTACK_FREE (yymsg);
7223 /* Make sure YYID is used. */
7224 return YYID (yyresult);
7228 #line 3506 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
7231 // common code from the two 'RunVMAsmParser' functions
7232 static Module* RunParser(Module * M) {
7233 CurModule.CurrentModule = M;
7234 // Check to make sure the parser succeeded
7237 delete ParserResult;
7241 // Emit an error if there are any unresolved types left.
7242 if (!CurModule.LateResolveTypes.empty()) {
7243 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7244 if (DID.Type == ValID::LocalName) {
7245 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7247 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7250 delete ParserResult;
7254 // Emit an error if there are any unresolved values left.
7255 if (!CurModule.LateResolveValues.empty()) {
7256 Value *V = CurModule.LateResolveValues.back();
7257 std::map<Value*, std::pair<ValID, int> >::iterator I =
7258 CurModule.PlaceHolderInfo.find(V);
7260 if (I != CurModule.PlaceHolderInfo.end()) {
7261 ValID &DID = I->second.first;
7262 if (DID.Type == ValID::LocalName) {
7263 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7265 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7268 delete ParserResult;
7273 // Check to make sure that parsing produced a result
7277 // Reset ParserResult variable while saving its value for the result.
7278 Module *Result = ParserResult;
7284 void llvm::GenerateError(const std::string &message, int LineNo) {
7285 if (LineNo == -1) LineNo = LLLgetLineNo();
7286 // TODO: column number in exception
7288 TheParseError->setError(LLLgetFilename(), message, LineNo);
7292 int yyerror(const char *ErrorMsg) {
7293 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
7294 std::string errMsg = where + "error: " + std::string(ErrorMsg);
7295 if (yychar != YYEMPTY && yychar != 0) {
7296 errMsg += " while reading token: '";
7297 errMsg += std::string(LLLgetTokenStart(),
7298 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7300 GenerateError(errMsg);