1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
209 EXTRACTELEMENT = 390,
236 #define ESINT64VAL 258
237 #define EUINT64VAL 259
238 #define ESAPINTVAL 260
239 #define EUAPINTVAL 261
240 #define LOCALVAL_ID 262
241 #define GLOBALVAL_ID 263
249 #define PPC_FP128 271
253 #define GLOBALVAR 275
255 #define STRINGCONSTANT 277
256 #define ATSTRINGCONSTANT 278
257 #define PCTSTRINGCONSTANT 279
258 #define ZEROINITIALIZER 280
270 #define THREAD_LOCAL 292
272 #define DOTDOTDOT 294
278 #define APPENDING 300
279 #define DLLIMPORT 301
280 #define DLLEXPORT 302
281 #define EXTERN_WEAK 303
288 #define ADDRSPACE 310
294 #define SIDEEFFECT 316
297 #define FASTCC_TOK 319
298 #define COLDCC_TOK 320
299 #define X86_STDCALLCC_TOK 321
300 #define X86_FASTCALLCC_TOK 322
301 #define DATALAYOUT 323
307 #define UNREACHABLE 329
352 #define GETELEMENTPTR 374
368 #define EXTRACTELEMENT 390
369 #define INSERTELEMENT 391
370 #define SHUFFLEVECTOR 392
371 #define GETRESULT 393
372 #define EXTRACTVALUE 394
373 #define INSERTVALUE 395
388 #define ALWAYSINLINE 410
391 #define PROTECTED 413
396 /* Copy the first part of user declarations. */
397 #line 14 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
399 #include "ParserInternals.h"
400 #include "llvm/CallingConv.h"
401 #include "llvm/InlineAsm.h"
402 #include "llvm/Instructions.h"
403 #include "llvm/Module.h"
404 #include "llvm/ValueSymbolTable.h"
405 #include "llvm/AutoUpgrade.h"
406 #include "llvm/Support/GetElementPtrTypeIterator.h"
407 #include "llvm/Support/CommandLine.h"
408 #include "llvm/ADT/SmallVector.h"
409 #include "llvm/ADT/STLExtras.h"
410 #include "llvm/Support/MathExtras.h"
411 #include "llvm/Support/Streams.h"
417 // The following is a gross hack. In order to rid the libAsmParser library of
418 // exceptions, we have to have a way of getting the yyparse function to go into
419 // an error situation. So, whenever we want an error to occur, the GenerateError
420 // function (see bottom of file) sets TriggerError. Then, at the end of each
421 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
422 // (a goto) to put YACC in error state. Furthermore, several calls to
423 // GenerateError are made from inside productions and they must simulate the
424 // previous exception behavior by exiting the production immediately. We have
425 // replaced these with the GEN_ERROR macro which calls GeneratError and then
426 // immediately invokes YYERROR. This would be so much cleaner if it was a
427 // recursive descent parser.
428 static bool TriggerError = false;
429 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
430 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
432 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
433 int yylex(); // declaration" of xxx warnings.
435 using namespace llvm;
437 static Module *ParserResult;
439 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
440 // relating to upreferences in the input stream.
442 //#define DEBUG_UPREFS 1
444 #define UR_OUT(X) cerr << X
449 #define YYERROR_VERBOSE 1
451 static GlobalVariable *CurGV;
454 // This contains info used when building the body of a function. It is
455 // destroyed when the function is completed.
457 typedef std::vector<Value *> ValueList; // Numbered defs
460 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
462 static struct PerModuleInfo {
463 Module *CurrentModule;
464 ValueList Values; // Module level numbered definitions
465 ValueList LateResolveValues;
466 std::vector<PATypeHolder> Types;
467 std::map<ValID, PATypeHolder> LateResolveTypes;
469 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
470 /// how they were referenced and on which line of the input they came from so
471 /// that we can resolve them later and print error messages as appropriate.
472 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
474 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
475 // references to global values. Global values may be referenced before they
476 // are defined, and if so, the temporary object that they represent is held
477 // here. This is used for forward references of GlobalValues.
479 typedef std::map<std::pair<const PointerType *,
480 ValID>, GlobalValue*> GlobalRefsType;
481 GlobalRefsType GlobalRefs;
484 // If we could not resolve some functions at function compilation time
485 // (calls to functions before they are defined), resolve them now... Types
486 // are resolved when the constant pool has been completely parsed.
488 ResolveDefinitions(LateResolveValues);
492 // Check to make sure that all global value forward references have been
495 if (!GlobalRefs.empty()) {
496 std::string UndefinedReferences = "Unresolved global references exist:\n";
498 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
500 UndefinedReferences += " " + I->first.first->getDescription() + " " +
501 I->first.second.getName() + "\n";
503 GenerateError(UndefinedReferences);
507 // Look for intrinsic functions and CallInst that need to be upgraded
508 for (Module::iterator FI = CurrentModule->begin(),
509 FE = CurrentModule->end(); FI != FE; )
510 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
512 Values.clear(); // Clear out function local definitions
517 // GetForwardRefForGlobal - Check to see if there is a forward reference
518 // for this global. If so, remove it from the GlobalRefs map and return it.
519 // If not, just return null.
520 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
521 // Check to see if there is a forward reference to this global variable...
522 // if there is, eliminate it and patch the reference to use the new def'n.
523 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
524 GlobalValue *Ret = 0;
525 if (I != GlobalRefs.end()) {
532 bool TypeIsUnresolved(PATypeHolder* PATy) {
533 // If it isn't abstract, its resolved
534 const Type* Ty = PATy->get();
535 if (!Ty->isAbstract())
537 // Traverse the type looking for abstract types. If it isn't abstract then
538 // we don't need to traverse that leg of the type.
539 std::vector<const Type*> WorkList, SeenList;
540 WorkList.push_back(Ty);
541 while (!WorkList.empty()) {
542 const Type* Ty = WorkList.back();
543 SeenList.push_back(Ty);
545 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
546 // Check to see if this is an unresolved type
547 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
548 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
549 for ( ; I != E; ++I) {
550 if (I->second.get() == OpTy)
553 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
554 const Type* TheTy = SeqTy->getElementType();
555 if (TheTy->isAbstract() && TheTy != Ty) {
556 std::vector<const Type*>::iterator I = SeenList.begin(),
562 WorkList.push_back(TheTy);
564 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
565 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
566 const Type* TheTy = StrTy->getElementType(i);
567 if (TheTy->isAbstract() && TheTy != Ty) {
568 std::vector<const Type*>::iterator I = SeenList.begin(),
574 WorkList.push_back(TheTy);
583 static struct PerFunctionInfo {
584 Function *CurrentFunction; // Pointer to current function being created
586 ValueList Values; // Keep track of #'d definitions
588 ValueList LateResolveValues;
589 bool isDeclare; // Is this function a forward declararation?
590 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
591 GlobalValue::VisibilityTypes Visibility;
593 /// BBForwardRefs - When we see forward references to basic blocks, keep
594 /// track of them here.
595 std::map<ValID, BasicBlock*> BBForwardRefs;
597 inline PerFunctionInfo() {
600 Linkage = GlobalValue::ExternalLinkage;
601 Visibility = GlobalValue::DefaultVisibility;
604 inline void FunctionStart(Function *M) {
609 void FunctionDone() {
610 // Any forward referenced blocks left?
611 if (!BBForwardRefs.empty()) {
612 GenerateError("Undefined reference to label " +
613 BBForwardRefs.begin()->second->getName());
617 // Resolve all forward references now.
618 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
620 Values.clear(); // Clear out function local definitions
621 BBForwardRefs.clear();
624 Linkage = GlobalValue::ExternalLinkage;
625 Visibility = GlobalValue::DefaultVisibility;
627 } CurFun; // Info for the current function...
629 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
632 //===----------------------------------------------------------------------===//
633 // Code to handle definitions of all the types
634 //===----------------------------------------------------------------------===//
636 /// InsertValue - Insert a value into the value table. If it is named, this
637 /// returns -1, otherwise it returns the slot number for the value.
638 static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
639 // Things that have names or are void typed don't get slot numbers
640 if (V->hasName() || (V->getType() == Type::VoidTy))
643 // In the case of function values, we have to allow for the forward reference
644 // of basic blocks, which are included in the numbering. Consequently, we keep
645 // track of the next insertion location with NextValNum. When a BB gets
646 // inserted, it could change the size of the CurFun.Values vector.
647 if (&ValueTab == &CurFun.Values) {
648 if (ValueTab.size() <= CurFun.NextValNum)
649 ValueTab.resize(CurFun.NextValNum+1);
650 ValueTab[CurFun.NextValNum++] = V;
651 return CurFun.NextValNum-1;
653 // For all other lists, its okay to just tack it on the back of the vector.
654 ValueTab.push_back(V);
655 return ValueTab.size()-1;
658 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
660 case ValID::LocalID: // Is it a numbered definition?
661 // Module constants occupy the lowest numbered slots...
662 if (D.Num < CurModule.Types.size())
663 return CurModule.Types[D.Num];
665 case ValID::LocalName: // Is it a named definition?
666 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
667 D.destroy(); // Free old strdup'd memory...
672 GenerateError("Internal parser error: Invalid symbol type reference");
676 // If we reached here, we referenced either a symbol that we don't know about
677 // or an id number that hasn't been read yet. We may be referencing something
678 // forward, so just create an entry to be resolved later and get to it...
680 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
683 if (inFunctionScope()) {
684 if (D.Type == ValID::LocalName) {
685 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
688 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
693 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
694 if (I != CurModule.LateResolveTypes.end())
697 Type *Typ = OpaqueType::get();
698 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
702 // getExistingVal - Look up the value specified by the provided type and
703 // the provided ValID. If the value exists and has already been defined, return
704 // it. Otherwise return null.
706 static Value *getExistingVal(const Type *Ty, const ValID &D) {
707 if (isa<FunctionType>(Ty)) {
708 GenerateError("Functions are not values and "
709 "must be referenced as pointers");
714 case ValID::LocalID: { // Is it a numbered definition?
715 // Check that the number is within bounds.
716 if (D.Num >= CurFun.Values.size())
718 Value *Result = CurFun.Values[D.Num];
719 if (Ty != Result->getType()) {
720 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
721 Result->getType()->getDescription() + "' does not match "
722 "expected type, '" + Ty->getDescription() + "'");
727 case ValID::GlobalID: { // Is it a numbered definition?
728 if (D.Num >= CurModule.Values.size())
730 Value *Result = CurModule.Values[D.Num];
731 if (Ty != Result->getType()) {
732 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
733 Result->getType()->getDescription() + "' does not match "
734 "expected type, '" + Ty->getDescription() + "'");
740 case ValID::LocalName: { // Is it a named definition?
741 if (!inFunctionScope())
743 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
744 Value *N = SymTab.lookup(D.getName());
747 if (N->getType() != Ty)
750 D.destroy(); // Free old strdup'd memory...
753 case ValID::GlobalName: { // Is it a named definition?
754 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
755 Value *N = SymTab.lookup(D.getName());
758 if (N->getType() != Ty)
761 D.destroy(); // Free old strdup'd memory...
765 // Check to make sure that "Ty" is an integral type, and that our
766 // value will fit into the specified type...
767 case ValID::ConstSIntVal: // Is it a constant pool reference??
768 if (!isa<IntegerType>(Ty) ||
769 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
770 GenerateError("Signed integral constant '" +
771 itostr(D.ConstPool64) + "' is invalid for type '" +
772 Ty->getDescription() + "'");
775 return ConstantInt::get(Ty, D.ConstPool64, true);
777 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
778 if (isa<IntegerType>(Ty) &&
779 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
780 return ConstantInt::get(Ty, D.UConstPool64);
782 if (!isa<IntegerType>(Ty) ||
783 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
784 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
785 "' is invalid or out of range for type '" +
786 Ty->getDescription() + "'");
789 // This is really a signed reference. Transmogrify.
790 return ConstantInt::get(Ty, D.ConstPool64, true);
792 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
793 if (!isa<IntegerType>(Ty)) {
794 GenerateError("Integral constant '" + D.getName() +
795 "' is invalid or out of range for type '" +
796 Ty->getDescription() + "'");
801 APSInt Tmp = *D.ConstPoolInt;
802 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
803 return ConstantInt::get(Tmp);
806 case ValID::ConstFPVal: // Is it a floating point const pool reference?
807 if (!Ty->isFloatingPoint() ||
808 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
809 GenerateError("FP constant invalid for type");
812 // Lexer has no type info, so builds all float and double FP constants
813 // as double. Fix this here. Long double does not need this.
814 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
816 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
817 return ConstantFP::get(*D.ConstPoolFP);
819 case ValID::ConstNullVal: // Is it a null value?
820 if (!isa<PointerType>(Ty)) {
821 GenerateError("Cannot create a a non pointer null");
824 return ConstantPointerNull::get(cast<PointerType>(Ty));
826 case ValID::ConstUndefVal: // Is it an undef value?
827 return UndefValue::get(Ty);
829 case ValID::ConstZeroVal: // Is it a zero value?
830 return Constant::getNullValue(Ty);
832 case ValID::ConstantVal: // Fully resolved constant?
833 if (D.ConstantValue->getType() != Ty) {
834 GenerateError("Constant expression type different from required type");
837 return D.ConstantValue;
839 case ValID::InlineAsmVal: { // Inline asm expression
840 const PointerType *PTy = dyn_cast<PointerType>(Ty);
841 const FunctionType *FTy =
842 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
843 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
844 GenerateError("Invalid type for asm constraint string");
847 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
848 D.IAD->HasSideEffects);
849 D.destroy(); // Free InlineAsmDescriptor.
853 assert(0 && "Unhandled case!");
857 assert(0 && "Unhandled case!");
861 // getVal - This function is identical to getExistingVal, except that if a
862 // value is not already defined, it "improvises" by creating a placeholder var
863 // that looks and acts just like the requested variable. When the value is
864 // defined later, all uses of the placeholder variable are replaced with the
867 static Value *getVal(const Type *Ty, const ValID &ID) {
868 if (Ty == Type::LabelTy) {
869 GenerateError("Cannot use a basic block here");
873 // See if the value has already been defined.
874 Value *V = getExistingVal(Ty, ID);
876 if (TriggerError) return 0;
878 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
879 GenerateError("Invalid use of a non-first-class type");
883 // If we reached here, we referenced either a symbol that we don't know about
884 // or an id number that hasn't been read yet. We may be referencing something
885 // forward, so just create an entry to be resolved later and get to it...
888 case ValID::GlobalName:
889 case ValID::GlobalID: {
890 const PointerType *PTy = dyn_cast<PointerType>(Ty);
892 GenerateError("Invalid type for reference to global" );
895 const Type* ElTy = PTy->getElementType();
896 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
897 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
899 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
900 (Module*)0, false, PTy->getAddressSpace());
904 V = new Argument(Ty);
907 // Remember where this forward reference came from. FIXME, shouldn't we try
908 // to recycle these things??
909 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
912 if (inFunctionScope())
913 InsertValue(V, CurFun.LateResolveValues);
915 InsertValue(V, CurModule.LateResolveValues);
919 /// defineBBVal - This is a definition of a new basic block with the specified
920 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
921 static BasicBlock *defineBBVal(const ValID &ID) {
922 assert(inFunctionScope() && "Can't get basic block at global scope!");
926 // First, see if this was forward referenced
928 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
929 if (BBI != CurFun.BBForwardRefs.end()) {
931 // The forward declaration could have been inserted anywhere in the
932 // function: insert it into the correct place now.
933 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
934 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
936 // We're about to erase the entry, save the key so we can clean it up.
937 ValID Tmp = BBI->first;
939 // Erase the forward ref from the map as its no longer "forward"
940 CurFun.BBForwardRefs.erase(ID);
942 // The key has been removed from the map but so we don't want to leave
943 // strdup'd memory around so destroy it too.
946 // If its a numbered definition, bump the number and set the BB value.
947 if (ID.Type == ValID::LocalID) {
948 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
952 // We haven't seen this BB before and its first mention is a definition.
953 // Just create it and return it.
954 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
955 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
956 if (ID.Type == ValID::LocalID) {
957 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
966 /// getBBVal - get an existing BB value or create a forward reference for it.
968 static BasicBlock *getBBVal(const ValID &ID) {
969 assert(inFunctionScope() && "Can't get basic block at global scope!");
973 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
974 if (BBI != CurFun.BBForwardRefs.end()) {
976 } if (ID.Type == ValID::LocalName) {
977 std::string Name = ID.getName();
978 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
980 if (N->getType()->getTypeID() == Type::LabelTyID)
981 BB = cast<BasicBlock>(N);
983 GenerateError("Reference to label '" + Name + "' is actually of type '"+
984 N->getType()->getDescription() + "'");
986 } else if (ID.Type == ValID::LocalID) {
987 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
988 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
989 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
991 GenerateError("Reference to label '%" + utostr(ID.Num) +
992 "' is actually of type '"+
993 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
996 GenerateError("Illegal label reference " + ID.getName());
1000 // If its already been defined, return it now.
1002 ID.destroy(); // Free strdup'd memory.
1006 // Otherwise, this block has not been seen before, create it.
1008 if (ID.Type == ValID::LocalName)
1009 Name = ID.getName();
1010 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
1012 // Insert it in the forward refs map.
1013 CurFun.BBForwardRefs[ID] = BB;
1019 //===----------------------------------------------------------------------===//
1020 // Code to handle forward references in instructions
1021 //===----------------------------------------------------------------------===//
1023 // This code handles the late binding needed with statements that reference
1024 // values not defined yet... for example, a forward branch, or the PHI node for
1027 // This keeps a table (CurFun.LateResolveValues) of all such forward references
1028 // and back patchs after we are done.
1031 // ResolveDefinitions - If we could not resolve some defs at parsing
1032 // time (forward branches, phi functions for loops, etc...) resolve the
1036 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1037 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1038 while (!LateResolvers.empty()) {
1039 Value *V = LateResolvers.back();
1040 LateResolvers.pop_back();
1042 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1043 CurModule.PlaceHolderInfo.find(V);
1044 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1046 ValID &DID = PHI->second.first;
1048 Value *TheRealValue = getExistingVal(V->getType(), DID);
1052 V->replaceAllUsesWith(TheRealValue);
1054 CurModule.PlaceHolderInfo.erase(PHI);
1055 } else if (FutureLateResolvers) {
1056 // Functions have their unresolved items forwarded to the module late
1058 InsertValue(V, *FutureLateResolvers);
1060 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1061 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1062 "' of type '" + V->getType()->getDescription() + "'",
1063 PHI->second.second);
1066 GenerateError("Reference to an invalid definition: #" +
1067 itostr(DID.Num) + " of type '" +
1068 V->getType()->getDescription() + "'",
1069 PHI->second.second);
1074 LateResolvers.clear();
1077 // ResolveTypeTo - A brand new type was just declared. This means that (if
1078 // name is not null) things referencing Name can be resolved. Otherwise, things
1079 // refering to the number can be resolved. Do this now.
1081 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1084 D = ValID::createLocalName(*Name);
1086 D = ValID::createLocalID(CurModule.Types.size());
1088 std::map<ValID, PATypeHolder>::iterator I =
1089 CurModule.LateResolveTypes.find(D);
1090 if (I != CurModule.LateResolveTypes.end()) {
1091 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1092 CurModule.LateResolveTypes.erase(I);
1097 // setValueName - Set the specified value to the name given. The name may be
1098 // null potentially, in which case this is a noop. The string passed in is
1099 // assumed to be a malloc'd string buffer, and is free'd by this function.
1101 static void setValueName(Value *V, std::string *NameStr) {
1102 if (!NameStr) return;
1103 std::string Name(*NameStr); // Copy string
1104 delete NameStr; // Free old string
1106 if (V->getType() == Type::VoidTy) {
1107 GenerateError("Can't assign name '" + Name+"' to value with void type");
1111 assert(inFunctionScope() && "Must be in function scope!");
1112 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1113 if (ST.lookup(Name)) {
1114 GenerateError("Redefinition of value '" + Name + "' of type '" +
1115 V->getType()->getDescription() + "'");
1123 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1124 /// this is a declaration, otherwise it is a definition.
1125 static GlobalVariable *
1126 ParseGlobalVariable(std::string *NameStr,
1127 GlobalValue::LinkageTypes Linkage,
1128 GlobalValue::VisibilityTypes Visibility,
1129 bool isConstantGlobal, const Type *Ty,
1130 Constant *Initializer, bool IsThreadLocal,
1131 unsigned AddressSpace = 0) {
1132 if (isa<FunctionType>(Ty)) {
1133 GenerateError("Cannot declare global vars of function type");
1136 if (Ty == Type::LabelTy) {
1137 GenerateError("Cannot declare global vars of label type");
1141 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1145 Name = *NameStr; // Copy string
1146 delete NameStr; // Free old string
1149 // See if this global value was forward referenced. If so, recycle the
1152 if (!Name.empty()) {
1153 ID = ValID::createGlobalName(Name);
1155 ID = ValID::createGlobalID(CurModule.Values.size());
1158 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1159 // Move the global to the end of the list, from whereever it was
1160 // previously inserted.
1161 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1162 CurModule.CurrentModule->getGlobalList().remove(GV);
1163 CurModule.CurrentModule->getGlobalList().push_back(GV);
1164 GV->setInitializer(Initializer);
1165 GV->setLinkage(Linkage);
1166 GV->setVisibility(Visibility);
1167 GV->setConstant(isConstantGlobal);
1168 GV->setThreadLocal(IsThreadLocal);
1169 InsertValue(GV, CurModule.Values);
1176 // If this global has a name
1177 if (!Name.empty()) {
1178 // if the global we're parsing has an initializer (is a definition) and
1179 // has external linkage.
1180 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1181 // If there is already a global with external linkage with this name
1182 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1183 // If we allow this GVar to get created, it will be renamed in the
1184 // symbol table because it conflicts with an existing GVar. We can't
1185 // allow redefinition of GVars whose linking indicates that their name
1186 // must stay the same. Issue the error.
1187 GenerateError("Redefinition of global variable named '" + Name +
1188 "' of type '" + Ty->getDescription() + "'");
1193 // Otherwise there is no existing GV to use, create one now.
1194 GlobalVariable *GV =
1195 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1196 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1197 GV->setVisibility(Visibility);
1198 InsertValue(GV, CurModule.Values);
1202 // setTypeName - Set the specified type to the name given. The name may be
1203 // null potentially, in which case this is a noop. The string passed in is
1204 // assumed to be a malloc'd string buffer, and is freed by this function.
1206 // This function returns true if the type has already been defined, but is
1207 // allowed to be redefined in the specified context. If the name is a new name
1208 // for the type plane, it is inserted and false is returned.
1209 static bool setTypeName(const Type *T, std::string *NameStr) {
1210 assert(!inFunctionScope() && "Can't give types function-local names!");
1211 if (NameStr == 0) return false;
1213 std::string Name(*NameStr); // Copy string
1214 delete NameStr; // Free old string
1216 // We don't allow assigning names to void type
1217 if (T == Type::VoidTy) {
1218 GenerateError("Can't assign name '" + Name + "' to the void type");
1222 // Set the type name, checking for conflicts as we do so.
1223 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1225 if (AlreadyExists) { // Inserting a name that is already defined???
1226 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1227 assert(Existing && "Conflict but no matching type?!");
1229 // There is only one case where this is allowed: when we are refining an
1230 // opaque type. In this case, Existing will be an opaque type.
1231 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1232 // We ARE replacing an opaque type!
1233 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1237 // Otherwise, this is an attempt to redefine a type. That's okay if
1238 // the redefinition is identical to the original. This will be so if
1239 // Existing and T point to the same Type object. In this one case we
1240 // allow the equivalent redefinition.
1241 if (Existing == T) return true; // Yes, it's equal.
1243 // Any other kind of (non-equivalent) redefinition is an error.
1244 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1245 T->getDescription() + "'");
1251 //===----------------------------------------------------------------------===//
1252 // Code for handling upreferences in type names...
1255 // TypeContains - Returns true if Ty directly contains E in it.
1257 static bool TypeContains(const Type *Ty, const Type *E) {
1258 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1259 E) != Ty->subtype_end();
1263 struct UpRefRecord {
1264 // NestingLevel - The number of nesting levels that need to be popped before
1265 // this type is resolved.
1266 unsigned NestingLevel;
1268 // LastContainedTy - This is the type at the current binding level for the
1269 // type. Every time we reduce the nesting level, this gets updated.
1270 const Type *LastContainedTy;
1272 // UpRefTy - This is the actual opaque type that the upreference is
1273 // represented with.
1274 OpaqueType *UpRefTy;
1276 UpRefRecord(unsigned NL, OpaqueType *URTy)
1277 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1281 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1282 static std::vector<UpRefRecord> UpRefs;
1284 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1285 /// called. It loops through the UpRefs vector, which is a list of the
1286 /// currently active types. For each type, if the up reference is contained in
1287 /// the newly completed type, we decrement the level count. When the level
1288 /// count reaches zero, the upreferenced type is the type that is passed in:
1289 /// thus we can complete the cycle.
1291 static PATypeHolder HandleUpRefs(const Type *ty) {
1292 // If Ty isn't abstract, or if there are no up-references in it, then there is
1293 // nothing to resolve here.
1294 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1296 PATypeHolder Ty(ty);
1297 UR_OUT("Type '" << Ty->getDescription() <<
1298 "' newly formed. Resolving upreferences.\n" <<
1299 UpRefs.size() << " upreferences active!\n");
1301 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1302 // to zero), we resolve them all together before we resolve them to Ty. At
1303 // the end of the loop, if there is anything to resolve to Ty, it will be in
1305 OpaqueType *TypeToResolve = 0;
1307 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1308 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1309 << UpRefs[i].second->getDescription() << ") = "
1310 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1311 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1312 // Decrement level of upreference
1313 unsigned Level = --UpRefs[i].NestingLevel;
1314 UpRefs[i].LastContainedTy = Ty;
1315 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1316 if (Level == 0) { // Upreference should be resolved!
1317 if (!TypeToResolve) {
1318 TypeToResolve = UpRefs[i].UpRefTy;
1320 UR_OUT(" * Resolving upreference for "
1321 << UpRefs[i].second->getDescription() << "\n";
1322 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1323 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1324 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1325 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1327 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1328 --i; // Do not skip the next element...
1333 if (TypeToResolve) {
1334 UR_OUT(" * Resolving upreference for "
1335 << UpRefs[i].second->getDescription() << "\n";
1336 std::string OldName = TypeToResolve->getDescription());
1337 TypeToResolve->refineAbstractTypeTo(Ty);
1343 //===----------------------------------------------------------------------===//
1344 // RunVMAsmParser - Define an interface to this parser
1345 //===----------------------------------------------------------------------===//
1347 static Module* RunParser(Module * M);
1349 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1351 Module *M = RunParser(new Module(LLLgetFilename()));
1358 /* Enabling traces. */
1363 /* Enabling verbose error messages. */
1364 #ifdef YYERROR_VERBOSE
1365 # undef YYERROR_VERBOSE
1366 # define YYERROR_VERBOSE 1
1368 # define YYERROR_VERBOSE 0
1371 /* Enabling the token table. */
1372 #ifndef YYTOKEN_TABLE
1373 # define YYTOKEN_TABLE 0
1376 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1377 typedef union YYSTYPE
1378 #line 974 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
1380 llvm::Module *ModuleVal;
1381 llvm::Function *FunctionVal;
1382 llvm::BasicBlock *BasicBlockVal;
1383 llvm::TerminatorInst *TermInstVal;
1384 llvm::Instruction *InstVal;
1385 llvm::Constant *ConstVal;
1387 const llvm::Type *PrimType;
1388 std::list<llvm::PATypeHolder> *TypeList;
1389 llvm::PATypeHolder *TypeVal;
1390 llvm::Value *ValueVal;
1391 std::vector<llvm::Value*> *ValueList;
1392 std::vector<unsigned> *ConstantList;
1393 llvm::ArgListType *ArgList;
1394 llvm::TypeWithAttrs TypeWithAttrs;
1395 llvm::TypeWithAttrsList *TypeWithAttrsList;
1396 llvm::ParamList *ParamList;
1398 // Represent the RHS of PHI node
1399 std::list<std::pair<llvm::Value*,
1400 llvm::BasicBlock*> > *PHIList;
1401 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1402 std::vector<llvm::Constant*> *ConstVector;
1404 llvm::GlobalValue::LinkageTypes Linkage;
1405 llvm::GlobalValue::VisibilityTypes Visibility;
1406 llvm::Attributes Attributes;
1407 llvm::APInt *APIntVal;
1412 llvm::APFloat *FPVal;
1415 std::string *StrVal; // This memory must be deleted
1416 llvm::ValID ValIDVal;
1418 llvm::Instruction::BinaryOps BinaryOpVal;
1419 llvm::Instruction::TermOps TermOpVal;
1420 llvm::Instruction::MemoryOps MemOpVal;
1421 llvm::Instruction::CastOps CastOpVal;
1422 llvm::Instruction::OtherOps OtherOpVal;
1423 llvm::ICmpInst::Predicate IPredicate;
1424 llvm::FCmpInst::Predicate FPredicate;
1426 /* Line 193 of yacc.c. */
1427 #line 1428 "llvmAsmParser.tab.c"
1429 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1430 # define YYSTYPE_IS_DECLARED 1
1431 # define YYSTYPE_IS_TRIVIAL 1
1436 /* Copy the second part of user declarations. */
1439 /* Line 216 of yacc.c. */
1440 #line 1441 "llvmAsmParser.tab.c"
1447 typedef YYTYPE_UINT8 yytype_uint8;
1449 typedef unsigned char yytype_uint8;
1453 typedef YYTYPE_INT8 yytype_int8;
1454 #elif (defined __STDC__ || defined __C99__FUNC__ \
1455 || defined __cplusplus || defined _MSC_VER)
1456 typedef signed char yytype_int8;
1458 typedef short int yytype_int8;
1461 #ifdef YYTYPE_UINT16
1462 typedef YYTYPE_UINT16 yytype_uint16;
1464 typedef unsigned short int yytype_uint16;
1468 typedef YYTYPE_INT16 yytype_int16;
1470 typedef short int yytype_int16;
1474 # ifdef __SIZE_TYPE__
1475 # define YYSIZE_T __SIZE_TYPE__
1476 # elif defined size_t
1477 # define YYSIZE_T size_t
1478 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1479 || defined __cplusplus || defined _MSC_VER)
1480 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1481 # define YYSIZE_T size_t
1483 # define YYSIZE_T unsigned int
1487 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1490 # if defined YYENABLE_NLS && YYENABLE_NLS
1492 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1493 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1497 # define YY_(msgid) msgid
1501 /* Suppress unused-variable warnings by "using" E. */
1502 #if ! defined lint || defined __GNUC__
1503 # define YYUSE(e) ((void) (e))
1505 # define YYUSE(e) /* empty */
1508 /* Identity function, used to suppress warnings about constant conditions. */
1510 # define YYID(n) (n)
1512 #if (defined __STDC__ || defined __C99__FUNC__ \
1513 || defined __cplusplus || defined _MSC_VER)
1526 #if ! defined yyoverflow || YYERROR_VERBOSE
1528 /* The parser invokes alloca or malloc; define the necessary symbols. */
1530 # ifdef YYSTACK_USE_ALLOCA
1531 # if YYSTACK_USE_ALLOCA
1533 # define YYSTACK_ALLOC __builtin_alloca
1534 # elif defined __BUILTIN_VA_ARG_INCR
1535 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1537 # define YYSTACK_ALLOC __alloca
1538 # elif defined _MSC_VER
1539 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1540 # define alloca _alloca
1542 # define YYSTACK_ALLOC alloca
1543 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1544 || defined __cplusplus || defined _MSC_VER)
1545 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1547 # define _STDLIB_H 1
1554 # ifdef YYSTACK_ALLOC
1555 /* Pacify GCC's `empty if-body' warning. */
1556 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1557 # ifndef YYSTACK_ALLOC_MAXIMUM
1558 /* The OS might guarantee only one guard page at the bottom of the stack,
1559 and a page size can be as small as 4096 bytes. So we cannot safely
1560 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1561 to allow for a few compiler-allocated temporary stack slots. */
1562 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1565 # define YYSTACK_ALLOC YYMALLOC
1566 # define YYSTACK_FREE YYFREE
1567 # ifndef YYSTACK_ALLOC_MAXIMUM
1568 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1570 # if (defined __cplusplus && ! defined _STDLIB_H \
1571 && ! ((defined YYMALLOC || defined malloc) \
1572 && (defined YYFREE || defined free)))
1573 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1575 # define _STDLIB_H 1
1579 # define YYMALLOC malloc
1580 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1581 || defined __cplusplus || defined _MSC_VER)
1582 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1586 # define YYFREE free
1587 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1588 || defined __cplusplus || defined _MSC_VER)
1589 void free (void *); /* INFRINGES ON USER NAME SPACE */
1593 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1596 #if (! defined yyoverflow \
1597 && (! defined __cplusplus \
1598 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1600 /* A type that is properly aligned for any stack member. */
1607 /* The size of the maximum gap between one aligned stack and the next. */
1608 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1610 /* The size of an array large to enough to hold all stacks, each with
1612 # define YYSTACK_BYTES(N) \
1613 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1614 + YYSTACK_GAP_MAXIMUM)
1616 /* Copy COUNT objects from FROM to TO. The source and destination do
1619 # if defined __GNUC__ && 1 < __GNUC__
1620 # define YYCOPY(To, From, Count) \
1621 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1623 # define YYCOPY(To, From, Count) \
1627 for (yyi = 0; yyi < (Count); yyi++) \
1628 (To)[yyi] = (From)[yyi]; \
1634 /* Relocate STACK from its old location to the new one. The
1635 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1636 elements in the stack, and YYPTR gives the new location of the
1637 stack. Advance YYPTR to a properly aligned location for the next
1639 # define YYSTACK_RELOCATE(Stack) \
1642 YYSIZE_T yynewbytes; \
1643 YYCOPY (&yyptr->Stack, Stack, yysize); \
1644 Stack = &yyptr->Stack; \
1645 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1646 yyptr += yynewbytes / sizeof (*yyptr); \
1652 /* YYFINAL -- State number of the termination state. */
1654 /* YYLAST -- Last index in YYTABLE. */
1657 /* YYNTOKENS -- Number of terminals. */
1658 #define YYNTOKENS 173
1659 /* YYNNTS -- Number of nonterminals. */
1661 /* YYNRULES -- Number of rules. */
1662 #define YYNRULES 354
1663 /* YYNRULES -- Number of states. */
1664 #define YYNSTATES 717
1666 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1667 #define YYUNDEFTOK 2
1668 #define YYMAXUTOK 413
1670 #define YYTRANSLATE(YYX) \
1671 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1673 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1674 static const yytype_uint8 yytranslate[] =
1676 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1677 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1678 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
1683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1685 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 166, 2, 2, 170, 2, 171, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1702 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1703 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1704 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1705 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1706 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1707 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1708 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1709 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1710 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1711 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1712 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1713 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1714 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1715 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1716 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1721 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1723 static const yytype_uint16 yyprhs[] =
1725 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1726 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1727 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1728 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1729 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1730 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1731 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1732 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1733 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1734 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
1735 197, 198, 200, 202, 204, 206, 208, 211, 213, 215,
1736 217, 219, 221, 223, 225, 227, 229, 232, 233, 236,
1737 238, 240, 242, 243, 246, 248, 250, 252, 254, 256,
1738 258, 260, 262, 264, 266, 267, 270, 271, 274, 275,
1739 278, 279, 283, 286, 287, 289, 290, 294, 296, 299,
1740 301, 303, 305, 307, 309, 311, 313, 315, 317, 321,
1741 323, 326, 332, 338, 344, 350, 354, 357, 363, 368,
1742 371, 373, 375, 377, 381, 383, 387, 389, 390, 392,
1743 396, 401, 405, 409, 414, 419, 423, 430, 436, 439,
1744 442, 445, 448, 451, 454, 457, 460, 463, 466, 469,
1745 472, 479, 485, 494, 501, 508, 516, 524, 532, 540,
1746 547, 556, 565, 571, 579, 583, 585, 587, 589, 591,
1747 592, 595, 602, 604, 605, 607, 610, 611, 615, 616,
1748 620, 624, 628, 632, 633, 642, 643, 653, 654, 664,
1749 670, 673, 677, 679, 683, 687, 691, 695, 697, 698,
1750 704, 708, 710, 714, 716, 717, 729, 731, 733, 738,
1751 740, 742, 745, 749, 750, 752, 754, 756, 758, 760,
1752 762, 764, 766, 768, 770, 772, 776, 780, 783, 786,
1753 790, 793, 799, 804, 806, 812, 814, 816, 818, 820,
1754 822, 824, 827, 829, 833, 836, 839, 843, 847, 850,
1755 851, 853, 856, 859, 863, 873, 883, 892, 908, 910,
1756 912, 919, 925, 928, 931, 938, 946, 951, 956, 963,
1757 970, 971, 972, 976, 979, 983, 986, 988, 994, 1000,
1758 1007, 1014, 1021, 1028, 1033, 1040, 1045, 1050, 1057, 1064,
1759 1067, 1077, 1079, 1081, 1082, 1086, 1093, 1097, 1104, 1107,
1760 1113, 1121, 1127, 1132, 1137
1763 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1764 static const yytype_int16 yyrhs[] =
1766 222, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1767 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1768 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1769 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1770 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1771 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1772 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1773 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1774 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1775 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1776 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
1777 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1778 -1, 19, -1, 22, -1, 24, -1, 181, -1, -1,
1779 55, 159, 4, 160, -1, -1, 181, 161, -1, -1,
1780 7, 161, -1, 20, -1, 23, -1, 188, -1, -1,
1781 186, 161, -1, 42, -1, 44, -1, 43, -1, 45,
1782 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
1783 -1, -1, 156, -1, 157, -1, 158, -1, -1, 46,
1784 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1785 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
1786 64, -1, 65, -1, 66, -1, 67, -1, 62, 4,
1787 -1, 142, -1, 121, -1, 141, -1, 122, -1, 144,
1788 -1, 145, -1, 147, -1, 148, -1, 149, -1, 54,
1789 4, -1, -1, 197, 196, -1, 144, -1, 142, -1,
1790 141, -1, -1, 199, 198, -1, 143, -1, 146, -1,
1791 144, -1, 142, -1, 141, -1, 150, -1, 151, -1,
1792 154, -1, 155, -1, 153, -1, -1, 201, 200, -1,
1793 -1, 152, 22, -1, -1, 54, 4, -1, -1, 162,
1794 54, 4, -1, 34, 22, -1, -1, 205, -1, -1,
1795 162, 208, 207, -1, 205, -1, 54, 4, -1, 11,
1796 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1797 -1, 17, -1, 50, -1, 209, -1, 210, 183, 163,
1798 -1, 244, -1, 164, 4, -1, 210, 159, 214, 160,
1799 201, -1, 10, 159, 214, 160, 201, -1, 165, 4,
1800 166, 210, 167, -1, 168, 4, 166, 210, 169, -1,
1801 170, 215, 171, -1, 170, 171, -1, 168, 170, 215,
1802 171, 169, -1, 168, 170, 171, 169, -1, 210, 197,
1803 -1, 210, -1, 10, -1, 211, -1, 213, 162, 211,
1804 -1, 213, -1, 213, 162, 39, -1, 39, -1, -1,
1805 210, -1, 215, 162, 210, -1, 210, 165, 218, 167,
1806 -1, 210, 165, 167, -1, 210, 172, 22, -1, 210,
1807 168, 218, 169, -1, 210, 170, 218, 171, -1, 210,
1808 170, 171, -1, 210, 168, 170, 218, 171, 169, -1,
1809 210, 168, 170, 171, 169, -1, 210, 40, -1, 210,
1810 41, -1, 210, 244, -1, 210, 217, -1, 210, 25,
1811 -1, 179, 3, -1, 179, 5, -1, 179, 4, -1,
1812 179, 6, -1, 11, 26, -1, 11, 27, -1, 180,
1813 9, -1, 176, 159, 216, 38, 210, 160, -1, 119,
1814 159, 216, 256, 160, -1, 133, 159, 216, 162, 216,
1815 162, 216, 160, -1, 174, 159, 216, 162, 216, 160,
1816 -1, 175, 159, 216, 162, 216, 160, -1, 90, 177,
1817 159, 216, 162, 216, 160, -1, 91, 178, 159, 216,
1818 162, 216, 160, -1, 92, 177, 159, 216, 162, 216,
1819 160, -1, 93, 178, 159, 216, 162, 216, 160, -1,
1820 135, 159, 216, 162, 216, 160, -1, 136, 159, 216,
1821 162, 216, 162, 216, 160, -1, 137, 159, 216, 162,
1822 216, 162, 216, 160, -1, 139, 159, 216, 257, 160,
1823 -1, 140, 159, 216, 162, 216, 257, 160, -1, 218,
1824 162, 216, -1, 216, -1, 32, -1, 33, -1, 37,
1825 -1, -1, 212, 244, -1, 125, 159, 221, 38, 210,
1826 160, -1, 223, -1, -1, 224, -1, 223, 224, -1,
1827 -1, 31, 225, 240, -1, -1, 30, 226, 241, -1,
1828 60, 59, 230, -1, 184, 18, 210, -1, 184, 18,
1829 10, -1, -1, 187, 191, 220, 219, 216, 183, 227,
1830 207, -1, -1, 187, 189, 191, 220, 219, 216, 183,
1831 228, 207, -1, -1, 187, 190, 191, 220, 219, 210,
1832 183, 229, 207, -1, 187, 191, 35, 194, 221, -1,
1833 52, 231, -1, 56, 161, 232, -1, 22, -1, 53,
1834 161, 22, -1, 68, 161, 22, -1, 165, 233, 167,
1835 -1, 233, 162, 22, -1, 22, -1, -1, 234, 162,
1836 210, 197, 182, -1, 210, 197, 182, -1, 234, -1,
1837 234, 162, 39, -1, 39, -1, -1, 195, 199, 212,
1838 186, 159, 235, 160, 201, 206, 203, 202, -1, 28,
1839 -1, 170, -1, 193, 191, 236, 237, -1, 29, -1,
1840 171, -1, 248, 239, -1, 192, 191, 236, -1, -1,
1841 61, -1, 3, -1, 4, -1, 5, -1, 6, -1,
1842 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1843 25, -1, 168, 218, 169, -1, 165, 218, 167, -1,
1844 165, 167, -1, 172, 22, -1, 170, 218, 171, -1,
1845 170, 171, -1, 168, 170, 218, 171, 169, -1, 168,
1846 170, 171, 169, -1, 217, -1, 59, 242, 22, 162,
1847 22, -1, 7, -1, 8, -1, 181, -1, 186, -1,
1848 244, -1, 243, -1, 210, 245, -1, 246, -1, 247,
1849 162, 246, -1, 248, 249, -1, 238, 249, -1, 250,
1850 184, 251, -1, 250, 185, 251, -1, 250, 253, -1,
1851 -1, 21, -1, 69, 247, -1, 69, 10, -1, 70,
1852 17, 245, -1, 70, 11, 245, 162, 17, 245, 162,
1853 17, 245, -1, 71, 179, 245, 162, 17, 245, 165,
1854 252, 167, -1, 71, 179, 245, 162, 17, 245, 165,
1855 167, -1, 72, 195, 199, 212, 245, 159, 255, 160,
1856 201, 38, 17, 245, 73, 17, 245, -1, 73, -1,
1857 74, -1, 252, 179, 243, 162, 17, 245, -1, 179,
1858 243, 162, 17, 245, -1, 184, 259, -1, 185, 259,
1859 -1, 210, 165, 245, 162, 245, 167, -1, 254, 162,
1860 165, 245, 162, 245, 167, -1, 210, 197, 245, 197,
1861 -1, 17, 197, 245, 197, -1, 255, 162, 210, 197,
1862 245, 197, -1, 255, 162, 17, 197, 245, 197, -1,
1863 -1, -1, 256, 162, 246, -1, 162, 4, -1, 257,
1864 162, 4, -1, 58, 57, -1, 57, -1, 174, 210,
1865 245, 162, 245, -1, 175, 210, 245, 162, 245, -1,
1866 90, 177, 210, 245, 162, 245, -1, 91, 178, 210,
1867 245, 162, 245, -1, 92, 177, 210, 245, 162, 245,
1868 -1, 93, 178, 210, 245, 162, 245, -1, 176, 246,
1869 38, 210, -1, 133, 246, 162, 246, 162, 246, -1,
1870 134, 246, 162, 210, -1, 135, 246, 162, 246, -1,
1871 136, 246, 162, 246, 162, 246, -1, 137, 246, 162,
1872 246, 162, 246, -1, 132, 254, -1, 258, 195, 199,
1873 212, 245, 159, 255, 160, 201, -1, 261, -1, 36,
1874 -1, -1, 114, 210, 204, -1, 114, 210, 162, 11,
1875 245, 204, -1, 115, 210, 204, -1, 115, 210, 162,
1876 11, 245, 204, -1, 116, 246, -1, 260, 117, 210,
1877 245, 204, -1, 260, 118, 246, 162, 210, 245, 204,
1878 -1, 138, 210, 245, 162, 4, -1, 119, 210, 245,
1879 256, -1, 139, 210, 245, 257, -1, 140, 210, 245,
1880 162, 210, 245, 257, -1
1883 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1884 static const yytype_uint16 yyrline[] =
1886 0, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140,
1887 1140, 1141, 1141, 1141, 1141, 1141, 1141, 1142, 1142, 1142,
1888 1142, 1142, 1142, 1143, 1143, 1143, 1143, 1143, 1143, 1146,
1889 1146, 1147, 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1154,
1890 1154, 1155, 1155, 1156, 1156, 1157, 1157, 1158, 1158, 1159,
1891 1159, 1160, 1160, 1161, 1162, 1167, 1168, 1168, 1168, 1168,
1892 1168, 1170, 1170, 1170, 1171, 1171, 1173, 1174, 1178, 1182,
1893 1187, 1193, 1193, 1195, 1196, 1201, 1207, 1208, 1209, 1210,
1894 1211, 1212, 1216, 1217, 1218, 1222, 1223, 1224, 1225, 1229,
1895 1230, 1231, 1235, 1236, 1237, 1238, 1239, 1243, 1244, 1245,
1896 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1261, 1262, 1263,
1897 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1274, 1275, 1280,
1898 1281, 1282, 1285, 1286, 1292, 1293, 1294, 1295, 1296, 1297,
1899 1298, 1299, 1300, 1301, 1304, 1305, 1311, 1312, 1319, 1320,
1900 1326, 1327, 1336, 1344, 1345, 1350, 1351, 1352, 1357, 1370,
1901 1370, 1370, 1370, 1370, 1370, 1370, 1373, 1377, 1381, 1388,
1902 1393, 1401, 1436, 1467, 1472, 1482, 1492, 1496, 1506, 1513,
1903 1522, 1529, 1534, 1539, 1546, 1547, 1554, 1561, 1569, 1575,
1904 1587, 1615, 1631, 1658, 1686, 1712, 1732, 1758, 1778, 1790,
1905 1797, 1863, 1873, 1883, 1889, 1899, 1905, 1915, 1921, 1927,
1906 1940, 1952, 1973, 1981, 1987, 1998, 2003, 2008, 2013, 2018,
1907 2024, 2030, 2036, 2044, 2055, 2059, 2067, 2067, 2070, 2070,
1908 2073, 2085, 2106, 2111, 2119, 2120, 2124, 2124, 2128, 2128,
1909 2131, 2134, 2158, 2170, 2169, 2181, 2180, 2190, 2189, 2200,
1910 2240, 2243, 2249, 2259, 2263, 2268, 2270, 2275, 2280, 2289,
1911 2299, 2310, 2314, 2323, 2332, 2337, 2486, 2486, 2488, 2497,
1912 2497, 2499, 2504, 2516, 2520, 2525, 2529, 2533, 2538, 2543,
1913 2547, 2551, 2555, 2559, 2563, 2567, 2589, 2611, 2617, 2630,
1914 2642, 2647, 2659, 2665, 2669, 2679, 2683, 2687, 2692, 2699,
1915 2699, 2705, 2714, 2719, 2724, 2728, 2737, 2746, 2759, 2768,
1916 2772, 2780, 2800, 2804, 2809, 2820, 2839, 2848, 2952, 2956,
1917 2963, 2974, 2987, 2996, 3009, 3020, 3030, 3041, 3049, 3059,
1918 3066, 3069, 3070, 3078, 3084, 3093, 3097, 3102, 3118, 3135,
1919 3147, 3159, 3173, 3187, 3199, 3220, 3227, 3233, 3239, 3245,
1920 3260, 3370, 3375, 3379, 3386, 3393, 3403, 3410, 3420, 3428,
1921 3442, 3459, 3473, 3488, 3503
1925 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1926 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1927 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1928 static const char *const yytname[] =
1930 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1931 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1932 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1933 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1934 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1935 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1936 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1937 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1938 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
1939 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1940 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1941 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1942 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1943 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1944 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1945 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1946 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1947 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1948 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1949 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1950 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1951 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1952 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1953 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1954 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1955 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1956 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1957 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1958 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1959 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1960 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1961 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
1962 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1963 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1964 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1965 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1966 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1967 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1968 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1969 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1970 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1971 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1972 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1973 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1974 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
1975 "OptVolatile", "MemoryInst", 0
1980 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1982 static const yytype_uint16 yytoknum[] =
1984 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1985 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1986 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1987 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1988 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1989 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1990 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1991 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1992 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1993 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1994 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1995 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1996 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1997 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1998 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1999 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
2000 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
2005 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2006 static const yytype_uint16 yyr1[] =
2008 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2009 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2010 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2011 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2012 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
2013 178, 178, 178, 178, 178, 179, 180, 180, 180, 180,
2014 180, 181, 181, 181, 182, 182, 183, 183, 184, 184,
2015 185, 186, 186, 187, 187, 188, 189, 189, 189, 189,
2016 189, 189, 190, 190, 190, 191, 191, 191, 191, 192,
2017 192, 192, 193, 193, 193, 193, 193, 194, 194, 194,
2018 195, 195, 195, 195, 195, 195, 195, 196, 196, 196,
2019 196, 196, 196, 196, 196, 196, 196, 197, 197, 198,
2020 198, 198, 199, 199, 200, 200, 200, 200, 200, 200,
2021 200, 200, 200, 200, 201, 201, 202, 202, 203, 203,
2022 204, 204, 205, 206, 206, 207, 207, 208, 208, 209,
2023 209, 209, 209, 209, 209, 209, 210, 210, 210, 210,
2024 210, 210, 210, 210, 210, 210, 210, 210, 210, 211,
2025 212, 212, 213, 213, 214, 214, 214, 214, 215, 215,
2026 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2027 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2028 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
2029 217, 217, 217, 217, 218, 218, 219, 219, 220, 220,
2030 221, 221, 222, 222, 223, 223, 225, 224, 226, 224,
2031 224, 224, 224, 227, 224, 228, 224, 229, 224, 224,
2032 224, 224, 230, 231, 231, 232, 233, 233, 233, 234,
2033 234, 235, 235, 235, 235, 236, 237, 237, 238, 239,
2034 239, 240, 241, 242, 242, 243, 243, 243, 243, 243,
2035 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2036 243, 243, 243, 243, 243, 244, 244, 244, 244, 245,
2037 245, 246, 247, 247, 248, 248, 249, 249, 250, 250,
2038 250, 251, 251, 251, 251, 251, 251, 251, 251, 251,
2039 252, 252, 253, 253, 254, 254, 255, 255, 255, 255,
2040 255, 256, 256, 257, 257, 258, 258, 259, 259, 259,
2041 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
2042 259, 259, 260, 260, 261, 261, 261, 261, 261, 261,
2043 261, 261, 261, 261, 261
2046 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2047 static const yytype_uint8 yyr2[] =
2049 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2050 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2051 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2052 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2056 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2058 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
2059 0, 1, 1, 1, 1, 1, 2, 1, 1, 1,
2060 1, 1, 1, 1, 1, 1, 2, 0, 2, 1,
2061 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
2062 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2063 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2064 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2065 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2066 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2067 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2068 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2069 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2070 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2071 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2072 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2073 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2074 3, 1, 3, 1, 0, 11, 1, 1, 4, 1,
2075 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2076 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2077 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2078 1, 2, 1, 3, 2, 2, 3, 3, 2, 0,
2079 1, 2, 2, 3, 9, 9, 8, 15, 1, 1,
2080 6, 5, 2, 2, 6, 7, 4, 4, 6, 6,
2081 0, 0, 3, 2, 3, 2, 1, 5, 5, 6,
2082 6, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2083 9, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2087 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2088 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2089 means the default is an error. */
2090 static const yytype_uint16 yydefact[] =
2092 74, 61, 71, 62, 72, 63, 228, 226, 0, 0,
2093 0, 0, 0, 0, 85, 73, 0, 74, 224, 89,
2094 92, 0, 0, 240, 0, 0, 68, 0, 75, 76,
2095 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
2096 88, 85, 85, 219, 1, 225, 90, 91, 85, 229,
2097 93, 94, 95, 96, 85, 299, 227, 299, 0, 0,
2098 248, 241, 242, 230, 285, 286, 232, 149, 150, 151,
2099 154, 153, 152, 155, 156, 0, 0, 0, 0, 287,
2100 288, 157, 231, 159, 219, 219, 97, 218, 0, 100,
2101 100, 300, 295, 69, 259, 260, 261, 294, 243, 244,
2102 247, 0, 177, 160, 0, 0, 0, 0, 166, 178,
2103 0, 0, 177, 0, 0, 0, 99, 98, 0, 216,
2104 217, 0, 0, 101, 102, 103, 104, 105, 122, 262,
2105 0, 0, 343, 343, 298, 0, 245, 176, 117, 172,
2106 174, 0, 0, 0, 0, 0, 0, 165, 0, 0,
2107 158, 0, 0, 171, 0, 170, 0, 239, 149, 150,
2108 151, 154, 153, 152, 0, 0, 67, 67, 106, 0,
2109 256, 257, 258, 70, 342, 326, 0, 0, 0, 0,
2110 100, 308, 309, 2, 3, 4, 5, 6, 7, 8,
2111 9, 10, 14, 15, 16, 11, 12, 13, 0, 0,
2112 0, 0, 0, 0, 0, 0, 17, 18, 19, 20,
2113 21, 22, 23, 24, 25, 26, 27, 28, 0, 0,
2114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2115 296, 100, 312, 0, 341, 297, 313, 246, 169, 0,
2116 134, 67, 67, 168, 0, 179, 0, 134, 67, 67,
2117 0, 220, 197, 198, 193, 195, 194, 196, 199, 192,
2118 188, 189, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2120 191, 190, 233, 121, 120, 119, 123, 0, 325, 302,
2121 67, 292, 301, 0, 0, 55, 0, 122, 29, 30,
2122 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
2123 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
2124 44, 45, 46, 47, 48, 0, 0, 0, 140, 140,
2125 348, 67, 67, 339, 0, 0, 0, 0, 0, 67,
2126 67, 67, 67, 67, 0, 122, 0, 0, 0, 108,
2127 110, 109, 107, 111, 112, 113, 114, 115, 118, 175,
2128 173, 162, 163, 164, 167, 66, 161, 235, 237, 0,
2129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2130 0, 181, 215, 0, 0, 0, 185, 0, 182, 0,
2131 0, 0, 145, 0, 265, 266, 267, 268, 269, 274,
2132 270, 271, 272, 273, 263, 0, 0, 0, 0, 283,
2133 290, 289, 291, 0, 0, 303, 0, 0, 67, 67,
2134 67, 67, 0, 344, 0, 346, 321, 0, 0, 0,
2135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2136 0, 67, 0, 116, 128, 127, 124, 126, 125, 129,
2137 130, 133, 131, 132, 135, 145, 145, 0, 0, 0,
2138 0, 0, 321, 0, 0, 0, 0, 0, 0, 0,
2139 180, 166, 178, 0, 183, 184, 0, 0, 0, 0,
2140 234, 254, 264, 0, 277, 0, 0, 0, 280, 0,
2141 278, 293, 0, 0, 0, 0, 0, 0, 0, 0,
2142 0, 0, 352, 0, 0, 0, 335, 336, 0, 0,
2143 0, 0, 353, 0, 0, 0, 333, 0, 140, 0,
2144 236, 238, 67, 0, 0, 0, 0, 0, 0, 0,
2145 0, 0, 0, 0, 214, 187, 0, 0, 0, 0,
2146 0, 0, 147, 145, 253, 117, 251, 0, 0, 276,
2147 166, 0, 275, 279, 0, 0, 0, 0, 0, 0,
2148 0, 140, 141, 140, 0, 0, 0, 0, 0, 0,
2149 351, 323, 0, 67, 327, 328, 0, 0, 349, 67,
2150 221, 0, 0, 0, 0, 201, 0, 0, 0, 0,
2151 212, 0, 186, 0, 0, 67, 142, 148, 146, 65,
2152 0, 134, 0, 282, 0, 0, 0, 320, 329, 330,
2153 331, 332, 345, 347, 322, 0, 0, 334, 337, 338,
2154 324, 0, 320, 140, 0, 0, 0, 0, 0, 209,
2155 0, 0, 0, 203, 204, 200, 64, 250, 252, 117,
2156 143, 284, 281, 0, 0, 117, 117, 0, 314, 0,
2157 354, 0, 350, 205, 206, 207, 208, 0, 0, 0,
2158 213, 65, 144, 138, 0, 306, 0, 0, 0, 0,
2159 134, 0, 315, 134, 202, 210, 211, 249, 0, 136,
2160 304, 0, 305, 0, 108, 110, 117, 117, 0, 117,
2161 117, 340, 139, 0, 255, 0, 0, 317, 316, 0,
2162 0, 0, 137, 0, 0, 0, 117, 117, 311, 0,
2163 0, 319, 318, 310, 0, 0, 307
2166 /* YYDEFGOTO[NTERM-NUM]. */
2167 static const yytype_int16 yydefgoto[] =
2169 -1, 277, 278, 279, 308, 325, 164, 165, 79, 637,
2170 113, 12, 133, 80, 14, 15, 41, 42, 43, 48,
2171 54, 118, 128, 358, 238, 286, 169, 454, 361, 694,
2172 679, 423, 542, 663, 480, 543, 81, 166, 139, 156,
2173 140, 141, 110, 382, 409, 383, 121, 88, 157, 16,
2174 17, 18, 20, 19, 392, 455, 456, 63, 23, 61,
2175 101, 546, 547, 129, 172, 55, 96, 56, 49, 483,
2176 410, 83, 412, 291, 292, 57, 92, 93, 230, 667,
2177 134, 333, 647, 502, 512, 231, 232, 233, 234
2180 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2182 #define YYPACT_NINF -620
2183 static const yytype_int16 yypact[] =
2185 484, -620, -620, -620, -620, -620, -620, -620, -14, -116,
2186 -6, -83, 104, -31, 24, -620, 161, 528, -620, 238,
2187 204, 43, 49, -620, 5, 196, -620, 1912, -620, -620,
2188 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2189 -620, 173, 173, 227, -620, -620, -620, -620, 173, -620,
2190 -620, -620, -620, -620, 173, 202, -620, -9, 234, 243,
2191 246, -620, -620, -620, -620, -620, 67, -620, -620, -620,
2192 -620, -620, -620, -620, -620, 273, 285, 3, 624, -620,
2193 -620, -620, 4, -620, 201, 201, 253, -620, 81, 240,
2194 240, -620, -620, 39, -620, -620, -620, -620, -620, -620,
2195 -620, -59, 1564, -620, 128, 132, 643, 67, -620, 4,
2196 -114, 165, 1564, 145, 81, 81, -620, -620, 1605, -620,
2197 -620, 2014, 324, -620, -620, -620, -620, -620, -620, -620,
2198 -13, 188, 2299, 2299, -620, 328, -620, -620, 4, -620,
2199 189, 194, 2076, 2076, 186, -111, 2076, -620, 352, 205,
2200 -620, 2014, 2076, 67, 208, 4, 247, -620, 216, 351,
2201 355, 359, 365, 368, 269, 372, 1625, 306, -620, 1517,
2202 -620, -620, -620, -620, -620, -620, 325, 2094, 38, 373,
2203 240, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2204 -620, -620, -620, -620, -620, -620, -620, -620, 298, 336,
2205 298, 336, 2076, 2076, 2076, 2076, -620, -620, -620, -620,
2206 -620, -620, -620, -620, -620, -620, -620, -620, 2076, 2076,
2207 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076,
2208 -620, 240, -620, 66, -620, -620, -620, -620, 231, 1791,
2209 -620, -17, -21, -620, 214, 4, 225, -620, 306, -5,
2210 1605, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2211 -620, -620, 298, 336, 298, 336, 229, 230, 249, 250,
2212 251, 252, 256, 1809, 2117, 690, 364, 257, 259, 261,
2213 -620, -620, -620, -620, -620, -620, -620, 114, -620, 67,
2214 1019, -620, 262, 1189, 1189, -620, 1189, -620, -620, -620,
2215 -620, -620, -620, -620, -620, -620, -620, -620, 2076, -620,
2216 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2217 -620, -620, -620, -620, -620, 2076, 2076, 2076, -23, 28,
2218 -620, 1019, -18, 265, 266, 268, 272, 288, 289, 1019,
2219 1019, 1019, 1019, 1019, 383, -620, 2076, 2076, 398, -620,
2220 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2221 -620, 137, -620, -620, -620, -620, 137, -620, 145, 385,
2222 293, 294, 295, 297, 2014, 2014, 2014, 2014, 2014, 2014,
2223 2014, -620, -620, -56, 1069, -74, -620, -80, -620, 2014,
2224 2014, 2014, 296, 300, -620, -620, -620, -620, -620, -620,
2225 -620, -620, -620, -620, 396, 1832, 2135, 1239, 403, -620,
2226 -620, -620, -620, 2076, 299, -620, 301, 1517, 1019, 1019,
2227 1019, 1019, 8, -620, 33, -620, -620, 1189, 303, 2076,
2228 2076, 2076, 2076, 2076, 302, 304, 307, 308, 309, 2076,
2229 1517, 1019, 312, -620, -620, -620, -620, -620, -620, -620,
2230 -620, -620, -620, -620, -620, 296, 296, 2076, 2014, 2014,
2231 2014, 2014, -620, 317, 318, 319, 320, 304, 323, 2014,
2232 -620, 326, 1471, -77, -620, -620, 327, 330, 424, 2,
2233 -620, 1850, -620, 443, -620, -52, 1280, -73, -620, -72,
2234 -620, -620, 469, 471, 1189, 332, 334, 337, 338, 1189,
2235 494, 1189, 339, 343, 1189, 347, 4, -620, 348, 349,
2236 508, 519, 362, 2076, 1189, 1189, 4, 1189, 363, 2076,
2237 -620, -620, 26, 367, 375, 377, 387, 149, 2014, 2014,
2238 2014, 2014, 157, 2014, -620, -620, 357, 2014, 2014, 2076,
2239 505, 526, -620, 296, -620, 4, 391, 394, 393, -620,
2240 366, -62, -620, -620, 1189, 1189, 386, 1189, 1189, 1189,
2241 1189, 363, -620, 363, 2076, 1189, 395, 2076, 2076, 2076,
2242 -620, -620, 552, 1019, -620, -620, 405, 511, -620, 1019,
2243 -620, 2014, 2014, 2014, 2014, -620, 400, 406, 407, 408,
2244 -620, 304, -620, 411, 412, 57, -620, -620, -620, 11,
2245 1891, -620, 545, -620, 399, 413, 414, 2179, -620, -620,
2246 -620, -620, -620, -620, -620, 409, 1189, -620, -620, -620,
2247 -620, 304, 2179, 363, 417, 418, 423, 425, 2014, -620,
2248 2014, 2014, 180, -620, -620, -620, -620, -620, -620, 4,
2249 172, -620, -620, 556, -3, 46, 4, 181, -620, 422,
2250 362, 184, -620, -620, -620, -620, -620, 430, 431, 432,
2251 -620, 11, -620, 539, 1189, -620, 1337, -1, 865, 865,
2252 -620, 2197, -620, -620, -620, -620, -620, -620, 590, 445,
2253 -620, 433, -620, 1337, 446, 453, -620, -620, 86, 46,
2254 4, 137, -620, 582, -620, 596, 452, 231, 231, 598,
2255 865, 865, -620, 1189, 599, 1189, -620, -620, -620, 1189,
2256 544, 231, 231, -620, 603, 1189, -620
2259 /* YYPGOTO[NTERM-NUM]. */
2260 static const yytype_int16 yypgoto[] =
2262 -620, 42, 112, 200, -160, -158, -177, -620, 0, -39,
2263 -151, 531, -620, 9, -620, -620, -620, -620, 77, -620,
2264 -620, -620, -152, -620, -518, -620, -268, -620, -244, -620,
2265 -620, -311, -15, -620, -414, -620, -620, -26, 389, -164,
2266 -620, 514, 523, 142, -162, -261, 220, 263, 380, -620,
2267 -620, 625, -620, -620, -620, -620, -620, -620, -620, -620,
2268 -620, -620, -620, 559, -620, -620, -620, -620, -620, -620,
2269 -619, -82, 267, -198, -620, -620, 595, -620, 535, -620,
2270 -620, -620, 47, 215, -456, -620, 543, -620, -620
2273 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2274 positive, shift that token. If negative, reduce the rule which
2275 number is the opposite. If zero, do what YYDEFACT says.
2276 If YYTABLE_NINF, syntax error. */
2277 #define YYTABLE_NINF -224
2278 static const yytype_int16 yytable[] =
2280 11, 82, 296, 366, 280, 287, 330, 105, 295, 13,
2281 295, 532, 91, 385, 387, 170, 282, 11, 425, 499,
2282 94, 334, 335, 336, 337, 338, 13, 599, 297, 417,
2283 1, 344, 111, 3, 111, 5, 540, 111, 111, 21,
2284 326, 520, 521, 327, 501, 24, 131, 681, 146, 293,
2285 111, 146, 109, 25, 22, 294, 541, 147, 1, 111,
2286 244, 3, 500, 5, 696, 348, 29, 30, 31, 32,
2287 33, 34, 35, 36, 251, 37, 138, 440, 26, 345,
2288 109, 111, 469, 111, 281, 469, 138, 500, 469, 469,
2289 469, 475, 155, 11, 536, 474, 552, 367, 368, 553,
2290 469, -155, 370, 135, 372, 371, 469, 373, 136, 604,
2291 469, 470, 111, 119, 120, 549, 241, 242, 84, 85,
2292 245, 661, 27, 473, 699, 89, 249, 668, 669, 598,
2293 28, 90, 349, 350, 2, 632, 112, 4, 112, 422,
2294 -67, 112, 112, 155, 485, 487, 489, 427, 363, 442,
2295 362, 290, 351, 352, 112, 353, 354, 171, 355, 356,
2296 357, 44, 95, 112, 665, 650, 682, -67, 697, 698,
2297 60, 700, 701, 106, 227, 227, 328, 329, 290, 331,
2298 38, 39, 40, 346, 347, 112, 580, 112, 711, 712,
2299 424, -67, 332, 290, 290, 290, 290, 290, 339, 340,
2300 341, 342, 343, 290, 58, -155, 540, 578, 411, -155,
2301 59, 411, 411, 138, 411, 491, 112, 635, 62, -55,
2302 -55, -55, -55, 91, 155, 551, 102, 444, 445, 446,
2303 447, 505, 448, 507, 508, 509, 449, 450, 87, 451,
2304 452, 453, 252, 253, 228, 228, 50, 51, 52, 411,
2305 612, 53, 613, 494, 64, 65, 98, 411, 411, 411,
2306 411, 411, 86, 167, 87, 99, 1, 2, 100, 3,
2307 4, 5, 254, 255, 256, 257, 517, 103, 444, 445,
2308 446, 447, 418, 448, 46, 348, 47, 449, 450, 104,
2309 451, 452, 453, 248, 142, 116, 393, 117, 143, 419,
2310 420, 421, 122, 123, 124, 125, 126, 127, 150, 585,
2311 280, 564, 652, 444, 445, 446, 447, 590, 448, 572,
2312 441, 290, 449, 450, 148, 451, 452, 453, 168, 38,
2313 39, 40, 229, 229, 151, 152, 411, 411, 411, 411,
2314 660, 670, 572, 671, 673, 411, 671, 114, 115, 173,
2315 237, 239, 349, 350, 240, 243, 246, 640, 472, 411,
2316 -56, 111, 309, 310, -57, 247, 614, 250, -60, 617,
2317 618, 619, 351, 352, -59, 353, 354, -58, 355, 356,
2318 357, 258, 288, 364, 295, 365, 388, 290, 374, 375,
2319 281, 155, 298, 299, 300, 301, 302, 303, 304, 305,
2320 306, 307, 443, 290, 506, 290, 290, 290, 376, 377,
2321 378, 379, 411, 516, 155, 380, 389, 411, 390, 411,
2322 391, 439, 411, 457, 413, 490, 688, 428, 429, 691,
2323 430, 522, 411, 411, 431, 411, 311, 312, 313, 314,
2324 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2325 432, 433, 458, 459, 460, 545, 461, 482, 479, 481,
2326 472, 492, 539, 493, 510, 548, 511, 666, 504, 513,
2327 514, 515, 411, 411, 519, 411, 411, 411, 411, 528,
2328 529, 530, 531, 411, -223, 533, 554, 573, 555, 537,
2329 683, 411, 538, 579, 557, 535, 558, 411, 562, 559,
2330 560, 564, -69, 1, 2, 565, 3, 4, 5, 567,
2331 568, 569, 570, 595, 6, 7, 462, 463, 464, 465,
2332 466, 467, 468, 571, 572, 577, 592, 596, -222, 581,
2333 597, 476, 477, 478, 411, 603, 8, 582, 290, 583,
2334 9, 290, 290, 290, 10, 607, -69, 1, 2, 584,
2335 3, 4, 5, 600, 601, 602, 620, 616, 6, 7,
2336 414, 415, 628, 416, 622, 500, 629, 641, 642, 630,
2337 631, 633, 634, 664, 639, 643, 648, 653, 654, 644,
2338 8, 646, 411, 655, 9, 656, 411, 411, 10, 672,
2339 674, 675, 676, 678, 692, 695, 646, 693, 426, 636,
2340 523, 524, 525, 526, 702, -18, 434, 435, 436, 437,
2341 438, 534, -19, 703, 704, 705, 709, 714, 411, 411,
2342 715, 411, 677, 411, 132, 662, 149, 411, 360, 145,
2343 369, 64, 65, 411, 107, 67, 68, 69, 70, 71,
2344 72, 73, 45, 1, 2, 690, 3, 4, 5, 130,
2345 64, 65, 97, 107, 67, 68, 69, 70, 71, 72,
2346 73, 636, 1, 2, 0, 3, 4, 5, 235, 651,
2347 586, 587, 588, 589, 74, 591, 236, 527, 0, 593,
2348 594, 0, 0, 0, 0, 495, 496, 497, 498, 0,
2349 0, 0, 0, 74, 503, 0, 0, 64, 65, 0,
2350 107, 158, 159, 160, 161, 162, 163, 73, 518, 1,
2351 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2352 0, 0, 0, 624, 625, 626, 627, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2354 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2356 0, 556, 0, 0, 0, 0, 561, 0, 563, 0,
2357 657, 566, 658, 659, 0, 0, 0, 0, 0, 0,
2358 0, 574, 575, 0, 576, 0, 0, 0, 75, 76,
2359 0, 0, 77, 0, 78, 108, 0, 0, 0, 0,
2360 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2361 0, 77, 0, 78, 144, 0, 0, 0, 0, 0,
2362 0, 605, 606, 0, 608, 609, 610, 611, 0, 0,
2363 0, 0, 615, 0, 0, 0, 0, 0, 0, 0,
2364 621, 0, 0, 0, 0, 0, 623, 0, 0, 0,
2365 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2366 78, 386, 0, 0, 0, 0, 0, 0, 394, 395,
2367 396, 397, 64, 65, 398, 0, 0, 0, 0, 0,
2368 0, 0, 0, 649, 1, 2, 0, 3, 4, 5,
2369 399, 400, 401, 0, 0, 0, 0, 0, 0, 0,
2370 0, 0, 0, 0, 0, 402, 403, 0, 0, 0,
2371 0, 0, 0, 0, 0, 0, 0, 0, 0, 348,
2372 0, 0, 0, 0, 404, 0, 0, 0, 0, 0,
2373 0, 680, 0, 0, 0, 686, 687, 0, 0, 0,
2374 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2375 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2376 0, 0, 0, 0, 0, 0, 0, 706, 707, 0,
2377 708, 0, 710, 0, 0, 0, 713, 0, 0, 0,
2378 0, 0, 716, 0, 266, 206, 684, 685, 209, 210,
2379 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2380 268, 269, 270, 0, 271, 272, 351, 352, 0, 353,
2381 354, 0, 355, 356, 357, 0, 0, 0, 0, 0,
2382 0, 0, 394, 395, 396, 397, 64, 65, 398, 0,
2383 405, 0, 0, 406, 0, 407, 0, 408, 1, 2,
2384 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2385 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2386 403, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2387 0, 0, 0, 0, 111, 0, 64, 65, 404, 107,
2388 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2389 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2390 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2391 263, 264, 265, 0, 0, 0, 0, 0, 0, 74,
2392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2393 0, 0, 0, 0, 0, 0, 0, 0, 266, 206,
2394 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2395 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
2396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2398 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2399 0, 408, 394, 395, 396, 397, 64, 65, 398, 0,
2400 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2401 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2402 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2403 403, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2404 471, 0, 0, 0, 0, 0, 64, 65, 404, 107,
2405 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2406 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2407 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2408 263, 264, 265, 0, 0, 0, 0, 64, 65, 74,
2409 107, 158, 159, 160, 161, 162, 163, 73, 0, 1,
2410 2, 0, 3, 4, 5, 0, 0, 0, 266, 206,
2411 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2412 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
2413 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2414 394, 395, 396, 397, 0, 0, 398, 0, 0, 0,
2415 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2416 0, 408, 399, 400, 401, 0, 0, 0, 0, 0,
2417 0, 0, 0, 0, 0, 0, 0, 402, 403, 0,
2418 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2419 0, 0, 0, 0, 0, 0, 404, 0, 0, 0,
2420 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2421 488, 0, 183, 184, 185, 186, 187, 188, 189, 190,
2422 191, 192, 193, 194, 195, 196, 197, 262, 263, 264,
2423 265, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2424 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2425 78, 550, 0, 0, 0, 0, 266, 206, 207, 208,
2426 209, 210, 211, 212, 213, 214, 215, 216, 217, 0,
2427 267, 0, 268, 269, 270, 0, 271, 272, 64, 65,
2428 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2429 1, 2, 0, 3, 4, 5, 259, 0, 0, 0,
2430 0, 0, 405, 0, 0, 406, 0, 407, 0, 408,
2431 0, 260, 261, 0, 0, 0, 0, 0, 0, 0,
2432 0, 0, 0, 0, 64, 65, 111, 153, 67, 68,
2433 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2434 4, 5, 0, 0, 0, 0, 183, 184, 185, 186,
2435 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
2436 197, 262, 263, 264, 265, 0, 0, 74, 0, 0,
2437 0, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2438 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2439 266, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2440 215, 216, 217, 137, 267, 0, 268, 269, 270, 0,
2441 271, 272, 64, 65, 74, 153, 67, 68, 69, 70,
2442 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2443 112, 0, 64, 65, -67, 0, 273, 0, 0, 274,
2444 0, 275, 0, 276, 1, 2, 0, 3, 4, 5,
2445 259, 0, 0, 0, 0, 74, 0, 0, 283, 284,
2446 0, 285, 0, 0, 0, 260, 261, 0, 0, 0,
2447 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2448 111, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2449 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2450 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2451 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2452 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2453 154, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2454 0, 0, 0, 0, 266, 206, 207, 208, 209, 210,
2455 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2456 268, 269, 270, 0, 271, 272, 0, 0, 0, 75,
2457 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2458 0, 0, 0, 0, 112, 0, 0, 0, 0, 0,
2459 273, 0, 0, 274, 0, 275, 0, 276, 64, 65,
2460 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2461 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2462 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2463 359, 3, 4, 5, 0, 0, 0, 0, 0, 64,
2464 65, 74, 107, 158, 159, 160, 161, 162, 163, 73,
2465 0, 1, 2, 0, 3, 4, 5, 64, 65, 74,
2466 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2467 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2468 0, 0, 74, 0, 0, 0, 0, 0, 0, 544,
2469 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2470 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2471 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2472 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
2473 638, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2474 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2475 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2476 0, 78, 74, 0, 0, 0, 0, 0, 0, 0,
2477 0, 0, 0, 75, 76, 0, 381, 77, 0, 78,
2478 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2479 0, 0, 0, 0, 0, 0, 75, 76, 0, 484,
2480 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2481 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2482 78, 64, 65, 0, 107, 158, 159, 160, 161, 162,
2483 163, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2484 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2485 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2486 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2487 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2488 77, 0, 78, 64, 65, 0, 107, 67, 68, 69,
2489 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2490 5, 64, 65, 0, 289, 67, 68, 69, 70, 71,
2491 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2492 0, 0, 0, 0, 64, 65, 74, 107, 158, 159,
2493 160, 161, 162, 163, 73, 0, 1, 2, 0, 3,
2494 4, 5, 64, 65, 74, 107, 158, 159, 160, 161,
2495 162, 163, 73, 0, 1, 2, 0, 3, 4, 5,
2496 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2497 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2498 0, 0, 77, 0, 78, 74, 64, 65, 0, 107,
2499 67, 68, 69, 70, 71, 72, 645, 0, 1, 2,
2500 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
2501 69, 70, 71, 72, 689, 0, 1, 2, 0, 3,
2502 4, 5, 0, 0, 0, 0, 0, 0, 0, 74,
2503 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2504 75, 76, 0, 0, 77, 0, 78, 74, 0, 0,
2505 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2506 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2507 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2508 0, 75, 76, 0, 0, 77, 0, 384, 0, 0,
2509 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2510 76, 0, 0, 77, 0, 486, 0, 0, 0, 0,
2511 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2512 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2513 0, 0, 0, 0, 0, 174, 0, 0, 0, 0,
2514 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2515 0, 0, 0, 0, 0, 0, 175, 176, 0, 0,
2516 0, 75, 76, 0, 0, 77, 0, 78, 177, 178,
2517 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2518 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2519 199, 200, 201, 0, 0, 0, 0, 0, 0, 0,
2520 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2521 0, 0, 0, 202, 203, 204, 0, 0, 205, 206,
2522 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2523 217, 218, 219, 220, 221, 222, 223, 224, 225, 226
2526 static const yytype_int16 yycheck[] =
2528 0, 27, 179, 247, 166, 169, 204, 4, 11, 0,
2529 11, 467, 21, 274, 275, 28, 167, 17, 329, 11,
2530 29, 219, 220, 221, 222, 223, 17, 545, 180, 297,
2531 19, 229, 55, 22, 55, 24, 34, 55, 55, 53,
2532 200, 455, 456, 201, 11, 161, 7, 666, 162, 11,
2533 55, 162, 78, 59, 68, 17, 54, 171, 19, 55,
2534 171, 22, 54, 24, 683, 54, 42, 43, 44, 45,
2535 46, 47, 48, 49, 156, 51, 102, 345, 161, 231,
2536 106, 55, 162, 55, 166, 162, 112, 54, 162, 162,
2537 162, 171, 118, 93, 171, 169, 169, 248, 249, 171,
2538 162, 55, 262, 162, 264, 263, 162, 265, 167, 171,
2539 162, 167, 55, 32, 33, 167, 142, 143, 41, 42,
2540 146, 639, 18, 384, 38, 48, 152, 645, 646, 543,
2541 161, 54, 121, 122, 20, 591, 159, 23, 159, 162,
2542 163, 159, 159, 169, 405, 406, 407, 165, 169, 347,
2543 167, 177, 141, 142, 159, 144, 145, 170, 147, 148,
2544 149, 0, 171, 159, 167, 621, 167, 163, 686, 687,
2545 165, 689, 690, 170, 132, 133, 202, 203, 204, 205,
2546 156, 157, 158, 117, 118, 159, 160, 159, 706, 707,
2547 162, 163, 218, 219, 220, 221, 222, 223, 224, 225,
2548 226, 227, 228, 229, 161, 159, 34, 518, 290, 163,
2549 161, 293, 294, 239, 296, 413, 159, 160, 22, 3,
2550 4, 5, 6, 21, 250, 486, 159, 141, 142, 143,
2551 144, 429, 146, 431, 432, 433, 150, 151, 37, 153,
2552 154, 155, 26, 27, 132, 133, 42, 43, 44, 331,
2553 561, 47, 563, 417, 7, 8, 22, 339, 340, 341,
2554 342, 343, 35, 121, 37, 22, 19, 20, 22, 22,
2555 23, 24, 3, 4, 5, 6, 440, 4, 141, 142,
2556 143, 144, 308, 146, 46, 54, 48, 150, 151, 4,
2557 153, 154, 155, 151, 166, 42, 287, 44, 166, 325,
2558 326, 327, 62, 63, 64, 65, 66, 67, 163, 160,
2559 472, 162, 623, 141, 142, 143, 144, 160, 146, 162,
2560 346, 347, 150, 151, 159, 153, 154, 155, 4, 156,
2561 157, 158, 132, 133, 114, 115, 418, 419, 420, 421,
2562 160, 160, 162, 162, 160, 427, 162, 84, 85, 161,
2563 22, 162, 121, 122, 160, 169, 4, 601, 384, 441,
2564 9, 55, 26, 27, 9, 160, 564, 159, 9, 567,
2565 568, 569, 141, 142, 9, 144, 145, 9, 147, 148,
2566 149, 9, 57, 169, 11, 160, 22, 413, 159, 159,
2567 472, 417, 94, 95, 96, 97, 98, 99, 100, 101,
2568 102, 103, 4, 429, 430, 431, 432, 433, 159, 159,
2569 159, 159, 494, 439, 440, 159, 159, 499, 159, 501,
2570 159, 38, 504, 38, 162, 22, 670, 162, 162, 673,
2571 162, 457, 514, 515, 162, 517, 100, 101, 102, 103,
2572 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
2573 162, 162, 159, 159, 159, 481, 159, 61, 162, 159,
2574 486, 162, 38, 162, 162, 22, 162, 644, 165, 162,
2575 162, 162, 554, 555, 162, 557, 558, 559, 560, 162,
2576 162, 162, 162, 565, 0, 162, 17, 513, 17, 162,
2577 667, 573, 162, 519, 162, 169, 162, 579, 4, 162,
2578 162, 162, 18, 19, 20, 162, 22, 23, 24, 162,
2579 162, 162, 4, 539, 30, 31, 374, 375, 376, 377,
2580 378, 379, 380, 4, 162, 162, 169, 22, 0, 162,
2581 4, 389, 390, 391, 616, 169, 52, 162, 564, 162,
2582 56, 567, 568, 569, 60, 159, 18, 19, 20, 162,
2583 22, 23, 24, 162, 160, 162, 4, 162, 30, 31,
2584 293, 294, 162, 296, 159, 54, 160, 22, 169, 162,
2585 162, 160, 160, 17, 600, 162, 167, 160, 160, 165,
2586 52, 607, 664, 160, 56, 160, 668, 669, 60, 167,
2587 160, 160, 160, 54, 4, 162, 622, 152, 331, 599,
2588 458, 459, 460, 461, 22, 159, 339, 340, 341, 342,
2589 343, 469, 159, 17, 162, 17, 17, 73, 700, 701,
2590 17, 703, 661, 705, 93, 640, 112, 709, 239, 106,
2591 250, 7, 8, 715, 10, 11, 12, 13, 14, 15,
2592 16, 17, 17, 19, 20, 671, 22, 23, 24, 90,
2593 7, 8, 57, 10, 11, 12, 13, 14, 15, 16,
2594 17, 661, 19, 20, -1, 22, 23, 24, 133, 622,
2595 528, 529, 530, 531, 50, 533, 133, 462, -1, 537,
2596 538, -1, -1, -1, -1, 418, 419, 420, 421, -1,
2597 -1, -1, -1, 50, 427, -1, -1, 7, 8, -1,
2598 10, 11, 12, 13, 14, 15, 16, 17, 441, 19,
2599 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2600 -1, -1, -1, 581, 582, 583, 584, -1, -1, -1,
2601 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2602 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2603 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2604 -1, 494, -1, -1, -1, -1, 499, -1, 501, -1,
2605 628, 504, 630, 631, -1, -1, -1, -1, -1, -1,
2606 -1, 514, 515, -1, 517, -1, -1, -1, 164, 165,
2607 -1, -1, 168, -1, 170, 171, -1, -1, -1, -1,
2608 -1, -1, -1, -1, -1, -1, -1, 164, 165, -1,
2609 -1, 168, -1, 170, 171, -1, -1, -1, -1, -1,
2610 -1, 554, 555, -1, 557, 558, 559, 560, -1, -1,
2611 -1, -1, 565, -1, -1, -1, -1, -1, -1, -1,
2612 573, -1, -1, -1, -1, -1, 579, -1, -1, -1,
2613 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2614 170, 171, -1, -1, -1, -1, -1, -1, 3, 4,
2615 5, 6, 7, 8, 9, -1, -1, -1, -1, -1,
2616 -1, -1, -1, 616, 19, 20, -1, 22, 23, 24,
2617 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2618 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2619 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2620 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2621 -1, 664, -1, -1, -1, 668, 669, -1, -1, -1,
2622 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2623 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2624 -1, -1, -1, -1, -1, -1, -1, 700, 701, -1,
2625 703, -1, 705, -1, -1, -1, 709, -1, -1, -1,
2626 -1, -1, 715, -1, 119, 120, 121, 122, 123, 124,
2627 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2628 135, 136, 137, -1, 139, 140, 141, 142, -1, 144,
2629 145, -1, 147, 148, 149, -1, -1, -1, -1, -1,
2630 -1, -1, 3, 4, 5, 6, 7, 8, 9, -1,
2631 165, -1, -1, 168, -1, 170, -1, 172, 19, 20,
2632 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2633 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2634 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2635 -1, -1, -1, -1, 55, -1, 7, 8, 59, 10,
2636 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2637 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2638 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2639 91, 92, 93, -1, -1, -1, -1, -1, -1, 50,
2640 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2641 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2642 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2643 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2644 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2645 -1, -1, -1, -1, -1, -1, -1, -1, 159, -1,
2646 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2647 -1, 172, 3, 4, 5, 6, 7, 8, 9, -1,
2648 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2649 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2650 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2651 41, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2652 171, -1, -1, -1, -1, -1, 7, 8, 59, 10,
2653 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2654 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2655 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2656 91, 92, 93, -1, -1, -1, -1, 7, 8, 50,
2657 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2658 20, -1, 22, 23, 24, -1, -1, -1, 119, 120,
2659 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2660 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2661 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2662 3, 4, 5, 6, -1, -1, 9, -1, -1, -1,
2663 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2664 -1, 172, 25, 26, 27, -1, -1, -1, -1, -1,
2665 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2666 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2667 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2668 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2669 171, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2670 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2671 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2672 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2673 170, 171, -1, -1, -1, -1, 119, 120, 121, 122,
2674 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2675 133, -1, 135, 136, 137, -1, 139, 140, 7, 8,
2676 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2677 19, 20, -1, 22, 23, 24, 25, -1, -1, -1,
2678 -1, -1, 165, -1, -1, 168, -1, 170, -1, 172,
2679 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2680 -1, -1, -1, -1, 7, 8, 55, 10, 11, 12,
2681 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2682 23, 24, -1, -1, -1, -1, 75, 76, 77, 78,
2683 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2684 89, 90, 91, 92, 93, -1, -1, 50, -1, -1,
2685 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2686 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2687 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2688 129, 130, 131, 39, 133, -1, 135, 136, 137, -1,
2689 139, 140, 7, 8, 50, 10, 11, 12, 13, 14,
2690 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2691 159, -1, 7, 8, 163, -1, 165, -1, -1, 168,
2692 -1, 170, -1, 172, 19, 20, -1, 22, 23, 24,
2693 25, -1, -1, -1, -1, 50, -1, -1, 141, 142,
2694 -1, 144, -1, -1, -1, 40, 41, -1, -1, -1,
2695 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2696 55, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2697 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2698 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2699 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2700 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2701 125, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2702 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2703 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2704 135, 136, 137, -1, 139, 140, -1, -1, -1, 164,
2705 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
2706 -1, -1, -1, -1, 159, -1, -1, -1, -1, -1,
2707 165, -1, -1, 168, -1, 170, -1, 172, 7, 8,
2708 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2709 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2710 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2711 39, 22, 23, 24, -1, -1, -1, -1, -1, 7,
2712 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2713 -1, 19, 20, -1, 22, 23, 24, 7, 8, 50,
2714 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2715 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2716 -1, -1, 50, -1, -1, -1, -1, -1, -1, 39,
2717 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2718 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2719 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2720 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2721 39, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2722 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2723 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2724 -1, 170, 50, -1, -1, -1, -1, -1, -1, -1,
2725 -1, -1, -1, 164, 165, -1, 167, 168, -1, 170,
2726 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2727 -1, -1, -1, -1, -1, -1, 164, 165, -1, 167,
2728 168, -1, 170, -1, -1, -1, -1, -1, -1, -1,
2729 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2730 170, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2731 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2732 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2733 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2734 -1, 170, -1, -1, 50, -1, -1, -1, -1, -1,
2735 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2736 168, -1, 170, 7, 8, -1, 10, 11, 12, 13,
2737 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2738 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2739 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2740 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2741 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2742 23, 24, 7, 8, 50, 10, 11, 12, 13, 14,
2743 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2744 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2745 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2746 -1, -1, 168, -1, 170, 50, 7, 8, -1, 10,
2747 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2748 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2749 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2750 23, 24, -1, -1, -1, -1, -1, -1, -1, 50,
2751 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2752 164, 165, -1, -1, 168, -1, 170, 50, -1, -1,
2753 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2754 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2755 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2756 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2757 -1, -1, -1, -1, -1, -1, -1, -1, -1, 164,
2758 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
2759 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2760 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2761 -1, -1, -1, -1, -1, 36, -1, -1, -1, -1,
2762 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2763 -1, -1, -1, -1, -1, -1, 57, 58, -1, -1,
2764 -1, 164, 165, -1, -1, 168, -1, 170, 69, 70,
2765 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2766 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2767 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
2768 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2769 -1, -1, -1, 114, 115, 116, -1, -1, 119, 120,
2770 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2771 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
2774 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2775 symbol of state STATE-NUM. */
2776 static const yytype_uint16 yystos[] =
2778 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2779 60, 181, 184, 186, 187, 188, 222, 223, 224, 226,
2780 225, 53, 68, 231, 161, 59, 161, 18, 161, 42,
2781 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
2782 158, 189, 190, 191, 0, 224, 46, 48, 192, 241,
2783 42, 43, 44, 47, 193, 238, 240, 248, 161, 161,
2784 165, 232, 22, 230, 7, 8, 10, 11, 12, 13,
2785 14, 15, 16, 17, 50, 164, 165, 168, 170, 181,
2786 186, 209, 210, 244, 191, 191, 35, 37, 220, 191,
2787 191, 21, 249, 250, 29, 171, 239, 249, 22, 22,
2788 22, 233, 159, 4, 4, 4, 170, 10, 171, 210,
2789 215, 55, 159, 183, 220, 220, 42, 44, 194, 32,
2790 33, 219, 62, 63, 64, 65, 66, 67, 195, 236,
2791 236, 7, 184, 185, 253, 162, 167, 39, 210, 211,
2792 213, 214, 166, 166, 171, 215, 162, 171, 159, 214,
2793 163, 219, 219, 10, 125, 210, 212, 221, 11, 12,
2794 13, 14, 15, 16, 179, 180, 210, 216, 4, 199,
2795 28, 170, 237, 161, 36, 57, 58, 69, 70, 71,
2796 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2797 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2798 92, 93, 114, 115, 116, 119, 120, 121, 122, 123,
2799 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
2800 134, 135, 136, 137, 138, 139, 140, 174, 175, 176,
2801 251, 258, 259, 260, 261, 251, 259, 22, 197, 162,
2802 160, 210, 210, 169, 171, 210, 4, 160, 216, 210,
2803 159, 244, 26, 27, 3, 4, 5, 6, 9, 25,
2804 40, 41, 90, 91, 92, 93, 119, 133, 135, 136,
2805 137, 139, 140, 165, 168, 170, 172, 174, 175, 176,
2806 217, 244, 183, 141, 142, 144, 198, 212, 57, 10,
2807 210, 246, 247, 11, 17, 11, 179, 195, 94, 95,
2808 96, 97, 98, 99, 100, 101, 102, 103, 177, 26,
2809 27, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2810 109, 110, 111, 112, 113, 178, 177, 178, 210, 210,
2811 246, 210, 210, 254, 246, 246, 246, 246, 246, 210,
2812 210, 210, 210, 210, 246, 195, 117, 118, 54, 121,
2813 122, 141, 142, 144, 145, 147, 148, 149, 196, 39,
2814 211, 201, 167, 169, 169, 160, 201, 183, 183, 221,
2815 177, 178, 177, 178, 159, 159, 159, 159, 159, 159,
2816 159, 167, 216, 218, 170, 218, 171, 218, 22, 159,
2817 159, 159, 227, 186, 3, 4, 5, 6, 9, 25,
2818 26, 27, 40, 41, 59, 165, 168, 170, 172, 217,
2819 243, 244, 245, 162, 245, 245, 245, 199, 210, 210,
2820 210, 210, 162, 204, 162, 204, 245, 165, 162, 162,
2821 162, 162, 162, 162, 245, 245, 245, 245, 245, 38,
2822 199, 210, 246, 4, 141, 142, 143, 144, 146, 150,
2823 151, 153, 154, 155, 200, 228, 229, 38, 159, 159,
2824 159, 159, 216, 216, 216, 216, 216, 216, 216, 162,
2825 167, 171, 210, 218, 169, 171, 216, 216, 216, 162,
2826 207, 159, 61, 242, 167, 218, 170, 218, 171, 218,
2827 22, 246, 162, 162, 212, 245, 245, 245, 245, 11,
2828 54, 11, 256, 245, 165, 246, 210, 246, 246, 246,
2829 162, 162, 257, 162, 162, 162, 210, 212, 245, 162,
2830 207, 207, 210, 216, 216, 216, 216, 256, 162, 162,
2831 162, 162, 257, 162, 216, 169, 171, 162, 162, 38,
2832 34, 54, 205, 208, 39, 210, 234, 235, 22, 167,
2833 171, 218, 169, 171, 17, 17, 245, 162, 162, 162,
2834 162, 245, 4, 245, 162, 162, 245, 162, 162, 162,
2835 4, 4, 162, 210, 245, 245, 245, 162, 204, 210,
2836 160, 162, 162, 162, 162, 160, 216, 216, 216, 216,
2837 160, 216, 169, 216, 216, 210, 22, 4, 207, 197,
2838 162, 160, 162, 169, 171, 245, 245, 159, 245, 245,
2839 245, 245, 204, 204, 246, 245, 162, 246, 246, 246,
2840 4, 245, 159, 245, 216, 216, 216, 216, 162, 160,
2841 162, 162, 257, 160, 160, 160, 181, 182, 39, 210,
2842 201, 22, 169, 162, 165, 17, 210, 255, 167, 245,
2843 257, 255, 204, 160, 160, 160, 160, 216, 216, 216,
2844 160, 197, 205, 206, 17, 167, 179, 252, 197, 197,
2845 160, 162, 167, 160, 160, 160, 160, 182, 54, 203,
2846 245, 243, 167, 179, 121, 122, 245, 245, 201, 17,
2847 210, 201, 4, 152, 202, 162, 243, 197, 197, 38,
2848 197, 197, 22, 17, 162, 17, 245, 245, 245, 17,
2849 245, 197, 197, 245, 73, 17, 245
2852 #define yyerrok (yyerrstatus = 0)
2853 #define yyclearin (yychar = YYEMPTY)
2854 #define YYEMPTY (-2)
2857 #define YYACCEPT goto yyacceptlab
2858 #define YYABORT goto yyabortlab
2859 #define YYERROR goto yyerrorlab
2862 /* Like YYERROR except do call yyerror. This remains here temporarily
2863 to ease the transition to the new meaning of YYERROR, for GCC.
2864 Once GCC version 2 has supplanted version 1, this can go. */
2866 #define YYFAIL goto yyerrlab
2868 #define YYRECOVERING() (!!yyerrstatus)
2870 #define YYBACKUP(Token, Value) \
2872 if (yychar == YYEMPTY && yylen == 1) \
2876 yytoken = YYTRANSLATE (yychar); \
2882 yyerror (YY_("syntax error: cannot back up")); \
2889 #define YYERRCODE 256
2892 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2893 If N is 0, then set CURRENT to the empty location which ends
2894 the previous symbol: RHS[0] (always defined). */
2896 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2897 #ifndef YYLLOC_DEFAULT
2898 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2902 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2903 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2904 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2905 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2909 (Current).first_line = (Current).last_line = \
2910 YYRHSLOC (Rhs, 0).last_line; \
2911 (Current).first_column = (Current).last_column = \
2912 YYRHSLOC (Rhs, 0).last_column; \
2918 /* YY_LOCATION_PRINT -- Print the location on the stream.
2919 This macro was not mandated originally: define only if we know
2920 we won't break user code: when these are the locations we know. */
2922 #ifndef YY_LOCATION_PRINT
2923 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2924 # define YY_LOCATION_PRINT(File, Loc) \
2925 fprintf (File, "%d.%d-%d.%d", \
2926 (Loc).first_line, (Loc).first_column, \
2927 (Loc).last_line, (Loc).last_column)
2929 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2934 /* YYLEX -- calling `yylex' with the right arguments. */
2937 # define YYLEX yylex (YYLEX_PARAM)
2939 # define YYLEX yylex ()
2942 /* Enable debugging if requested. */
2946 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2947 # define YYFPRINTF fprintf
2950 # define YYDPRINTF(Args) \
2956 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2960 YYFPRINTF (stderr, "%s ", Title); \
2961 yy_symbol_print (stderr, \
2963 YYFPRINTF (stderr, "\n"); \
2968 /*--------------------------------.
2969 | Print this symbol on YYOUTPUT. |
2970 `--------------------------------*/
2973 #if (defined __STDC__ || defined __C99__FUNC__ \
2974 || defined __cplusplus || defined _MSC_VER)
2976 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2979 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2982 YYSTYPE const * const yyvaluep;
2988 if (yytype < YYNTOKENS)
2989 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
3001 /*--------------------------------.
3002 | Print this symbol on YYOUTPUT. |
3003 `--------------------------------*/
3005 #if (defined __STDC__ || defined __C99__FUNC__ \
3006 || defined __cplusplus || defined _MSC_VER)
3008 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3011 yy_symbol_print (yyoutput, yytype, yyvaluep)
3014 YYSTYPE const * const yyvaluep;
3017 if (yytype < YYNTOKENS)
3018 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3020 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
3022 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3023 YYFPRINTF (yyoutput, ")");
3026 /*------------------------------------------------------------------.
3027 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
3029 `------------------------------------------------------------------*/
3031 #if (defined __STDC__ || defined __C99__FUNC__ \
3032 || defined __cplusplus || defined _MSC_VER)
3034 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3037 yy_stack_print (bottom, top)
3038 yytype_int16 *bottom;
3042 YYFPRINTF (stderr, "Stack now");
3043 for (; bottom <= top; ++bottom)
3044 YYFPRINTF (stderr, " %d", *bottom);
3045 YYFPRINTF (stderr, "\n");
3048 # define YY_STACK_PRINT(Bottom, Top) \
3051 yy_stack_print ((Bottom), (Top)); \
3055 /*------------------------------------------------.
3056 | Report that the YYRULE is going to be reduced. |
3057 `------------------------------------------------*/
3059 #if (defined __STDC__ || defined __C99__FUNC__ \
3060 || defined __cplusplus || defined _MSC_VER)
3062 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3065 yy_reduce_print (yyvsp, yyrule)
3070 int yynrhs = yyr2[yyrule];
3072 unsigned long int yylno = yyrline[yyrule];
3073 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3075 /* The symbols being reduced. */
3076 for (yyi = 0; yyi < yynrhs; yyi++)
3078 fprintf (stderr, " $%d = ", yyi + 1);
3079 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3080 &(yyvsp[(yyi + 1) - (yynrhs)])
3082 fprintf (stderr, "\n");
3086 # define YY_REDUCE_PRINT(Rule) \
3089 yy_reduce_print (yyvsp, Rule); \
3092 /* Nonzero means print parse trace. It is left uninitialized so that
3093 multiple parsers can coexist. */
3095 #else /* !YYDEBUG */
3096 # define YYDPRINTF(Args)
3097 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3098 # define YY_STACK_PRINT(Bottom, Top)
3099 # define YY_REDUCE_PRINT(Rule)
3100 #endif /* !YYDEBUG */
3103 /* YYINITDEPTH -- initial size of the parser's stacks. */
3105 # define YYINITDEPTH 200
3108 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3109 if the built-in stack extension method is used).
3111 Do not make this value too large; the results are undefined if
3112 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3113 evaluated with infinite-precision integer arithmetic. */
3116 # define YYMAXDEPTH 10000
3124 # if defined __GLIBC__ && defined _STRING_H
3125 # define yystrlen strlen
3127 /* Return the length of YYSTR. */
3128 #if (defined __STDC__ || defined __C99__FUNC__ \
3129 || defined __cplusplus || defined _MSC_VER)
3131 yystrlen (const char *yystr)
3139 for (yylen = 0; yystr[yylen]; yylen++)
3147 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3148 # define yystpcpy stpcpy
3150 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3152 #if (defined __STDC__ || defined __C99__FUNC__ \
3153 || defined __cplusplus || defined _MSC_VER)
3155 yystpcpy (char *yydest, const char *yysrc)
3158 yystpcpy (yydest, yysrc)
3164 const char *yys = yysrc;
3166 while ((*yyd++ = *yys++) != '\0')
3175 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3176 quotes and backslashes, so that it's suitable for yyerror. The
3177 heuristic is that double-quoting is unnecessary unless the string
3178 contains an apostrophe, a comma, or backslash (other than
3179 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3180 null, do not copy; instead, return the length of what the result
3183 yytnamerr (char *yyres, const char *yystr)
3188 char const *yyp = yystr;
3195 goto do_not_strip_quotes;
3199 goto do_not_strip_quotes;
3212 do_not_strip_quotes: ;
3216 return yystrlen (yystr);
3218 return yystpcpy (yyres, yystr) - yyres;
3222 /* Copy into YYRESULT an error message about the unexpected token
3223 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3224 including the terminating null byte. If YYRESULT is null, do not
3225 copy anything; just return the number of bytes that would be
3226 copied. As a special case, return 0 if an ordinary "syntax error"
3227 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3228 size calculation. */
3230 yysyntax_error (char *yyresult, int yystate, int yychar)
3232 int yyn = yypact[yystate];
3234 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3238 int yytype = YYTRANSLATE (yychar);
3239 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3240 YYSIZE_T yysize = yysize0;
3242 int yysize_overflow = 0;
3243 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3244 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3248 /* This is so xgettext sees the translatable formats that are
3249 constructed on the fly. */
3250 YY_("syntax error, unexpected %s");
3251 YY_("syntax error, unexpected %s, expecting %s");
3252 YY_("syntax error, unexpected %s, expecting %s or %s");
3253 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3254 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3258 static char const yyunexpected[] = "syntax error, unexpected %s";
3259 static char const yyexpecting[] = ", expecting %s";
3260 static char const yyor[] = " or %s";
3261 char yyformat[sizeof yyunexpected
3262 + sizeof yyexpecting - 1
3263 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3264 * (sizeof yyor - 1))];
3265 char const *yyprefix = yyexpecting;
3267 /* Start YYX at -YYN if negative to avoid negative indexes in
3269 int yyxbegin = yyn < 0 ? -yyn : 0;
3271 /* Stay within bounds of both yycheck and yytname. */
3272 int yychecklim = YYLAST - yyn + 1;
3273 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3276 yyarg[0] = yytname[yytype];
3277 yyfmt = yystpcpy (yyformat, yyunexpected);
3279 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3280 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3282 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3286 yyformat[sizeof yyunexpected - 1] = '\0';
3289 yyarg[yycount++] = yytname[yyx];
3290 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3291 yysize_overflow |= (yysize1 < yysize);
3293 yyfmt = yystpcpy (yyfmt, yyprefix);
3297 yyf = YY_(yyformat);
3298 yysize1 = yysize + yystrlen (yyf);
3299 yysize_overflow |= (yysize1 < yysize);
3302 if (yysize_overflow)
3303 return YYSIZE_MAXIMUM;
3307 /* Avoid sprintf, as that infringes on the user's name space.
3308 Don't have undefined behavior even if the translation
3309 produced a string with the wrong number of "%s"s. */
3310 char *yyp = yyresult;
3312 while ((*yyp = *yyf) != '\0')
3314 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3316 yyp += yytnamerr (yyp, yyarg[yyi++]);
3329 #endif /* YYERROR_VERBOSE */
3332 /*-----------------------------------------------.
3333 | Release the memory associated to this symbol. |
3334 `-----------------------------------------------*/
3337 #if (defined __STDC__ || defined __C99__FUNC__ \
3338 || defined __cplusplus || defined _MSC_VER)
3340 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3343 yydestruct (yymsg, yytype, yyvaluep)
3353 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3364 /* Prevent warnings from -Wmissing-prototypes. */
3366 #ifdef YYPARSE_PARAM
3367 #if defined __STDC__ || defined __cplusplus
3368 int yyparse (void *YYPARSE_PARAM);
3372 #else /* ! YYPARSE_PARAM */
3373 #if defined __STDC__ || defined __cplusplus
3378 #endif /* ! YYPARSE_PARAM */
3382 /* The look-ahead symbol. */
3385 /* The semantic value of the look-ahead symbol. */
3388 /* Number of syntax errors so far. */
3397 #ifdef YYPARSE_PARAM
3398 #if (defined __STDC__ || defined __C99__FUNC__ \
3399 || defined __cplusplus || defined _MSC_VER)
3401 yyparse (void *YYPARSE_PARAM)
3404 yyparse (YYPARSE_PARAM)
3405 void *YYPARSE_PARAM;
3407 #else /* ! YYPARSE_PARAM */
3408 #if (defined __STDC__ || defined __C99__FUNC__ \
3409 || defined __cplusplus || defined _MSC_VER)
3423 /* Number of tokens to shift before error messages enabled. */
3425 /* Look-ahead token as an internal (translated) token number. */
3428 /* Buffer for error messages, and its allocated size. */
3430 char *yymsg = yymsgbuf;
3431 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3434 /* Three stacks and their tools:
3435 `yyss': related to states,
3436 `yyvs': related to semantic values,
3437 `yyls': related to locations.
3439 Refer to the stacks thru separate pointers, to allow yyoverflow
3440 to reallocate them elsewhere. */
3442 /* The state stack. */
3443 yytype_int16 yyssa[YYINITDEPTH];
3444 yytype_int16 *yyss = yyssa;
3445 yytype_int16 *yyssp;
3447 /* The semantic value stack. */
3448 YYSTYPE yyvsa[YYINITDEPTH];
3449 YYSTYPE *yyvs = yyvsa;
3454 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3456 YYSIZE_T yystacksize = YYINITDEPTH;
3458 /* The variables used to return semantic value and location from the
3463 /* The number of symbols on the RHS of the reduced rule.
3464 Keep to zero when no symbol should be popped. */
3467 YYDPRINTF ((stderr, "Starting parse\n"));
3472 yychar = YYEMPTY; /* Cause a token to be read. */
3474 /* Initialize stack pointers.
3475 Waste one element of value and location stack
3476 so that they stay on the same level as the state stack.
3477 The wasted elements are never initialized. */
3484 /*------------------------------------------------------------.
3485 | yynewstate -- Push a new state, which is found in yystate. |
3486 `------------------------------------------------------------*/
3488 /* In all cases, when you get here, the value and location stacks
3489 have just been pushed. So pushing a state here evens the stacks. */
3495 if (yyss + yystacksize - 1 <= yyssp)
3497 /* Get the current used size of the three stacks, in elements. */
3498 YYSIZE_T yysize = yyssp - yyss + 1;
3502 /* Give user a chance to reallocate the stack. Use copies of
3503 these so that the &'s don't force the real ones into
3505 YYSTYPE *yyvs1 = yyvs;
3506 yytype_int16 *yyss1 = yyss;
3509 /* Each stack pointer address is followed by the size of the
3510 data in use in that stack, in bytes. This used to be a
3511 conditional around just the two extra args, but that might
3512 be undefined if yyoverflow is a macro. */
3513 yyoverflow (YY_("memory exhausted"),
3514 &yyss1, yysize * sizeof (*yyssp),
3515 &yyvs1, yysize * sizeof (*yyvsp),
3522 #else /* no yyoverflow */
3523 # ifndef YYSTACK_RELOCATE
3524 goto yyexhaustedlab;
3526 /* Extend the stack our own way. */
3527 if (YYMAXDEPTH <= yystacksize)
3528 goto yyexhaustedlab;
3530 if (YYMAXDEPTH < yystacksize)
3531 yystacksize = YYMAXDEPTH;
3534 yytype_int16 *yyss1 = yyss;
3535 union yyalloc *yyptr =
3536 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3538 goto yyexhaustedlab;
3539 YYSTACK_RELOCATE (yyss);
3540 YYSTACK_RELOCATE (yyvs);
3542 # undef YYSTACK_RELOCATE
3544 YYSTACK_FREE (yyss1);
3547 #endif /* no yyoverflow */
3549 yyssp = yyss + yysize - 1;
3550 yyvsp = yyvs + yysize - 1;
3553 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3554 (unsigned long int) yystacksize));
3556 if (yyss + yystacksize - 1 <= yyssp)
3560 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3569 /* Do appropriate processing given the current state. Read a
3570 look-ahead token if we need one and don't already have one. */
3572 /* First try to decide what to do without reference to look-ahead token. */
3573 yyn = yypact[yystate];
3574 if (yyn == YYPACT_NINF)
3577 /* Not known => get a look-ahead token if don't already have one. */
3579 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3580 if (yychar == YYEMPTY)
3582 YYDPRINTF ((stderr, "Reading a token: "));
3586 if (yychar <= YYEOF)
3588 yychar = yytoken = YYEOF;
3589 YYDPRINTF ((stderr, "Now at end of input.\n"));
3593 yytoken = YYTRANSLATE (yychar);
3594 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3597 /* If the proper action on seeing token YYTOKEN is to reduce or to
3598 detect an error, take that action. */
3600 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3605 if (yyn == 0 || yyn == YYTABLE_NINF)
3614 /* Count tokens shifted since error; after three, turn off error
3619 /* Shift the look-ahead token. */
3620 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3622 /* Discard the shifted token unless it is eof. */
3623 if (yychar != YYEOF)
3632 /*-----------------------------------------------------------.
3633 | yydefault -- do the default action for the current state. |
3634 `-----------------------------------------------------------*/
3636 yyn = yydefact[yystate];
3642 /*-----------------------------.
3643 | yyreduce -- Do a reduction. |
3644 `-----------------------------*/
3646 /* yyn is the number of a rule to reduce with. */
3649 /* If YYLEN is nonzero, implement the default value of the action:
3652 Otherwise, the following line sets YYVAL to garbage.
3653 This behavior is undocumented and Bison
3654 users should not rely upon it. Assigning to YYVAL
3655 unconditionally makes the parser a bit smaller, and it avoids a
3656 GCC warning that YYVAL may be used uninitialized. */
3657 yyval = yyvsp[1-yylen];
3660 YY_REDUCE_PRINT (yyn);
3664 #line 1146 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3665 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3669 #line 1146 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3670 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3674 #line 1147 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3675 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3679 #line 1147 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3680 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3684 #line 1148 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3685 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3689 #line 1148 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3690 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3694 #line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3695 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3699 #line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3700 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3704 #line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3705 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3709 #line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3710 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3714 #line 1154 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3715 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3719 #line 1154 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3720 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3724 #line 1155 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3725 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3729 #line 1155 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3730 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3734 #line 1156 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3735 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3739 #line 1156 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3740 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3744 #line 1157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3745 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3749 #line 1157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3750 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3754 #line 1158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3755 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3759 #line 1158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3760 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3764 #line 1159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3765 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3769 #line 1159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3770 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3774 #line 1160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3775 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3779 #line 1160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3780 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3784 #line 1161 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3785 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3789 #line 1162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3790 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3794 #line 1171 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3795 { (yyval.StrVal) = 0; ;}
3799 #line 1173 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3800 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3804 #line 1174 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3805 { (yyval.UIntVal)=0; ;}
3809 #line 1178 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3811 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3817 #line 1182 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3825 #line 1187 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3827 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3833 #line 1196 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3841 #line 1201 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3843 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3849 #line 1207 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3850 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3854 #line 1208 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3855 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3859 #line 1209 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3860 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3864 #line 1210 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3865 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3869 #line 1211 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3870 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3874 #line 1212 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3875 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
3879 #line 1216 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3880 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3884 #line 1217 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3885 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3889 #line 1218 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3890 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3894 #line 1222 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3895 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3899 #line 1223 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3900 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3904 #line 1224 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3905 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3909 #line 1225 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3910 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3914 #line 1229 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3915 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3919 #line 1230 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3920 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3924 #line 1231 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3925 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3929 #line 1235 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3930 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3934 #line 1236 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3935 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3939 #line 1237 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3940 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3944 #line 1238 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3945 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3949 #line 1239 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3950 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3954 #line 1243 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3955 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3959 #line 1244 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3960 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3964 #line 1245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3965 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3969 #line 1248 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3970 { (yyval.UIntVal) = CallingConv::C; ;}
3974 #line 1249 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3975 { (yyval.UIntVal) = CallingConv::C; ;}
3979 #line 1250 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3980 { (yyval.UIntVal) = CallingConv::Fast; ;}
3984 #line 1251 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3985 { (yyval.UIntVal) = CallingConv::Cold; ;}
3989 #line 1252 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3990 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3994 #line 1253 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3995 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3999 #line 1254 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4001 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
4002 GEN_ERROR("Calling conv too large");
4003 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4009 #line 1261 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4010 { (yyval.Attributes) = Attribute::ZExt; ;}
4014 #line 1262 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4015 { (yyval.Attributes) = Attribute::ZExt; ;}
4019 #line 1263 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4020 { (yyval.Attributes) = Attribute::SExt; ;}
4024 #line 1264 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4025 { (yyval.Attributes) = Attribute::SExt; ;}
4029 #line 1265 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4030 { (yyval.Attributes) = Attribute::InReg; ;}
4034 #line 1266 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4035 { (yyval.Attributes) = Attribute::StructRet; ;}
4039 #line 1267 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4040 { (yyval.Attributes) = Attribute::NoAlias; ;}
4044 #line 1268 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4045 { (yyval.Attributes) = Attribute::ByVal; ;}
4049 #line 1269 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4050 { (yyval.Attributes) = Attribute::Nest; ;}
4054 #line 1270 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4055 { (yyval.Attributes) =
4056 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4060 #line 1274 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4061 { (yyval.Attributes) = Attribute::None; ;}
4065 #line 1275 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4067 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4072 #line 1280 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4073 { (yyval.Attributes) = Attribute::InReg; ;}
4077 #line 1281 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4078 { (yyval.Attributes) = Attribute::ZExt; ;}
4082 #line 1282 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4083 { (yyval.Attributes) = Attribute::SExt; ;}
4087 #line 1285 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4088 { (yyval.Attributes) = Attribute::None; ;}
4092 #line 1286 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4094 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4099 #line 1292 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4100 { (yyval.Attributes) = Attribute::NoReturn; ;}
4104 #line 1293 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4105 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4109 #line 1294 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4110 { (yyval.Attributes) = Attribute::InReg; ;}
4114 #line 1295 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4115 { (yyval.Attributes) = Attribute::ZExt; ;}
4119 #line 1296 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4120 { (yyval.Attributes) = Attribute::SExt; ;}
4124 #line 1297 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4125 { (yyval.Attributes) = Attribute::ReadNone; ;}
4129 #line 1298 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4130 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4134 #line 1299 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4135 { (yyval.Attributes) = Attribute::NoInline; ;}
4139 #line 1300 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4140 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
4144 #line 1301 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4145 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
4149 #line 1304 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4150 { (yyval.Attributes) = Attribute::None; ;}
4154 #line 1305 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4156 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4161 #line 1311 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4162 { (yyval.StrVal) = 0; ;}
4166 #line 1312 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4168 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4173 #line 1319 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4174 { (yyval.UIntVal) = 0; ;}
4178 #line 1320 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4180 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4181 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4182 GEN_ERROR("Alignment must be a power of two");
4188 #line 1326 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4189 { (yyval.UIntVal) = 0; ;}
4193 #line 1327 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4195 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4196 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4197 GEN_ERROR("Alignment must be a power of two");
4203 #line 1336 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4205 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4206 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
4207 GEN_ERROR("Invalid character in section name");
4208 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4214 #line 1344 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4215 { (yyval.StrVal) = 0; ;}
4219 #line 1345 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4220 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4224 #line 1350 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4229 #line 1351 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4234 #line 1352 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4236 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4237 delete (yyvsp[(1) - (1)].StrVal);
4243 #line 1357 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4245 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4246 GEN_ERROR("Alignment must be a power of two");
4247 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4253 #line 1373 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4255 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4261 #line 1377 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4263 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4269 #line 1381 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4271 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4272 GEN_ERROR("Cannot form a pointer to a basic block");
4273 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4274 delete (yyvsp[(1) - (3)].TypeVal);
4280 #line 1388 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4281 { // Named types are also simple types...
4282 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4284 (yyval.TypeVal) = new PATypeHolder(tmp);
4289 #line 1393 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4290 { // Type UpReference
4291 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4292 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4293 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4294 (yyval.TypeVal) = new PATypeHolder(OT);
4295 UR_OUT("New Upreference!\n");
4301 #line 1401 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4303 // Allow but ignore attributes on function types; this permits auto-upgrade.
4304 // FIXME: remove in LLVM 3.0.
4305 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4306 if (!FunctionType::isValidReturnType(RetTy))
4307 GEN_ERROR("Invalid result type for LLVM function");
4309 std::vector<const Type*> Params;
4310 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4311 for (; I != E; ++I ) {
4312 const Type *Ty = I->Ty->get();
4313 Params.push_back(Ty);
4316 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4317 if (isVarArg) Params.pop_back();
4319 for (unsigned i = 0; i != Params.size(); ++i)
4320 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4321 GEN_ERROR("Function arguments must be value types!");
4325 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4326 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4327 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4329 // Delete the argument list
4330 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4333 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4340 #line 1436 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4342 // Allow but ignore attributes on function types; this permits auto-upgrade.
4343 // FIXME: remove in LLVM 3.0.
4344 std::vector<const Type*> Params;
4345 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4346 for ( ; I != E; ++I ) {
4347 const Type* Ty = I->Ty->get();
4348 Params.push_back(Ty);
4351 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4352 if (isVarArg) Params.pop_back();
4354 for (unsigned i = 0; i != Params.size(); ++i)
4355 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4356 GEN_ERROR("Function arguments must be value types!");
4360 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4361 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4363 // Delete the argument list
4364 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4367 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4374 #line 1467 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4375 { // Sized array type?
4376 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
4377 delete (yyvsp[(4) - (5)].TypeVal);
4383 #line 1472 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4385 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4386 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4387 GEN_ERROR("Unsigned result not equal to signed result");
4388 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4389 GEN_ERROR("Element type of a VectorType must be primitive");
4390 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4391 delete (yyvsp[(4) - (5)].TypeVal);
4397 #line 1482 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4398 { // Structure type?
4399 std::vector<const Type*> Elements;
4400 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4401 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4402 Elements.push_back(*I);
4404 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4405 delete (yyvsp[(2) - (3)].TypeList);
4411 #line 1492 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4412 { // Empty structure type?
4413 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4419 #line 1496 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4421 std::vector<const Type*> Elements;
4422 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4423 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4424 Elements.push_back(*I);
4426 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4427 delete (yyvsp[(3) - (5)].TypeList);
4433 #line 1506 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4434 { // Empty structure type?
4435 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4441 #line 1513 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4443 // Allow but ignore attributes on function types; this permits auto-upgrade.
4444 // FIXME: remove in LLVM 3.0.
4445 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4446 (yyval.TypeWithAttrs).Attrs = Attribute::None;
4451 #line 1522 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4453 if (!UpRefs.empty())
4454 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4455 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4456 GEN_ERROR("LLVM functions cannot return aggregate types");
4457 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4462 #line 1529 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4464 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4469 #line 1534 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4471 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4472 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4478 #line 1539 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4480 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4486 #line 1547 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4488 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4489 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
4490 TWA.Ty = new PATypeHolder(Type::VoidTy);
4491 (yyval.TypeWithAttrsList)->push_back(TWA);
4497 #line 1554 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4499 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4500 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
4501 TWA.Ty = new PATypeHolder(Type::VoidTy);
4502 (yyval.TypeWithAttrsList)->push_back(TWA);
4508 #line 1561 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4510 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4516 #line 1569 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4518 (yyval.TypeList) = new std::list<PATypeHolder>();
4519 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4520 delete (yyvsp[(1) - (1)].TypeVal);
4526 #line 1575 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4528 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4529 delete (yyvsp[(3) - (3)].TypeVal);
4535 #line 1587 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4536 { // Nonempty unsized arr
4537 if (!UpRefs.empty())
4538 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4539 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4541 GEN_ERROR("Cannot make array constant with type: '" +
4542 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4543 const Type *ETy = ATy->getElementType();
4544 uint64_t NumElements = ATy->getNumElements();
4546 // Verify that we have the correct size...
4547 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
4548 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4549 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4550 utostr(NumElements) + "");
4552 // Verify all elements are correct type!
4553 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4554 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4555 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4556 ETy->getDescription() +"' as required!\nIt is of type '"+
4557 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4560 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4561 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4567 #line 1615 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4569 if (!UpRefs.empty())
4570 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4571 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4573 GEN_ERROR("Cannot make array constant with type: '" +
4574 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4576 uint64_t NumElements = ATy->getNumElements();
4577 if (NumElements != uint64_t(-1) && NumElements != 0)
4578 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4579 " arguments, but has size of " + utostr(NumElements) +"");
4580 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4581 delete (yyvsp[(1) - (3)].TypeVal);
4587 #line 1631 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4589 if (!UpRefs.empty())
4590 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4591 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4593 GEN_ERROR("Cannot make array constant with type: '" +
4594 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4596 uint64_t NumElements = ATy->getNumElements();
4597 const Type *ETy = ATy->getElementType();
4598 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
4599 GEN_ERROR("Can't build string constant of size " +
4600 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4601 " when array has size " + utostr(NumElements) + "");
4602 std::vector<Constant*> Vals;
4603 if (ETy == Type::Int8Ty) {
4604 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4605 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4607 delete (yyvsp[(3) - (3)].StrVal);
4608 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4610 delete (yyvsp[(3) - (3)].StrVal);
4611 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4612 delete (yyvsp[(1) - (3)].TypeVal);
4618 #line 1658 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4619 { // Nonempty unsized arr
4620 if (!UpRefs.empty())
4621 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4622 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4624 GEN_ERROR("Cannot make packed constant with type: '" +
4625 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4626 const Type *ETy = PTy->getElementType();
4627 unsigned NumElements = PTy->getNumElements();
4629 // Verify that we have the correct size...
4630 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
4631 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4632 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4633 utostr(NumElements) + "");
4635 // Verify all elements are correct type!
4636 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4637 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4638 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4639 ETy->getDescription() +"' as required!\nIt is of type '"+
4640 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4643 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4644 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4650 #line 1686 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4652 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4654 GEN_ERROR("Cannot make struct constant with type: '" +
4655 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4657 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4658 GEN_ERROR("Illegal number of initializers for structure type");
4660 // Check to ensure that constants are compatible with the type initializer!
4661 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4662 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4663 GEN_ERROR("Expected type '" +
4664 STy->getElementType(i)->getDescription() +
4665 "' for element #" + utostr(i) +
4666 " of structure initializer");
4668 // Check to ensure that Type is not packed
4669 if (STy->isPacked())
4670 GEN_ERROR("Unpacked Initializer to vector type '" +
4671 STy->getDescription() + "'");
4673 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4674 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4680 #line 1712 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4682 if (!UpRefs.empty())
4683 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4684 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4686 GEN_ERROR("Cannot make struct constant with type: '" +
4687 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4689 if (STy->getNumContainedTypes() != 0)
4690 GEN_ERROR("Illegal number of initializers for structure type");
4692 // Check to ensure that Type is not packed
4693 if (STy->isPacked())
4694 GEN_ERROR("Unpacked Initializer to vector type '" +
4695 STy->getDescription() + "'");
4697 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4698 delete (yyvsp[(1) - (3)].TypeVal);
4704 #line 1732 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4706 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4708 GEN_ERROR("Cannot make struct constant with type: '" +
4709 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4711 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4712 GEN_ERROR("Illegal number of initializers for structure type");
4714 // Check to ensure that constants are compatible with the type initializer!
4715 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4716 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4717 GEN_ERROR("Expected type '" +
4718 STy->getElementType(i)->getDescription() +
4719 "' for element #" + utostr(i) +
4720 " of structure initializer");
4722 // Check to ensure that Type is packed
4723 if (!STy->isPacked())
4724 GEN_ERROR("Vector initializer to non-vector type '" +
4725 STy->getDescription() + "'");
4727 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4728 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4734 #line 1758 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4736 if (!UpRefs.empty())
4737 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4738 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4740 GEN_ERROR("Cannot make struct constant with type: '" +
4741 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4743 if (STy->getNumContainedTypes() != 0)
4744 GEN_ERROR("Illegal number of initializers for structure type");
4746 // Check to ensure that Type is packed
4747 if (!STy->isPacked())
4748 GEN_ERROR("Vector initializer to non-vector type '" +
4749 STy->getDescription() + "'");
4751 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4752 delete (yyvsp[(1) - (5)].TypeVal);
4758 #line 1778 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4760 if (!UpRefs.empty())
4761 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4762 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4764 GEN_ERROR("Cannot make null pointer constant with type: '" +
4765 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4767 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4768 delete (yyvsp[(1) - (2)].TypeVal);
4774 #line 1790 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4776 if (!UpRefs.empty())
4777 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4778 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4779 delete (yyvsp[(1) - (2)].TypeVal);
4785 #line 1797 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4787 if (!UpRefs.empty())
4788 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4789 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4791 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4793 // ConstExprs can exist in the body of a function, thus creating
4794 // GlobalValues whenever they refer to a variable. Because we are in
4795 // the context of a function, getExistingVal will search the functions
4796 // symbol table instead of the module symbol table for the global symbol,
4797 // which throws things all off. To get around this, we just tell
4798 // getExistingVal that we are at global scope here.
4800 Function *SavedCurFn = CurFun.CurrentFunction;
4801 CurFun.CurrentFunction = 0;
4803 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4806 CurFun.CurrentFunction = SavedCurFn;
4808 // If this is an initializer for a constant pointer, which is referencing a
4809 // (currently) undefined variable, create a stub now that shall be replaced
4810 // in the future with the right type of variable.
4813 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4814 const PointerType *PT = cast<PointerType>(Ty);
4816 // First check to see if the forward references value is already created!
4817 PerModuleInfo::GlobalRefsType::iterator I =
4818 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4820 if (I != CurModule.GlobalRefs.end()) {
4821 V = I->second; // Placeholder already exists, use it...
4822 (yyvsp[(2) - (2)].ValIDVal).destroy();
4825 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4826 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4827 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4828 GEN_ERROR("Invalid reference to global");
4830 // Create the forward referenced global.
4832 if (const FunctionType *FTy =
4833 dyn_cast<FunctionType>(PT->getElementType())) {
4834 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4835 CurModule.CurrentModule);
4837 GV = new GlobalVariable(PT->getElementType(), false,
4838 GlobalValue::ExternalWeakLinkage, 0,
4839 Name, CurModule.CurrentModule);
4842 // Keep track of the fact that we have a forward ref to recycle it
4843 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4848 (yyval.ConstVal) = cast<GlobalValue>(V);
4849 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4855 #line 1863 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4857 if (!UpRefs.empty())
4858 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4859 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4860 GEN_ERROR("Mismatched types for constant expression: " +
4861 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4862 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4863 delete (yyvsp[(1) - (2)].TypeVal);
4869 #line 1873 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4871 if (!UpRefs.empty())
4872 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4873 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4874 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4875 GEN_ERROR("Cannot create a null initialized value of this type");
4876 (yyval.ConstVal) = Constant::getNullValue(Ty);
4877 delete (yyvsp[(1) - (2)].TypeVal);
4883 #line 1883 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4884 { // integral constants
4885 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4886 GEN_ERROR("Constant value doesn't fit in type");
4887 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4893 #line 1889 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4894 { // arbitrary precision integer constants
4895 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4896 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4897 GEN_ERROR("Constant value does not fit in type");
4899 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4900 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4901 delete (yyvsp[(2) - (2)].APIntVal);
4907 #line 1899 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4908 { // integral constants
4909 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4910 GEN_ERROR("Constant value doesn't fit in type");
4911 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4917 #line 1905 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4918 { // arbitrary precision integer constants
4919 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4920 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4921 GEN_ERROR("Constant value does not fit in type");
4923 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4924 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4925 delete (yyvsp[(2) - (2)].APIntVal);
4931 #line 1915 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4932 { // Boolean constants
4933 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4934 GEN_ERROR("Constant true must have type i1");
4935 (yyval.ConstVal) = ConstantInt::getTrue();
4941 #line 1921 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4942 { // Boolean constants
4943 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4944 GEN_ERROR("Constant false must have type i1");
4945 (yyval.ConstVal) = ConstantInt::getFalse();
4951 #line 1927 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4952 { // Floating point constants
4953 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4954 GEN_ERROR("Floating point constant invalid for type");
4955 // Lexer has no type info, so builds all float and double FP constants
4956 // as double. Fix this here. Long double is done right.
4957 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4958 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4959 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4960 delete (yyvsp[(2) - (2)].FPVal);
4966 #line 1940 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4968 if (!UpRefs.empty())
4969 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4970 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4971 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4972 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4973 GEN_ERROR("invalid cast opcode for cast from '" +
4974 Val->getType()->getDescription() + "' to '" +
4975 DestTy->getDescription() + "'");
4976 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4977 delete (yyvsp[(5) - (6)].TypeVal);
4982 #line 1952 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4984 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4985 GEN_ERROR("GetElementPtr requires a pointer operand");
4988 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4990 GEN_ERROR("Index list invalid for constant getelementptr");
4992 SmallVector<Constant*, 8> IdxVec;
4993 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4994 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4995 IdxVec.push_back(C);
4997 GEN_ERROR("Indices to constant getelementptr must be constants");
4999 delete (yyvsp[(4) - (5)].ValueList);
5001 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
5007 #line 1973 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5009 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
5010 GEN_ERROR("Select condition must be of boolean type");
5011 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
5012 GEN_ERROR("Select operand types must match");
5013 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5019 #line 1981 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5021 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
5022 GEN_ERROR("Binary operator types must match");
5024 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5029 #line 1987 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5031 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
5032 GEN_ERROR("Logical operator types must match");
5033 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
5034 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
5035 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
5036 GEN_ERROR("Logical operator requires integral operands");
5038 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5044 #line 1998 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5046 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5047 GEN_ERROR("icmp operand types must match");
5048 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5053 #line 2003 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5055 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5056 GEN_ERROR("fcmp operand types must match");
5057 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5062 #line 2008 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5064 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5065 GEN_ERROR("vicmp operand types must match");
5066 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5071 #line 2013 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5073 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5074 GEN_ERROR("vfcmp operand types must match");
5075 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5080 #line 2018 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5082 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
5083 GEN_ERROR("Invalid extractelement operands");
5084 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5090 #line 2024 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5092 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
5093 GEN_ERROR("Invalid insertelement operands");
5094 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5100 #line 2030 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5102 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
5103 GEN_ERROR("Invalid shufflevector operands");
5104 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
5110 #line 2036 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5112 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5113 GEN_ERROR("ExtractValue requires an aggregate operand");
5115 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5116 delete (yyvsp[(4) - (5)].ConstantList);
5122 #line 2044 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5124 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5125 GEN_ERROR("InsertValue requires an aggregate operand");
5127 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5128 delete (yyvsp[(6) - (7)].ConstantList);
5134 #line 2055 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5136 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
5142 #line 2059 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5144 (yyval.ConstVector) = new std::vector<Constant*>();
5145 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
5151 #line 2067 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5152 { (yyval.BoolVal) = false; ;}
5156 #line 2067 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5157 { (yyval.BoolVal) = true; ;}
5161 #line 2070 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5162 { (yyval.BoolVal) = true; ;}
5166 #line 2070 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5167 { (yyval.BoolVal) = false; ;}
5171 #line 2073 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5173 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5174 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
5176 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5178 GEN_ERROR("Aliases can be created only to global values");
5180 (yyval.ConstVal) = Aliasee;
5182 delete (yyvsp[(1) - (2)].TypeVal);
5187 #line 2085 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5189 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5190 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5191 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
5192 GEN_ERROR("invalid cast opcode for cast from '" +
5193 Val->getType()->getDescription() + "' to '" +
5194 DestTy->getDescription() + "'");
5196 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5198 delete (yyvsp[(5) - (6)].TypeVal);
5203 #line 2106 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5205 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5206 CurModule.ModuleDone();
5212 #line 2111 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5214 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5215 CurModule.ModuleDone();
5221 #line 2124 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5222 { CurFun.isDeclare = false; ;}
5226 #line 2124 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5228 CurFun.FunctionDone();
5234 #line 2128 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5235 { CurFun.isDeclare = true; ;}
5239 #line 2128 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5246 #line 2131 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5253 #line 2134 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5255 if (!UpRefs.empty())
5256 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
5257 // Eagerly resolve types. This is not an optimization, this is a
5258 // requirement that is due to the fact that we could have this:
5260 // %list = type { %list * }
5261 // %list = type { %list * } ; repeated type decl
5263 // If types are not resolved eagerly, then the two types will not be
5264 // determined to be the same type!
5266 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5268 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5270 // If this is a named type that is not a redefinition, add it to the slot
5272 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5275 delete (yyvsp[(3) - (3)].TypeVal);
5281 #line 2158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5283 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5285 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5287 // If this is a named type that is not a redefinition, add it to the slot
5289 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5296 #line 2170 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5298 /* "Externally Visible" Linkage */
5299 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5300 GEN_ERROR("Global value initializer is not a constant");
5301 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5302 (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));
5308 #line 2177 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5315 #line 2181 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5317 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5318 GEN_ERROR("Global value initializer is not a constant");
5319 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));
5325 #line 2186 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5332 #line 2190 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5334 if (!UpRefs.empty())
5335 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5336 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));
5338 delete (yyvsp[(6) - (7)].TypeVal);
5343 #line 2196 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5351 #line 2200 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5354 if ((yyvsp[(1) - (5)].StrVal)) {
5355 Name = *(yyvsp[(1) - (5)].StrVal);
5356 delete (yyvsp[(1) - (5)].StrVal);
5359 GEN_ERROR("Alias name cannot be empty");
5361 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5363 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5365 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5366 CurModule.CurrentModule);
5367 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5368 InsertValue(GA, CurModule.Values);
5371 // If there was a forward reference of this alias, resolve it now.
5375 ID = ValID::createGlobalName(Name);
5377 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5379 if (GlobalValue *FWGV =
5380 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5381 // Replace uses of the fwdref with the actual alias.
5382 FWGV->replaceAllUsesWith(GA);
5383 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5384 GV->eraseFromParent();
5386 cast<Function>(FWGV)->eraseFromParent();
5395 #line 2240 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5402 #line 2243 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5409 #line 2249 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5411 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5412 if (AsmSoFar.empty())
5413 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5415 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5416 delete (yyvsp[(1) - (1)].StrVal);
5422 #line 2259 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5424 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5425 delete (yyvsp[(3) - (3)].StrVal);
5430 #line 2263 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5432 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5433 delete (yyvsp[(3) - (3)].StrVal);
5438 #line 2270 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5440 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5441 delete (yyvsp[(3) - (3)].StrVal);
5447 #line 2275 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5449 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5450 delete (yyvsp[(1) - (1)].StrVal);
5456 #line 2280 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5463 #line 2289 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5465 if (!UpRefs.empty())
5466 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5467 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5468 GEN_ERROR("Argument types must be first-class");
5469 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].Attributes); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5470 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5471 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5477 #line 2299 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5479 if (!UpRefs.empty())
5480 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5481 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5482 GEN_ERROR("Argument types must be first-class");
5483 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].Attributes); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5484 (yyval.ArgList) = new ArgListType;
5485 (yyval.ArgList)->push_back(E);
5491 #line 2310 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5493 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5499 #line 2314 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5501 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5502 struct ArgListEntry E;
5503 E.Ty = new PATypeHolder(Type::VoidTy);
5505 E.Attrs = Attribute::None;
5506 (yyval.ArgList)->push_back(E);
5512 #line 2323 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5514 (yyval.ArgList) = new ArgListType;
5515 struct ArgListEntry E;
5516 E.Ty = new PATypeHolder(Type::VoidTy);
5518 E.Attrs = Attribute::None;
5519 (yyval.ArgList)->push_back(E);
5525 #line 2332 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5527 (yyval.ArgList) = 0;
5533 #line 2338 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5535 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5536 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
5538 // Check the function result for abstractness if this is a define. We should
5539 // have no abstract types at this point
5540 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5541 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
5543 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
5544 GEN_ERROR("Invalid result type for LLVM function");
5546 std::vector<const Type*> ParamTypeList;
5547 SmallVector<AttributeWithIndex, 8> Attrs;
5548 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5550 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5551 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5552 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
5553 RetAttrs = RetAttrs | Attribute::ZExt;
5554 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
5556 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
5557 RetAttrs = RetAttrs | Attribute::SExt;
5558 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
5560 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
5561 RetAttrs = RetAttrs | Attribute::InReg;
5562 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
5565 if (RetAttrs != Attribute::None)
5566 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5567 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
5569 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
5570 const Type* Ty = I->Ty->get();
5571 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5572 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5573 ParamTypeList.push_back(Ty);
5574 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5575 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
5578 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5579 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
5581 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5582 if (isVarArg) ParamTypeList.pop_back();
5586 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
5588 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
5589 const PointerType *PFT = PointerType::getUnqual(FT);
5590 delete (yyvsp[(3) - (11)].TypeVal);
5593 if (!FunctionName.empty()) {
5594 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5596 ID = ValID::createGlobalID(CurModule.Values.size());
5600 // See if this function was forward referenced. If so, recycle the object.
5601 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5602 // Move the function to the end of the list, from whereever it was
5603 // previously inserted.
5604 Fn = cast<Function>(FWRef);
5605 assert(Fn->getAttributes().isEmpty() &&
5606 "Forward reference has parameter attributes!");
5607 CurModule.CurrentModule->getFunctionList().remove(Fn);
5608 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5609 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5610 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5611 if (Fn->getFunctionType() != FT ) {
5612 // The existing function doesn't have the same type. This is an overload
5614 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5615 } else if (Fn->getAttributes() != PAL) {
5616 // The existing function doesn't have the same parameter attributes.
5617 // This is an overload error.
5618 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5619 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5620 // Neither the existing or the current function is a declaration and they
5621 // have the same name and same type. Clearly this is a redefinition.
5622 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5623 } else if (Fn->isDeclaration()) {
5624 // Make sure to strip off any argument names so we can't get conflicts.
5625 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5629 } else { // Not already defined?
5630 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5631 CurModule.CurrentModule);
5632 InsertValue(Fn, CurModule.Values);
5636 CurFun.FunctionStart(Fn);
5638 if (CurFun.isDeclare) {
5639 // If we have declaration, always overwrite linkage. This will allow us to
5640 // correctly handle cases, when pointer to function is passed as argument to
5641 // another function.
5642 Fn->setLinkage(CurFun.Linkage);
5643 Fn->setVisibility(CurFun.Visibility);
5645 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
5646 Fn->setAttributes(PAL);
5647 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5648 if ((yyvsp[(9) - (11)].StrVal)) {
5649 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5650 delete (yyvsp[(9) - (11)].StrVal);
5652 if ((yyvsp[(11) - (11)].StrVal)) {
5653 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5654 delete (yyvsp[(11) - (11)].StrVal);
5657 // Add all of the arguments we parsed to the function...
5658 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
5659 if (isVarArg) { // Nuke the last entry
5660 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
5661 "Not a varargs marker!");
5662 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5663 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
5665 Function::arg_iterator ArgIt = Fn->arg_begin();
5666 Function::arg_iterator ArgEnd = Fn->arg_end();
5668 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5669 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5670 delete I->Ty; // Delete the typeholder...
5671 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5677 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
5684 #line 2488 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5686 (yyval.FunctionVal) = CurFun.CurrentFunction;
5688 // Make sure that we keep track of the linkage type even if there was a
5689 // previous "declare".
5690 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5691 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5696 #line 2499 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5698 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5704 #line 2504 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5706 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5707 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5708 (yyval.FunctionVal) = CurFun.CurrentFunction;
5709 CurFun.FunctionDone();
5715 #line 2516 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5717 (yyval.BoolVal) = false;
5723 #line 2520 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5725 (yyval.BoolVal) = true;
5731 #line 2525 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5732 { // A reference to a direct constant
5733 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5739 #line 2529 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5741 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5747 #line 2533 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5748 { // arbitrary precision integer constants
5749 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5750 delete (yyvsp[(1) - (1)].APIntVal);
5756 #line 2538 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5757 { // arbitrary precision integer constants
5758 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5759 delete (yyvsp[(1) - (1)].APIntVal);
5765 #line 2543 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5766 { // Perhaps it's an FP constant?
5767 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5773 #line 2547 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5775 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5781 #line 2551 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5783 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5789 #line 2555 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5791 (yyval.ValIDVal) = ValID::createNull();
5797 #line 2559 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5799 (yyval.ValIDVal) = ValID::createUndef();
5805 #line 2563 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5806 { // A vector zero constant.
5807 (yyval.ValIDVal) = ValID::createZeroInit();
5813 #line 2567 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5814 { // Nonempty unsized packed vector
5815 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5816 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5818 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5819 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
5821 VectorType* pt = VectorType::get(ETy, NumElements);
5822 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
5824 // Verify all elements are correct type!
5825 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5826 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5827 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5828 ETy->getDescription() +"' as required!\nIt is of type '" +
5829 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5832 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5833 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5839 #line 2589 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5840 { // Nonempty unsized arr
5841 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5842 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5844 if (!ETy->isFirstClassType())
5845 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5847 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5848 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5850 // Verify all elements are correct type!
5851 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5852 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5853 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5854 ETy->getDescription() +"' as required!\nIt is of type '"+
5855 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5858 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5859 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5865 #line 2611 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5867 // Use undef instead of an array because it's inconvenient to determine
5868 // the element type at this point, there being no elements to examine.
5869 (yyval.ValIDVal) = ValID::createUndef();
5875 #line 2617 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5877 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
5878 const Type *ETy = Type::Int8Ty;
5880 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5882 std::vector<Constant*> Vals;
5883 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5884 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5885 delete (yyvsp[(2) - (2)].StrVal);
5886 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5892 #line 2630 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5894 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5895 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5896 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5898 const StructType *STy = StructType::get(Elements);
5899 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5901 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5902 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5908 #line 2642 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5910 const StructType *STy = StructType::get(std::vector<const Type*>());
5911 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5917 #line 2647 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5919 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5920 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5921 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5923 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5924 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5926 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5927 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5933 #line 2659 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5935 const StructType *STy = StructType::get(std::vector<const Type*>(),
5937 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5943 #line 2665 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5945 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5951 #line 2669 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5953 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5954 delete (yyvsp[(3) - (5)].StrVal);
5955 delete (yyvsp[(5) - (5)].StrVal);
5961 #line 2679 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5962 { // Is it an integer reference...?
5963 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5969 #line 2683 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5971 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5977 #line 2687 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5978 { // Is it a named reference...?
5979 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5980 delete (yyvsp[(1) - (1)].StrVal);
5986 #line 2692 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5987 { // Is it a named reference...?
5988 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5989 delete (yyvsp[(1) - (1)].StrVal);
5995 #line 2705 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5997 if (!UpRefs.empty())
5998 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5999 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
6000 delete (yyvsp[(1) - (2)].TypeVal);
6006 #line 2714 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6008 (yyval.ValueList) = new std::vector<Value *>();
6009 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
6015 #line 2719 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6017 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
6023 #line 2724 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6025 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
6031 #line 2728 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6032 { // Do not allow functions with 0 basic blocks
6033 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
6039 #line 2737 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6041 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
6043 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6044 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6045 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6051 #line 2746 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6054 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6055 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6056 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6057 " is incorrect, expected %" + utostr((unsigned)ValNum));
6059 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6060 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6066 #line 2759 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6068 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
6069 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6070 if (CI2->getParent() == 0)
6071 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6072 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6073 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
6079 #line 2768 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6080 { // Empty space between instruction lists
6081 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
6087 #line 2772 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6088 { // Labelled (named) basic block
6089 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6090 delete (yyvsp[(1) - (1)].StrVal);
6097 #line 2780 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6098 { // Return with a result...
6099 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6100 assert(!VL.empty() && "Invalid ret operands!");
6101 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6102 if (VL.size() > 1 ||
6103 (isa<StructType>(ReturnType) &&
6104 (VL.empty() || VL[0]->getType() != ReturnType))) {
6105 Value *RV = UndefValue::get(ReturnType);
6106 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6107 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6108 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6111 (yyval.TermInstVal) = ReturnInst::Create(RV);
6113 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6115 delete (yyvsp[(2) - (2)].ValueList);
6121 #line 2800 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6122 { // Return with no result...
6123 (yyval.TermInstVal) = ReturnInst::Create();
6129 #line 2804 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6130 { // Unconditional Branch...
6131 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6133 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6138 #line 2809 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6140 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6141 GEN_ERROR("Branch condition must have type i1");
6142 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6144 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6146 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6148 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6153 #line 2820 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6155 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6157 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6159 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6160 (yyval.TermInstVal) = S;
6162 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6163 E = (yyvsp[(8) - (9)].JumpTable)->end();
6164 for (; I != E; ++I) {
6165 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6166 S->addCase(CI, I->second);
6168 GEN_ERROR("Switch case is constant, but not a simple integer");
6170 delete (yyvsp[(8) - (9)].JumpTable);
6176 #line 2839 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6178 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
6180 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
6182 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
6183 (yyval.TermInstVal) = S;
6189 #line 2849 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6192 // Handle the short syntax
6193 const PointerType *PFTy = 0;
6194 const FunctionType *Ty = 0;
6195 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
6196 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6197 // Pull out the types of all of the arguments...
6198 std::vector<const Type*> ParamTypes;
6199 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
6200 for (; I != E; ++I) {
6201 const Type *Ty = I->Val->getType();
6202 if (Ty == Type::VoidTy)
6203 GEN_ERROR("Short call syntax cannot be used with varargs");
6204 ParamTypes.push_back(Ty);
6207 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
6208 GEN_ERROR("Invalid result type for LLVM function");
6210 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
6211 PFTy = PointerType::getUnqual(Ty);
6214 delete (yyvsp[(4) - (15)].TypeVal);
6216 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
6218 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
6220 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
6223 SmallVector<AttributeWithIndex, 8> Attrs;
6224 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6226 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6227 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6228 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
6229 RetAttrs = RetAttrs | Attribute::ZExt;
6230 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
6232 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
6233 RetAttrs = RetAttrs | Attribute::SExt;
6234 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
6236 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
6237 RetAttrs = RetAttrs | Attribute::InReg;
6238 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
6241 if (RetAttrs != Attribute::None)
6242 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
6244 // Check the arguments
6246 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
6247 // Make sure no arguments is a good thing!
6248 if (Ty->getNumParams() != 0)
6249 GEN_ERROR("No arguments passed to a function that "
6250 "expects arguments");
6251 } else { // Has arguments?
6252 // Loop through FunctionType's arguments and ensure they are specified
6254 FunctionType::param_iterator I = Ty->param_begin();
6255 FunctionType::param_iterator E = Ty->param_end();
6256 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
6259 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6260 if (ArgI->Val->getType() != *I)
6261 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6262 (*I)->getDescription() + "'");
6263 Args.push_back(ArgI->Val);
6264 if (ArgI->Attrs != Attribute::None)
6265 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6268 if (Ty->isVarArg()) {
6270 for (; ArgI != ArgE; ++ArgI, ++index) {
6271 Args.push_back(ArgI->Val); // push the remaining varargs
6272 if (ArgI->Attrs != Attribute::None)
6273 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6275 } else if (I != E || ArgI != ArgE)
6276 GEN_ERROR("Invalid number of parameters detected");
6278 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6279 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
6282 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
6284 // Create the InvokeInst
6285 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6286 Args.begin(), Args.end());
6287 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
6288 II->setAttributes(PAL);
6289 (yyval.TermInstVal) = II;
6290 delete (yyvsp[(7) - (15)].ParamList);
6296 #line 2952 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6298 (yyval.TermInstVal) = new UnwindInst();
6304 #line 2956 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6306 (yyval.TermInstVal) = new UnreachableInst();
6312 #line 2963 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6314 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6315 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
6318 GEN_ERROR("May only switch on a constant pool value");
6320 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
6322 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6327 #line 2974 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6329 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6330 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
6334 GEN_ERROR("May only switch on a constant pool value");
6336 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
6338 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6343 #line 2987 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6345 // Is this definition named?? if so, assign the name...
6346 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
6348 InsertValue((yyvsp[(2) - (2)].InstVal));
6349 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6355 #line 2996 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6358 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
6360 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6361 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6362 " is incorrect, expected %" + utostr((unsigned)ValNum));
6364 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6370 #line 3009 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6371 { // Used for PHI nodes
6372 if (!UpRefs.empty())
6373 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6374 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6375 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
6377 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6379 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6380 delete (yyvsp[(1) - (6)].TypeVal);
6385 #line 3020 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6387 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6388 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
6390 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
6392 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6397 #line 3030 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6399 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6400 if (!UpRefs.empty())
6401 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
6402 // Used for call and invoke instructions
6403 (yyval.ParamList) = new ParamList();
6404 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6405 (yyval.ParamList)->push_back(E);
6406 delete (yyvsp[(1) - (4)].TypeVal);
6412 #line 3041 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6414 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6415 // Labels are only valid in ASMs
6416 (yyval.ParamList) = new ParamList();
6417 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6418 (yyval.ParamList)->push_back(E);
6424 #line 3049 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6426 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6427 if (!UpRefs.empty())
6428 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6429 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6430 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6431 (yyval.ParamList)->push_back(E);
6432 delete (yyvsp[(3) - (6)].TypeVal);
6438 #line 3059 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6440 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
6441 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6442 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6443 (yyval.ParamList)->push_back(E);
6449 #line 3066 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6450 { (yyval.ParamList) = new ParamList(); ;}
6454 #line 3069 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6455 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6459 #line 3070 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6461 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6462 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6468 #line 3078 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6470 (yyval.ConstantList) = new std::vector<unsigned>();
6471 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6472 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6473 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6478 #line 3084 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6480 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6481 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6482 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6483 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6489 #line 3093 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6491 (yyval.BoolVal) = true;
6497 #line 3097 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6499 (yyval.BoolVal) = false;
6505 #line 3102 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6507 if (!UpRefs.empty())
6508 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6509 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6510 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6512 "Arithmetic operator requires integer, FP, or packed operands");
6513 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6515 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6517 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6518 if ((yyval.InstVal) == 0)
6519 GEN_ERROR("binary operator returned null");
6520 delete (yyvsp[(2) - (5)].TypeVal);
6525 #line 3118 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6527 if (!UpRefs.empty())
6528 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6529 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6530 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6531 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6532 GEN_ERROR("Logical operator requires integral operands");
6534 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6536 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6538 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6539 if ((yyval.InstVal) == 0)
6540 GEN_ERROR("binary operator returned null");
6541 delete (yyvsp[(2) - (5)].TypeVal);
6546 #line 3135 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6548 if (!UpRefs.empty())
6549 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6550 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6552 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6554 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6555 if ((yyval.InstVal) == 0)
6556 GEN_ERROR("icmp operator returned null");
6557 delete (yyvsp[(3) - (6)].TypeVal);
6562 #line 3147 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6564 if (!UpRefs.empty())
6565 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6566 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6568 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6570 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6571 if ((yyval.InstVal) == 0)
6572 GEN_ERROR("fcmp operator returned null");
6573 delete (yyvsp[(3) - (6)].TypeVal);
6578 #line 3159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6580 if (!UpRefs.empty())
6581 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6582 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6583 GEN_ERROR("Scalar types not supported by vicmp instruction");
6584 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6586 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6588 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6589 if ((yyval.InstVal) == 0)
6590 GEN_ERROR("vicmp operator returned null");
6591 delete (yyvsp[(3) - (6)].TypeVal);
6596 #line 3173 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6598 if (!UpRefs.empty())
6599 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6600 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6601 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6602 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6604 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6606 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6607 if ((yyval.InstVal) == 0)
6608 GEN_ERROR("vfcmp operator returned null");
6609 delete (yyvsp[(3) - (6)].TypeVal);
6614 #line 3187 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6616 if (!UpRefs.empty())
6617 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6618 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6619 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6620 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6621 GEN_ERROR("invalid cast opcode for cast from '" +
6622 Val->getType()->getDescription() + "' to '" +
6623 DestTy->getDescription() + "'");
6624 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6625 delete (yyvsp[(4) - (4)].TypeVal);
6630 #line 3199 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6632 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6634 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6635 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6636 GEN_ERROR("vector select value types must be vector types");
6637 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6638 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6639 if (cond_type->getElementType() != Type::Int1Ty)
6640 GEN_ERROR("vector select condition element type must be boolean");
6641 if (cond_type->getNumElements() != select_type->getNumElements())
6642 GEN_ERROR("vector select number of elements must be the same");
6644 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6645 GEN_ERROR("select condition must be boolean");
6647 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6648 GEN_ERROR("select value types must match");
6649 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6655 #line 3220 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6657 if (!UpRefs.empty())
6658 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6659 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6660 delete (yyvsp[(4) - (4)].TypeVal);
6666 #line 3227 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6668 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6669 GEN_ERROR("Invalid extractelement operands");
6670 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6676 #line 3233 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6678 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6679 GEN_ERROR("Invalid insertelement operands");
6680 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6686 #line 3239 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6688 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6689 GEN_ERROR("Invalid shufflevector operands");
6690 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6696 #line 3245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6698 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6699 if (!Ty->isFirstClassType())
6700 GEN_ERROR("PHI node operands must be of first class type");
6701 (yyval.InstVal) = PHINode::Create(Ty);
6702 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6703 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6704 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6705 GEN_ERROR("All elements of a PHI node must be of the same type");
6706 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6707 (yyvsp[(2) - (2)].PHIList)->pop_front();
6709 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6715 #line 3261 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6718 // Handle the short syntax
6719 const PointerType *PFTy = 0;
6720 const FunctionType *Ty = 0;
6721 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
6722 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6723 // Pull out the types of all of the arguments...
6724 std::vector<const Type*> ParamTypes;
6725 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
6726 for (; I != E; ++I) {
6727 const Type *Ty = I->Val->getType();
6728 if (Ty == Type::VoidTy)
6729 GEN_ERROR("Short call syntax cannot be used with varargs");
6730 ParamTypes.push_back(Ty);
6733 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
6734 GEN_ERROR("Invalid result type for LLVM function");
6736 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
6737 PFTy = PointerType::getUnqual(Ty);
6740 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
6743 // Check for call to invalid intrinsic to avoid crashing later.
6744 if (Function *theF = dyn_cast<Function>(V)) {
6745 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6746 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6747 !theF->getIntrinsicID(true))
6748 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6749 theF->getName() + "'");
6752 // Set up the Attributes for the function
6753 SmallVector<AttributeWithIndex, 8> Attrs;
6754 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6756 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6757 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6758 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
6759 RetAttrs = RetAttrs | Attribute::ZExt;
6760 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
6762 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
6763 RetAttrs = RetAttrs | Attribute::SExt;
6764 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
6766 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
6767 RetAttrs = RetAttrs | Attribute::InReg;
6768 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
6771 if (RetAttrs != Attribute::None)
6772 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
6774 // Check the arguments
6776 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
6777 // Make sure no arguments is a good thing!
6778 if (Ty->getNumParams() != 0)
6779 GEN_ERROR("No arguments passed to a function that "
6780 "expects arguments");
6781 } else { // Has arguments?
6782 // Loop through FunctionType's arguments and ensure they are specified
6783 // correctly. Also, gather any parameter attributes.
6784 FunctionType::param_iterator I = Ty->param_begin();
6785 FunctionType::param_iterator E = Ty->param_end();
6786 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
6789 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6790 if (ArgI->Val->getType() != *I)
6791 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6792 (*I)->getDescription() + "'");
6793 Args.push_back(ArgI->Val);
6794 if (ArgI->Attrs != Attribute::None)
6795 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6797 if (Ty->isVarArg()) {
6799 for (; ArgI != ArgE; ++ArgI, ++index) {
6800 Args.push_back(ArgI->Val); // push the remaining varargs
6801 if (ArgI->Attrs != Attribute::None)
6802 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
6804 } else if (I != E || ArgI != ArgE)
6805 GEN_ERROR("Invalid number of parameters detected");
6807 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6808 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
6810 // Finish off the Attributes and check them
6813 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
6815 // Create the call node
6816 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6817 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6818 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
6819 CI->setAttributes(PAL);
6820 (yyval.InstVal) = CI;
6821 delete (yyvsp[(7) - (9)].ParamList);
6822 delete (yyvsp[(4) - (9)].TypeVal);
6828 #line 3370 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6830 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6836 #line 3375 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6838 (yyval.BoolVal) = true;
6844 #line 3379 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6846 (yyval.BoolVal) = false;
6852 #line 3386 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6854 if (!UpRefs.empty())
6855 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6856 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6857 delete (yyvsp[(2) - (3)].TypeVal);
6863 #line 3393 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6865 if (!UpRefs.empty())
6866 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6867 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6868 GEN_ERROR("Malloc array size is not a 32-bit integer!");
6869 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6871 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6872 delete (yyvsp[(2) - (6)].TypeVal);
6877 #line 3403 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6879 if (!UpRefs.empty())
6880 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6881 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6882 delete (yyvsp[(2) - (3)].TypeVal);
6888 #line 3410 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6890 if (!UpRefs.empty())
6891 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6892 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6893 GEN_ERROR("Alloca array size is not a 32-bit integer!");
6894 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6896 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6897 delete (yyvsp[(2) - (6)].TypeVal);
6902 #line 3420 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6904 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6905 GEN_ERROR("Trying to free nonpointer type " +
6906 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6907 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6913 #line 3428 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6915 if (!UpRefs.empty())
6916 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6917 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6918 GEN_ERROR("Can't load from nonpointer type: " +
6919 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6920 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6921 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6922 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6923 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6925 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6926 delete (yyvsp[(3) - (5)].TypeVal);
6931 #line 3442 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6933 if (!UpRefs.empty())
6934 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6935 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6937 GEN_ERROR("Can't store to a nonpointer type: " +
6938 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6939 const Type *ElTy = PT->getElementType();
6940 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6941 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6942 "' into space of type '" + ElTy->getDescription() + "'");
6944 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6946 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6947 delete (yyvsp[(5) - (7)].TypeVal);
6952 #line 3459 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6954 if (!UpRefs.empty())
6955 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6956 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6957 GEN_ERROR("getresult insn requires an aggregate operand");
6958 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6959 GEN_ERROR("Invalid getresult index for type '" +
6960 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6962 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6964 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6965 delete (yyvsp[(2) - (5)].TypeVal);
6970 #line 3473 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6972 if (!UpRefs.empty())
6973 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6974 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6975 GEN_ERROR("getelementptr insn requires pointer operand");
6977 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6978 GEN_ERROR("Invalid getelementptr indices for type '" +
6979 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6980 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6982 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6983 delete (yyvsp[(2) - (4)].TypeVal);
6984 delete (yyvsp[(4) - (4)].ValueList);
6989 #line 3488 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6991 if (!UpRefs.empty())
6992 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6993 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6994 GEN_ERROR("extractvalue insn requires an aggregate operand");
6996 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
6997 GEN_ERROR("Invalid extractvalue indices for type '" +
6998 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6999 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7001 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
7002 delete (yyvsp[(2) - (4)].TypeVal);
7003 delete (yyvsp[(4) - (4)].ConstantList);
7008 #line 3503 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
7010 if (!UpRefs.empty())
7011 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7012 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7013 GEN_ERROR("extractvalue insn requires an aggregate operand");
7015 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
7016 GEN_ERROR("Invalid insertvalue indices for type '" +
7017 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7018 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7019 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7021 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
7022 delete (yyvsp[(2) - (7)].TypeVal);
7023 delete (yyvsp[(5) - (7)].TypeVal);
7024 delete (yyvsp[(7) - (7)].ConstantList);
7029 /* Line 1267 of yacc.c. */
7030 #line 7031 "llvmAsmParser.tab.c"
7033 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7037 YY_STACK_PRINT (yyss, yyssp);
7042 /* Now `shift' the result of the reduction. Determine what state
7043 that goes to, based on the state we popped back to and the rule
7044 number reduced by. */
7048 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7049 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
7050 yystate = yytable[yystate];
7052 yystate = yydefgoto[yyn - YYNTOKENS];
7057 /*------------------------------------.
7058 | yyerrlab -- here on detecting error |
7059 `------------------------------------*/
7061 /* If not already recovering from an error, report this error. */
7065 #if ! YYERROR_VERBOSE
7066 yyerror (YY_("syntax error"));
7069 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7070 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7072 YYSIZE_T yyalloc = 2 * yysize;
7073 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7074 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7075 if (yymsg != yymsgbuf)
7076 YYSTACK_FREE (yymsg);
7077 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7079 yymsg_alloc = yyalloc;
7083 yymsg_alloc = sizeof yymsgbuf;
7087 if (0 < yysize && yysize <= yymsg_alloc)
7089 (void) yysyntax_error (yymsg, yystate, yychar);
7094 yyerror (YY_("syntax error"));
7096 goto yyexhaustedlab;
7104 if (yyerrstatus == 3)
7106 /* If just tried and failed to reuse look-ahead token after an
7107 error, discard it. */
7109 if (yychar <= YYEOF)
7111 /* Return failure if at end of input. */
7112 if (yychar == YYEOF)
7117 yydestruct ("Error: discarding",
7123 /* Else will try to reuse look-ahead token after shifting the error
7128 /*---------------------------------------------------.
7129 | yyerrorlab -- error raised explicitly by YYERROR. |
7130 `---------------------------------------------------*/
7133 /* Pacify compilers like GCC when the user code never invokes
7134 YYERROR and the label yyerrorlab therefore never appears in user
7136 if (/*CONSTCOND*/ 0)
7139 /* Do not reclaim the symbols of the rule which action triggered
7143 YY_STACK_PRINT (yyss, yyssp);
7148 /*-------------------------------------------------------------.
7149 | yyerrlab1 -- common code for both syntax error and YYERROR. |
7150 `-------------------------------------------------------------*/
7152 yyerrstatus = 3; /* Each real token shifted decrements this. */
7156 yyn = yypact[yystate];
7157 if (yyn != YYPACT_NINF)
7160 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7168 /* Pop the current state because it cannot handle the error token. */
7173 yydestruct ("Error: popping",
7174 yystos[yystate], yyvsp);
7177 YY_STACK_PRINT (yyss, yyssp);
7186 /* Shift the error token. */
7187 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
7193 /*-------------------------------------.
7194 | yyacceptlab -- YYACCEPT comes here. |
7195 `-------------------------------------*/
7200 /*-----------------------------------.
7201 | yyabortlab -- YYABORT comes here. |
7202 `-----------------------------------*/
7208 /*-------------------------------------------------.
7209 | yyexhaustedlab -- memory exhaustion comes here. |
7210 `-------------------------------------------------*/
7212 yyerror (YY_("memory exhausted"));
7218 if (yychar != YYEOF && yychar != YYEMPTY)
7219 yydestruct ("Cleanup: discarding lookahead",
7221 /* Do not reclaim the symbols of the rule which action triggered
7222 this YYABORT or YYACCEPT. */
7224 YY_STACK_PRINT (yyss, yyssp);
7225 while (yyssp != yyss)
7227 yydestruct ("Cleanup: popping",
7228 yystos[*yyssp], yyvsp);
7233 YYSTACK_FREE (yyss);
7236 if (yymsg != yymsgbuf)
7237 YYSTACK_FREE (yymsg);
7239 /* Make sure YYID is used. */
7240 return YYID (yyresult);
7244 #line 3522 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
7247 // common code from the two 'RunVMAsmParser' functions
7248 static Module* RunParser(Module * M) {
7249 CurModule.CurrentModule = M;
7250 // Check to make sure the parser succeeded
7253 delete ParserResult;
7257 // Emit an error if there are any unresolved types left.
7258 if (!CurModule.LateResolveTypes.empty()) {
7259 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7260 if (DID.Type == ValID::LocalName) {
7261 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7263 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7266 delete ParserResult;
7270 // Emit an error if there are any unresolved values left.
7271 if (!CurModule.LateResolveValues.empty()) {
7272 Value *V = CurModule.LateResolveValues.back();
7273 std::map<Value*, std::pair<ValID, int> >::iterator I =
7274 CurModule.PlaceHolderInfo.find(V);
7276 if (I != CurModule.PlaceHolderInfo.end()) {
7277 ValID &DID = I->second.first;
7278 if (DID.Type == ValID::LocalName) {
7279 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7281 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7284 delete ParserResult;
7289 // Check to make sure that parsing produced a result
7293 // Reset ParserResult variable while saving its value for the result.
7294 Module *Result = ParserResult;
7300 void llvm::GenerateError(const std::string &message, int LineNo) {
7301 if (LineNo == -1) LineNo = LLLgetLineNo();
7302 // TODO: column number in exception
7304 TheParseError->setError(LLLgetFilename(), message, LineNo);
7308 int yyerror(const char *ErrorMsg) {
7309 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
7310 std::string errMsg = where + "error: " + std::string(ErrorMsg);
7311 if (yychar != YYEMPTY && yychar != 0) {
7312 errMsg += " while reading token: '";
7313 errMsg += std::string(LLLgetTokenStart(),
7314 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7316 GenerateError(errMsg);