1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
206 EXTRACTELEMENT = 387,
228 #define ESINT64VAL 258
229 #define EUINT64VAL 259
230 #define ESAPINTVAL 260
231 #define EUAPINTVAL 261
232 #define LOCALVAL_ID 262
233 #define GLOBALVAL_ID 263
241 #define PPC_FP128 271
245 #define GLOBALVAR 275
247 #define STRINGCONSTANT 277
248 #define ATSTRINGCONSTANT 278
249 #define PCTSTRINGCONSTANT 279
250 #define ZEROINITIALIZER 280
262 #define THREAD_LOCAL 292
264 #define DOTDOTDOT 294
270 #define APPENDING 300
271 #define DLLIMPORT 301
272 #define DLLEXPORT 302
273 #define EXTERN_WEAK 303
279 #define ADDRSPACE 309
285 #define SIDEEFFECT 315
288 #define FASTCC_TOK 318
289 #define COLDCC_TOK 319
290 #define X86_STDCALLCC_TOK 320
291 #define X86_FASTCALLCC_TOK 321
292 #define DATALAYOUT 322
298 #define UNREACHABLE 328
341 #define GETELEMENTPTR 371
357 #define EXTRACTELEMENT 387
358 #define INSERTELEMENT 388
359 #define SHUFFLEVECTOR 389
360 #define GETRESULT 390
375 #define PROTECTED 405
380 /* Copy the first part of user declarations. */
381 #line 14 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
383 #include "ParserInternals.h"
384 #include "llvm/CallingConv.h"
385 #include "llvm/InlineAsm.h"
386 #include "llvm/Instructions.h"
387 #include "llvm/Module.h"
388 #include "llvm/ValueSymbolTable.h"
389 #include "llvm/AutoUpgrade.h"
390 #include "llvm/Support/GetElementPtrTypeIterator.h"
391 #include "llvm/Support/CommandLine.h"
392 #include "llvm/ADT/SmallVector.h"
393 #include "llvm/ADT/STLExtras.h"
394 #include "llvm/Support/MathExtras.h"
395 #include "llvm/Support/Streams.h"
401 // The following is a gross hack. In order to rid the libAsmParser library of
402 // exceptions, we have to have a way of getting the yyparse function to go into
403 // an error situation. So, whenever we want an error to occur, the GenerateError
404 // function (see bottom of file) sets TriggerError. Then, at the end of each
405 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
406 // (a goto) to put YACC in error state. Furthermore, several calls to
407 // GenerateError are made from inside productions and they must simulate the
408 // previous exception behavior by exiting the production immediately. We have
409 // replaced these with the GEN_ERROR macro which calls GeneratError and then
410 // immediately invokes YYERROR. This would be so much cleaner if it was a
411 // recursive descent parser.
412 static bool TriggerError = false;
413 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
414 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
416 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
417 int yylex(); // declaration" of xxx warnings.
419 using namespace llvm;
421 static Module *ParserResult;
423 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
424 // relating to upreferences in the input stream.
426 //#define DEBUG_UPREFS 1
428 #define UR_OUT(X) cerr << X
433 #define YYERROR_VERBOSE 1
435 static GlobalVariable *CurGV;
438 // This contains info used when building the body of a function. It is
439 // destroyed when the function is completed.
441 typedef std::vector<Value *> ValueList; // Numbered defs
444 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
446 static struct PerModuleInfo {
447 Module *CurrentModule;
448 ValueList Values; // Module level numbered definitions
449 ValueList LateResolveValues;
450 std::vector<PATypeHolder> Types;
451 std::map<ValID, PATypeHolder> LateResolveTypes;
453 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
454 /// how they were referenced and on which line of the input they came from so
455 /// that we can resolve them later and print error messages as appropriate.
456 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
458 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
459 // references to global values. Global values may be referenced before they
460 // are defined, and if so, the temporary object that they represent is held
461 // here. This is used for forward references of GlobalValues.
463 typedef std::map<std::pair<const PointerType *,
464 ValID>, GlobalValue*> GlobalRefsType;
465 GlobalRefsType GlobalRefs;
468 // If we could not resolve some functions at function compilation time
469 // (calls to functions before they are defined), resolve them now... Types
470 // are resolved when the constant pool has been completely parsed.
472 ResolveDefinitions(LateResolveValues);
476 // Check to make sure that all global value forward references have been
479 if (!GlobalRefs.empty()) {
480 std::string UndefinedReferences = "Unresolved global references exist:\n";
482 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
484 UndefinedReferences += " " + I->first.first->getDescription() + " " +
485 I->first.second.getName() + "\n";
487 GenerateError(UndefinedReferences);
491 // Look for intrinsic functions and CallInst that need to be upgraded
492 for (Module::iterator FI = CurrentModule->begin(),
493 FE = CurrentModule->end(); FI != FE; )
494 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
496 Values.clear(); // Clear out function local definitions
501 // GetForwardRefForGlobal - Check to see if there is a forward reference
502 // for this global. If so, remove it from the GlobalRefs map and return it.
503 // If not, just return null.
504 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
505 // Check to see if there is a forward reference to this global variable...
506 // if there is, eliminate it and patch the reference to use the new def'n.
507 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
508 GlobalValue *Ret = 0;
509 if (I != GlobalRefs.end()) {
516 bool TypeIsUnresolved(PATypeHolder* PATy) {
517 // If it isn't abstract, its resolved
518 const Type* Ty = PATy->get();
519 if (!Ty->isAbstract())
521 // Traverse the type looking for abstract types. If it isn't abstract then
522 // we don't need to traverse that leg of the type.
523 std::vector<const Type*> WorkList, SeenList;
524 WorkList.push_back(Ty);
525 while (!WorkList.empty()) {
526 const Type* Ty = WorkList.back();
527 SeenList.push_back(Ty);
529 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
530 // Check to see if this is an unresolved type
531 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
532 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
533 for ( ; I != E; ++I) {
534 if (I->second.get() == OpTy)
537 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
538 const Type* TheTy = SeqTy->getElementType();
539 if (TheTy->isAbstract() && TheTy != Ty) {
540 std::vector<const Type*>::iterator I = SeenList.begin(),
546 WorkList.push_back(TheTy);
548 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
549 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
550 const Type* TheTy = StrTy->getElementType(i);
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
558 WorkList.push_back(TheTy);
567 static struct PerFunctionInfo {
568 Function *CurrentFunction; // Pointer to current function being created
570 ValueList Values; // Keep track of #'d definitions
572 ValueList LateResolveValues;
573 bool isDeclare; // Is this function a forward declararation?
574 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
575 GlobalValue::VisibilityTypes Visibility;
577 /// BBForwardRefs - When we see forward references to basic blocks, keep
578 /// track of them here.
579 std::map<ValID, BasicBlock*> BBForwardRefs;
581 inline PerFunctionInfo() {
584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
588 inline void FunctionStart(Function *M) {
593 void FunctionDone() {
594 // Any forward referenced blocks left?
595 if (!BBForwardRefs.empty()) {
596 GenerateError("Undefined reference to label " +
597 BBForwardRefs.begin()->second->getName());
601 // Resolve all forward references now.
602 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
604 Values.clear(); // Clear out function local definitions
605 BBForwardRefs.clear();
608 Linkage = GlobalValue::ExternalLinkage;
609 Visibility = GlobalValue::DefaultVisibility;
611 } CurFun; // Info for the current function...
613 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
616 //===----------------------------------------------------------------------===//
617 // Code to handle definitions of all the types
618 //===----------------------------------------------------------------------===//
620 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
621 // Things that have names or are void typed don't get slot numbers
622 if (V->hasName() || (V->getType() == Type::VoidTy))
625 // In the case of function values, we have to allow for the forward reference
626 // of basic blocks, which are included in the numbering. Consequently, we keep
627 // track of the next insertion location with NextValNum. When a BB gets
628 // inserted, it could change the size of the CurFun.Values vector.
629 if (&ValueTab == &CurFun.Values) {
630 if (ValueTab.size() <= CurFun.NextValNum)
631 ValueTab.resize(CurFun.NextValNum+1);
632 ValueTab[CurFun.NextValNum++] = V;
635 // For all other lists, its okay to just tack it on the back of the vector.
636 ValueTab.push_back(V);
639 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
641 case ValID::LocalID: // Is it a numbered definition?
642 // Module constants occupy the lowest numbered slots...
643 if (D.Num < CurModule.Types.size())
644 return CurModule.Types[D.Num];
646 case ValID::LocalName: // Is it a named definition?
647 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
648 D.destroy(); // Free old strdup'd memory...
653 GenerateError("Internal parser error: Invalid symbol type reference");
657 // If we reached here, we referenced either a symbol that we don't know about
658 // or an id number that hasn't been read yet. We may be referencing something
659 // forward, so just create an entry to be resolved later and get to it...
661 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
664 if (inFunctionScope()) {
665 if (D.Type == ValID::LocalName) {
666 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
669 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
674 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
675 if (I != CurModule.LateResolveTypes.end())
678 Type *Typ = OpaqueType::get();
679 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
683 // getExistingVal - Look up the value specified by the provided type and
684 // the provided ValID. If the value exists and has already been defined, return
685 // it. Otherwise return null.
687 static Value *getExistingVal(const Type *Ty, const ValID &D) {
688 if (isa<FunctionType>(Ty)) {
689 GenerateError("Functions are not values and "
690 "must be referenced as pointers");
695 case ValID::LocalID: { // Is it a numbered definition?
696 // Check that the number is within bounds.
697 if (D.Num >= CurFun.Values.size())
699 Value *Result = CurFun.Values[D.Num];
700 if (Ty != Result->getType()) {
701 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
702 Result->getType()->getDescription() + "' does not match "
703 "expected type, '" + Ty->getDescription() + "'");
708 case ValID::GlobalID: { // Is it a numbered definition?
709 if (D.Num >= CurModule.Values.size())
711 Value *Result = CurModule.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
721 case ValID::LocalName: { // Is it a named definition?
722 if (!inFunctionScope())
724 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
725 Value *N = SymTab.lookup(D.getName());
728 if (N->getType() != Ty)
731 D.destroy(); // Free old strdup'd memory...
734 case ValID::GlobalName: { // Is it a named definition?
735 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
736 Value *N = SymTab.lookup(D.getName());
739 if (N->getType() != Ty)
742 D.destroy(); // Free old strdup'd memory...
746 // Check to make sure that "Ty" is an integral type, and that our
747 // value will fit into the specified type...
748 case ValID::ConstSIntVal: // Is it a constant pool reference??
749 if (!isa<IntegerType>(Ty) ||
750 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
751 GenerateError("Signed integral constant '" +
752 itostr(D.ConstPool64) + "' is invalid for type '" +
753 Ty->getDescription() + "'");
756 return ConstantInt::get(Ty, D.ConstPool64, true);
758 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
759 if (isa<IntegerType>(Ty) &&
760 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
761 return ConstantInt::get(Ty, D.UConstPool64);
763 if (!isa<IntegerType>(Ty) ||
764 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
765 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
766 "' is invalid or out of range for type '" +
767 Ty->getDescription() + "'");
770 // This is really a signed reference. Transmogrify.
771 return ConstantInt::get(Ty, D.ConstPool64, true);
773 case ValID::ConstFPVal: // Is it a floating point const pool reference?
774 if (!Ty->isFloatingPoint() ||
775 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
776 GenerateError("FP constant invalid for type");
779 // Lexer has no type info, so builds all float and double FP constants
780 // as double. Fix this here. Long double does not need this.
781 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
783 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
784 return ConstantFP::get(Ty, *D.ConstPoolFP);
786 case ValID::ConstNullVal: // Is it a null value?
787 if (!isa<PointerType>(Ty)) {
788 GenerateError("Cannot create a a non pointer null");
791 return ConstantPointerNull::get(cast<PointerType>(Ty));
793 case ValID::ConstUndefVal: // Is it an undef value?
794 return UndefValue::get(Ty);
796 case ValID::ConstZeroVal: // Is it a zero value?
797 return Constant::getNullValue(Ty);
799 case ValID::ConstantVal: // Fully resolved constant?
800 if (D.ConstantValue->getType() != Ty) {
801 GenerateError("Constant expression type different from required type");
804 return D.ConstantValue;
806 case ValID::InlineAsmVal: { // Inline asm expression
807 const PointerType *PTy = dyn_cast<PointerType>(Ty);
808 const FunctionType *FTy =
809 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
810 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
811 GenerateError("Invalid type for asm constraint string");
814 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
815 D.IAD->HasSideEffects);
816 D.destroy(); // Free InlineAsmDescriptor.
820 assert(0 && "Unhandled case!");
824 assert(0 && "Unhandled case!");
828 // getVal - This function is identical to getExistingVal, except that if a
829 // value is not already defined, it "improvises" by creating a placeholder var
830 // that looks and acts just like the requested variable. When the value is
831 // defined later, all uses of the placeholder variable are replaced with the
834 static Value *getVal(const Type *Ty, const ValID &ID) {
835 if (Ty == Type::LabelTy) {
836 GenerateError("Cannot use a basic block here");
840 // See if the value has already been defined.
841 Value *V = getExistingVal(Ty, ID);
843 if (TriggerError) return 0;
845 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
846 GenerateError("Invalid use of a composite type");
850 // If we reached here, we referenced either a symbol that we don't know about
851 // or an id number that hasn't been read yet. We may be referencing something
852 // forward, so just create an entry to be resolved later and get to it...
855 case ValID::GlobalName:
856 case ValID::GlobalID: {
857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
859 GenerateError("Invalid type for reference to global" );
862 const Type* ElTy = PTy->getElementType();
863 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
864 V = new Function(FTy, GlobalValue::ExternalLinkage);
866 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
867 (Module*)0, false, PTy->getAddressSpace());
871 V = new Argument(Ty);
874 // Remember where this forward reference came from. FIXME, shouldn't we try
875 // to recycle these things??
876 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
879 if (inFunctionScope())
880 InsertValue(V, CurFun.LateResolveValues);
882 InsertValue(V, CurModule.LateResolveValues);
886 /// defineBBVal - This is a definition of a new basic block with the specified
887 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
888 static BasicBlock *defineBBVal(const ValID &ID) {
889 assert(inFunctionScope() && "Can't get basic block at global scope!");
893 // First, see if this was forward referenced
895 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
896 if (BBI != CurFun.BBForwardRefs.end()) {
898 // The forward declaration could have been inserted anywhere in the
899 // function: insert it into the correct place now.
900 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
901 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
903 // We're about to erase the entry, save the key so we can clean it up.
904 ValID Tmp = BBI->first;
906 // Erase the forward ref from the map as its no longer "forward"
907 CurFun.BBForwardRefs.erase(ID);
909 // The key has been removed from the map but so we don't want to leave
910 // strdup'd memory around so destroy it too.
913 // If its a numbered definition, bump the number and set the BB value.
914 if (ID.Type == ValID::LocalID) {
915 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
923 // We haven't seen this BB before and its first mention is a definition.
924 // Just create it and return it.
925 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
926 BB = new BasicBlock(Name, CurFun.CurrentFunction);
927 if (ID.Type == ValID::LocalID) {
928 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
932 ID.destroy(); // Free strdup'd memory
936 /// getBBVal - get an existing BB value or create a forward reference for it.
938 static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
946 } if (ID.Type == ValID::LocalName) {
947 std::string Name = ID.getName();
948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
955 } else if (ID.Type == ValID::LocalID) {
956 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
957 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
958 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
960 GenerateError("Reference to label '%" + utostr(ID.Num) +
961 "' is actually of type '"+
962 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
965 GenerateError("Illegal label reference " + ID.getName());
969 // If its already been defined, return it now.
971 ID.destroy(); // Free strdup'd memory.
975 // Otherwise, this block has not been seen before, create it.
977 if (ID.Type == ValID::LocalName)
979 BB = new BasicBlock(Name, CurFun.CurrentFunction);
981 // Insert it in the forward refs map.
982 CurFun.BBForwardRefs[ID] = BB;
988 //===----------------------------------------------------------------------===//
989 // Code to handle forward references in instructions
990 //===----------------------------------------------------------------------===//
992 // This code handles the late binding needed with statements that reference
993 // values not defined yet... for example, a forward branch, or the PHI node for
996 // This keeps a table (CurFun.LateResolveValues) of all such forward references
997 // and back patchs after we are done.
1000 // ResolveDefinitions - If we could not resolve some defs at parsing
1001 // time (forward branches, phi functions for loops, etc...) resolve the
1005 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1006 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1007 while (!LateResolvers.empty()) {
1008 Value *V = LateResolvers.back();
1009 LateResolvers.pop_back();
1011 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1012 CurModule.PlaceHolderInfo.find(V);
1013 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1015 ValID &DID = PHI->second.first;
1017 Value *TheRealValue = getExistingVal(V->getType(), DID);
1021 V->replaceAllUsesWith(TheRealValue);
1023 CurModule.PlaceHolderInfo.erase(PHI);
1024 } else if (FutureLateResolvers) {
1025 // Functions have their unresolved items forwarded to the module late
1027 InsertValue(V, *FutureLateResolvers);
1029 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1030 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1031 "' of type '" + V->getType()->getDescription() + "'",
1032 PHI->second.second);
1035 GenerateError("Reference to an invalid definition: #" +
1036 itostr(DID.Num) + " of type '" +
1037 V->getType()->getDescription() + "'",
1038 PHI->second.second);
1043 LateResolvers.clear();
1046 // ResolveTypeTo - A brand new type was just declared. This means that (if
1047 // name is not null) things referencing Name can be resolved. Otherwise, things
1048 // refering to the number can be resolved. Do this now.
1050 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1053 D = ValID::createLocalName(*Name);
1055 D = ValID::createLocalID(CurModule.Types.size());
1057 std::map<ValID, PATypeHolder>::iterator I =
1058 CurModule.LateResolveTypes.find(D);
1059 if (I != CurModule.LateResolveTypes.end()) {
1060 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1061 CurModule.LateResolveTypes.erase(I);
1065 // setValueName - Set the specified value to the name given. The name may be
1066 // null potentially, in which case this is a noop. The string passed in is
1067 // assumed to be a malloc'd string buffer, and is free'd by this function.
1069 static void setValueName(Value *V, std::string *NameStr) {
1070 if (!NameStr) return;
1071 std::string Name(*NameStr); // Copy string
1072 delete NameStr; // Free old string
1074 if (V->getType() == Type::VoidTy) {
1075 GenerateError("Can't assign name '" + Name+"' to value with void type");
1079 assert(inFunctionScope() && "Must be in function scope!");
1080 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1081 if (ST.lookup(Name)) {
1082 GenerateError("Redefinition of value '" + Name + "' of type '" +
1083 V->getType()->getDescription() + "'");
1091 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1092 /// this is a declaration, otherwise it is a definition.
1093 static GlobalVariable *
1094 ParseGlobalVariable(std::string *NameStr,
1095 GlobalValue::LinkageTypes Linkage,
1096 GlobalValue::VisibilityTypes Visibility,
1097 bool isConstantGlobal, const Type *Ty,
1098 Constant *Initializer, bool IsThreadLocal,
1099 unsigned AddressSpace = 0) {
1100 if (isa<FunctionType>(Ty)) {
1101 GenerateError("Cannot declare global vars of function type");
1105 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1109 Name = *NameStr; // Copy string
1110 delete NameStr; // Free old string
1113 // See if this global value was forward referenced. If so, recycle the
1116 if (!Name.empty()) {
1117 ID = ValID::createGlobalName(Name);
1119 ID = ValID::createGlobalID(CurModule.Values.size());
1122 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1123 // Move the global to the end of the list, from whereever it was
1124 // previously inserted.
1125 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1126 CurModule.CurrentModule->getGlobalList().remove(GV);
1127 CurModule.CurrentModule->getGlobalList().push_back(GV);
1128 GV->setInitializer(Initializer);
1129 GV->setLinkage(Linkage);
1130 GV->setVisibility(Visibility);
1131 GV->setConstant(isConstantGlobal);
1132 GV->setThreadLocal(IsThreadLocal);
1133 InsertValue(GV, CurModule.Values);
1137 // If this global has a name
1138 if (!Name.empty()) {
1139 // if the global we're parsing has an initializer (is a definition) and
1140 // has external linkage.
1141 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1142 // If there is already a global with external linkage with this name
1143 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1144 // If we allow this GVar to get created, it will be renamed in the
1145 // symbol table because it conflicts with an existing GVar. We can't
1146 // allow redefinition of GVars whose linking indicates that their name
1147 // must stay the same. Issue the error.
1148 GenerateError("Redefinition of global variable named '" + Name +
1149 "' of type '" + Ty->getDescription() + "'");
1154 // Otherwise there is no existing GV to use, create one now.
1155 GlobalVariable *GV =
1156 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1157 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1158 GV->setVisibility(Visibility);
1159 InsertValue(GV, CurModule.Values);
1163 // setTypeName - Set the specified type to the name given. The name may be
1164 // null potentially, in which case this is a noop. The string passed in is
1165 // assumed to be a malloc'd string buffer, and is freed by this function.
1167 // This function returns true if the type has already been defined, but is
1168 // allowed to be redefined in the specified context. If the name is a new name
1169 // for the type plane, it is inserted and false is returned.
1170 static bool setTypeName(const Type *T, std::string *NameStr) {
1171 assert(!inFunctionScope() && "Can't give types function-local names!");
1172 if (NameStr == 0) return false;
1174 std::string Name(*NameStr); // Copy string
1175 delete NameStr; // Free old string
1177 // We don't allow assigning names to void type
1178 if (T == Type::VoidTy) {
1179 GenerateError("Can't assign name '" + Name + "' to the void type");
1183 // Set the type name, checking for conflicts as we do so.
1184 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1186 if (AlreadyExists) { // Inserting a name that is already defined???
1187 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1188 assert(Existing && "Conflict but no matching type?!");
1190 // There is only one case where this is allowed: when we are refining an
1191 // opaque type. In this case, Existing will be an opaque type.
1192 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1193 // We ARE replacing an opaque type!
1194 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1198 // Otherwise, this is an attempt to redefine a type. That's okay if
1199 // the redefinition is identical to the original. This will be so if
1200 // Existing and T point to the same Type object. In this one case we
1201 // allow the equivalent redefinition.
1202 if (Existing == T) return true; // Yes, it's equal.
1204 // Any other kind of (non-equivalent) redefinition is an error.
1205 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1206 T->getDescription() + "'");
1212 //===----------------------------------------------------------------------===//
1213 // Code for handling upreferences in type names...
1216 // TypeContains - Returns true if Ty directly contains E in it.
1218 static bool TypeContains(const Type *Ty, const Type *E) {
1219 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1220 E) != Ty->subtype_end();
1224 struct UpRefRecord {
1225 // NestingLevel - The number of nesting levels that need to be popped before
1226 // this type is resolved.
1227 unsigned NestingLevel;
1229 // LastContainedTy - This is the type at the current binding level for the
1230 // type. Every time we reduce the nesting level, this gets updated.
1231 const Type *LastContainedTy;
1233 // UpRefTy - This is the actual opaque type that the upreference is
1234 // represented with.
1235 OpaqueType *UpRefTy;
1237 UpRefRecord(unsigned NL, OpaqueType *URTy)
1238 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1242 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1243 static std::vector<UpRefRecord> UpRefs;
1245 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1246 /// called. It loops through the UpRefs vector, which is a list of the
1247 /// currently active types. For each type, if the up reference is contained in
1248 /// the newly completed type, we decrement the level count. When the level
1249 /// count reaches zero, the upreferenced type is the type that is passed in:
1250 /// thus we can complete the cycle.
1252 static PATypeHolder HandleUpRefs(const Type *ty) {
1253 // If Ty isn't abstract, or if there are no up-references in it, then there is
1254 // nothing to resolve here.
1255 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1257 PATypeHolder Ty(ty);
1258 UR_OUT("Type '" << Ty->getDescription() <<
1259 "' newly formed. Resolving upreferences.\n" <<
1260 UpRefs.size() << " upreferences active!\n");
1262 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1263 // to zero), we resolve them all together before we resolve them to Ty. At
1264 // the end of the loop, if there is anything to resolve to Ty, it will be in
1266 OpaqueType *TypeToResolve = 0;
1268 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1269 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1270 << UpRefs[i].second->getDescription() << ") = "
1271 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1272 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1273 // Decrement level of upreference
1274 unsigned Level = --UpRefs[i].NestingLevel;
1275 UpRefs[i].LastContainedTy = Ty;
1276 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1277 if (Level == 0) { // Upreference should be resolved!
1278 if (!TypeToResolve) {
1279 TypeToResolve = UpRefs[i].UpRefTy;
1281 UR_OUT(" * Resolving upreference for "
1282 << UpRefs[i].second->getDescription() << "\n";
1283 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1284 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1285 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1286 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1288 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1289 --i; // Do not skip the next element...
1294 if (TypeToResolve) {
1295 UR_OUT(" * Resolving upreference for "
1296 << UpRefs[i].second->getDescription() << "\n";
1297 std::string OldName = TypeToResolve->getDescription());
1298 TypeToResolve->refineAbstractTypeTo(Ty);
1304 //===----------------------------------------------------------------------===//
1305 // RunVMAsmParser - Define an interface to this parser
1306 //===----------------------------------------------------------------------===//
1308 static Module* RunParser(Module * M);
1310 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1312 Module *M = RunParser(new Module(LLLgetFilename()));
1319 /* Enabling traces. */
1324 /* Enabling verbose error messages. */
1325 #ifdef YYERROR_VERBOSE
1326 # undef YYERROR_VERBOSE
1327 # define YYERROR_VERBOSE 1
1329 # define YYERROR_VERBOSE 0
1332 /* Enabling the token table. */
1333 #ifndef YYTOKEN_TABLE
1334 # define YYTOKEN_TABLE 0
1337 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1338 typedef union YYSTYPE
1339 #line 951 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
1341 llvm::Module *ModuleVal;
1342 llvm::Function *FunctionVal;
1343 llvm::BasicBlock *BasicBlockVal;
1344 llvm::TerminatorInst *TermInstVal;
1345 llvm::Instruction *InstVal;
1346 llvm::Constant *ConstVal;
1348 const llvm::Type *PrimType;
1349 std::list<llvm::PATypeHolder> *TypeList;
1350 llvm::PATypeHolder *TypeVal;
1351 llvm::Value *ValueVal;
1352 std::vector<llvm::Value*> *ValueList;
1353 llvm::ArgListType *ArgList;
1354 llvm::TypeWithAttrs TypeWithAttrs;
1355 llvm::TypeWithAttrsList *TypeWithAttrsList;
1356 llvm::ParamList *ParamList;
1358 // Represent the RHS of PHI node
1359 std::list<std::pair<llvm::Value*,
1360 llvm::BasicBlock*> > *PHIList;
1361 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1362 std::vector<llvm::Constant*> *ConstVector;
1364 llvm::GlobalValue::LinkageTypes Linkage;
1365 llvm::GlobalValue::VisibilityTypes Visibility;
1366 llvm::ParameterAttributes ParamAttrs;
1367 llvm::APInt *APIntVal;
1372 llvm::APFloat *FPVal;
1375 std::string *StrVal; // This memory must be deleted
1376 llvm::ValID ValIDVal;
1378 llvm::Instruction::BinaryOps BinaryOpVal;
1379 llvm::Instruction::TermOps TermOpVal;
1380 llvm::Instruction::MemoryOps MemOpVal;
1381 llvm::Instruction::CastOps CastOpVal;
1382 llvm::Instruction::OtherOps OtherOpVal;
1383 llvm::ICmpInst::Predicate IPredicate;
1384 llvm::FCmpInst::Predicate FPredicate;
1386 /* Line 193 of yacc.c. */
1387 #line 1388 "llvmAsmParser.tab.c"
1389 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1390 # define YYSTYPE_IS_DECLARED 1
1391 # define YYSTYPE_IS_TRIVIAL 1
1396 /* Copy the second part of user declarations. */
1399 /* Line 216 of yacc.c. */
1400 #line 1401 "llvmAsmParser.tab.c"
1407 typedef YYTYPE_UINT8 yytype_uint8;
1409 typedef unsigned char yytype_uint8;
1413 typedef YYTYPE_INT8 yytype_int8;
1414 #elif (defined __STDC__ || defined __C99__FUNC__ \
1415 || defined __cplusplus || defined _MSC_VER)
1416 typedef signed char yytype_int8;
1418 typedef short int yytype_int8;
1421 #ifdef YYTYPE_UINT16
1422 typedef YYTYPE_UINT16 yytype_uint16;
1424 typedef unsigned short int yytype_uint16;
1428 typedef YYTYPE_INT16 yytype_int16;
1430 typedef short int yytype_int16;
1434 # ifdef __SIZE_TYPE__
1435 # define YYSIZE_T __SIZE_TYPE__
1436 # elif defined size_t
1437 # define YYSIZE_T size_t
1438 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1439 || defined __cplusplus || defined _MSC_VER)
1440 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1441 # define YYSIZE_T size_t
1443 # define YYSIZE_T unsigned int
1447 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1450 # if defined YYENABLE_NLS && YYENABLE_NLS
1452 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1453 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1457 # define YY_(msgid) msgid
1461 /* Suppress unused-variable warnings by "using" E. */
1462 #if ! defined lint || defined __GNUC__
1463 # define YYUSE(e) ((void) (e))
1465 # define YYUSE(e) /* empty */
1468 /* Identity function, used to suppress warnings about constant conditions. */
1470 # define YYID(n) (n)
1472 #if (defined __STDC__ || defined __C99__FUNC__ \
1473 || defined __cplusplus || defined _MSC_VER)
1486 #if ! defined yyoverflow || YYERROR_VERBOSE
1488 /* The parser invokes alloca or malloc; define the necessary symbols. */
1490 # ifdef YYSTACK_USE_ALLOCA
1491 # if YYSTACK_USE_ALLOCA
1493 # define YYSTACK_ALLOC __builtin_alloca
1494 # elif defined __BUILTIN_VA_ARG_INCR
1495 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1497 # define YYSTACK_ALLOC __alloca
1498 # elif defined _MSC_VER
1499 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1500 # define alloca _alloca
1502 # define YYSTACK_ALLOC alloca
1503 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1504 || defined __cplusplus || defined _MSC_VER)
1505 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1507 # define _STDLIB_H 1
1514 # ifdef YYSTACK_ALLOC
1515 /* Pacify GCC's `empty if-body' warning. */
1516 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1517 # ifndef YYSTACK_ALLOC_MAXIMUM
1518 /* The OS might guarantee only one guard page at the bottom of the stack,
1519 and a page size can be as small as 4096 bytes. So we cannot safely
1520 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1521 to allow for a few compiler-allocated temporary stack slots. */
1522 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1525 # define YYSTACK_ALLOC YYMALLOC
1526 # define YYSTACK_FREE YYFREE
1527 # ifndef YYSTACK_ALLOC_MAXIMUM
1528 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1530 # if (defined __cplusplus && ! defined _STDLIB_H \
1531 && ! ((defined YYMALLOC || defined malloc) \
1532 && (defined YYFREE || defined free)))
1533 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1535 # define _STDLIB_H 1
1539 # define YYMALLOC malloc
1540 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1541 || defined __cplusplus || defined _MSC_VER)
1542 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1546 # define YYFREE free
1547 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1548 || defined __cplusplus || defined _MSC_VER)
1549 void free (void *); /* INFRINGES ON USER NAME SPACE */
1553 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1556 #if (! defined yyoverflow \
1557 && (! defined __cplusplus \
1558 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1560 /* A type that is properly aligned for any stack member. */
1567 /* The size of the maximum gap between one aligned stack and the next. */
1568 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1570 /* The size of an array large to enough to hold all stacks, each with
1572 # define YYSTACK_BYTES(N) \
1573 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1574 + YYSTACK_GAP_MAXIMUM)
1576 /* Copy COUNT objects from FROM to TO. The source and destination do
1579 # if defined __GNUC__ && 1 < __GNUC__
1580 # define YYCOPY(To, From, Count) \
1581 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1583 # define YYCOPY(To, From, Count) \
1587 for (yyi = 0; yyi < (Count); yyi++) \
1588 (To)[yyi] = (From)[yyi]; \
1594 /* Relocate STACK from its old location to the new one. The
1595 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1596 elements in the stack, and YYPTR gives the new location of the
1597 stack. Advance YYPTR to a properly aligned location for the next
1599 # define YYSTACK_RELOCATE(Stack) \
1602 YYSIZE_T yynewbytes; \
1603 YYCOPY (&yyptr->Stack, Stack, yysize); \
1604 Stack = &yyptr->Stack; \
1605 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1606 yyptr += yynewbytes / sizeof (*yyptr); \
1612 /* YYFINAL -- State number of the termination state. */
1614 /* YYLAST -- Last index in YYTABLE. */
1617 /* YYNTOKENS -- Number of terminals. */
1618 #define YYNTOKENS 165
1619 /* YYNNTS -- Number of nonterminals. */
1621 /* YYNRULES -- Number of rules. */
1622 #define YYNRULES 319
1623 /* YYNRULES -- Number of states. */
1624 #define YYNSTATES 624
1626 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1627 #define YYUNDEFTOK 2
1628 #define YYMAXUTOK 405
1630 #define YYTRANSLATE(YYX) \
1631 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1633 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1634 static const yytype_uint8 yytranslate[] =
1636 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1662 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1663 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1664 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1665 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1666 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1667 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1668 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1669 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1670 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1671 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1672 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1673 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1674 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1675 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1676 145, 146, 147, 148, 149, 150
1680 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1682 static const yytype_uint16 yyprhs[] =
1684 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1685 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1686 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1687 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1688 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1689 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1690 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1691 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1692 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1693 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1694 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1695 216, 218, 220, 222, 224, 225, 228, 230, 232, 234,
1696 236, 238, 240, 241, 244, 245, 248, 249, 252, 253,
1697 257, 260, 261, 263, 264, 268, 270, 273, 275, 277,
1698 279, 281, 283, 285, 287, 289, 291, 295, 297, 300,
1699 306, 312, 318, 324, 328, 331, 337, 342, 345, 347,
1700 349, 351, 355, 357, 361, 363, 364, 366, 370, 375,
1701 379, 383, 388, 393, 397, 404, 410, 413, 416, 419,
1702 422, 425, 428, 431, 434, 437, 440, 443, 446, 453,
1703 459, 468, 475, 482, 490, 498, 505, 514, 523, 527,
1704 529, 531, 533, 535, 536, 539, 546, 548, 549, 551,
1705 554, 555, 559, 560, 564, 568, 572, 576, 577, 586,
1706 587, 597, 598, 608, 614, 617, 621, 623, 627, 631,
1707 635, 639, 641, 642, 648, 652, 654, 658, 660, 661,
1708 672, 674, 676, 681, 683, 685, 688, 692, 693, 695,
1709 697, 699, 701, 703, 705, 707, 709, 711, 715, 717,
1710 723, 725, 727, 729, 731, 733, 735, 738, 741, 744,
1711 748, 751, 752, 754, 757, 760, 764, 774, 784, 793,
1712 808, 810, 812, 819, 825, 828, 835, 843, 848, 853,
1713 860, 867, 868, 869, 873, 876, 878, 884, 890, 897,
1714 904, 909, 916, 921, 926, 933, 940, 943, 952, 954,
1715 956, 957, 961, 968, 972, 979, 982, 988, 996, 1002
1718 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1719 static const yytype_int16 yyrhs[] =
1721 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
1722 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1723 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1724 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1725 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1726 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1727 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1728 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1729 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1730 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1731 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1732 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1733 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1734 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1735 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
1736 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1737 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1738 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
1739 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1740 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1741 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1742 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
1743 143, -1, 144, -1, -1, 188, 187, -1, 138, -1,
1744 141, -1, 137, -1, 136, -1, 145, -1, 146, -1,
1745 -1, 190, 189, -1, -1, 147, 22, -1, -1, 53,
1746 4, -1, -1, 154, 53, 4, -1, 34, 22, -1,
1747 -1, 194, -1, -1, 154, 197, 196, -1, 194, -1,
1748 53, 4, -1, 11, -1, 12, -1, 13, -1, 16,
1749 -1, 15, -1, 14, -1, 17, -1, 49, -1, 198,
1750 -1, 199, 175, 155, -1, 233, -1, 156, 4, -1,
1751 199, 151, 203, 152, 190, -1, 10, 151, 203, 152,
1752 190, -1, 157, 4, 158, 199, 159, -1, 160, 4,
1753 158, 199, 161, -1, 162, 204, 163, -1, 162, 163,
1754 -1, 160, 162, 204, 163, 161, -1, 160, 162, 163,
1755 161, -1, 199, 188, -1, 199, -1, 10, -1, 200,
1756 -1, 202, 154, 200, -1, 202, -1, 202, 154, 39,
1757 -1, 39, -1, -1, 199, -1, 204, 154, 199, -1,
1758 199, 157, 207, 159, -1, 199, 157, 159, -1, 199,
1759 164, 22, -1, 199, 160, 207, 161, -1, 199, 162,
1760 207, 163, -1, 199, 162, 163, -1, 199, 160, 162,
1761 207, 163, 161, -1, 199, 160, 162, 163, 161, -1,
1762 199, 40, -1, 199, 41, -1, 199, 233, -1, 199,
1763 206, -1, 199, 25, -1, 171, 3, -1, 171, 5,
1764 -1, 171, 4, -1, 171, 6, -1, 11, 26, -1,
1765 11, 27, -1, 172, 9, -1, 168, 151, 205, 38,
1766 199, 152, -1, 116, 151, 205, 244, 152, -1, 130,
1767 151, 205, 154, 205, 154, 205, 152, -1, 166, 151,
1768 205, 154, 205, 152, -1, 167, 151, 205, 154, 205,
1769 152, -1, 89, 169, 151, 205, 154, 205, 152, -1,
1770 90, 170, 151, 205, 154, 205, 152, -1, 132, 151,
1771 205, 154, 205, 152, -1, 133, 151, 205, 154, 205,
1772 154, 205, 152, -1, 134, 151, 205, 154, 205, 154,
1773 205, 152, -1, 207, 154, 205, -1, 205, -1, 32,
1774 -1, 33, -1, 37, -1, -1, 201, 233, -1, 122,
1775 151, 210, 38, 199, 152, -1, 212, -1, -1, 213,
1776 -1, 212, 213, -1, -1, 31, 214, 229, -1, -1,
1777 30, 215, 230, -1, 59, 58, 219, -1, 176, 18,
1778 199, -1, 176, 18, 10, -1, -1, 178, 182, 209,
1779 208, 205, 175, 216, 196, -1, -1, 178, 180, 182,
1780 209, 208, 205, 175, 217, 196, -1, -1, 178, 181,
1781 182, 209, 208, 199, 175, 218, 196, -1, 178, 182,
1782 35, 185, 210, -1, 51, 220, -1, 55, 153, 221,
1783 -1, 22, -1, 52, 153, 22, -1, 67, 153, 22,
1784 -1, 157, 222, 159, -1, 222, 154, 22, -1, 22,
1785 -1, -1, 223, 154, 199, 188, 174, -1, 199, 188,
1786 174, -1, 223, -1, 223, 154, 39, -1, 39, -1,
1787 -1, 186, 201, 177, 151, 224, 152, 190, 195, 192,
1788 191, -1, 28, -1, 162, -1, 184, 182, 225, 226,
1789 -1, 29, -1, 163, -1, 236, 228, -1, 183, 182,
1790 225, -1, -1, 60, -1, 3, -1, 4, -1, 9,
1791 -1, 26, -1, 27, -1, 40, -1, 41, -1, 25,
1792 -1, 160, 207, 161, -1, 206, -1, 58, 231, 22,
1793 154, 22, -1, 7, -1, 8, -1, 173, -1, 177,
1794 -1, 233, -1, 232, -1, 199, 234, -1, 236, 237,
1795 -1, 227, 237, -1, 238, 176, 239, -1, 238, 241,
1796 -1, -1, 21, -1, 68, 235, -1, 68, 10, -1,
1797 69, 17, 234, -1, 69, 11, 234, 154, 17, 234,
1798 154, 17, 234, -1, 70, 171, 234, 154, 17, 234,
1799 157, 240, 159, -1, 70, 171, 234, 154, 17, 234,
1800 157, 159, -1, 71, 186, 201, 234, 151, 243, 152,
1801 190, 38, 17, 234, 72, 17, 234, -1, 72, -1,
1802 73, -1, 240, 171, 232, 154, 17, 234, -1, 171,
1803 232, 154, 17, 234, -1, 176, 246, -1, 199, 157,
1804 234, 154, 234, 159, -1, 242, 154, 157, 234, 154,
1805 234, 159, -1, 199, 188, 234, 188, -1, 17, 188,
1806 234, 188, -1, 243, 154, 199, 188, 234, 188, -1,
1807 243, 154, 17, 188, 234, 188, -1, -1, -1, 244,
1808 154, 235, -1, 57, 56, -1, 56, -1, 166, 199,
1809 234, 154, 234, -1, 167, 199, 234, 154, 234, -1,
1810 89, 169, 199, 234, 154, 234, -1, 90, 170, 199,
1811 234, 154, 234, -1, 168, 235, 38, 199, -1, 130,
1812 235, 154, 235, 154, 235, -1, 131, 235, 154, 199,
1813 -1, 132, 235, 154, 235, -1, 133, 235, 154, 235,
1814 154, 235, -1, 134, 235, 154, 235, 154, 235, -1,
1815 129, 242, -1, 245, 186, 201, 234, 151, 243, 152,
1816 190, -1, 248, -1, 36, -1, -1, 111, 199, 193,
1817 -1, 111, 199, 154, 11, 234, 193, -1, 112, 199,
1818 193, -1, 112, 199, 154, 11, 234, 193, -1, 113,
1819 235, -1, 247, 114, 199, 234, 193, -1, 247, 115,
1820 235, 154, 199, 234, 193, -1, 135, 199, 173, 154,
1821 205, -1, 116, 199, 234, 244, -1
1824 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1825 static const yytype_uint16 yyrline[] =
1827 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
1828 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
1829 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118,
1830 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126,
1831 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131,
1832 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140,
1833 1140, 1142, 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154,
1834 1159, 1159, 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177,
1835 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195, 1196,
1836 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213, 1214,
1837 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229, 1230,
1838 1231, 1232, 1233, 1234, 1237, 1238, 1243, 1244, 1245, 1246,
1839 1247, 1248, 1251, 1252, 1257, 1258, 1265, 1266, 1272, 1273,
1840 1282, 1290, 1291, 1296, 1297, 1298, 1303, 1316, 1316, 1316,
1841 1316, 1316, 1316, 1316, 1319, 1323, 1327, 1334, 1339, 1347,
1842 1377, 1402, 1407, 1417, 1427, 1431, 1441, 1448, 1457, 1464,
1843 1469, 1474, 1481, 1482, 1489, 1496, 1504, 1510, 1522, 1550,
1844 1566, 1593, 1621, 1647, 1667, 1693, 1713, 1725, 1732, 1798,
1845 1808, 1818, 1824, 1834, 1840, 1850, 1855, 1860, 1873, 1885,
1846 1907, 1915, 1921, 1932, 1937, 1942, 1948, 1954, 1963, 1967,
1847 1975, 1975, 1978, 1978, 1981, 1993, 2014, 2019, 2027, 2028,
1848 2032, 2032, 2036, 2036, 2039, 2042, 2066, 2078, 2077, 2089,
1849 2088, 2098, 2097, 2108, 2148, 2151, 2157, 2167, 2171, 2176,
1850 2178, 2183, 2188, 2197, 2207, 2218, 2222, 2231, 2240, 2245,
1851 2379, 2379, 2381, 2390, 2390, 2392, 2397, 2409, 2413, 2418,
1852 2422, 2426, 2430, 2434, 2438, 2442, 2446, 2450, 2475, 2479,
1853 2489, 2493, 2497, 2502, 2509, 2509, 2515, 2524, 2528, 2537,
1854 2546, 2555, 2559, 2566, 2570, 2574, 2579, 2589, 2608, 2617,
1855 2708, 2712, 2719, 2730, 2743, 2753, 2764, 2774, 2785, 2793,
1856 2803, 2810, 2813, 2814, 2821, 2825, 2830, 2846, 2863, 2877,
1857 2891, 2903, 2911, 2918, 2924, 2930, 2936, 2951, 3049, 3054,
1858 3058, 3065, 3072, 3080, 3087, 3095, 3103, 3117, 3134, 3142
1862 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1863 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1864 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1865 static const char *const yytname[] =
1867 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1868 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1869 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1870 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1871 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1872 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1873 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1874 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1875 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1876 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1877 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1878 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1879 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1880 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1881 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1882 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1883 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1884 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1885 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1886 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
1887 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1888 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1889 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1890 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1891 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1892 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1893 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1894 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1895 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1896 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1897 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1898 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1899 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1900 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1901 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1902 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1903 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1904 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1905 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1906 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1907 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1908 "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
1909 "OptVolatile", "MemoryInst", 0
1914 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1916 static const yytype_uint16 yytoknum[] =
1918 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1919 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1920 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1921 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1922 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1923 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1924 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1925 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1926 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1927 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1928 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1929 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1930 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1931 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1932 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1933 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1934 60, 62, 123, 125, 99
1938 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1939 static const yytype_uint8 yyr1[] =
1941 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1942 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1943 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
1944 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1945 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1946 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1947 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1948 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1949 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1950 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1951 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
1952 187, 187, 187, 187, 188, 188, 189, 189, 189, 189,
1953 189, 189, 190, 190, 191, 191, 192, 192, 193, 193,
1954 194, 195, 195, 196, 196, 197, 197, 198, 198, 198,
1955 198, 198, 198, 198, 199, 199, 199, 199, 199, 199,
1956 199, 199, 199, 199, 199, 199, 199, 200, 201, 201,
1957 202, 202, 203, 203, 203, 203, 204, 204, 205, 205,
1958 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
1959 205, 205, 205, 205, 205, 205, 205, 205, 206, 206,
1960 206, 206, 206, 206, 206, 206, 206, 206, 207, 207,
1961 208, 208, 209, 209, 210, 210, 211, 211, 212, 212,
1962 214, 213, 215, 213, 213, 213, 213, 216, 213, 217,
1963 213, 218, 213, 213, 213, 213, 219, 220, 220, 221,
1964 222, 222, 222, 223, 223, 224, 224, 224, 224, 225,
1965 226, 226, 227, 228, 228, 229, 230, 231, 231, 232,
1966 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1967 233, 233, 233, 233, 234, 234, 235, 236, 236, 237,
1968 238, 238, 238, 239, 239, 239, 239, 239, 239, 239,
1969 239, 239, 240, 240, 241, 242, 242, 243, 243, 243,
1970 243, 243, 244, 244, 245, 245, 246, 246, 246, 246,
1971 246, 246, 246, 246, 246, 246, 246, 246, 246, 247,
1972 247, 248, 248, 248, 248, 248, 248, 248, 248, 248
1975 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1976 static const yytype_uint8 yyr2[] =
1978 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1979 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1980 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1981 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1982 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1983 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1985 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1986 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1987 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1988 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 0, 2, 1, 1, 1, 1,
1990 1, 1, 0, 2, 0, 2, 0, 2, 0, 3,
1991 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
1992 1, 1, 1, 1, 1, 1, 3, 1, 2, 5,
1993 5, 5, 5, 3, 2, 5, 4, 2, 1, 1,
1994 1, 3, 1, 3, 1, 0, 1, 3, 4, 3,
1995 3, 4, 4, 3, 6, 5, 2, 2, 2, 2,
1996 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1997 8, 6, 6, 7, 7, 6, 8, 8, 3, 1,
1998 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
1999 0, 3, 0, 3, 3, 3, 3, 0, 8, 0,
2000 9, 0, 9, 5, 2, 3, 1, 3, 3, 3,
2001 3, 1, 0, 5, 3, 1, 3, 1, 0, 10,
2002 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
2003 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
2004 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
2005 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
2006 1, 1, 6, 5, 2, 6, 7, 4, 4, 6,
2007 6, 0, 0, 3, 2, 1, 5, 5, 6, 6,
2008 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
2009 0, 3, 6, 3, 6, 2, 5, 7, 5, 4
2012 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2013 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2014 means the default is an error. */
2015 static const yytype_uint16 yydefact[] =
2017 73, 61, 70, 62, 71, 63, 212, 210, 0, 0,
2018 0, 0, 0, 0, 83, 72, 0, 73, 208, 87,
2019 90, 0, 0, 224, 0, 0, 68, 0, 74, 75,
2020 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2021 83, 83, 203, 1, 209, 88, 89, 83, 213, 91,
2022 92, 93, 94, 83, 271, 211, 271, 0, 0, 232,
2023 225, 226, 214, 260, 261, 216, 137, 138, 139, 142,
2024 141, 140, 143, 144, 0, 0, 0, 0, 262, 263,
2025 145, 215, 147, 203, 203, 95, 202, 0, 98, 98,
2026 272, 268, 69, 243, 244, 245, 267, 227, 228, 231,
2027 0, 165, 148, 0, 0, 0, 0, 154, 166, 0,
2028 0, 165, 0, 0, 0, 97, 96, 0, 200, 201,
2029 0, 0, 99, 100, 101, 102, 103, 0, 246, 0,
2030 310, 270, 0, 229, 164, 114, 160, 162, 0, 0,
2031 0, 0, 0, 0, 153, 0, 0, 146, 0, 0,
2032 159, 0, 158, 0, 223, 137, 138, 139, 142, 141,
2033 140, 0, 0, 67, 67, 104, 0, 240, 241, 242,
2034 309, 295, 0, 0, 0, 0, 98, 280, 281, 2,
2035 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2036 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2037 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2038 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
2039 0, 0, 269, 98, 284, 0, 308, 230, 157, 0,
2040 122, 67, 67, 156, 0, 167, 0, 122, 67, 67,
2041 0, 204, 185, 186, 181, 183, 182, 184, 187, 180,
2042 176, 177, 0, 0, 0, 0, 0, 0, 0, 0,
2043 0, 0, 0, 0, 0, 0, 179, 178, 217, 0,
2044 294, 274, 67, 273, 0, 0, 55, 0, 0, 29,
2045 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2046 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2047 43, 44, 45, 46, 47, 48, 0, 128, 128, 315,
2048 67, 67, 306, 0, 0, 0, 0, 0, 67, 67,
2049 67, 0, 0, 0, 0, 106, 108, 107, 105, 109,
2050 110, 111, 112, 113, 115, 163, 161, 150, 151, 152,
2051 155, 66, 149, 219, 221, 0, 0, 0, 0, 0,
2052 0, 0, 0, 169, 199, 0, 0, 0, 173, 0,
2053 170, 0, 0, 0, 133, 238, 249, 250, 251, 256,
2054 252, 253, 254, 255, 247, 0, 258, 265, 264, 266,
2055 0, 275, 0, 0, 67, 67, 0, 311, 0, 313,
2056 292, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2057 0, 0, 0, 67, 0, 119, 118, 116, 117, 120,
2058 121, 123, 133, 133, 0, 0, 0, 292, 0, 0,
2059 0, 0, 0, 168, 154, 166, 0, 171, 172, 0,
2060 0, 0, 0, 218, 237, 114, 235, 0, 248, 0,
2061 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,
2062 0, 0, 0, 302, 303, 0, 0, 0, 0, 0,
2063 300, 0, 128, 0, 220, 222, 67, 0, 0, 0,
2064 0, 0, 0, 0, 198, 175, 0, 0, 0, 0,
2065 0, 0, 135, 133, 65, 0, 122, 0, 257, 0,
2066 0, 291, 0, 0, 128, 129, 128, 0, 0, 0,
2067 0, 0, 0, 318, 296, 297, 291, 0, 316, 67,
2068 205, 0, 0, 189, 0, 0, 0, 0, 174, 0,
2069 0, 67, 130, 136, 134, 64, 234, 236, 114, 131,
2070 0, 0, 0, 114, 114, 0, 298, 299, 312, 314,
2071 293, 0, 0, 301, 304, 305, 0, 128, 0, 0,
2072 0, 195, 0, 0, 191, 192, 188, 65, 132, 126,
2073 259, 0, 0, 0, 0, 122, 0, 285, 0, 122,
2074 317, 193, 194, 0, 0, 0, 233, 0, 124, 0,
2075 278, 0, 0, 106, 108, 114, 114, 0, 114, 114,
2076 286, 307, 190, 196, 197, 127, 0, 239, 276, 0,
2077 277, 0, 288, 287, 0, 0, 0, 125, 0, 0,
2078 0, 114, 114, 0, 0, 0, 290, 289, 283, 0,
2082 /* YYDEFGOTO[NTERM-NUM]. */
2083 static const yytype_int16 yydefgoto[] =
2085 -1, 263, 264, 265, 289, 306, 161, 162, 78, 526,
2086 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2087 117, 127, 334, 228, 411, 337, 597, 578, 387, 482,
2088 559, 433, 483, 80, 163, 136, 153, 137, 138, 109,
2089 354, 376, 355, 120, 87, 154, 16, 17, 18, 20,
2090 19, 364, 412, 413, 62, 23, 60, 100, 436, 437,
2091 128, 169, 54, 95, 55, 48, 439, 377, 82, 379,
2092 273, 56, 91, 92, 222, 582, 131, 312, 535, 449,
2096 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2098 #define YYPACT_NINF -566
2099 static const yytype_int16 yypact[] =
2101 331, -566, -566, -566, -566, -566, -566, -566, -9, -100,
2102 18, -71, 93, 30, 60, -566, 155, 403, -566, 193,
2103 186, 62, 87, -566, 120, 228, -566, 1521, -566, -566,
2104 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2105 63, 63, 223, -566, -566, -566, -566, 63, -566, -566,
2106 -566, -566, -566, 63, 258, -566, -11, 259, 260, 263,
2107 -566, -566, -566, -566, -566, 136, -566, -566, -566, -566,
2108 -566, -566, -566, -566, 284, 287, 1, 710, -566, -566,
2109 -566, -31, -566, 255, 255, 217, -566, 57, 34, 34,
2110 -566, -566, 177, -566, -566, -566, -566, -566, -566, -566,
2111 -88, 1304, -566, 135, 137, 750, 136, -566, -31, -102,
2112 143, 1304, 144, 57, 57, -566, -566, 1347, -566, -566,
2113 1579, 296, -566, -566, -566, -566, -566, 1619, -566, -17,
2114 1790, -566, 281, -566, -566, -31, -566, 150, 153, 1637,
2115 1637, 145, -99, 1637, -566, 303, 164, -566, 1579, 1637,
2116 136, 166, -31, 302, -566, 240, 311, 314, 318, 325,
2117 328, 251, 332, 1074, 286, -566, 128, -566, -566, -566,
2118 -566, -566, 288, 1677, 20, 336, 34, -566, -566, -566,
2119 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2120 -566, -566, -566, -566, 349, 1159, 1637, 1637, 1637, 1637,
2121 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2122 -566, -566, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1637,
2123 1637, 1637, -566, 34, -566, 53, -566, -566, -56, 1365,
2124 -566, -22, -39, -566, 181, -31, 196, -566, 286, -21,
2125 1347, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2126 -566, -566, 349, 1159, 201, 209, 214, 215, 221, 1405,
2127 1695, 973, 351, 227, 230, 232, -566, -566, -566, 233,
2128 -566, 136, 661, -566, 800, 800, -566, 800, 1619, -566,
2129 -566, -566, -566, -566, -566, -566, -566, -566, -566, 1637,
2130 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2131 -566, -566, -566, -566, -566, -566, 1637, -13, -5, -566,
2132 661, -32, 220, 237, 241, 245, 247, 248, 5, 661,
2133 661, 366, 1619, 1637, 1637, -566, -566, -566, -566, -566,
2134 -566, -566, -566, -566, -566, -566, -566, 86, -566, -566,
2135 -566, -566, 86, -566, 144, 367, 236, 256, 1579, 1579,
2136 1579, 1579, 1579, -566, -566, 6, 1016, -119, -566, -89,
2137 -566, 1579, 1579, 1579, 252, 1423, -566, -566, -566, -566,
2138 -566, -566, -566, -566, 348, 1579, -566, -566, -566, -566,
2139 262, -566, 270, 800, 661, 661, 15, -566, 19, -566,
2140 -566, 800, 253, 1637, 1637, 1637, 1637, 1637, 274, 276,
2141 277, 1637, 800, 661, 278, -566, -566, -566, -566, -566,
2142 -566, -566, 252, 252, 1637, 1579, 1579, -566, 298, 307,
2143 309, 310, 1579, -566, 295, 928, -85, -566, -566, 315,
2144 316, 375, 4, -566, -566, -31, 319, 265, -566, 392,
2145 -84, 418, 455, 326, 324, 327, 800, 475, 800, 329,
2146 333, 800, 334, -31, -566, 335, 337, 1579, 800, 800,
2147 -31, 339, 340, 1637, -566, -566, -8, 341, 342, 110,
2148 1579, 1579, 1579, 1579, -566, -566, 321, 1579, 1579, 1637,
2149 463, 482, -566, 252, 556, 1463, -566, 350, -566, 800,
2150 800, 1735, 800, 800, 340, -566, 340, 1637, 800, 354,
2151 1637, 1637, 1637, -566, -566, -566, 1735, 450, -566, 661,
2152 -566, 1579, 1579, -566, 356, 353, 357, 358, -566, 361,
2153 362, 2, -566, -566, -566, -566, -566, -566, -31, 39,
2154 493, 363, 359, -15, -31, 121, -566, -566, -566, -566,
2155 -566, 360, 800, -566, -566, -566, 122, 340, 368, 369,
2156 1579, -566, 1579, 1579, -566, -566, -566, 556, -566, 471,
2157 -566, 508, -2, 519, 519, -566, 1793, -566, 370, -566,
2158 -566, -566, -566, 378, 379, 380, -566, 529, 387, 800,
2159 -566, 1214, 10, 384, 385, -566, -566, 80, -15, -31,
2160 -566, 86, -566, -566, -566, -566, 515, -566, -566, 393,
2161 -566, 1214, -56, -56, 531, 519, 519, -566, 532, 396,
2162 800, -566, -566, 800, 535, 481, -56, -56, -566, 800,
2163 537, -566, 800, -566
2166 /* YYPGOTO[NTERM-NUM]. */
2167 static const yytype_int16 yypgoto[] =
2169 -566, 425, 426, 428, 312, 308, -173, -566, 0, 11,
2170 -145, 470, 8, -566, -566, -566, -566, 7, -566, -566,
2171 -566, -156, -566, -407, -566, -233, -566, -566, -296, 36,
2172 -566, -368, -566, -566, -26, 338, -120, -566, 452, 461,
2173 -114, -160, -247, 106, 185, 330, -566, -566, 552, -566,
2174 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2175 485, -566, -566, -566, -566, -566, -566, -565, -113, 9,
2176 -82, -566, 520, -566, -566, -566, -566, -566, 65, 162,
2177 -566, -566, -566, -566
2180 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2181 positive, shift that token. If negative, reduce the rule which
2182 number is the opposite. If zero, do what YYDEFACT says.
2183 If YYTABLE_NINF, syntax error. */
2184 #define YYTABLE_NINF -208
2185 static const yytype_int16 yytable[] =
2187 11, 81, 277, 266, 342, 104, 164, 166, 13, 276,
2188 90, 167, 389, 357, 359, 110, 599, 11, 93, 268,
2189 278, 276, 110, 110, 1, 13, 446, 3, 484, 5,
2190 448, 274, 110, 110, 238, 422, 609, 275, 480, -143,
2191 241, 110, 427, 21, 464, 465, 110, 83, 84, 110,
2192 267, 108, 143, 24, 88, 143, 110, 481, 22, 110,
2193 89, 144, 325, 326, 234, 422, 132, 322, 447, 422,
2194 422, 133, 447, 480, 428, 135, 25, 488, 476, 108,
2195 327, 328, 26, 329, 330, 135, 331, 332, 333, 118,
2196 119, 152, 11, 343, 344, 121, 122, 123, 124, 125,
2197 126, 152, 29, 30, 31, 32, 33, 34, 35, 426,
2198 36, 27, 111, 231, 232, 524, 309, 235, 604, 111,
2199 111, 557, 339, 239, -67, 391, 563, 564, 440, 111,
2200 111, 313, 314, 315, 316, 317, -143, 338, 111, 321,
2201 -143, 386, -67, 111, 510, 168, 111, 272, 2, 388,
2202 -67, 4, 94, 111, 556, 43, 111, 580, 383, 378,
2203 422, 378, 378, 105, 378, 423, 508, 323, 324, 600,
2204 307, 308, 272, 310, 269, 405, 406, 407, 602, 603,
2205 408, 605, 606, 28, 409, 410, 311, 272, 272, 272,
2206 272, 272, 318, 319, 320, 272, 1, 378, 538, 3,
2207 539, 5, 402, 135, 616, 617, 378, 378, 37, 38,
2208 39, 37, 38, 39, 152, 57, 405, 406, 407, 148,
2209 149, 408, 405, 406, 407, 409, 410, 408, 49, 50,
2210 51, 409, 410, 52, 417, 418, 419, 420, 421, 45,
2211 58, 46, 404, -55, -55, -55, -55, 429, 430, 431,
2212 61, 570, 152, 529, 244, 245, 246, 247, 85, 115,
2213 86, 116, 513, 384, 497, 266, 242, 243, 113, 114,
2214 378, 378, 378, 565, 569, 566, 566, 59, 378, 90,
2215 385, 97, 98, 380, 381, 99, 382, 101, 102, 378,
2216 378, 103, 86, 139, 145, 140, 152, 403, 272, 147,
2217 165, 467, 468, 227, 229, 230, 233, 236, 474, 63,
2218 64, 452, 267, 454, 455, 456, 237, 240, 398, 390,
2219 -56, 1, 2, -57, 3, 4, 5, -60, 399, 400,
2220 425, -207, 587, 378, -59, 378, 591, -58, 378, 435,
2221 110, 248, 340, 503, 270, 378, 378, 276, 341, -69,
2222 1, 2, 348, 3, 4, 5, 514, 515, 516, 517,
2223 349, 6, 7, 519, 520, 350, 351, 272, 453, 272,
2224 272, 272, 352, 360, 392, 460, 378, 378, 361, 378,
2225 378, 362, 8, 363, 365, 378, 9, 415, 466, 581,
2226 10, 393, 443, 444, 445, 394, 378, 548, 549, 395,
2227 450, 396, 397, -206, 401, 414, 432, 416, 438, 601,
2228 451, 461, 462, 479, 487, 540, 441, 486, 543, 544,
2229 545, -69, 1, 2, 442, 3, 4, 5, 457, 378,
2230 458, 459, 463, 6, 7, 489, 573, 509, 574, 575,
2231 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
2232 378, 378, 470, 521, 8, 494, 475, 496, 9, 528,
2233 499, 471, 10, 472, 473, 534, 378, 504, 505, 477,
2234 478, 272, 490, 485, 272, 272, 272, 491, 492, 495,
2235 534, 493, 518, 497, 525, 522, 523, 498, 500, 501,
2236 506, 502, 378, 378, 507, 511, 512, 378, 531, 532,
2237 378, 536, 537, 447, 530, 551, 378, 541, 542, 378,
2238 550, 552, 553, 554, 555, 560, 562, 561, 547, 567,
2239 571, 572, 366, 367, 577, 579, 63, 64, 368, 590,
2240 592, 593, 594, 595, 596, -18, -19, 607, 1, 2,
2241 589, 3, 4, 5, 369, 370, 371, 608, 610, 613,
2242 614, 568, 619, 620, 622, 219, 220, 525, 221, 372,
2243 373, 347, 130, 146, 346, 558, 142, 336, 576, 44,
2244 345, 546, 585, 586, 129, 1, 96, 374, 3, 469,
2245 5, 0, 0, 0, 0, 0, 0, 0, 598, 0,
2246 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2247 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2248 0, 0, 0, 0, 611, 612, 0, 0, 0, 615,
2249 0, 0, 618, 0, 0, 0, 0, 0, 621, 0,
2250 0, 623, 0, 0, 0, 254, 200, 583, 584, 203,
2251 204, 205, 206, 207, 208, 209, 210, 211, 0, 255,
2252 0, 256, 257, 258, 0, 327, 328, 0, 329, 330,
2253 0, 331, 332, 333, 366, 367, 0, 0, 63, 64,
2254 368, 0, 0, 0, 325, 326, 0, 0, 0, 375,
2255 1, 2, 0, 3, 4, 5, 369, 370, 371, 0,
2256 0, 0, 327, 328, 0, 329, 330, 0, 331, 332,
2257 333, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2258 0, 0, 0, 0, 0, 110, 0, 63, 64, 374,
2259 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2260 2, 0, 3, 4, 5, 179, 180, 181, 182, 183,
2261 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2262 252, 253, 0, 0, 0, 0, 0, 63, 64, 73,
2263 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2264 2, 0, 3, 4, 5, 0, 0, 254, 200, 201,
2265 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2266 0, 255, 0, 256, 257, 258, 0, 0, 0, 73,
2267 0, 0, 0, 366, 367, 0, 0, 63, 64, 368,
2268 0, 0, 111, 0, 0, 0, 0, 0, 0, 1,
2269 2, 375, 3, 4, 5, 369, 370, 371, 0, 0,
2270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2271 372, 373, 0, 0, 0, 0, 0, 0, 0, 0,
2272 0, 0, 0, 0, 0, 0, 0, 0, 374, 0,
2273 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2274 76, 0, 77, 107, 179, 180, 181, 182, 183, 184,
2275 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2276 253, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2277 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2278 76, 0, 77, 141, 0, 0, 254, 200, 201, 202,
2279 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
2280 255, 0, 256, 257, 258, 63, 64, 0, 0, 0,
2281 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2282 3, 4, 5, 249, 0, 0, 0, 0, 0, 0,
2283 375, 0, 0, 0, 0, 0, 0, 0, 250, 251,
2284 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2285 63, 64, 110, 106, 155, 156, 157, 158, 159, 160,
2286 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2287 0, 0, 179, 180, 181, 182, 183, 184, 185, 186,
2288 187, 188, 189, 190, 191, 192, 193, 252, 253, 0,
2289 0, 0, 73, 63, 64, 0, 106, 155, 156, 157,
2290 158, 159, 160, 72, 0, 1, 2, 0, 3, 4,
2291 5, 0, 0, 0, 254, 200, 201, 202, 203, 204,
2292 205, 206, 207, 208, 209, 210, 211, 0, 255, 0,
2293 256, 257, 258, 0, 0, 73, 0, 0, 0, 0,
2294 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2295 0, 63, 64, -67, 0, 259, 0, 0, 260, 0,
2296 261, 0, 262, 1, 2, 0, 3, 4, 5, 249,
2297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2298 0, 0, 0, 0, 250, 251, 0, 0, 0, 0,
2299 0, 0, 0, 0, 0, 0, 0, 0, 110, 74,
2300 75, 0, 0, 76, 0, 77, 358, 0, 0, 0,
2301 0, 0, 0, 0, 0, 0, 0, 0, 179, 180,
2302 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2303 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
2304 0, 0, 74, 75, 0, 0, 76, 0, 77, 424,
2305 0, 0, 0, 0, 0, 290, 291, 0, 0, 0,
2306 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2307 209, 210, 211, 0, 255, 0, 256, 257, 258, 0,
2308 0, 0, 0, 0, 0, 0, 0, 366, 367, 0,
2309 0, 0, 0, 368, 0, 111, 0, 0, 0, 0,
2310 0, 259, 0, 0, 260, 0, 261, 0, 262, 369,
2311 370, 371, 0, 0, 0, 0, 0, 0, 0, 0,
2312 0, 0, 0, 0, 372, 373, 292, 293, 294, 295,
2313 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
2314 0, 0, 374, 0, 0, 0, 0, 0, 0, 0,
2315 0, 0, 0, 0, 0, 0, 0, 0, 179, 180,
2316 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2317 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
2318 0, 63, 64, 0, 106, 66, 67, 68, 69, 70,
2319 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2320 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2321 209, 210, 211, 134, 255, 0, 256, 257, 258, 0,
2322 0, 0, 0, 73, 63, 64, 0, 150, 66, 67,
2323 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2324 4, 5, 63, 64, 375, 106, 66, 67, 68, 69,
2325 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2326 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
2327 0, 0, 0, 0, 335, 0, 0, 0, 0, 0,
2328 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2329 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2330 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
2331 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2332 0, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2333 74, 75, 434, 0, 76, 0, 77, 0, 0, 151,
2334 63, 64, 73, 106, 66, 67, 68, 69, 70, 71,
2335 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2337 0, 0, 527, 74, 75, 0, 0, 76, 0, 77,
2338 0, 0, 73, 0, 0, 0, 0, 0, 0, 0,
2339 0, 74, 75, 0, 0, 76, 0, 77, 63, 64,
2340 0, 65, 66, 67, 68, 69, 70, 71, 72, 0,
2341 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2342 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2343 0, 74, 75, 0, 353, 76, 0, 77, 0, 0,
2344 73, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2345 75, 0, 0, 76, 0, 77, 63, 64, 0, 106,
2346 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2347 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2348 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2349 75, 0, 0, 76, 0, 77, 63, 64, 73, 150,
2350 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2351 0, 3, 4, 5, 63, 64, 0, 106, 66, 67,
2352 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2353 4, 5, 0, 0, 0, 0, 0, 0, 73, 0,
2354 0, 0, 0, 0, 0, 0, 0, 74, 75, 0,
2355 0, 76, 0, 77, 63, 64, 73, 271, 66, 67,
2356 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2357 4, 5, 63, 64, 0, 106, 155, 156, 157, 158,
2358 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2359 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
2360 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2361 0, 77, 63, 64, 73, 106, 66, 67, 68, 69,
2362 70, 71, 533, 0, 1, 2, 0, 3, 4, 5,
2363 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2364 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2365 0, 77, 0, 0, 73, 0, 0, 0, 0, 0,
2366 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2367 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
2368 588, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2369 0, 0, 0, 0, 0, 0, 170, 0, 0, 0,
2370 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2371 0, 0, 73, 0, 0, 0, 171, 172, 0, 0,
2372 0, 74, 75, 0, 0, 76, 0, 356, 173, 174,
2373 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2374 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2375 195, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2376 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2377 0, 196, 197, 198, 0, 0, 199, 200, 201, 202,
2378 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2379 213, 214, 215, 216, 217, 218, 0, 0, 0, 0,
2380 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2385 static const yytype_int16 yycheck[] =
2387 0, 27, 175, 163, 237, 4, 120, 127, 0, 11,
2388 21, 28, 308, 260, 261, 54, 581, 17, 29, 164,
2389 176, 11, 54, 54, 19, 17, 11, 22, 435, 24,
2390 11, 11, 54, 54, 148, 154, 601, 17, 34, 54,
2391 153, 54, 161, 52, 412, 413, 54, 40, 41, 54,
2392 163, 77, 154, 153, 47, 154, 54, 53, 67, 54,
2393 53, 163, 118, 119, 163, 154, 154, 223, 53, 154,
2394 154, 159, 53, 34, 163, 101, 58, 161, 163, 105,
2395 136, 137, 153, 139, 140, 111, 142, 143, 144, 32,
2396 33, 117, 92, 238, 239, 61, 62, 63, 64, 65,
2397 66, 127, 42, 43, 44, 45, 46, 47, 48, 356,
2398 50, 18, 151, 139, 140, 483, 198, 143, 38, 151,
2399 151, 528, 161, 149, 155, 157, 533, 534, 375, 151,
2400 151, 213, 214, 215, 216, 217, 151, 159, 151, 221,
2401 155, 154, 155, 151, 152, 162, 151, 173, 20, 154,
2402 155, 23, 163, 151, 152, 0, 151, 159, 278, 272,
2403 154, 274, 275, 162, 277, 159, 462, 114, 115, 159,
2404 196, 197, 198, 199, 166, 136, 137, 138, 585, 586,
2405 141, 588, 589, 153, 145, 146, 212, 213, 214, 215,
2406 216, 217, 218, 219, 220, 221, 19, 310, 494, 22,
2407 496, 24, 322, 229, 611, 612, 319, 320, 148, 149,
2408 150, 148, 149, 150, 240, 153, 136, 137, 138, 113,
2409 114, 141, 136, 137, 138, 145, 146, 141, 42, 43,
2410 44, 145, 146, 47, 348, 349, 350, 351, 352, 46,
2411 153, 48, 324, 3, 4, 5, 6, 361, 362, 363,
2412 22, 547, 278, 486, 3, 4, 5, 6, 35, 42,
2413 37, 44, 152, 289, 154, 425, 26, 27, 83, 84,
2414 383, 384, 385, 152, 152, 154, 154, 157, 391, 21,
2415 306, 22, 22, 274, 275, 22, 277, 151, 4, 402,
2416 403, 4, 37, 158, 151, 158, 322, 323, 324, 155,
2417 4, 415, 416, 22, 154, 152, 161, 4, 422, 7,
2418 8, 393, 425, 395, 396, 397, 152, 151, 318, 310,
2419 9, 19, 20, 9, 22, 23, 24, 9, 319, 320,
2420 356, 0, 565, 446, 9, 448, 569, 9, 451, 365,
2421 54, 9, 161, 457, 56, 458, 459, 11, 152, 18,
2422 19, 20, 151, 22, 23, 24, 470, 471, 472, 473,
2423 151, 30, 31, 477, 478, 151, 151, 393, 394, 395,
2424 396, 397, 151, 22, 154, 401, 489, 490, 151, 492,
2425 493, 151, 51, 151, 151, 498, 55, 151, 414, 562,
2426 59, 154, 383, 384, 385, 154, 509, 511, 512, 154,
2427 391, 154, 154, 0, 38, 38, 154, 151, 60, 582,
2428 157, 402, 403, 38, 22, 497, 154, 152, 500, 501,
2429 502, 18, 19, 20, 154, 22, 23, 24, 154, 542,
2430 154, 154, 154, 30, 31, 17, 550, 463, 552, 553,
2431 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2432 563, 564, 154, 479, 51, 446, 161, 448, 55, 485,
2433 451, 154, 59, 154, 154, 491, 579, 458, 459, 154,
2434 154, 497, 17, 154, 500, 501, 502, 151, 154, 4,
2435 506, 154, 161, 154, 484, 22, 4, 154, 154, 154,
2436 151, 154, 605, 606, 154, 154, 154, 610, 489, 490,
2437 613, 492, 493, 53, 154, 152, 619, 498, 154, 622,
2438 154, 154, 154, 152, 152, 22, 157, 154, 509, 159,
2439 152, 152, 3, 4, 53, 17, 7, 8, 9, 159,
2440 152, 152, 152, 4, 147, 151, 151, 22, 19, 20,
2441 566, 22, 23, 24, 25, 26, 27, 154, 17, 17,
2442 154, 542, 17, 72, 17, 130, 130, 557, 130, 40,
2443 41, 253, 92, 111, 252, 529, 105, 229, 557, 17,
2444 240, 506, 563, 564, 89, 19, 56, 58, 22, 417,
2445 24, -1, -1, -1, -1, -1, -1, -1, 579, -1,
2446 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2447 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2448 -1, -1, -1, -1, 605, 606, -1, -1, -1, 610,
2449 -1, -1, 613, -1, -1, -1, -1, -1, 619, -1,
2450 -1, 622, -1, -1, -1, 116, 117, 118, 119, 120,
2451 121, 122, 123, 124, 125, 126, 127, 128, -1, 130,
2452 -1, 132, 133, 134, -1, 136, 137, -1, 139, 140,
2453 -1, 142, 143, 144, 3, 4, -1, -1, 7, 8,
2454 9, -1, -1, -1, 118, 119, -1, -1, -1, 160,
2455 19, 20, -1, 22, 23, 24, 25, 26, 27, -1,
2456 -1, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2457 144, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2458 -1, -1, -1, -1, -1, 54, -1, 7, 8, 58,
2459 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2460 20, -1, 22, 23, 24, 74, 75, 76, 77, 78,
2461 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2462 89, 90, -1, -1, -1, -1, -1, 7, 8, 49,
2463 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2464 20, -1, 22, 23, 24, -1, -1, 116, 117, 118,
2465 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2466 -1, 130, -1, 132, 133, 134, -1, -1, -1, 49,
2467 -1, -1, -1, 3, 4, -1, -1, 7, 8, 9,
2468 -1, -1, 151, -1, -1, -1, -1, -1, -1, 19,
2469 20, 160, 22, 23, 24, 25, 26, 27, -1, -1,
2470 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2471 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2472 -1, -1, -1, -1, -1, -1, -1, -1, 58, -1,
2473 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2474 160, -1, 162, 163, 74, 75, 76, 77, 78, 79,
2475 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2476 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2477 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2478 160, -1, 162, 163, -1, -1, 116, 117, 118, 119,
2479 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
2480 130, -1, 132, 133, 134, 7, 8, -1, -1, -1,
2481 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
2482 22, 23, 24, 25, -1, -1, -1, -1, -1, -1,
2483 160, -1, -1, -1, -1, -1, -1, -1, 40, 41,
2484 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2485 7, 8, 54, 10, 11, 12, 13, 14, 15, 16,
2486 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2487 -1, -1, 74, 75, 76, 77, 78, 79, 80, 81,
2488 82, 83, 84, 85, 86, 87, 88, 89, 90, -1,
2489 -1, -1, 49, 7, 8, -1, 10, 11, 12, 13,
2490 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2491 24, -1, -1, -1, 116, 117, 118, 119, 120, 121,
2492 122, 123, 124, 125, 126, 127, 128, -1, 130, -1,
2493 132, 133, 134, -1, -1, 49, -1, -1, -1, -1,
2494 -1, -1, -1, -1, -1, -1, -1, -1, -1, 151,
2495 -1, 7, 8, 155, -1, 157, -1, -1, 160, -1,
2496 162, -1, 164, 19, 20, -1, 22, 23, 24, 25,
2497 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2498 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2499 -1, -1, -1, -1, -1, -1, -1, -1, 54, 156,
2500 157, -1, -1, 160, -1, 162, 163, -1, -1, -1,
2501 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
2502 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2503 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
2504 -1, -1, 156, 157, -1, -1, 160, -1, 162, 163,
2505 -1, -1, -1, -1, -1, 26, 27, -1, -1, -1,
2506 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2507 126, 127, 128, -1, 130, -1, 132, 133, 134, -1,
2508 -1, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2509 -1, -1, -1, 9, -1, 151, -1, -1, -1, -1,
2510 -1, 157, -1, -1, 160, -1, 162, -1, 164, 25,
2511 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2512 -1, -1, -1, -1, 40, 41, 97, 98, 99, 100,
2513 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
2514 -1, -1, 58, -1, -1, -1, -1, -1, -1, -1,
2515 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
2516 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2517 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
2518 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2519 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2520 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2521 126, 127, 128, 39, 130, -1, 132, 133, 134, -1,
2522 -1, -1, -1, 49, 7, 8, -1, 10, 11, 12,
2523 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2524 23, 24, 7, 8, 160, 10, 11, 12, 13, 14,
2525 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2526 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2527 -1, -1, -1, -1, 39, -1, -1, -1, -1, -1,
2528 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2529 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2530 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2531 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2532 -1, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2533 156, 157, 39, -1, 160, -1, 162, -1, -1, 122,
2534 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
2535 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2536 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2537 -1, -1, 39, 156, 157, -1, -1, 160, -1, 162,
2538 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2539 -1, 156, 157, -1, -1, 160, -1, 162, 7, 8,
2540 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2541 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2542 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2543 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2544 49, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2545 157, -1, -1, 160, -1, 162, 7, 8, -1, 10,
2546 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2547 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2548 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2549 157, -1, -1, 160, -1, 162, 7, 8, 49, 10,
2550 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2551 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2552 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2553 23, 24, -1, -1, -1, -1, -1, -1, 49, -1,
2554 -1, -1, -1, -1, -1, -1, -1, 156, 157, -1,
2555 -1, 160, -1, 162, 7, 8, 49, 10, 11, 12,
2556 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2557 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2558 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2559 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2560 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2561 -1, 162, 7, 8, 49, 10, 11, 12, 13, 14,
2562 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2563 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2564 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2565 -1, 162, -1, -1, 49, -1, -1, -1, -1, -1,
2566 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
2567 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2568 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2569 -1, -1, -1, -1, -1, -1, 36, -1, -1, -1,
2570 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
2571 -1, -1, 49, -1, -1, -1, 56, 57, -1, -1,
2572 -1, 156, 157, -1, -1, 160, -1, 162, 68, 69,
2573 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2574 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2575 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2576 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2577 -1, 111, 112, 113, -1, -1, 116, 117, 118, 119,
2578 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2579 130, 131, 132, 133, 134, 135, -1, -1, -1, -1,
2580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2581 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2582 157, -1, -1, 160, -1, 162
2585 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2586 symbol of state STATE-NUM. */
2587 static const yytype_uint8 yystos[] =
2589 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2590 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2591 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2592 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2593 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
2594 43, 44, 47, 184, 227, 229, 236, 153, 153, 157,
2595 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2596 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2597 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
2598 21, 237, 238, 29, 163, 228, 237, 22, 22, 22,
2599 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2600 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2601 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
2602 176, 241, 154, 159, 39, 199, 200, 202, 203, 158,
2603 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2604 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2605 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
2606 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2607 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2608 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2609 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2610 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
2611 167, 168, 239, 245, 246, 247, 248, 22, 188, 154,
2612 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2613 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2614 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2615 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
2616 56, 10, 199, 235, 11, 17, 11, 171, 186, 91,
2617 92, 93, 94, 95, 96, 97, 98, 99, 100, 169,
2618 26, 27, 97, 98, 99, 100, 101, 102, 103, 104,
2619 105, 106, 107, 108, 109, 110, 170, 199, 199, 235,
2620 199, 199, 242, 235, 235, 235, 235, 235, 199, 199,
2621 199, 235, 186, 114, 115, 118, 119, 136, 137, 139,
2622 140, 142, 143, 144, 187, 39, 200, 190, 159, 161,
2623 161, 152, 190, 175, 175, 210, 169, 170, 151, 151,
2624 151, 151, 151, 159, 205, 207, 162, 207, 163, 207,
2625 22, 151, 151, 151, 216, 151, 3, 4, 9, 25,
2626 26, 27, 40, 41, 58, 160, 206, 232, 233, 234,
2627 234, 234, 234, 201, 199, 199, 154, 193, 154, 193,
2628 234, 157, 154, 154, 154, 154, 154, 154, 173, 234,
2629 234, 38, 201, 199, 235, 136, 137, 138, 141, 145,
2630 146, 189, 217, 218, 38, 151, 151, 205, 205, 205,
2631 205, 205, 154, 159, 163, 199, 207, 161, 163, 205,
2632 205, 205, 154, 196, 39, 199, 223, 224, 60, 231,
2633 207, 154, 154, 234, 234, 234, 11, 53, 11, 244,
2634 234, 157, 235, 199, 235, 235, 235, 154, 154, 154,
2635 199, 234, 234, 154, 196, 196, 199, 205, 205, 244,
2636 154, 154, 154, 154, 205, 161, 163, 154, 154, 38,
2637 34, 53, 194, 197, 188, 154, 152, 22, 161, 17,
2638 17, 151, 154, 154, 234, 4, 234, 154, 154, 234,
2639 154, 154, 154, 205, 234, 234, 151, 154, 193, 199,
2640 152, 154, 154, 152, 205, 205, 205, 205, 161, 205,
2641 205, 199, 22, 4, 196, 173, 174, 39, 199, 190,
2642 154, 234, 234, 17, 199, 243, 234, 234, 193, 193,
2643 235, 234, 154, 235, 235, 235, 243, 234, 205, 205,
2644 154, 152, 154, 154, 152, 152, 152, 188, 194, 195,
2645 22, 154, 157, 188, 188, 152, 154, 159, 234, 152,
2646 193, 152, 152, 205, 205, 205, 174, 53, 192, 17,
2647 159, 171, 240, 118, 119, 234, 234, 190, 17, 199,
2648 159, 190, 152, 152, 152, 4, 147, 191, 234, 232,
2649 159, 171, 188, 188, 38, 188, 188, 22, 154, 232,
2650 17, 234, 234, 17, 154, 234, 188, 188, 234, 17,
2654 #define yyerrok (yyerrstatus = 0)
2655 #define yyclearin (yychar = YYEMPTY)
2656 #define YYEMPTY (-2)
2659 #define YYACCEPT goto yyacceptlab
2660 #define YYABORT goto yyabortlab
2661 #define YYERROR goto yyerrorlab
2664 /* Like YYERROR except do call yyerror. This remains here temporarily
2665 to ease the transition to the new meaning of YYERROR, for GCC.
2666 Once GCC version 2 has supplanted version 1, this can go. */
2668 #define YYFAIL goto yyerrlab
2670 #define YYRECOVERING() (!!yyerrstatus)
2672 #define YYBACKUP(Token, Value) \
2674 if (yychar == YYEMPTY && yylen == 1) \
2678 yytoken = YYTRANSLATE (yychar); \
2684 yyerror (YY_("syntax error: cannot back up")); \
2691 #define YYERRCODE 256
2694 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2695 If N is 0, then set CURRENT to the empty location which ends
2696 the previous symbol: RHS[0] (always defined). */
2698 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2699 #ifndef YYLLOC_DEFAULT
2700 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2704 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2705 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2706 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2707 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2711 (Current).first_line = (Current).last_line = \
2712 YYRHSLOC (Rhs, 0).last_line; \
2713 (Current).first_column = (Current).last_column = \
2714 YYRHSLOC (Rhs, 0).last_column; \
2720 /* YY_LOCATION_PRINT -- Print the location on the stream.
2721 This macro was not mandated originally: define only if we know
2722 we won't break user code: when these are the locations we know. */
2724 #ifndef YY_LOCATION_PRINT
2725 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2726 # define YY_LOCATION_PRINT(File, Loc) \
2727 fprintf (File, "%d.%d-%d.%d", \
2728 (Loc).first_line, (Loc).first_column, \
2729 (Loc).last_line, (Loc).last_column)
2731 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2736 /* YYLEX -- calling `yylex' with the right arguments. */
2739 # define YYLEX yylex (YYLEX_PARAM)
2741 # define YYLEX yylex ()
2744 /* Enable debugging if requested. */
2748 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2749 # define YYFPRINTF fprintf
2752 # define YYDPRINTF(Args) \
2758 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2762 YYFPRINTF (stderr, "%s ", Title); \
2763 yy_symbol_print (stderr, \
2765 YYFPRINTF (stderr, "\n"); \
2770 /*--------------------------------.
2771 | Print this symbol on YYOUTPUT. |
2772 `--------------------------------*/
2775 #if (defined __STDC__ || defined __C99__FUNC__ \
2776 || defined __cplusplus || defined _MSC_VER)
2778 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2781 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2784 YYSTYPE const * const yyvaluep;
2790 if (yytype < YYNTOKENS)
2791 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2803 /*--------------------------------.
2804 | Print this symbol on YYOUTPUT. |
2805 `--------------------------------*/
2807 #if (defined __STDC__ || defined __C99__FUNC__ \
2808 || defined __cplusplus || defined _MSC_VER)
2810 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2813 yy_symbol_print (yyoutput, yytype, yyvaluep)
2816 YYSTYPE const * const yyvaluep;
2819 if (yytype < YYNTOKENS)
2820 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2822 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2824 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2825 YYFPRINTF (yyoutput, ")");
2828 /*------------------------------------------------------------------.
2829 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2831 `------------------------------------------------------------------*/
2833 #if (defined __STDC__ || defined __C99__FUNC__ \
2834 || defined __cplusplus || defined _MSC_VER)
2836 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2839 yy_stack_print (bottom, top)
2840 yytype_int16 *bottom;
2844 YYFPRINTF (stderr, "Stack now");
2845 for (; bottom <= top; ++bottom)
2846 YYFPRINTF (stderr, " %d", *bottom);
2847 YYFPRINTF (stderr, "\n");
2850 # define YY_STACK_PRINT(Bottom, Top) \
2853 yy_stack_print ((Bottom), (Top)); \
2857 /*------------------------------------------------.
2858 | Report that the YYRULE is going to be reduced. |
2859 `------------------------------------------------*/
2861 #if (defined __STDC__ || defined __C99__FUNC__ \
2862 || defined __cplusplus || defined _MSC_VER)
2864 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2867 yy_reduce_print (yyvsp, yyrule)
2872 int yynrhs = yyr2[yyrule];
2874 unsigned long int yylno = yyrline[yyrule];
2875 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2877 /* The symbols being reduced. */
2878 for (yyi = 0; yyi < yynrhs; yyi++)
2880 fprintf (stderr, " $%d = ", yyi + 1);
2881 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2882 &(yyvsp[(yyi + 1) - (yynrhs)])
2884 fprintf (stderr, "\n");
2888 # define YY_REDUCE_PRINT(Rule) \
2891 yy_reduce_print (yyvsp, Rule); \
2894 /* Nonzero means print parse trace. It is left uninitialized so that
2895 multiple parsers can coexist. */
2897 #else /* !YYDEBUG */
2898 # define YYDPRINTF(Args)
2899 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2900 # define YY_STACK_PRINT(Bottom, Top)
2901 # define YY_REDUCE_PRINT(Rule)
2902 #endif /* !YYDEBUG */
2905 /* YYINITDEPTH -- initial size of the parser's stacks. */
2907 # define YYINITDEPTH 200
2910 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2911 if the built-in stack extension method is used).
2913 Do not make this value too large; the results are undefined if
2914 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2915 evaluated with infinite-precision integer arithmetic. */
2918 # define YYMAXDEPTH 10000
2926 # if defined __GLIBC__ && defined _STRING_H
2927 # define yystrlen strlen
2929 /* Return the length of YYSTR. */
2930 #if (defined __STDC__ || defined __C99__FUNC__ \
2931 || defined __cplusplus || defined _MSC_VER)
2933 yystrlen (const char *yystr)
2941 for (yylen = 0; yystr[yylen]; yylen++)
2949 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2950 # define yystpcpy stpcpy
2952 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2954 #if (defined __STDC__ || defined __C99__FUNC__ \
2955 || defined __cplusplus || defined _MSC_VER)
2957 yystpcpy (char *yydest, const char *yysrc)
2960 yystpcpy (yydest, yysrc)
2966 const char *yys = yysrc;
2968 while ((*yyd++ = *yys++) != '\0')
2977 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2978 quotes and backslashes, so that it's suitable for yyerror. The
2979 heuristic is that double-quoting is unnecessary unless the string
2980 contains an apostrophe, a comma, or backslash (other than
2981 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2982 null, do not copy; instead, return the length of what the result
2985 yytnamerr (char *yyres, const char *yystr)
2990 char const *yyp = yystr;
2997 goto do_not_strip_quotes;
3001 goto do_not_strip_quotes;
3014 do_not_strip_quotes: ;
3018 return yystrlen (yystr);
3020 return yystpcpy (yyres, yystr) - yyres;
3024 /* Copy into YYRESULT an error message about the unexpected token
3025 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3026 including the terminating null byte. If YYRESULT is null, do not
3027 copy anything; just return the number of bytes that would be
3028 copied. As a special case, return 0 if an ordinary "syntax error"
3029 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3030 size calculation. */
3032 yysyntax_error (char *yyresult, int yystate, int yychar)
3034 int yyn = yypact[yystate];
3036 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3040 int yytype = YYTRANSLATE (yychar);
3041 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3042 YYSIZE_T yysize = yysize0;
3044 int yysize_overflow = 0;
3045 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3046 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3050 /* This is so xgettext sees the translatable formats that are
3051 constructed on the fly. */
3052 YY_("syntax error, unexpected %s");
3053 YY_("syntax error, unexpected %s, expecting %s");
3054 YY_("syntax error, unexpected %s, expecting %s or %s");
3055 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3056 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3060 static char const yyunexpected[] = "syntax error, unexpected %s";
3061 static char const yyexpecting[] = ", expecting %s";
3062 static char const yyor[] = " or %s";
3063 char yyformat[sizeof yyunexpected
3064 + sizeof yyexpecting - 1
3065 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3066 * (sizeof yyor - 1))];
3067 char const *yyprefix = yyexpecting;
3069 /* Start YYX at -YYN if negative to avoid negative indexes in
3071 int yyxbegin = yyn < 0 ? -yyn : 0;
3073 /* Stay within bounds of both yycheck and yytname. */
3074 int yychecklim = YYLAST - yyn + 1;
3075 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3078 yyarg[0] = yytname[yytype];
3079 yyfmt = yystpcpy (yyformat, yyunexpected);
3081 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3082 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3084 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3088 yyformat[sizeof yyunexpected - 1] = '\0';
3091 yyarg[yycount++] = yytname[yyx];
3092 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3093 yysize_overflow |= (yysize1 < yysize);
3095 yyfmt = yystpcpy (yyfmt, yyprefix);
3099 yyf = YY_(yyformat);
3100 yysize1 = yysize + yystrlen (yyf);
3101 yysize_overflow |= (yysize1 < yysize);
3104 if (yysize_overflow)
3105 return YYSIZE_MAXIMUM;
3109 /* Avoid sprintf, as that infringes on the user's name space.
3110 Don't have undefined behavior even if the translation
3111 produced a string with the wrong number of "%s"s. */
3112 char *yyp = yyresult;
3114 while ((*yyp = *yyf) != '\0')
3116 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3118 yyp += yytnamerr (yyp, yyarg[yyi++]);
3131 #endif /* YYERROR_VERBOSE */
3134 /*-----------------------------------------------.
3135 | Release the memory associated to this symbol. |
3136 `-----------------------------------------------*/
3139 #if (defined __STDC__ || defined __C99__FUNC__ \
3140 || defined __cplusplus || defined _MSC_VER)
3142 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3145 yydestruct (yymsg, yytype, yyvaluep)
3155 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3166 /* Prevent warnings from -Wmissing-prototypes. */
3168 #ifdef YYPARSE_PARAM
3169 #if defined __STDC__ || defined __cplusplus
3170 int yyparse (void *YYPARSE_PARAM);
3174 #else /* ! YYPARSE_PARAM */
3175 #if defined __STDC__ || defined __cplusplus
3180 #endif /* ! YYPARSE_PARAM */
3184 /* The look-ahead symbol. */
3187 /* The semantic value of the look-ahead symbol. */
3190 /* Number of syntax errors so far. */
3199 #ifdef YYPARSE_PARAM
3200 #if (defined __STDC__ || defined __C99__FUNC__ \
3201 || defined __cplusplus || defined _MSC_VER)
3203 yyparse (void *YYPARSE_PARAM)
3206 yyparse (YYPARSE_PARAM)
3207 void *YYPARSE_PARAM;
3209 #else /* ! YYPARSE_PARAM */
3210 #if (defined __STDC__ || defined __C99__FUNC__ \
3211 || defined __cplusplus || defined _MSC_VER)
3225 /* Number of tokens to shift before error messages enabled. */
3227 /* Look-ahead token as an internal (translated) token number. */
3230 /* Buffer for error messages, and its allocated size. */
3232 char *yymsg = yymsgbuf;
3233 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3236 /* Three stacks and their tools:
3237 `yyss': related to states,
3238 `yyvs': related to semantic values,
3239 `yyls': related to locations.
3241 Refer to the stacks thru separate pointers, to allow yyoverflow
3242 to reallocate them elsewhere. */
3244 /* The state stack. */
3245 yytype_int16 yyssa[YYINITDEPTH];
3246 yytype_int16 *yyss = yyssa;
3247 yytype_int16 *yyssp;
3249 /* The semantic value stack. */
3250 YYSTYPE yyvsa[YYINITDEPTH];
3251 YYSTYPE *yyvs = yyvsa;
3256 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3258 YYSIZE_T yystacksize = YYINITDEPTH;
3260 /* The variables used to return semantic value and location from the
3265 /* The number of symbols on the RHS of the reduced rule.
3266 Keep to zero when no symbol should be popped. */
3269 YYDPRINTF ((stderr, "Starting parse\n"));
3274 yychar = YYEMPTY; /* Cause a token to be read. */
3276 /* Initialize stack pointers.
3277 Waste one element of value and location stack
3278 so that they stay on the same level as the state stack.
3279 The wasted elements are never initialized. */
3286 /*------------------------------------------------------------.
3287 | yynewstate -- Push a new state, which is found in yystate. |
3288 `------------------------------------------------------------*/
3290 /* In all cases, when you get here, the value and location stacks
3291 have just been pushed. So pushing a state here evens the stacks. */
3297 if (yyss + yystacksize - 1 <= yyssp)
3299 /* Get the current used size of the three stacks, in elements. */
3300 YYSIZE_T yysize = yyssp - yyss + 1;
3304 /* Give user a chance to reallocate the stack. Use copies of
3305 these so that the &'s don't force the real ones into
3307 YYSTYPE *yyvs1 = yyvs;
3308 yytype_int16 *yyss1 = yyss;
3311 /* Each stack pointer address is followed by the size of the
3312 data in use in that stack, in bytes. This used to be a
3313 conditional around just the two extra args, but that might
3314 be undefined if yyoverflow is a macro. */
3315 yyoverflow (YY_("memory exhausted"),
3316 &yyss1, yysize * sizeof (*yyssp),
3317 &yyvs1, yysize * sizeof (*yyvsp),
3324 #else /* no yyoverflow */
3325 # ifndef YYSTACK_RELOCATE
3326 goto yyexhaustedlab;
3328 /* Extend the stack our own way. */
3329 if (YYMAXDEPTH <= yystacksize)
3330 goto yyexhaustedlab;
3332 if (YYMAXDEPTH < yystacksize)
3333 yystacksize = YYMAXDEPTH;
3336 yytype_int16 *yyss1 = yyss;
3337 union yyalloc *yyptr =
3338 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3340 goto yyexhaustedlab;
3341 YYSTACK_RELOCATE (yyss);
3342 YYSTACK_RELOCATE (yyvs);
3344 # undef YYSTACK_RELOCATE
3346 YYSTACK_FREE (yyss1);
3349 #endif /* no yyoverflow */
3351 yyssp = yyss + yysize - 1;
3352 yyvsp = yyvs + yysize - 1;
3355 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3356 (unsigned long int) yystacksize));
3358 if (yyss + yystacksize - 1 <= yyssp)
3362 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3371 /* Do appropriate processing given the current state. Read a
3372 look-ahead token if we need one and don't already have one. */
3374 /* First try to decide what to do without reference to look-ahead token. */
3375 yyn = yypact[yystate];
3376 if (yyn == YYPACT_NINF)
3379 /* Not known => get a look-ahead token if don't already have one. */
3381 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3382 if (yychar == YYEMPTY)
3384 YYDPRINTF ((stderr, "Reading a token: "));
3388 if (yychar <= YYEOF)
3390 yychar = yytoken = YYEOF;
3391 YYDPRINTF ((stderr, "Now at end of input.\n"));
3395 yytoken = YYTRANSLATE (yychar);
3396 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3399 /* If the proper action on seeing token YYTOKEN is to reduce or to
3400 detect an error, take that action. */
3402 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3407 if (yyn == 0 || yyn == YYTABLE_NINF)
3416 /* Count tokens shifted since error; after three, turn off error
3421 /* Shift the look-ahead token. */
3422 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3424 /* Discard the shifted token unless it is eof. */
3425 if (yychar != YYEOF)
3434 /*-----------------------------------------------------------.
3435 | yydefault -- do the default action for the current state. |
3436 `-----------------------------------------------------------*/
3438 yyn = yydefact[yystate];
3444 /*-----------------------------.
3445 | yyreduce -- Do a reduction. |
3446 `-----------------------------*/
3448 /* yyn is the number of a rule to reduce with. */
3451 /* If YYLEN is nonzero, implement the default value of the action:
3454 Otherwise, the following line sets YYVAL to garbage.
3455 This behavior is undocumented and Bison
3456 users should not rely upon it. Assigning to YYVAL
3457 unconditionally makes the parser a bit smaller, and it avoids a
3458 GCC warning that YYVAL may be used uninitialized. */
3459 yyval = yyvsp[1-yylen];
3462 YY_REDUCE_PRINT (yyn);
3466 #line 1118 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3467 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3471 #line 1118 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3472 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3476 #line 1119 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3477 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3481 #line 1119 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3482 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3486 #line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3487 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3491 #line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3492 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3496 #line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3497 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3501 #line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3502 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3506 #line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3507 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3511 #line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3512 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3516 #line 1126 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3517 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3521 #line 1126 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3522 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3526 #line 1127 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3527 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3531 #line 1127 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3532 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3536 #line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3537 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3541 #line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3542 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3546 #line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3547 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3551 #line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3552 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3556 #line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3557 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3561 #line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3562 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3566 #line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3567 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3571 #line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3572 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3576 #line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3577 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3581 #line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3582 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3586 #line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3587 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3591 #line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3592 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3596 #line 1143 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3597 { (yyval.StrVal) = 0; ;}
3601 #line 1145 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3602 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3606 #line 1146 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3607 { (yyval.UIntVal)=0; ;}
3611 #line 1150 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3613 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3619 #line 1154 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3627 #line 1162 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3635 #line 1167 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3637 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3643 #line 1173 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3644 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3648 #line 1174 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3649 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3653 #line 1175 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3654 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3658 #line 1176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3659 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3663 #line 1177 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3664 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3668 #line 1181 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3669 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3673 #line 1182 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3674 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3678 #line 1183 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3679 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3683 #line 1187 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3684 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3688 #line 1188 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3689 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3693 #line 1189 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3694 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3698 #line 1190 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3699 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3703 #line 1194 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3704 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3708 #line 1195 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3709 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3713 #line 1196 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3714 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3718 #line 1200 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3719 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3723 #line 1201 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3724 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3728 #line 1202 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3729 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3733 #line 1203 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3734 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3738 #line 1204 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3739 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3743 #line 1208 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3744 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3748 #line 1209 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3749 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3753 #line 1210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3754 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3758 #line 1213 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3759 { (yyval.UIntVal) = CallingConv::C; ;}
3763 #line 1214 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3764 { (yyval.UIntVal) = CallingConv::C; ;}
3768 #line 1215 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3769 { (yyval.UIntVal) = CallingConv::Fast; ;}
3773 #line 1216 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3774 { (yyval.UIntVal) = CallingConv::Cold; ;}
3778 #line 1217 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3779 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3783 #line 1218 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3784 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3788 #line 1219 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3790 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3791 GEN_ERROR("Calling conv too large");
3792 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3798 #line 1226 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3799 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3803 #line 1227 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3804 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3808 #line 1228 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3809 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3813 #line 1229 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3814 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3818 #line 1230 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3819 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3823 #line 1231 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3824 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3828 #line 1232 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3829 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3833 #line 1233 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3834 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3838 #line 1234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3839 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3843 #line 1237 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3844 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3848 #line 1238 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3850 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3855 #line 1243 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3856 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3860 #line 1244 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3861 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3865 #line 1245 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3866 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3870 #line 1246 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3871 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3875 #line 1247 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3876 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3880 #line 1248 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3881 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3885 #line 1251 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3886 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3890 #line 1252 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3892 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3897 #line 1257 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3898 { (yyval.StrVal) = 0; ;}
3902 #line 1258 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3904 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3909 #line 1265 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3910 { (yyval.UIntVal) = 0; ;}
3914 #line 1266 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3916 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3917 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3918 GEN_ERROR("Alignment must be a power of two");
3924 #line 1272 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3925 { (yyval.UIntVal) = 0; ;}
3929 #line 1273 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3931 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3932 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3933 GEN_ERROR("Alignment must be a power of two");
3939 #line 1282 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3941 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3942 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3943 GEN_ERROR("Invalid character in section name");
3944 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3950 #line 1290 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3951 { (yyval.StrVal) = 0; ;}
3955 #line 1291 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3956 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3960 #line 1296 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3965 #line 1297 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3970 #line 1298 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3972 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3973 delete (yyvsp[(1) - (1)].StrVal);
3979 #line 1303 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3981 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3982 GEN_ERROR("Alignment must be a power of two");
3983 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3989 #line 1319 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3991 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3997 #line 1323 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3999 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4005 #line 1327 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4007 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4008 GEN_ERROR("Cannot form a pointer to a basic block");
4009 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4010 delete (yyvsp[(1) - (3)].TypeVal);
4016 #line 1334 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4017 { // Named types are also simple types...
4018 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4020 (yyval.TypeVal) = new PATypeHolder(tmp);
4025 #line 1339 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4026 { // Type UpReference
4027 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4028 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4029 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4030 (yyval.TypeVal) = new PATypeHolder(OT);
4031 UR_OUT("New Upreference!\n");
4037 #line 1347 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4039 // Allow but ignore attributes on function types; this permits auto-upgrade.
4040 // FIXME: remove in LLVM 3.0.
4041 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
4042 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4043 isa<OpaqueType>(RetTy)))
4044 GEN_ERROR("LLVM Functions cannot return aggregates");
4046 std::vector<const Type*> Params;
4047 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4048 for (; I != E; ++I ) {
4049 const Type *Ty = I->Ty->get();
4050 Params.push_back(Ty);
4053 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4054 if (isVarArg) Params.pop_back();
4056 for (unsigned i = 0; i != Params.size(); ++i)
4057 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4058 GEN_ERROR("Function arguments must be value types!");
4062 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4063 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4064 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4065 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4071 #line 1377 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4073 // Allow but ignore attributes on function types; this permits auto-upgrade.
4074 // FIXME: remove in LLVM 3.0.
4075 std::vector<const Type*> Params;
4076 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4077 for ( ; I != E; ++I ) {
4078 const Type* Ty = I->Ty->get();
4079 Params.push_back(Ty);
4082 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4083 if (isVarArg) Params.pop_back();
4085 for (unsigned i = 0; i != Params.size(); ++i)
4086 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4087 GEN_ERROR("Function arguments must be value types!");
4091 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4092 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4093 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4099 #line 1402 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4100 { // Sized array type?
4101 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4102 delete (yyvsp[(4) - (5)].TypeVal);
4108 #line 1407 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4110 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4111 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4112 GEN_ERROR("Unsigned result not equal to signed result");
4113 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4114 GEN_ERROR("Element type of a VectorType must be primitive");
4115 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4116 delete (yyvsp[(4) - (5)].TypeVal);
4122 #line 1417 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4123 { // Structure type?
4124 std::vector<const Type*> Elements;
4125 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4126 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4127 Elements.push_back(*I);
4129 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4130 delete (yyvsp[(2) - (3)].TypeList);
4136 #line 1427 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4137 { // Empty structure type?
4138 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4144 #line 1431 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4146 std::vector<const Type*> Elements;
4147 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4148 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4149 Elements.push_back(*I);
4151 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4152 delete (yyvsp[(3) - (5)].TypeList);
4158 #line 1441 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4159 { // Empty structure type?
4160 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4166 #line 1448 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4168 // Allow but ignore attributes on function types; this permits auto-upgrade.
4169 // FIXME: remove in LLVM 3.0.
4170 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4171 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4176 #line 1457 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4178 if (!UpRefs.empty())
4179 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4180 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
4181 GEN_ERROR("LLVM functions cannot return aggregate types");
4182 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4187 #line 1464 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4189 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4194 #line 1469 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4196 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4197 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4203 #line 1474 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4205 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4211 #line 1482 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4213 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4214 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4215 TWA.Ty = new PATypeHolder(Type::VoidTy);
4216 (yyval.TypeWithAttrsList)->push_back(TWA);
4222 #line 1489 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4224 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4225 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4226 TWA.Ty = new PATypeHolder(Type::VoidTy);
4227 (yyval.TypeWithAttrsList)->push_back(TWA);
4233 #line 1496 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4235 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4241 #line 1504 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4243 (yyval.TypeList) = new std::list<PATypeHolder>();
4244 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4245 delete (yyvsp[(1) - (1)].TypeVal);
4251 #line 1510 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4253 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4254 delete (yyvsp[(3) - (3)].TypeVal);
4260 #line 1522 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4261 { // Nonempty unsized arr
4262 if (!UpRefs.empty())
4263 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4264 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4266 GEN_ERROR("Cannot make array constant with type: '" +
4267 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4268 const Type *ETy = ATy->getElementType();
4269 int NumElements = ATy->getNumElements();
4271 // Verify that we have the correct size...
4272 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4273 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4274 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4275 itostr(NumElements) + "");
4277 // Verify all elements are correct type!
4278 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4279 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4280 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4281 ETy->getDescription() +"' as required!\nIt is of type '"+
4282 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4285 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4286 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4292 #line 1550 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4294 if (!UpRefs.empty())
4295 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4296 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4298 GEN_ERROR("Cannot make array constant with type: '" +
4299 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4301 int NumElements = ATy->getNumElements();
4302 if (NumElements != -1 && NumElements != 0)
4303 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4304 " arguments, but has size of " + itostr(NumElements) +"");
4305 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4306 delete (yyvsp[(1) - (3)].TypeVal);
4312 #line 1566 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4314 if (!UpRefs.empty())
4315 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4316 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4318 GEN_ERROR("Cannot make array constant with type: '" +
4319 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4321 int NumElements = ATy->getNumElements();
4322 const Type *ETy = ATy->getElementType();
4323 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4324 GEN_ERROR("Can't build string constant of size " +
4325 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4326 " when array has size " + itostr(NumElements) + "");
4327 std::vector<Constant*> Vals;
4328 if (ETy == Type::Int8Ty) {
4329 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4330 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4332 delete (yyvsp[(3) - (3)].StrVal);
4333 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4335 delete (yyvsp[(3) - (3)].StrVal);
4336 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4337 delete (yyvsp[(1) - (3)].TypeVal);
4343 #line 1593 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4344 { // Nonempty unsized arr
4345 if (!UpRefs.empty())
4346 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4347 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4349 GEN_ERROR("Cannot make packed constant with type: '" +
4350 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4351 const Type *ETy = PTy->getElementType();
4352 int NumElements = PTy->getNumElements();
4354 // Verify that we have the correct size...
4355 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4356 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4357 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4358 itostr(NumElements) + "");
4360 // Verify all elements are correct type!
4361 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4362 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4363 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4364 ETy->getDescription() +"' as required!\nIt is of type '"+
4365 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4368 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4369 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4375 #line 1621 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4377 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4379 GEN_ERROR("Cannot make struct constant with type: '" +
4380 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4382 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4383 GEN_ERROR("Illegal number of initializers for structure type");
4385 // Check to ensure that constants are compatible with the type initializer!
4386 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4387 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4388 GEN_ERROR("Expected type '" +
4389 STy->getElementType(i)->getDescription() +
4390 "' for element #" + utostr(i) +
4391 " of structure initializer");
4393 // Check to ensure that Type is not packed
4394 if (STy->isPacked())
4395 GEN_ERROR("Unpacked Initializer to vector type '" +
4396 STy->getDescription() + "'");
4398 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4399 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4405 #line 1647 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4407 if (!UpRefs.empty())
4408 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4409 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4411 GEN_ERROR("Cannot make struct constant with type: '" +
4412 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4414 if (STy->getNumContainedTypes() != 0)
4415 GEN_ERROR("Illegal number of initializers for structure type");
4417 // Check to ensure that Type is not packed
4418 if (STy->isPacked())
4419 GEN_ERROR("Unpacked Initializer to vector type '" +
4420 STy->getDescription() + "'");
4422 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4423 delete (yyvsp[(1) - (3)].TypeVal);
4429 #line 1667 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4431 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4433 GEN_ERROR("Cannot make struct constant with type: '" +
4434 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4436 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4437 GEN_ERROR("Illegal number of initializers for structure type");
4439 // Check to ensure that constants are compatible with the type initializer!
4440 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4441 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4442 GEN_ERROR("Expected type '" +
4443 STy->getElementType(i)->getDescription() +
4444 "' for element #" + utostr(i) +
4445 " of structure initializer");
4447 // Check to ensure that Type is packed
4448 if (!STy->isPacked())
4449 GEN_ERROR("Vector initializer to non-vector type '" +
4450 STy->getDescription() + "'");
4452 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4453 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4459 #line 1693 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4461 if (!UpRefs.empty())
4462 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4463 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4465 GEN_ERROR("Cannot make struct constant with type: '" +
4466 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4468 if (STy->getNumContainedTypes() != 0)
4469 GEN_ERROR("Illegal number of initializers for structure type");
4471 // Check to ensure that Type is packed
4472 if (!STy->isPacked())
4473 GEN_ERROR("Vector initializer to non-vector type '" +
4474 STy->getDescription() + "'");
4476 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4477 delete (yyvsp[(1) - (5)].TypeVal);
4483 #line 1713 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4485 if (!UpRefs.empty())
4486 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4487 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4489 GEN_ERROR("Cannot make null pointer constant with type: '" +
4490 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4492 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4493 delete (yyvsp[(1) - (2)].TypeVal);
4499 #line 1725 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4501 if (!UpRefs.empty())
4502 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4503 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4504 delete (yyvsp[(1) - (2)].TypeVal);
4510 #line 1732 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4512 if (!UpRefs.empty())
4513 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4514 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4516 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4518 // ConstExprs can exist in the body of a function, thus creating
4519 // GlobalValues whenever they refer to a variable. Because we are in
4520 // the context of a function, getExistingVal will search the functions
4521 // symbol table instead of the module symbol table for the global symbol,
4522 // which throws things all off. To get around this, we just tell
4523 // getExistingVal that we are at global scope here.
4525 Function *SavedCurFn = CurFun.CurrentFunction;
4526 CurFun.CurrentFunction = 0;
4528 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4531 CurFun.CurrentFunction = SavedCurFn;
4533 // If this is an initializer for a constant pointer, which is referencing a
4534 // (currently) undefined variable, create a stub now that shall be replaced
4535 // in the future with the right type of variable.
4538 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4539 const PointerType *PT = cast<PointerType>(Ty);
4541 // First check to see if the forward references value is already created!
4542 PerModuleInfo::GlobalRefsType::iterator I =
4543 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4545 if (I != CurModule.GlobalRefs.end()) {
4546 V = I->second; // Placeholder already exists, use it...
4547 (yyvsp[(2) - (2)].ValIDVal).destroy();
4550 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4551 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4552 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4553 GEN_ERROR("Invalid reference to global");
4555 // Create the forward referenced global.
4557 if (const FunctionType *FTy =
4558 dyn_cast<FunctionType>(PT->getElementType())) {
4559 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4560 CurModule.CurrentModule);
4562 GV = new GlobalVariable(PT->getElementType(), false,
4563 GlobalValue::ExternalWeakLinkage, 0,
4564 Name, CurModule.CurrentModule);
4567 // Keep track of the fact that we have a forward ref to recycle it
4568 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4573 (yyval.ConstVal) = cast<GlobalValue>(V);
4574 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4580 #line 1798 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4582 if (!UpRefs.empty())
4583 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4584 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4585 GEN_ERROR("Mismatched types for constant expression: " +
4586 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4587 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4588 delete (yyvsp[(1) - (2)].TypeVal);
4594 #line 1808 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4596 if (!UpRefs.empty())
4597 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4598 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4599 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4600 GEN_ERROR("Cannot create a null initialized value of this type");
4601 (yyval.ConstVal) = Constant::getNullValue(Ty);
4602 delete (yyvsp[(1) - (2)].TypeVal);
4608 #line 1818 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4609 { // integral constants
4610 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4611 GEN_ERROR("Constant value doesn't fit in type");
4612 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4618 #line 1824 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4619 { // arbitrary precision integer constants
4620 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4621 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4622 GEN_ERROR("Constant value does not fit in type");
4624 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4625 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4626 delete (yyvsp[(2) - (2)].APIntVal);
4632 #line 1834 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4633 { // integral constants
4634 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4635 GEN_ERROR("Constant value doesn't fit in type");
4636 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4642 #line 1840 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4643 { // arbitrary precision integer constants
4644 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4645 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4646 GEN_ERROR("Constant value does not fit in type");
4648 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4649 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4650 delete (yyvsp[(2) - (2)].APIntVal);
4656 #line 1850 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4657 { // Boolean constants
4658 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4659 (yyval.ConstVal) = ConstantInt::getTrue();
4665 #line 1855 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4666 { // Boolean constants
4667 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4668 (yyval.ConstVal) = ConstantInt::getFalse();
4674 #line 1860 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4675 { // Floating point constants
4676 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4677 GEN_ERROR("Floating point constant invalid for type");
4678 // Lexer has no type info, so builds all float and double FP constants
4679 // as double. Fix this here. Long double is done right.
4680 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4681 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4682 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4683 delete (yyvsp[(2) - (2)].FPVal);
4689 #line 1873 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4691 if (!UpRefs.empty())
4692 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4693 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4694 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4695 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4696 GEN_ERROR("invalid cast opcode for cast from '" +
4697 Val->getType()->getDescription() + "' to '" +
4698 DestTy->getDescription() + "'");
4699 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4700 delete (yyvsp[(5) - (6)].TypeVal);
4705 #line 1885 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4707 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4708 GEN_ERROR("GetElementPtr requires a pointer operand");
4711 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4714 GEN_ERROR("Index list invalid for constant getelementptr");
4716 SmallVector<Constant*, 8> IdxVec;
4717 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4718 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4719 IdxVec.push_back(C);
4721 GEN_ERROR("Indices to constant getelementptr must be constants");
4723 delete (yyvsp[(4) - (5)].ValueList);
4725 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4731 #line 1907 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4733 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4734 GEN_ERROR("Select condition must be of boolean type");
4735 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4736 GEN_ERROR("Select operand types must match");
4737 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4743 #line 1915 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4745 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4746 GEN_ERROR("Binary operator types must match");
4748 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4753 #line 1921 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4755 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4756 GEN_ERROR("Logical operator types must match");
4757 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4758 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4759 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4760 GEN_ERROR("Logical operator requires integral operands");
4762 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4768 #line 1932 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4770 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4771 GEN_ERROR("icmp operand types must match");
4772 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4777 #line 1937 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4779 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4780 GEN_ERROR("fcmp operand types must match");
4781 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4786 #line 1942 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4788 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4789 GEN_ERROR("Invalid extractelement operands");
4790 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4796 #line 1948 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4798 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4799 GEN_ERROR("Invalid insertelement operands");
4800 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4806 #line 1954 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4808 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4809 GEN_ERROR("Invalid shufflevector operands");
4810 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4816 #line 1963 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4818 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4824 #line 1967 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4826 (yyval.ConstVector) = new std::vector<Constant*>();
4827 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4833 #line 1975 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4834 { (yyval.BoolVal) = false; ;}
4838 #line 1975 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4839 { (yyval.BoolVal) = true; ;}
4843 #line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4844 { (yyval.BoolVal) = true; ;}
4848 #line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4849 { (yyval.BoolVal) = false; ;}
4853 #line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4855 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4856 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4858 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4860 GEN_ERROR("Aliases can be created only to global values");
4862 (yyval.ConstVal) = Aliasee;
4864 delete (yyvsp[(1) - (2)].TypeVal);
4869 #line 1993 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4871 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4872 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4873 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4874 GEN_ERROR("invalid cast opcode for cast from '" +
4875 Val->getType()->getDescription() + "' to '" +
4876 DestTy->getDescription() + "'");
4878 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4880 delete (yyvsp[(5) - (6)].TypeVal);
4885 #line 2014 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4887 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4888 CurModule.ModuleDone();
4894 #line 2019 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4896 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4897 CurModule.ModuleDone();
4903 #line 2032 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4904 { CurFun.isDeclare = false; ;}
4908 #line 2032 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4910 CurFun.FunctionDone();
4916 #line 2036 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4917 { CurFun.isDeclare = true; ;}
4921 #line 2036 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4928 #line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4935 #line 2042 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4937 if (!UpRefs.empty())
4938 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4939 // Eagerly resolve types. This is not an optimization, this is a
4940 // requirement that is due to the fact that we could have this:
4942 // %list = type { %list * }
4943 // %list = type { %list * } ; repeated type decl
4945 // If types are not resolved eagerly, then the two types will not be
4946 // determined to be the same type!
4948 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4950 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4952 // If this is a named type that is not a redefinition, add it to the slot
4954 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4957 delete (yyvsp[(3) - (3)].TypeVal);
4963 #line 2066 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4965 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4967 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4969 // If this is a named type that is not a redefinition, add it to the slot
4971 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4978 #line 2078 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4980 /* "Externally Visible" Linkage */
4981 if ((yyvsp[(5) - (6)].ConstVal) == 0)
4982 GEN_ERROR("Global value initializer is not a constant");
4983 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
4984 (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));
4990 #line 2085 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4997 #line 2089 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4999 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5000 GEN_ERROR("Global value initializer is not a constant");
5001 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));
5007 #line 2094 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5014 #line 2098 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5016 if (!UpRefs.empty())
5017 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5018 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));
5020 delete (yyvsp[(6) - (7)].TypeVal);
5025 #line 2104 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5033 #line 2108 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5036 if ((yyvsp[(1) - (5)].StrVal)) {
5037 Name = *(yyvsp[(1) - (5)].StrVal);
5038 delete (yyvsp[(1) - (5)].StrVal);
5041 GEN_ERROR("Alias name cannot be empty");
5043 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5045 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5047 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5048 CurModule.CurrentModule);
5049 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5050 InsertValue(GA, CurModule.Values);
5053 // If there was a forward reference of this alias, resolve it now.
5057 ID = ValID::createGlobalName(Name);
5059 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5061 if (GlobalValue *FWGV =
5062 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5063 // Replace uses of the fwdref with the actual alias.
5064 FWGV->replaceAllUsesWith(GA);
5065 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5066 GV->eraseFromParent();
5068 cast<Function>(FWGV)->eraseFromParent();
5077 #line 2148 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5084 #line 2151 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5091 #line 2157 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5093 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5094 if (AsmSoFar.empty())
5095 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5097 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5098 delete (yyvsp[(1) - (1)].StrVal);
5104 #line 2167 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5106 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5107 delete (yyvsp[(3) - (3)].StrVal);
5112 #line 2171 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5114 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5115 delete (yyvsp[(3) - (3)].StrVal);
5120 #line 2178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5122 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5123 delete (yyvsp[(3) - (3)].StrVal);
5129 #line 2183 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5131 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5132 delete (yyvsp[(1) - (1)].StrVal);
5138 #line 2188 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5145 #line 2197 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5147 if (!UpRefs.empty())
5148 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5149 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5150 GEN_ERROR("void typed arguments are invalid");
5151 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5152 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5153 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5159 #line 2207 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5161 if (!UpRefs.empty())
5162 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5163 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5164 GEN_ERROR("void typed arguments are invalid");
5165 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5166 (yyval.ArgList) = new ArgListType;
5167 (yyval.ArgList)->push_back(E);
5173 #line 2218 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5175 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5181 #line 2222 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5183 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5184 struct ArgListEntry E;
5185 E.Ty = new PATypeHolder(Type::VoidTy);
5187 E.Attrs = ParamAttr::None;
5188 (yyval.ArgList)->push_back(E);
5194 #line 2231 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5196 (yyval.ArgList) = new ArgListType;
5197 struct ArgListEntry E;
5198 E.Ty = new PATypeHolder(Type::VoidTy);
5200 E.Attrs = ParamAttr::None;
5201 (yyval.ArgList)->push_back(E);
5207 #line 2240 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5209 (yyval.ArgList) = 0;
5215 #line 2246 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5217 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5218 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5220 // Check the function result for abstractness if this is a define. We should
5221 // have no abstract types at this point
5222 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5223 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5225 std::vector<const Type*> ParamTypeList;
5226 ParamAttrsVector Attrs;
5227 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
5228 ParamAttrsWithIndex PAWI;
5230 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
5231 Attrs.push_back(PAWI);
5233 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5235 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5236 const Type* Ty = I->Ty->get();
5237 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5238 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5239 ParamTypeList.push_back(Ty);
5240 if (Ty != Type::VoidTy)
5241 if (I->Attrs != ParamAttr::None) {
5242 ParamAttrsWithIndex PAWI;
5244 PAWI.attrs = I->Attrs;
5245 Attrs.push_back(PAWI);
5250 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5251 if (isVarArg) ParamTypeList.pop_back();
5253 const ParamAttrsList *PAL = 0;
5255 PAL = ParamAttrsList::get(Attrs);
5257 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5258 const PointerType *PFT = PointerType::getUnqual(FT);
5259 delete (yyvsp[(2) - (10)].TypeVal);
5262 if (!FunctionName.empty()) {
5263 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5265 ID = ValID::createGlobalID(CurModule.Values.size());
5269 // See if this function was forward referenced. If so, recycle the object.
5270 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5271 // Move the function to the end of the list, from whereever it was
5272 // previously inserted.
5273 Fn = cast<Function>(FWRef);
5274 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
5275 CurModule.CurrentModule->getFunctionList().remove(Fn);
5276 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5277 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5278 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5279 if (Fn->getFunctionType() != FT ) {
5280 // The existing function doesn't have the same type. This is an overload
5282 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5283 } else if (Fn->getParamAttrs() != PAL) {
5284 // The existing function doesn't have the same parameter attributes.
5285 // This is an overload error.
5286 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5287 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5288 // Neither the existing or the current function is a declaration and they
5289 // have the same name and same type. Clearly this is a redefinition.
5290 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5291 } else if (Fn->isDeclaration()) {
5292 // Make sure to strip off any argument names so we can't get conflicts.
5293 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5297 } else { // Not already defined?
5298 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5299 CurModule.CurrentModule);
5300 InsertValue(Fn, CurModule.Values);
5303 CurFun.FunctionStart(Fn);
5305 if (CurFun.isDeclare) {
5306 // If we have declaration, always overwrite linkage. This will allow us to
5307 // correctly handle cases, when pointer to function is passed as argument to
5308 // another function.
5309 Fn->setLinkage(CurFun.Linkage);
5310 Fn->setVisibility(CurFun.Visibility);
5312 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5313 Fn->setParamAttrs(PAL);
5314 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5315 if ((yyvsp[(8) - (10)].StrVal)) {
5316 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5317 delete (yyvsp[(8) - (10)].StrVal);
5319 if ((yyvsp[(10) - (10)].StrVal)) {
5320 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5321 delete (yyvsp[(10) - (10)].StrVal);
5324 // Add all of the arguments we parsed to the function...
5325 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5326 if (isVarArg) { // Nuke the last entry
5327 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5328 "Not a varargs marker!");
5329 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5330 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5332 Function::arg_iterator ArgIt = Fn->arg_begin();
5333 Function::arg_iterator ArgEnd = Fn->arg_end();
5335 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5336 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5337 delete I->Ty; // Delete the typeholder...
5338 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5344 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5351 #line 2381 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5353 (yyval.FunctionVal) = CurFun.CurrentFunction;
5355 // Make sure that we keep track of the linkage type even if there was a
5356 // previous "declare".
5357 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5358 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5363 #line 2392 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5365 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5371 #line 2397 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5373 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5374 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5375 (yyval.FunctionVal) = CurFun.CurrentFunction;
5376 CurFun.FunctionDone();
5382 #line 2409 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5384 (yyval.BoolVal) = false;
5390 #line 2413 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5392 (yyval.BoolVal) = true;
5398 #line 2418 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5399 { // A reference to a direct constant
5400 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5406 #line 2422 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5408 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5414 #line 2426 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5415 { // Perhaps it's an FP constant?
5416 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5422 #line 2430 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5424 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5430 #line 2434 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5432 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5438 #line 2438 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5440 (yyval.ValIDVal) = ValID::createNull();
5446 #line 2442 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5448 (yyval.ValIDVal) = ValID::createUndef();
5454 #line 2446 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5455 { // A vector zero constant.
5456 (yyval.ValIDVal) = ValID::createZeroInit();
5462 #line 2450 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5463 { // Nonempty unsized packed vector
5464 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5465 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5467 VectorType* pt = VectorType::get(ETy, NumElements);
5468 PATypeHolder* PTy = new PATypeHolder(
5476 // Verify all elements are correct type!
5477 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5478 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5479 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5480 ETy->getDescription() +"' as required!\nIt is of type '" +
5481 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5484 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5485 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5491 #line 2475 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5493 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5499 #line 2479 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5501 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5502 delete (yyvsp[(3) - (5)].StrVal);
5503 delete (yyvsp[(5) - (5)].StrVal);
5509 #line 2489 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5510 { // Is it an integer reference...?
5511 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5517 #line 2493 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5519 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5525 #line 2497 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5526 { // Is it a named reference...?
5527 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5528 delete (yyvsp[(1) - (1)].StrVal);
5534 #line 2502 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5535 { // Is it a named reference...?
5536 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5537 delete (yyvsp[(1) - (1)].StrVal);
5543 #line 2515 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5545 if (!UpRefs.empty())
5546 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5547 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5548 delete (yyvsp[(1) - (2)].TypeVal);
5554 #line 2524 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5556 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5562 #line 2528 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5563 { // Do not allow functions with 0 basic blocks
5564 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5570 #line 2537 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5572 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5574 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5575 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5576 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5582 #line 2546 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5584 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5585 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5586 if (CI2->getParent() == 0)
5587 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5588 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5589 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5595 #line 2555 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5596 { // Empty space between instruction lists
5597 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5603 #line 2559 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5604 { // Labelled (named) basic block
5605 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5606 delete (yyvsp[(1) - (1)].StrVal);
5613 #line 2566 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5614 { // Return with a result...
5615 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5621 #line 2570 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5622 { // Return with no result...
5623 (yyval.TermInstVal) = new ReturnInst();
5629 #line 2574 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5630 { // Unconditional Branch...
5631 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5633 (yyval.TermInstVal) = new BranchInst(tmpBB);
5638 #line 2579 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5640 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5641 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5643 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5645 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5647 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5652 #line 2589 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5654 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5656 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5658 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5659 (yyval.TermInstVal) = S;
5661 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5662 E = (yyvsp[(8) - (9)].JumpTable)->end();
5663 for (; I != E; ++I) {
5664 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5665 S->addCase(CI, I->second);
5667 GEN_ERROR("Switch case is constant, but not a simple integer");
5669 delete (yyvsp[(8) - (9)].JumpTable);
5675 #line 2608 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5677 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5679 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5681 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5682 (yyval.TermInstVal) = S;
5688 #line 2618 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5691 // Handle the short syntax
5692 const PointerType *PFTy = 0;
5693 const FunctionType *Ty = 0;
5694 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5695 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5696 // Pull out the types of all of the arguments...
5697 std::vector<const Type*> ParamTypes;
5698 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5699 for (; I != E; ++I) {
5700 const Type *Ty = I->Val->getType();
5701 if (Ty == Type::VoidTy)
5702 GEN_ERROR("Short call syntax cannot be used with varargs");
5703 ParamTypes.push_back(Ty);
5705 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5706 PFTy = PointerType::getUnqual(Ty);
5709 delete (yyvsp[(3) - (14)].TypeVal);
5711 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5713 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5715 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5718 ParamAttrsVector Attrs;
5719 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5720 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5721 Attrs.push_back(PAWI);
5724 // Check the arguments
5726 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5727 // Make sure no arguments is a good thing!
5728 if (Ty->getNumParams() != 0)
5729 GEN_ERROR("No arguments passed to a function that "
5730 "expects arguments");
5731 } else { // Has arguments?
5732 // Loop through FunctionType's arguments and ensure they are specified
5734 FunctionType::param_iterator I = Ty->param_begin();
5735 FunctionType::param_iterator E = Ty->param_end();
5736 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5739 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5740 if (ArgI->Val->getType() != *I)
5741 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5742 (*I)->getDescription() + "'");
5743 Args.push_back(ArgI->Val);
5744 if (ArgI->Attrs != ParamAttr::None) {
5745 ParamAttrsWithIndex PAWI;
5747 PAWI.attrs = ArgI->Attrs;
5748 Attrs.push_back(PAWI);
5752 if (Ty->isVarArg()) {
5754 for (; ArgI != ArgE; ++ArgI, ++index) {
5755 Args.push_back(ArgI->Val); // push the remaining varargs
5756 if (ArgI->Attrs != ParamAttr::None) {
5757 ParamAttrsWithIndex PAWI;
5759 PAWI.attrs = ArgI->Attrs;
5760 Attrs.push_back(PAWI);
5763 } else if (I != E || ArgI != ArgE)
5764 GEN_ERROR("Invalid number of parameters detected");
5767 const ParamAttrsList *PAL = 0;
5769 PAL = ParamAttrsList::get(Attrs);
5771 // Create the InvokeInst
5772 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5773 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5774 II->setParamAttrs(PAL);
5775 (yyval.TermInstVal) = II;
5776 delete (yyvsp[(6) - (14)].ParamList);
5782 #line 2708 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5784 (yyval.TermInstVal) = new UnwindInst();
5790 #line 2712 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5792 (yyval.TermInstVal) = new UnreachableInst();
5798 #line 2719 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5800 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5801 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5804 GEN_ERROR("May only switch on a constant pool value");
5806 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5808 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5813 #line 2730 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5815 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5816 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5820 GEN_ERROR("May only switch on a constant pool value");
5822 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5824 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5829 #line 2743 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5831 // Is this definition named?? if so, assign the name...
5832 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5834 InsertValue((yyvsp[(2) - (2)].InstVal));
5835 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5841 #line 2753 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5842 { // Used for PHI nodes
5843 if (!UpRefs.empty())
5844 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5845 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5846 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5848 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5850 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5851 delete (yyvsp[(1) - (6)].TypeVal);
5856 #line 2764 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5858 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5859 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5861 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5863 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5868 #line 2774 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5870 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5871 if (!UpRefs.empty())
5872 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5873 // Used for call and invoke instructions
5874 (yyval.ParamList) = new ParamList();
5875 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5876 (yyval.ParamList)->push_back(E);
5877 delete (yyvsp[(1) - (4)].TypeVal);
5883 #line 2785 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5885 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5886 // Labels are only valid in ASMs
5887 (yyval.ParamList) = new ParamList();
5888 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5889 (yyval.ParamList)->push_back(E);
5895 #line 2793 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5897 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5898 if (!UpRefs.empty())
5899 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5900 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5901 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5902 (yyval.ParamList)->push_back(E);
5903 delete (yyvsp[(3) - (6)].TypeVal);
5909 #line 2803 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5911 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5912 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5913 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5914 (yyval.ParamList)->push_back(E);
5920 #line 2810 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5921 { (yyval.ParamList) = new ParamList(); ;}
5925 #line 2813 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5926 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5930 #line 2814 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5932 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5933 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5939 #line 2821 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5941 (yyval.BoolVal) = true;
5947 #line 2825 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5949 (yyval.BoolVal) = false;
5955 #line 2830 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5957 if (!UpRefs.empty())
5958 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5959 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5960 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5962 "Arithmetic operator requires integer, FP, or packed operands");
5963 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5965 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5967 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5968 if ((yyval.InstVal) == 0)
5969 GEN_ERROR("binary operator returned null");
5970 delete (yyvsp[(2) - (5)].TypeVal);
5975 #line 2846 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5977 if (!UpRefs.empty())
5978 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5979 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5980 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5981 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5982 GEN_ERROR("Logical operator requires integral operands");
5984 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5986 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5988 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5989 if ((yyval.InstVal) == 0)
5990 GEN_ERROR("binary operator returned null");
5991 delete (yyvsp[(2) - (5)].TypeVal);
5996 #line 2863 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5998 if (!UpRefs.empty())
5999 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6000 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6001 GEN_ERROR("Vector types not supported by icmp instruction");
6002 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6004 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6006 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6007 if ((yyval.InstVal) == 0)
6008 GEN_ERROR("icmp operator returned null");
6009 delete (yyvsp[(3) - (6)].TypeVal);
6014 #line 2877 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6016 if (!UpRefs.empty())
6017 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6018 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6019 GEN_ERROR("Vector types not supported by fcmp instruction");
6020 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6022 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6024 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6025 if ((yyval.InstVal) == 0)
6026 GEN_ERROR("fcmp operator returned null");
6027 delete (yyvsp[(3) - (6)].TypeVal);
6032 #line 2891 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6034 if (!UpRefs.empty())
6035 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6036 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6037 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6038 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6039 GEN_ERROR("invalid cast opcode for cast from '" +
6040 Val->getType()->getDescription() + "' to '" +
6041 DestTy->getDescription() + "'");
6042 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6043 delete (yyvsp[(4) - (4)].TypeVal);
6048 #line 2903 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6050 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6051 GEN_ERROR("select condition must be boolean");
6052 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6053 GEN_ERROR("select value types should match");
6054 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6060 #line 2911 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6062 if (!UpRefs.empty())
6063 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6064 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6065 delete (yyvsp[(4) - (4)].TypeVal);
6071 #line 2918 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6073 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6074 GEN_ERROR("Invalid extractelement operands");
6075 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6081 #line 2924 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6083 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6084 GEN_ERROR("Invalid insertelement operands");
6085 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6091 #line 2930 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6093 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6094 GEN_ERROR("Invalid shufflevector operands");
6095 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6101 #line 2936 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6103 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6104 if (!Ty->isFirstClassType())
6105 GEN_ERROR("PHI node operands must be of first class type");
6106 (yyval.InstVal) = new PHINode(Ty);
6107 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6108 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6109 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6110 GEN_ERROR("All elements of a PHI node must be of the same type");
6111 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6112 (yyvsp[(2) - (2)].PHIList)->pop_front();
6114 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6120 #line 2952 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6123 // Handle the short syntax
6124 const PointerType *PFTy = 0;
6125 const FunctionType *Ty = 0;
6126 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6127 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6128 // Pull out the types of all of the arguments...
6129 std::vector<const Type*> ParamTypes;
6130 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6131 for (; I != E; ++I) {
6132 const Type *Ty = I->Val->getType();
6133 if (Ty == Type::VoidTy)
6134 GEN_ERROR("Short call syntax cannot be used with varargs");
6135 ParamTypes.push_back(Ty);
6137 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6138 PFTy = PointerType::getUnqual(Ty);
6141 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6144 // Check for call to invalid intrinsic to avoid crashing later.
6145 if (Function *theF = dyn_cast<Function>(V)) {
6146 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6147 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6148 !theF->getIntrinsicID(true))
6149 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6150 theF->getName() + "'");
6153 // Set up the ParamAttrs for the function
6154 ParamAttrsVector Attrs;
6155 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6156 ParamAttrsWithIndex PAWI;
6158 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6159 Attrs.push_back(PAWI);
6161 // Check the arguments
6163 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6164 // Make sure no arguments is a good thing!
6165 if (Ty->getNumParams() != 0)
6166 GEN_ERROR("No arguments passed to a function that "
6167 "expects arguments");
6168 } else { // Has arguments?
6169 // Loop through FunctionType's arguments and ensure they are specified
6170 // correctly. Also, gather any parameter attributes.
6171 FunctionType::param_iterator I = Ty->param_begin();
6172 FunctionType::param_iterator E = Ty->param_end();
6173 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6176 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6177 if (ArgI->Val->getType() != *I)
6178 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6179 (*I)->getDescription() + "'");
6180 Args.push_back(ArgI->Val);
6181 if (ArgI->Attrs != ParamAttr::None) {
6182 ParamAttrsWithIndex PAWI;
6184 PAWI.attrs = ArgI->Attrs;
6185 Attrs.push_back(PAWI);
6188 if (Ty->isVarArg()) {
6190 for (; ArgI != ArgE; ++ArgI, ++index) {
6191 Args.push_back(ArgI->Val); // push the remaining varargs
6192 if (ArgI->Attrs != ParamAttr::None) {
6193 ParamAttrsWithIndex PAWI;
6195 PAWI.attrs = ArgI->Attrs;
6196 Attrs.push_back(PAWI);
6199 } else if (I != E || ArgI != ArgE)
6200 GEN_ERROR("Invalid number of parameters detected");
6203 // Finish off the ParamAttrs and check them
6204 const ParamAttrsList *PAL = 0;
6206 PAL = ParamAttrsList::get(Attrs);
6208 // Create the call node
6209 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
6210 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6211 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6212 CI->setParamAttrs(PAL);
6213 (yyval.InstVal) = CI;
6214 delete (yyvsp[(6) - (8)].ParamList);
6215 delete (yyvsp[(3) - (8)].TypeVal);
6221 #line 3049 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6223 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6229 #line 3054 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6231 (yyval.BoolVal) = true;
6237 #line 3058 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6239 (yyval.BoolVal) = false;
6245 #line 3065 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6247 if (!UpRefs.empty())
6248 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6249 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6250 delete (yyvsp[(2) - (3)].TypeVal);
6256 #line 3072 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6258 if (!UpRefs.empty())
6259 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6260 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6262 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6263 delete (yyvsp[(2) - (6)].TypeVal);
6268 #line 3080 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6270 if (!UpRefs.empty())
6271 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6272 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6273 delete (yyvsp[(2) - (3)].TypeVal);
6279 #line 3087 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6281 if (!UpRefs.empty())
6282 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6283 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6285 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6286 delete (yyvsp[(2) - (6)].TypeVal);
6291 #line 3095 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6293 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6294 GEN_ERROR("Trying to free nonpointer type " +
6295 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6296 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6302 #line 3103 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6304 if (!UpRefs.empty())
6305 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6306 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6307 GEN_ERROR("Can't load from nonpointer type: " +
6308 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6309 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6310 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6311 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6312 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6314 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6315 delete (yyvsp[(3) - (5)].TypeVal);
6320 #line 3117 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6322 if (!UpRefs.empty())
6323 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6324 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6326 GEN_ERROR("Can't store to a nonpointer type: " +
6327 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6328 const Type *ElTy = PT->getElementType();
6329 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6330 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6331 "' into space of type '" + ElTy->getDescription() + "'");
6333 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6335 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6336 delete (yyvsp[(5) - (7)].TypeVal);
6341 #line 3134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6343 ValID TmpVID = ValID::createLocalName(*(yyvsp[(3) - (5)].StrVal));
6344 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), TmpVID);
6345 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].ConstVal)))
6346 GEN_ERROR("Invalid getresult operands");
6347 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].ConstVal));
6353 #line 3142 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6355 if (!UpRefs.empty())
6356 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6357 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6358 GEN_ERROR("getelementptr insn requires pointer operand");
6360 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6361 GEN_ERROR("Invalid getelementptr indices for type '" +
6362 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6363 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6365 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6366 delete (yyvsp[(2) - (4)].TypeVal);
6367 delete (yyvsp[(4) - (4)].ValueList);
6372 /* Line 1267 of yacc.c. */
6373 #line 6374 "llvmAsmParser.tab.c"
6376 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6380 YY_STACK_PRINT (yyss, yyssp);
6385 /* Now `shift' the result of the reduction. Determine what state
6386 that goes to, based on the state we popped back to and the rule
6387 number reduced by. */
6391 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6392 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6393 yystate = yytable[yystate];
6395 yystate = yydefgoto[yyn - YYNTOKENS];
6400 /*------------------------------------.
6401 | yyerrlab -- here on detecting error |
6402 `------------------------------------*/
6404 /* If not already recovering from an error, report this error. */
6408 #if ! YYERROR_VERBOSE
6409 yyerror (YY_("syntax error"));
6412 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6413 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6415 YYSIZE_T yyalloc = 2 * yysize;
6416 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6417 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6418 if (yymsg != yymsgbuf)
6419 YYSTACK_FREE (yymsg);
6420 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6422 yymsg_alloc = yyalloc;
6426 yymsg_alloc = sizeof yymsgbuf;
6430 if (0 < yysize && yysize <= yymsg_alloc)
6432 (void) yysyntax_error (yymsg, yystate, yychar);
6437 yyerror (YY_("syntax error"));
6439 goto yyexhaustedlab;
6447 if (yyerrstatus == 3)
6449 /* If just tried and failed to reuse look-ahead token after an
6450 error, discard it. */
6452 if (yychar <= YYEOF)
6454 /* Return failure if at end of input. */
6455 if (yychar == YYEOF)
6460 yydestruct ("Error: discarding",
6466 /* Else will try to reuse look-ahead token after shifting the error
6471 /*---------------------------------------------------.
6472 | yyerrorlab -- error raised explicitly by YYERROR. |
6473 `---------------------------------------------------*/
6476 /* Pacify compilers like GCC when the user code never invokes
6477 YYERROR and the label yyerrorlab therefore never appears in user
6479 if (/*CONSTCOND*/ 0)
6482 /* Do not reclaim the symbols of the rule which action triggered
6486 YY_STACK_PRINT (yyss, yyssp);
6491 /*-------------------------------------------------------------.
6492 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6493 `-------------------------------------------------------------*/
6495 yyerrstatus = 3; /* Each real token shifted decrements this. */
6499 yyn = yypact[yystate];
6500 if (yyn != YYPACT_NINF)
6503 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6511 /* Pop the current state because it cannot handle the error token. */
6516 yydestruct ("Error: popping",
6517 yystos[yystate], yyvsp);
6520 YY_STACK_PRINT (yyss, yyssp);
6529 /* Shift the error token. */
6530 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6536 /*-------------------------------------.
6537 | yyacceptlab -- YYACCEPT comes here. |
6538 `-------------------------------------*/
6543 /*-----------------------------------.
6544 | yyabortlab -- YYABORT comes here. |
6545 `-----------------------------------*/
6551 /*-------------------------------------------------.
6552 | yyexhaustedlab -- memory exhaustion comes here. |
6553 `-------------------------------------------------*/
6555 yyerror (YY_("memory exhausted"));
6561 if (yychar != YYEOF && yychar != YYEMPTY)
6562 yydestruct ("Cleanup: discarding lookahead",
6564 /* Do not reclaim the symbols of the rule which action triggered
6565 this YYABORT or YYACCEPT. */
6567 YY_STACK_PRINT (yyss, yyssp);
6568 while (yyssp != yyss)
6570 yydestruct ("Cleanup: popping",
6571 yystos[*yyssp], yyvsp);
6576 YYSTACK_FREE (yyss);
6579 if (yymsg != yymsgbuf)
6580 YYSTACK_FREE (yymsg);
6582 /* Make sure YYID is used. */
6583 return YYID (yyresult);
6587 #line 3159 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6590 // common code from the two 'RunVMAsmParser' functions
6591 static Module* RunParser(Module * M) {
6592 CurModule.CurrentModule = M;
6593 // Check to make sure the parser succeeded
6596 delete ParserResult;
6600 // Emit an error if there are any unresolved types left.
6601 if (!CurModule.LateResolveTypes.empty()) {
6602 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6603 if (DID.Type == ValID::LocalName) {
6604 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6606 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6609 delete ParserResult;
6613 // Emit an error if there are any unresolved values left.
6614 if (!CurModule.LateResolveValues.empty()) {
6615 Value *V = CurModule.LateResolveValues.back();
6616 std::map<Value*, std::pair<ValID, int> >::iterator I =
6617 CurModule.PlaceHolderInfo.find(V);
6619 if (I != CurModule.PlaceHolderInfo.end()) {
6620 ValID &DID = I->second.first;
6621 if (DID.Type == ValID::LocalName) {
6622 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6624 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6627 delete ParserResult;
6632 // Check to make sure that parsing produced a result
6636 // Reset ParserResult variable while saving its value for the result.
6637 Module *Result = ParserResult;
6643 void llvm::GenerateError(const std::string &message, int LineNo) {
6644 if (LineNo == -1) LineNo = LLLgetLineNo();
6645 // TODO: column number in exception
6647 TheParseError->setError(LLLgetFilename(), message, LineNo);
6651 int yyerror(const char *ErrorMsg) {
6652 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6653 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6654 if (yychar != YYEMPTY && yychar != 0) {
6655 errMsg += " while reading token: '";
6656 errMsg += std::string(LLLgetTokenStart(),
6657 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6659 GenerateError(errMsg);