1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
90 ZEROINITIALIZER = 281,
133 X86_STDCALLCC_TOK = 324,
134 X86_FASTCALLCC_TOK = 325,
206 EXTRACTELEMENT = 397,
214 #define ESINT64VAL 258
215 #define EUINT64VAL 259
235 #define STRINGCONSTANT 279
236 #define IMPLEMENTATION 280
237 #define ZEROINITIALIZER 281
248 #define DOTDOTDOT 292
255 #define APPENDING 299
256 #define DLLIMPORT 300
257 #define DLLEXPORT 301
258 #define EXTERN_WEAK 302
265 #define POINTERSIZE 309
274 #define SIDEEFFECT 318
277 #define CSRETCC_TOK 321
278 #define FASTCC_TOK 322
279 #define COLDCC_TOK 323
280 #define X86_STDCALLCC_TOK 324
281 #define X86_FASTCALLCC_TOK 325
282 #define DATALAYOUT 326
288 #define UNREACHABLE 332
334 #define GETELEMENTPTR 378
353 #define EXTRACTELEMENT 397
354 #define INSERTELEMENT 398
355 #define SHUFFLEVECTOR 399
356 #define VAARG_old 400
357 #define VANEXT_old 401
362 /* Copy the first part of user declarations. */
363 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
365 #include "ParserInternals.h"
366 #include "llvm/CallingConv.h"
367 #include "llvm/InlineAsm.h"
368 #include "llvm/Instructions.h"
369 #include "llvm/Module.h"
370 #include "llvm/SymbolTable.h"
371 #include "llvm/Support/GetElementPtrTypeIterator.h"
372 #include "llvm/ADT/STLExtras.h"
373 #include "llvm/Support/MathExtras.h"
374 #include "llvm/Support/Streams.h"
379 // The following is a gross hack. In order to rid the libAsmParser library of
380 // exceptions, we have to have a way of getting the yyparse function to go into
381 // an error situation. So, whenever we want an error to occur, the GenerateError
382 // function (see bottom of file) sets TriggerError. Then, at the end of each
383 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
384 // (a goto) to put YACC in error state. Furthermore, several calls to
385 // GenerateError are made from inside productions and they must simulate the
386 // previous exception behavior by exiting the production immediately. We have
387 // replaced these with the GEN_ERROR macro which calls GeneratError and then
388 // immediately invokes YYERROR. This would be so much cleaner if it was a
389 // recursive descent parser.
390 static bool TriggerError = false;
391 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
392 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
394 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
395 int yylex(); // declaration" of xxx warnings.
399 std::string CurFilename;
401 using namespace llvm;
403 static Module *ParserResult;
405 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
406 // relating to upreferences in the input stream.
408 //#define DEBUG_UPREFS 1
410 #define UR_OUT(X) llvm_cerr << X
415 #define YYERROR_VERBOSE 1
417 static bool ObsoleteVarArgs;
418 static bool NewVarArgs;
419 static BasicBlock *CurBB;
420 static GlobalVariable *CurGV;
423 // This contains info used when building the body of a function. It is
424 // destroyed when the function is completed.
426 typedef std::vector<Value *> ValueList; // Numbered defs
428 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
429 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
431 static struct PerModuleInfo {
432 Module *CurrentModule;
433 std::map<const Type *, ValueList> Values; // Module level numbered definitions
434 std::map<const Type *,ValueList> LateResolveValues;
435 std::vector<PATypeHolder> Types;
436 std::map<ValID, PATypeHolder> LateResolveTypes;
438 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
439 /// how they were referenced and on which line of the input they came from so
440 /// that we can resolve them later and print error messages as appropriate.
441 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
443 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
444 // references to global values. Global values may be referenced before they
445 // are defined, and if so, the temporary object that they represent is held
446 // here. This is used for forward references of GlobalValues.
448 typedef std::map<std::pair<const PointerType *,
449 ValID>, GlobalValue*> GlobalRefsType;
450 GlobalRefsType GlobalRefs;
453 // If we could not resolve some functions at function compilation time
454 // (calls to functions before they are defined), resolve them now... Types
455 // are resolved when the constant pool has been completely parsed.
457 ResolveDefinitions(LateResolveValues);
461 // Check to make sure that all global value forward references have been
464 if (!GlobalRefs.empty()) {
465 std::string UndefinedReferences = "Unresolved global references exist:\n";
467 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
469 UndefinedReferences += " " + I->first.first->getDescription() + " " +
470 I->first.second.getName() + "\n";
472 GenerateError(UndefinedReferences);
476 Values.clear(); // Clear out function local definitions
481 // GetForwardRefForGlobal - Check to see if there is a forward reference
482 // for this global. If so, remove it from the GlobalRefs map and return it.
483 // If not, just return null.
484 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
485 // Check to see if there is a forward reference to this global variable...
486 // if there is, eliminate it and patch the reference to use the new def'n.
487 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
488 GlobalValue *Ret = 0;
489 if (I != GlobalRefs.end()) {
497 static struct PerFunctionInfo {
498 Function *CurrentFunction; // Pointer to current function being created
500 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
501 std::map<const Type*, ValueList> LateResolveValues;
502 bool isDeclare; // Is this function a forward declararation?
503 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
505 /// BBForwardRefs - When we see forward references to basic blocks, keep
506 /// track of them here.
507 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
508 std::vector<BasicBlock*> NumberedBlocks;
511 inline PerFunctionInfo() {
514 Linkage = GlobalValue::ExternalLinkage;
517 inline void FunctionStart(Function *M) {
522 void FunctionDone() {
523 NumberedBlocks.clear();
525 // Any forward referenced blocks left?
526 if (!BBForwardRefs.empty()) {
527 GenerateError("Undefined reference to label " +
528 BBForwardRefs.begin()->first->getName());
532 // Resolve all forward references now.
533 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
535 Values.clear(); // Clear out function local definitions
538 Linkage = GlobalValue::ExternalLinkage;
540 } CurFun; // Info for the current function...
542 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
545 //===----------------------------------------------------------------------===//
546 // Code to handle definitions of all the types
547 //===----------------------------------------------------------------------===//
549 static int InsertValue(Value *V,
550 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
551 if (V->hasName()) return -1; // Is this a numbered definition?
553 // Yes, insert the value into the value table...
554 ValueList &List = ValueTab[V->getType()];
556 return List.size()-1;
559 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
561 case ValID::NumberVal: // Is it a numbered definition?
562 // Module constants occupy the lowest numbered slots...
563 if ((unsigned)D.Num < CurModule.Types.size())
564 return CurModule.Types[(unsigned)D.Num];
566 case ValID::NameVal: // Is it a named definition?
567 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
568 D.destroy(); // Free old strdup'd memory...
573 GenerateError("Internal parser error: Invalid symbol type reference!");
577 // If we reached here, we referenced either a symbol that we don't know about
578 // or an id number that hasn't been read yet. We may be referencing something
579 // forward, so just create an entry to be resolved later and get to it...
581 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
584 if (inFunctionScope()) {
585 if (D.Type == ValID::NameVal) {
586 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
589 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
594 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
595 if (I != CurModule.LateResolveTypes.end())
598 Type *Typ = OpaqueType::get();
599 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
603 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
604 SymbolTable &SymTab =
605 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
606 CurModule.CurrentModule->getSymbolTable();
607 return SymTab.lookup(Ty, Name);
610 // getValNonImprovising - Look up the value specified by the provided type and
611 // the provided ValID. If the value exists and has already been defined, return
612 // it. Otherwise return null.
614 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
615 if (isa<FunctionType>(Ty)) {
616 GenerateError("Functions are not values and "
617 "must be referenced as pointers");
622 case ValID::NumberVal: { // Is it a numbered definition?
623 unsigned Num = (unsigned)D.Num;
625 // Module constants occupy the lowest numbered slots...
626 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
627 if (VI != CurModule.Values.end()) {
628 if (Num < VI->second.size())
629 return VI->second[Num];
630 Num -= VI->second.size();
633 // Make sure that our type is within bounds
634 VI = CurFun.Values.find(Ty);
635 if (VI == CurFun.Values.end()) return 0;
637 // Check that the number is within bounds...
638 if (VI->second.size() <= Num) return 0;
640 return VI->second[Num];
643 case ValID::NameVal: { // Is it a named definition?
644 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
645 if (N == 0) return 0;
647 D.destroy(); // Free old strdup'd memory...
651 // Check to make sure that "Ty" is an integral type, and that our
652 // value will fit into the specified type...
653 case ValID::ConstSIntVal: // Is it a constant pool reference??
654 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
655 GenerateError("Signed integral constant '" +
656 itostr(D.ConstPool64) + "' is invalid for type '" +
657 Ty->getDescription() + "'!");
660 return ConstantInt::get(Ty, D.ConstPool64);
662 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
663 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
664 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
665 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
666 "' is invalid or out of range!");
668 } else { // This is really a signed reference. Transmogrify.
669 return ConstantInt::get(Ty, D.ConstPool64);
672 return ConstantInt::get(Ty, D.UConstPool64);
675 case ValID::ConstFPVal: // Is it a floating point const pool reference?
676 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
677 GenerateError("FP constant invalid for type!!");
680 return ConstantFP::get(Ty, D.ConstPoolFP);
682 case ValID::ConstNullVal: // Is it a null value?
683 if (!isa<PointerType>(Ty)) {
684 GenerateError("Cannot create a a non pointer null!");
687 return ConstantPointerNull::get(cast<PointerType>(Ty));
689 case ValID::ConstUndefVal: // Is it an undef value?
690 return UndefValue::get(Ty);
692 case ValID::ConstZeroVal: // Is it a zero value?
693 return Constant::getNullValue(Ty);
695 case ValID::ConstantVal: // Fully resolved constant?
696 if (D.ConstantValue->getType() != Ty) {
697 GenerateError("Constant expression type different from required type!");
700 return D.ConstantValue;
702 case ValID::InlineAsmVal: { // Inline asm expression
703 const PointerType *PTy = dyn_cast<PointerType>(Ty);
704 const FunctionType *FTy =
705 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
706 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
707 GenerateError("Invalid type for asm constraint string!");
710 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
711 D.IAD->HasSideEffects);
712 D.destroy(); // Free InlineAsmDescriptor.
716 assert(0 && "Unhandled case!");
720 assert(0 && "Unhandled case!");
724 // getVal - This function is identical to getValNonImprovising, except that if a
725 // value is not already defined, it "improvises" by creating a placeholder var
726 // that looks and acts just like the requested variable. When the value is
727 // defined later, all uses of the placeholder variable are replaced with the
730 static Value *getVal(const Type *Ty, const ValID &ID) {
731 if (Ty == Type::LabelTy) {
732 GenerateError("Cannot use a basic block here");
736 // See if the value has already been defined.
737 Value *V = getValNonImprovising(Ty, ID);
739 if (TriggerError) return 0;
741 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
742 GenerateError("Invalid use of a composite type!");
746 // If we reached here, we referenced either a symbol that we don't know about
747 // or an id number that hasn't been read yet. We may be referencing something
748 // forward, so just create an entry to be resolved later and get to it...
750 V = new Argument(Ty);
752 // Remember where this forward reference came from. FIXME, shouldn't we try
753 // to recycle these things??
754 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
757 if (inFunctionScope())
758 InsertValue(V, CurFun.LateResolveValues);
760 InsertValue(V, CurModule.LateResolveValues);
764 /// getBBVal - This is used for two purposes:
765 /// * If isDefinition is true, a new basic block with the specified ID is being
767 /// * If isDefinition is true, this is a reference to a basic block, which may
768 /// or may not be a forward reference.
770 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
771 assert(inFunctionScope() && "Can't get basic block at global scope!");
777 GenerateError("Illegal label reference " + ID.getName());
779 case ValID::NumberVal: // Is it a numbered definition?
780 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
781 CurFun.NumberedBlocks.resize(ID.Num+1);
782 BB = CurFun.NumberedBlocks[ID.Num];
784 case ValID::NameVal: // Is it a named definition?
786 if (Value *N = CurFun.CurrentFunction->
787 getSymbolTable().lookup(Type::LabelTy, Name))
788 BB = cast<BasicBlock>(N);
792 // See if the block has already been defined.
794 // If this is the definition of the block, make sure the existing value was
795 // just a forward reference. If it was a forward reference, there will be
796 // an entry for it in the PlaceHolderInfo map.
797 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
798 // The existing value was a definition, not a forward reference.
799 GenerateError("Redefinition of label " + ID.getName());
803 ID.destroy(); // Free strdup'd memory.
807 // Otherwise this block has not been seen before.
808 BB = new BasicBlock("", CurFun.CurrentFunction);
809 if (ID.Type == ValID::NameVal) {
810 BB->setName(ID.Name);
812 CurFun.NumberedBlocks[ID.Num] = BB;
815 // If this is not a definition, keep track of it so we can use it as a forward
818 // Remember where this forward reference came from.
819 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
821 // The forward declaration could have been inserted anywhere in the
822 // function: insert it into the correct place now.
823 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
824 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
831 //===----------------------------------------------------------------------===//
832 // Code to handle forward references in instructions
833 //===----------------------------------------------------------------------===//
835 // This code handles the late binding needed with statements that reference
836 // values not defined yet... for example, a forward branch, or the PHI node for
839 // This keeps a table (CurFun.LateResolveValues) of all such forward references
840 // and back patchs after we are done.
843 // ResolveDefinitions - If we could not resolve some defs at parsing
844 // time (forward branches, phi functions for loops, etc...) resolve the
848 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
849 std::map<const Type*,ValueList> *FutureLateResolvers) {
850 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
851 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
852 E = LateResolvers.end(); LRI != E; ++LRI) {
853 ValueList &List = LRI->second;
854 while (!List.empty()) {
855 Value *V = List.back();
858 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
859 CurModule.PlaceHolderInfo.find(V);
860 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
862 ValID &DID = PHI->second.first;
864 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
868 V->replaceAllUsesWith(TheRealValue);
870 CurModule.PlaceHolderInfo.erase(PHI);
871 } else if (FutureLateResolvers) {
872 // Functions have their unresolved items forwarded to the module late
874 InsertValue(V, *FutureLateResolvers);
876 if (DID.Type == ValID::NameVal) {
877 GenerateError("Reference to an invalid definition: '" +DID.getName()+
878 "' of type '" + V->getType()->getDescription() + "'",
882 GenerateError("Reference to an invalid definition: #" +
883 itostr(DID.Num) + " of type '" +
884 V->getType()->getDescription() + "'",
892 LateResolvers.clear();
895 // ResolveTypeTo - A brand new type was just declared. This means that (if
896 // name is not null) things referencing Name can be resolved. Otherwise, things
897 // refering to the number can be resolved. Do this now.
899 static void ResolveTypeTo(char *Name, const Type *ToTy) {
901 if (Name) D = ValID::create(Name);
902 else D = ValID::create((int)CurModule.Types.size());
904 std::map<ValID, PATypeHolder>::iterator I =
905 CurModule.LateResolveTypes.find(D);
906 if (I != CurModule.LateResolveTypes.end()) {
907 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
908 CurModule.LateResolveTypes.erase(I);
912 // setValueName - Set the specified value to the name given. The name may be
913 // null potentially, in which case this is a noop. The string passed in is
914 // assumed to be a malloc'd string buffer, and is free'd by this function.
916 static void setValueName(Value *V, char *NameStr) {
918 std::string Name(NameStr); // Copy string
919 free(NameStr); // Free old string
921 if (V->getType() == Type::VoidTy) {
922 GenerateError("Can't assign name '" + Name+"' to value with void type!");
926 assert(inFunctionScope() && "Must be in function scope!");
927 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
928 if (ST.lookup(V->getType(), Name)) {
929 GenerateError("Redefinition of value named '" + Name + "' in the '" +
930 V->getType()->getDescription() + "' type plane!");
939 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
940 /// this is a declaration, otherwise it is a definition.
941 static GlobalVariable *
942 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
943 bool isConstantGlobal, const Type *Ty,
944 Constant *Initializer) {
945 if (isa<FunctionType>(Ty)) {
946 GenerateError("Cannot declare global vars of function type!");
950 const PointerType *PTy = PointerType::get(Ty);
954 Name = NameStr; // Copy string
955 free(NameStr); // Free old string
958 // See if this global value was forward referenced. If so, recycle the
962 ID = ValID::create((char*)Name.c_str());
964 ID = ValID::create((int)CurModule.Values[PTy].size());
967 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
968 // Move the global to the end of the list, from whereever it was
969 // previously inserted.
970 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
971 CurModule.CurrentModule->getGlobalList().remove(GV);
972 CurModule.CurrentModule->getGlobalList().push_back(GV);
973 GV->setInitializer(Initializer);
974 GV->setLinkage(Linkage);
975 GV->setConstant(isConstantGlobal);
976 InsertValue(GV, CurModule.Values);
980 // If this global has a name, check to see if there is already a definition
981 // of this global in the module. If so, merge as appropriate. Note that
982 // this is really just a hack around problems in the CFE. :(
984 // We are a simple redefinition of a value, check to see if it is defined
985 // the same as the old one.
986 if (GlobalVariable *EGV =
987 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
988 // We are allowed to redefine a global variable in two circumstances:
989 // 1. If at least one of the globals is uninitialized or
990 // 2. If both initializers have the same value.
992 if (!EGV->hasInitializer() || !Initializer ||
993 EGV->getInitializer() == Initializer) {
995 // Make sure the existing global version gets the initializer! Make
996 // sure that it also gets marked const if the new version is.
997 if (Initializer && !EGV->hasInitializer())
998 EGV->setInitializer(Initializer);
999 if (isConstantGlobal)
1000 EGV->setConstant(true);
1001 EGV->setLinkage(Linkage);
1005 GenerateError("Redefinition of global variable named '" + Name +
1006 "' in the '" + Ty->getDescription() + "' type plane!");
1011 // Otherwise there is no existing GV to use, create one now.
1012 GlobalVariable *GV =
1013 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1014 CurModule.CurrentModule);
1015 InsertValue(GV, CurModule.Values);
1019 // setTypeName - Set the specified type to the name given. The name may be
1020 // null potentially, in which case this is a noop. The string passed in is
1021 // assumed to be a malloc'd string buffer, and is freed by this function.
1023 // This function returns true if the type has already been defined, but is
1024 // allowed to be redefined in the specified context. If the name is a new name
1025 // for the type plane, it is inserted and false is returned.
1026 static bool setTypeName(const Type *T, char *NameStr) {
1027 assert(!inFunctionScope() && "Can't give types function-local names!");
1028 if (NameStr == 0) return false;
1030 std::string Name(NameStr); // Copy string
1031 free(NameStr); // Free old string
1033 // We don't allow assigning names to void type
1034 if (T == Type::VoidTy) {
1035 GenerateError("Can't assign name '" + Name + "' to the void type!");
1039 // Set the type name, checking for conflicts as we do so.
1040 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1042 if (AlreadyExists) { // Inserting a name that is already defined???
1043 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1044 assert(Existing && "Conflict but no matching type?");
1046 // There is only one case where this is allowed: when we are refining an
1047 // opaque type. In this case, Existing will be an opaque type.
1048 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1049 // We ARE replacing an opaque type!
1050 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1054 // Otherwise, this is an attempt to redefine a type. That's okay if
1055 // the redefinition is identical to the original. This will be so if
1056 // Existing and T point to the same Type object. In this one case we
1057 // allow the equivalent redefinition.
1058 if (Existing == T) return true; // Yes, it's equal.
1060 // Any other kind of (non-equivalent) redefinition is an error.
1061 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1062 T->getDescription() + "' type plane!");
1068 //===----------------------------------------------------------------------===//
1069 // Code for handling upreferences in type names...
1072 // TypeContains - Returns true if Ty directly contains E in it.
1074 static bool TypeContains(const Type *Ty, const Type *E) {
1075 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1076 E) != Ty->subtype_end();
1080 struct UpRefRecord {
1081 // NestingLevel - The number of nesting levels that need to be popped before
1082 // this type is resolved.
1083 unsigned NestingLevel;
1085 // LastContainedTy - This is the type at the current binding level for the
1086 // type. Every time we reduce the nesting level, this gets updated.
1087 const Type *LastContainedTy;
1089 // UpRefTy - This is the actual opaque type that the upreference is
1090 // represented with.
1091 OpaqueType *UpRefTy;
1093 UpRefRecord(unsigned NL, OpaqueType *URTy)
1094 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1098 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1099 static std::vector<UpRefRecord> UpRefs;
1101 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1102 /// called. It loops through the UpRefs vector, which is a list of the
1103 /// currently active types. For each type, if the up reference is contained in
1104 /// the newly completed type, we decrement the level count. When the level
1105 /// count reaches zero, the upreferenced type is the type that is passed in:
1106 /// thus we can complete the cycle.
1108 static PATypeHolder HandleUpRefs(const Type *ty) {
1109 // If Ty isn't abstract, or if there are no up-references in it, then there is
1110 // nothing to resolve here.
1111 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1113 PATypeHolder Ty(ty);
1114 UR_OUT("Type '" << Ty->getDescription() <<
1115 "' newly formed. Resolving upreferences.\n" <<
1116 UpRefs.size() << " upreferences active!\n");
1118 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1119 // to zero), we resolve them all together before we resolve them to Ty. At
1120 // the end of the loop, if there is anything to resolve to Ty, it will be in
1122 OpaqueType *TypeToResolve = 0;
1124 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1125 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1126 << UpRefs[i].second->getDescription() << ") = "
1127 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1128 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1129 // Decrement level of upreference
1130 unsigned Level = --UpRefs[i].NestingLevel;
1131 UpRefs[i].LastContainedTy = Ty;
1132 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1133 if (Level == 0) { // Upreference should be resolved!
1134 if (!TypeToResolve) {
1135 TypeToResolve = UpRefs[i].UpRefTy;
1137 UR_OUT(" * Resolving upreference for "
1138 << UpRefs[i].second->getDescription() << "\n";
1139 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1140 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1141 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1142 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1144 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1145 --i; // Do not skip the next element...
1150 if (TypeToResolve) {
1151 UR_OUT(" * Resolving upreference for "
1152 << UpRefs[i].second->getDescription() << "\n";
1153 std::string OldName = TypeToResolve->getDescription());
1154 TypeToResolve->refineAbstractTypeTo(Ty);
1160 // common code from the two 'RunVMAsmParser' functions
1161 static Module* RunParser(Module * M) {
1163 llvmAsmlineno = 1; // Reset the current line number...
1164 ObsoleteVarArgs = false;
1166 CurModule.CurrentModule = M;
1168 // Check to make sure the parser succeeded
1171 delete ParserResult;
1175 // Check to make sure that parsing produced a result
1179 // Reset ParserResult variable while saving its value for the result.
1180 Module *Result = ParserResult;
1183 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1186 if ((F = Result->getNamedFunction("llvm.va_start"))
1187 && F->getFunctionType()->getNumParams() == 0)
1188 ObsoleteVarArgs = true;
1189 if((F = Result->getNamedFunction("llvm.va_copy"))
1190 && F->getFunctionType()->getNumParams() == 1)
1191 ObsoleteVarArgs = true;
1194 if (ObsoleteVarArgs && NewVarArgs) {
1196 "This file is corrupt: it uses both new and old style varargs");
1200 if(ObsoleteVarArgs) {
1201 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1202 if (F->arg_size() != 0) {
1203 GenerateError("Obsolete va_start takes 0 argument!");
1209 //bar = alloca typeof(foo)
1213 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1214 const Type* ArgTy = F->getFunctionType()->getReturnType();
1215 const Type* ArgTyPtr = PointerType::get(ArgTy);
1216 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1217 RetTy, ArgTyPtr, (Type *)0);
1219 while (!F->use_empty()) {
1220 CallInst* CI = cast<CallInst>(F->use_back());
1221 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1222 new CallInst(NF, bar, "", CI);
1223 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1224 CI->replaceAllUsesWith(foo);
1225 CI->getParent()->getInstList().erase(CI);
1227 Result->getFunctionList().erase(F);
1230 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1231 if(F->arg_size() != 1) {
1232 GenerateError("Obsolete va_end takes 1 argument!");
1238 //bar = alloca 1 of typeof(foo)
1240 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1241 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1242 const Type* ArgTyPtr = PointerType::get(ArgTy);
1243 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1244 RetTy, ArgTyPtr, (Type *)0);
1246 while (!F->use_empty()) {
1247 CallInst* CI = cast<CallInst>(F->use_back());
1248 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1249 new StoreInst(CI->getOperand(1), bar, CI);
1250 new CallInst(NF, bar, "", CI);
1251 CI->getParent()->getInstList().erase(CI);
1253 Result->getFunctionList().erase(F);
1256 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1257 if(F->arg_size() != 1) {
1258 GenerateError("Obsolete va_copy takes 1 argument!");
1263 //a = alloca 1 of typeof(foo)
1264 //b = alloca 1 of typeof(foo)
1269 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1270 const Type* ArgTy = F->getFunctionType()->getReturnType();
1271 const Type* ArgTyPtr = PointerType::get(ArgTy);
1272 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1273 RetTy, ArgTyPtr, ArgTyPtr,
1276 while (!F->use_empty()) {
1277 CallInst* CI = cast<CallInst>(F->use_back());
1278 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1279 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1280 new StoreInst(CI->getOperand(1), b, CI);
1281 new CallInst(NF, a, b, "", CI);
1282 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1283 CI->replaceAllUsesWith(foo);
1284 CI->getParent()->getInstList().erase(CI);
1286 Result->getFunctionList().erase(F);
1293 //===----------------------------------------------------------------------===//
1294 // RunVMAsmParser - Define an interface to this parser
1295 //===----------------------------------------------------------------------===//
1297 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1300 CurFilename = Filename;
1301 return RunParser(new Module(CurFilename));
1304 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1305 set_scan_string(AsmString);
1307 CurFilename = "from_memory";
1309 return RunParser(new Module (CurFilename));
1311 return RunParser(M);
1317 /* Enabling traces. */
1322 /* Enabling verbose error messages. */
1323 #ifdef YYERROR_VERBOSE
1324 # undef YYERROR_VERBOSE
1325 # define YYERROR_VERBOSE 1
1327 # define YYERROR_VERBOSE 0
1330 /* Enabling the token table. */
1331 #ifndef YYTOKEN_TABLE
1332 # define YYTOKEN_TABLE 0
1335 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1336 #line 967 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1337 typedef union YYSTYPE {
1338 llvm::Module *ModuleVal;
1339 llvm::Function *FunctionVal;
1340 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1341 llvm::BasicBlock *BasicBlockVal;
1342 llvm::TerminatorInst *TermInstVal;
1343 llvm::Instruction *InstVal;
1344 llvm::Constant *ConstVal;
1346 const llvm::Type *PrimType;
1347 llvm::PATypeHolder *TypeVal;
1348 llvm::Value *ValueVal;
1350 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1351 std::vector<llvm::Value*> *ValueList;
1352 std::list<llvm::PATypeHolder> *TypeList;
1353 // Represent the RHS of PHI node
1354 std::list<std::pair<llvm::Value*,
1355 llvm::BasicBlock*> > *PHIList;
1356 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1357 std::vector<llvm::Constant*> *ConstVector;
1359 llvm::GlobalValue::LinkageTypes Linkage;
1367 char *StrVal; // This memory is strdup'd!
1368 llvm::ValID ValIDVal; // strdup'd memory maybe!
1370 llvm::Instruction::BinaryOps BinaryOpVal;
1371 llvm::Instruction::TermOps TermOpVal;
1372 llvm::Instruction::MemoryOps MemOpVal;
1373 llvm::Instruction::CastOps CastOpVal;
1374 llvm::Instruction::OtherOps OtherOpVal;
1375 llvm::Module::Endianness Endianness;
1376 llvm::ICmpInst::Predicate IPredicate;
1377 llvm::FCmpInst::Predicate FPredicate;
1379 /* Line 196 of yacc.c. */
1380 #line 1381 "llvmAsmParser.tab.c"
1381 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1382 # define YYSTYPE_IS_DECLARED 1
1383 # define YYSTYPE_IS_TRIVIAL 1
1388 /* Copy the second part of user declarations. */
1391 /* Line 219 of yacc.c. */
1392 #line 1393 "llvmAsmParser.tab.c"
1394 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1395 # define YYSIZE_T __SIZE_TYPE__
1397 #if ! defined (YYSIZE_T) && defined (size_t)
1398 # define YYSIZE_T size_t
1400 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1401 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1402 # define YYSIZE_T size_t
1404 #if ! defined (YYSIZE_T)
1405 # define YYSIZE_T unsigned int
1411 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1412 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1416 # define YY_(msgid) msgid
1420 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1422 /* The parser invokes alloca or malloc; define the necessary symbols. */
1424 # ifdef YYSTACK_USE_ALLOCA
1425 # if YYSTACK_USE_ALLOCA
1427 # define YYSTACK_ALLOC __builtin_alloca
1429 # define YYSTACK_ALLOC alloca
1430 # if defined (__STDC__) || defined (__cplusplus)
1431 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1432 # define YYINCLUDED_STDLIB_H
1438 # ifdef YYSTACK_ALLOC
1439 /* Pacify GCC's `empty if-body' warning. */
1440 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1441 # ifndef YYSTACK_ALLOC_MAXIMUM
1442 /* The OS might guarantee only one guard page at the bottom of the stack,
1443 and a page size can be as small as 4096 bytes. So we cannot safely
1444 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1445 to allow for a few compiler-allocated temporary stack slots. */
1446 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1449 # define YYSTACK_ALLOC YYMALLOC
1450 # define YYSTACK_FREE YYFREE
1451 # ifndef YYSTACK_ALLOC_MAXIMUM
1452 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1458 # define YYMALLOC malloc
1459 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1460 && (defined (__STDC__) || defined (__cplusplus)))
1461 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1465 # define YYFREE free
1466 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1467 && (defined (__STDC__) || defined (__cplusplus)))
1468 void free (void *); /* INFRINGES ON USER NAME SPACE */
1475 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1478 #if (! defined (yyoverflow) \
1479 && (! defined (__cplusplus) \
1480 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1482 /* A type that is properly aligned for any stack member. */
1489 /* The size of the maximum gap between one aligned stack and the next. */
1490 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1492 /* The size of an array large to enough to hold all stacks, each with
1494 # define YYSTACK_BYTES(N) \
1495 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1496 + YYSTACK_GAP_MAXIMUM)
1498 /* Copy COUNT objects from FROM to TO. The source and destination do
1501 # if defined (__GNUC__) && 1 < __GNUC__
1502 # define YYCOPY(To, From, Count) \
1503 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1505 # define YYCOPY(To, From, Count) \
1509 for (yyi = 0; yyi < (Count); yyi++) \
1510 (To)[yyi] = (From)[yyi]; \
1516 /* Relocate STACK from its old location to the new one. The
1517 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1518 elements in the stack, and YYPTR gives the new location of the
1519 stack. Advance YYPTR to a properly aligned location for the next
1521 # define YYSTACK_RELOCATE(Stack) \
1524 YYSIZE_T yynewbytes; \
1525 YYCOPY (&yyptr->Stack, Stack, yysize); \
1526 Stack = &yyptr->Stack; \
1527 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1528 yyptr += yynewbytes / sizeof (*yyptr); \
1534 #if defined (__STDC__) || defined (__cplusplus)
1535 typedef signed char yysigned_char;
1537 typedef short int yysigned_char;
1540 /* YYFINAL -- State number of the termination state. */
1542 /* YYLAST -- Last index in YYTABLE. */
1545 /* YYNTOKENS -- Number of terminals. */
1546 #define YYNTOKENS 161
1547 /* YYNNTS -- Number of nonterminals. */
1549 /* YYNRULES -- Number of rules. */
1550 #define YYNRULES 299
1551 /* YYNRULES -- Number of states. */
1552 #define YYNSTATES 586
1554 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1555 #define YYUNDEFTOK 2
1556 #define YYMAXUTOK 401
1558 #define YYTRANSLATE(YYX) \
1559 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1561 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1562 static const unsigned char yytranslate[] =
1564 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1568 150, 151, 159, 2, 148, 2, 2, 2, 2, 2,
1569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1570 155, 147, 156, 2, 2, 2, 2, 2, 2, 2,
1571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1573 2, 152, 149, 154, 2, 2, 2, 2, 2, 160,
1574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1576 153, 2, 2, 157, 2, 158, 2, 2, 2, 2,
1577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1589 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1590 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1591 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1592 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1593 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1594 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1595 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1596 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1597 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1598 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1599 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1600 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1601 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1602 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1603 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1608 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1610 static const unsigned short int yyprhs[] =
1612 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1613 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1614 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1615 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1616 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1617 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1618 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1619 139, 141, 143, 145, 147, 149, 151, 153, 156, 157,
1620 159, 161, 163, 165, 167, 169, 171, 172, 173, 175,
1621 177, 179, 181, 183, 185, 188, 189, 192, 193, 197,
1622 200, 201, 203, 204, 208, 210, 213, 215, 217, 219,
1623 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1624 241, 243, 245, 247, 249, 251, 253, 255, 258, 263,
1625 269, 275, 279, 282, 285, 287, 291, 293, 297, 299,
1626 300, 305, 309, 313, 318, 323, 327, 330, 333, 336,
1627 339, 342, 345, 348, 351, 354, 357, 364, 370, 379,
1628 386, 393, 400, 408, 416, 423, 430, 439, 448, 452,
1629 454, 456, 458, 460, 463, 466, 471, 474, 476, 481,
1630 484, 489, 490, 498, 499, 507, 508, 516, 517, 525,
1631 529, 534, 535, 537, 539, 541, 545, 549, 553, 557,
1632 561, 565, 567, 568, 570, 572, 574, 575, 578, 582,
1633 584, 586, 590, 592, 593, 602, 604, 606, 610, 612,
1634 614, 617, 618, 620, 622, 623, 628, 629, 631, 633,
1635 635, 637, 639, 641, 643, 645, 647, 651, 653, 659,
1636 661, 663, 665, 667, 670, 673, 676, 680, 683, 684,
1637 686, 689, 692, 696, 706, 716, 725, 739, 741, 743,
1638 750, 756, 759, 766, 774, 776, 780, 782, 783, 786,
1639 788, 794, 800, 806, 813, 820, 823, 828, 833, 840,
1640 845, 850, 855, 860, 867, 874, 877, 885, 887, 890,
1641 891, 893, 894, 898, 905, 909, 916, 919, 924, 931
1644 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1645 static const short int yyrhs[] =
1647 195, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1648 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1649 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1650 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1651 -1, 93, -1, 94, -1, 95, -1, 124, -1, 125,
1652 -1, 126, -1, 127, -1, 128, -1, 129, -1, 130,
1653 -1, 131, -1, 132, -1, 133, -1, 134, -1, 135,
1654 -1, 138, -1, 139, -1, 140, -1, 98, -1, 99,
1655 -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
1656 -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
1657 -1, 110, -1, 111, -1, 112, -1, 113, -1, 114,
1658 -1, 115, -1, 116, -1, 117, -1, 104, -1, 105,
1659 -1, 106, -1, 107, -1, 27, -1, 28, -1, 16,
1660 -1, 14, -1, 12, -1, 10, -1, 17, -1, 15,
1661 -1, 13, -1, 11, -1, 171, -1, 172, -1, 18,
1662 -1, 19, -1, 207, 147, -1, -1, 41, -1, 42,
1663 -1, 43, -1, 44, -1, 45, -1, 46, -1, 47,
1664 -1, -1, -1, 65, -1, 66, -1, 67, -1, 68,
1665 -1, 69, -1, 70, -1, 64, 4, -1, -1, 57,
1666 4, -1, -1, 148, 57, 4, -1, 34, 24, -1,
1667 -1, 180, -1, -1, 148, 183, 182, -1, 180, -1,
1668 57, 4, -1, 186, -1, 8, -1, 188, -1, 8,
1669 -1, 188, -1, 9, -1, 10, -1, 11, -1, 12,
1670 -1, 13, -1, 14, -1, 15, -1, 16, -1, 17,
1671 -1, 18, -1, 19, -1, 20, -1, 21, -1, 48,
1672 -1, 187, -1, 222, -1, 149, 4, -1, 185, 150,
1673 190, 151, -1, 152, 4, 153, 188, 154, -1, 155,
1674 4, 153, 188, 156, -1, 157, 189, 158, -1, 157,
1675 158, -1, 188, 159, -1, 188, -1, 189, 148, 188,
1676 -1, 189, -1, 189, 148, 37, -1, 37, -1, -1,
1677 186, 152, 193, 154, -1, 186, 152, 154, -1, 186,
1678 160, 24, -1, 186, 155, 193, 156, -1, 186, 157,
1679 193, 158, -1, 186, 157, 158, -1, 186, 38, -1,
1680 186, 39, -1, 186, 222, -1, 186, 192, -1, 186,
1681 26, -1, 171, 163, -1, 172, 4, -1, 9, 27,
1682 -1, 9, 28, -1, 174, 7, -1, 167, 150, 191,
1683 36, 186, 151, -1, 123, 150, 191, 236, 151, -1,
1684 137, 150, 191, 148, 191, 148, 191, 151, -1, 164,
1685 150, 191, 148, 191, 151, -1, 165, 150, 191, 148,
1686 191, 151, -1, 166, 150, 191, 148, 191, 151, -1,
1687 96, 169, 150, 191, 148, 191, 151, -1, 97, 170,
1688 150, 191, 148, 191, 151, -1, 168, 150, 191, 148,
1689 191, 151, -1, 142, 150, 191, 148, 191, 151, -1,
1690 143, 150, 191, 148, 191, 148, 191, 151, -1, 144,
1691 150, 191, 148, 191, 148, 191, 151, -1, 193, 148,
1692 191, -1, 191, -1, 32, -1, 33, -1, 196, -1,
1693 196, 216, -1, 196, 218, -1, 196, 62, 61, 202,
1694 -1, 196, 25, -1, 197, -1, 197, 175, 20, 184,
1695 -1, 197, 218, -1, 197, 62, 61, 202, -1, -1,
1696 197, 175, 176, 194, 191, 198, 182, -1, -1, 197,
1697 175, 50, 194, 186, 199, 182, -1, -1, 197, 175,
1698 45, 194, 186, 200, 182, -1, -1, 197, 175, 47,
1699 194, 186, 201, 182, -1, 197, 51, 204, -1, 197,
1700 58, 147, 205, -1, -1, 24, -1, 56, -1, 55,
1701 -1, 53, 147, 203, -1, 54, 147, 4, -1, 52,
1702 147, 24, -1, 71, 147, 24, -1, 152, 206, 154,
1703 -1, 206, 148, 24, -1, 24, -1, -1, 22, -1,
1704 24, -1, 207, -1, -1, 186, 208, -1, 210, 148,
1705 209, -1, 209, -1, 210, -1, 210, 148, 37, -1,
1706 37, -1, -1, 177, 184, 207, 150, 211, 151, 181,
1707 178, -1, 29, -1, 157, -1, 176, 212, 213, -1,
1708 30, -1, 158, -1, 225, 215, -1, -1, 45, -1,
1709 47, -1, -1, 31, 219, 217, 212, -1, -1, 63,
1710 -1, 3, -1, 4, -1, 7, -1, 27, -1, 28,
1711 -1, 38, -1, 39, -1, 26, -1, 155, 193, 156,
1712 -1, 192, -1, 61, 220, 24, 148, 24, -1, 162,
1713 -1, 207, -1, 222, -1, 221, -1, 186, 223, -1,
1714 225, 226, -1, 214, 226, -1, 227, 175, 228, -1,
1715 227, 230, -1, -1, 23, -1, 72, 224, -1, 72,
1716 8, -1, 73, 21, 223, -1, 73, 9, 223, 148,
1717 21, 223, 148, 21, 223, -1, 74, 173, 223, 148,
1718 21, 223, 152, 229, 154, -1, 74, 173, 223, 148,
1719 21, 223, 152, 154, -1, 75, 177, 184, 223, 150,
1720 233, 151, 36, 21, 223, 76, 21, 223, -1, 76,
1721 -1, 77, -1, 229, 173, 221, 148, 21, 223, -1,
1722 173, 221, 148, 21, 223, -1, 175, 235, -1, 186,
1723 152, 223, 148, 223, 154, -1, 231, 148, 152, 223,
1724 148, 223, 154, -1, 224, -1, 232, 148, 224, -1,
1725 232, -1, -1, 60, 59, -1, 59, -1, 164, 186,
1726 223, 148, 223, -1, 165, 186, 223, 148, 223, -1,
1727 166, 186, 223, 148, 223, -1, 96, 169, 186, 223,
1728 148, 223, -1, 97, 170, 186, 223, 148, 223, -1,
1729 49, 224, -1, 168, 224, 148, 224, -1, 167, 224,
1730 36, 186, -1, 137, 224, 148, 224, 148, 224, -1,
1731 141, 224, 148, 186, -1, 145, 224, 148, 186, -1,
1732 146, 224, 148, 186, -1, 142, 224, 148, 224, -1,
1733 143, 224, 148, 224, 148, 224, -1, 144, 224, 148,
1734 224, 148, 224, -1, 136, 231, -1, 234, 177, 184,
1735 223, 150, 233, 151, -1, 238, -1, 148, 232, -1,
1736 -1, 35, -1, -1, 118, 186, 179, -1, 118, 186,
1737 148, 15, 223, 179, -1, 119, 186, 179, -1, 119,
1738 186, 148, 15, 223, 179, -1, 120, 224, -1, 237,
1739 121, 186, 223, -1, 237, 122, 224, 148, 186, 223,
1740 -1, 123, 186, 223, 236, -1
1743 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1744 static const unsigned short int yyrline[] =
1746 0, 1103, 1103, 1104, 1112, 1113, 1123, 1123, 1123, 1123,
1747 1123, 1123, 1123, 1123, 1123, 1124, 1124, 1124, 1125, 1125,
1748 1125, 1125, 1125, 1125, 1126, 1126, 1126, 1126, 1126, 1126,
1749 1127, 1127, 1127, 1127, 1127, 1127, 1128, 1128, 1128, 1130,
1750 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1138,
1751 1138, 1139, 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1143,
1752 1143, 1144, 1144, 1145, 1146, 1151, 1151, 1151, 1151, 1152,
1753 1152, 1152, 1152, 1153, 1153, 1154, 1154, 1157, 1161, 1166,
1754 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1175, 1176, 1177,
1755 1178, 1179, 1180, 1181, 1182, 1191, 1192, 1198, 1199, 1207,
1756 1215, 1216, 1221, 1222, 1223, 1228, 1242, 1242, 1243, 1243,
1757 1245, 1255, 1255, 1255, 1255, 1255, 1255, 1255, 1256, 1256,
1758 1256, 1256, 1256, 1256, 1257, 1261, 1265, 1273, 1281, 1294,
1759 1299, 1311, 1321, 1325, 1336, 1341, 1347, 1348, 1352, 1356,
1760 1367, 1393, 1407, 1437, 1463, 1484, 1497, 1507, 1512, 1573,
1761 1580, 1588, 1594, 1600, 1604, 1608, 1616, 1628, 1660, 1668,
1762 1692, 1703, 1709, 1714, 1719, 1728, 1734, 1740, 1749, 1753,
1763 1761, 1761, 1771, 1779, 1784, 1788, 1792, 1796, 1811, 1833,
1764 1836, 1839, 1839, 1847, 1847, 1855, 1855, 1863, 1863, 1872,
1765 1875, 1878, 1882, 1895, 1896, 1898, 1902, 1911, 1915, 1920,
1766 1922, 1927, 1932, 1941, 1941, 1942, 1942, 1944, 1951, 1957,
1767 1964, 1968, 1974, 1979, 1984, 2079, 2079, 2081, 2089, 2089,
1768 2091, 2096, 2097, 2098, 2100, 2100, 2110, 2114, 2119, 2123,
1769 2127, 2131, 2135, 2139, 2143, 2147, 2151, 2176, 2180, 2194,
1770 2198, 2204, 2204, 2210, 2215, 2219, 2228, 2239, 2248, 2260,
1771 2273, 2277, 2281, 2286, 2295, 2314, 2323, 2379, 2383, 2390,
1772 2401, 2414, 2423, 2432, 2442, 2446, 2453, 2453, 2455, 2459,
1773 2464, 2483, 2498, 2512, 2523, 2534, 2547, 2556, 2567, 2575,
1774 2581, 2601, 2624, 2630, 2636, 2642, 2657, 2716, 2723, 2726,
1775 2731, 2735, 2742, 2747, 2753, 2758, 2764, 2772, 2784, 2799
1779 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1780 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1781 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1782 static const char *const yytname[] =
1784 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1785 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1786 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1787 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1788 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1789 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1790 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1791 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1792 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1793 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1794 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1795 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1796 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1797 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1798 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP",
1799 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1800 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1801 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1802 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1803 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1804 "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1805 "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='",
1806 "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1807 "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps",
1808 "LogicalOps", "SetCondOps", "CastOps", "ShiftOps", "IPredicates",
1809 "FPredicates", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1810 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1811 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1812 "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1813 "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1814 "Module", "FunctionList", "ConstPool", "@1", "@2", "@3", "@4",
1815 "AsmBlock", "BigOrLittle", "TargetDefinition", "LibrariesDefinition",
1816 "LibList", "Name", "OptName", "ArgVal", "ArgListH", "ArgList",
1817 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1818 "FnDeclareLinkage", "FunctionProto", "@5", "OptSideEffect",
1819 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1820 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1821 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1822 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
1827 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1829 static const unsigned short int yytoknum[] =
1831 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1832 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1833 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1834 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1835 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1836 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1837 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1838 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1839 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1840 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1841 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1842 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1843 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1844 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1845 395, 396, 397, 398, 399, 400, 401, 61, 44, 92,
1846 40, 41, 91, 120, 93, 60, 62, 123, 125, 42,
1851 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1852 static const unsigned char yyr1[] =
1854 0, 161, 162, 162, 163, 163, 164, 164, 164, 164,
1855 164, 164, 164, 164, 164, 165, 165, 165, 166, 166,
1856 166, 166, 166, 166, 167, 167, 167, 167, 167, 167,
1857 167, 167, 167, 167, 167, 167, 168, 168, 168, 169,
1858 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1859 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1860 170, 170, 170, 170, 170, 171, 171, 171, 171, 172,
1861 172, 172, 172, 173, 173, 174, 174, 175, 175, 176,
1862 176, 176, 176, 176, 176, 176, 176, 177, 177, 177,
1863 177, 177, 177, 177, 177, 178, 178, 179, 179, 180,
1864 181, 181, 182, 182, 183, 183, 184, 184, 185, 185,
1865 186, 187, 187, 187, 187, 187, 187, 187, 187, 187,
1866 187, 187, 187, 187, 188, 188, 188, 188, 188, 188,
1867 188, 188, 188, 188, 189, 189, 190, 190, 190, 190,
1868 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
1869 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1870 192, 192, 192, 192, 192, 192, 192, 192, 193, 193,
1871 194, 194, 195, 196, 196, 196, 196, 196, 197, 197,
1872 197, 198, 197, 199, 197, 200, 197, 201, 197, 197,
1873 197, 197, 202, 203, 203, 204, 204, 204, 204, 205,
1874 206, 206, 206, 207, 207, 208, 208, 209, 210, 210,
1875 211, 211, 211, 211, 212, 213, 213, 214, 215, 215,
1876 216, 217, 217, 217, 219, 218, 220, 220, 221, 221,
1877 221, 221, 221, 221, 221, 221, 221, 221, 221, 222,
1878 222, 223, 223, 224, 225, 225, 226, 227, 227, 227,
1879 228, 228, 228, 228, 228, 228, 228, 228, 228, 229,
1880 229, 230, 231, 231, 232, 232, 233, 233, 234, 234,
1881 235, 235, 235, 235, 235, 235, 235, 235, 235, 235,
1882 235, 235, 235, 235, 235, 235, 235, 235, 236, 236,
1883 237, 237, 238, 238, 238, 238, 238, 238, 238, 238
1886 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1887 static const unsigned char yyr2[] =
1889 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1890 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1891 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1892 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1893 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1894 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1895 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1896 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
1897 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,
1898 1, 1, 1, 1, 2, 0, 2, 0, 3, 2,
1899 0, 1, 0, 3, 1, 2, 1, 1, 1, 1,
1900 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1901 1, 1, 1, 1, 1, 1, 1, 2, 4, 5,
1902 5, 3, 2, 2, 1, 3, 1, 3, 1, 0,
1903 4, 3, 3, 4, 4, 3, 2, 2, 2, 2,
1904 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1905 6, 6, 7, 7, 6, 6, 8, 8, 3, 1,
1906 1, 1, 1, 2, 2, 4, 2, 1, 4, 2,
1907 4, 0, 7, 0, 7, 0, 7, 0, 7, 3,
1908 4, 0, 1, 1, 1, 3, 3, 3, 3, 3,
1909 3, 1, 0, 1, 1, 1, 0, 2, 3, 1,
1910 1, 3, 1, 0, 8, 1, 1, 3, 1, 1,
1911 2, 0, 1, 1, 0, 4, 0, 1, 1, 1,
1912 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1913 1, 1, 1, 2, 2, 2, 3, 2, 0, 1,
1914 2, 2, 3, 9, 9, 8, 13, 1, 1, 6,
1915 5, 2, 6, 7, 1, 3, 1, 0, 2, 1,
1916 5, 5, 5, 6, 6, 2, 4, 4, 6, 4,
1917 4, 4, 4, 6, 6, 2, 7, 1, 2, 0,
1918 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
1921 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1922 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1923 means the default is an error. */
1924 static const unsigned short int yydefact[] =
1926 191, 0, 86, 177, 1, 176, 224, 79, 80, 81,
1927 82, 83, 84, 85, 0, 87, 248, 173, 174, 248,
1928 203, 204, 0, 0, 0, 86, 0, 179, 221, 0,
1929 0, 88, 89, 90, 91, 92, 93, 0, 0, 249,
1930 245, 78, 218, 219, 220, 244, 0, 0, 0, 0,
1931 189, 0, 0, 0, 0, 0, 0, 0, 77, 222,
1932 223, 87, 192, 175, 94, 2, 3, 107, 111, 112,
1933 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
1934 123, 124, 0, 0, 0, 0, 239, 0, 0, 106,
1935 125, 110, 240, 126, 215, 216, 217, 291, 247, 0,
1936 0, 0, 0, 202, 190, 180, 178, 170, 171, 0,
1937 0, 0, 0, 225, 127, 0, 0, 109, 132, 134,
1938 0, 0, 139, 133, 290, 0, 269, 0, 0, 0,
1939 0, 87, 257, 258, 6, 7, 8, 9, 10, 11,
1940 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1941 22, 23, 0, 0, 0, 0, 0, 0, 24, 25,
1942 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1943 0, 0, 36, 37, 38, 0, 0, 0, 0, 0,
1944 0, 0, 0, 0, 0, 0, 246, 87, 261, 0,
1945 287, 197, 194, 193, 195, 196, 198, 201, 0, 185,
1946 187, 183, 111, 112, 113, 114, 115, 116, 117, 118,
1947 119, 120, 121, 0, 0, 0, 0, 181, 0, 0,
1948 0, 131, 213, 138, 136, 0, 0, 275, 268, 251,
1949 250, 0, 0, 68, 72, 67, 71, 66, 70, 65,
1950 69, 73, 74, 0, 0, 39, 40, 41, 42, 43,
1951 44, 45, 46, 47, 48, 0, 63, 64, 59, 60,
1952 61, 62, 49, 50, 51, 52, 53, 54, 55, 56,
1953 57, 58, 0, 97, 97, 296, 0, 0, 285, 0,
1954 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1955 0, 0, 0, 0, 0, 199, 102, 102, 102, 153,
1956 154, 4, 5, 151, 152, 155, 150, 146, 147, 0,
1957 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1958 0, 0, 0, 0, 0, 149, 148, 102, 108, 108,
1959 135, 212, 206, 209, 210, 0, 0, 128, 228, 229,
1960 230, 235, 231, 232, 233, 234, 226, 0, 237, 242,
1961 241, 243, 0, 252, 0, 0, 0, 0, 0, 292,
1962 0, 294, 289, 0, 0, 0, 0, 0, 0, 0,
1963 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1964 200, 0, 186, 188, 184, 0, 0, 0, 0, 0,
1965 0, 0, 141, 169, 0, 0, 145, 0, 142, 0,
1966 0, 0, 0, 0, 182, 129, 130, 205, 207, 0,
1967 100, 137, 227, 0, 0, 0, 0, 0, 0, 0,
1968 0, 0, 0, 0, 299, 0, 0, 0, 279, 282,
1969 0, 0, 280, 281, 0, 0, 0, 277, 276, 0,
1970 297, 0, 0, 0, 104, 102, 0, 0, 289, 0,
1971 0, 0, 0, 0, 140, 143, 144, 0, 0, 0,
1972 0, 0, 211, 208, 101, 95, 0, 236, 0, 0,
1973 267, 0, 0, 97, 98, 97, 264, 288, 0, 0,
1974 0, 0, 0, 270, 271, 272, 267, 0, 99, 105,
1975 103, 0, 0, 0, 0, 0, 0, 0, 168, 0,
1976 0, 0, 0, 0, 0, 214, 0, 0, 0, 266,
1977 0, 273, 274, 0, 293, 295, 0, 0, 0, 278,
1978 283, 284, 0, 298, 0, 0, 157, 0, 0, 0,
1979 0, 0, 0, 0, 0, 0, 96, 238, 0, 0,
1980 0, 265, 262, 0, 286, 0, 0, 0, 165, 0,
1981 0, 159, 160, 161, 156, 164, 0, 255, 0, 0,
1982 0, 263, 162, 163, 0, 0, 0, 253, 0, 254,
1983 0, 0, 158, 166, 167, 0, 0, 0, 0, 0,
1984 0, 260, 0, 0, 259, 256
1987 /* YYDEFGOTO[NTERM-NUM]. */
1988 static const short int yydefgoto[] =
1990 -1, 86, 303, 320, 321, 322, 323, 324, 255, 272,
1991 213, 214, 243, 215, 25, 15, 37, 505, 359, 444,
1992 465, 382, 445, 87, 88, 216, 90, 91, 120, 225,
1993 393, 348, 394, 109, 1, 2, 3, 327, 298, 296,
1994 297, 63, 194, 50, 104, 198, 92, 408, 333, 334,
1995 335, 38, 96, 16, 44, 17, 61, 18, 28, 413,
1996 349, 93, 351, 476, 19, 40, 41, 186, 559, 98,
1997 278, 509, 510, 187, 188, 424, 189, 190
2000 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2002 #define YYPACT_NINF -536
2003 static const short int yypact[] =
2005 -536, 28, 149, 426, -536, -536, -536, -536, -536, -536,
2006 -536, -536, -536, -536, -16, 158, 41, -536, -536, -1,
2007 -536, -536, 14, -67, 25, 80, -31, -536, 30, 130,
2008 155, -536, -536, -536, -536, -536, -536, 1242, -4, -536,
2009 -536, 65, -536, -536, -536, -536, 32, 36, 37, 39,
2010 -536, 35, 130, 1242, 69, 69, 69, 69, -536, -536,
2011 -536, 158, -536, -536, -536, -536, -536, 38, -536, -536,
2012 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2013 -536, -536, 185, 193, 194, 659, -536, 65, 50, -536,
2014 -536, -113, -536, -536, -536, -536, -536, 1410, -536, 177,
2015 59, 198, 179, 180, -536, -536, -536, -536, -536, 1262,
2016 1262, 1262, 1303, -536, -536, 52, 57, -536, -536, -113,
2017 -118, 62, 1047, -536, -536, 1262, -536, 150, 1323, 15,
2018 151, 158, -536, -536, -536, -536, -536, -536, -536, -536,
2019 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2020 -536, -536, 399, 210, 1262, 1262, 1262, 1262, -536, -536,
2021 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2022 1262, 1262, -536, -536, -536, 1262, 1262, 1262, 1262, 1262,
2023 1262, 1262, 1262, 1262, 1262, 1262, -536, 158, -536, 7,
2024 -536, -536, -536, -536, -536, -536, -536, -536, -85, -536,
2025 -536, -536, 104, 152, 209, 167, 212, 172, 215, 174,
2026 216, 207, 225, 178, 229, 227, 566, -536, 1262, 1262,
2027 1262, -536, 1088, -536, 91, 89, 757, -536, -536, 38,
2028 -536, 757, 757, -536, -536, -536, -536, -536, -536, -536,
2029 -536, -536, -536, 757, 1242, -536, -536, -536, -536, -536,
2030 -536, -536, -536, -536, -536, 1262, -536, -536, -536, -536,
2031 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2032 -536, -536, 1262, 94, 100, -536, 757, 97, 102, 103,
2033 109, 110, 111, 112, 113, 114, 757, 757, 757, 232,
2034 117, 1242, 1262, 1262, 245, -536, 122, 122, 122, -536,
2035 -536, -536, -536, -536, -536, -536, -536, -536, -536, 399,
2036 210, 121, 124, 125, 126, 127, 992, 1303, 719, 248,
2037 128, 129, 131, 133, 134, -536, -536, 122, -111, -80,
2038 -113, -536, 65, -536, 132, 135, 1145, -536, -536, -536,
2039 -536, -536, -536, -536, -536, -536, 222, 1303, -536, -536,
2040 -536, -536, 139, -536, 140, 757, 757, 757, 0, -536,
2041 2, -536, 141, 757, 138, 1262, 1262, 1262, 1262, 1262,
2042 1262, 1262, 153, 154, 156, 1262, 1262, 757, 757, 162,
2043 -536, -24, -536, -536, -536, 148, 161, 1303, 1303, 1303,
2044 1303, 1303, -536, -536, -70, -98, -536, -117, -536, 1303,
2045 1303, 1303, 1303, 1303, -536, -536, -536, -536, -536, 1201,
2046 265, -536, -536, 276, -86, 291, 316, 190, 195, 196,
2047 757, 337, 757, 1262, -536, 197, 757, 201, -536, -536,
2048 202, 206, -536, -536, 757, 757, 757, -536, -536, 192,
2049 -536, 1262, 331, 356, -536, 122, 1303, 1303, 141, 213,
2050 214, 217, 219, 1303, -536, -536, -536, 220, 221, 223,
2051 327, 226, -536, -536, -536, 307, 228, -536, 757, 757,
2052 1262, 757, 757, 231, -536, 231, -536, 233, 757, 234,
2053 1262, 1262, 1262, -536, -536, -536, 1262, 757, -536, -536,
2054 -536, 235, 236, 224, 1303, 1303, 1303, 1303, -536, 1303,
2055 1303, 1303, 1262, 1303, 366, -536, 361, 239, 237, 233,
2056 240, -536, -536, 323, -536, -536, 1262, 241, 757, -536,
2057 -536, -536, 242, -536, 1303, 1303, -536, 246, 247, 249,
2058 251, 257, 259, 260, 262, 267, -536, -536, 367, 82,
2059 354, -536, -536, 266, -536, 268, 270, 1303, -536, 1303,
2060 1303, -536, -536, -536, -536, -536, 757, -536, 899, 93,
2061 375, -536, -536, -536, 271, 273, 274, -536, 278, -536,
2062 899, 757, -536, -536, -536, 406, 280, 353, 757, 414,
2063 415, -536, 757, 757, -536, -536
2066 /* YYPGOTO[NTERM-NUM]. */
2067 static const short int yypgoto[] =
2069 -536, -536, -536, 342, 343, 344, 345, 350, 142, 144,
2070 -127, -125, -525, -536, 411, 435, -122, -536, -267, 51,
2071 -536, -285, -536, -45, -536, -37, -536, -83, 340, -536,
2072 -94, 250, -298, 56, -536, -536, -536, -536, -536, -536,
2073 -536, 412, -536, -536, -536, -536, 3, -536, 54, -536,
2074 -536, 413, -536, -536, -536, -536, -536, 472, -536, -536,
2075 -535, -205, 60, -124, -536, 459, -536, -536, -536, -536,
2076 -536, 58, -3, -536, -536, 42, -536, -536
2079 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2080 positive, shift that token. If negative, reduce the rule which
2081 number is the opposite. If zero, do what YYDEFACT says.
2082 If YYTABLE_NINF, syntax error. */
2083 #define YYTABLE_NINF -173
2084 static const short int yytable[] =
2086 89, 227, 119, 241, 230, 242, 26, 361, 106, 244,
2087 442, 326, 383, 384, 558, 420, 89, 422, 217, 395,
2088 397, 350, 39, 568, 231, 94, 350, 350, 4, 42,
2089 220, 453, 275, 443, 570, 576, 232, -108, 350, 119,
2090 221, 456, 404, 405, 26, 29, 123, 279, 123, 414,
2091 453, 280, 281, 282, 283, 284, 285, 421, 455, 421,
2092 289, 290, 453, 294, 39, 291, 46, 47, 48, 295,
2093 467, 350, 199, 200, 201, 59, 406, 60, 453, 123,
2094 51, 350, 350, 350, 454, 49, 52, 20, 226, 21,
2095 121, 226, 233, 234, 235, 236, 237, 238, 239, 240,
2096 53, 107, 108, 233, 234, 235, 236, 237, 238, 239,
2097 240, 110, 111, 112, 192, 193, 58, 273, 274, 226,
2098 276, 7, 8, 9, 10, 54, 12, 55, 292, 293,
2099 56, 299, 300, 277, 226, 328, 329, 330, 226, 226,
2100 226, 226, 226, 226, 286, 287, 288, 226, 226, -172,
2101 350, 350, 350, 95, 62, -68, -68, 43, 350, 64,
2102 490, 233, 234, 235, 236, 237, 238, 239, 240, 379,
2103 -67, -67, 350, 350, 5, -66, -66, -65, -65, 99,
2104 6, 301, 302, 100, 101, 332, 102, 103, -109, 114,
2105 7, 8, 9, 10, 11, 12, 13, 115, 116, 355,
2106 122, 191, 195, 196, 197, 218, 514, 89, 515, 228,
2107 219, 14, 222, -72, -75, 350, -71, 350, 356, -70,
2108 -69, 350, 30, 31, 32, 33, 34, 35, 36, 350,
2109 350, 350, -76, 304, 305, 357, 557, 256, 257, 336,
2110 337, 427, 358, 429, 430, 431, 377, 569, 360, 363,
2111 364, 365, 438, 330, 89, 378, 226, 366, 367, 368,
2112 369, 370, 371, 350, 350, 376, 350, 350, 375, 380,
2113 381, 387, 398, 350, 388, 389, 390, 391, 399, 400,
2114 409, 401, 350, 402, 403, 412, 410, 415, 416, 423,
2115 426, 352, 353, 448, 449, 450, 451, 452, 446, 442,
2116 466, 434, 435, 354, 436, 457, 458, 459, 460, 461,
2117 441, 447, 468, 350, 258, 259, 260, 261, 262, 263,
2118 264, 265, 266, 267, 268, 269, 270, 271, 226, 428,
2119 226, 226, 226, 432, 433, 407, 362, 469, 437, 226,
2120 470, 474, 486, 471, 472, 478, 372, 373, 374, 480,
2121 481, 350, 491, 492, 482, 488, 519, 520, 521, 498,
2122 489, 494, 495, 502, 504, 496, 350, 497, 499, 500,
2123 536, 501, 332, 350, 503, 526, 506, 350, 350, 513,
2124 421, 516, 518, 524, 525, 537, 226, 538, 556, 539,
2125 560, 540, 541, 544, 547, 542, 571, 549, 548, 550,
2126 527, 528, 529, 530, 487, 531, 532, 533, 551, 535,
2127 552, 553, 241, 554, 242, 417, 418, 419, 555, 562,
2128 561, 563, 572, 425, 573, 574, 575, 578, 579, 580,
2129 545, 546, 241, 226, 242, 582, 583, 439, 440, 181,
2130 182, 183, 184, 226, 226, 226, -78, 185, 20, 226,
2131 21, 385, 97, 564, 386, 565, 566, 6, -78, -78,
2132 57, 464, 224, 463, 105, 534, 325, -78, -78, -78,
2133 -78, -78, -78, -78, 113, 27, -78, 22, 45, 226,
2134 473, 477, 475, 522, 23, 0, 479, 0, 24, 0,
2135 493, 0, 0, 0, 483, 484, 485, 245, 246, 247,
2136 248, 249, 250, 251, 252, 253, 254, 0, 0, 0,
2137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0, 0, 0, 0, 0, 507, 508,
2139 0, 511, 512, 0, 0, 0, 0, 0, 517, 0,
2140 0, 0, 0, 0, 0, 0, 0, 523, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 65, 66, 0, 0, 0, 0, 0, 543, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 20, 0,
2145 21, 0, 306, 0, 0, 0, 0, 0, 0, 0,
2146 0, 0, 0, 0, 307, 308, 0, 0, 0, 0,
2147 0, 0, 0, 0, 0, 0, 567, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 0, 577, 0, 0, 0, 0, 0, 0, 581, 0,
2150 0, 0, 584, 585, 134, 135, 136, 137, 138, 139,
2151 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
2152 150, 151, 309, 310, 65, 66, 0, 117, 68, 69,
2153 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2154 80, 20, 0, 21, 0, 0, 0, 0, 0, 311,
2155 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2156 168, 169, 0, 312, 172, 173, 174, 81, 313, 314,
2157 315, 0, 0, 0, 0, 0, 0, 0, 316, 0,
2158 0, 317, 0, 318, 65, 66, 319, 117, 202, 203,
2159 204, 205, 206, 207, 208, 209, 210, 211, 212, 79,
2160 80, 20, 0, 21, 0, 0, 0, 0, 0, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2162 338, 339, 65, 66, 340, 0, 0, 81, 0, 0,
2163 0, 0, 0, 0, 0, 0, 0, 0, 0, 20,
2164 0, 21, 0, 341, 342, 343, 0, 0, 0, 0,
2165 0, 0, 0, 0, 0, 344, 345, 0, 0, 0,
2166 0, 0, 0, 0, 0, 0, 0, 0, 82, 0,
2167 0, 83, 0, 0, 84, 0, 85, 118, 346, 0,
2168 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2169 0, 0, 0, 0, 0, 134, 135, 136, 137, 138,
2170 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
2171 149, 150, 151, 309, 310, 0, 0, 0, 0, 0,
2172 0, 0, 0, 0, 0, 0, 0, 0, 82, 0,
2173 0, 83, 0, 0, 84, 0, 85, 396, 0, 0,
2174 311, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2175 167, 168, 169, 0, 312, 172, 173, 174, 0, 313,
2176 314, 315, 338, 339, 0, 0, 340, 0, 0, 0,
2177 0, 0, 347, 0, 0, 0, 0, 0, 0, 0,
2178 0, 0, 0, 0, 0, 341, 342, 343, 0, 0,
2179 0, 0, 0, 0, 0, 0, 0, 344, 345, 0,
2180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2182 346, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2183 0, 0, 0, 0, 0, 0, 0, 134, 135, 136,
2184 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2185 147, 148, 149, 150, 151, 309, 310, 65, 66, 0,
2186 117, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2187 211, 212, 79, 80, 20, 0, 21, 0, 0, 0,
2188 0, 0, 311, 158, 159, 160, 161, 162, 163, 164,
2189 165, 166, 167, 168, 169, 0, 312, 172, 173, 174,
2190 81, 313, 314, 315, 0, 0, 0, 0, 0, 0,
2191 0, 0, 65, 66, 347, 117, 68, 69, 70, 71,
2192 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
2193 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
2194 0, 0, 0, 0, 223, 0, 0, 0, 0, 0,
2195 0, 0, 0, 65, 66, 81, 117, 68, 69, 70,
2196 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2197 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2198 0, 0, 0, 0, 0, 331, 0, 0, 0, 0,
2199 0, 0, 0, 0, 0, 0, 81, 0, 0, 0,
2200 0, 82, 0, 0, 83, 0, 392, 84, 0, 85,
2201 65, 66, 0, 117, 68, 69, 70, 71, 72, 73,
2202 74, 75, 76, 77, 78, 79, 80, 20, 0, 21,
2203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2204 0, 0, 411, 0, 0, 0, 0, 0, 0, 0,
2205 0, 0, 0, 81, 0, 0, 82, 0, 0, 83,
2206 0, 0, 84, 0, 85, 0, 65, 66, 0, 117,
2207 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2208 78, 79, 80, 20, 0, 21, 0, 0, 0, 0,
2209 0, 0, 0, 0, 0, 0, 0, 82, 462, 0,
2210 83, 0, 0, 84, 0, 85, 0, 65, 66, 81,
2211 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2212 77, 78, 79, 80, 20, 0, 21, 65, 66, 0,
2213 117, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2214 77, 78, 79, 80, 20, 0, 21, 0, 0, 0,
2215 81, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2216 84, 0, 85, 0, 0, 0, 0, 0, 65, 66,
2217 81, 117, 202, 203, 204, 205, 206, 207, 208, 209,
2218 210, 211, 212, 79, 80, 20, 0, 21, 65, 66,
2219 0, 229, 68, 69, 70, 71, 72, 73, 74, 75,
2220 76, 77, 78, 79, 80, 20, 0, 21, 0, 0,
2221 82, 81, 0, 83, 0, 0, 84, 0, 85, 0,
2222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2223 0, 81, 0, 0, 0, 0, 0, 0, 0, 0,
2224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2225 0, 82, 0, 0, 83, 0, 0, 84, 0, 85,
2226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2227 0, 82, 0, 0, 83, 0, 0, 84, 0, 85,
2228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2230 0, 0, 0, 0, 0, 124, 0, 0, 0, 0,
2231 0, 0, 82, 0, 0, 83, 0, 0, 84, 125,
2232 85, 0, 0, 0, 0, 0, 0, 0, 0, 126,
2233 127, 0, 82, 0, 0, 83, 0, 0, 84, 0,
2234 85, 0, 128, 129, 130, 131, 132, 133, 134, 135,
2235 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2236 146, 147, 148, 149, 150, 151, 152, 153, 0, 0,
2237 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2238 0, 0, 0, 0, 0, 0, 0, 0, 154, 155,
2239 156, 0, 0, 157, 158, 159, 160, 161, 162, 163,
2240 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
2241 174, 175, 176, 177, 178, 179, 180
2244 static const short int yycheck[] =
2246 37, 125, 85, 130, 128, 130, 3, 274, 53, 131,
2247 34, 216, 297, 298, 539, 15, 53, 15, 112, 317,
2248 318, 226, 23, 558, 9, 29, 231, 232, 0, 30,
2249 148, 148, 156, 57, 559, 570, 21, 150, 243, 122,
2250 158, 158, 327, 154, 41, 61, 159, 171, 159, 347,
2251 148, 175, 176, 177, 178, 179, 180, 57, 156, 57,
2252 184, 185, 148, 148, 23, 187, 52, 53, 54, 154,
2253 156, 276, 109, 110, 111, 45, 156, 47, 148, 159,
2254 147, 286, 287, 288, 154, 71, 61, 22, 125, 24,
2255 87, 128, 10, 11, 12, 13, 14, 15, 16, 17,
2256 20, 32, 33, 10, 11, 12, 13, 14, 15, 16,
2257 17, 55, 56, 57, 55, 56, 147, 154, 155, 156,
2258 157, 41, 42, 43, 44, 45, 46, 47, 121, 122,
2259 50, 27, 28, 170, 171, 218, 219, 220, 175, 176,
2260 177, 178, 179, 180, 181, 182, 183, 184, 185, 0,
2261 355, 356, 357, 157, 24, 3, 4, 158, 363, 4,
2262 445, 10, 11, 12, 13, 14, 15, 16, 17, 293,
2263 3, 4, 377, 378, 25, 3, 4, 3, 4, 147,
2264 31, 3, 4, 147, 147, 222, 147, 152, 150, 4,
2265 41, 42, 43, 44, 45, 46, 47, 4, 4, 244,
2266 150, 24, 4, 24, 24, 153, 473, 244, 475, 59,
2267 153, 62, 150, 4, 7, 420, 4, 422, 255, 4,
2268 4, 426, 64, 65, 66, 67, 68, 69, 70, 434,
2269 435, 436, 7, 4, 7, 272, 154, 27, 28, 148,
2270 151, 365, 148, 367, 368, 369, 291, 154, 148, 152,
2271 148, 148, 376, 336, 291, 292, 293, 148, 148, 148,
2272 148, 148, 148, 468, 469, 148, 471, 472, 36, 24,
2273 148, 150, 24, 478, 150, 150, 150, 150, 150, 150,
2274 148, 150, 487, 150, 150, 63, 151, 148, 148, 148,
2275 152, 231, 232, 387, 388, 389, 390, 391, 150, 34,
2276 24, 148, 148, 243, 148, 399, 400, 401, 402, 403,
2277 148, 150, 21, 518, 104, 105, 106, 107, 108, 109,
2278 110, 111, 112, 113, 114, 115, 116, 117, 365, 366,
2279 367, 368, 369, 370, 371, 332, 276, 21, 375, 376,
2280 150, 4, 150, 148, 148, 148, 286, 287, 288, 148,
2281 148, 556, 446, 447, 148, 24, 480, 481, 482, 453,
2282 4, 148, 148, 36, 57, 148, 571, 148, 148, 148,
2283 4, 148, 409, 578, 148, 151, 148, 582, 583, 148,
2284 57, 148, 148, 148, 148, 24, 423, 148, 21, 152,
2285 36, 151, 516, 151, 148, 154, 21, 148, 151, 148,
2286 494, 495, 496, 497, 441, 499, 500, 501, 151, 503,
2287 151, 151, 539, 151, 539, 355, 356, 357, 151, 151,
2288 154, 151, 151, 363, 151, 151, 148, 21, 148, 76,
2289 524, 525, 559, 470, 559, 21, 21, 377, 378, 97,
2290 97, 97, 97, 480, 481, 482, 20, 97, 22, 486,
2291 24, 309, 41, 547, 310, 549, 550, 31, 32, 33,
2292 25, 410, 122, 409, 52, 502, 216, 41, 42, 43,
2293 44, 45, 46, 47, 61, 3, 50, 51, 19, 516,
2294 420, 423, 422, 486, 58, -1, 426, -1, 62, -1,
2295 448, -1, -1, -1, 434, 435, 436, 98, 99, 100,
2296 101, 102, 103, 104, 105, 106, 107, -1, -1, -1,
2297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2298 -1, -1, -1, -1, -1, -1, -1, -1, 468, 469,
2299 -1, 471, 472, -1, -1, -1, -1, -1, 478, -1,
2300 -1, -1, -1, -1, -1, -1, -1, 487, -1, -1,
2301 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2303 -1, 5, 6, -1, -1, -1, -1, -1, 518, -1,
2304 -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
2305 24, -1, 26, -1, -1, -1, -1, -1, -1, -1,
2306 -1, -1, -1, -1, 38, 39, -1, -1, -1, -1,
2307 -1, -1, -1, -1, -1, -1, 556, -1, -1, -1,
2308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2309 -1, 571, -1, -1, -1, -1, -1, -1, 578, -1,
2310 -1, -1, 582, 583, 78, 79, 80, 81, 82, 83,
2311 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2312 94, 95, 96, 97, 5, 6, -1, 8, 9, 10,
2313 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2314 21, 22, -1, 24, -1, -1, -1, -1, -1, 123,
2315 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
2316 134, 135, -1, 137, 138, 139, 140, 48, 142, 143,
2317 144, -1, -1, -1, -1, -1, -1, -1, 152, -1,
2318 -1, 155, -1, 157, 5, 6, 160, 8, 9, 10,
2319 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2320 21, 22, -1, 24, -1, -1, -1, -1, -1, -1,
2321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2322 3, 4, 5, 6, 7, -1, -1, 48, -1, -1,
2323 -1, -1, -1, -1, -1, -1, -1, -1, -1, 22,
2324 -1, 24, -1, 26, 27, 28, -1, -1, -1, -1,
2325 -1, -1, -1, -1, -1, 38, 39, -1, -1, -1,
2326 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
2327 -1, 152, -1, -1, 155, -1, 157, 158, 61, -1,
2328 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2329 -1, -1, -1, -1, -1, 78, 79, 80, 81, 82,
2330 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2331 93, 94, 95, 96, 97, -1, -1, -1, -1, -1,
2332 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
2333 -1, 152, -1, -1, 155, -1, 157, 158, -1, -1,
2334 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2335 133, 134, 135, -1, 137, 138, 139, 140, -1, 142,
2336 143, 144, 3, 4, -1, -1, 7, -1, -1, -1,
2337 -1, -1, 155, -1, -1, -1, -1, -1, -1, -1,
2338 -1, -1, -1, -1, -1, 26, 27, 28, -1, -1,
2339 -1, -1, -1, -1, -1, -1, -1, 38, 39, -1,
2340 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2341 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2342 61, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2343 -1, -1, -1, -1, -1, -1, -1, 78, 79, 80,
2344 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2345 91, 92, 93, 94, 95, 96, 97, 5, 6, -1,
2346 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2347 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2348 -1, -1, 123, 124, 125, 126, 127, 128, 129, 130,
2349 131, 132, 133, 134, 135, -1, 137, 138, 139, 140,
2350 48, 142, 143, 144, -1, -1, -1, -1, -1, -1,
2351 -1, -1, 5, 6, 155, 8, 9, 10, 11, 12,
2352 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2353 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2354 -1, -1, -1, -1, 37, -1, -1, -1, -1, -1,
2355 -1, -1, -1, 5, 6, 48, 8, 9, 10, 11,
2356 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2357 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2358 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
2359 -1, -1, -1, -1, -1, -1, 48, -1, -1, -1,
2360 -1, 149, -1, -1, 152, -1, 154, 155, -1, 157,
2361 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
2362 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2363 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2364 -1, -1, 37, -1, -1, -1, -1, -1, -1, -1,
2365 -1, -1, -1, 48, -1, -1, 149, -1, -1, 152,
2366 -1, -1, 155, -1, 157, -1, 5, 6, -1, 8,
2367 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2368 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
2369 -1, -1, -1, -1, -1, -1, -1, 149, 37, -1,
2370 152, -1, -1, 155, -1, 157, -1, 5, 6, 48,
2371 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2372 18, 19, 20, 21, 22, -1, 24, 5, 6, -1,
2373 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2374 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2375 48, -1, -1, -1, 149, -1, -1, 152, -1, -1,
2376 155, -1, 157, -1, -1, -1, -1, -1, 5, 6,
2377 48, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2378 17, 18, 19, 20, 21, 22, -1, 24, 5, 6,
2379 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2380 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2381 149, 48, -1, 152, -1, -1, 155, -1, 157, -1,
2382 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2383 -1, 48, -1, -1, -1, -1, -1, -1, -1, -1,
2384 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2385 -1, 149, -1, -1, 152, -1, -1, 155, -1, 157,
2386 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2387 -1, 149, -1, -1, 152, -1, -1, 155, -1, 157,
2388 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2389 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2390 -1, -1, -1, -1, -1, 35, -1, -1, -1, -1,
2391 -1, -1, 149, -1, -1, 152, -1, -1, 155, 49,
2392 157, -1, -1, -1, -1, -1, -1, -1, -1, 59,
2393 60, -1, 149, -1, -1, 152, -1, -1, 155, -1,
2394 157, -1, 72, 73, 74, 75, 76, 77, 78, 79,
2395 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2396 90, 91, 92, 93, 94, 95, 96, 97, -1, -1,
2397 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2398 -1, -1, -1, -1, -1, -1, -1, -1, 118, 119,
2399 120, -1, -1, 123, 124, 125, 126, 127, 128, 129,
2400 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2401 140, 141, 142, 143, 144, 145, 146
2404 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2405 symbol of state STATE-NUM. */
2406 static const unsigned char yystos[] =
2408 0, 195, 196, 197, 0, 25, 31, 41, 42, 43,
2409 44, 45, 46, 47, 62, 176, 214, 216, 218, 225,
2410 22, 24, 51, 58, 62, 175, 207, 218, 219, 61,
2411 64, 65, 66, 67, 68, 69, 70, 177, 212, 23,
2412 226, 227, 30, 158, 215, 226, 52, 53, 54, 71,
2413 204, 147, 61, 20, 45, 47, 50, 176, 147, 45,
2414 47, 217, 24, 202, 4, 5, 6, 8, 9, 10,
2415 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2416 21, 48, 149, 152, 155, 157, 162, 184, 185, 186,
2417 187, 188, 207, 222, 29, 157, 213, 175, 230, 147,
2418 147, 147, 147, 152, 205, 202, 184, 32, 33, 194,
2419 194, 194, 194, 212, 4, 4, 4, 8, 158, 188,
2420 189, 207, 150, 159, 35, 49, 59, 60, 72, 73,
2421 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2422 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2423 94, 95, 96, 97, 118, 119, 120, 123, 124, 125,
2424 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2425 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2426 146, 164, 165, 166, 167, 168, 228, 234, 235, 237,
2427 238, 24, 55, 56, 203, 4, 24, 24, 206, 186,
2428 186, 186, 9, 10, 11, 12, 13, 14, 15, 16,
2429 17, 18, 19, 171, 172, 174, 186, 191, 153, 153,
2430 148, 158, 150, 37, 189, 190, 186, 224, 59, 8,
2431 224, 9, 21, 10, 11, 12, 13, 14, 15, 16,
2432 17, 171, 172, 173, 177, 98, 99, 100, 101, 102,
2433 103, 104, 105, 106, 107, 169, 27, 28, 104, 105,
2434 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2435 116, 117, 170, 186, 186, 224, 186, 186, 231, 224,
2436 224, 224, 224, 224, 224, 224, 186, 186, 186, 224,
2437 224, 177, 121, 122, 148, 154, 200, 201, 199, 27,
2438 28, 3, 4, 163, 4, 7, 26, 38, 39, 96,
2439 97, 123, 137, 142, 143, 144, 152, 155, 157, 160,
2440 164, 165, 166, 167, 168, 192, 222, 198, 188, 188,
2441 188, 37, 186, 209, 210, 211, 148, 151, 3, 4,
2442 7, 26, 27, 28, 38, 39, 61, 155, 192, 221,
2443 222, 223, 223, 223, 223, 184, 186, 186, 148, 179,
2444 148, 179, 223, 152, 148, 148, 148, 148, 148, 148,
2445 148, 148, 223, 223, 223, 36, 148, 184, 186, 224,
2446 24, 148, 182, 182, 182, 169, 170, 150, 150, 150,
2447 150, 150, 154, 191, 193, 193, 158, 193, 24, 150,
2448 150, 150, 150, 150, 182, 154, 156, 207, 208, 148,
2449 151, 37, 63, 220, 193, 148, 148, 223, 223, 223,
2450 15, 57, 15, 148, 236, 223, 152, 224, 186, 224,
2451 224, 224, 186, 186, 148, 148, 148, 186, 224, 223,
2452 223, 148, 34, 57, 180, 183, 150, 150, 191, 191,
2453 191, 191, 191, 148, 154, 156, 158, 191, 191, 191,
2454 191, 191, 37, 209, 180, 181, 24, 156, 21, 21,
2455 150, 148, 148, 223, 4, 223, 224, 232, 148, 223,
2456 148, 148, 148, 223, 223, 223, 150, 186, 24, 4,
2457 182, 191, 191, 236, 148, 148, 148, 148, 191, 148,
2458 148, 148, 36, 148, 57, 178, 148, 223, 223, 232,
2459 233, 223, 223, 148, 179, 179, 148, 223, 148, 224,
2460 224, 224, 233, 223, 148, 148, 151, 191, 191, 191,
2461 191, 191, 191, 191, 186, 191, 4, 24, 148, 152,
2462 151, 224, 154, 223, 151, 191, 191, 148, 151, 148,
2463 148, 151, 151, 151, 151, 151, 21, 154, 173, 229,
2464 36, 154, 151, 151, 191, 191, 191, 223, 221, 154,
2465 173, 21, 151, 151, 151, 148, 221, 223, 21, 148,
2466 76, 223, 21, 21, 223, 223
2469 #define yyerrok (yyerrstatus = 0)
2470 #define yyclearin (yychar = YYEMPTY)
2471 #define YYEMPTY (-2)
2474 #define YYACCEPT goto yyacceptlab
2475 #define YYABORT goto yyabortlab
2476 #define YYERROR goto yyerrorlab
2479 /* Like YYERROR except do call yyerror. This remains here temporarily
2480 to ease the transition to the new meaning of YYERROR, for GCC.
2481 Once GCC version 2 has supplanted version 1, this can go. */
2483 #define YYFAIL goto yyerrlab
2485 #define YYRECOVERING() (!!yyerrstatus)
2487 #define YYBACKUP(Token, Value) \
2489 if (yychar == YYEMPTY && yylen == 1) \
2493 yytoken = YYTRANSLATE (yychar); \
2499 yyerror (YY_("syntax error: cannot back up")); \
2506 #define YYERRCODE 256
2509 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2510 If N is 0, then set CURRENT to the empty location which ends
2511 the previous symbol: RHS[0] (always defined). */
2513 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2514 #ifndef YYLLOC_DEFAULT
2515 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2519 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2520 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2521 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2522 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2526 (Current).first_line = (Current).last_line = \
2527 YYRHSLOC (Rhs, 0).last_line; \
2528 (Current).first_column = (Current).last_column = \
2529 YYRHSLOC (Rhs, 0).last_column; \
2535 /* YY_LOCATION_PRINT -- Print the location on the stream.
2536 This macro was not mandated originally: define only if we know
2537 we won't break user code: when these are the locations we know. */
2539 #ifndef YY_LOCATION_PRINT
2540 # if YYLTYPE_IS_TRIVIAL
2541 # define YY_LOCATION_PRINT(File, Loc) \
2542 fprintf (File, "%d.%d-%d.%d", \
2543 (Loc).first_line, (Loc).first_column, \
2544 (Loc).last_line, (Loc).last_column)
2546 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2551 /* YYLEX -- calling `yylex' with the right arguments. */
2554 # define YYLEX yylex (YYLEX_PARAM)
2556 # define YYLEX yylex ()
2559 /* Enable debugging if requested. */
2563 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2564 # define YYFPRINTF fprintf
2567 # define YYDPRINTF(Args) \
2573 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2577 YYFPRINTF (stderr, "%s ", Title); \
2578 yysymprint (stderr, \
2580 YYFPRINTF (stderr, "\n"); \
2584 /*------------------------------------------------------------------.
2585 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2587 `------------------------------------------------------------------*/
2589 #if defined (__STDC__) || defined (__cplusplus)
2591 yy_stack_print (short int *bottom, short int *top)
2594 yy_stack_print (bottom, top)
2599 YYFPRINTF (stderr, "Stack now");
2600 for (/* Nothing. */; bottom <= top; ++bottom)
2601 YYFPRINTF (stderr, " %d", *bottom);
2602 YYFPRINTF (stderr, "\n");
2605 # define YY_STACK_PRINT(Bottom, Top) \
2608 yy_stack_print ((Bottom), (Top)); \
2612 /*------------------------------------------------.
2613 | Report that the YYRULE is going to be reduced. |
2614 `------------------------------------------------*/
2616 #if defined (__STDC__) || defined (__cplusplus)
2618 yy_reduce_print (int yyrule)
2621 yy_reduce_print (yyrule)
2626 unsigned long int yylno = yyrline[yyrule];
2627 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2629 /* Print the symbols being reduced, and their result. */
2630 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2631 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2632 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2635 # define YY_REDUCE_PRINT(Rule) \
2638 yy_reduce_print (Rule); \
2641 /* Nonzero means print parse trace. It is left uninitialized so that
2642 multiple parsers can coexist. */
2644 #else /* !YYDEBUG */
2645 # define YYDPRINTF(Args)
2646 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2647 # define YY_STACK_PRINT(Bottom, Top)
2648 # define YY_REDUCE_PRINT(Rule)
2649 #endif /* !YYDEBUG */
2652 /* YYINITDEPTH -- initial size of the parser's stacks. */
2654 # define YYINITDEPTH 200
2657 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2658 if the built-in stack extension method is used).
2660 Do not make this value too large; the results are undefined if
2661 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2662 evaluated with infinite-precision integer arithmetic. */
2665 # define YYMAXDEPTH 10000
2673 # if defined (__GLIBC__) && defined (_STRING_H)
2674 # define yystrlen strlen
2676 /* Return the length of YYSTR. */
2678 # if defined (__STDC__) || defined (__cplusplus)
2679 yystrlen (const char *yystr)
2685 const char *yys = yystr;
2687 while (*yys++ != '\0')
2690 return yys - yystr - 1;
2696 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2697 # define yystpcpy stpcpy
2699 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2702 # if defined (__STDC__) || defined (__cplusplus)
2703 yystpcpy (char *yydest, const char *yysrc)
2705 yystpcpy (yydest, yysrc)
2711 const char *yys = yysrc;
2713 while ((*yyd++ = *yys++) != '\0')
2722 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2723 quotes and backslashes, so that it's suitable for yyerror. The
2724 heuristic is that double-quoting is unnecessary unless the string
2725 contains an apostrophe, a comma, or backslash (other than
2726 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2727 null, do not copy; instead, return the length of what the result
2730 yytnamerr (char *yyres, const char *yystr)
2735 char const *yyp = yystr;
2742 goto do_not_strip_quotes;
2746 goto do_not_strip_quotes;
2759 do_not_strip_quotes: ;
2763 return yystrlen (yystr);
2765 return yystpcpy (yyres, yystr) - yyres;
2769 #endif /* YYERROR_VERBOSE */
2774 /*--------------------------------.
2775 | Print this symbol on YYOUTPUT. |
2776 `--------------------------------*/
2778 #if defined (__STDC__) || defined (__cplusplus)
2780 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2783 yysymprint (yyoutput, yytype, yyvaluep)
2789 /* Pacify ``unused variable'' warnings. */
2792 if (yytype < YYNTOKENS)
2793 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2795 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2799 if (yytype < YYNTOKENS)
2800 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2807 YYFPRINTF (yyoutput, ")");
2810 #endif /* ! YYDEBUG */
2811 /*-----------------------------------------------.
2812 | Release the memory associated to this symbol. |
2813 `-----------------------------------------------*/
2815 #if defined (__STDC__) || defined (__cplusplus)
2817 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2820 yydestruct (yymsg, yytype, yyvaluep)
2826 /* Pacify ``unused variable'' warnings. */
2831 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2842 /* Prevent warnings from -Wmissing-prototypes. */
2844 #ifdef YYPARSE_PARAM
2845 # if defined (__STDC__) || defined (__cplusplus)
2846 int yyparse (void *YYPARSE_PARAM);
2850 #else /* ! YYPARSE_PARAM */
2851 #if defined (__STDC__) || defined (__cplusplus)
2856 #endif /* ! YYPARSE_PARAM */
2860 /* The look-ahead symbol. */
2863 /* The semantic value of the look-ahead symbol. */
2866 /* Number of syntax errors so far. */
2875 #ifdef YYPARSE_PARAM
2876 # if defined (__STDC__) || defined (__cplusplus)
2877 int yyparse (void *YYPARSE_PARAM)
2879 int yyparse (YYPARSE_PARAM)
2880 void *YYPARSE_PARAM;
2882 #else /* ! YYPARSE_PARAM */
2883 #if defined (__STDC__) || defined (__cplusplus)
2897 /* Number of tokens to shift before error messages enabled. */
2899 /* Look-ahead token as an internal (translated) token number. */
2902 /* Three stacks and their tools:
2903 `yyss': related to states,
2904 `yyvs': related to semantic values,
2905 `yyls': related to locations.
2907 Refer to the stacks thru separate pointers, to allow yyoverflow
2908 to reallocate them elsewhere. */
2910 /* The state stack. */
2911 short int yyssa[YYINITDEPTH];
2912 short int *yyss = yyssa;
2915 /* The semantic value stack. */
2916 YYSTYPE yyvsa[YYINITDEPTH];
2917 YYSTYPE *yyvs = yyvsa;
2922 #define YYPOPSTACK (yyvsp--, yyssp--)
2924 YYSIZE_T yystacksize = YYINITDEPTH;
2926 /* The variables used to return semantic value and location from the
2931 /* When reducing, the number of symbols on the RHS of the reduced
2935 YYDPRINTF ((stderr, "Starting parse\n"));
2940 yychar = YYEMPTY; /* Cause a token to be read. */
2942 /* Initialize stack pointers.
2943 Waste one element of value and location stack
2944 so that they stay on the same level as the state stack.
2945 The wasted elements are never initialized. */
2952 /*------------------------------------------------------------.
2953 | yynewstate -- Push a new state, which is found in yystate. |
2954 `------------------------------------------------------------*/
2956 /* In all cases, when you get here, the value and location stacks
2957 have just been pushed. so pushing a state here evens the stacks.
2964 if (yyss + yystacksize - 1 <= yyssp)
2966 /* Get the current used size of the three stacks, in elements. */
2967 YYSIZE_T yysize = yyssp - yyss + 1;
2971 /* Give user a chance to reallocate the stack. Use copies of
2972 these so that the &'s don't force the real ones into
2974 YYSTYPE *yyvs1 = yyvs;
2975 short int *yyss1 = yyss;
2978 /* Each stack pointer address is followed by the size of the
2979 data in use in that stack, in bytes. This used to be a
2980 conditional around just the two extra args, but that might
2981 be undefined if yyoverflow is a macro. */
2982 yyoverflow (YY_("memory exhausted"),
2983 &yyss1, yysize * sizeof (*yyssp),
2984 &yyvs1, yysize * sizeof (*yyvsp),
2991 #else /* no yyoverflow */
2992 # ifndef YYSTACK_RELOCATE
2993 goto yyexhaustedlab;
2995 /* Extend the stack our own way. */
2996 if (YYMAXDEPTH <= yystacksize)
2997 goto yyexhaustedlab;
2999 if (YYMAXDEPTH < yystacksize)
3000 yystacksize = YYMAXDEPTH;
3003 short int *yyss1 = yyss;
3004 union yyalloc *yyptr =
3005 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3007 goto yyexhaustedlab;
3008 YYSTACK_RELOCATE (yyss);
3009 YYSTACK_RELOCATE (yyvs);
3011 # undef YYSTACK_RELOCATE
3013 YYSTACK_FREE (yyss1);
3016 #endif /* no yyoverflow */
3018 yyssp = yyss + yysize - 1;
3019 yyvsp = yyvs + yysize - 1;
3022 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3023 (unsigned long int) yystacksize));
3025 if (yyss + yystacksize - 1 <= yyssp)
3029 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3038 /* Do appropriate processing given the current state. */
3039 /* Read a look-ahead token if we need one and don't already have one. */
3042 /* First try to decide what to do without reference to look-ahead token. */
3044 yyn = yypact[yystate];
3045 if (yyn == YYPACT_NINF)
3048 /* Not known => get a look-ahead token if don't already have one. */
3050 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3051 if (yychar == YYEMPTY)
3053 YYDPRINTF ((stderr, "Reading a token: "));
3057 if (yychar <= YYEOF)
3059 yychar = yytoken = YYEOF;
3060 YYDPRINTF ((stderr, "Now at end of input.\n"));
3064 yytoken = YYTRANSLATE (yychar);
3065 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3068 /* If the proper action on seeing token YYTOKEN is to reduce or to
3069 detect an error, take that action. */
3071 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3076 if (yyn == 0 || yyn == YYTABLE_NINF)
3085 /* Shift the look-ahead token. */
3086 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3088 /* Discard the token being shifted unless it is eof. */
3089 if (yychar != YYEOF)
3095 /* Count tokens shifted since error; after three, turn off error
3104 /*-----------------------------------------------------------.
3105 | yydefault -- do the default action for the current state. |
3106 `-----------------------------------------------------------*/
3108 yyn = yydefact[yystate];
3114 /*-----------------------------.
3115 | yyreduce -- Do a reduction. |
3116 `-----------------------------*/
3118 /* yyn is the number of a rule to reduce with. */
3121 /* If YYLEN is nonzero, implement the default value of the action:
3124 Otherwise, the following line sets YYVAL to garbage.
3125 This behavior is undocumented and Bison
3126 users should not rely upon it. Assigning to YYVAL
3127 unconditionally makes the parser a bit smaller, and it avoids a
3128 GCC warning that YYVAL may be used uninitialized. */
3129 yyval = yyvsp[1-yylen];
3132 YY_REDUCE_PRINT (yyn);
3136 #line 1104 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3138 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3139 GEN_ERROR("Value too large for type!");
3140 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3146 #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3148 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
3149 GEN_ERROR("Value too large for type!");
3150 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3156 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3157 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3161 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3162 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3166 #line 1131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3167 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3171 #line 1131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3172 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3176 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3177 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3181 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3182 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3186 #line 1133 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3187 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3191 #line 1133 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3192 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3196 #line 1134 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3197 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3201 #line 1134 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3202 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3206 #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3207 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3211 #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3212 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3216 #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3217 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3221 #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3222 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3226 #line 1140 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3227 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3231 #line 1140 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3232 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3236 #line 1141 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3237 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3241 #line 1141 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3242 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3246 #line 1142 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3247 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3251 #line 1142 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3252 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3256 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3257 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3261 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3262 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3266 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3267 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3271 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3272 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3276 #line 1145 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3277 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3281 #line 1146 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3282 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3286 #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3288 (yyval.StrVal) = (yyvsp[-1].StrVal);
3294 #line 1161 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3302 #line 1166 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3303 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3307 #line 1167 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3308 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3312 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3313 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3317 #line 1169 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3318 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3322 #line 1170 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3323 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3327 #line 1171 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3328 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3332 #line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3333 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3337 #line 1173 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3338 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3342 #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3343 { (yyval.UIntVal) = CallingConv::C; ;}
3347 #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3348 { (yyval.UIntVal) = CallingConv::C; ;}
3352 #line 1177 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3353 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3357 #line 1178 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3358 { (yyval.UIntVal) = CallingConv::Fast; ;}
3362 #line 1179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3363 { (yyval.UIntVal) = CallingConv::Cold; ;}
3367 #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3368 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3372 #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3373 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3377 #line 1182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3379 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3380 GEN_ERROR("Calling conv too large!");
3381 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3387 #line 1191 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3388 { (yyval.UIntVal) = 0; ;}
3392 #line 1192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3394 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3395 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3396 GEN_ERROR("Alignment must be a power of two!");
3402 #line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3403 { (yyval.UIntVal) = 0; ;}
3407 #line 1199 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3409 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3410 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3411 GEN_ERROR("Alignment must be a power of two!");
3417 #line 1207 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3419 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3420 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3421 GEN_ERROR("Invalid character in section name!");
3422 (yyval.StrVal) = (yyvsp[0].StrVal);
3428 #line 1215 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3429 { (yyval.StrVal) = 0; ;}
3433 #line 1216 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3434 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3438 #line 1221 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3443 #line 1222 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3448 #line 1223 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3450 CurGV->setSection((yyvsp[0].StrVal));
3451 free((yyvsp[0].StrVal));
3457 #line 1228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3459 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3460 GEN_ERROR("Alignment must be a power of two!");
3461 CurGV->setAlignment((yyvsp[0].UInt64Val));
3467 #line 1242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3468 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3472 #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3473 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3477 #line 1245 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3479 if (!UpRefs.empty())
3480 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3481 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3487 #line 1257 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3489 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3495 #line 1261 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3497 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3503 #line 1265 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3504 { // Named types are also simple types...
3505 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3507 (yyval.TypeVal) = new PATypeHolder(tmp);
3512 #line 1273 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3513 { // Type UpReference
3514 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3515 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3516 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3517 (yyval.TypeVal) = new PATypeHolder(OT);
3518 UR_OUT("New Upreference!\n");
3524 #line 1281 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3525 { // Function derived type?
3526 std::vector<const Type*> Params;
3527 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3528 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3529 Params.push_back(*I);
3530 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3531 if (isVarArg) Params.pop_back();
3533 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3534 delete (yyvsp[-1].TypeList); // Delete the argument list
3535 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3541 #line 1294 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3542 { // Sized array type?
3543 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3544 delete (yyvsp[-1].TypeVal);
3550 #line 1299 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3551 { // Packed array type?
3552 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3553 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3554 GEN_ERROR("Unsigned result not equal to signed result");
3555 if (!ElemTy->isPrimitiveType())
3556 GEN_ERROR("Elemental type of a PackedType must be primitive");
3557 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3558 GEN_ERROR("Vector length should be a power of 2!");
3559 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3560 delete (yyvsp[-1].TypeVal);
3566 #line 1311 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3567 { // Structure type?
3568 std::vector<const Type*> Elements;
3569 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3570 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3571 Elements.push_back(*I);
3573 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3574 delete (yyvsp[-1].TypeList);
3580 #line 1321 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3581 { // Empty structure type?
3582 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3588 #line 1325 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3590 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3591 GEN_ERROR("Cannot form a pointer to a basic block");
3592 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3593 delete (yyvsp[-1].TypeVal);
3599 #line 1336 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3601 (yyval.TypeList) = new std::list<PATypeHolder>();
3602 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3608 #line 1341 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3610 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3616 #line 1348 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3618 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3624 #line 1352 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3626 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3632 #line 1356 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3634 (yyval.TypeList) = new std::list<PATypeHolder>();
3640 #line 1367 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3641 { // Nonempty unsized arr
3642 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3644 GEN_ERROR("Cannot make array constant with type: '" +
3645 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3646 const Type *ETy = ATy->getElementType();
3647 int NumElements = ATy->getNumElements();
3649 // Verify that we have the correct size...
3650 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3651 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3652 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3653 itostr(NumElements) + "!");
3655 // Verify all elements are correct type!
3656 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3657 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3658 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3659 ETy->getDescription() +"' as required!\nIt is of type '"+
3660 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3663 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3664 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3670 #line 1393 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3672 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3674 GEN_ERROR("Cannot make array constant with type: '" +
3675 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3677 int NumElements = ATy->getNumElements();
3678 if (NumElements != -1 && NumElements != 0)
3679 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3680 " arguments, but has size of " + itostr(NumElements) +"!");
3681 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3682 delete (yyvsp[-2].TypeVal);
3688 #line 1407 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3690 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3692 GEN_ERROR("Cannot make array constant with type: '" +
3693 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3695 int NumElements = ATy->getNumElements();
3696 const Type *ETy = ATy->getElementType();
3697 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3698 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3699 GEN_ERROR("Can't build string constant of size " +
3700 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3701 " when array has size " + itostr(NumElements) + "!");
3702 std::vector<Constant*> Vals;
3703 if (ETy == Type::SByteTy) {
3704 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3705 Vals.push_back(ConstantInt::get(ETy, *C));
3706 } else if (ETy == Type::UByteTy) {
3707 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3708 C != (unsigned char*)EndStr; ++C)
3709 Vals.push_back(ConstantInt::get(ETy, *C));
3711 free((yyvsp[0].StrVal));
3712 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3714 free((yyvsp[0].StrVal));
3715 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3716 delete (yyvsp[-2].TypeVal);
3722 #line 1437 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3723 { // Nonempty unsized arr
3724 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3726 GEN_ERROR("Cannot make packed constant with type: '" +
3727 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3728 const Type *ETy = PTy->getElementType();
3729 int NumElements = PTy->getNumElements();
3731 // Verify that we have the correct size...
3732 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3733 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3734 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3735 itostr(NumElements) + "!");
3737 // Verify all elements are correct type!
3738 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3739 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3740 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3741 ETy->getDescription() +"' as required!\nIt is of type '"+
3742 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3745 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3746 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3752 #line 1463 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3754 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3756 GEN_ERROR("Cannot make struct constant with type: '" +
3757 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3759 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3760 GEN_ERROR("Illegal number of initializers for structure type!");
3762 // Check to ensure that constants are compatible with the type initializer!
3763 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3764 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3765 GEN_ERROR("Expected type '" +
3766 STy->getElementType(i)->getDescription() +
3767 "' for element #" + utostr(i) +
3768 " of structure initializer!");
3770 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3771 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3777 #line 1484 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3779 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3781 GEN_ERROR("Cannot make struct constant with type: '" +
3782 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3784 if (STy->getNumContainedTypes() != 0)
3785 GEN_ERROR("Illegal number of initializers for structure type!");
3787 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3788 delete (yyvsp[-2].TypeVal);
3794 #line 1497 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3796 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3798 GEN_ERROR("Cannot make null pointer constant with type: '" +
3799 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3801 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3802 delete (yyvsp[-1].TypeVal);
3808 #line 1507 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3810 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3811 delete (yyvsp[-1].TypeVal);
3817 #line 1512 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3819 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3821 GEN_ERROR("Global const reference must be a pointer type!");
3823 // ConstExprs can exist in the body of a function, thus creating
3824 // GlobalValues whenever they refer to a variable. Because we are in
3825 // the context of a function, getValNonImprovising will search the functions
3826 // symbol table instead of the module symbol table for the global symbol,
3827 // which throws things all off. To get around this, we just tell
3828 // getValNonImprovising that we are at global scope here.
3830 Function *SavedCurFn = CurFun.CurrentFunction;
3831 CurFun.CurrentFunction = 0;
3833 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3836 CurFun.CurrentFunction = SavedCurFn;
3838 // If this is an initializer for a constant pointer, which is referencing a
3839 // (currently) undefined variable, create a stub now that shall be replaced
3840 // in the future with the right type of variable.
3843 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3844 const PointerType *PT = cast<PointerType>(Ty);
3846 // First check to see if the forward references value is already created!
3847 PerModuleInfo::GlobalRefsType::iterator I =
3848 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3850 if (I != CurModule.GlobalRefs.end()) {
3851 V = I->second; // Placeholder already exists, use it...
3852 (yyvsp[0].ValIDVal).destroy();
3855 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3857 // Create the forward referenced global.
3859 if (const FunctionType *FTy =
3860 dyn_cast<FunctionType>(PT->getElementType())) {
3861 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3862 CurModule.CurrentModule);
3864 GV = new GlobalVariable(PT->getElementType(), false,
3865 GlobalValue::ExternalLinkage, 0,
3866 Name, CurModule.CurrentModule);
3869 // Keep track of the fact that we have a forward ref to recycle it
3870 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3875 (yyval.ConstVal) = cast<GlobalValue>(V);
3876 delete (yyvsp[-1].TypeVal); // Free the type handle
3882 #line 1573 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3884 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3885 GEN_ERROR("Mismatched types for constant expression!");
3886 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3887 delete (yyvsp[-1].TypeVal);
3893 #line 1580 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3895 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3896 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3897 GEN_ERROR("Cannot create a null initialized value of this type!");
3898 (yyval.ConstVal) = Constant::getNullValue(Ty);
3899 delete (yyvsp[-1].TypeVal);
3905 #line 1588 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3906 { // integral constants
3907 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3908 GEN_ERROR("Constant value doesn't fit in type!");
3909 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3915 #line 1594 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3916 { // integral constants
3917 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3918 GEN_ERROR("Constant value doesn't fit in type!");
3919 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3925 #line 1600 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3926 { // Boolean constants
3927 (yyval.ConstVal) = ConstantBool::getTrue();
3933 #line 1604 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3934 { // Boolean constants
3935 (yyval.ConstVal) = ConstantBool::getFalse();
3941 #line 1608 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3942 { // Float & Double constants
3943 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3944 GEN_ERROR("Floating point constant invalid for type!!");
3945 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3951 #line 1616 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3953 Constant *Val = (yyvsp[-3].ConstVal);
3954 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3955 if (!Val->getType()->isFirstClassType())
3956 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3957 Val->getType()->getDescription() + "'!");
3958 if (!Ty->isFirstClassType())
3959 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3960 Ty->getDescription() + "'!");
3961 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3962 delete (yyvsp[-1].TypeVal);
3967 #line 1628 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3969 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3970 GEN_ERROR("GetElementPtr requires a pointer operand!");
3972 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3973 // indices to uint struct indices for compatibility.
3974 generic_gep_type_iterator<std::vector<Value*>::iterator>
3975 GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3976 GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3977 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3978 if (isa<StructType>(*GTI)) // Only change struct indices
3979 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[-1].ValueList))[i]))
3980 if (CUI->getType() == Type::UByteTy)
3981 (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3984 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3986 GEN_ERROR("Index list invalid for constant getelementptr!");
3988 std::vector<Constant*> IdxVec;
3989 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3990 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3991 IdxVec.push_back(C);
3993 GEN_ERROR("Indices to constant getelementptr must be constants!");
3995 delete (yyvsp[-1].ValueList);
3997 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
4003 #line 1660 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4005 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
4006 GEN_ERROR("Select condition must be of boolean type!");
4007 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4008 GEN_ERROR("Select operand types must match!");
4009 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4015 #line 1668 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4017 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4018 GEN_ERROR("Binary operator types must match!");
4021 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
4022 // To retain backward compatibility with these early compilers, we emit a
4023 // cast to the appropriate integer type automatically if we are in the
4024 // broken case. See PR424 for more information.
4025 if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
4026 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4028 const Type *IntPtrTy = 0;
4029 switch (CurModule.CurrentModule->getPointerSize()) {
4030 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
4031 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
4032 default: GEN_ERROR("invalid pointer binary constant expr!");
4034 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
4035 ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
4036 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
4043 #line 1692 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4045 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4046 GEN_ERROR("Logical operator types must match!");
4047 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4048 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4049 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4050 GEN_ERROR("Logical operator requires integral operands!");
4052 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4058 #line 1703 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4060 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4061 GEN_ERROR("setcc operand types must match!");
4062 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4068 #line 1709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4070 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4071 GEN_ERROR("icmp operand types must match!");
4072 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4077 #line 1714 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4079 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4080 GEN_ERROR("fcmp operand types must match!");
4081 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4086 #line 1719 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4088 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
4089 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
4090 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4091 GEN_ERROR("Shift constant expression requires integer operand!");
4093 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4099 #line 1728 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4101 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4102 GEN_ERROR("Invalid extractelement operands!");
4103 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4109 #line 1734 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4111 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4112 GEN_ERROR("Invalid insertelement operands!");
4113 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4119 #line 1740 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4121 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4122 GEN_ERROR("Invalid shufflevector operands!");
4123 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4129 #line 1749 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4131 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4137 #line 1753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4139 (yyval.ConstVector) = new std::vector<Constant*>();
4140 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4146 #line 1761 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4147 { (yyval.BoolVal) = false; ;}
4151 #line 1761 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4152 { (yyval.BoolVal) = true; ;}
4156 #line 1771 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4158 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
4159 CurModule.ModuleDone();
4165 #line 1779 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4167 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4168 CurFun.FunctionDone();
4174 #line 1784 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4176 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4182 #line 1788 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4184 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4190 #line 1792 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4192 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4198 #line 1796 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4200 (yyval.ModuleVal) = CurModule.CurrentModule;
4201 // Emit an error if there are any unresolved types left.
4202 if (!CurModule.LateResolveTypes.empty()) {
4203 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4204 if (DID.Type == ValID::NameVal) {
4205 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4207 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4215 #line 1811 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4217 // Eagerly resolve types. This is not an optimization, this is a
4218 // requirement that is due to the fact that we could have this:
4220 // %list = type { %list * }
4221 // %list = type { %list * } ; repeated type decl
4223 // If types are not resolved eagerly, then the two types will not be
4224 // determined to be the same type!
4226 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4228 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4230 // If this is a named type that is not a redefinition, add it to the slot
4232 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4235 delete (yyvsp[0].TypeVal);
4241 #line 1833 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4242 { // Function prototypes can be in const pool
4248 #line 1836 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4249 { // Asm blocks can be in the const pool
4255 #line 1839 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4257 if ((yyvsp[0].ConstVal) == 0)
4258 GEN_ERROR("Global value initializer is not a constant!");
4259 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4265 #line 1844 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4272 #line 1847 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4274 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4276 delete (yyvsp[0].TypeVal);
4281 #line 1851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4289 #line 1855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4291 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4293 delete (yyvsp[0].TypeVal);
4298 #line 1859 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4306 #line 1863 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4309 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4311 delete (yyvsp[0].TypeVal);
4316 #line 1868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4324 #line 1872 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4331 #line 1875 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4338 #line 1878 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4344 #line 1882 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4346 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4347 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4348 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4349 free((yyvsp[0].StrVal));
4351 if (AsmSoFar.empty())
4352 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4354 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4360 #line 1895 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4361 { (yyval.Endianness) = Module::BigEndian; ;}
4365 #line 1896 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4366 { (yyval.Endianness) = Module::LittleEndian; ;}
4370 #line 1898 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4372 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4378 #line 1902 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4380 if ((yyvsp[0].UInt64Val) == 32)
4381 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4382 else if ((yyvsp[0].UInt64Val) == 64)
4383 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4385 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4391 #line 1911 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4393 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4394 free((yyvsp[0].StrVal));
4399 #line 1915 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4401 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4402 free((yyvsp[0].StrVal));
4407 #line 1922 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4409 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4410 free((yyvsp[0].StrVal));
4416 #line 1927 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4418 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4419 free((yyvsp[0].StrVal));
4425 #line 1932 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4432 #line 1942 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4433 { (yyval.StrVal) = 0; ;}
4437 #line 1944 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4439 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4440 GEN_ERROR("void typed arguments are invalid!");
4441 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4447 #line 1951 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4449 (yyval.ArgList) = (yyvsp[-2].ArgList);
4450 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4451 delete (yyvsp[0].ArgVal);
4457 #line 1957 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4459 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4460 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4461 delete (yyvsp[0].ArgVal);
4467 #line 1964 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4469 (yyval.ArgList) = (yyvsp[0].ArgList);
4475 #line 1968 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4477 (yyval.ArgList) = (yyvsp[-2].ArgList);
4478 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4479 char*>(new PATypeHolder(Type::VoidTy), 0));
4485 #line 1974 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4487 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4488 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4494 #line 1979 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4496 (yyval.ArgList) = 0;
4502 #line 1985 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4504 UnEscapeLexed((yyvsp[-5].StrVal));
4505 std::string FunctionName((yyvsp[-5].StrVal));
4506 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4508 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4509 GEN_ERROR("LLVM functions cannot return aggregate types!");
4511 std::vector<const Type*> ParamTypeList;
4512 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4513 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4514 I != (yyvsp[-3].ArgList)->end(); ++I)
4515 ParamTypeList.push_back(I->first->get());
4518 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4519 if (isVarArg) ParamTypeList.pop_back();
4521 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4522 const PointerType *PFT = PointerType::get(FT);
4523 delete (yyvsp[-6].TypeVal);
4526 if (!FunctionName.empty()) {
4527 ID = ValID::create((char*)FunctionName.c_str());
4529 ID = ValID::create((int)CurModule.Values[PFT].size());
4533 // See if this function was forward referenced. If so, recycle the object.
4534 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4535 // Move the function to the end of the list, from whereever it was
4536 // previously inserted.
4537 Fn = cast<Function>(FWRef);
4538 CurModule.CurrentModule->getFunctionList().remove(Fn);
4539 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4540 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4541 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4542 // If this is the case, either we need to be a forward decl, or it needs
4544 if (!CurFun.isDeclare && !Fn->isExternal())
4545 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4547 // Make sure to strip off any argument names so we can't get conflicts.
4548 if (Fn->isExternal())
4549 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4552 } else { // Not already defined?
4553 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4554 CurModule.CurrentModule);
4556 InsertValue(Fn, CurModule.Values);
4559 CurFun.FunctionStart(Fn);
4561 if (CurFun.isDeclare) {
4562 // If we have declaration, always overwrite linkage. This will allow us to
4563 // correctly handle cases, when pointer to function is passed as argument to
4564 // another function.
4565 Fn->setLinkage(CurFun.Linkage);
4567 Fn->setCallingConv((yyvsp[-7].UIntVal));
4568 Fn->setAlignment((yyvsp[0].UIntVal));
4569 if ((yyvsp[-1].StrVal)) {
4570 Fn->setSection((yyvsp[-1].StrVal));
4571 free((yyvsp[-1].StrVal));
4574 // Add all of the arguments we parsed to the function...
4575 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4576 if (isVarArg) { // Nuke the last entry
4577 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4578 "Not a varargs marker!");
4579 delete (yyvsp[-3].ArgList)->back().first;
4580 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4582 Function::arg_iterator ArgIt = Fn->arg_begin();
4583 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4584 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4585 delete I->first; // Delete the typeholder...
4587 setValueName(ArgIt, I->second); // Insert arg into symtab...
4592 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4599 #line 2081 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4601 (yyval.FunctionVal) = CurFun.CurrentFunction;
4603 // Make sure that we keep track of the linkage type even if there was a
4604 // previous "declare".
4605 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4610 #line 2091 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4612 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4618 #line 2097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4619 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4623 #line 2098 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4624 { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4628 #line 2100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4629 { CurFun.isDeclare = true; ;}
4633 #line 2100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4635 (yyval.FunctionVal) = CurFun.CurrentFunction;
4636 CurFun.FunctionDone();
4642 #line 2110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4644 (yyval.BoolVal) = false;
4650 #line 2114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4652 (yyval.BoolVal) = true;
4658 #line 2119 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4659 { // A reference to a direct constant
4660 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4666 #line 2123 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4668 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4674 #line 2127 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4675 { // Perhaps it's an FP constant?
4676 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4682 #line 2131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4684 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4690 #line 2135 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4692 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4698 #line 2139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4700 (yyval.ValIDVal) = ValID::createNull();
4706 #line 2143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4708 (yyval.ValIDVal) = ValID::createUndef();
4714 #line 2147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4715 { // A vector zero constant.
4716 (yyval.ValIDVal) = ValID::createZeroInit();
4722 #line 2151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4723 { // Nonempty unsized packed vector
4724 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4725 int NumElements = (yyvsp[-1].ConstVector)->size();
4727 PackedType* pt = PackedType::get(ETy, NumElements);
4728 PATypeHolder* PTy = new PATypeHolder(
4736 // Verify all elements are correct type!
4737 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4738 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4739 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4740 ETy->getDescription() +"' as required!\nIt is of type '" +
4741 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4744 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4745 delete PTy; delete (yyvsp[-1].ConstVector);
4751 #line 2176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4753 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4759 #line 2180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4761 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4762 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4763 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4764 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4765 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4766 free((yyvsp[-2].StrVal));
4767 free((yyvsp[0].StrVal));
4773 #line 2194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4774 { // Is it an integer reference...?
4775 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4781 #line 2198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4782 { // Is it a named reference...?
4783 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4789 #line 2210 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4791 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4797 #line 2215 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4799 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4805 #line 2219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4806 { // Do not allow functions with 0 basic blocks
4807 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4813 #line 2228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4815 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4817 InsertValue((yyvsp[0].TermInstVal));
4819 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4820 InsertValue((yyvsp[-2].BasicBlockVal));
4821 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4827 #line 2239 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4829 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4830 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4831 if (CI2->getParent() == 0)
4832 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4833 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4834 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4840 #line 2248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4842 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4845 // Make sure to move the basic block to the correct location in the
4846 // function, instead of leaving it inserted wherever it was first
4848 Function::BasicBlockListType &BBL =
4849 CurFun.CurrentFunction->getBasicBlockList();
4850 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4856 #line 2260 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4858 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4861 // Make sure to move the basic block to the correct location in the
4862 // function, instead of leaving it inserted wherever it was first
4864 Function::BasicBlockListType &BBL =
4865 CurFun.CurrentFunction->getBasicBlockList();
4866 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4872 #line 2273 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4873 { // Return with a result...
4874 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4880 #line 2277 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4881 { // Return with no result...
4882 (yyval.TermInstVal) = new ReturnInst();
4888 #line 2281 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4889 { // Unconditional Branch...
4890 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4892 (yyval.TermInstVal) = new BranchInst(tmpBB);
4897 #line 2286 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4899 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4901 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4903 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4905 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4910 #line 2295 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4912 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4914 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4916 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4917 (yyval.TermInstVal) = S;
4919 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4920 E = (yyvsp[-1].JumpTable)->end();
4921 for (; I != E; ++I) {
4922 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4923 S->addCase(CI, I->second);
4925 GEN_ERROR("Switch case is constant, but not a simple integer!");
4927 delete (yyvsp[-1].JumpTable);
4933 #line 2314 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4935 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4937 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4939 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4940 (yyval.TermInstVal) = S;
4946 #line 2324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4948 const PointerType *PFTy;
4949 const FunctionType *Ty;
4951 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4952 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4953 // Pull out the types of all of the arguments...
4954 std::vector<const Type*> ParamTypes;
4955 if ((yyvsp[-7].ValueList)) {
4956 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4958 ParamTypes.push_back((*I)->getType());
4961 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4962 if (isVarArg) ParamTypes.pop_back();
4964 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4965 PFTy = PointerType::get(Ty);
4968 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4970 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4972 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4975 // Create the call node...
4976 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4977 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4978 } else { // Has arguments?
4979 // Loop through FunctionType's arguments and ensure they are specified
4982 FunctionType::param_iterator I = Ty->param_begin();
4983 FunctionType::param_iterator E = Ty->param_end();
4984 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4986 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4987 if ((*ArgI)->getType() != *I)
4988 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4989 (*I)->getDescription() + "'!");
4991 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4992 GEN_ERROR("Invalid number of parameters detected!");
4994 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4996 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4998 delete (yyvsp[-10].TypeVal);
4999 delete (yyvsp[-7].ValueList);
5005 #line 2379 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5007 (yyval.TermInstVal) = new UnwindInst();
5013 #line 2383 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5015 (yyval.TermInstVal) = new UnreachableInst();
5021 #line 2390 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5023 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5024 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5027 GEN_ERROR("May only switch on a constant pool value!");
5029 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5031 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5036 #line 2401 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5038 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5039 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5043 GEN_ERROR("May only switch on a constant pool value!");
5045 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5047 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5052 #line 2414 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5054 // Is this definition named?? if so, assign the name...
5055 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5057 InsertValue((yyvsp[0].InstVal));
5058 (yyval.InstVal) = (yyvsp[0].InstVal);
5064 #line 2423 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5065 { // Used for PHI nodes
5066 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5067 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5069 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5071 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5072 delete (yyvsp[-5].TypeVal);
5077 #line 2432 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5079 (yyval.PHIList) = (yyvsp[-6].PHIList);
5080 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5082 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5084 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5089 #line 2442 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5090 { // Used for call statements, and memory insts...
5091 (yyval.ValueList) = new std::vector<Value*>();
5092 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5097 #line 2446 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5099 (yyval.ValueList) = (yyvsp[-2].ValueList);
5100 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
5106 #line 2453 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5107 { (yyval.ValueList) = 0; ;}
5111 #line 2455 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5113 (yyval.BoolVal) = true;
5119 #line 2459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5121 (yyval.BoolVal) = false;
5127 #line 2464 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5129 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5130 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5132 "Arithmetic operator requires integer, FP, or packed operands!");
5133 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5134 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5135 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5136 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5137 GEN_ERROR("U/S/FRem not supported on packed types!");
5138 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5140 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5142 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5143 if ((yyval.InstVal) == 0)
5144 GEN_ERROR("binary operator returned null!");
5145 delete (yyvsp[-3].TypeVal);
5150 #line 2483 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5152 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5153 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5154 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5155 GEN_ERROR("Logical operator requires integral operands!");
5157 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5159 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5161 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5162 if ((yyval.InstVal) == 0)
5163 GEN_ERROR("binary operator returned null!");
5164 delete (yyvsp[-3].TypeVal);
5169 #line 2498 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5171 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
5173 "PackedTypes currently not supported in setcc instructions!");
5175 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5177 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5179 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5180 if ((yyval.InstVal) == 0)
5181 GEN_ERROR("binary operator returned null!");
5182 delete (yyvsp[-3].TypeVal);
5187 #line 2512 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5189 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5190 GEN_ERROR("Packed types not supported by icmp instruction");
5191 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5193 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5195 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5196 if ((yyval.InstVal) == 0)
5197 GEN_ERROR("icmp operator returned null!");
5202 #line 2523 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5204 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5205 GEN_ERROR("Packed types not supported by fcmp instruction");
5206 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5208 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5210 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5211 if ((yyval.InstVal) == 0)
5212 GEN_ERROR("fcmp operator returned null!");
5217 #line 2534 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5219 llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
5220 << " Replacing with 'xor'.\n";
5222 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5224 GEN_ERROR("Expected integral type for not instruction!");
5226 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5227 if ((yyval.InstVal) == 0)
5228 GEN_ERROR("Could not create a xor instruction!");
5234 #line 2547 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5236 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
5237 GEN_ERROR("Shift amount must be ubyte!");
5238 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5239 GEN_ERROR("Shift constant expression requires integer operand!");
5241 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5247 #line 2556 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5249 Value* Val = (yyvsp[-2].ValueVal);
5250 const Type* Ty = (yyvsp[0].TypeVal)->get();
5251 if (!Val->getType()->isFirstClassType())
5252 GEN_ERROR("cast from a non-primitive type: '" +
5253 Val->getType()->getDescription() + "'!");
5254 if (!Ty->isFirstClassType())
5255 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5256 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
5257 delete (yyvsp[0].TypeVal);
5262 #line 2567 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5264 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5265 GEN_ERROR("select condition must be boolean!");
5266 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5267 GEN_ERROR("select value types should match!");
5268 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5274 #line 2575 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5277 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5278 delete (yyvsp[0].TypeVal);
5284 #line 2581 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5286 ObsoleteVarArgs = true;
5287 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5288 Function* NF = CurModule.CurrentModule->
5289 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5292 //foo = alloca 1 of t
5296 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
5297 CurBB->getInstList().push_back(foo);
5298 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5299 CurBB->getInstList().push_back(bar);
5300 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5301 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5302 delete (yyvsp[0].TypeVal);
5308 #line 2601 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5310 ObsoleteVarArgs = true;
5311 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5312 Function* NF = CurModule.CurrentModule->
5313 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5315 //b = vanext a, t ->
5316 //foo = alloca 1 of t
5319 //tmp = vaarg foo, t
5321 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
5322 CurBB->getInstList().push_back(foo);
5323 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5324 CurBB->getInstList().push_back(bar);
5325 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5326 Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5327 CurBB->getInstList().push_back(tmp);
5328 (yyval.InstVal) = new LoadInst(foo);
5329 delete (yyvsp[0].TypeVal);
5335 #line 2624 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5337 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5338 GEN_ERROR("Invalid extractelement operands!");
5339 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5345 #line 2630 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5347 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5348 GEN_ERROR("Invalid insertelement operands!");
5349 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5355 #line 2636 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5357 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5358 GEN_ERROR("Invalid shufflevector operands!");
5359 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5365 #line 2642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5367 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5368 if (!Ty->isFirstClassType())
5369 GEN_ERROR("PHI node operands must be of first class type!");
5370 (yyval.InstVal) = new PHINode(Ty);
5371 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5372 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5373 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5374 GEN_ERROR("All elements of a PHI node must be of the same type!");
5375 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5376 (yyvsp[0].PHIList)->pop_front();
5378 delete (yyvsp[0].PHIList); // Free the list...
5384 #line 2657 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5386 const PointerType *PFTy = 0;
5387 const FunctionType *Ty = 0;
5389 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5390 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5391 // Pull out the types of all of the arguments...
5392 std::vector<const Type*> ParamTypes;
5393 if ((yyvsp[-1].ValueList)) {
5394 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5396 ParamTypes.push_back((*I)->getType());
5399 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5400 if (isVarArg) ParamTypes.pop_back();
5402 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5403 GEN_ERROR("LLVM functions cannot return aggregate types!");
5405 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5406 PFTy = PointerType::get(Ty);
5409 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5412 // Create the call node...
5413 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5414 // Make sure no arguments is a good thing!
5415 if (Ty->getNumParams() != 0)
5416 GEN_ERROR("No arguments passed to a function that "
5417 "expects arguments!");
5419 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5420 } else { // Has arguments?
5421 // Loop through FunctionType's arguments and ensure they are specified
5424 FunctionType::param_iterator I = Ty->param_begin();
5425 FunctionType::param_iterator E = Ty->param_end();
5426 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5428 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5429 if ((*ArgI)->getType() != *I)
5430 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5431 (*I)->getDescription() + "'!");
5433 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5434 GEN_ERROR("Invalid number of parameters detected!");
5436 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5438 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5439 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5440 delete (yyvsp[-4].TypeVal);
5441 delete (yyvsp[-1].ValueList);
5447 #line 2716 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5449 (yyval.InstVal) = (yyvsp[0].InstVal);
5455 #line 2723 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5457 (yyval.ValueList) = (yyvsp[0].ValueList);
5463 #line 2726 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5465 (yyval.ValueList) = new std::vector<Value*>();
5471 #line 2731 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5473 (yyval.BoolVal) = true;
5479 #line 2735 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5481 (yyval.BoolVal) = false;
5487 #line 2742 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5489 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5490 delete (yyvsp[-1].TypeVal);
5496 #line 2747 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5498 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5500 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5501 delete (yyvsp[-4].TypeVal);
5506 #line 2753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5508 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5509 delete (yyvsp[-1].TypeVal);
5515 #line 2758 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5517 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5519 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5520 delete (yyvsp[-4].TypeVal);
5525 #line 2764 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5527 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5528 GEN_ERROR("Trying to free nonpointer type " +
5529 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5530 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5536 #line 2772 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5538 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5539 GEN_ERROR("Can't load from nonpointer type: " +
5540 (*(yyvsp[-1].TypeVal))->getDescription());
5541 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5542 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5543 (*(yyvsp[-1].TypeVal))->getDescription());
5544 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5546 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5547 delete (yyvsp[-1].TypeVal);
5552 #line 2784 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5554 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5556 GEN_ERROR("Can't store to a nonpointer type: " +
5557 (*(yyvsp[-1].TypeVal))->getDescription());
5558 const Type *ElTy = PT->getElementType();
5559 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5560 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5561 "' into space of type '" + ElTy->getDescription() + "'!");
5563 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5565 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5566 delete (yyvsp[-1].TypeVal);
5571 #line 2799 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5573 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5574 GEN_ERROR("getelementptr insn requires pointer operand!");
5576 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
5577 // indices to uint struct indices for compatibility.
5578 generic_gep_type_iterator<std::vector<Value*>::iterator>
5579 GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
5580 GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
5581 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
5582 if (isa<StructType>(*GTI)) // Only change struct indices
5583 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[0].ValueList))[i]))
5584 if (CUI->getType() == Type::UByteTy)
5585 (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
5587 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5588 GEN_ERROR("Invalid getelementptr indices for type '" +
5589 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5590 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5592 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5593 delete (yyvsp[-2].TypeVal);
5594 delete (yyvsp[0].ValueList);
5602 /* Line 1126 of yacc.c. */
5603 #line 5604 "llvmAsmParser.tab.c"
5609 YY_STACK_PRINT (yyss, yyssp);
5614 /* Now `shift' the result of the reduction. Determine what state
5615 that goes to, based on the state we popped back to and the rule
5616 number reduced by. */
5620 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5621 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5622 yystate = yytable[yystate];
5624 yystate = yydefgoto[yyn - YYNTOKENS];
5629 /*------------------------------------.
5630 | yyerrlab -- here on detecting error |
5631 `------------------------------------*/
5633 /* If not already recovering from an error, report this error. */
5638 yyn = yypact[yystate];
5640 if (YYPACT_NINF < yyn && yyn < YYLAST)
5642 int yytype = YYTRANSLATE (yychar);
5643 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5644 YYSIZE_T yysize = yysize0;
5646 int yysize_overflow = 0;
5648 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5649 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5653 /* This is so xgettext sees the translatable formats that are
5654 constructed on the fly. */
5655 YY_("syntax error, unexpected %s");
5656 YY_("syntax error, unexpected %s, expecting %s");
5657 YY_("syntax error, unexpected %s, expecting %s or %s");
5658 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5659 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5663 static char const yyunexpected[] = "syntax error, unexpected %s";
5664 static char const yyexpecting[] = ", expecting %s";
5665 static char const yyor[] = " or %s";
5666 char yyformat[sizeof yyunexpected
5667 + sizeof yyexpecting - 1
5668 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5669 * (sizeof yyor - 1))];
5670 char const *yyprefix = yyexpecting;
5672 /* Start YYX at -YYN if negative to avoid negative indexes in
5674 int yyxbegin = yyn < 0 ? -yyn : 0;
5676 /* Stay within bounds of both yycheck and yytname. */
5677 int yychecklim = YYLAST - yyn;
5678 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5681 yyarg[0] = yytname[yytype];
5682 yyfmt = yystpcpy (yyformat, yyunexpected);
5684 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5685 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5687 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5691 yyformat[sizeof yyunexpected - 1] = '\0';
5694 yyarg[yycount++] = yytname[yyx];
5695 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5696 yysize_overflow |= yysize1 < yysize;
5698 yyfmt = yystpcpy (yyfmt, yyprefix);
5702 yyf = YY_(yyformat);
5703 yysize1 = yysize + yystrlen (yyf);
5704 yysize_overflow |= yysize1 < yysize;
5707 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5708 yymsg = (char *) YYSTACK_ALLOC (yysize);
5711 /* Avoid sprintf, as that infringes on the user's name space.
5712 Don't have undefined behavior even if the translation
5713 produced a string with the wrong number of "%s"s. */
5716 while ((*yyp = *yyf))
5718 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5720 yyp += yytnamerr (yyp, yyarg[yyi++]);
5730 YYSTACK_FREE (yymsg);
5734 yyerror (YY_("syntax error"));
5735 goto yyexhaustedlab;
5739 #endif /* YYERROR_VERBOSE */
5740 yyerror (YY_("syntax error"));
5745 if (yyerrstatus == 3)
5747 /* If just tried and failed to reuse look-ahead token after an
5748 error, discard it. */
5750 if (yychar <= YYEOF)
5752 /* Return failure if at end of input. */
5753 if (yychar == YYEOF)
5758 yydestruct ("Error: discarding", yytoken, &yylval);
5763 /* Else will try to reuse look-ahead token after shifting the error
5768 /*---------------------------------------------------.
5769 | yyerrorlab -- error raised explicitly by YYERROR. |
5770 `---------------------------------------------------*/
5773 /* Pacify compilers like GCC when the user code never invokes
5774 YYERROR and the label yyerrorlab therefore never appears in user
5785 /*-------------------------------------------------------------.
5786 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5787 `-------------------------------------------------------------*/
5789 yyerrstatus = 3; /* Each real token shifted decrements this. */
5793 yyn = yypact[yystate];
5794 if (yyn != YYPACT_NINF)
5797 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5805 /* Pop the current state because it cannot handle the error token. */
5810 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5813 YY_STACK_PRINT (yyss, yyssp);
5822 /* Shift the error token. */
5823 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5829 /*-------------------------------------.
5830 | yyacceptlab -- YYACCEPT comes here. |
5831 `-------------------------------------*/
5836 /*-----------------------------------.
5837 | yyabortlab -- YYABORT comes here. |
5838 `-----------------------------------*/
5844 /*-------------------------------------------------.
5845 | yyexhaustedlab -- memory exhaustion comes here. |
5846 `-------------------------------------------------*/
5848 yyerror (YY_("memory exhausted"));
5854 if (yychar != YYEOF && yychar != YYEMPTY)
5855 yydestruct ("Cleanup: discarding lookahead",
5857 while (yyssp != yyss)
5859 yydestruct ("Cleanup: popping",
5860 yystos[*yyssp], yyvsp);
5865 YYSTACK_FREE (yyss);
5871 #line 2825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5874 void llvm::GenerateError(const std::string &message, int LineNo) {
5875 if (LineNo == -1) LineNo = llvmAsmlineno;
5876 // TODO: column number in exception
5878 TheParseError->setError(CurFilename, message, LineNo);
5882 int yyerror(const char *ErrorMsg) {
5884 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5885 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5886 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5887 if (yychar == YYEMPTY || yychar == 0)
5888 errMsg += "end-of-file.";
5890 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5891 GenerateError(errMsg);