1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
208 EXTRACTELEMENT = 389,
230 #define ESINT64VAL 258
231 #define EUINT64VAL 259
232 #define ESAPINTVAL 260
233 #define EUAPINTVAL 261
234 #define LOCALVAL_ID 262
235 #define GLOBALVAL_ID 263
243 #define PPC_FP128 271
247 #define GLOBALVAR 275
249 #define STRINGCONSTANT 277
250 #define ATSTRINGCONSTANT 278
251 #define PCTSTRINGCONSTANT 279
252 #define ZEROINITIALIZER 280
264 #define THREAD_LOCAL 292
266 #define DOTDOTDOT 294
272 #define APPENDING 300
273 #define DLLIMPORT 301
274 #define DLLEXPORT 302
275 #define EXTERN_WEAK 303
281 #define ADDRSPACE 309
287 #define SIDEEFFECT 315
290 #define FASTCC_TOK 318
291 #define COLDCC_TOK 319
292 #define X86_STDCALLCC_TOK 320
293 #define X86_FASTCALLCC_TOK 321
294 #define DATALAYOUT 322
300 #define UNREACHABLE 328
345 #define GETELEMENTPTR 373
361 #define EXTRACTELEMENT 389
362 #define INSERTELEMENT 390
363 #define SHUFFLEVECTOR 391
364 #define GETRESULT 392
379 #define PROTECTED 407
384 /* Copy the first part of user declarations. */
385 #line 14 "/llvm/lib/AsmParser/llvmAsmParser.y"
387 #include "ParserInternals.h"
388 #include "llvm/CallingConv.h"
389 #include "llvm/InlineAsm.h"
390 #include "llvm/Instructions.h"
391 #include "llvm/Module.h"
392 #include "llvm/ValueSymbolTable.h"
393 #include "llvm/AutoUpgrade.h"
394 #include "llvm/Support/GetElementPtrTypeIterator.h"
395 #include "llvm/Support/CommandLine.h"
396 #include "llvm/ADT/SmallVector.h"
397 #include "llvm/ADT/STLExtras.h"
398 #include "llvm/Support/MathExtras.h"
399 #include "llvm/Support/Streams.h"
405 // The following is a gross hack. In order to rid the libAsmParser library of
406 // exceptions, we have to have a way of getting the yyparse function to go into
407 // an error situation. So, whenever we want an error to occur, the GenerateError
408 // function (see bottom of file) sets TriggerError. Then, at the end of each
409 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
410 // (a goto) to put YACC in error state. Furthermore, several calls to
411 // GenerateError are made from inside productions and they must simulate the
412 // previous exception behavior by exiting the production immediately. We have
413 // replaced these with the GEN_ERROR macro which calls GeneratError and then
414 // immediately invokes YYERROR. This would be so much cleaner if it was a
415 // recursive descent parser.
416 static bool TriggerError = false;
417 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
418 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
420 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
421 int yylex(); // declaration" of xxx warnings.
423 using namespace llvm;
425 static Module *ParserResult;
427 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
428 // relating to upreferences in the input stream.
430 //#define DEBUG_UPREFS 1
432 #define UR_OUT(X) cerr << X
437 #define YYERROR_VERBOSE 1
439 static GlobalVariable *CurGV;
442 // This contains info used when building the body of a function. It is
443 // destroyed when the function is completed.
445 typedef std::vector<Value *> ValueList; // Numbered defs
448 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
450 static struct PerModuleInfo {
451 Module *CurrentModule;
452 ValueList Values; // Module level numbered definitions
453 ValueList LateResolveValues;
454 std::vector<PATypeHolder> Types;
455 std::map<ValID, PATypeHolder> LateResolveTypes;
457 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
458 /// how they were referenced and on which line of the input they came from so
459 /// that we can resolve them later and print error messages as appropriate.
460 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
462 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
463 // references to global values. Global values may be referenced before they
464 // are defined, and if so, the temporary object that they represent is held
465 // here. This is used for forward references of GlobalValues.
467 typedef std::map<std::pair<const PointerType *,
468 ValID>, GlobalValue*> GlobalRefsType;
469 GlobalRefsType GlobalRefs;
472 // If we could not resolve some functions at function compilation time
473 // (calls to functions before they are defined), resolve them now... Types
474 // are resolved when the constant pool has been completely parsed.
476 ResolveDefinitions(LateResolveValues);
480 // Check to make sure that all global value forward references have been
483 if (!GlobalRefs.empty()) {
484 std::string UndefinedReferences = "Unresolved global references exist:\n";
486 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
488 UndefinedReferences += " " + I->first.first->getDescription() + " " +
489 I->first.second.getName() + "\n";
491 GenerateError(UndefinedReferences);
495 // Look for intrinsic functions and CallInst that need to be upgraded
496 for (Module::iterator FI = CurrentModule->begin(),
497 FE = CurrentModule->end(); FI != FE; )
498 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
500 Values.clear(); // Clear out function local definitions
505 // GetForwardRefForGlobal - Check to see if there is a forward reference
506 // for this global. If so, remove it from the GlobalRefs map and return it.
507 // If not, just return null.
508 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
509 // Check to see if there is a forward reference to this global variable...
510 // if there is, eliminate it and patch the reference to use the new def'n.
511 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
512 GlobalValue *Ret = 0;
513 if (I != GlobalRefs.end()) {
520 bool TypeIsUnresolved(PATypeHolder* PATy) {
521 // If it isn't abstract, its resolved
522 const Type* Ty = PATy->get();
523 if (!Ty->isAbstract())
525 // Traverse the type looking for abstract types. If it isn't abstract then
526 // we don't need to traverse that leg of the type.
527 std::vector<const Type*> WorkList, SeenList;
528 WorkList.push_back(Ty);
529 while (!WorkList.empty()) {
530 const Type* Ty = WorkList.back();
531 SeenList.push_back(Ty);
533 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
534 // Check to see if this is an unresolved type
535 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
536 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
537 for ( ; I != E; ++I) {
538 if (I->second.get() == OpTy)
541 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
542 const Type* TheTy = SeqTy->getElementType();
543 if (TheTy->isAbstract() && TheTy != Ty) {
544 std::vector<const Type*>::iterator I = SeenList.begin(),
550 WorkList.push_back(TheTy);
552 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
553 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
554 const Type* TheTy = StrTy->getElementType(i);
555 if (TheTy->isAbstract() && TheTy != Ty) {
556 std::vector<const Type*>::iterator I = SeenList.begin(),
562 WorkList.push_back(TheTy);
571 static struct PerFunctionInfo {
572 Function *CurrentFunction; // Pointer to current function being created
574 ValueList Values; // Keep track of #'d definitions
576 ValueList LateResolveValues;
577 bool isDeclare; // Is this function a forward declararation?
578 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
579 GlobalValue::VisibilityTypes Visibility;
581 /// BBForwardRefs - When we see forward references to basic blocks, keep
582 /// track of them here.
583 std::map<ValID, BasicBlock*> BBForwardRefs;
585 inline PerFunctionInfo() {
588 Linkage = GlobalValue::ExternalLinkage;
589 Visibility = GlobalValue::DefaultVisibility;
592 inline void FunctionStart(Function *M) {
597 void FunctionDone() {
598 // Any forward referenced blocks left?
599 if (!BBForwardRefs.empty()) {
600 GenerateError("Undefined reference to label " +
601 BBForwardRefs.begin()->second->getName());
605 // Resolve all forward references now.
606 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
608 Values.clear(); // Clear out function local definitions
609 BBForwardRefs.clear();
612 Linkage = GlobalValue::ExternalLinkage;
613 Visibility = GlobalValue::DefaultVisibility;
615 } CurFun; // Info for the current function...
617 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
620 //===----------------------------------------------------------------------===//
621 // Code to handle definitions of all the types
622 //===----------------------------------------------------------------------===//
624 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
625 // Things that have names or are void typed don't get slot numbers
626 if (V->hasName() || (V->getType() == Type::VoidTy))
629 // In the case of function values, we have to allow for the forward reference
630 // of basic blocks, which are included in the numbering. Consequently, we keep
631 // track of the next insertion location with NextValNum. When a BB gets
632 // inserted, it could change the size of the CurFun.Values vector.
633 if (&ValueTab == &CurFun.Values) {
634 if (ValueTab.size() <= CurFun.NextValNum)
635 ValueTab.resize(CurFun.NextValNum+1);
636 ValueTab[CurFun.NextValNum++] = V;
639 // For all other lists, its okay to just tack it on the back of the vector.
640 ValueTab.push_back(V);
643 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
645 case ValID::LocalID: // Is it a numbered definition?
646 // Module constants occupy the lowest numbered slots...
647 if (D.Num < CurModule.Types.size())
648 return CurModule.Types[D.Num];
650 case ValID::LocalName: // Is it a named definition?
651 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
652 D.destroy(); // Free old strdup'd memory...
657 GenerateError("Internal parser error: Invalid symbol type reference");
661 // If we reached here, we referenced either a symbol that we don't know about
662 // or an id number that hasn't been read yet. We may be referencing something
663 // forward, so just create an entry to be resolved later and get to it...
665 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
668 if (inFunctionScope()) {
669 if (D.Type == ValID::LocalName) {
670 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
673 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
678 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
679 if (I != CurModule.LateResolveTypes.end())
682 Type *Typ = OpaqueType::get();
683 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
687 // getExistingVal - Look up the value specified by the provided type and
688 // the provided ValID. If the value exists and has already been defined, return
689 // it. Otherwise return null.
691 static Value *getExistingVal(const Type *Ty, const ValID &D) {
692 if (isa<FunctionType>(Ty)) {
693 GenerateError("Functions are not values and "
694 "must be referenced as pointers");
699 case ValID::LocalID: { // Is it a numbered definition?
700 // Check that the number is within bounds.
701 if (D.Num >= CurFun.Values.size())
703 Value *Result = CurFun.Values[D.Num];
704 if (Ty != Result->getType()) {
705 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
706 Result->getType()->getDescription() + "' does not match "
707 "expected type, '" + Ty->getDescription() + "'");
712 case ValID::GlobalID: { // Is it a numbered definition?
713 if (D.Num >= CurModule.Values.size())
715 Value *Result = CurModule.Values[D.Num];
716 if (Ty != Result->getType()) {
717 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
718 Result->getType()->getDescription() + "' does not match "
719 "expected type, '" + Ty->getDescription() + "'");
725 case ValID::LocalName: { // Is it a named definition?
726 if (!inFunctionScope())
728 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
729 Value *N = SymTab.lookup(D.getName());
732 if (N->getType() != Ty)
735 D.destroy(); // Free old strdup'd memory...
738 case ValID::GlobalName: { // Is it a named definition?
739 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
740 Value *N = SymTab.lookup(D.getName());
743 if (N->getType() != Ty)
746 D.destroy(); // Free old strdup'd memory...
750 // Check to make sure that "Ty" is an integral type, and that our
751 // value will fit into the specified type...
752 case ValID::ConstSIntVal: // Is it a constant pool reference??
753 if (!isa<IntegerType>(Ty) ||
754 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
755 GenerateError("Signed integral constant '" +
756 itostr(D.ConstPool64) + "' is invalid for type '" +
757 Ty->getDescription() + "'");
760 return ConstantInt::get(Ty, D.ConstPool64, true);
762 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
763 if (isa<IntegerType>(Ty) &&
764 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
765 return ConstantInt::get(Ty, D.UConstPool64);
767 if (!isa<IntegerType>(Ty) ||
768 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
769 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
770 "' is invalid or out of range for type '" +
771 Ty->getDescription() + "'");
774 // This is really a signed reference. Transmogrify.
775 return ConstantInt::get(Ty, D.ConstPool64, true);
777 case ValID::ConstFPVal: // Is it a floating point const pool reference?
778 if (!Ty->isFloatingPoint() ||
779 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
780 GenerateError("FP constant invalid for type");
783 // Lexer has no type info, so builds all float and double FP constants
784 // as double. Fix this here. Long double does not need this.
785 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
787 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
788 return ConstantFP::get(*D.ConstPoolFP);
790 case ValID::ConstNullVal: // Is it a null value?
791 if (!isa<PointerType>(Ty)) {
792 GenerateError("Cannot create a a non pointer null");
795 return ConstantPointerNull::get(cast<PointerType>(Ty));
797 case ValID::ConstUndefVal: // Is it an undef value?
798 return UndefValue::get(Ty);
800 case ValID::ConstZeroVal: // Is it a zero value?
801 return Constant::getNullValue(Ty);
803 case ValID::ConstantVal: // Fully resolved constant?
804 if (D.ConstantValue->getType() != Ty) {
805 GenerateError("Constant expression type different from required type");
808 return D.ConstantValue;
810 case ValID::InlineAsmVal: { // Inline asm expression
811 const PointerType *PTy = dyn_cast<PointerType>(Ty);
812 const FunctionType *FTy =
813 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
814 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
815 GenerateError("Invalid type for asm constraint string");
818 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
819 D.IAD->HasSideEffects);
820 D.destroy(); // Free InlineAsmDescriptor.
824 assert(0 && "Unhandled case!");
828 assert(0 && "Unhandled case!");
832 // getVal - This function is identical to getExistingVal, except that if a
833 // value is not already defined, it "improvises" by creating a placeholder var
834 // that looks and acts just like the requested variable. When the value is
835 // defined later, all uses of the placeholder variable are replaced with the
838 static Value *getVal(const Type *Ty, const ValID &ID) {
839 if (Ty == Type::LabelTy) {
840 GenerateError("Cannot use a basic block here");
844 // See if the value has already been defined.
845 Value *V = getExistingVal(Ty, ID);
847 if (TriggerError) return 0;
849 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
850 GenerateError("Invalid use of a composite type");
854 // If we reached here, we referenced either a symbol that we don't know about
855 // or an id number that hasn't been read yet. We may be referencing something
856 // forward, so just create an entry to be resolved later and get to it...
859 case ValID::GlobalName:
860 case ValID::GlobalID: {
861 const PointerType *PTy = dyn_cast<PointerType>(Ty);
863 GenerateError("Invalid type for reference to global" );
866 const Type* ElTy = PTy->getElementType();
867 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
868 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
870 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
871 (Module*)0, false, PTy->getAddressSpace());
875 V = new Argument(Ty);
878 // Remember where this forward reference came from. FIXME, shouldn't we try
879 // to recycle these things??
880 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
883 if (inFunctionScope())
884 InsertValue(V, CurFun.LateResolveValues);
886 InsertValue(V, CurModule.LateResolveValues);
890 /// defineBBVal - This is a definition of a new basic block with the specified
891 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
892 static BasicBlock *defineBBVal(const ValID &ID) {
893 assert(inFunctionScope() && "Can't get basic block at global scope!");
897 // First, see if this was forward referenced
899 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
900 if (BBI != CurFun.BBForwardRefs.end()) {
902 // The forward declaration could have been inserted anywhere in the
903 // function: insert it into the correct place now.
904 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
905 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
907 // We're about to erase the entry, save the key so we can clean it up.
908 ValID Tmp = BBI->first;
910 // Erase the forward ref from the map as its no longer "forward"
911 CurFun.BBForwardRefs.erase(ID);
913 // The key has been removed from the map but so we don't want to leave
914 // strdup'd memory around so destroy it too.
917 // If its a numbered definition, bump the number and set the BB value.
918 if (ID.Type == ValID::LocalID) {
919 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
923 // We haven't seen this BB before and its first mention is a definition.
924 // Just create it and return it.
925 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
926 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
927 if (ID.Type == ValID::LocalID) {
928 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
937 /// getBBVal - get an existing BB value or create a forward reference for it.
939 static BasicBlock *getBBVal(const ValID &ID) {
940 assert(inFunctionScope() && "Can't get basic block at global scope!");
944 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
945 if (BBI != CurFun.BBForwardRefs.end()) {
947 } if (ID.Type == ValID::LocalName) {
948 std::string Name = ID.getName();
949 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
951 if (N->getType()->getTypeID() == Type::LabelTyID)
952 BB = cast<BasicBlock>(N);
954 GenerateError("Reference to label '" + Name + "' is actually of type '"+
955 N->getType()->getDescription() + "'");
957 } else if (ID.Type == ValID::LocalID) {
958 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
959 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
960 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
962 GenerateError("Reference to label '%" + utostr(ID.Num) +
963 "' is actually of type '"+
964 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
967 GenerateError("Illegal label reference " + ID.getName());
971 // If its already been defined, return it now.
973 ID.destroy(); // Free strdup'd memory.
977 // Otherwise, this block has not been seen before, create it.
979 if (ID.Type == ValID::LocalName)
981 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
983 // Insert it in the forward refs map.
984 CurFun.BBForwardRefs[ID] = BB;
990 //===----------------------------------------------------------------------===//
991 // Code to handle forward references in instructions
992 //===----------------------------------------------------------------------===//
994 // This code handles the late binding needed with statements that reference
995 // values not defined yet... for example, a forward branch, or the PHI node for
998 // This keeps a table (CurFun.LateResolveValues) of all such forward references
999 // and back patchs after we are done.
1002 // ResolveDefinitions - If we could not resolve some defs at parsing
1003 // time (forward branches, phi functions for loops, etc...) resolve the
1007 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1008 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1009 while (!LateResolvers.empty()) {
1010 Value *V = LateResolvers.back();
1011 LateResolvers.pop_back();
1013 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1014 CurModule.PlaceHolderInfo.find(V);
1015 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1017 ValID &DID = PHI->second.first;
1019 Value *TheRealValue = getExistingVal(V->getType(), DID);
1023 V->replaceAllUsesWith(TheRealValue);
1025 CurModule.PlaceHolderInfo.erase(PHI);
1026 } else if (FutureLateResolvers) {
1027 // Functions have their unresolved items forwarded to the module late
1029 InsertValue(V, *FutureLateResolvers);
1031 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1032 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1033 "' of type '" + V->getType()->getDescription() + "'",
1034 PHI->second.second);
1037 GenerateError("Reference to an invalid definition: #" +
1038 itostr(DID.Num) + " of type '" +
1039 V->getType()->getDescription() + "'",
1040 PHI->second.second);
1045 LateResolvers.clear();
1048 // ResolveTypeTo - A brand new type was just declared. This means that (if
1049 // name is not null) things referencing Name can be resolved. Otherwise, things
1050 // refering to the number can be resolved. Do this now.
1052 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1055 D = ValID::createLocalName(*Name);
1057 D = ValID::createLocalID(CurModule.Types.size());
1059 std::map<ValID, PATypeHolder>::iterator I =
1060 CurModule.LateResolveTypes.find(D);
1061 if (I != CurModule.LateResolveTypes.end()) {
1062 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1063 CurModule.LateResolveTypes.erase(I);
1067 // setValueName - Set the specified value to the name given. The name may be
1068 // null potentially, in which case this is a noop. The string passed in is
1069 // assumed to be a malloc'd string buffer, and is free'd by this function.
1071 static void setValueName(Value *V, std::string *NameStr) {
1072 if (!NameStr) return;
1073 std::string Name(*NameStr); // Copy string
1074 delete NameStr; // Free old string
1076 if (V->getType() == Type::VoidTy) {
1077 GenerateError("Can't assign name '" + Name+"' to value with void type");
1081 assert(inFunctionScope() && "Must be in function scope!");
1082 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1083 if (ST.lookup(Name)) {
1084 GenerateError("Redefinition of value '" + Name + "' of type '" +
1085 V->getType()->getDescription() + "'");
1093 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1094 /// this is a declaration, otherwise it is a definition.
1095 static GlobalVariable *
1096 ParseGlobalVariable(std::string *NameStr,
1097 GlobalValue::LinkageTypes Linkage,
1098 GlobalValue::VisibilityTypes Visibility,
1099 bool isConstantGlobal, const Type *Ty,
1100 Constant *Initializer, bool IsThreadLocal,
1101 unsigned AddressSpace = 0) {
1102 if (isa<FunctionType>(Ty)) {
1103 GenerateError("Cannot declare global vars of function type");
1107 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1111 Name = *NameStr; // Copy string
1112 delete NameStr; // Free old string
1115 // See if this global value was forward referenced. If so, recycle the
1118 if (!Name.empty()) {
1119 ID = ValID::createGlobalName(Name);
1121 ID = ValID::createGlobalID(CurModule.Values.size());
1124 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1125 // Move the global to the end of the list, from whereever it was
1126 // previously inserted.
1127 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1128 CurModule.CurrentModule->getGlobalList().remove(GV);
1129 CurModule.CurrentModule->getGlobalList().push_back(GV);
1130 GV->setInitializer(Initializer);
1131 GV->setLinkage(Linkage);
1132 GV->setVisibility(Visibility);
1133 GV->setConstant(isConstantGlobal);
1134 GV->setThreadLocal(IsThreadLocal);
1135 InsertValue(GV, CurModule.Values);
1139 // If this global has a name
1140 if (!Name.empty()) {
1141 // if the global we're parsing has an initializer (is a definition) and
1142 // has external linkage.
1143 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1144 // If there is already a global with external linkage with this name
1145 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1146 // If we allow this GVar to get created, it will be renamed in the
1147 // symbol table because it conflicts with an existing GVar. We can't
1148 // allow redefinition of GVars whose linking indicates that their name
1149 // must stay the same. Issue the error.
1150 GenerateError("Redefinition of global variable named '" + Name +
1151 "' of type '" + Ty->getDescription() + "'");
1156 // Otherwise there is no existing GV to use, create one now.
1157 GlobalVariable *GV =
1158 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1159 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1160 GV->setVisibility(Visibility);
1161 InsertValue(GV, CurModule.Values);
1165 // setTypeName - Set the specified type to the name given. The name may be
1166 // null potentially, in which case this is a noop. The string passed in is
1167 // assumed to be a malloc'd string buffer, and is freed by this function.
1169 // This function returns true if the type has already been defined, but is
1170 // allowed to be redefined in the specified context. If the name is a new name
1171 // for the type plane, it is inserted and false is returned.
1172 static bool setTypeName(const Type *T, std::string *NameStr) {
1173 assert(!inFunctionScope() && "Can't give types function-local names!");
1174 if (NameStr == 0) return false;
1176 std::string Name(*NameStr); // Copy string
1177 delete NameStr; // Free old string
1179 // We don't allow assigning names to void type
1180 if (T == Type::VoidTy) {
1181 GenerateError("Can't assign name '" + Name + "' to the void type");
1185 // Set the type name, checking for conflicts as we do so.
1186 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1188 if (AlreadyExists) { // Inserting a name that is already defined???
1189 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1190 assert(Existing && "Conflict but no matching type?!");
1192 // There is only one case where this is allowed: when we are refining an
1193 // opaque type. In this case, Existing will be an opaque type.
1194 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1195 // We ARE replacing an opaque type!
1196 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1200 // Otherwise, this is an attempt to redefine a type. That's okay if
1201 // the redefinition is identical to the original. This will be so if
1202 // Existing and T point to the same Type object. In this one case we
1203 // allow the equivalent redefinition.
1204 if (Existing == T) return true; // Yes, it's equal.
1206 // Any other kind of (non-equivalent) redefinition is an error.
1207 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1208 T->getDescription() + "'");
1214 //===----------------------------------------------------------------------===//
1215 // Code for handling upreferences in type names...
1218 // TypeContains - Returns true if Ty directly contains E in it.
1220 static bool TypeContains(const Type *Ty, const Type *E) {
1221 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1222 E) != Ty->subtype_end();
1226 struct UpRefRecord {
1227 // NestingLevel - The number of nesting levels that need to be popped before
1228 // this type is resolved.
1229 unsigned NestingLevel;
1231 // LastContainedTy - This is the type at the current binding level for the
1232 // type. Every time we reduce the nesting level, this gets updated.
1233 const Type *LastContainedTy;
1235 // UpRefTy - This is the actual opaque type that the upreference is
1236 // represented with.
1237 OpaqueType *UpRefTy;
1239 UpRefRecord(unsigned NL, OpaqueType *URTy)
1240 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1244 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1245 static std::vector<UpRefRecord> UpRefs;
1247 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1248 /// called. It loops through the UpRefs vector, which is a list of the
1249 /// currently active types. For each type, if the up reference is contained in
1250 /// the newly completed type, we decrement the level count. When the level
1251 /// count reaches zero, the upreferenced type is the type that is passed in:
1252 /// thus we can complete the cycle.
1254 static PATypeHolder HandleUpRefs(const Type *ty) {
1255 // If Ty isn't abstract, or if there are no up-references in it, then there is
1256 // nothing to resolve here.
1257 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1259 PATypeHolder Ty(ty);
1260 UR_OUT("Type '" << Ty->getDescription() <<
1261 "' newly formed. Resolving upreferences.\n" <<
1262 UpRefs.size() << " upreferences active!\n");
1264 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1265 // to zero), we resolve them all together before we resolve them to Ty. At
1266 // the end of the loop, if there is anything to resolve to Ty, it will be in
1268 OpaqueType *TypeToResolve = 0;
1270 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1271 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1272 << UpRefs[i].second->getDescription() << ") = "
1273 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1274 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1275 // Decrement level of upreference
1276 unsigned Level = --UpRefs[i].NestingLevel;
1277 UpRefs[i].LastContainedTy = Ty;
1278 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1279 if (Level == 0) { // Upreference should be resolved!
1280 if (!TypeToResolve) {
1281 TypeToResolve = UpRefs[i].UpRefTy;
1283 UR_OUT(" * Resolving upreference for "
1284 << UpRefs[i].second->getDescription() << "\n";
1285 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1286 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1287 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1288 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1290 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1291 --i; // Do not skip the next element...
1296 if (TypeToResolve) {
1297 UR_OUT(" * Resolving upreference for "
1298 << UpRefs[i].second->getDescription() << "\n";
1299 std::string OldName = TypeToResolve->getDescription());
1300 TypeToResolve->refineAbstractTypeTo(Ty);
1306 //===----------------------------------------------------------------------===//
1307 // RunVMAsmParser - Define an interface to this parser
1308 //===----------------------------------------------------------------------===//
1310 static Module* RunParser(Module * M);
1312 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1314 Module *M = RunParser(new Module(LLLgetFilename()));
1321 /* Enabling traces. */
1326 /* Enabling verbose error messages. */
1327 #ifdef YYERROR_VERBOSE
1328 # undef YYERROR_VERBOSE
1329 # define YYERROR_VERBOSE 1
1331 # define YYERROR_VERBOSE 0
1334 /* Enabling the token table. */
1335 #ifndef YYTOKEN_TABLE
1336 # define YYTOKEN_TABLE 0
1339 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1340 typedef union YYSTYPE
1341 #line 949 "/llvm/lib/AsmParser/llvmAsmParser.y"
1343 llvm::Module *ModuleVal;
1344 llvm::Function *FunctionVal;
1345 llvm::BasicBlock *BasicBlockVal;
1346 llvm::TerminatorInst *TermInstVal;
1347 llvm::Instruction *InstVal;
1348 llvm::Constant *ConstVal;
1350 const llvm::Type *PrimType;
1351 std::list<llvm::PATypeHolder> *TypeList;
1352 llvm::PATypeHolder *TypeVal;
1353 llvm::Value *ValueVal;
1354 std::vector<llvm::Value*> *ValueList;
1355 llvm::ArgListType *ArgList;
1356 llvm::TypeWithAttrs TypeWithAttrs;
1357 llvm::TypeWithAttrsList *TypeWithAttrsList;
1358 llvm::ParamList *ParamList;
1360 // Represent the RHS of PHI node
1361 std::list<std::pair<llvm::Value*,
1362 llvm::BasicBlock*> > *PHIList;
1363 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1364 std::vector<llvm::Constant*> *ConstVector;
1366 llvm::GlobalValue::LinkageTypes Linkage;
1367 llvm::GlobalValue::VisibilityTypes Visibility;
1368 llvm::ParameterAttributes ParamAttrs;
1369 llvm::APInt *APIntVal;
1374 llvm::APFloat *FPVal;
1377 std::string *StrVal; // This memory must be deleted
1378 llvm::ValID ValIDVal;
1380 llvm::Instruction::BinaryOps BinaryOpVal;
1381 llvm::Instruction::TermOps TermOpVal;
1382 llvm::Instruction::MemoryOps MemOpVal;
1383 llvm::Instruction::CastOps CastOpVal;
1384 llvm::Instruction::OtherOps OtherOpVal;
1385 llvm::ICmpInst::Predicate IPredicate;
1386 llvm::FCmpInst::Predicate FPredicate;
1388 /* Line 193 of yacc.c. */
1389 #line 1390 "llvmAsmParser.tab.c"
1391 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1392 # define YYSTYPE_IS_DECLARED 1
1393 # define YYSTYPE_IS_TRIVIAL 1
1398 /* Copy the second part of user declarations. */
1401 /* Line 216 of yacc.c. */
1402 #line 1403 "llvmAsmParser.tab.c"
1409 typedef YYTYPE_UINT8 yytype_uint8;
1411 typedef unsigned char yytype_uint8;
1415 typedef YYTYPE_INT8 yytype_int8;
1416 #elif (defined __STDC__ || defined __C99__FUNC__ \
1417 || defined __cplusplus || defined _MSC_VER)
1418 typedef signed char yytype_int8;
1420 typedef short int yytype_int8;
1423 #ifdef YYTYPE_UINT16
1424 typedef YYTYPE_UINT16 yytype_uint16;
1426 typedef unsigned short int yytype_uint16;
1430 typedef YYTYPE_INT16 yytype_int16;
1432 typedef short int yytype_int16;
1436 # ifdef __SIZE_TYPE__
1437 # define YYSIZE_T __SIZE_TYPE__
1438 # elif defined size_t
1439 # define YYSIZE_T size_t
1440 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1441 || defined __cplusplus || defined _MSC_VER)
1442 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1443 # define YYSIZE_T size_t
1445 # define YYSIZE_T unsigned int
1449 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1452 # if defined YYENABLE_NLS && YYENABLE_NLS
1454 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1455 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1459 # define YY_(msgid) msgid
1463 /* Suppress unused-variable warnings by "using" E. */
1464 #if ! defined lint || defined __GNUC__
1465 # define YYUSE(e) ((void) (e))
1467 # define YYUSE(e) /* empty */
1470 /* Identity function, used to suppress warnings about constant conditions. */
1472 # define YYID(n) (n)
1474 #if (defined __STDC__ || defined __C99__FUNC__ \
1475 || defined __cplusplus || defined _MSC_VER)
1488 #if ! defined yyoverflow || YYERROR_VERBOSE
1490 /* The parser invokes alloca or malloc; define the necessary symbols. */
1492 # ifdef YYSTACK_USE_ALLOCA
1493 # if YYSTACK_USE_ALLOCA
1495 # define YYSTACK_ALLOC __builtin_alloca
1496 # elif defined __BUILTIN_VA_ARG_INCR
1497 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1499 # define YYSTACK_ALLOC __alloca
1500 # elif defined _MSC_VER
1501 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1502 # define alloca _alloca
1504 # define YYSTACK_ALLOC alloca
1505 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1506 || defined __cplusplus || defined _MSC_VER)
1507 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1509 # define _STDLIB_H 1
1516 # ifdef YYSTACK_ALLOC
1517 /* Pacify GCC's `empty if-body' warning. */
1518 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1519 # ifndef YYSTACK_ALLOC_MAXIMUM
1520 /* The OS might guarantee only one guard page at the bottom of the stack,
1521 and a page size can be as small as 4096 bytes. So we cannot safely
1522 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1523 to allow for a few compiler-allocated temporary stack slots. */
1524 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1527 # define YYSTACK_ALLOC YYMALLOC
1528 # define YYSTACK_FREE YYFREE
1529 # ifndef YYSTACK_ALLOC_MAXIMUM
1530 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1532 # if (defined __cplusplus && ! defined _STDLIB_H \
1533 && ! ((defined YYMALLOC || defined malloc) \
1534 && (defined YYFREE || defined free)))
1535 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1537 # define _STDLIB_H 1
1541 # define YYMALLOC malloc
1542 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1543 || defined __cplusplus || defined _MSC_VER)
1544 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1548 # define YYFREE free
1549 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1550 || defined __cplusplus || defined _MSC_VER)
1551 void free (void *); /* INFRINGES ON USER NAME SPACE */
1555 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1558 #if (! defined yyoverflow \
1559 && (! defined __cplusplus \
1560 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1562 /* A type that is properly aligned for any stack member. */
1569 /* The size of the maximum gap between one aligned stack and the next. */
1570 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1572 /* The size of an array large to enough to hold all stacks, each with
1574 # define YYSTACK_BYTES(N) \
1575 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1576 + YYSTACK_GAP_MAXIMUM)
1578 /* Copy COUNT objects from FROM to TO. The source and destination do
1581 # if defined __GNUC__ && 1 < __GNUC__
1582 # define YYCOPY(To, From, Count) \
1583 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1585 # define YYCOPY(To, From, Count) \
1589 for (yyi = 0; yyi < (Count); yyi++) \
1590 (To)[yyi] = (From)[yyi]; \
1596 /* Relocate STACK from its old location to the new one. The
1597 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1598 elements in the stack, and YYPTR gives the new location of the
1599 stack. Advance YYPTR to a properly aligned location for the next
1601 # define YYSTACK_RELOCATE(Stack) \
1604 YYSIZE_T yynewbytes; \
1605 YYCOPY (&yyptr->Stack, Stack, yysize); \
1606 Stack = &yyptr->Stack; \
1607 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1608 yyptr += yynewbytes / sizeof (*yyptr); \
1614 /* YYFINAL -- State number of the termination state. */
1616 /* YYLAST -- Last index in YYTABLE. */
1619 /* YYNTOKENS -- Number of terminals. */
1620 #define YYNTOKENS 167
1621 /* YYNNTS -- Number of nonterminals. */
1623 /* YYNRULES -- Number of rules. */
1624 #define YYNRULES 326
1625 /* YYNRULES -- Number of states. */
1626 #define YYNSTATES 655
1628 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1629 #define YYUNDEFTOK 2
1630 #define YYMAXUTOK 407
1632 #define YYTRANSLATE(YYX) \
1633 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1635 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1636 static const yytype_uint8 yytranslate[] =
1638 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 153, 154, 157, 2, 156, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1644 162, 155, 163, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 159, 158, 161, 2, 2, 2, 2, 2, 166,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 160, 2, 2, 164, 2, 165, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1664 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1665 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1666 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1667 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1668 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1669 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1670 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1671 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1672 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1673 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1674 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1675 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1676 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1677 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1678 145, 146, 147, 148, 149, 150, 151, 152
1682 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1684 static const yytype_uint16 yyprhs[] =
1686 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1687 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1688 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1689 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1690 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1691 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1692 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1693 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1694 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1695 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1696 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1697 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1698 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1699 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1700 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1701 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1702 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1703 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1704 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1705 456, 462, 471, 478, 485, 493, 501, 509, 517, 524,
1706 533, 542, 546, 548, 550, 552, 554, 555, 558, 565,
1707 567, 568, 570, 573, 574, 578, 579, 583, 587, 591,
1708 595, 596, 605, 606, 616, 617, 627, 633, 636, 640,
1709 642, 646, 650, 654, 658, 660, 661, 667, 671, 673,
1710 677, 679, 680, 691, 693, 695, 700, 702, 704, 707,
1711 711, 712, 714, 716, 718, 720, 722, 724, 726, 728,
1712 730, 734, 736, 742, 744, 746, 748, 750, 752, 754,
1713 757, 759, 763, 766, 769, 773, 776, 777, 779, 782,
1714 785, 789, 799, 809, 818, 833, 835, 837, 844, 850,
1715 853, 860, 868, 873, 878, 885, 892, 893, 894, 898,
1716 901, 903, 909, 915, 922, 929, 936, 943, 948, 955,
1717 960, 965, 972, 979, 982, 991, 993, 995, 996, 1000,
1718 1007, 1011, 1018, 1021, 1027, 1035, 1041
1721 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1722 static const yytype_int16 yyrhs[] =
1724 213, 0, -1, 74, -1, 75, -1, 76, -1, 77,
1725 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1726 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1727 -1, 85, -1, 119, -1, 120, -1, 121, -1, 122,
1728 -1, 123, -1, 124, -1, 125, -1, 126, -1, 127,
1729 -1, 128, -1, 129, -1, 130, -1, 93, -1, 94,
1730 -1, 95, -1, 96, -1, 97, -1, 98, -1, 99,
1731 -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
1732 -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
1733 -1, 110, -1, 111, -1, 112, -1, 99, -1, 100,
1734 -1, 101, -1, 102, -1, 26, -1, 27, -1, 11,
1735 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1736 -1, 19, -1, 22, -1, 24, -1, 175, -1, -1,
1737 54, 153, 4, 154, -1, -1, 175, 155, -1, -1,
1738 20, -1, 23, -1, 181, -1, -1, 179, 155, -1,
1739 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1740 46, -1, 48, -1, 50, -1, -1, 150, -1, 151,
1741 -1, 152, -1, -1, 46, -1, 48, -1, -1, 42,
1742 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1743 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1744 -1, 66, -1, 61, 4, -1, 139, -1, 120, -1,
1745 138, -1, 121, -1, 141, -1, 142, -1, 144, -1,
1746 145, -1, 146, -1, 53, 4, -1, -1, 190, 189,
1747 -1, 140, -1, 143, -1, 139, -1, 138, -1, 147,
1748 -1, 148, -1, -1, 192, 191, -1, -1, 149, 22,
1749 -1, -1, 53, 4, -1, -1, 156, 53, 4, -1,
1750 34, 22, -1, -1, 196, -1, -1, 156, 199, 198,
1751 -1, 196, -1, 53, 4, -1, 11, -1, 12, -1,
1752 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1753 49, -1, 200, -1, 201, 177, 157, -1, 235, -1,
1754 158, 4, -1, 201, 153, 205, 154, 192, -1, 10,
1755 153, 205, 154, 192, -1, 159, 4, 160, 201, 161,
1756 -1, 162, 4, 160, 201, 163, -1, 164, 206, 165,
1757 -1, 164, 165, -1, 162, 164, 206, 165, 163, -1,
1758 162, 164, 165, 163, -1, 201, 190, -1, 201, -1,
1759 10, -1, 202, -1, 204, 156, 202, -1, 204, -1,
1760 204, 156, 39, -1, 39, -1, -1, 201, -1, 206,
1761 156, 201, -1, 201, 159, 209, 161, -1, 201, 159,
1762 161, -1, 201, 166, 22, -1, 201, 162, 209, 163,
1763 -1, 201, 164, 209, 165, -1, 201, 164, 165, -1,
1764 201, 162, 164, 209, 165, 163, -1, 201, 162, 164,
1765 165, 163, -1, 201, 40, -1, 201, 41, -1, 201,
1766 235, -1, 201, 208, -1, 201, 25, -1, 173, 3,
1767 -1, 173, 5, -1, 173, 4, -1, 173, 6, -1,
1768 11, 26, -1, 11, 27, -1, 174, 9, -1, 170,
1769 153, 207, 38, 201, 154, -1, 118, 153, 207, 247,
1770 154, -1, 132, 153, 207, 156, 207, 156, 207, 154,
1771 -1, 168, 153, 207, 156, 207, 154, -1, 169, 153,
1772 207, 156, 207, 154, -1, 89, 171, 153, 207, 156,
1773 207, 154, -1, 90, 172, 153, 207, 156, 207, 154,
1774 -1, 91, 171, 153, 207, 156, 207, 154, -1, 92,
1775 172, 153, 207, 156, 207, 154, -1, 134, 153, 207,
1776 156, 207, 154, -1, 135, 153, 207, 156, 207, 156,
1777 207, 154, -1, 136, 153, 207, 156, 207, 156, 207,
1778 154, -1, 209, 156, 207, -1, 207, -1, 32, -1,
1779 33, -1, 37, -1, -1, 203, 235, -1, 124, 153,
1780 212, 38, 201, 154, -1, 214, -1, -1, 215, -1,
1781 214, 215, -1, -1, 31, 216, 231, -1, -1, 30,
1782 217, 232, -1, 59, 58, 221, -1, 178, 18, 201,
1783 -1, 178, 18, 10, -1, -1, 180, 184, 211, 210,
1784 207, 177, 218, 198, -1, -1, 180, 182, 184, 211,
1785 210, 207, 177, 219, 198, -1, -1, 180, 183, 184,
1786 211, 210, 201, 177, 220, 198, -1, 180, 184, 35,
1787 187, 212, -1, 51, 222, -1, 55, 155, 223, -1,
1788 22, -1, 52, 155, 22, -1, 67, 155, 22, -1,
1789 159, 224, 161, -1, 224, 156, 22, -1, 22, -1,
1790 -1, 225, 156, 201, 190, 176, -1, 201, 190, 176,
1791 -1, 225, -1, 225, 156, 39, -1, 39, -1, -1,
1792 188, 203, 179, 153, 226, 154, 192, 197, 194, 193,
1793 -1, 28, -1, 164, -1, 186, 184, 227, 228, -1,
1794 29, -1, 165, -1, 239, 230, -1, 185, 184, 227,
1795 -1, -1, 60, -1, 3, -1, 4, -1, 9, -1,
1796 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
1797 162, 209, 163, -1, 208, -1, 58, 233, 22, 156,
1798 22, -1, 7, -1, 8, -1, 175, -1, 179, -1,
1799 235, -1, 234, -1, 201, 236, -1, 237, -1, 238,
1800 156, 237, -1, 239, 240, -1, 229, 240, -1, 241,
1801 178, 242, -1, 241, 244, -1, -1, 21, -1, 68,
1802 238, -1, 68, 10, -1, 69, 17, 236, -1, 69,
1803 11, 236, 156, 17, 236, 156, 17, 236, -1, 70,
1804 173, 236, 156, 17, 236, 159, 243, 161, -1, 70,
1805 173, 236, 156, 17, 236, 159, 161, -1, 71, 188,
1806 203, 236, 153, 246, 154, 192, 38, 17, 236, 72,
1807 17, 236, -1, 72, -1, 73, -1, 243, 173, 234,
1808 156, 17, 236, -1, 173, 234, 156, 17, 236, -1,
1809 178, 249, -1, 201, 159, 236, 156, 236, 161, -1,
1810 245, 156, 159, 236, 156, 236, 161, -1, 201, 190,
1811 236, 190, -1, 17, 190, 236, 190, -1, 246, 156,
1812 201, 190, 236, 190, -1, 246, 156, 17, 190, 236,
1813 190, -1, -1, -1, 247, 156, 237, -1, 57, 56,
1814 -1, 56, -1, 168, 201, 236, 156, 236, -1, 169,
1815 201, 236, 156, 236, -1, 89, 171, 201, 236, 156,
1816 236, -1, 90, 172, 201, 236, 156, 236, -1, 91,
1817 171, 201, 236, 156, 236, -1, 92, 172, 201, 236,
1818 156, 236, -1, 170, 237, 38, 201, -1, 132, 237,
1819 156, 237, 156, 237, -1, 133, 237, 156, 201, -1,
1820 134, 237, 156, 237, -1, 135, 237, 156, 237, 156,
1821 237, -1, 136, 237, 156, 237, 156, 237, -1, 131,
1822 245, -1, 248, 188, 203, 236, 153, 246, 154, 192,
1823 -1, 251, -1, 36, -1, -1, 113, 201, 195, -1,
1824 113, 201, 156, 11, 236, 195, -1, 114, 201, 195,
1825 -1, 114, 201, 156, 11, 236, 195, -1, 115, 237,
1826 -1, 250, 116, 201, 236, 195, -1, 250, 117, 237,
1827 156, 201, 236, 195, -1, 137, 201, 236, 156, 4,
1828 -1, 118, 201, 236, 247, -1
1831 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1832 static const yytype_uint16 yyrline[] =
1834 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1835 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1836 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117,
1837 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1838 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1839 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1139, 1139,
1840 1139, 1141, 1141, 1141, 1142, 1142, 1144, 1145, 1149, 1153,
1841 1158, 1158, 1160, 1161, 1166, 1172, 1173, 1174, 1175, 1176,
1842 1180, 1181, 1182, 1186, 1187, 1188, 1189, 1193, 1194, 1195,
1843 1199, 1200, 1201, 1202, 1203, 1207, 1208, 1209, 1212, 1213,
1844 1214, 1215, 1216, 1217, 1218, 1225, 1226, 1227, 1228, 1229,
1845 1230, 1231, 1232, 1233, 1234, 1238, 1239, 1244, 1245, 1246,
1846 1247, 1248, 1249, 1252, 1253, 1258, 1259, 1266, 1267, 1273,
1847 1274, 1283, 1291, 1292, 1297, 1298, 1299, 1304, 1317, 1317,
1848 1317, 1317, 1317, 1317, 1317, 1320, 1324, 1328, 1335, 1340,
1849 1348, 1377, 1402, 1407, 1417, 1427, 1431, 1441, 1448, 1457,
1850 1464, 1469, 1474, 1481, 1482, 1489, 1496, 1504, 1510, 1522,
1851 1550, 1566, 1593, 1621, 1647, 1667, 1693, 1713, 1725, 1732,
1852 1798, 1808, 1818, 1824, 1834, 1840, 1850, 1855, 1860, 1873,
1853 1885, 1907, 1915, 1921, 1932, 1937, 1942, 1947, 1952, 1958,
1854 1964, 1973, 1977, 1985, 1985, 1988, 1988, 1991, 2003, 2024,
1855 2029, 2037, 2038, 2042, 2042, 2046, 2046, 2049, 2052, 2076,
1856 2088, 2087, 2099, 2098, 2108, 2107, 2118, 2158, 2161, 2167,
1857 2177, 2181, 2186, 2188, 2193, 2198, 2207, 2217, 2228, 2232,
1858 2241, 2250, 2255, 2384, 2384, 2386, 2395, 2395, 2397, 2402,
1859 2414, 2418, 2423, 2427, 2431, 2435, 2439, 2443, 2447, 2451,
1860 2455, 2480, 2484, 2494, 2498, 2502, 2507, 2514, 2514, 2520,
1861 2529, 2534, 2539, 2543, 2552, 2561, 2570, 2574, 2582, 2589,
1862 2593, 2598, 2608, 2627, 2636, 2721, 2725, 2732, 2743, 2756,
1863 2766, 2777, 2787, 2798, 2806, 2816, 2823, 2826, 2827, 2834,
1864 2838, 2843, 2859, 2876, 2890, 2904, 2918, 2932, 2944, 2952,
1865 2959, 2965, 2971, 2977, 2992, 3082, 3087, 3091, 3098, 3105,
1866 3113, 3120, 3128, 3136, 3150, 3167, 3175
1870 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1871 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1872 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1873 static const char *const yytname[] =
1875 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1876 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1877 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1878 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1879 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1880 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1881 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1882 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1883 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1884 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1885 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1886 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1887 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1888 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1889 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1890 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1891 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1892 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1893 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1894 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1895 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1896 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1897 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1898 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1899 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1900 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1901 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1902 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1903 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1904 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1905 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1906 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1907 "SectionString", "OptSection", "GlobalVarAttributes",
1908 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1909 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1910 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1911 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1912 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1913 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1914 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1915 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1916 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1917 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1918 "InstVal", "OptVolatile", "MemoryInst", 0
1923 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1925 static const yytype_uint16 yytoknum[] =
1927 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1928 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1929 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1930 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1931 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1932 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1933 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1934 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1935 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1936 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1937 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1938 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1939 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1940 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1941 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1942 405, 406, 407, 40, 41, 61, 44, 42, 92, 91,
1943 120, 93, 60, 62, 123, 125, 99
1947 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1948 static const yytype_uint8 yyr1[] =
1950 0, 167, 168, 168, 168, 168, 168, 168, 168, 168,
1951 168, 169, 169, 169, 169, 169, 169, 170, 170, 170,
1952 170, 170, 170, 170, 170, 170, 170, 170, 170, 171,
1953 171, 171, 171, 171, 171, 171, 171, 171, 171, 172,
1954 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
1955 172, 172, 172, 172, 172, 173, 174, 174, 174, 174,
1956 174, 175, 175, 175, 176, 176, 177, 177, 178, 178,
1957 179, 179, 180, 180, 181, 182, 182, 182, 182, 182,
1958 183, 183, 183, 184, 184, 184, 184, 185, 185, 185,
1959 186, 186, 186, 186, 186, 187, 187, 187, 188, 188,
1960 188, 188, 188, 188, 188, 189, 189, 189, 189, 189,
1961 189, 189, 189, 189, 189, 190, 190, 191, 191, 191,
1962 191, 191, 191, 192, 192, 193, 193, 194, 194, 195,
1963 195, 196, 197, 197, 198, 198, 199, 199, 200, 200,
1964 200, 200, 200, 200, 200, 201, 201, 201, 201, 201,
1965 201, 201, 201, 201, 201, 201, 201, 201, 202, 203,
1966 203, 204, 204, 205, 205, 205, 205, 206, 206, 207,
1967 207, 207, 207, 207, 207, 207, 207, 207, 207, 207,
1968 207, 207, 207, 207, 207, 207, 207, 207, 207, 208,
1969 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
1970 208, 209, 209, 210, 210, 211, 211, 212, 212, 213,
1971 213, 214, 214, 216, 215, 217, 215, 215, 215, 215,
1972 218, 215, 219, 215, 220, 215, 215, 215, 215, 221,
1973 222, 222, 223, 224, 224, 224, 225, 225, 226, 226,
1974 226, 226, 227, 228, 228, 229, 230, 230, 231, 232,
1975 233, 233, 234, 234, 234, 234, 234, 234, 234, 234,
1976 234, 234, 234, 235, 235, 235, 235, 236, 236, 237,
1977 238, 238, 239, 239, 240, 241, 241, 241, 242, 242,
1978 242, 242, 242, 242, 242, 242, 242, 243, 243, 244,
1979 245, 245, 246, 246, 246, 246, 246, 247, 247, 248,
1980 248, 249, 249, 249, 249, 249, 249, 249, 249, 249,
1981 249, 249, 249, 249, 249, 249, 250, 250, 251, 251,
1982 251, 251, 251, 251, 251, 251, 251
1985 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1986 static const yytype_uint8 yyr2[] =
1988 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1993 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1994 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1995 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1996 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1997 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1998 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1999 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
2000 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
2001 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
2002 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2003 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2004 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2005 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2006 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2007 5, 8, 6, 6, 7, 7, 7, 7, 6, 8,
2008 8, 3, 1, 1, 1, 1, 0, 2, 6, 1,
2009 0, 1, 2, 0, 3, 0, 3, 3, 3, 3,
2010 0, 8, 0, 9, 0, 9, 5, 2, 3, 1,
2011 3, 3, 3, 3, 1, 0, 5, 3, 1, 3,
2012 1, 0, 10, 1, 1, 4, 1, 1, 2, 3,
2013 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2014 3, 1, 5, 1, 1, 1, 1, 1, 1, 2,
2015 1, 3, 2, 2, 3, 2, 0, 1, 2, 2,
2016 3, 9, 9, 8, 14, 1, 1, 6, 5, 2,
2017 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2018 1, 5, 5, 6, 6, 6, 6, 4, 6, 4,
2019 4, 6, 6, 2, 8, 1, 1, 0, 3, 6,
2023 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2024 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2025 means the default is an error. */
2026 static const yytype_uint16 yydefact[] =
2028 73, 61, 70, 62, 71, 63, 215, 213, 0, 0,
2029 0, 0, 0, 0, 83, 72, 0, 73, 211, 87,
2030 90, 0, 0, 227, 0, 0, 68, 0, 74, 75,
2031 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2032 83, 83, 206, 1, 212, 88, 89, 83, 216, 91,
2033 92, 93, 94, 83, 276, 214, 276, 0, 0, 235,
2034 228, 229, 217, 263, 264, 219, 138, 139, 140, 143,
2035 142, 141, 144, 145, 0, 0, 0, 0, 265, 266,
2036 146, 218, 148, 206, 206, 95, 205, 0, 98, 98,
2037 277, 273, 69, 246, 247, 248, 272, 230, 231, 234,
2038 0, 166, 149, 0, 0, 0, 0, 155, 167, 0,
2039 0, 166, 0, 0, 0, 97, 96, 0, 203, 204,
2040 0, 0, 99, 100, 101, 102, 103, 0, 249, 0,
2041 317, 275, 0, 232, 165, 115, 161, 163, 0, 0,
2042 0, 0, 0, 0, 154, 0, 0, 147, 0, 0,
2043 160, 0, 159, 0, 226, 138, 139, 140, 143, 142,
2044 141, 0, 0, 67, 67, 104, 0, 243, 244, 245,
2045 316, 300, 0, 0, 0, 0, 98, 285, 286, 2,
2046 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2047 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2048 0, 0, 17, 18, 19, 20, 21, 22, 23, 24,
2049 25, 26, 27, 28, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 274, 98, 289, 0, 315, 233,
2051 158, 0, 123, 67, 67, 157, 0, 168, 0, 123,
2052 67, 67, 0, 207, 186, 187, 182, 184, 183, 185,
2053 188, 181, 177, 178, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2055 180, 179, 220, 0, 299, 279, 67, 270, 278, 0,
2056 0, 55, 0, 0, 29, 30, 31, 32, 33, 34,
2057 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
2058 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
2059 48, 0, 0, 0, 129, 129, 322, 67, 67, 313,
2060 0, 0, 0, 0, 0, 67, 67, 67, 0, 0,
2061 0, 0, 0, 106, 108, 107, 105, 109, 110, 111,
2062 112, 113, 116, 164, 162, 151, 152, 153, 156, 66,
2063 150, 222, 224, 0, 0, 0, 0, 0, 0, 0,
2064 0, 0, 0, 170, 202, 0, 0, 0, 174, 0,
2065 171, 0, 0, 0, 134, 241, 252, 253, 254, 259,
2066 255, 256, 257, 258, 250, 0, 261, 268, 267, 269,
2067 0, 0, 280, 0, 0, 67, 67, 67, 67, 0,
2068 318, 0, 320, 297, 0, 0, 0, 0, 0, 0,
2069 0, 0, 0, 0, 0, 0, 67, 0, 114, 120,
2070 119, 117, 118, 121, 122, 124, 134, 134, 0, 0,
2071 0, 0, 0, 297, 0, 0, 0, 0, 0, 169,
2072 155, 167, 0, 172, 173, 0, 0, 0, 0, 221,
2073 240, 115, 238, 0, 251, 0, 0, 271, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 326, 0,
2075 0, 0, 309, 310, 0, 0, 0, 0, 0, 307,
2076 0, 129, 0, 223, 225, 67, 0, 0, 0, 0,
2077 0, 0, 0, 0, 0, 201, 176, 0, 0, 0,
2078 0, 0, 0, 136, 134, 65, 0, 123, 0, 260,
2079 0, 0, 296, 0, 0, 0, 0, 129, 130, 129,
2080 0, 0, 0, 0, 0, 0, 325, 301, 302, 296,
2081 0, 323, 67, 208, 0, 0, 0, 0, 190, 0,
2082 0, 0, 0, 175, 0, 0, 67, 131, 137, 135,
2083 64, 237, 239, 115, 132, 0, 0, 0, 115, 115,
2084 0, 303, 304, 305, 306, 319, 321, 298, 0, 0,
2085 308, 311, 312, 0, 129, 0, 0, 0, 0, 0,
2086 198, 0, 0, 192, 193, 189, 65, 133, 127, 262,
2087 0, 0, 0, 0, 123, 0, 290, 0, 123, 324,
2088 194, 195, 196, 197, 0, 0, 0, 236, 0, 125,
2089 0, 283, 0, 0, 106, 108, 115, 115, 0, 115,
2090 115, 291, 314, 191, 199, 200, 128, 0, 242, 281,
2091 0, 282, 0, 293, 292, 0, 0, 0, 126, 0,
2092 0, 0, 115, 115, 0, 0, 0, 295, 294, 288,
2096 /* YYDEFGOTO[NTERM-NUM]. */
2097 static const yytype_int16 yydefgoto[] =
2099 -1, 267, 268, 269, 294, 311, 161, 162, 78, 551,
2100 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2101 117, 127, 342, 230, 425, 345, 628, 609, 400, 503,
2102 588, 449, 504, 80, 163, 136, 153, 137, 138, 109,
2103 364, 386, 365, 120, 87, 154, 16, 17, 18, 20,
2104 19, 374, 426, 427, 62, 23, 60, 100, 452, 453,
2105 128, 169, 54, 95, 55, 48, 455, 387, 82, 389,
2106 277, 278, 56, 91, 92, 224, 613, 131, 319, 560,
2107 468, 225, 226, 227, 228
2110 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2112 #define YYPACT_NINF -572
2113 static const yytype_int16 yypact[] =
2115 445, -572, -572, -572, -572, -572, -572, -572, -2, -122,
2116 19, -58, 90, -40, 26, -572, 112, 855, -572, 52,
2117 217, -28, 4, -572, 12, 146, -572, 1594, -572, -572,
2118 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
2119 70, 70, 125, -572, -572, -572, -572, 70, -572, -572,
2120 -572, -572, -572, 70, 166, -572, -8, 176, 185, 201,
2121 -572, -572, -572, -572, -572, 80, -572, -572, -572, -572,
2122 -572, -572, -572, -572, 232, 241, 2, 227, -572, -572,
2123 -572, -1, -572, 211, 211, 137, -572, 118, 258, 258,
2124 -572, -572, 87, -572, -572, -572, -572, -572, -572, -572,
2125 -57, 1357, -572, 105, 139, 1020, 80, -572, -1, -107,
2126 109, 1357, 145, 118, 118, -572, -572, 1400, -572, -572,
2127 1634, 302, -572, -572, -572, -572, -572, 1677, -572, -16,
2128 1856, -572, 290, -572, -572, -1, -572, 159, 177, 1695,
2129 1695, 179, -102, 1695, -572, 331, 189, -572, 1634, 1695,
2130 80, 186, -1, 247, -572, 226, 335, 338, 339, 342,
2131 344, 269, 345, 1123, 303, -572, 24, -572, -572, -572,
2132 -572, -572, 300, 1752, 76, 347, 258, -572, -572, -572,
2133 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
2134 -572, -572, -572, -572, 314, 845, 314, 845, 1695, 1695,
2135 1695, 1695, -572, -572, -572, -572, -572, -572, -572, -572,
2136 -572, -572, -572, -572, 1695, 1695, 1695, 1695, 1695, 1695,
2137 1695, 1695, 1695, 1695, -572, 258, -572, 97, -572, -572,
2138 172, 1418, -572, -43, -31, -572, 196, -1, 206, -572,
2139 303, -12, 1400, -572, -572, -572, -572, -572, -572, -572,
2140 -572, -572, -572, -572, 314, 845, 314, 845, 208, 216,
2141 219, 220, 223, 1473, 1795, 1063, 348, 224, 225, 234,
2142 -572, -572, -572, 237, -572, 80, 843, -572, 238, 524,
2143 524, -572, 524, 1677, -572, -572, -572, -572, -572, -572,
2144 -572, -572, -572, -572, 1695, -572, -572, -572, -572, -572,
2145 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
2146 -572, 1695, 1695, 1695, 27, 29, -572, 843, -23, 248,
2147 249, 263, 264, 265, 266, 843, 843, 843, 341, 1677,
2148 1695, 1695, 389, -572, -572, -572, -572, -572, -572, -572,
2149 -572, -572, -572, -572, -572, 198, -572, -572, -572, -572,
2150 198, -572, 145, 359, 250, 270, 271, 272, 1634, 1634,
2151 1634, 1634, 1634, -572, -572, -30, 1314, -104, -572, -101,
2152 -572, 1634, 1634, 1634, 275, 1518, -572, -572, -572, -572,
2153 -572, -572, -572, -572, 366, 1634, -572, -572, -572, -572,
2154 1695, 276, -572, 277, 524, 843, 843, 843, 843, 25,
2155 -572, 35, -572, -572, 524, 278, 1695, 1695, 1695, 1695,
2156 1695, 280, 282, 283, 1695, 524, 843, 287, -572, -572,
2157 -572, -572, -572, -572, -572, -572, 275, 275, 1695, 1634,
2158 1634, 1634, 1634, -572, 291, 292, 293, 294, 1634, -572,
2159 288, 975, -99, -572, -572, 296, 297, 408, 9, -572,
2160 -572, -1, 299, 304, -572, 435, -96, -572, 442, 443,
2161 308, 306, 310, 325, 326, 524, 479, 524, 328, 329,
2162 524, 334, -1, -572, 336, 337, 487, 524, 524, -1,
2163 349, 350, 1695, -572, -572, -20, 351, 352, 353, 354,
2164 102, 1634, 1634, 1634, 1634, -572, -572, 356, 1634, 1634,
2165 1695, 489, 497, -572, 275, 571, 1576, -572, 357, -572,
2166 524, 524, 1853, 524, 524, 524, 524, 350, -572, 350,
2167 1695, 524, 358, 1695, 1695, 1695, -572, -572, -572, 1853,
2168 459, -572, 843, -572, 1634, 1634, 1634, 1634, -572, 360,
2169 369, 364, 368, -572, 371, 376, -15, -572, -572, -572,
2170 -572, -572, -572, -1, 6, 512, 380, 378, 71, -1,
2171 171, -572, -572, -572, -572, -572, -572, -572, 379, 524,
2172 -572, -572, -572, 174, 350, 385, 387, 388, 391, 1634,
2173 -572, 1634, 1634, -572, -572, -572, 571, -572, 499, -572,
2174 536, -6, 699, 699, -572, 1871, -572, 393, -572, -572,
2175 -572, -572, -572, -572, 401, 407, 409, -572, 558, 418,
2176 524, -572, 1265, -3, 415, 417, -572, -572, -19, 71,
2177 -1, -572, 198, -572, -572, -572, -572, 549, -572, -572,
2178 416, -572, 1265, 172, 172, 556, 699, 699, -572, 557,
2179 419, 524, -572, -572, 524, 559, 507, 172, 172, -572,
2180 524, 563, -572, 524, -572
2183 /* YYPGOTO[NTERM-NUM]. */
2184 static const yytype_int16 yypgoto[] =
2186 -572, 451, 453, 454, -174, -152, -173, -572, 0, 1,
2187 -146, 493, 3, -572, -572, -572, -572, 49, -572, -572,
2188 -572, -139, -572, -416, -572, -223, -572, -572, -311, 34,
2189 -572, -397, -572, -572, -26, 361, -120, -572, 478, 486,
2190 -64, -153, -250, 164, 207, 355, -572, -572, 577, -572,
2191 -572, -572, -572, -572, -572, -572, -572, -572, -572, -572,
2192 528, -572, -572, -572, -572, -572, -572, -571, -115, 162,
2193 -191, -572, -572, 540, -572, -572, -572, -572, -572, 89,
2194 187, -572, -572, -572, -572
2197 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2198 positive, shift that token. If negative, reduce the rule which
2199 number is the opposite. If zero, do what YYDEFACT says.
2200 If YYTABLE_NINF, syntax error. */
2201 #define YYTABLE_NINF -211
2202 static const yytype_int16 yytable[] =
2204 11, 81, 282, 13, 402, 281, 104, 166, 281, 316,
2205 270, 110, 167, 90, 367, 369, 350, 11, 272, 635,
2206 13, 93, 312, 110, 320, 321, 322, 323, 324, 483,
2207 484, 110, 328, 24, 110, 505, 465, 283, 243, 110,
2208 501, 630, 110, 501, 2, 313, 467, 4, 271, 143,
2209 21, 108, 438, 110, 143, 438, 164, 438, 144, 443,
2210 438, 640, 502, 236, 444, 22, 497, 509, 29, 30,
2211 31, 32, 33, 34, 35, 135, 36, 25, 466, 108,
2212 354, 110, 356, 110, 240, 135, 329, 279, 466, 83,
2213 84, 152, 11, 280, 351, 352, 88, 26, 45, 132,
2214 46, 152, 89, 355, 133, 357, 1, 549, 27, 3,
2215 111, 5, 43, 233, 234, 28, 442, 237, 346, 419,
2216 420, 421, 111, 241, 422, -144, 438, 57, 423, 424,
2217 111, 439, 347, 111, 533, 456, 404, 586, 111, 585,
2218 417, 111, 592, 593, 419, 420, 421, 276, 168, 422,
2219 118, 119, 111, 423, 424, 611, -67, 94, 631, 58,
2220 85, 388, 86, 394, 388, 388, 105, 388, 61, 273,
2221 531, 59, 314, 315, 276, 317, 37, 38, 39, 115,
2222 111, 116, 111, 399, -67, 401, -67, 90, 318, 276,
2223 276, 276, 276, 276, 325, 326, 327, 276, 97, 457,
2224 633, 634, 388, 636, 637, 135, 565, 98, 566, 415,
2225 388, 388, 388, 330, 331, 471, 152, 473, 474, 475,
2226 37, 38, 39, 99, -144, 332, 647, 648, -144, -55,
2227 -55, -55, -55, 101, 63, 64, 102, 106, 66, 67,
2228 68, 69, 70, 71, 72, 103, 1, 2, 86, 3,
2229 4, 5, 244, 245, 63, 64, 538, 152, 520, 49,
2230 50, 51, 145, 599, 52, 139, 1, 2, 395, 3,
2231 4, 5, 246, 247, 248, 249, 73, 148, 149, 388,
2232 388, 388, 388, 388, 554, 396, 397, 398, 270, 388,
2233 113, 114, 333, 334, 433, 434, 435, 436, 437, 140,
2234 388, 388, 147, 152, 416, 276, 165, 445, 446, 447,
2235 335, 336, 229, 337, 338, 231, 339, 340, 341, 121,
2236 122, 123, 124, 125, 126, 594, 271, 595, 598, 567,
2237 595, 232, 570, 571, 572, 238, 419, 420, 421, 242,
2238 441, 422, 235, 239, -56, 423, 424, -57, -60, 451,
2239 388, -59, 388, -58, 250, 388, 274, 110, 281, 348,
2240 349, 358, 388, 388, 276, 486, 487, 488, 489, 359,
2241 370, 618, 360, 361, 495, 622, 362, 371, 372, 414,
2242 276, 472, 276, 276, 276, 74, 75, 373, 479, 76,
2243 375, 77, 107, 418, 390, 388, 388, 428, 388, 388,
2244 388, 388, 485, 429, 405, 406, 388, 284, 285, 286,
2245 287, 288, 289, 290, 291, 292, 293, 388, 612, 407,
2246 408, 409, 410, 430, 431, 432, 454, 539, 540, 541,
2247 542, 448, 458, 459, 544, 545, 476, 470, 477, 478,
2248 632, 391, 392, 482, 393, -210, 500, 491, 492, 493,
2249 494, 496, 498, 499, 388, 506, 532, 508, 507, 510,
2250 511, 512, 513, -69, 1, 2, 514, 3, 4, 5,
2251 575, 576, 577, 578, 546, 6, 7, 388, 388, 403,
2252 553, 515, 516, 518, 520, 521, 559, 411, 412, 413,
2253 523, 526, 524, 525, 276, 388, 8, 276, 276, 276,
2254 9, 548, 529, 559, 10, 550, 530, 534, 535, 536,
2255 537, 547, 466, 555, 569, 604, 579, 605, 606, 543,
2256 581, 388, 388, 580, 582, 583, 388, 376, 377, 388,
2257 584, 63, 64, 378, 589, 388, 590, 591, 388, 600,
2258 596, 601, 602, 1, 2, 603, 3, 4, 5, 379,
2259 380, 381, 608, 610, 621, 623, 460, 461, 462, 463,
2260 464, 624, 626, 625, 382, 383, 469, 627, -18, 620,
2261 -19, 638, 639, 641, 644, 645, 650, 480, 481, 651,
2262 653, 221, 384, 222, 223, 130, 550, 607, 587, 146,
2263 1, 142, 344, 3, 44, 5, 96, 353, 179, 180,
2264 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2265 191, 192, 193, 254, 255, 256, 257, 129, 573, 0,
2266 490, 0, 0, 0, 332, 0, 0, 517, 0, 519,
2267 0, 0, 522, 0, 0, 0, 0, 0, 0, 527,
2268 528, 0, 258, 202, 203, 204, 205, 206, 207, 208,
2269 209, 210, 211, 212, 213, 0, 259, 0, 260, 261,
2270 262, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2271 0, 0, 556, 557, 0, 561, 562, 563, 564, 0,
2272 0, 0, 0, 568, 0, 0, 385, 0, 0, 0,
2273 0, 333, 334, 0, 574, 0, 0, 0, 0, 0,
2274 0, 0, 376, 377, 0, 0, 63, 64, 378, 335,
2275 336, 0, 337, 338, 0, 339, 340, 341, 1, 2,
2276 0, 3, 4, 5, 379, 380, 381, 0, 0, 0,
2277 0, 597, 0, 0, 0, 0, 0, 0, 0, 382,
2278 383, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2279 0, 0, 332, 0, 616, 617, 0, 384, 0, 0,
2280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2281 0, 0, 629, 179, 180, 181, 182, 183, 184, 185,
2282 186, 187, 188, 189, 190, 191, 192, 193, 254, 255,
2283 256, 257, 0, 0, 0, 0, 0, 0, 642, 643,
2284 0, 0, 0, 646, 0, 0, 649, 0, 0, 0,
2285 0, 0, 652, 0, 0, 654, 0, 258, 202, 614,
2286 615, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2287 0, 259, 0, 260, 261, 262, 0, 335, 336, 0,
2288 337, 338, 0, 339, 340, 341, 376, 377, 0, 0,
2289 63, 64, 378, 0, 0, -209, 0, 0, 0, 0,
2290 0, 385, 1, 2, 0, 3, 4, 5, 379, 380,
2291 381, 295, 296, -69, 1, 2, 0, 3, 4, 5,
2292 0, 0, 0, 382, 383, 6, 7, 0, 0, 0,
2293 0, 0, 0, 0, 0, 0, 0, 110, 0, 0,
2294 0, 384, 0, 0, 0, 0, 8, 0, 0, 0,
2295 9, 0, 0, 0, 10, 0, 0, 179, 180, 181,
2296 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2297 192, 193, 254, 255, 256, 257, 0, 0, 0, 0,
2298 0, 0, 0, 0, 297, 298, 299, 300, 301, 302,
2299 303, 304, 305, 306, 307, 308, 309, 310, 0, 0,
2300 0, 258, 202, 203, 204, 205, 206, 207, 208, 209,
2301 210, 211, 212, 213, 0, 259, 0, 260, 261, 262,
2302 0, 0, 63, 64, 0, 0, 0, 0, 0, 0,
2303 0, 0, 0, 0, 1, 2, 111, 3, 4, 5,
2304 251, 0, 0, 0, 0, 385, 0, 0, 0, 0,
2305 0, 0, 0, 0, 0, 252, 253, 0, 0, 0,
2306 0, 0, 0, 0, 0, 0, 0, 63, 64, 110,
2307 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2308 2, 0, 3, 4, 5, 0, 0, 0, 0, 179,
2309 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2310 190, 191, 192, 193, 254, 255, 256, 257, 0, 73,
2311 63, 64, 0, 106, 155, 156, 157, 158, 159, 160,
2312 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2313 0, 0, 0, 258, 202, 203, 204, 205, 206, 207,
2314 208, 209, 210, 211, 212, 213, 0, 259, 0, 260,
2315 261, 262, 73, 0, 0, 0, 0, 0, 0, 0,
2316 0, 0, 0, 0, 0, 0, 0, 0, 111, 0,
2317 63, 64, -67, 0, 263, 0, 0, 264, 0, 265,
2318 0, 266, 1, 2, 0, 3, 4, 5, 251, 0,
2319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2320 0, 0, 0, 252, 253, 0, 0, 0, 0, 0,
2321 0, 0, 0, 0, 0, 0, 0, 110, 74, 75,
2322 0, 0, 76, 0, 77, 141, 0, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 0, 179, 180, 181,
2324 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2325 192, 193, 254, 255, 256, 257, 0, 0, 0, 0,
2326 0, 74, 75, 0, 0, 76, 0, 77, 368, 0,
2327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2328 0, 258, 202, 203, 204, 205, 206, 207, 208, 209,
2329 210, 211, 212, 213, 0, 259, 0, 260, 261, 262,
2330 0, 0, 0, 0, 0, 0, 0, 0, 376, 377,
2331 0, 0, 0, 0, 378, 0, 111, 0, 0, 0,
2332 0, 0, 263, 0, 0, 264, 0, 265, 0, 266,
2333 379, 380, 381, 0, 0, 0, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 382, 383, 0, 0, 0,
2335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2336 0, 63, 64, 384, 106, 155, 156, 157, 158, 159,
2337 160, 72, 0, 1, 2, 0, 3, 4, 5, 179,
2338 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2339 190, 191, 192, 193, 254, 255, 256, 257, 0, 0,
2340 0, 0, 0, 73, 63, 64, 0, 106, 66, 67,
2341 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2342 4, 5, 0, 258, 202, 203, 204, 205, 206, 207,
2343 208, 209, 210, 211, 212, 213, 134, 259, 0, 260,
2344 261, 262, 0, 0, 0, 0, 73, 63, 64, 0,
2345 150, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2346 2, 0, 3, 4, 5, 63, 64, 385, 106, 66,
2347 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2348 3, 4, 5, 0, 0, 0, 0, 0, 0, 73,
2349 0, 0, 0, 0, 0, 0, 0, 343, 0, 0,
2350 0, 0, 0, 0, 0, 0, 0, 73, 0, 0,
2351 0, 0, 74, 75, 0, 0, 76, 0, 77, 440,
2352 63, 64, 0, 106, 155, 156, 157, 158, 159, 160,
2353 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2354 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2356 0, 77, 73, 0, 151, 63, 64, 0, 106, 66,
2357 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2358 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2359 0, 0, 0, 0, 0, 0, 0, 450, 74, 75,
2360 0, 0, 76, 0, 77, 0, 0, 73, 0, 0,
2361 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2362 76, 0, 77, 63, 64, 0, 106, 66, 67, 68,
2363 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2364 5, 63, 64, 0, 65, 66, 67, 68, 69, 70,
2365 71, 72, 0, 1, 2, 552, 3, 4, 5, 0,
2366 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2367 0, 74, 75, 0, 363, 76, 0, 77, 0, 0,
2368 0, 63, 64, 73, 106, 155, 156, 157, 158, 159,
2369 160, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2371 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2372 76, 0, 77, 73, 63, 64, 0, 150, 66, 67,
2373 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2374 4, 5, 63, 64, 0, 106, 66, 67, 68, 69,
2375 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2376 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
2377 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2378 77, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2379 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
2380 64, 0, 275, 66, 67, 68, 69, 70, 71, 72,
2381 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2383 0, 0, 74, 75, 0, 0, 76, 0, 77, 0,
2384 0, 73, 63, 64, 0, 106, 155, 156, 157, 158,
2385 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2387 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2388 0, 77, 0, 0, 73, 0, 0, 0, 0, 0,
2389 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2390 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
2391 558, 0, 1, 2, 0, 3, 4, 5, 63, 64,
2392 0, 106, 66, 67, 68, 69, 70, 71, 619, 0,
2393 1, 2, 170, 3, 4, 5, 0, 0, 0, 0,
2394 0, 0, 73, 0, 0, 0, 0, 0, 0, 0,
2395 74, 75, 171, 172, 76, 0, 77, 0, 0, 0,
2396 73, 0, 0, 0, 173, 174, 175, 176, 177, 178,
2397 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2398 189, 190, 191, 192, 193, 194, 195, 196, 197, 0,
2399 0, 0, 0, 74, 75, 0, 0, 76, 0, 366,
2400 0, 0, 0, 0, 0, 0, 0, 0, 0, 198,
2401 199, 200, 0, 0, 201, 202, 203, 204, 205, 206,
2402 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2403 217, 218, 219, 220, 0, 0, 0, 0, 0, 0,
2404 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2405 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2406 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2410 static const yytype_int16 yycheck[] =
2412 0, 27, 175, 0, 315, 11, 4, 127, 11, 200,
2413 163, 54, 28, 21, 264, 265, 239, 17, 164, 38,
2414 17, 29, 196, 54, 215, 216, 217, 218, 219, 426,
2415 427, 54, 223, 155, 54, 451, 11, 176, 153, 54,
2416 34, 612, 54, 34, 20, 197, 11, 23, 163, 156,
2417 52, 77, 156, 54, 156, 156, 120, 156, 165, 163,
2418 156, 632, 53, 165, 165, 67, 165, 163, 42, 43,
2419 44, 45, 46, 47, 48, 101, 50, 58, 53, 105,
2420 254, 54, 256, 54, 148, 111, 225, 11, 53, 40,
2421 41, 117, 92, 17, 240, 241, 47, 155, 46, 156,
2422 48, 127, 53, 255, 161, 257, 19, 504, 18, 22,
2423 153, 24, 0, 139, 140, 155, 366, 143, 161, 138,
2424 139, 140, 153, 149, 143, 54, 156, 155, 147, 148,
2425 153, 161, 163, 153, 154, 385, 159, 553, 153, 154,
2426 331, 153, 558, 559, 138, 139, 140, 173, 164, 143,
2427 32, 33, 153, 147, 148, 161, 157, 165, 161, 155,
2428 35, 276, 37, 283, 279, 280, 164, 282, 22, 166,
2429 481, 159, 198, 199, 200, 201, 150, 151, 152, 42,
2430 153, 44, 153, 156, 157, 156, 157, 21, 214, 215,
2431 216, 217, 218, 219, 220, 221, 222, 223, 22, 390,
2432 616, 617, 317, 619, 620, 231, 517, 22, 519, 329,
2433 325, 326, 327, 116, 117, 406, 242, 408, 409, 410,
2434 150, 151, 152, 22, 153, 53, 642, 643, 157, 3,
2435 4, 5, 6, 153, 7, 8, 4, 10, 11, 12,
2436 13, 14, 15, 16, 17, 4, 19, 20, 37, 22,
2437 23, 24, 26, 27, 7, 8, 154, 283, 156, 42,
2438 43, 44, 153, 574, 47, 160, 19, 20, 294, 22,
2439 23, 24, 3, 4, 5, 6, 49, 113, 114, 394,
2440 395, 396, 397, 398, 507, 311, 312, 313, 441, 404,
2441 83, 84, 120, 121, 358, 359, 360, 361, 362, 160,
2442 415, 416, 157, 329, 330, 331, 4, 371, 372, 373,
2443 138, 139, 22, 141, 142, 156, 144, 145, 146, 61,
2444 62, 63, 64, 65, 66, 154, 441, 156, 154, 520,
2445 156, 154, 523, 524, 525, 4, 138, 139, 140, 153,
2446 366, 143, 163, 154, 9, 147, 148, 9, 9, 375,
2447 465, 9, 467, 9, 9, 470, 56, 54, 11, 163,
2448 154, 153, 477, 478, 390, 429, 430, 431, 432, 153,
2449 22, 594, 153, 153, 438, 598, 153, 153, 153, 38,
2450 406, 407, 408, 409, 410, 158, 159, 153, 414, 162,
2451 153, 164, 165, 4, 156, 510, 511, 38, 513, 514,
2452 515, 516, 428, 153, 156, 156, 521, 93, 94, 95,
2453 96, 97, 98, 99, 100, 101, 102, 532, 591, 156,
2454 156, 156, 156, 153, 153, 153, 60, 491, 492, 493,
2455 494, 156, 156, 156, 498, 499, 156, 159, 156, 156,
2456 613, 279, 280, 156, 282, 0, 38, 156, 156, 156,
2457 156, 163, 156, 156, 569, 156, 482, 22, 154, 17,
2458 17, 153, 156, 18, 19, 20, 156, 22, 23, 24,
2459 534, 535, 536, 537, 500, 30, 31, 592, 593, 317,
2460 506, 156, 156, 4, 156, 156, 512, 325, 326, 327,
2461 156, 4, 156, 156, 520, 610, 51, 523, 524, 525,
2462 55, 4, 153, 529, 59, 505, 156, 156, 156, 156,
2463 156, 22, 53, 156, 156, 579, 156, 581, 582, 163,
2464 156, 636, 637, 154, 156, 154, 641, 3, 4, 644,
2465 154, 7, 8, 9, 22, 650, 156, 159, 653, 154,
2466 161, 154, 154, 19, 20, 154, 22, 23, 24, 25,
2467 26, 27, 53, 17, 161, 154, 394, 395, 396, 397,
2468 398, 154, 4, 154, 40, 41, 404, 149, 153, 595,
2469 153, 22, 156, 17, 17, 156, 17, 415, 416, 72,
2470 17, 130, 58, 130, 130, 92, 586, 586, 554, 111,
2471 19, 105, 231, 22, 17, 24, 56, 242, 74, 75,
2472 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2473 86, 87, 88, 89, 90, 91, 92, 89, 529, -1,
2474 433, -1, -1, -1, 53, -1, -1, 465, -1, 467,
2475 -1, -1, 470, -1, -1, -1, -1, -1, -1, 477,
2476 478, -1, 118, 119, 120, 121, 122, 123, 124, 125,
2477 126, 127, 128, 129, 130, -1, 132, -1, 134, 135,
2478 136, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2479 -1, -1, 510, 511, -1, 513, 514, 515, 516, -1,
2480 -1, -1, -1, 521, -1, -1, 162, -1, -1, -1,
2481 -1, 120, 121, -1, 532, -1, -1, -1, -1, -1,
2482 -1, -1, 3, 4, -1, -1, 7, 8, 9, 138,
2483 139, -1, 141, 142, -1, 144, 145, 146, 19, 20,
2484 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2485 -1, 569, -1, -1, -1, -1, -1, -1, -1, 40,
2486 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2487 -1, -1, 53, -1, 592, 593, -1, 58, -1, -1,
2488 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2489 -1, -1, 610, 74, 75, 76, 77, 78, 79, 80,
2490 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2491 91, 92, -1, -1, -1, -1, -1, -1, 636, 637,
2492 -1, -1, -1, 641, -1, -1, 644, -1, -1, -1,
2493 -1, -1, 650, -1, -1, 653, -1, 118, 119, 120,
2494 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2495 -1, 132, -1, 134, 135, 136, -1, 138, 139, -1,
2496 141, 142, -1, 144, 145, 146, 3, 4, -1, -1,
2497 7, 8, 9, -1, -1, 0, -1, -1, -1, -1,
2498 -1, 162, 19, 20, -1, 22, 23, 24, 25, 26,
2499 27, 26, 27, 18, 19, 20, -1, 22, 23, 24,
2500 -1, -1, -1, 40, 41, 30, 31, -1, -1, -1,
2501 -1, -1, -1, -1, -1, -1, -1, 54, -1, -1,
2502 -1, 58, -1, -1, -1, -1, 51, -1, -1, -1,
2503 55, -1, -1, -1, 59, -1, -1, 74, 75, 76,
2504 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2505 87, 88, 89, 90, 91, 92, -1, -1, -1, -1,
2506 -1, -1, -1, -1, 99, 100, 101, 102, 103, 104,
2507 105, 106, 107, 108, 109, 110, 111, 112, -1, -1,
2508 -1, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2509 127, 128, 129, 130, -1, 132, -1, 134, 135, 136,
2510 -1, -1, 7, 8, -1, -1, -1, -1, -1, -1,
2511 -1, -1, -1, -1, 19, 20, 153, 22, 23, 24,
2512 25, -1, -1, -1, -1, 162, -1, -1, -1, -1,
2513 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2514 -1, -1, -1, -1, -1, -1, -1, 7, 8, 54,
2515 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2516 20, -1, 22, 23, 24, -1, -1, -1, -1, 74,
2517 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2518 85, 86, 87, 88, 89, 90, 91, 92, -1, 49,
2519 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2520 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2521 -1, -1, -1, 118, 119, 120, 121, 122, 123, 124,
2522 125, 126, 127, 128, 129, 130, -1, 132, -1, 134,
2523 135, 136, 49, -1, -1, -1, -1, -1, -1, -1,
2524 -1, -1, -1, -1, -1, -1, -1, -1, 153, -1,
2525 7, 8, 157, -1, 159, -1, -1, 162, -1, 164,
2526 -1, 166, 19, 20, -1, 22, 23, 24, 25, -1,
2527 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2528 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2529 -1, -1, -1, -1, -1, -1, -1, 54, 158, 159,
2530 -1, -1, 162, -1, 164, 165, -1, -1, -1, -1,
2531 -1, -1, -1, -1, -1, -1, -1, 74, 75, 76,
2532 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2533 87, 88, 89, 90, 91, 92, -1, -1, -1, -1,
2534 -1, 158, 159, -1, -1, 162, -1, 164, 165, -1,
2535 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2536 -1, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2537 127, 128, 129, 130, -1, 132, -1, 134, 135, 136,
2538 -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2539 -1, -1, -1, -1, 9, -1, 153, -1, -1, -1,
2540 -1, -1, 159, -1, -1, 162, -1, 164, -1, 166,
2541 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2542 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2543 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2544 -1, 7, 8, 58, 10, 11, 12, 13, 14, 15,
2545 16, 17, -1, 19, 20, -1, 22, 23, 24, 74,
2546 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2547 85, 86, 87, 88, 89, 90, 91, 92, -1, -1,
2548 -1, -1, -1, 49, 7, 8, -1, 10, 11, 12,
2549 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2550 23, 24, -1, 118, 119, 120, 121, 122, 123, 124,
2551 125, 126, 127, 128, 129, 130, 39, 132, -1, 134,
2552 135, 136, -1, -1, -1, -1, 49, 7, 8, -1,
2553 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2554 20, -1, 22, 23, 24, 7, 8, 162, 10, 11,
2555 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2556 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2557 -1, -1, -1, -1, -1, -1, -1, 39, -1, -1,
2558 -1, -1, -1, -1, -1, -1, -1, 49, -1, -1,
2559 -1, -1, 158, 159, -1, -1, 162, -1, 164, 165,
2560 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2561 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2562 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2563 -1, -1, -1, -1, -1, 158, 159, -1, -1, 162,
2564 -1, 164, 49, -1, 124, 7, 8, -1, 10, 11,
2565 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2566 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2567 -1, -1, -1, -1, -1, -1, -1, 39, 158, 159,
2568 -1, -1, 162, -1, 164, -1, -1, 49, -1, -1,
2569 -1, -1, -1, -1, -1, -1, 158, 159, -1, -1,
2570 162, -1, 164, 7, 8, -1, 10, 11, 12, 13,
2571 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2572 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2573 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
2574 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2575 -1, 158, 159, -1, 161, 162, -1, 164, -1, -1,
2576 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2577 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2578 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2579 -1, -1, -1, -1, -1, -1, 158, 159, -1, -1,
2580 162, -1, 164, 49, 7, 8, -1, 10, 11, 12,
2581 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2582 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2583 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2584 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2585 -1, -1, -1, -1, 158, 159, -1, -1, 162, -1,
2586 164, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2587 -1, -1, 158, 159, -1, -1, 162, -1, 164, 7,
2588 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2589 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2591 -1, -1, 158, 159, -1, -1, 162, -1, 164, -1,
2592 -1, 49, 7, 8, -1, 10, 11, 12, 13, 14,
2593 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2594 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2595 -1, -1, -1, -1, -1, 158, 159, -1, -1, 162,
2596 -1, 164, -1, -1, 49, -1, -1, -1, -1, -1,
2597 -1, -1, -1, 158, 159, -1, -1, 162, -1, 164,
2598 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2599 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
2600 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2601 19, 20, 36, 22, 23, 24, -1, -1, -1, -1,
2602 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2603 158, 159, 56, 57, 162, -1, 164, -1, -1, -1,
2604 49, -1, -1, -1, 68, 69, 70, 71, 72, 73,
2605 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2606 84, 85, 86, 87, 88, 89, 90, 91, 92, -1,
2607 -1, -1, -1, 158, 159, -1, -1, 162, -1, 164,
2608 -1, -1, -1, -1, -1, -1, -1, -1, -1, 113,
2609 114, 115, -1, -1, 118, 119, 120, 121, 122, 123,
2610 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
2611 134, 135, 136, 137, -1, -1, -1, -1, -1, -1,
2612 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2613 -1, 158, 159, -1, -1, 162, -1, 164, -1, -1,
2614 -1, -1, -1, -1, -1, -1, -1, -1, -1, 158,
2615 159, -1, -1, 162, -1, 164
2618 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2619 symbol of state STATE-NUM. */
2620 static const yytype_uint8 yystos[] =
2622 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2623 59, 175, 178, 179, 180, 181, 213, 214, 215, 217,
2624 216, 52, 67, 222, 155, 58, 155, 18, 155, 42,
2625 43, 44, 45, 46, 47, 48, 50, 150, 151, 152,
2626 182, 183, 184, 0, 215, 46, 48, 185, 232, 42,
2627 43, 44, 47, 186, 229, 231, 239, 155, 155, 159,
2628 223, 22, 221, 7, 8, 10, 11, 12, 13, 14,
2629 15, 16, 17, 49, 158, 159, 162, 164, 175, 179,
2630 200, 201, 235, 184, 184, 35, 37, 211, 184, 184,
2631 21, 240, 241, 29, 165, 230, 240, 22, 22, 22,
2632 224, 153, 4, 4, 4, 164, 10, 165, 201, 206,
2633 54, 153, 177, 211, 211, 42, 44, 187, 32, 33,
2634 210, 61, 62, 63, 64, 65, 66, 188, 227, 227,
2635 178, 244, 156, 161, 39, 201, 202, 204, 205, 160,
2636 160, 165, 206, 156, 165, 153, 205, 157, 210, 210,
2637 10, 124, 201, 203, 212, 11, 12, 13, 14, 15,
2638 16, 173, 174, 201, 207, 4, 203, 28, 164, 228,
2639 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2640 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2641 85, 86, 87, 88, 89, 90, 91, 92, 113, 114,
2642 115, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2643 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2644 137, 168, 169, 170, 242, 248, 249, 250, 251, 22,
2645 190, 156, 154, 201, 201, 163, 165, 201, 4, 154,
2646 207, 201, 153, 235, 26, 27, 3, 4, 5, 6,
2647 9, 25, 40, 41, 89, 90, 91, 92, 118, 132,
2648 134, 135, 136, 159, 162, 164, 166, 168, 169, 170,
2649 208, 235, 177, 179, 56, 10, 201, 237, 238, 11,
2650 17, 11, 173, 188, 93, 94, 95, 96, 97, 98,
2651 99, 100, 101, 102, 171, 26, 27, 99, 100, 101,
2652 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2653 112, 172, 171, 172, 201, 201, 237, 201, 201, 245,
2654 237, 237, 237, 237, 237, 201, 201, 201, 237, 188,
2655 116, 117, 53, 120, 121, 138, 139, 141, 142, 144,
2656 145, 146, 189, 39, 202, 192, 161, 163, 163, 154,
2657 192, 177, 177, 212, 171, 172, 171, 172, 153, 153,
2658 153, 153, 153, 161, 207, 209, 164, 209, 165, 209,
2659 22, 153, 153, 153, 218, 153, 3, 4, 9, 25,
2660 26, 27, 40, 41, 58, 162, 208, 234, 235, 236,
2661 156, 236, 236, 236, 203, 201, 201, 201, 201, 156,
2662 195, 156, 195, 236, 159, 156, 156, 156, 156, 156,
2663 156, 236, 236, 236, 38, 203, 201, 237, 4, 138,
2664 139, 140, 143, 147, 148, 191, 219, 220, 38, 153,
2665 153, 153, 153, 207, 207, 207, 207, 207, 156, 161,
2666 165, 201, 209, 163, 165, 207, 207, 207, 156, 198,
2667 39, 201, 225, 226, 60, 233, 209, 237, 156, 156,
2668 236, 236, 236, 236, 236, 11, 53, 11, 247, 236,
2669 159, 237, 201, 237, 237, 237, 156, 156, 156, 201,
2670 236, 236, 156, 198, 198, 201, 207, 207, 207, 207,
2671 247, 156, 156, 156, 156, 207, 163, 165, 156, 156,
2672 38, 34, 53, 196, 199, 190, 156, 154, 22, 163,
2673 17, 17, 153, 156, 156, 156, 156, 236, 4, 236,
2674 156, 156, 236, 156, 156, 156, 4, 236, 236, 153,
2675 156, 195, 201, 154, 156, 156, 156, 156, 154, 207,
2676 207, 207, 207, 163, 207, 207, 201, 22, 4, 198,
2677 175, 176, 39, 201, 192, 156, 236, 236, 17, 201,
2678 246, 236, 236, 236, 236, 195, 195, 237, 236, 156,
2679 237, 237, 237, 246, 236, 207, 207, 207, 207, 156,
2680 154, 156, 156, 154, 154, 154, 190, 196, 197, 22,
2681 156, 159, 190, 190, 154, 156, 161, 236, 154, 195,
2682 154, 154, 154, 154, 207, 207, 207, 176, 53, 194,
2683 17, 161, 173, 243, 120, 121, 236, 236, 192, 17,
2684 201, 161, 192, 154, 154, 154, 4, 149, 193, 236,
2685 234, 161, 173, 190, 190, 38, 190, 190, 22, 156,
2686 234, 17, 236, 236, 17, 156, 236, 190, 190, 236,
2687 17, 72, 236, 17, 236
2690 #define yyerrok (yyerrstatus = 0)
2691 #define yyclearin (yychar = YYEMPTY)
2692 #define YYEMPTY (-2)
2695 #define YYACCEPT goto yyacceptlab
2696 #define YYABORT goto yyabortlab
2697 #define YYERROR goto yyerrorlab
2700 /* Like YYERROR except do call yyerror. This remains here temporarily
2701 to ease the transition to the new meaning of YYERROR, for GCC.
2702 Once GCC version 2 has supplanted version 1, this can go. */
2704 #define YYFAIL goto yyerrlab
2706 #define YYRECOVERING() (!!yyerrstatus)
2708 #define YYBACKUP(Token, Value) \
2710 if (yychar == YYEMPTY && yylen == 1) \
2714 yytoken = YYTRANSLATE (yychar); \
2720 yyerror (YY_("syntax error: cannot back up")); \
2727 #define YYERRCODE 256
2730 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2731 If N is 0, then set CURRENT to the empty location which ends
2732 the previous symbol: RHS[0] (always defined). */
2734 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2735 #ifndef YYLLOC_DEFAULT
2736 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2740 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2741 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2742 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2743 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2747 (Current).first_line = (Current).last_line = \
2748 YYRHSLOC (Rhs, 0).last_line; \
2749 (Current).first_column = (Current).last_column = \
2750 YYRHSLOC (Rhs, 0).last_column; \
2756 /* YY_LOCATION_PRINT -- Print the location on the stream.
2757 This macro was not mandated originally: define only if we know
2758 we won't break user code: when these are the locations we know. */
2760 #ifndef YY_LOCATION_PRINT
2761 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2762 # define YY_LOCATION_PRINT(File, Loc) \
2763 fprintf (File, "%d.%d-%d.%d", \
2764 (Loc).first_line, (Loc).first_column, \
2765 (Loc).last_line, (Loc).last_column)
2767 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2772 /* YYLEX -- calling `yylex' with the right arguments. */
2775 # define YYLEX yylex (YYLEX_PARAM)
2777 # define YYLEX yylex ()
2780 /* Enable debugging if requested. */
2784 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2785 # define YYFPRINTF fprintf
2788 # define YYDPRINTF(Args) \
2794 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2798 YYFPRINTF (stderr, "%s ", Title); \
2799 yy_symbol_print (stderr, \
2801 YYFPRINTF (stderr, "\n"); \
2806 /*--------------------------------.
2807 | Print this symbol on YYOUTPUT. |
2808 `--------------------------------*/
2811 #if (defined __STDC__ || defined __C99__FUNC__ \
2812 || defined __cplusplus || defined _MSC_VER)
2814 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2817 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2820 YYSTYPE const * const yyvaluep;
2826 if (yytype < YYNTOKENS)
2827 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2839 /*--------------------------------.
2840 | Print this symbol on YYOUTPUT. |
2841 `--------------------------------*/
2843 #if (defined __STDC__ || defined __C99__FUNC__ \
2844 || defined __cplusplus || defined _MSC_VER)
2846 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2849 yy_symbol_print (yyoutput, yytype, yyvaluep)
2852 YYSTYPE const * const yyvaluep;
2855 if (yytype < YYNTOKENS)
2856 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2858 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2860 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2861 YYFPRINTF (yyoutput, ")");
2864 /*------------------------------------------------------------------.
2865 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2867 `------------------------------------------------------------------*/
2869 #if (defined __STDC__ || defined __C99__FUNC__ \
2870 || defined __cplusplus || defined _MSC_VER)
2872 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2875 yy_stack_print (bottom, top)
2876 yytype_int16 *bottom;
2880 YYFPRINTF (stderr, "Stack now");
2881 for (; bottom <= top; ++bottom)
2882 YYFPRINTF (stderr, " %d", *bottom);
2883 YYFPRINTF (stderr, "\n");
2886 # define YY_STACK_PRINT(Bottom, Top) \
2889 yy_stack_print ((Bottom), (Top)); \
2893 /*------------------------------------------------.
2894 | Report that the YYRULE is going to be reduced. |
2895 `------------------------------------------------*/
2897 #if (defined __STDC__ || defined __C99__FUNC__ \
2898 || defined __cplusplus || defined _MSC_VER)
2900 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2903 yy_reduce_print (yyvsp, yyrule)
2908 int yynrhs = yyr2[yyrule];
2910 unsigned long int yylno = yyrline[yyrule];
2911 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2913 /* The symbols being reduced. */
2914 for (yyi = 0; yyi < yynrhs; yyi++)
2916 fprintf (stderr, " $%d = ", yyi + 1);
2917 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2918 &(yyvsp[(yyi + 1) - (yynrhs)])
2920 fprintf (stderr, "\n");
2924 # define YY_REDUCE_PRINT(Rule) \
2927 yy_reduce_print (yyvsp, Rule); \
2930 /* Nonzero means print parse trace. It is left uninitialized so that
2931 multiple parsers can coexist. */
2933 #else /* !YYDEBUG */
2934 # define YYDPRINTF(Args)
2935 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2936 # define YY_STACK_PRINT(Bottom, Top)
2937 # define YY_REDUCE_PRINT(Rule)
2938 #endif /* !YYDEBUG */
2941 /* YYINITDEPTH -- initial size of the parser's stacks. */
2943 # define YYINITDEPTH 200
2946 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2947 if the built-in stack extension method is used).
2949 Do not make this value too large; the results are undefined if
2950 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2951 evaluated with infinite-precision integer arithmetic. */
2954 # define YYMAXDEPTH 10000
2962 # if defined __GLIBC__ && defined _STRING_H
2963 # define yystrlen strlen
2965 /* Return the length of YYSTR. */
2966 #if (defined __STDC__ || defined __C99__FUNC__ \
2967 || defined __cplusplus || defined _MSC_VER)
2969 yystrlen (const char *yystr)
2977 for (yylen = 0; yystr[yylen]; yylen++)
2985 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2986 # define yystpcpy stpcpy
2988 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2990 #if (defined __STDC__ || defined __C99__FUNC__ \
2991 || defined __cplusplus || defined _MSC_VER)
2993 yystpcpy (char *yydest, const char *yysrc)
2996 yystpcpy (yydest, yysrc)
3002 const char *yys = yysrc;
3004 while ((*yyd++ = *yys++) != '\0')
3013 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3014 quotes and backslashes, so that it's suitable for yyerror. The
3015 heuristic is that double-quoting is unnecessary unless the string
3016 contains an apostrophe, a comma, or backslash (other than
3017 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3018 null, do not copy; instead, return the length of what the result
3021 yytnamerr (char *yyres, const char *yystr)
3026 char const *yyp = yystr;
3033 goto do_not_strip_quotes;
3037 goto do_not_strip_quotes;
3050 do_not_strip_quotes: ;
3054 return yystrlen (yystr);
3056 return yystpcpy (yyres, yystr) - yyres;
3060 /* Copy into YYRESULT an error message about the unexpected token
3061 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3062 including the terminating null byte. If YYRESULT is null, do not
3063 copy anything; just return the number of bytes that would be
3064 copied. As a special case, return 0 if an ordinary "syntax error"
3065 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3066 size calculation. */
3068 yysyntax_error (char *yyresult, int yystate, int yychar)
3070 int yyn = yypact[yystate];
3072 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3076 int yytype = YYTRANSLATE (yychar);
3077 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3078 YYSIZE_T yysize = yysize0;
3080 int yysize_overflow = 0;
3081 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3082 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3086 /* This is so xgettext sees the translatable formats that are
3087 constructed on the fly. */
3088 YY_("syntax error, unexpected %s");
3089 YY_("syntax error, unexpected %s, expecting %s");
3090 YY_("syntax error, unexpected %s, expecting %s or %s");
3091 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3092 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3096 static char const yyunexpected[] = "syntax error, unexpected %s";
3097 static char const yyexpecting[] = ", expecting %s";
3098 static char const yyor[] = " or %s";
3099 char yyformat[sizeof yyunexpected
3100 + sizeof yyexpecting - 1
3101 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3102 * (sizeof yyor - 1))];
3103 char const *yyprefix = yyexpecting;
3105 /* Start YYX at -YYN if negative to avoid negative indexes in
3107 int yyxbegin = yyn < 0 ? -yyn : 0;
3109 /* Stay within bounds of both yycheck and yytname. */
3110 int yychecklim = YYLAST - yyn + 1;
3111 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3114 yyarg[0] = yytname[yytype];
3115 yyfmt = yystpcpy (yyformat, yyunexpected);
3117 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3118 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3120 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3124 yyformat[sizeof yyunexpected - 1] = '\0';
3127 yyarg[yycount++] = yytname[yyx];
3128 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3129 yysize_overflow |= (yysize1 < yysize);
3131 yyfmt = yystpcpy (yyfmt, yyprefix);
3135 yyf = YY_(yyformat);
3136 yysize1 = yysize + yystrlen (yyf);
3137 yysize_overflow |= (yysize1 < yysize);
3140 if (yysize_overflow)
3141 return YYSIZE_MAXIMUM;
3145 /* Avoid sprintf, as that infringes on the user's name space.
3146 Don't have undefined behavior even if the translation
3147 produced a string with the wrong number of "%s"s. */
3148 char *yyp = yyresult;
3150 while ((*yyp = *yyf) != '\0')
3152 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3154 yyp += yytnamerr (yyp, yyarg[yyi++]);
3167 #endif /* YYERROR_VERBOSE */
3170 /*-----------------------------------------------.
3171 | Release the memory associated to this symbol. |
3172 `-----------------------------------------------*/
3175 #if (defined __STDC__ || defined __C99__FUNC__ \
3176 || defined __cplusplus || defined _MSC_VER)
3178 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3181 yydestruct (yymsg, yytype, yyvaluep)
3191 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3202 /* Prevent warnings from -Wmissing-prototypes. */
3204 #ifdef YYPARSE_PARAM
3205 #if defined __STDC__ || defined __cplusplus
3206 int yyparse (void *YYPARSE_PARAM);
3210 #else /* ! YYPARSE_PARAM */
3211 #if defined __STDC__ || defined __cplusplus
3216 #endif /* ! YYPARSE_PARAM */
3220 /* The look-ahead symbol. */
3223 /* The semantic value of the look-ahead symbol. */
3226 /* Number of syntax errors so far. */
3235 #ifdef YYPARSE_PARAM
3236 #if (defined __STDC__ || defined __C99__FUNC__ \
3237 || defined __cplusplus || defined _MSC_VER)
3239 yyparse (void *YYPARSE_PARAM)
3242 yyparse (YYPARSE_PARAM)
3243 void *YYPARSE_PARAM;
3245 #else /* ! YYPARSE_PARAM */
3246 #if (defined __STDC__ || defined __C99__FUNC__ \
3247 || defined __cplusplus || defined _MSC_VER)
3261 /* Number of tokens to shift before error messages enabled. */
3263 /* Look-ahead token as an internal (translated) token number. */
3266 /* Buffer for error messages, and its allocated size. */
3268 char *yymsg = yymsgbuf;
3269 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3272 /* Three stacks and their tools:
3273 `yyss': related to states,
3274 `yyvs': related to semantic values,
3275 `yyls': related to locations.
3277 Refer to the stacks thru separate pointers, to allow yyoverflow
3278 to reallocate them elsewhere. */
3280 /* The state stack. */
3281 yytype_int16 yyssa[YYINITDEPTH];
3282 yytype_int16 *yyss = yyssa;
3283 yytype_int16 *yyssp;
3285 /* The semantic value stack. */
3286 YYSTYPE yyvsa[YYINITDEPTH];
3287 YYSTYPE *yyvs = yyvsa;
3292 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3294 YYSIZE_T yystacksize = YYINITDEPTH;
3296 /* The variables used to return semantic value and location from the
3301 /* The number of symbols on the RHS of the reduced rule.
3302 Keep to zero when no symbol should be popped. */
3305 YYDPRINTF ((stderr, "Starting parse\n"));
3310 yychar = YYEMPTY; /* Cause a token to be read. */
3312 /* Initialize stack pointers.
3313 Waste one element of value and location stack
3314 so that they stay on the same level as the state stack.
3315 The wasted elements are never initialized. */
3322 /*------------------------------------------------------------.
3323 | yynewstate -- Push a new state, which is found in yystate. |
3324 `------------------------------------------------------------*/
3326 /* In all cases, when you get here, the value and location stacks
3327 have just been pushed. So pushing a state here evens the stacks. */
3333 if (yyss + yystacksize - 1 <= yyssp)
3335 /* Get the current used size of the three stacks, in elements. */
3336 YYSIZE_T yysize = yyssp - yyss + 1;
3340 /* Give user a chance to reallocate the stack. Use copies of
3341 these so that the &'s don't force the real ones into
3343 YYSTYPE *yyvs1 = yyvs;
3344 yytype_int16 *yyss1 = yyss;
3347 /* Each stack pointer address is followed by the size of the
3348 data in use in that stack, in bytes. This used to be a
3349 conditional around just the two extra args, but that might
3350 be undefined if yyoverflow is a macro. */
3351 yyoverflow (YY_("memory exhausted"),
3352 &yyss1, yysize * sizeof (*yyssp),
3353 &yyvs1, yysize * sizeof (*yyvsp),
3360 #else /* no yyoverflow */
3361 # ifndef YYSTACK_RELOCATE
3362 goto yyexhaustedlab;
3364 /* Extend the stack our own way. */
3365 if (YYMAXDEPTH <= yystacksize)
3366 goto yyexhaustedlab;
3368 if (YYMAXDEPTH < yystacksize)
3369 yystacksize = YYMAXDEPTH;
3372 yytype_int16 *yyss1 = yyss;
3373 union yyalloc *yyptr =
3374 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3376 goto yyexhaustedlab;
3377 YYSTACK_RELOCATE (yyss);
3378 YYSTACK_RELOCATE (yyvs);
3380 # undef YYSTACK_RELOCATE
3382 YYSTACK_FREE (yyss1);
3385 #endif /* no yyoverflow */
3387 yyssp = yyss + yysize - 1;
3388 yyvsp = yyvs + yysize - 1;
3391 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3392 (unsigned long int) yystacksize));
3394 if (yyss + yystacksize - 1 <= yyssp)
3398 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3407 /* Do appropriate processing given the current state. Read a
3408 look-ahead token if we need one and don't already have one. */
3410 /* First try to decide what to do without reference to look-ahead token. */
3411 yyn = yypact[yystate];
3412 if (yyn == YYPACT_NINF)
3415 /* Not known => get a look-ahead token if don't already have one. */
3417 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3418 if (yychar == YYEMPTY)
3420 YYDPRINTF ((stderr, "Reading a token: "));
3424 if (yychar <= YYEOF)
3426 yychar = yytoken = YYEOF;
3427 YYDPRINTF ((stderr, "Now at end of input.\n"));
3431 yytoken = YYTRANSLATE (yychar);
3432 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3435 /* If the proper action on seeing token YYTOKEN is to reduce or to
3436 detect an error, take that action. */
3438 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3443 if (yyn == 0 || yyn == YYTABLE_NINF)
3452 /* Count tokens shifted since error; after three, turn off error
3457 /* Shift the look-ahead token. */
3458 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3460 /* Discard the shifted token unless it is eof. */
3461 if (yychar != YYEOF)
3470 /*-----------------------------------------------------------.
3471 | yydefault -- do the default action for the current state. |
3472 `-----------------------------------------------------------*/
3474 yyn = yydefact[yystate];
3480 /*-----------------------------.
3481 | yyreduce -- Do a reduction. |
3482 `-----------------------------*/
3484 /* yyn is the number of a rule to reduce with. */
3487 /* If YYLEN is nonzero, implement the default value of the action:
3490 Otherwise, the following line sets YYVAL to garbage.
3491 This behavior is undocumented and Bison
3492 users should not rely upon it. Assigning to YYVAL
3493 unconditionally makes the parser a bit smaller, and it avoids a
3494 GCC warning that YYVAL may be used uninitialized. */
3495 yyval = yyvsp[1-yylen];
3498 YY_REDUCE_PRINT (yyn);
3502 #line 1117 "/llvm/lib/AsmParser/llvmAsmParser.y"
3503 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3507 #line 1117 "/llvm/lib/AsmParser/llvmAsmParser.y"
3508 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3512 #line 1118 "/llvm/lib/AsmParser/llvmAsmParser.y"
3513 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3517 #line 1118 "/llvm/lib/AsmParser/llvmAsmParser.y"
3518 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3522 #line 1119 "/llvm/lib/AsmParser/llvmAsmParser.y"
3523 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3527 #line 1119 "/llvm/lib/AsmParser/llvmAsmParser.y"
3528 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3532 #line 1120 "/llvm/lib/AsmParser/llvmAsmParser.y"
3533 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3537 #line 1120 "/llvm/lib/AsmParser/llvmAsmParser.y"
3538 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3542 #line 1121 "/llvm/lib/AsmParser/llvmAsmParser.y"
3543 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3547 #line 1121 "/llvm/lib/AsmParser/llvmAsmParser.y"
3548 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3552 #line 1125 "/llvm/lib/AsmParser/llvmAsmParser.y"
3553 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3557 #line 1125 "/llvm/lib/AsmParser/llvmAsmParser.y"
3558 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3562 #line 1126 "/llvm/lib/AsmParser/llvmAsmParser.y"
3563 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3567 #line 1126 "/llvm/lib/AsmParser/llvmAsmParser.y"
3568 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3572 #line 1127 "/llvm/lib/AsmParser/llvmAsmParser.y"
3573 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3577 #line 1127 "/llvm/lib/AsmParser/llvmAsmParser.y"
3578 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3582 #line 1128 "/llvm/lib/AsmParser/llvmAsmParser.y"
3583 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3587 #line 1128 "/llvm/lib/AsmParser/llvmAsmParser.y"
3588 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3592 #line 1129 "/llvm/lib/AsmParser/llvmAsmParser.y"
3593 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3597 #line 1129 "/llvm/lib/AsmParser/llvmAsmParser.y"
3598 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3602 #line 1130 "/llvm/lib/AsmParser/llvmAsmParser.y"
3603 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3607 #line 1130 "/llvm/lib/AsmParser/llvmAsmParser.y"
3608 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3612 #line 1131 "/llvm/lib/AsmParser/llvmAsmParser.y"
3613 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3617 #line 1131 "/llvm/lib/AsmParser/llvmAsmParser.y"
3618 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3622 #line 1132 "/llvm/lib/AsmParser/llvmAsmParser.y"
3623 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3627 #line 1133 "/llvm/lib/AsmParser/llvmAsmParser.y"
3628 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3632 #line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y"
3633 { (yyval.StrVal) = 0; ;}
3637 #line 1144 "/llvm/lib/AsmParser/llvmAsmParser.y"
3638 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3642 #line 1145 "/llvm/lib/AsmParser/llvmAsmParser.y"
3643 { (yyval.UIntVal)=0; ;}
3647 #line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y"
3649 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3655 #line 1153 "/llvm/lib/AsmParser/llvmAsmParser.y"
3663 #line 1161 "/llvm/lib/AsmParser/llvmAsmParser.y"
3671 #line 1166 "/llvm/lib/AsmParser/llvmAsmParser.y"
3673 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3679 #line 1172 "/llvm/lib/AsmParser/llvmAsmParser.y"
3680 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3684 #line 1173 "/llvm/lib/AsmParser/llvmAsmParser.y"
3685 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3689 #line 1174 "/llvm/lib/AsmParser/llvmAsmParser.y"
3690 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3694 #line 1175 "/llvm/lib/AsmParser/llvmAsmParser.y"
3695 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3699 #line 1176 "/llvm/lib/AsmParser/llvmAsmParser.y"
3700 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3704 #line 1180 "/llvm/lib/AsmParser/llvmAsmParser.y"
3705 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3709 #line 1181 "/llvm/lib/AsmParser/llvmAsmParser.y"
3710 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3714 #line 1182 "/llvm/lib/AsmParser/llvmAsmParser.y"
3715 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3719 #line 1186 "/llvm/lib/AsmParser/llvmAsmParser.y"
3720 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3724 #line 1187 "/llvm/lib/AsmParser/llvmAsmParser.y"
3725 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3729 #line 1188 "/llvm/lib/AsmParser/llvmAsmParser.y"
3730 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3734 #line 1189 "/llvm/lib/AsmParser/llvmAsmParser.y"
3735 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3739 #line 1193 "/llvm/lib/AsmParser/llvmAsmParser.y"
3740 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3744 #line 1194 "/llvm/lib/AsmParser/llvmAsmParser.y"
3745 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3749 #line 1195 "/llvm/lib/AsmParser/llvmAsmParser.y"
3750 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3754 #line 1199 "/llvm/lib/AsmParser/llvmAsmParser.y"
3755 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3759 #line 1200 "/llvm/lib/AsmParser/llvmAsmParser.y"
3760 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3764 #line 1201 "/llvm/lib/AsmParser/llvmAsmParser.y"
3765 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3769 #line 1202 "/llvm/lib/AsmParser/llvmAsmParser.y"
3770 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3774 #line 1203 "/llvm/lib/AsmParser/llvmAsmParser.y"
3775 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3779 #line 1207 "/llvm/lib/AsmParser/llvmAsmParser.y"
3780 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3784 #line 1208 "/llvm/lib/AsmParser/llvmAsmParser.y"
3785 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3789 #line 1209 "/llvm/lib/AsmParser/llvmAsmParser.y"
3790 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3794 #line 1212 "/llvm/lib/AsmParser/llvmAsmParser.y"
3795 { (yyval.UIntVal) = CallingConv::C; ;}
3799 #line 1213 "/llvm/lib/AsmParser/llvmAsmParser.y"
3800 { (yyval.UIntVal) = CallingConv::C; ;}
3804 #line 1214 "/llvm/lib/AsmParser/llvmAsmParser.y"
3805 { (yyval.UIntVal) = CallingConv::Fast; ;}
3809 #line 1215 "/llvm/lib/AsmParser/llvmAsmParser.y"
3810 { (yyval.UIntVal) = CallingConv::Cold; ;}
3814 #line 1216 "/llvm/lib/AsmParser/llvmAsmParser.y"
3815 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3819 #line 1217 "/llvm/lib/AsmParser/llvmAsmParser.y"
3820 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3824 #line 1218 "/llvm/lib/AsmParser/llvmAsmParser.y"
3826 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3827 GEN_ERROR("Calling conv too large");
3828 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3834 #line 1225 "/llvm/lib/AsmParser/llvmAsmParser.y"
3835 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3839 #line 1226 "/llvm/lib/AsmParser/llvmAsmParser.y"
3840 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3844 #line 1227 "/llvm/lib/AsmParser/llvmAsmParser.y"
3845 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3849 #line 1228 "/llvm/lib/AsmParser/llvmAsmParser.y"
3850 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3854 #line 1229 "/llvm/lib/AsmParser/llvmAsmParser.y"
3855 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3859 #line 1230 "/llvm/lib/AsmParser/llvmAsmParser.y"
3860 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3864 #line 1231 "/llvm/lib/AsmParser/llvmAsmParser.y"
3865 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3869 #line 1232 "/llvm/lib/AsmParser/llvmAsmParser.y"
3870 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3874 #line 1233 "/llvm/lib/AsmParser/llvmAsmParser.y"
3875 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3879 #line 1234 "/llvm/lib/AsmParser/llvmAsmParser.y"
3880 { (yyval.ParamAttrs) =
3881 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3885 #line 1238 "/llvm/lib/AsmParser/llvmAsmParser.y"
3886 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3890 #line 1239 "/llvm/lib/AsmParser/llvmAsmParser.y"
3892 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3897 #line 1244 "/llvm/lib/AsmParser/llvmAsmParser.y"
3898 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3902 #line 1245 "/llvm/lib/AsmParser/llvmAsmParser.y"
3903 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3907 #line 1246 "/llvm/lib/AsmParser/llvmAsmParser.y"
3908 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3912 #line 1247 "/llvm/lib/AsmParser/llvmAsmParser.y"
3913 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3917 #line 1248 "/llvm/lib/AsmParser/llvmAsmParser.y"
3918 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3922 #line 1249 "/llvm/lib/AsmParser/llvmAsmParser.y"
3923 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3927 #line 1252 "/llvm/lib/AsmParser/llvmAsmParser.y"
3928 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3932 #line 1253 "/llvm/lib/AsmParser/llvmAsmParser.y"
3934 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3939 #line 1258 "/llvm/lib/AsmParser/llvmAsmParser.y"
3940 { (yyval.StrVal) = 0; ;}
3944 #line 1259 "/llvm/lib/AsmParser/llvmAsmParser.y"
3946 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3951 #line 1266 "/llvm/lib/AsmParser/llvmAsmParser.y"
3952 { (yyval.UIntVal) = 0; ;}
3956 #line 1267 "/llvm/lib/AsmParser/llvmAsmParser.y"
3958 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3959 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3960 GEN_ERROR("Alignment must be a power of two");
3966 #line 1273 "/llvm/lib/AsmParser/llvmAsmParser.y"
3967 { (yyval.UIntVal) = 0; ;}
3971 #line 1274 "/llvm/lib/AsmParser/llvmAsmParser.y"
3973 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3974 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3975 GEN_ERROR("Alignment must be a power of two");
3981 #line 1283 "/llvm/lib/AsmParser/llvmAsmParser.y"
3983 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3984 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3985 GEN_ERROR("Invalid character in section name");
3986 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3992 #line 1291 "/llvm/lib/AsmParser/llvmAsmParser.y"
3993 { (yyval.StrVal) = 0; ;}
3997 #line 1292 "/llvm/lib/AsmParser/llvmAsmParser.y"
3998 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4002 #line 1297 "/llvm/lib/AsmParser/llvmAsmParser.y"
4007 #line 1298 "/llvm/lib/AsmParser/llvmAsmParser.y"
4012 #line 1299 "/llvm/lib/AsmParser/llvmAsmParser.y"
4014 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4015 delete (yyvsp[(1) - (1)].StrVal);
4021 #line 1304 "/llvm/lib/AsmParser/llvmAsmParser.y"
4023 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4024 GEN_ERROR("Alignment must be a power of two");
4025 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4031 #line 1320 "/llvm/lib/AsmParser/llvmAsmParser.y"
4033 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4039 #line 1324 "/llvm/lib/AsmParser/llvmAsmParser.y"
4041 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4047 #line 1328 "/llvm/lib/AsmParser/llvmAsmParser.y"
4049 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4050 GEN_ERROR("Cannot form a pointer to a basic block");
4051 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4052 delete (yyvsp[(1) - (3)].TypeVal);
4058 #line 1335 "/llvm/lib/AsmParser/llvmAsmParser.y"
4059 { // Named types are also simple types...
4060 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4062 (yyval.TypeVal) = new PATypeHolder(tmp);
4067 #line 1340 "/llvm/lib/AsmParser/llvmAsmParser.y"
4068 { // Type UpReference
4069 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4070 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4071 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4072 (yyval.TypeVal) = new PATypeHolder(OT);
4073 UR_OUT("New Upreference!\n");
4079 #line 1348 "/llvm/lib/AsmParser/llvmAsmParser.y"
4081 // Allow but ignore attributes on function types; this permits auto-upgrade.
4082 // FIXME: remove in LLVM 3.0.
4083 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4084 if (!FunctionType::isValidReturnType(RetTy))
4085 GEN_ERROR("Invalid result type for LLVM function");
4087 std::vector<const Type*> Params;
4088 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4089 for (; I != E; ++I ) {
4090 const Type *Ty = I->Ty->get();
4091 Params.push_back(Ty);
4094 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4095 if (isVarArg) Params.pop_back();
4097 for (unsigned i = 0; i != Params.size(); ++i)
4098 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4099 GEN_ERROR("Function arguments must be value types!");
4103 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4104 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4105 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4106 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4112 #line 1377 "/llvm/lib/AsmParser/llvmAsmParser.y"
4114 // Allow but ignore attributes on function types; this permits auto-upgrade.
4115 // FIXME: remove in LLVM 3.0.
4116 std::vector<const Type*> Params;
4117 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4118 for ( ; I != E; ++I ) {
4119 const Type* Ty = I->Ty->get();
4120 Params.push_back(Ty);
4123 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4124 if (isVarArg) Params.pop_back();
4126 for (unsigned i = 0; i != Params.size(); ++i)
4127 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4128 GEN_ERROR("Function arguments must be value types!");
4132 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4133 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4134 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4140 #line 1402 "/llvm/lib/AsmParser/llvmAsmParser.y"
4141 { // Sized array type?
4142 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4143 delete (yyvsp[(4) - (5)].TypeVal);
4149 #line 1407 "/llvm/lib/AsmParser/llvmAsmParser.y"
4151 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4152 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4153 GEN_ERROR("Unsigned result not equal to signed result");
4154 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4155 GEN_ERROR("Element type of a VectorType must be primitive");
4156 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4157 delete (yyvsp[(4) - (5)].TypeVal);
4163 #line 1417 "/llvm/lib/AsmParser/llvmAsmParser.y"
4164 { // Structure type?
4165 std::vector<const Type*> Elements;
4166 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4167 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4168 Elements.push_back(*I);
4170 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4171 delete (yyvsp[(2) - (3)].TypeList);
4177 #line 1427 "/llvm/lib/AsmParser/llvmAsmParser.y"
4178 { // Empty structure type?
4179 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4185 #line 1431 "/llvm/lib/AsmParser/llvmAsmParser.y"
4187 std::vector<const Type*> Elements;
4188 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4189 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4190 Elements.push_back(*I);
4192 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4193 delete (yyvsp[(3) - (5)].TypeList);
4199 #line 1441 "/llvm/lib/AsmParser/llvmAsmParser.y"
4200 { // Empty structure type?
4201 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4207 #line 1448 "/llvm/lib/AsmParser/llvmAsmParser.y"
4209 // Allow but ignore attributes on function types; this permits auto-upgrade.
4210 // FIXME: remove in LLVM 3.0.
4211 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4212 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4217 #line 1457 "/llvm/lib/AsmParser/llvmAsmParser.y"
4219 if (!UpRefs.empty())
4220 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4221 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4222 GEN_ERROR("LLVM functions cannot return aggregate types");
4223 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4228 #line 1464 "/llvm/lib/AsmParser/llvmAsmParser.y"
4230 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4235 #line 1469 "/llvm/lib/AsmParser/llvmAsmParser.y"
4237 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4238 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4244 #line 1474 "/llvm/lib/AsmParser/llvmAsmParser.y"
4246 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4252 #line 1482 "/llvm/lib/AsmParser/llvmAsmParser.y"
4254 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4255 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4256 TWA.Ty = new PATypeHolder(Type::VoidTy);
4257 (yyval.TypeWithAttrsList)->push_back(TWA);
4263 #line 1489 "/llvm/lib/AsmParser/llvmAsmParser.y"
4265 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4266 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4267 TWA.Ty = new PATypeHolder(Type::VoidTy);
4268 (yyval.TypeWithAttrsList)->push_back(TWA);
4274 #line 1496 "/llvm/lib/AsmParser/llvmAsmParser.y"
4276 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4282 #line 1504 "/llvm/lib/AsmParser/llvmAsmParser.y"
4284 (yyval.TypeList) = new std::list<PATypeHolder>();
4285 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4286 delete (yyvsp[(1) - (1)].TypeVal);
4292 #line 1510 "/llvm/lib/AsmParser/llvmAsmParser.y"
4294 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4295 delete (yyvsp[(3) - (3)].TypeVal);
4301 #line 1522 "/llvm/lib/AsmParser/llvmAsmParser.y"
4302 { // Nonempty unsized arr
4303 if (!UpRefs.empty())
4304 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4305 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4307 GEN_ERROR("Cannot make array constant with type: '" +
4308 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4309 const Type *ETy = ATy->getElementType();
4310 int NumElements = ATy->getNumElements();
4312 // Verify that we have the correct size...
4313 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4314 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4315 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4316 itostr(NumElements) + "");
4318 // Verify all elements are correct type!
4319 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4320 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4321 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4322 ETy->getDescription() +"' as required!\nIt is of type '"+
4323 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4326 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4327 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4333 #line 1550 "/llvm/lib/AsmParser/llvmAsmParser.y"
4335 if (!UpRefs.empty())
4336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4337 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4339 GEN_ERROR("Cannot make array constant with type: '" +
4340 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4342 int NumElements = ATy->getNumElements();
4343 if (NumElements != -1 && NumElements != 0)
4344 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4345 " arguments, but has size of " + itostr(NumElements) +"");
4346 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4347 delete (yyvsp[(1) - (3)].TypeVal);
4353 #line 1566 "/llvm/lib/AsmParser/llvmAsmParser.y"
4355 if (!UpRefs.empty())
4356 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4357 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4359 GEN_ERROR("Cannot make array constant with type: '" +
4360 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4362 int NumElements = ATy->getNumElements();
4363 const Type *ETy = ATy->getElementType();
4364 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4365 GEN_ERROR("Can't build string constant of size " +
4366 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4367 " when array has size " + itostr(NumElements) + "");
4368 std::vector<Constant*> Vals;
4369 if (ETy == Type::Int8Ty) {
4370 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4371 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4373 delete (yyvsp[(3) - (3)].StrVal);
4374 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4376 delete (yyvsp[(3) - (3)].StrVal);
4377 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4378 delete (yyvsp[(1) - (3)].TypeVal);
4384 #line 1593 "/llvm/lib/AsmParser/llvmAsmParser.y"
4385 { // Nonempty unsized arr
4386 if (!UpRefs.empty())
4387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4388 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4390 GEN_ERROR("Cannot make packed constant with type: '" +
4391 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4392 const Type *ETy = PTy->getElementType();
4393 int NumElements = PTy->getNumElements();
4395 // Verify that we have the correct size...
4396 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4397 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4398 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4399 itostr(NumElements) + "");
4401 // Verify all elements are correct type!
4402 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4403 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4404 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4405 ETy->getDescription() +"' as required!\nIt is of type '"+
4406 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4409 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4410 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4416 #line 1621 "/llvm/lib/AsmParser/llvmAsmParser.y"
4418 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4420 GEN_ERROR("Cannot make struct constant with type: '" +
4421 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4423 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4424 GEN_ERROR("Illegal number of initializers for structure type");
4426 // Check to ensure that constants are compatible with the type initializer!
4427 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4428 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4429 GEN_ERROR("Expected type '" +
4430 STy->getElementType(i)->getDescription() +
4431 "' for element #" + utostr(i) +
4432 " of structure initializer");
4434 // Check to ensure that Type is not packed
4435 if (STy->isPacked())
4436 GEN_ERROR("Unpacked Initializer to vector type '" +
4437 STy->getDescription() + "'");
4439 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4440 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4446 #line 1647 "/llvm/lib/AsmParser/llvmAsmParser.y"
4448 if (!UpRefs.empty())
4449 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4450 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4452 GEN_ERROR("Cannot make struct constant with type: '" +
4453 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4455 if (STy->getNumContainedTypes() != 0)
4456 GEN_ERROR("Illegal number of initializers for structure type");
4458 // Check to ensure that Type is not packed
4459 if (STy->isPacked())
4460 GEN_ERROR("Unpacked Initializer to vector type '" +
4461 STy->getDescription() + "'");
4463 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4464 delete (yyvsp[(1) - (3)].TypeVal);
4470 #line 1667 "/llvm/lib/AsmParser/llvmAsmParser.y"
4472 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4474 GEN_ERROR("Cannot make struct constant with type: '" +
4475 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4477 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4478 GEN_ERROR("Illegal number of initializers for structure type");
4480 // Check to ensure that constants are compatible with the type initializer!
4481 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4482 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4483 GEN_ERROR("Expected type '" +
4484 STy->getElementType(i)->getDescription() +
4485 "' for element #" + utostr(i) +
4486 " of structure initializer");
4488 // Check to ensure that Type is packed
4489 if (!STy->isPacked())
4490 GEN_ERROR("Vector initializer to non-vector type '" +
4491 STy->getDescription() + "'");
4493 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4494 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4500 #line 1693 "/llvm/lib/AsmParser/llvmAsmParser.y"
4502 if (!UpRefs.empty())
4503 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4504 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4506 GEN_ERROR("Cannot make struct constant with type: '" +
4507 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4509 if (STy->getNumContainedTypes() != 0)
4510 GEN_ERROR("Illegal number of initializers for structure type");
4512 // Check to ensure that Type is packed
4513 if (!STy->isPacked())
4514 GEN_ERROR("Vector initializer to non-vector type '" +
4515 STy->getDescription() + "'");
4517 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4518 delete (yyvsp[(1) - (5)].TypeVal);
4524 #line 1713 "/llvm/lib/AsmParser/llvmAsmParser.y"
4526 if (!UpRefs.empty())
4527 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4528 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4530 GEN_ERROR("Cannot make null pointer constant with type: '" +
4531 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4533 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4534 delete (yyvsp[(1) - (2)].TypeVal);
4540 #line 1725 "/llvm/lib/AsmParser/llvmAsmParser.y"
4542 if (!UpRefs.empty())
4543 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4544 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4545 delete (yyvsp[(1) - (2)].TypeVal);
4551 #line 1732 "/llvm/lib/AsmParser/llvmAsmParser.y"
4553 if (!UpRefs.empty())
4554 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4555 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4557 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4559 // ConstExprs can exist in the body of a function, thus creating
4560 // GlobalValues whenever they refer to a variable. Because we are in
4561 // the context of a function, getExistingVal will search the functions
4562 // symbol table instead of the module symbol table for the global symbol,
4563 // which throws things all off. To get around this, we just tell
4564 // getExistingVal that we are at global scope here.
4566 Function *SavedCurFn = CurFun.CurrentFunction;
4567 CurFun.CurrentFunction = 0;
4569 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4572 CurFun.CurrentFunction = SavedCurFn;
4574 // If this is an initializer for a constant pointer, which is referencing a
4575 // (currently) undefined variable, create a stub now that shall be replaced
4576 // in the future with the right type of variable.
4579 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4580 const PointerType *PT = cast<PointerType>(Ty);
4582 // First check to see if the forward references value is already created!
4583 PerModuleInfo::GlobalRefsType::iterator I =
4584 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4586 if (I != CurModule.GlobalRefs.end()) {
4587 V = I->second; // Placeholder already exists, use it...
4588 (yyvsp[(2) - (2)].ValIDVal).destroy();
4591 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4592 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4593 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4594 GEN_ERROR("Invalid reference to global");
4596 // Create the forward referenced global.
4598 if (const FunctionType *FTy =
4599 dyn_cast<FunctionType>(PT->getElementType())) {
4600 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4601 CurModule.CurrentModule);
4603 GV = new GlobalVariable(PT->getElementType(), false,
4604 GlobalValue::ExternalWeakLinkage, 0,
4605 Name, CurModule.CurrentModule);
4608 // Keep track of the fact that we have a forward ref to recycle it
4609 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4614 (yyval.ConstVal) = cast<GlobalValue>(V);
4615 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4621 #line 1798 "/llvm/lib/AsmParser/llvmAsmParser.y"
4623 if (!UpRefs.empty())
4624 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4625 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4626 GEN_ERROR("Mismatched types for constant expression: " +
4627 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4628 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4629 delete (yyvsp[(1) - (2)].TypeVal);
4635 #line 1808 "/llvm/lib/AsmParser/llvmAsmParser.y"
4637 if (!UpRefs.empty())
4638 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4639 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4640 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4641 GEN_ERROR("Cannot create a null initialized value of this type");
4642 (yyval.ConstVal) = Constant::getNullValue(Ty);
4643 delete (yyvsp[(1) - (2)].TypeVal);
4649 #line 1818 "/llvm/lib/AsmParser/llvmAsmParser.y"
4650 { // integral constants
4651 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4652 GEN_ERROR("Constant value doesn't fit in type");
4653 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4659 #line 1824 "/llvm/lib/AsmParser/llvmAsmParser.y"
4660 { // arbitrary precision integer constants
4661 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4662 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4663 GEN_ERROR("Constant value does not fit in type");
4665 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4666 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4667 delete (yyvsp[(2) - (2)].APIntVal);
4673 #line 1834 "/llvm/lib/AsmParser/llvmAsmParser.y"
4674 { // integral constants
4675 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4676 GEN_ERROR("Constant value doesn't fit in type");
4677 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4683 #line 1840 "/llvm/lib/AsmParser/llvmAsmParser.y"
4684 { // arbitrary precision integer constants
4685 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4686 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4687 GEN_ERROR("Constant value does not fit in type");
4689 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4690 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4691 delete (yyvsp[(2) - (2)].APIntVal);
4697 #line 1850 "/llvm/lib/AsmParser/llvmAsmParser.y"
4698 { // Boolean constants
4699 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4700 (yyval.ConstVal) = ConstantInt::getTrue();
4706 #line 1855 "/llvm/lib/AsmParser/llvmAsmParser.y"
4707 { // Boolean constants
4708 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4709 (yyval.ConstVal) = ConstantInt::getFalse();
4715 #line 1860 "/llvm/lib/AsmParser/llvmAsmParser.y"
4716 { // Floating point constants
4717 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4718 GEN_ERROR("Floating point constant invalid for type");
4719 // Lexer has no type info, so builds all float and double FP constants
4720 // as double. Fix this here. Long double is done right.
4721 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4722 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4723 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4724 delete (yyvsp[(2) - (2)].FPVal);
4730 #line 1873 "/llvm/lib/AsmParser/llvmAsmParser.y"
4732 if (!UpRefs.empty())
4733 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4734 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4735 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4736 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4737 GEN_ERROR("invalid cast opcode for cast from '" +
4738 Val->getType()->getDescription() + "' to '" +
4739 DestTy->getDescription() + "'");
4740 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4741 delete (yyvsp[(5) - (6)].TypeVal);
4746 #line 1885 "/llvm/lib/AsmParser/llvmAsmParser.y"
4748 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4749 GEN_ERROR("GetElementPtr requires a pointer operand");
4752 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4755 GEN_ERROR("Index list invalid for constant getelementptr");
4757 SmallVector<Constant*, 8> IdxVec;
4758 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4759 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4760 IdxVec.push_back(C);
4762 GEN_ERROR("Indices to constant getelementptr must be constants");
4764 delete (yyvsp[(4) - (5)].ValueList);
4766 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4772 #line 1907 "/llvm/lib/AsmParser/llvmAsmParser.y"
4774 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4775 GEN_ERROR("Select condition must be of boolean type");
4776 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4777 GEN_ERROR("Select operand types must match");
4778 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4784 #line 1915 "/llvm/lib/AsmParser/llvmAsmParser.y"
4786 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4787 GEN_ERROR("Binary operator types must match");
4789 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4794 #line 1921 "/llvm/lib/AsmParser/llvmAsmParser.y"
4796 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4797 GEN_ERROR("Logical operator types must match");
4798 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4799 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4800 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4801 GEN_ERROR("Logical operator requires integral operands");
4803 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4809 #line 1932 "/llvm/lib/AsmParser/llvmAsmParser.y"
4811 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4812 GEN_ERROR("icmp operand types must match");
4813 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4818 #line 1937 "/llvm/lib/AsmParser/llvmAsmParser.y"
4820 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4821 GEN_ERROR("fcmp operand types must match");
4822 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4827 #line 1942 "/llvm/lib/AsmParser/llvmAsmParser.y"
4829 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4830 GEN_ERROR("vicmp operand types must match");
4831 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4836 #line 1947 "/llvm/lib/AsmParser/llvmAsmParser.y"
4838 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4839 GEN_ERROR("vfcmp operand types must match");
4840 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4845 #line 1952 "/llvm/lib/AsmParser/llvmAsmParser.y"
4847 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4848 GEN_ERROR("Invalid extractelement operands");
4849 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4855 #line 1958 "/llvm/lib/AsmParser/llvmAsmParser.y"
4857 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4858 GEN_ERROR("Invalid insertelement operands");
4859 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4865 #line 1964 "/llvm/lib/AsmParser/llvmAsmParser.y"
4867 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4868 GEN_ERROR("Invalid shufflevector operands");
4869 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4875 #line 1973 "/llvm/lib/AsmParser/llvmAsmParser.y"
4877 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4883 #line 1977 "/llvm/lib/AsmParser/llvmAsmParser.y"
4885 (yyval.ConstVector) = new std::vector<Constant*>();
4886 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4892 #line 1985 "/llvm/lib/AsmParser/llvmAsmParser.y"
4893 { (yyval.BoolVal) = false; ;}
4897 #line 1985 "/llvm/lib/AsmParser/llvmAsmParser.y"
4898 { (yyval.BoolVal) = true; ;}
4902 #line 1988 "/llvm/lib/AsmParser/llvmAsmParser.y"
4903 { (yyval.BoolVal) = true; ;}
4907 #line 1988 "/llvm/lib/AsmParser/llvmAsmParser.y"
4908 { (yyval.BoolVal) = false; ;}
4912 #line 1991 "/llvm/lib/AsmParser/llvmAsmParser.y"
4914 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4915 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4917 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4919 GEN_ERROR("Aliases can be created only to global values");
4921 (yyval.ConstVal) = Aliasee;
4923 delete (yyvsp[(1) - (2)].TypeVal);
4928 #line 2003 "/llvm/lib/AsmParser/llvmAsmParser.y"
4930 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4931 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4932 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4933 GEN_ERROR("invalid cast opcode for cast from '" +
4934 Val->getType()->getDescription() + "' to '" +
4935 DestTy->getDescription() + "'");
4937 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4939 delete (yyvsp[(5) - (6)].TypeVal);
4944 #line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y"
4946 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4947 CurModule.ModuleDone();
4953 #line 2029 "/llvm/lib/AsmParser/llvmAsmParser.y"
4955 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4956 CurModule.ModuleDone();
4962 #line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y"
4963 { CurFun.isDeclare = false; ;}
4967 #line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y"
4969 CurFun.FunctionDone();
4975 #line 2046 "/llvm/lib/AsmParser/llvmAsmParser.y"
4976 { CurFun.isDeclare = true; ;}
4980 #line 2046 "/llvm/lib/AsmParser/llvmAsmParser.y"
4987 #line 2049 "/llvm/lib/AsmParser/llvmAsmParser.y"
4994 #line 2052 "/llvm/lib/AsmParser/llvmAsmParser.y"
4996 if (!UpRefs.empty())
4997 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4998 // Eagerly resolve types. This is not an optimization, this is a
4999 // requirement that is due to the fact that we could have this:
5001 // %list = type { %list * }
5002 // %list = type { %list * } ; repeated type decl
5004 // If types are not resolved eagerly, then the two types will not be
5005 // determined to be the same type!
5007 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5009 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5011 // If this is a named type that is not a redefinition, add it to the slot
5013 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5016 delete (yyvsp[(3) - (3)].TypeVal);
5022 #line 2076 "/llvm/lib/AsmParser/llvmAsmParser.y"
5024 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5026 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5028 // If this is a named type that is not a redefinition, add it to the slot
5030 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5037 #line 2088 "/llvm/lib/AsmParser/llvmAsmParser.y"
5039 /* "Externally Visible" Linkage */
5040 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5041 GEN_ERROR("Global value initializer is not a constant");
5042 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5043 (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal));
5049 #line 2095 "/llvm/lib/AsmParser/llvmAsmParser.y"
5056 #line 2099 "/llvm/lib/AsmParser/llvmAsmParser.y"
5058 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5059 GEN_ERROR("Global value initializer is not a constant");
5060 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5066 #line 2104 "/llvm/lib/AsmParser/llvmAsmParser.y"
5073 #line 2108 "/llvm/lib/AsmParser/llvmAsmParser.y"
5075 if (!UpRefs.empty())
5076 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5077 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5079 delete (yyvsp[(6) - (7)].TypeVal);
5084 #line 2114 "/llvm/lib/AsmParser/llvmAsmParser.y"
5092 #line 2118 "/llvm/lib/AsmParser/llvmAsmParser.y"
5095 if ((yyvsp[(1) - (5)].StrVal)) {
5096 Name = *(yyvsp[(1) - (5)].StrVal);
5097 delete (yyvsp[(1) - (5)].StrVal);
5100 GEN_ERROR("Alias name cannot be empty");
5102 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5104 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5106 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5107 CurModule.CurrentModule);
5108 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5109 InsertValue(GA, CurModule.Values);
5112 // If there was a forward reference of this alias, resolve it now.
5116 ID = ValID::createGlobalName(Name);
5118 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5120 if (GlobalValue *FWGV =
5121 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5122 // Replace uses of the fwdref with the actual alias.
5123 FWGV->replaceAllUsesWith(GA);
5124 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5125 GV->eraseFromParent();
5127 cast<Function>(FWGV)->eraseFromParent();
5136 #line 2158 "/llvm/lib/AsmParser/llvmAsmParser.y"
5143 #line 2161 "/llvm/lib/AsmParser/llvmAsmParser.y"
5150 #line 2167 "/llvm/lib/AsmParser/llvmAsmParser.y"
5152 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5153 if (AsmSoFar.empty())
5154 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5156 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5157 delete (yyvsp[(1) - (1)].StrVal);
5163 #line 2177 "/llvm/lib/AsmParser/llvmAsmParser.y"
5165 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5166 delete (yyvsp[(3) - (3)].StrVal);
5171 #line 2181 "/llvm/lib/AsmParser/llvmAsmParser.y"
5173 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5174 delete (yyvsp[(3) - (3)].StrVal);
5179 #line 2188 "/llvm/lib/AsmParser/llvmAsmParser.y"
5181 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5182 delete (yyvsp[(3) - (3)].StrVal);
5188 #line 2193 "/llvm/lib/AsmParser/llvmAsmParser.y"
5190 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5191 delete (yyvsp[(1) - (1)].StrVal);
5197 #line 2198 "/llvm/lib/AsmParser/llvmAsmParser.y"
5204 #line 2207 "/llvm/lib/AsmParser/llvmAsmParser.y"
5206 if (!UpRefs.empty())
5207 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5208 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5209 GEN_ERROR("void typed arguments are invalid");
5210 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5211 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5212 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5218 #line 2217 "/llvm/lib/AsmParser/llvmAsmParser.y"
5220 if (!UpRefs.empty())
5221 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5222 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5223 GEN_ERROR("void typed arguments are invalid");
5224 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5225 (yyval.ArgList) = new ArgListType;
5226 (yyval.ArgList)->push_back(E);
5232 #line 2228 "/llvm/lib/AsmParser/llvmAsmParser.y"
5234 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5240 #line 2232 "/llvm/lib/AsmParser/llvmAsmParser.y"
5242 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5243 struct ArgListEntry E;
5244 E.Ty = new PATypeHolder(Type::VoidTy);
5246 E.Attrs = ParamAttr::None;
5247 (yyval.ArgList)->push_back(E);
5253 #line 2241 "/llvm/lib/AsmParser/llvmAsmParser.y"
5255 (yyval.ArgList) = new ArgListType;
5256 struct ArgListEntry E;
5257 E.Ty = new PATypeHolder(Type::VoidTy);
5259 E.Attrs = ParamAttr::None;
5260 (yyval.ArgList)->push_back(E);
5266 #line 2250 "/llvm/lib/AsmParser/llvmAsmParser.y"
5268 (yyval.ArgList) = 0;
5274 #line 2256 "/llvm/lib/AsmParser/llvmAsmParser.y"
5276 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5277 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5279 // Check the function result for abstractness if this is a define. We should
5280 // have no abstract types at this point
5281 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5282 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5284 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5285 GEN_ERROR("Invalid result type for LLVM function");
5287 std::vector<const Type*> ParamTypeList;
5288 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5289 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5290 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5291 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5293 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5294 const Type* Ty = I->Ty->get();
5295 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5296 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5297 ParamTypeList.push_back(Ty);
5298 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5299 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5303 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5304 if (isVarArg) ParamTypeList.pop_back();
5308 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5310 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5311 const PointerType *PFT = PointerType::getUnqual(FT);
5312 delete (yyvsp[(2) - (10)].TypeVal);
5315 if (!FunctionName.empty()) {
5316 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5318 ID = ValID::createGlobalID(CurModule.Values.size());
5322 // See if this function was forward referenced. If so, recycle the object.
5323 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5324 // Move the function to the end of the list, from whereever it was
5325 // previously inserted.
5326 Fn = cast<Function>(FWRef);
5327 assert(Fn->getParamAttrs().isEmpty() &&
5328 "Forward reference has parameter attributes!");
5329 CurModule.CurrentModule->getFunctionList().remove(Fn);
5330 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5331 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5332 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5333 if (Fn->getFunctionType() != FT ) {
5334 // The existing function doesn't have the same type. This is an overload
5336 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5337 } else if (Fn->getParamAttrs() != PAL) {
5338 // The existing function doesn't have the same parameter attributes.
5339 // This is an overload error.
5340 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5341 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5342 // Neither the existing or the current function is a declaration and they
5343 // have the same name and same type. Clearly this is a redefinition.
5344 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5345 } else if (Fn->isDeclaration()) {
5346 // Make sure to strip off any argument names so we can't get conflicts.
5347 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5351 } else { // Not already defined?
5352 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5353 CurModule.CurrentModule);
5354 InsertValue(Fn, CurModule.Values);
5357 CurFun.FunctionStart(Fn);
5359 if (CurFun.isDeclare) {
5360 // If we have declaration, always overwrite linkage. This will allow us to
5361 // correctly handle cases, when pointer to function is passed as argument to
5362 // another function.
5363 Fn->setLinkage(CurFun.Linkage);
5364 Fn->setVisibility(CurFun.Visibility);
5366 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5367 Fn->setParamAttrs(PAL);
5368 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5369 if ((yyvsp[(8) - (10)].StrVal)) {
5370 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5371 delete (yyvsp[(8) - (10)].StrVal);
5373 if ((yyvsp[(10) - (10)].StrVal)) {
5374 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5375 delete (yyvsp[(10) - (10)].StrVal);
5378 // Add all of the arguments we parsed to the function...
5379 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5380 if (isVarArg) { // Nuke the last entry
5381 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5382 "Not a varargs marker!");
5383 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5384 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5386 Function::arg_iterator ArgIt = Fn->arg_begin();
5387 Function::arg_iterator ArgEnd = Fn->arg_end();
5389 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5390 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5391 delete I->Ty; // Delete the typeholder...
5392 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5398 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5405 #line 2386 "/llvm/lib/AsmParser/llvmAsmParser.y"
5407 (yyval.FunctionVal) = CurFun.CurrentFunction;
5409 // Make sure that we keep track of the linkage type even if there was a
5410 // previous "declare".
5411 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5412 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5417 #line 2397 "/llvm/lib/AsmParser/llvmAsmParser.y"
5419 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5425 #line 2402 "/llvm/lib/AsmParser/llvmAsmParser.y"
5427 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5428 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5429 (yyval.FunctionVal) = CurFun.CurrentFunction;
5430 CurFun.FunctionDone();
5436 #line 2414 "/llvm/lib/AsmParser/llvmAsmParser.y"
5438 (yyval.BoolVal) = false;
5444 #line 2418 "/llvm/lib/AsmParser/llvmAsmParser.y"
5446 (yyval.BoolVal) = true;
5452 #line 2423 "/llvm/lib/AsmParser/llvmAsmParser.y"
5453 { // A reference to a direct constant
5454 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5460 #line 2427 "/llvm/lib/AsmParser/llvmAsmParser.y"
5462 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5468 #line 2431 "/llvm/lib/AsmParser/llvmAsmParser.y"
5469 { // Perhaps it's an FP constant?
5470 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5476 #line 2435 "/llvm/lib/AsmParser/llvmAsmParser.y"
5478 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5484 #line 2439 "/llvm/lib/AsmParser/llvmAsmParser.y"
5486 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5492 #line 2443 "/llvm/lib/AsmParser/llvmAsmParser.y"
5494 (yyval.ValIDVal) = ValID::createNull();
5500 #line 2447 "/llvm/lib/AsmParser/llvmAsmParser.y"
5502 (yyval.ValIDVal) = ValID::createUndef();
5508 #line 2451 "/llvm/lib/AsmParser/llvmAsmParser.y"
5509 { // A vector zero constant.
5510 (yyval.ValIDVal) = ValID::createZeroInit();
5516 #line 2455 "/llvm/lib/AsmParser/llvmAsmParser.y"
5517 { // Nonempty unsized packed vector
5518 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5519 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5521 VectorType* pt = VectorType::get(ETy, NumElements);
5522 PATypeHolder* PTy = new PATypeHolder(
5530 // Verify all elements are correct type!
5531 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5532 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5533 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5534 ETy->getDescription() +"' as required!\nIt is of type '" +
5535 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5538 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5539 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5545 #line 2480 "/llvm/lib/AsmParser/llvmAsmParser.y"
5547 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5553 #line 2484 "/llvm/lib/AsmParser/llvmAsmParser.y"
5555 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5556 delete (yyvsp[(3) - (5)].StrVal);
5557 delete (yyvsp[(5) - (5)].StrVal);
5563 #line 2494 "/llvm/lib/AsmParser/llvmAsmParser.y"
5564 { // Is it an integer reference...?
5565 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5571 #line 2498 "/llvm/lib/AsmParser/llvmAsmParser.y"
5573 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5579 #line 2502 "/llvm/lib/AsmParser/llvmAsmParser.y"
5580 { // Is it a named reference...?
5581 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5582 delete (yyvsp[(1) - (1)].StrVal);
5588 #line 2507 "/llvm/lib/AsmParser/llvmAsmParser.y"
5589 { // Is it a named reference...?
5590 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5591 delete (yyvsp[(1) - (1)].StrVal);
5597 #line 2520 "/llvm/lib/AsmParser/llvmAsmParser.y"
5599 if (!UpRefs.empty())
5600 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5601 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5602 delete (yyvsp[(1) - (2)].TypeVal);
5608 #line 2529 "/llvm/lib/AsmParser/llvmAsmParser.y"
5610 (yyval.ValueList) = new std::vector<Value *>();
5611 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5617 #line 2534 "/llvm/lib/AsmParser/llvmAsmParser.y"
5619 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5625 #line 2539 "/llvm/lib/AsmParser/llvmAsmParser.y"
5627 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5633 #line 2543 "/llvm/lib/AsmParser/llvmAsmParser.y"
5634 { // Do not allow functions with 0 basic blocks
5635 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5641 #line 2552 "/llvm/lib/AsmParser/llvmAsmParser.y"
5643 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5645 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5646 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5647 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5653 #line 2561 "/llvm/lib/AsmParser/llvmAsmParser.y"
5655 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5656 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5657 if (CI2->getParent() == 0)
5658 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5659 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5660 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5666 #line 2570 "/llvm/lib/AsmParser/llvmAsmParser.y"
5667 { // Empty space between instruction lists
5668 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5674 #line 2574 "/llvm/lib/AsmParser/llvmAsmParser.y"
5675 { // Labelled (named) basic block
5676 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5677 delete (yyvsp[(1) - (1)].StrVal);
5684 #line 2582 "/llvm/lib/AsmParser/llvmAsmParser.y"
5685 { // Return with a result...
5686 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5687 assert(!VL.empty() && "Invalid ret operands!");
5688 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5689 delete (yyvsp[(2) - (2)].ValueList);
5695 #line 2589 "/llvm/lib/AsmParser/llvmAsmParser.y"
5696 { // Return with no result...
5697 (yyval.TermInstVal) = ReturnInst::Create();
5703 #line 2593 "/llvm/lib/AsmParser/llvmAsmParser.y"
5704 { // Unconditional Branch...
5705 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5707 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5712 #line 2598 "/llvm/lib/AsmParser/llvmAsmParser.y"
5714 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5715 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5717 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5719 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5721 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5726 #line 2608 "/llvm/lib/AsmParser/llvmAsmParser.y"
5728 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5730 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5732 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5733 (yyval.TermInstVal) = S;
5735 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5736 E = (yyvsp[(8) - (9)].JumpTable)->end();
5737 for (; I != E; ++I) {
5738 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5739 S->addCase(CI, I->second);
5741 GEN_ERROR("Switch case is constant, but not a simple integer");
5743 delete (yyvsp[(8) - (9)].JumpTable);
5749 #line 2627 "/llvm/lib/AsmParser/llvmAsmParser.y"
5751 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5753 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5755 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
5756 (yyval.TermInstVal) = S;
5762 #line 2637 "/llvm/lib/AsmParser/llvmAsmParser.y"
5765 // Handle the short syntax
5766 const PointerType *PFTy = 0;
5767 const FunctionType *Ty = 0;
5768 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5769 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5770 // Pull out the types of all of the arguments...
5771 std::vector<const Type*> ParamTypes;
5772 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5773 for (; I != E; ++I) {
5774 const Type *Ty = I->Val->getType();
5775 if (Ty == Type::VoidTy)
5776 GEN_ERROR("Short call syntax cannot be used with varargs");
5777 ParamTypes.push_back(Ty);
5780 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5781 GEN_ERROR("Invalid result type for LLVM function");
5783 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5784 PFTy = PointerType::getUnqual(Ty);
5787 delete (yyvsp[(3) - (14)].TypeVal);
5789 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5791 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5793 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5796 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5797 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5798 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
5800 // Check the arguments
5802 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5803 // Make sure no arguments is a good thing!
5804 if (Ty->getNumParams() != 0)
5805 GEN_ERROR("No arguments passed to a function that "
5806 "expects arguments");
5807 } else { // Has arguments?
5808 // Loop through FunctionType's arguments and ensure they are specified
5810 FunctionType::param_iterator I = Ty->param_begin();
5811 FunctionType::param_iterator E = Ty->param_end();
5812 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5815 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5816 if (ArgI->Val->getType() != *I)
5817 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5818 (*I)->getDescription() + "'");
5819 Args.push_back(ArgI->Val);
5820 if (ArgI->Attrs != ParamAttr::None)
5821 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5824 if (Ty->isVarArg()) {
5826 for (; ArgI != ArgE; ++ArgI, ++index) {
5827 Args.push_back(ArgI->Val); // push the remaining varargs
5828 if (ArgI->Attrs != ParamAttr::None)
5829 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5831 } else if (I != E || ArgI != ArgE)
5832 GEN_ERROR("Invalid number of parameters detected");
5837 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5839 // Create the InvokeInst
5840 InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end());
5841 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5842 II->setParamAttrs(PAL);
5843 (yyval.TermInstVal) = II;
5844 delete (yyvsp[(6) - (14)].ParamList);
5850 #line 2721 "/llvm/lib/AsmParser/llvmAsmParser.y"
5852 (yyval.TermInstVal) = new UnwindInst();
5858 #line 2725 "/llvm/lib/AsmParser/llvmAsmParser.y"
5860 (yyval.TermInstVal) = new UnreachableInst();
5866 #line 2732 "/llvm/lib/AsmParser/llvmAsmParser.y"
5868 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5869 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5872 GEN_ERROR("May only switch on a constant pool value");
5874 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5876 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5881 #line 2743 "/llvm/lib/AsmParser/llvmAsmParser.y"
5883 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5884 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5888 GEN_ERROR("May only switch on a constant pool value");
5890 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5892 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5897 #line 2756 "/llvm/lib/AsmParser/llvmAsmParser.y"
5899 // Is this definition named?? if so, assign the name...
5900 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5902 InsertValue((yyvsp[(2) - (2)].InstVal));
5903 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5909 #line 2766 "/llvm/lib/AsmParser/llvmAsmParser.y"
5910 { // Used for PHI nodes
5911 if (!UpRefs.empty())
5912 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5913 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5914 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5916 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5918 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5919 delete (yyvsp[(1) - (6)].TypeVal);
5924 #line 2777 "/llvm/lib/AsmParser/llvmAsmParser.y"
5926 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5927 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5929 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5931 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5936 #line 2787 "/llvm/lib/AsmParser/llvmAsmParser.y"
5938 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5939 if (!UpRefs.empty())
5940 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5941 // Used for call and invoke instructions
5942 (yyval.ParamList) = new ParamList();
5943 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5944 (yyval.ParamList)->push_back(E);
5945 delete (yyvsp[(1) - (4)].TypeVal);
5951 #line 2798 "/llvm/lib/AsmParser/llvmAsmParser.y"
5953 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5954 // Labels are only valid in ASMs
5955 (yyval.ParamList) = new ParamList();
5956 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5957 (yyval.ParamList)->push_back(E);
5963 #line 2806 "/llvm/lib/AsmParser/llvmAsmParser.y"
5965 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5966 if (!UpRefs.empty())
5967 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5968 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5969 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5970 (yyval.ParamList)->push_back(E);
5971 delete (yyvsp[(3) - (6)].TypeVal);
5977 #line 2816 "/llvm/lib/AsmParser/llvmAsmParser.y"
5979 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5980 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5981 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5982 (yyval.ParamList)->push_back(E);
5988 #line 2823 "/llvm/lib/AsmParser/llvmAsmParser.y"
5989 { (yyval.ParamList) = new ParamList(); ;}
5993 #line 2826 "/llvm/lib/AsmParser/llvmAsmParser.y"
5994 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5998 #line 2827 "/llvm/lib/AsmParser/llvmAsmParser.y"
6000 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6001 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6007 #line 2834 "/llvm/lib/AsmParser/llvmAsmParser.y"
6009 (yyval.BoolVal) = true;
6015 #line 2838 "/llvm/lib/AsmParser/llvmAsmParser.y"
6017 (yyval.BoolVal) = false;
6023 #line 2843 "/llvm/lib/AsmParser/llvmAsmParser.y"
6025 if (!UpRefs.empty())
6026 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6027 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6028 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6030 "Arithmetic operator requires integer, FP, or packed operands");
6031 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6033 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6035 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6036 if ((yyval.InstVal) == 0)
6037 GEN_ERROR("binary operator returned null");
6038 delete (yyvsp[(2) - (5)].TypeVal);
6043 #line 2859 "/llvm/lib/AsmParser/llvmAsmParser.y"
6045 if (!UpRefs.empty())
6046 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6047 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6048 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6049 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6050 GEN_ERROR("Logical operator requires integral operands");
6052 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6054 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6056 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6057 if ((yyval.InstVal) == 0)
6058 GEN_ERROR("binary operator returned null");
6059 delete (yyvsp[(2) - (5)].TypeVal);
6064 #line 2876 "/llvm/lib/AsmParser/llvmAsmParser.y"
6066 if (!UpRefs.empty())
6067 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6068 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6069 GEN_ERROR("Vector types not supported by icmp instruction");
6070 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6072 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6074 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6075 if ((yyval.InstVal) == 0)
6076 GEN_ERROR("icmp operator returned null");
6077 delete (yyvsp[(3) - (6)].TypeVal);
6082 #line 2890 "/llvm/lib/AsmParser/llvmAsmParser.y"
6084 if (!UpRefs.empty())
6085 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6086 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6087 GEN_ERROR("Vector types not supported by fcmp instruction");
6088 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6090 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6092 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6093 if ((yyval.InstVal) == 0)
6094 GEN_ERROR("fcmp operator returned null");
6095 delete (yyvsp[(3) - (6)].TypeVal);
6100 #line 2904 "/llvm/lib/AsmParser/llvmAsmParser.y"
6102 if (!UpRefs.empty())
6103 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6104 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6105 GEN_ERROR("Scalar types not supported by vicmp instruction");
6106 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6108 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6110 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6111 if ((yyval.InstVal) == 0)
6112 GEN_ERROR("icmp operator returned null");
6113 delete (yyvsp[(3) - (6)].TypeVal);
6118 #line 2918 "/llvm/lib/AsmParser/llvmAsmParser.y"
6120 if (!UpRefs.empty())
6121 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6122 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6123 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6124 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6126 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6128 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6129 if ((yyval.InstVal) == 0)
6130 GEN_ERROR("fcmp operator returned null");
6131 delete (yyvsp[(3) - (6)].TypeVal);
6136 #line 2932 "/llvm/lib/AsmParser/llvmAsmParser.y"
6138 if (!UpRefs.empty())
6139 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6140 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6141 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6142 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6143 GEN_ERROR("invalid cast opcode for cast from '" +
6144 Val->getType()->getDescription() + "' to '" +
6145 DestTy->getDescription() + "'");
6146 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6147 delete (yyvsp[(4) - (4)].TypeVal);
6152 #line 2944 "/llvm/lib/AsmParser/llvmAsmParser.y"
6154 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6155 GEN_ERROR("select condition must be boolean");
6156 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6157 GEN_ERROR("select value types should match");
6158 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6164 #line 2952 "/llvm/lib/AsmParser/llvmAsmParser.y"
6166 if (!UpRefs.empty())
6167 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6168 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6169 delete (yyvsp[(4) - (4)].TypeVal);
6175 #line 2959 "/llvm/lib/AsmParser/llvmAsmParser.y"
6177 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6178 GEN_ERROR("Invalid extractelement operands");
6179 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6185 #line 2965 "/llvm/lib/AsmParser/llvmAsmParser.y"
6187 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6188 GEN_ERROR("Invalid insertelement operands");
6189 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6195 #line 2971 "/llvm/lib/AsmParser/llvmAsmParser.y"
6197 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6198 GEN_ERROR("Invalid shufflevector operands");
6199 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6205 #line 2977 "/llvm/lib/AsmParser/llvmAsmParser.y"
6207 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6208 if (!Ty->isFirstClassType())
6209 GEN_ERROR("PHI node operands must be of first class type");
6210 (yyval.InstVal) = PHINode::Create(Ty);
6211 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6212 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6213 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6214 GEN_ERROR("All elements of a PHI node must be of the same type");
6215 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6216 (yyvsp[(2) - (2)].PHIList)->pop_front();
6218 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6224 #line 2993 "/llvm/lib/AsmParser/llvmAsmParser.y"
6227 // Handle the short syntax
6228 const PointerType *PFTy = 0;
6229 const FunctionType *Ty = 0;
6230 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6231 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6232 // Pull out the types of all of the arguments...
6233 std::vector<const Type*> ParamTypes;
6234 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6235 for (; I != E; ++I) {
6236 const Type *Ty = I->Val->getType();
6237 if (Ty == Type::VoidTy)
6238 GEN_ERROR("Short call syntax cannot be used with varargs");
6239 ParamTypes.push_back(Ty);
6242 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6243 GEN_ERROR("Invalid result type for LLVM function");
6245 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6246 PFTy = PointerType::getUnqual(Ty);
6249 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6252 // Check for call to invalid intrinsic to avoid crashing later.
6253 if (Function *theF = dyn_cast<Function>(V)) {
6254 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6255 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6256 !theF->getIntrinsicID(true))
6257 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6258 theF->getName() + "'");
6261 // Set up the ParamAttrs for the function
6262 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6263 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6264 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6265 // Check the arguments
6267 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6268 // Make sure no arguments is a good thing!
6269 if (Ty->getNumParams() != 0)
6270 GEN_ERROR("No arguments passed to a function that "
6271 "expects arguments");
6272 } else { // Has arguments?
6273 // Loop through FunctionType's arguments and ensure they are specified
6274 // correctly. Also, gather any parameter attributes.
6275 FunctionType::param_iterator I = Ty->param_begin();
6276 FunctionType::param_iterator E = Ty->param_end();
6277 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6280 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6281 if (ArgI->Val->getType() != *I)
6282 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6283 (*I)->getDescription() + "'");
6284 Args.push_back(ArgI->Val);
6285 if (ArgI->Attrs != ParamAttr::None)
6286 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6288 if (Ty->isVarArg()) {
6290 for (; ArgI != ArgE; ++ArgI, ++index) {
6291 Args.push_back(ArgI->Val); // push the remaining varargs
6292 if (ArgI->Attrs != ParamAttr::None)
6293 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6295 } else if (I != E || ArgI != ArgE)
6296 GEN_ERROR("Invalid number of parameters detected");
6299 // Finish off the ParamAttrs and check them
6302 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6304 // Create the call node
6305 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6306 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6307 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6308 CI->setParamAttrs(PAL);
6309 (yyval.InstVal) = CI;
6310 delete (yyvsp[(6) - (8)].ParamList);
6311 delete (yyvsp[(3) - (8)].TypeVal);
6317 #line 3082 "/llvm/lib/AsmParser/llvmAsmParser.y"
6319 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6325 #line 3087 "/llvm/lib/AsmParser/llvmAsmParser.y"
6327 (yyval.BoolVal) = true;
6333 #line 3091 "/llvm/lib/AsmParser/llvmAsmParser.y"
6335 (yyval.BoolVal) = false;
6341 #line 3098 "/llvm/lib/AsmParser/llvmAsmParser.y"
6343 if (!UpRefs.empty())
6344 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6345 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6346 delete (yyvsp[(2) - (3)].TypeVal);
6352 #line 3105 "/llvm/lib/AsmParser/llvmAsmParser.y"
6354 if (!UpRefs.empty())
6355 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6356 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6358 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6359 delete (yyvsp[(2) - (6)].TypeVal);
6364 #line 3113 "/llvm/lib/AsmParser/llvmAsmParser.y"
6366 if (!UpRefs.empty())
6367 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6368 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6369 delete (yyvsp[(2) - (3)].TypeVal);
6375 #line 3120 "/llvm/lib/AsmParser/llvmAsmParser.y"
6377 if (!UpRefs.empty())
6378 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6379 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6381 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6382 delete (yyvsp[(2) - (6)].TypeVal);
6387 #line 3128 "/llvm/lib/AsmParser/llvmAsmParser.y"
6389 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6390 GEN_ERROR("Trying to free nonpointer type " +
6391 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6392 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6398 #line 3136 "/llvm/lib/AsmParser/llvmAsmParser.y"
6400 if (!UpRefs.empty())
6401 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6402 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6403 GEN_ERROR("Can't load from nonpointer type: " +
6404 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6405 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6406 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6407 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6408 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6410 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6411 delete (yyvsp[(3) - (5)].TypeVal);
6416 #line 3150 "/llvm/lib/AsmParser/llvmAsmParser.y"
6418 if (!UpRefs.empty())
6419 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6420 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6422 GEN_ERROR("Can't store to a nonpointer type: " +
6423 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6424 const Type *ElTy = PT->getElementType();
6425 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6426 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6427 "' into space of type '" + ElTy->getDescription() + "'");
6429 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6431 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6432 delete (yyvsp[(5) - (7)].TypeVal);
6437 #line 3167 "/llvm/lib/AsmParser/llvmAsmParser.y"
6439 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6440 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6441 GEN_ERROR("Invalid getresult operands");
6442 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6443 delete (yyvsp[(2) - (5)].TypeVal);
6449 #line 3175 "/llvm/lib/AsmParser/llvmAsmParser.y"
6451 if (!UpRefs.empty())
6452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6453 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6454 GEN_ERROR("getelementptr insn requires pointer operand");
6456 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6457 GEN_ERROR("Invalid getelementptr indices for type '" +
6458 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6459 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6461 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6462 delete (yyvsp[(2) - (4)].TypeVal);
6463 delete (yyvsp[(4) - (4)].ValueList);
6468 /* Line 1267 of yacc.c. */
6469 #line 6470 "llvmAsmParser.tab.c"
6472 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6476 YY_STACK_PRINT (yyss, yyssp);
6481 /* Now `shift' the result of the reduction. Determine what state
6482 that goes to, based on the state we popped back to and the rule
6483 number reduced by. */
6487 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6488 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6489 yystate = yytable[yystate];
6491 yystate = yydefgoto[yyn - YYNTOKENS];
6496 /*------------------------------------.
6497 | yyerrlab -- here on detecting error |
6498 `------------------------------------*/
6500 /* If not already recovering from an error, report this error. */
6504 #if ! YYERROR_VERBOSE
6505 yyerror (YY_("syntax error"));
6508 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6509 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6511 YYSIZE_T yyalloc = 2 * yysize;
6512 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6513 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6514 if (yymsg != yymsgbuf)
6515 YYSTACK_FREE (yymsg);
6516 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6518 yymsg_alloc = yyalloc;
6522 yymsg_alloc = sizeof yymsgbuf;
6526 if (0 < yysize && yysize <= yymsg_alloc)
6528 (void) yysyntax_error (yymsg, yystate, yychar);
6533 yyerror (YY_("syntax error"));
6535 goto yyexhaustedlab;
6543 if (yyerrstatus == 3)
6545 /* If just tried and failed to reuse look-ahead token after an
6546 error, discard it. */
6548 if (yychar <= YYEOF)
6550 /* Return failure if at end of input. */
6551 if (yychar == YYEOF)
6556 yydestruct ("Error: discarding",
6562 /* Else will try to reuse look-ahead token after shifting the error
6567 /*---------------------------------------------------.
6568 | yyerrorlab -- error raised explicitly by YYERROR. |
6569 `---------------------------------------------------*/
6572 /* Pacify compilers like GCC when the user code never invokes
6573 YYERROR and the label yyerrorlab therefore never appears in user
6575 if (/*CONSTCOND*/ 0)
6578 /* Do not reclaim the symbols of the rule which action triggered
6582 YY_STACK_PRINT (yyss, yyssp);
6587 /*-------------------------------------------------------------.
6588 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6589 `-------------------------------------------------------------*/
6591 yyerrstatus = 3; /* Each real token shifted decrements this. */
6595 yyn = yypact[yystate];
6596 if (yyn != YYPACT_NINF)
6599 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6607 /* Pop the current state because it cannot handle the error token. */
6612 yydestruct ("Error: popping",
6613 yystos[yystate], yyvsp);
6616 YY_STACK_PRINT (yyss, yyssp);
6625 /* Shift the error token. */
6626 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6632 /*-------------------------------------.
6633 | yyacceptlab -- YYACCEPT comes here. |
6634 `-------------------------------------*/
6639 /*-----------------------------------.
6640 | yyabortlab -- YYABORT comes here. |
6641 `-----------------------------------*/
6647 /*-------------------------------------------------.
6648 | yyexhaustedlab -- memory exhaustion comes here. |
6649 `-------------------------------------------------*/
6651 yyerror (YY_("memory exhausted"));
6657 if (yychar != YYEOF && yychar != YYEMPTY)
6658 yydestruct ("Cleanup: discarding lookahead",
6660 /* Do not reclaim the symbols of the rule which action triggered
6661 this YYABORT or YYACCEPT. */
6663 YY_STACK_PRINT (yyss, yyssp);
6664 while (yyssp != yyss)
6666 yydestruct ("Cleanup: popping",
6667 yystos[*yyssp], yyvsp);
6672 YYSTACK_FREE (yyss);
6675 if (yymsg != yymsgbuf)
6676 YYSTACK_FREE (yymsg);
6678 /* Make sure YYID is used. */
6679 return YYID (yyresult);
6683 #line 3192 "/llvm/lib/AsmParser/llvmAsmParser.y"
6686 // common code from the two 'RunVMAsmParser' functions
6687 static Module* RunParser(Module * M) {
6688 CurModule.CurrentModule = M;
6689 // Check to make sure the parser succeeded
6692 delete ParserResult;
6696 // Emit an error if there are any unresolved types left.
6697 if (!CurModule.LateResolveTypes.empty()) {
6698 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6699 if (DID.Type == ValID::LocalName) {
6700 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6702 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6705 delete ParserResult;
6709 // Emit an error if there are any unresolved values left.
6710 if (!CurModule.LateResolveValues.empty()) {
6711 Value *V = CurModule.LateResolveValues.back();
6712 std::map<Value*, std::pair<ValID, int> >::iterator I =
6713 CurModule.PlaceHolderInfo.find(V);
6715 if (I != CurModule.PlaceHolderInfo.end()) {
6716 ValID &DID = I->second.first;
6717 if (DID.Type == ValID::LocalName) {
6718 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6720 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6723 delete ParserResult;
6728 // Check to make sure that parsing produced a result
6732 // Reset ParserResult variable while saving its value for the result.
6733 Module *Result = ParserResult;
6739 void llvm::GenerateError(const std::string &message, int LineNo) {
6740 if (LineNo == -1) LineNo = LLLgetLineNo();
6741 // TODO: column number in exception
6743 TheParseError->setError(LLLgetFilename(), message, LineNo);
6747 int yyerror(const char *ErrorMsg) {
6748 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6749 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6750 if (yychar != YYEMPTY && yychar != 0) {
6751 errMsg += " while reading token: '";
6752 errMsg += std::string(LLLgetTokenStart(),
6753 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6755 GenerateError(errMsg);