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() + "'");
956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
966 GenerateError("Illegal label reference " + ID.getName());
970 // If its already been defined, return it now.
972 ID.destroy(); // Free strdup'd memory.
976 // Otherwise, this block has not been seen before, create it.
978 if (ID.Type == ValID::LocalName)
980 BB = new BasicBlock(Name, CurFun.CurrentFunction);
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
989 //===----------------------------------------------------------------------===//
990 // Code to handle forward references in instructions
991 //===----------------------------------------------------------------------===//
993 // This code handles the late binding needed with statements that reference
994 // values not defined yet... for example, a forward branch, or the PHI node for
997 // This keeps a table (CurFun.LateResolveValues) of all such forward references
998 // and back patchs after we are done.
1001 // ResolveDefinitions - If we could not resolve some defs at parsing
1002 // time (forward branches, phi functions for loops, etc...) resolve the
1006 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
1012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1016 ValID &DID = PHI->second.first;
1018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1022 V->replaceAllUsesWith(TheRealValue);
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1028 InsertValue(V, *FutureLateResolvers);
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
1036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1044 LateResolvers.clear();
1047 // ResolveTypeTo - A brand new type was just declared. This means that (if
1048 // name is not null) things referencing Name can be resolved. Otherwise, things
1049 // refering to the number can be resolved. Do this now.
1051 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1054 D = ValID::createLocalName(*Name);
1056 D = ValID::createLocalID(CurModule.Types.size());
1058 std::map<ValID, PATypeHolder>::iterator I =
1059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
1061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1062 CurModule.LateResolveTypes.erase(I);
1066 // setValueName - Set the specified value to the name given. The name may be
1067 // null potentially, in which case this is a noop. The string passed in is
1068 // assumed to be a malloc'd string buffer, and is free'd by this function.
1070 static void setValueName(Value *V, std::string *NameStr) {
1071 if (!NameStr) return;
1072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
1075 if (V->getType() == Type::VoidTy) {
1076 GenerateError("Can't assign name '" + Name+"' to value with void type");
1080 assert(inFunctionScope() && "Must be in function scope!");
1081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
1083 GenerateError("Redefinition of value '" + Name + "' of type '" +
1084 V->getType()->getDescription() + "'");
1092 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093 /// this is a declaration, otherwise it is a definition.
1094 static GlobalVariable *
1095 ParseGlobalVariable(std::string *NameStr,
1096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
1098 bool isConstantGlobal, const Type *Ty,
1099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
1101 if (isa<FunctionType>(Ty)) {
1102 GenerateError("Cannot declare global vars of function type");
1106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
1114 // See if this global value was forward referenced. If so, recycle the
1117 if (!Name.empty()) {
1118 ID = ValID::createGlobalName(Name);
1120 ID = ValID::createGlobalID(CurModule.Values.size());
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
1131 GV->setVisibility(Visibility);
1132 GV->setConstant(isConstantGlobal);
1133 GV->setThreadLocal(IsThreadLocal);
1134 InsertValue(GV, CurModule.Values);
1138 // If this global has a name
1139 if (!Name.empty()) {
1140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1159 GV->setVisibility(Visibility);
1160 InsertValue(GV, CurModule.Values);
1164 // setTypeName - Set the specified type to the name given. The name may be
1165 // null potentially, in which case this is a noop. The string passed in is
1166 // assumed to be a malloc'd string buffer, and is freed by this function.
1168 // This function returns true if the type has already been defined, but is
1169 // allowed to be redefined in the specified context. If the name is a new name
1170 // for the type plane, it is inserted and false is returned.
1171 static bool setTypeName(const Type *T, std::string *NameStr) {
1172 assert(!inFunctionScope() && "Can't give types function-local names!");
1173 if (NameStr == 0) return false;
1175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
1178 // We don't allow assigning names to void type
1179 if (T == Type::VoidTy) {
1180 GenerateError("Can't assign name '" + Name + "' to the void type");
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1189 assert(Existing && "Conflict but no matching type?!");
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1205 // Any other kind of (non-equivalent) redefinition is an error.
1206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1207 T->getDescription() + "'");
1213 //===----------------------------------------------------------------------===//
1214 // Code for handling upreferences in type names...
1217 // TypeContains - Returns true if Ty directly contains E in it.
1219 static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1243 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1244 static std::vector<UpRefRecord> UpRefs;
1246 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1247 /// called. It loops through the UpRefs vector, which is a list of the
1248 /// currently active types. For each type, if the up reference is contained in
1249 /// the newly completed type, we decrement the level count. When the level
1250 /// count reaches zero, the upreferenced type is the type that is passed in:
1251 /// thus we can complete the cycle.
1253 static PATypeHolder HandleUpRefs(const Type *ty) {
1254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1267 OpaqueType *TypeToResolve = 0;
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1305 //===----------------------------------------------------------------------===//
1306 // RunVMAsmParser - Define an interface to this parser
1307 //===----------------------------------------------------------------------===//
1309 static Module* RunParser(Module * M);
1311 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1320 /* Enabling traces. */
1325 /* Enabling verbose error messages. */
1326 #ifdef YYERROR_VERBOSE
1327 # undef YYERROR_VERBOSE
1328 # define YYERROR_VERBOSE 1
1330 # define YYERROR_VERBOSE 0
1333 /* Enabling the token table. */
1334 #ifndef YYTOKEN_TABLE
1335 # define YYTOKEN_TABLE 0
1338 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339 typedef union YYSTYPE
1340 #line 952 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
1342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
1344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
1347 llvm::Constant *ConstVal;
1349 const llvm::Type *PrimType;
1350 std::list<llvm::PATypeHolder> *TypeList;
1351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
1353 std::vector<llvm::Value*> *ValueList;
1354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
1357 llvm::ParamList *ParamList;
1359 // Represent the RHS of PHI node
1360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
1362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1363 std::vector<llvm::Constant*> *ConstVector;
1365 llvm::GlobalValue::LinkageTypes Linkage;
1366 llvm::GlobalValue::VisibilityTypes Visibility;
1367 llvm::ParameterAttributes ParamAttrs;
1368 llvm::APInt *APIntVal;
1373 llvm::APFloat *FPVal;
1376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
1387 /* Line 193 of yacc.c. */
1388 #line 1389 "llvmAsmParser.tab.c"
1390 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391 # define YYSTYPE_IS_DECLARED 1
1392 # define YYSTYPE_IS_TRIVIAL 1
1397 /* Copy the second part of user declarations. */
1400 /* Line 216 of yacc.c. */
1401 #line 1402 "llvmAsmParser.tab.c"
1408 typedef YYTYPE_UINT8 yytype_uint8;
1410 typedef unsigned char yytype_uint8;
1414 typedef YYTYPE_INT8 yytype_int8;
1415 #elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417 typedef signed char yytype_int8;
1419 typedef short int yytype_int8;
1422 #ifdef YYTYPE_UINT16
1423 typedef YYTYPE_UINT16 yytype_uint16;
1425 typedef unsigned short int yytype_uint16;
1429 typedef YYTYPE_INT16 yytype_int16;
1431 typedef short int yytype_int16;
1435 # ifdef __SIZE_TYPE__
1436 # define YYSIZE_T __SIZE_TYPE__
1437 # elif defined size_t
1438 # define YYSIZE_T size_t
1439 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442 # define YYSIZE_T size_t
1444 # define YYSIZE_T unsigned int
1448 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1451 # if defined YYENABLE_NLS && YYENABLE_NLS
1453 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1458 # define YY_(msgid) msgid
1462 /* Suppress unused-variable warnings by "using" E. */
1463 #if ! defined lint || defined __GNUC__
1464 # define YYUSE(e) ((void) (e))
1466 # define YYUSE(e) /* empty */
1469 /* Identity function, used to suppress warnings about constant conditions. */
1471 # define YYID(n) (n)
1473 #if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1487 #if ! defined yyoverflow || YYERROR_VERBOSE
1489 /* The parser invokes alloca or malloc; define the necessary symbols. */
1491 # ifdef YYSTACK_USE_ALLOCA
1492 # if YYSTACK_USE_ALLOCA
1494 # define YYSTACK_ALLOC __builtin_alloca
1495 # elif defined __BUILTIN_VA_ARG_INCR
1496 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1498 # define YYSTACK_ALLOC __alloca
1499 # elif defined _MSC_VER
1500 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501 # define alloca _alloca
1503 # define YYSTACK_ALLOC alloca
1504 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1508 # define _STDLIB_H 1
1515 # ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518 # ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1526 # define YYSTACK_ALLOC YYMALLOC
1527 # define YYSTACK_FREE YYFREE
1528 # ifndef YYSTACK_ALLOC_MAXIMUM
1529 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1531 # if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1536 # define _STDLIB_H 1
1540 # define YYMALLOC malloc
1541 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1547 # define YYFREE free
1548 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550 void free (void *); /* INFRINGES ON USER NAME SPACE */
1554 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1557 #if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1561 /* A type that is properly aligned for any stack member. */
1568 /* The size of the maximum gap between one aligned stack and the next. */
1569 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1571 /* The size of an array large to enough to hold all stacks, each with
1573 # define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1577 /* Copy COUNT objects from FROM to TO. The source and destination do
1580 # if defined __GNUC__ && 1 < __GNUC__
1581 # define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1584 # define YYCOPY(To, From, Count) \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1595 /* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1600 # define YYSTACK_RELOCATE(Stack) \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1613 /* YYFINAL -- State number of the termination state. */
1615 /* YYLAST -- Last index in YYTABLE. */
1618 /* YYNTOKENS -- Number of terminals. */
1619 #define YYNTOKENS 165
1620 /* YYNNTS -- Number of nonterminals. */
1622 /* YYNRULES -- Number of rules. */
1623 #define YYNRULES 322
1624 /* YYNRULES -- Number of states. */
1625 #define YYNSTATES 629
1627 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628 #define YYUNDEFTOK 2
1629 #define YYMAXUTOK 405
1631 #define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1634 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635 static const yytype_uint8 yytranslate[] =
1637 0, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 158, 2, 2, 162, 2, 163, 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, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1677 145, 146, 147, 148, 149, 150
1681 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1683 static const yytype_uint16 yyprhs[] =
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1696 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1697 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1698 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1699 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1700 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1701 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1702 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1704 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1705 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1706 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1707 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1708 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1709 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1710 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
1711 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1712 747, 750, 753, 757, 760, 761, 763, 766, 769, 773,
1713 783, 793, 802, 817, 819, 821, 828, 834, 837, 844,
1714 852, 857, 862, 869, 876, 877, 878, 882, 885, 887,
1715 893, 899, 906, 913, 918, 925, 930, 935, 942, 949,
1716 952, 961, 963, 965, 966, 970, 977, 981, 988, 991,
1720 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1721 static const yytype_int16 yyrhs[] =
1723 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
1724 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1725 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1726 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1727 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1728 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1729 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1730 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1731 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1732 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1733 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1734 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1735 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1736 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1737 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
1738 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1739 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1740 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
1741 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1742 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1743 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1744 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
1745 143, -1, 144, -1, 53, 4, -1, -1, 188, 187,
1746 -1, 138, -1, 141, -1, 137, -1, 136, -1, 145,
1747 -1, 146, -1, -1, 190, 189, -1, -1, 147, 22,
1748 -1, -1, 53, 4, -1, -1, 154, 53, 4, -1,
1749 34, 22, -1, -1, 194, -1, -1, 154, 197, 196,
1750 -1, 194, -1, 53, 4, -1, 11, -1, 12, -1,
1751 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1752 49, -1, 198, -1, 199, 175, 155, -1, 233, -1,
1753 156, 4, -1, 199, 151, 203, 152, 190, -1, 10,
1754 151, 203, 152, 190, -1, 157, 4, 158, 199, 159,
1755 -1, 160, 4, 158, 199, 161, -1, 162, 204, 163,
1756 -1, 162, 163, -1, 160, 162, 204, 163, 161, -1,
1757 160, 162, 163, 161, -1, 199, 188, -1, 199, -1,
1758 10, -1, 200, -1, 202, 154, 200, -1, 202, -1,
1759 202, 154, 39, -1, 39, -1, -1, 199, -1, 204,
1760 154, 199, -1, 199, 157, 207, 159, -1, 199, 157,
1761 159, -1, 199, 164, 22, -1, 199, 160, 207, 161,
1762 -1, 199, 162, 207, 163, -1, 199, 162, 163, -1,
1763 199, 160, 162, 207, 163, 161, -1, 199, 160, 162,
1764 163, 161, -1, 199, 40, -1, 199, 41, -1, 199,
1765 233, -1, 199, 206, -1, 199, 25, -1, 171, 3,
1766 -1, 171, 5, -1, 171, 4, -1, 171, 6, -1,
1767 11, 26, -1, 11, 27, -1, 172, 9, -1, 168,
1768 151, 205, 38, 199, 152, -1, 116, 151, 205, 245,
1769 152, -1, 130, 151, 205, 154, 205, 154, 205, 152,
1770 -1, 166, 151, 205, 154, 205, 152, -1, 167, 151,
1771 205, 154, 205, 152, -1, 89, 169, 151, 205, 154,
1772 205, 152, -1, 90, 170, 151, 205, 154, 205, 152,
1773 -1, 132, 151, 205, 154, 205, 152, -1, 133, 151,
1774 205, 154, 205, 154, 205, 152, -1, 134, 151, 205,
1775 154, 205, 154, 205, 152, -1, 207, 154, 205, -1,
1776 205, -1, 32, -1, 33, -1, 37, -1, -1, 201,
1777 233, -1, 122, 151, 210, 38, 199, 152, -1, 212,
1778 -1, -1, 213, -1, 212, 213, -1, -1, 31, 214,
1779 229, -1, -1, 30, 215, 230, -1, 59, 58, 219,
1780 -1, 176, 18, 199, -1, 176, 18, 10, -1, -1,
1781 178, 182, 209, 208, 205, 175, 216, 196, -1, -1,
1782 178, 180, 182, 209, 208, 205, 175, 217, 196, -1,
1783 -1, 178, 181, 182, 209, 208, 199, 175, 218, 196,
1784 -1, 178, 182, 35, 185, 210, -1, 51, 220, -1,
1785 55, 153, 221, -1, 22, -1, 52, 153, 22, -1,
1786 67, 153, 22, -1, 157, 222, 159, -1, 222, 154,
1787 22, -1, 22, -1, -1, 223, 154, 199, 188, 174,
1788 -1, 199, 188, 174, -1, 223, -1, 223, 154, 39,
1789 -1, 39, -1, -1, 186, 201, 177, 151, 224, 152,
1790 190, 195, 192, 191, -1, 28, -1, 162, -1, 184,
1791 182, 225, 226, -1, 29, -1, 163, -1, 237, 228,
1792 -1, 183, 182, 225, -1, -1, 60, -1, 3, -1,
1793 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1794 41, -1, 25, -1, 160, 207, 161, -1, 206, -1,
1795 58, 231, 22, 154, 22, -1, 7, -1, 8, -1,
1796 173, -1, 177, -1, 233, -1, 232, -1, 199, 234,
1797 -1, 235, -1, 236, 154, 205, -1, 237, 238, -1,
1798 227, 238, -1, 239, 176, 240, -1, 239, 242, -1,
1799 -1, 21, -1, 68, 236, -1, 68, 10, -1, 69,
1800 17, 234, -1, 69, 11, 234, 154, 17, 234, 154,
1801 17, 234, -1, 70, 171, 234, 154, 17, 234, 157,
1802 241, 159, -1, 70, 171, 234, 154, 17, 234, 157,
1803 159, -1, 71, 186, 201, 234, 151, 244, 152, 190,
1804 38, 17, 234, 72, 17, 234, -1, 72, -1, 73,
1805 -1, 241, 171, 232, 154, 17, 234, -1, 171, 232,
1806 154, 17, 234, -1, 176, 247, -1, 199, 157, 234,
1807 154, 234, 159, -1, 243, 154, 157, 234, 154, 234,
1808 159, -1, 199, 188, 234, 188, -1, 17, 188, 234,
1809 188, -1, 244, 154, 199, 188, 234, 188, -1, 244,
1810 154, 17, 188, 234, 188, -1, -1, -1, 245, 154,
1811 235, -1, 57, 56, -1, 56, -1, 166, 199, 234,
1812 154, 234, -1, 167, 199, 234, 154, 234, -1, 89,
1813 169, 199, 234, 154, 234, -1, 90, 170, 199, 234,
1814 154, 234, -1, 168, 235, 38, 199, -1, 130, 235,
1815 154, 235, 154, 235, -1, 131, 235, 154, 199, -1,
1816 132, 235, 154, 235, -1, 133, 235, 154, 235, 154,
1817 235, -1, 134, 235, 154, 235, 154, 235, -1, 129,
1818 243, -1, 246, 186, 201, 234, 151, 244, 152, 190,
1819 -1, 249, -1, 36, -1, -1, 111, 199, 193, -1,
1820 111, 199, 154, 11, 234, 193, -1, 112, 199, 193,
1821 -1, 112, 199, 154, 11, 234, 193, -1, 113, 235,
1822 -1, 248, 114, 199, 234, 193, -1, 248, 115, 235,
1823 154, 199, 234, 193, -1, 135, 199, 173, 154, 4,
1824 -1, 116, 199, 234, 245, -1
1827 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1828 static const yytype_uint16 yyrline[] =
1830 0, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114,
1831 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1116, 1116, 1116,
1832 1116, 1116, 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1120,
1833 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1124, 1124, 1128,
1834 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132, 1132, 1133,
1835 1133, 1134, 1134, 1135, 1136, 1141, 1142, 1142, 1142, 1142,
1836 1142, 1144, 1144, 1144, 1145, 1145, 1147, 1148, 1152, 1156,
1837 1161, 1161, 1163, 1164, 1169, 1175, 1176, 1177, 1178, 1179,
1838 1183, 1184, 1185, 1189, 1190, 1191, 1192, 1196, 1197, 1198,
1839 1202, 1203, 1204, 1205, 1206, 1210, 1211, 1212, 1215, 1216,
1840 1217, 1218, 1219, 1220, 1221, 1228, 1229, 1230, 1231, 1232,
1841 1233, 1234, 1235, 1236, 1237, 1240, 1241, 1246, 1247, 1248,
1842 1249, 1250, 1251, 1254, 1255, 1260, 1261, 1268, 1269, 1275,
1843 1276, 1285, 1293, 1294, 1299, 1300, 1301, 1306, 1319, 1319,
1844 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337, 1342,
1845 1350, 1380, 1405, 1410, 1420, 1430, 1434, 1444, 1451, 1460,
1846 1467, 1472, 1477, 1484, 1485, 1492, 1499, 1507, 1513, 1525,
1847 1553, 1569, 1596, 1624, 1650, 1670, 1696, 1716, 1728, 1735,
1848 1801, 1811, 1821, 1827, 1837, 1843, 1853, 1858, 1863, 1876,
1849 1888, 1910, 1918, 1924, 1935, 1940, 1945, 1951, 1957, 1966,
1850 1970, 1978, 1978, 1981, 1981, 1984, 1996, 2017, 2022, 2030,
1851 2031, 2035, 2035, 2039, 2039, 2042, 2045, 2069, 2081, 2080,
1852 2092, 2091, 2101, 2100, 2111, 2151, 2154, 2160, 2170, 2174,
1853 2179, 2181, 2186, 2191, 2200, 2210, 2221, 2225, 2234, 2243,
1854 2248, 2382, 2382, 2384, 2393, 2393, 2395, 2400, 2412, 2416,
1855 2421, 2425, 2429, 2433, 2437, 2441, 2445, 2449, 2453, 2478,
1856 2482, 2492, 2496, 2500, 2505, 2512, 2512, 2518, 2527, 2532,
1857 2537, 2541, 2550, 2559, 2568, 2572, 2580, 2606, 2610, 2615,
1858 2625, 2644, 2653, 2744, 2748, 2755, 2766, 2779, 2789, 2800,
1859 2810, 2821, 2829, 2839, 2846, 2849, 2850, 2857, 2861, 2866,
1860 2882, 2899, 2913, 2927, 2939, 2947, 2954, 2960, 2966, 2972,
1861 2987, 3085, 3090, 3094, 3101, 3108, 3116, 3123, 3131, 3139,
1866 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1867 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1868 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1869 static const char *const yytname[] =
1871 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1872 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1873 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1874 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1875 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1876 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1877 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1878 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1879 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1880 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1881 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1882 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1883 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1884 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1885 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1886 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1887 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1888 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1889 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1890 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
1891 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1892 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1893 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1894 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1895 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1896 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1897 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1898 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1899 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1900 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1901 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1902 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1903 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1904 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1905 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1906 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1907 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1908 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1909 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1910 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1911 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1912 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1913 "InstVal", "OptVolatile", "MemoryInst", 0
1918 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1920 static const yytype_uint16 yytoknum[] =
1922 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1923 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1924 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1925 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1926 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1927 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1928 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1929 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1930 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1931 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1932 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1933 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1934 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1935 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1936 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1937 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1938 60, 62, 123, 125, 99
1942 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1943 static const yytype_uint8 yyr1[] =
1945 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1946 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1947 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
1948 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1949 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1950 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1951 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1952 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1953 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1954 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1955 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
1956 187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
1957 189, 189, 189, 190, 190, 191, 191, 192, 192, 193,
1958 193, 194, 195, 195, 196, 196, 197, 197, 198, 198,
1959 198, 198, 198, 198, 198, 199, 199, 199, 199, 199,
1960 199, 199, 199, 199, 199, 199, 199, 199, 200, 201,
1961 201, 202, 202, 203, 203, 203, 203, 204, 204, 205,
1962 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
1963 205, 205, 205, 205, 205, 205, 205, 205, 205, 206,
1964 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1965 207, 208, 208, 209, 209, 210, 210, 211, 211, 212,
1966 212, 214, 213, 215, 213, 213, 213, 213, 216, 213,
1967 217, 213, 218, 213, 213, 213, 213, 219, 220, 220,
1968 221, 222, 222, 222, 223, 223, 224, 224, 224, 224,
1969 225, 226, 226, 227, 228, 228, 229, 230, 231, 231,
1970 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1971 232, 233, 233, 233, 233, 234, 234, 235, 236, 236,
1972 237, 237, 238, 239, 239, 239, 240, 240, 240, 240,
1973 240, 240, 240, 240, 240, 241, 241, 242, 243, 243,
1974 244, 244, 244, 244, 244, 245, 245, 246, 246, 247,
1975 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
1976 247, 247, 248, 248, 249, 249, 249, 249, 249, 249,
1980 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1981 static const yytype_uint8 yyr2[] =
1983 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1986 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1987 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1988 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1990 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1991 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1992 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1993 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1994 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1995 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1996 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1997 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
1998 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
1999 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2000 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2001 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2002 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2003 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2004 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2005 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2006 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2007 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2008 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2009 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2010 2, 2, 3, 2, 0, 1, 2, 2, 3, 9,
2011 9, 8, 14, 1, 1, 6, 5, 2, 6, 7,
2012 4, 4, 6, 6, 0, 0, 3, 2, 1, 5,
2013 5, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2014 8, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2018 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2019 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2020 means the default is an error. */
2021 static const yytype_uint16 yydefact[] =
2023 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2024 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2025 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
2026 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2027 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
2028 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
2029 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2030 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2031 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
2032 275, 271, 69, 244, 245, 246, 270, 228, 229, 232,
2033 0, 166, 149, 0, 0, 0, 0, 155, 167, 0,
2034 0, 166, 0, 0, 0, 97, 96, 0, 201, 202,
2035 0, 0, 99, 100, 101, 102, 103, 0, 247, 0,
2036 313, 273, 0, 230, 165, 115, 161, 163, 0, 0,
2037 0, 0, 0, 0, 154, 0, 0, 147, 0, 0,
2038 160, 0, 159, 0, 224, 138, 139, 140, 143, 142,
2039 141, 0, 0, 67, 67, 104, 0, 241, 242, 243,
2040 312, 298, 0, 0, 0, 0, 98, 283, 284, 2,
2041 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2042 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2043 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2044 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
2045 0, 0, 272, 98, 287, 0, 311, 231, 158, 0,
2046 123, 67, 67, 157, 0, 168, 0, 123, 67, 67,
2047 0, 205, 186, 187, 182, 184, 183, 185, 188, 181,
2048 177, 178, 0, 0, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 180, 179, 218, 0,
2050 297, 277, 67, 268, 276, 0, 0, 55, 0, 0,
2051 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2052 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2053 42, 43, 44, 45, 46, 47, 48, 0, 129, 129,
2054 318, 67, 67, 309, 0, 0, 0, 0, 0, 67,
2055 67, 67, 0, 0, 0, 0, 0, 106, 108, 107,
2056 105, 109, 110, 111, 112, 113, 116, 164, 162, 151,
2057 152, 153, 156, 66, 150, 220, 222, 0, 0, 0,
2058 0, 0, 0, 0, 0, 170, 200, 0, 0, 0,
2059 174, 0, 171, 0, 0, 0, 134, 239, 250, 251,
2060 252, 257, 253, 254, 255, 256, 248, 0, 259, 266,
2061 265, 267, 0, 0, 278, 0, 0, 67, 67, 0,
2062 314, 0, 316, 295, 0, 0, 0, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 67, 0, 114, 120,
2064 119, 117, 118, 121, 122, 124, 134, 134, 0, 0,
2065 0, 295, 0, 0, 0, 0, 0, 169, 155, 167,
2066 0, 172, 173, 0, 0, 0, 0, 219, 238, 115,
2067 236, 0, 249, 0, 0, 269, 0, 0, 0, 0,
2068 0, 0, 0, 0, 322, 0, 0, 0, 305, 306,
2069 0, 0, 0, 0, 0, 303, 0, 129, 0, 221,
2070 223, 67, 0, 0, 0, 0, 0, 0, 0, 199,
2071 176, 0, 0, 0, 0, 0, 0, 136, 134, 65,
2072 0, 123, 0, 258, 0, 0, 294, 0, 0, 129,
2073 130, 129, 0, 0, 0, 0, 0, 0, 321, 299,
2074 300, 294, 0, 319, 67, 206, 0, 0, 190, 0,
2075 0, 0, 0, 175, 0, 0, 67, 131, 137, 135,
2076 64, 235, 237, 115, 132, 0, 0, 0, 115, 115,
2077 0, 301, 302, 315, 317, 296, 0, 0, 304, 307,
2078 308, 0, 129, 0, 0, 0, 196, 0, 0, 192,
2079 193, 189, 65, 133, 127, 260, 0, 0, 0, 0,
2080 123, 0, 288, 0, 123, 320, 194, 195, 0, 0,
2081 0, 234, 0, 125, 0, 281, 0, 0, 106, 108,
2082 115, 115, 0, 115, 115, 289, 310, 191, 197, 198,
2083 128, 0, 240, 279, 0, 280, 0, 291, 290, 0,
2084 0, 0, 126, 0, 0, 0, 115, 115, 0, 0,
2085 0, 293, 292, 286, 0, 0, 285, 0, 282
2088 /* YYDEFGOTO[NTERM-NUM]. */
2089 static const yytype_int16 yydefgoto[] =
2091 -1, 263, 264, 265, 290, 307, 161, 162, 78, 531,
2092 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2093 117, 127, 336, 228, 415, 339, 602, 583, 390, 487,
2094 564, 437, 488, 80, 163, 136, 153, 137, 138, 109,
2095 356, 378, 357, 120, 87, 154, 16, 17, 18, 20,
2096 19, 366, 416, 417, 62, 23, 60, 100, 440, 441,
2097 128, 169, 54, 95, 55, 48, 443, 379, 82, 381,
2098 273, 274, 56, 91, 92, 222, 587, 131, 313, 540,
2099 454, 223, 224, 225, 226
2102 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2104 #define YYPACT_NINF -571
2105 static const yytype_int16 yypact[] =
2107 39, -571, -571, -571, -571, -571, -571, -571, -12, -138,
2108 -25, -108, 49, -75, 258, -571, 83, 883, -571, 54,
2109 187, -54, -50, -571, -38, 105, -571, 1464, -571, -571,
2110 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2111 106, 106, 178, -571, -571, -571, -571, 106, -571, -571,
2112 -571, -571, -571, 106, 110, -571, -10, 158, 176, 184,
2113 -571, -571, -571, -571, -571, 58, -571, -571, -571, -571,
2114 -571, -571, -571, -571, 239, 242, 2, 126, -571, -571,
2115 -571, 12, -571, 232, 232, 234, -571, 127, 175, 175,
2116 -571, -571, 255, -571, -571, -571, -571, -571, -571, -571,
2117 62, 1059, -571, 117, 122, 506, 58, -571, 12, -111,
2118 141, 1059, 129, 127, 127, -571, -571, 1014, -571, -571,
2119 1504, 292, -571, -571, -571, -571, -571, 1562, -571, -6,
2120 1843, -571, 291, -571, -571, 12, -571, 166, 174, 1620,
2121 1620, 170, -110, 1620, -571, 329, 183, -571, 1504, 1620,
2122 58, 188, 12, 336, -571, 311, 333, 337, 338, 339,
2123 340, 262, 341, 1115, 297, -571, 26, -571, -571, -571,
2124 -571, -571, 289, 1660, 194, 343, 175, -571, -571, -571,
2125 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2126 -571, -571, -571, -571, 511, 787, 1620, 1620, 1620, 1620,
2127 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2128 -571, -571, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620,
2129 1620, 1620, -571, 175, -571, 135, -571, -571, 434, 1345,
2130 -571, -7, -33, -571, 191, 12, 209, -571, 297, -19,
2131 1014, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2132 -571, -571, 511, 787, 211, 212, 213, 214, 217, 1385,
2133 1678, 609, 347, 225, 228, 230, -571, -571, -571, 231,
2134 -571, 58, 702, -571, 235, 841, 841, -571, 841, 1562,
2135 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2136 1620, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2137 -571, -571, -571, -571, -571, -571, -571, 1620, 11, 97,
2138 -571, 702, -31, 241, 244, 245, 249, 250, 251, 10,
2139 702, 702, 355, 1562, 1620, 1620, 392, -571, -571, -571,
2140 -571, -571, -571, -571, -571, -571, -571, -571, -571, -65,
2141 -571, -571, -571, -571, -65, -571, 129, 371, 259, 260,
2142 1504, 1504, 1504, 1504, 1504, -571, -571, 88, 788, -57,
2143 -571, -68, -571, 1504, 1504, 1504, 261, 1406, -571, -571,
2144 -571, -571, -571, -571, -571, -571, 352, 1504, -571, -571,
2145 -571, -571, 1504, 263, -571, 266, 841, 702, 702, 7,
2146 -571, 15, -571, -571, 841, 256, 1620, 1620, 1620, 1620,
2147 1620, 269, 272, 274, 1620, 841, 702, 275, -571, -571,
2148 -571, -571, -571, -571, -571, -571, 261, 261, 1620, 1504,
2149 1504, -571, 276, 277, 281, 282, 1504, -571, 278, 969,
2150 -58, -571, -571, 283, 287, 378, -3, -571, -571, 12,
2151 290, 293, -571, 421, 43, -571, 429, 430, 298, 294,
2152 296, 841, 449, 841, 300, 301, 841, 302, 12, -571,
2153 303, 305, 456, 841, 841, 12, 310, 308, 1620, -571,
2154 -571, -45, 313, 314, 133, 1504, 1504, 1504, 1504, -571,
2155 -571, 312, 1504, 1504, 1620, 447, 468, -571, 261, 1746,
2156 1446, -571, 320, -571, 841, 841, 1718, 841, 841, 308,
2157 -571, 308, 1620, 841, 321, 1620, 1620, 1620, -571, -571,
2158 -571, 1718, 424, -571, 702, -571, 1504, 1504, -571, 324,
2159 330, 332, 334, -571, 331, 342, -30, -571, -571, -571,
2160 -571, -571, -571, 12, 81, 462, 344, 346, 28, 12,
2161 155, -571, -571, -571, -571, -571, 345, 841, -571, -571,
2162 -571, 171, 308, 348, 349, 1504, -571, 1504, 1504, -571,
2163 -571, -571, 1746, -571, 437, -571, 474, -4, 560, 560,
2164 -571, 1736, -571, 353, -571, -571, -571, -571, 354, 359,
2165 363, -571, 491, 358, 841, -571, 1255, -1, 356, 373,
2166 -571, -571, 87, 28, 12, -571, -65, -571, -571, -571,
2167 -571, 505, -571, -571, 377, -571, 1255, 434, 434, 479,
2168 560, 560, -571, 515, 379, 841, -571, -571, 841, 519,
2169 465, 434, 434, -571, 841, 521, -571, 841, -571
2172 /* YYPGOTO[NTERM-NUM]. */
2173 static const yytype_int16 yypgoto[] =
2175 -571, 416, 417, 420, 304, 306, -173, -571, 0, -8,
2176 -150, 466, 8, -571, -571, -571, -571, 1, -571, -571,
2177 -571, -149, -571, -409, -571, -234, -571, -571, -289, 23,
2178 -571, -404, -571, -571, -26, 360, -122, -571, 450, 460,
2179 -92, -159, -223, 55, 93, 326, -571, -571, 555, -571,
2180 -571, -571, -571, -571, -571, -571, -571, -571, -571, -571,
2181 486, -571, -571, -571, -571, -571, -571, -570, -76, 46,
2182 -105, -571, -571, 525, -571, -571, -571, -571, -571, 77,
2183 169, -571, -571, -571, -571
2186 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2187 positive, shift that token. If negative, reduce the rule which
2188 number is the opposite. If zero, do what YYDEFACT says.
2189 If YYTABLE_NINF, syntax error. */
2190 #define YYTABLE_NINF -209
2191 static const yytype_int16 yytable[] =
2193 11, 81, 278, 344, 266, 166, 104, 277, 13, 110,
2194 277, 90, 469, 470, 268, 24, 604, 11, 451, 93,
2195 392, 110, 167, 110, 110, 13, 453, 279, 164, 1,
2196 489, 485, 3, 25, 5, 110, 614, 359, 361, -208,
2197 21, 83, 84, 143, 143, 26, 2, 110, 88, 4,
2198 486, 108, 144, 234, 89, 22, 238, -69, 1, 2,
2199 452, 3, 4, 5, 110, 110, 110, 27, 452, 6,
2200 7, 409, 410, 411, 323, 135, 412, 241, 28, 108,
2201 413, 414, -144, 43, 529, 135, 426, 267, 345, 346,
2202 8, 152, 11, 310, 9, 432, 426, 426, 10, 57,
2203 45, 152, 46, 58, 431, 481, 111, 515, 314, 315,
2204 316, 317, 318, 231, 232, 485, 322, 235, 111, 59,
2205 111, 111, 561, 239, 562, 609, 394, 61, 341, 568,
2206 569, 90, 111, 63, 64, 430, 106, 66, 67, 68,
2207 69, 70, 71, 72, 111, 1, 2, 272, 3, 4,
2208 5, 110, 340, 94, 444, 585, 168, 386, 605, 118,
2209 119, 111, 111, 111, 105, 389, -67, -67, 148, 149,
2210 308, 309, 272, 311, 269, 73, 113, 114, 513, -144,
2211 97, 607, 608, -144, 610, 611, 312, 272, 272, 272,
2212 272, 272, 319, 320, 321, 272, 380, 426, 98, 380,
2213 380, 405, 380, 135, 493, 275, 99, 621, 622, 101,
2214 543, 276, 544, 85, 152, 86, 132, 409, 410, 411,
2215 407, 133, 412, 409, 410, 411, 413, 414, 412, 49,
2216 50, 51, 413, 414, 52, 380, 121, 122, 123, 124,
2217 125, 126, 426, 102, 380, 380, 103, 427, 111, 324,
2218 325, 391, -67, 152, 37, 38, 39, 534, 421, 422,
2219 423, 424, 425, 575, 387, 244, 245, 246, 247, 86,
2220 266, 433, 434, 435, 1, 139, 115, 3, 116, 5,
2221 140, 388, 74, 75, 147, 518, 76, 502, 77, 107,
2222 445, 457, 145, 459, 460, 461, 165, 152, 406, 272,
2223 29, 30, 31, 32, 33, 34, 35, 570, 36, 571,
2224 380, 380, 380, 227, -55, -55, -55, -55, 380, 401,
2225 229, 383, 384, 574, 385, 571, 230, 472, 473, 380,
2226 380, 233, 429, 236, 479, 237, 592, 242, 243, 240,
2227 596, 439, -56, 63, 64, 270, -57, -60, -59, -58,
2228 248, 110, 342, 267, 277, 1, 2, 393, 3, 4,
2229 5, 343, 350, 351, 352, 353, 402, 403, 354, 362,
2230 272, 458, 272, 272, 272, 380, 363, 380, 465, 364,
2231 380, 365, 367, 519, 520, 521, 522, 380, 380, 382,
2232 524, 525, 471, 404, 586, 395, 408, 545, 396, 397,
2233 548, 549, 550, 398, 399, 400, 37, 38, 39, 418,
2234 419, 420, 442, 456, 606, 436, 484, 446, 380, 380,
2235 447, 380, 380, 462, 553, 554, 463, 380, 464, 468,
2236 475, 476, 448, 449, 450, 477, 478, 482, 380, 480,
2237 455, 483, 514, 492, 490, 491, 494, 495, 497, 496,
2238 498, 466, 467, 500, 502, 503, 505, 506, 526, 507,
2239 508, 511, 512, 578, 533, 579, 580, 516, 517, 527,
2240 539, 380, 528, 523, 535, 547, 272, 452, 555, 272,
2241 272, 272, 556, 559, 565, 539, 557, 326, 558, 530,
2242 582, 584, 380, 380, 560, 600, 615, 499, 566, 501,
2243 576, 577, 504, 567, 572, 601, 597, -18, 380, 509,
2244 510, 598, 595, 63, 64, 599, 106, 66, 67, 68,
2245 69, 70, 71, 72, -19, 1, 2, 612, 3, 4,
2246 5, 613, 618, 619, 380, 380, 624, 625, 627, 380,
2247 536, 537, 380, 541, 542, 594, 219, 220, 380, 546,
2248 221, 380, 327, 328, 581, 73, 348, 563, 130, 349,
2249 552, 146, 530, 368, 369, 142, 347, 63, 64, 370,
2250 329, 330, 44, 331, 332, 129, 333, 334, 335, 1,
2251 2, 96, 3, 4, 5, 371, 372, 373, 551, 338,
2252 474, 0, 0, 573, 0, 0, 0, 0, 0, 0,
2253 374, 375, 280, 281, 282, 283, 284, 285, 286, 287,
2254 288, 289, 0, 326, 590, 591, 63, 64, 376, 106,
2255 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2256 603, 3, 4, 5, 179, 180, 181, 182, 183, 184,
2257 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2258 253, 0, 0, 0, 0, 0, 616, 617, 73, 0,
2259 0, 620, 74, 75, 623, 0, 76, 0, 77, 141,
2260 626, 0, 0, 628, 0, 0, 254, 200, 588, 589,
2261 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
2262 255, 0, 256, 257, 258, 0, 329, 330, 0, 331,
2263 332, 0, 333, 334, 335, 368, 369, 0, 0, 63,
2264 64, 370, 0, 0, 0, 0, 0, 0, 0, 0,
2265 377, 1, 2, 0, 3, 4, 5, 371, 372, 373,
2266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2267 0, 0, 374, 375, 0, 0, 0, 0, 0, 0,
2268 0, 0, 0, 0, 0, 0, 110, 0, 0, 0,
2269 376, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2270 0, 77, 360, 0, 0, 0, 179, 180, 181, 182,
2271 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2272 193, 252, 253, 0, 0, 63, 64, 0, 106, 155,
2273 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
2274 3, 4, 5, 291, 292, 0, 0, 0, 254, 200,
2275 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2276 211, 0, 255, 0, 256, 257, 258, 73, 0, 0,
2277 0, 0, 0, 0, 368, 369, 0, 0, 63, 64,
2278 370, 0, 0, 111, 0, 0, 0, 0, 0, 0,
2279 1, 2, 377, 3, 4, 5, 371, 372, 373, 0,
2280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2281 0, 374, 375, -207, 293, 294, 295, 296, 297, 298,
2282 299, 300, 301, 302, 303, 304, 305, 306, 0, 376,
2283 0, -69, 1, 2, 0, 3, 4, 5, 0, 0,
2284 0, 0, 0, 6, 7, 179, 180, 181, 182, 183,
2285 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2286 252, 253, 0, 0, 8, 0, 0, 0, 9, 0,
2287 0, 0, 10, 0, 74, 75, 0, 0, 76, 0,
2288 77, 428, 0, 0, 0, 0, 0, 254, 200, 201,
2289 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2290 0, 255, 0, 256, 257, 258, 63, 64, 0, 0,
2291 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2292 0, 3, 4, 5, 249, 0, 0, 0, 0, 0,
2293 0, 377, 0, 0, 0, 0, 0, 0, 0, 250,
2294 251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2295 0, 63, 64, 110, 150, 66, 67, 68, 69, 70,
2296 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2297 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2298 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2299 0, 0, 0, 73, 0, 0, 63, 64, 0, 106,
2300 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2301 0, 3, 4, 5, 0, 254, 200, 201, 202, 203,
2302 204, 205, 206, 207, 208, 209, 210, 211, 134, 255,
2303 0, 256, 257, 258, 0, 0, 0, 0, 73, 0,
2304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2305 111, 0, 63, 64, -67, 0, 259, 0, 0, 260,
2306 0, 261, 0, 262, 1, 2, 151, 3, 4, 5,
2307 249, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2308 0, 0, 0, 0, 0, 250, 251, 0, 0, 0,
2309 0, 0, 0, 0, 0, 0, 0, 0, 0, 110,
2310 74, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2311 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2312 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2313 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2314 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2315 0, 77, 0, 0, 0, 0, 0, 0, 0, 0,
2316 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2317 208, 209, 210, 211, 0, 255, 0, 256, 257, 258,
2318 0, 0, 0, 0, 0, 0, 0, 0, 368, 369,
2319 0, 0, 0, 0, 370, 0, 111, 0, 0, 0,
2320 0, 0, 259, 0, 0, 260, 0, 261, 0, 262,
2321 371, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 374, 375, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2324 0, 0, 0, 376, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2326 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2327 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2328 0, 0, 63, 64, 0, 106, 66, 67, 68, 69,
2329 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2330 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2331 208, 209, 210, 211, 337, 255, 0, 256, 257, 258,
2332 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2333 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2334 0, 0, 0, 63, 64, 377, 106, 66, 67, 68,
2335 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2336 5, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2337 0, 0, 0, 0, 0, 438, 0, 0, 0, 0,
2338 0, 0, 0, 63, 64, 73, 106, 66, 67, 68,
2339 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2340 5, 63, 64, 0, 65, 66, 67, 68, 69, 70,
2341 71, 72, 0, 1, 2, 532, 3, 4, 5, 0,
2342 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2343 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2344 0, 63, 64, 73, 106, 155, 156, 157, 158, 159,
2345 160, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2346 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2347 0, 74, 75, 0, 355, 76, 0, 77, 0, 0,
2348 0, 0, 0, 73, 0, 0, 0, 0, 0, 0,
2349 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
2350 64, 0, 150, 66, 67, 68, 69, 70, 71, 72,
2351 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2353 0, 0, 74, 75, 0, 0, 76, 0, 77, 0,
2354 0, 73, 0, 0, 0, 0, 0, 0, 0, 0,
2355 74, 75, 0, 0, 76, 0, 77, 63, 64, 0,
2356 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2357 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2358 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2359 74, 75, 0, 0, 76, 0, 77, 63, 64, 73,
2360 271, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2361 2, 0, 3, 4, 5, 63, 64, 0, 106, 155,
2362 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
2363 3, 4, 5, 0, 0, 0, 0, 0, 0, 73,
2364 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
2365 0, 0, 76, 0, 77, 63, 64, 73, 106, 66,
2366 67, 68, 69, 70, 71, 538, 0, 1, 2, 0,
2367 3, 4, 5, 63, 64, 0, 106, 66, 67, 68,
2368 69, 70, 71, 593, 0, 1, 2, 0, 3, 4,
2369 5, 0, 0, 0, 0, 1, 0, 73, 3, 0,
2370 5, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2371 76, 0, 77, 0, 0, 73, 0, 0, 0, 0,
2372 0, 0, 0, 0, 0, 0, 0, 0, 0, 326,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2374 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2375 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2377 358, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2378 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2379 0, 0, 0, 0, 327, 328, 0, 0, 0, 0,
2380 0, 0, 0, 0, 74, 75, 0, 0, 76, 170,
2381 77, 0, 329, 330, 0, 331, 332, 0, 333, 334,
2382 335, 0, 74, 75, 0, 0, 76, 0, 77, 171,
2383 172, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2384 0, 173, 174, 175, 176, 177, 178, 179, 180, 181,
2385 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2386 192, 193, 194, 195, 0, 0, 0, 0, 0, 0,
2387 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2388 0, 0, 0, 0, 196, 197, 198, 0, 0, 199,
2389 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2390 210, 211, 212, 213, 214, 215, 216, 217, 218
2393 static const yytype_int16 yycheck[] =
2395 0, 27, 175, 237, 163, 127, 4, 11, 0, 54,
2396 11, 21, 416, 417, 164, 153, 586, 17, 11, 29,
2397 309, 54, 28, 54, 54, 17, 11, 176, 120, 19,
2398 439, 34, 22, 58, 24, 54, 606, 260, 261, 0,
2399 52, 40, 41, 154, 154, 153, 20, 54, 47, 23,
2400 53, 77, 163, 163, 53, 67, 148, 18, 19, 20,
2401 53, 22, 23, 24, 54, 54, 54, 18, 53, 30,
2402 31, 136, 137, 138, 223, 101, 141, 153, 153, 105,
2403 145, 146, 54, 0, 488, 111, 154, 163, 238, 239,
2404 51, 117, 92, 198, 55, 163, 154, 154, 59, 153,
2405 46, 127, 48, 153, 161, 163, 151, 152, 213, 214,
2406 215, 216, 217, 139, 140, 34, 221, 143, 151, 157,
2407 151, 151, 152, 149, 533, 38, 157, 22, 161, 538,
2408 539, 21, 151, 7, 8, 358, 10, 11, 12, 13,
2409 14, 15, 16, 17, 151, 19, 20, 173, 22, 23,
2410 24, 54, 159, 163, 377, 159, 162, 279, 159, 32,
2411 33, 151, 151, 151, 162, 154, 155, 155, 113, 114,
2412 196, 197, 198, 199, 166, 49, 83, 84, 467, 151,
2413 22, 590, 591, 155, 593, 594, 212, 213, 214, 215,
2414 216, 217, 218, 219, 220, 221, 272, 154, 22, 275,
2415 276, 323, 278, 229, 161, 11, 22, 616, 617, 151,
2416 499, 17, 501, 35, 240, 37, 154, 136, 137, 138,
2417 325, 159, 141, 136, 137, 138, 145, 146, 141, 42,
2418 43, 44, 145, 146, 47, 311, 61, 62, 63, 64,
2419 65, 66, 154, 4, 320, 321, 4, 159, 151, 114,
2420 115, 154, 155, 279, 148, 149, 150, 491, 350, 351,
2421 352, 353, 354, 552, 290, 3, 4, 5, 6, 37,
2422 429, 363, 364, 365, 19, 158, 42, 22, 44, 24,
2423 158, 307, 156, 157, 155, 152, 160, 154, 162, 163,
2424 382, 396, 151, 398, 399, 400, 4, 323, 324, 325,
2425 42, 43, 44, 45, 46, 47, 48, 152, 50, 154,
2426 386, 387, 388, 22, 3, 4, 5, 6, 394, 319,
2427 154, 275, 276, 152, 278, 154, 152, 419, 420, 405,
2428 406, 161, 358, 4, 426, 152, 570, 26, 27, 151,
2429 574, 367, 9, 7, 8, 56, 9, 9, 9, 9,
2430 9, 54, 161, 429, 11, 19, 20, 311, 22, 23,
2431 24, 152, 151, 151, 151, 151, 320, 321, 151, 22,
2432 396, 397, 398, 399, 400, 451, 151, 453, 404, 151,
2433 456, 151, 151, 475, 476, 477, 478, 463, 464, 154,
2434 482, 483, 418, 38, 567, 154, 4, 502, 154, 154,
2435 505, 506, 507, 154, 154, 154, 148, 149, 150, 38,
2436 151, 151, 60, 157, 587, 154, 38, 154, 494, 495,
2437 154, 497, 498, 154, 516, 517, 154, 503, 154, 154,
2438 154, 154, 386, 387, 388, 154, 154, 154, 514, 161,
2439 394, 154, 468, 22, 154, 152, 17, 17, 154, 151,
2440 154, 405, 406, 4, 154, 154, 154, 154, 484, 154,
2441 4, 151, 154, 555, 490, 557, 558, 154, 154, 22,
2442 496, 547, 4, 161, 154, 154, 502, 53, 154, 505,
2443 506, 507, 152, 152, 22, 511, 154, 53, 154, 489,
2444 53, 17, 568, 569, 152, 4, 17, 451, 154, 453,
2445 152, 152, 456, 157, 159, 147, 152, 151, 584, 463,
2446 464, 152, 159, 7, 8, 152, 10, 11, 12, 13,
2447 14, 15, 16, 17, 151, 19, 20, 22, 22, 23,
2448 24, 154, 17, 154, 610, 611, 17, 72, 17, 615,
2449 494, 495, 618, 497, 498, 571, 130, 130, 624, 503,
2450 130, 627, 118, 119, 562, 49, 252, 534, 92, 253,
2451 514, 111, 562, 3, 4, 105, 240, 7, 8, 9,
2452 136, 137, 17, 139, 140, 89, 142, 143, 144, 19,
2453 20, 56, 22, 23, 24, 25, 26, 27, 511, 229,
2454 421, -1, -1, 547, -1, -1, -1, -1, -1, -1,
2455 40, 41, 91, 92, 93, 94, 95, 96, 97, 98,
2456 99, 100, -1, 53, 568, 569, 7, 8, 58, 10,
2457 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2458 584, 22, 23, 24, 74, 75, 76, 77, 78, 79,
2459 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2460 90, -1, -1, -1, -1, -1, 610, 611, 49, -1,
2461 -1, 615, 156, 157, 618, -1, 160, -1, 162, 163,
2462 624, -1, -1, 627, -1, -1, 116, 117, 118, 119,
2463 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
2464 130, -1, 132, 133, 134, -1, 136, 137, -1, 139,
2465 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
2466 8, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2467 160, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2468 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2469 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2470 -1, -1, -1, -1, -1, -1, 54, -1, -1, -1,
2471 58, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2472 -1, 162, 163, -1, -1, -1, 74, 75, 76, 77,
2473 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2474 88, 89, 90, -1, -1, 7, 8, -1, 10, 11,
2475 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2476 22, 23, 24, 26, 27, -1, -1, -1, 116, 117,
2477 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2478 128, -1, 130, -1, 132, 133, 134, 49, -1, -1,
2479 -1, -1, -1, -1, 3, 4, -1, -1, 7, 8,
2480 9, -1, -1, 151, -1, -1, -1, -1, -1, -1,
2481 19, 20, 160, 22, 23, 24, 25, 26, 27, -1,
2482 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2483 -1, 40, 41, 0, 97, 98, 99, 100, 101, 102,
2484 103, 104, 105, 106, 107, 108, 109, 110, -1, 58,
2485 -1, 18, 19, 20, -1, 22, 23, 24, -1, -1,
2486 -1, -1, -1, 30, 31, 74, 75, 76, 77, 78,
2487 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2488 89, 90, -1, -1, 51, -1, -1, -1, 55, -1,
2489 -1, -1, 59, -1, 156, 157, -1, -1, 160, -1,
2490 162, 163, -1, -1, -1, -1, -1, 116, 117, 118,
2491 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2492 -1, 130, -1, 132, 133, 134, 7, 8, -1, -1,
2493 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2494 -1, 22, 23, 24, 25, -1, -1, -1, -1, -1,
2495 -1, 160, -1, -1, -1, -1, -1, -1, -1, 40,
2496 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2497 -1, 7, 8, 54, 10, 11, 12, 13, 14, 15,
2498 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2499 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2500 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2501 -1, -1, -1, 49, -1, -1, 7, 8, -1, 10,
2502 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2503 -1, 22, 23, 24, -1, 116, 117, 118, 119, 120,
2504 121, 122, 123, 124, 125, 126, 127, 128, 39, 130,
2505 -1, 132, 133, 134, -1, -1, -1, -1, 49, -1,
2506 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2507 151, -1, 7, 8, 155, -1, 157, -1, -1, 160,
2508 -1, 162, -1, 164, 19, 20, 122, 22, 23, 24,
2509 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2510 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2511 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2512 156, 157, -1, -1, 160, -1, 162, -1, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2514 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2515 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2516 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2517 -1, 162, -1, -1, -1, -1, -1, -1, -1, -1,
2518 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2519 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
2520 -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2521 -1, -1, -1, -1, 9, -1, 151, -1, -1, -1,
2522 -1, -1, 157, -1, -1, 160, -1, 162, -1, 164,
2523 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2524 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2525 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2526 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1,
2527 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2528 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2529 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2530 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2531 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2532 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2533 125, 126, 127, 128, 39, 130, -1, 132, 133, 134,
2534 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2535 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2536 -1, -1, -1, 7, 8, 160, 10, 11, 12, 13,
2537 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2538 24, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2539 -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
2540 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
2541 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2542 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2543 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
2544 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2545 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2546 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2547 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2548 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2549 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2550 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
2551 -1, -1, 156, 157, -1, -1, 160, -1, 162, 7,
2552 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2553 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2554 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2555 -1, -1, 156, 157, -1, -1, 160, -1, 162, -1,
2556 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
2557 156, 157, -1, -1, 160, -1, 162, 7, 8, -1,
2558 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2559 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2560 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2561 156, 157, -1, -1, 160, -1, 162, 7, 8, 49,
2562 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2563 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2564 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2565 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2566 -1, -1, -1, -1, -1, -1, -1, -1, 156, 157,
2567 -1, -1, 160, -1, 162, 7, 8, 49, 10, 11,
2568 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2569 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
2570 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2571 24, -1, -1, -1, -1, 19, -1, 49, 22, -1,
2572 24, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2573 160, -1, 162, -1, -1, 49, -1, -1, -1, -1,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
2575 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2576 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2577 160, -1, 162, -1, -1, -1, -1, -1, -1, -1,
2578 -1, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2579 162, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2581 -1, -1, -1, -1, 118, 119, -1, -1, -1, -1,
2582 -1, -1, -1, -1, 156, 157, -1, -1, 160, 36,
2583 162, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2584 144, -1, 156, 157, -1, -1, 160, -1, 162, 56,
2585 57, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2586 -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2587 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2588 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
2589 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2590 -1, -1, -1, -1, 111, 112, 113, -1, -1, 116,
2591 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2592 127, 128, 129, 130, 131, 132, 133, 134, 135
2595 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2596 symbol of state STATE-NUM. */
2597 static const yytype_uint8 yystos[] =
2599 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2600 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2601 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2602 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2603 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
2604 43, 44, 47, 184, 227, 229, 237, 153, 153, 157,
2605 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2606 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2607 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
2608 21, 238, 239, 29, 163, 228, 238, 22, 22, 22,
2609 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2610 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2611 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
2612 176, 242, 154, 159, 39, 199, 200, 202, 203, 158,
2613 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2614 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2615 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
2616 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2617 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2618 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2619 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2620 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
2621 167, 168, 240, 246, 247, 248, 249, 22, 188, 154,
2622 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2623 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2624 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2625 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
2626 56, 10, 199, 235, 236, 11, 17, 11, 171, 186,
2627 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2628 169, 26, 27, 97, 98, 99, 100, 101, 102, 103,
2629 104, 105, 106, 107, 108, 109, 110, 170, 199, 199,
2630 235, 199, 199, 243, 235, 235, 235, 235, 235, 199,
2631 199, 199, 235, 186, 114, 115, 53, 118, 119, 136,
2632 137, 139, 140, 142, 143, 144, 187, 39, 200, 190,
2633 159, 161, 161, 152, 190, 175, 175, 210, 169, 170,
2634 151, 151, 151, 151, 151, 159, 205, 207, 162, 207,
2635 163, 207, 22, 151, 151, 151, 216, 151, 3, 4,
2636 9, 25, 26, 27, 40, 41, 58, 160, 206, 232,
2637 233, 234, 154, 234, 234, 234, 201, 199, 199, 154,
2638 193, 154, 193, 234, 157, 154, 154, 154, 154, 154,
2639 154, 173, 234, 234, 38, 201, 199, 235, 4, 136,
2640 137, 138, 141, 145, 146, 189, 217, 218, 38, 151,
2641 151, 205, 205, 205, 205, 205, 154, 159, 163, 199,
2642 207, 161, 163, 205, 205, 205, 154, 196, 39, 199,
2643 223, 224, 60, 231, 207, 205, 154, 154, 234, 234,
2644 234, 11, 53, 11, 245, 234, 157, 235, 199, 235,
2645 235, 235, 154, 154, 154, 199, 234, 234, 154, 196,
2646 196, 199, 205, 205, 245, 154, 154, 154, 154, 205,
2647 161, 163, 154, 154, 38, 34, 53, 194, 197, 188,
2648 154, 152, 22, 161, 17, 17, 151, 154, 154, 234,
2649 4, 234, 154, 154, 234, 154, 154, 154, 4, 234,
2650 234, 151, 154, 193, 199, 152, 154, 154, 152, 205,
2651 205, 205, 205, 161, 205, 205, 199, 22, 4, 196,
2652 173, 174, 39, 199, 190, 154, 234, 234, 17, 199,
2653 244, 234, 234, 193, 193, 235, 234, 154, 235, 235,
2654 235, 244, 234, 205, 205, 154, 152, 154, 154, 152,
2655 152, 152, 188, 194, 195, 22, 154, 157, 188, 188,
2656 152, 154, 159, 234, 152, 193, 152, 152, 205, 205,
2657 205, 174, 53, 192, 17, 159, 171, 241, 118, 119,
2658 234, 234, 190, 17, 199, 159, 190, 152, 152, 152,
2659 4, 147, 191, 234, 232, 159, 171, 188, 188, 38,
2660 188, 188, 22, 154, 232, 17, 234, 234, 17, 154,
2661 234, 188, 188, 234, 17, 72, 234, 17, 234
2664 #define yyerrok (yyerrstatus = 0)
2665 #define yyclearin (yychar = YYEMPTY)
2666 #define YYEMPTY (-2)
2669 #define YYACCEPT goto yyacceptlab
2670 #define YYABORT goto yyabortlab
2671 #define YYERROR goto yyerrorlab
2674 /* Like YYERROR except do call yyerror. This remains here temporarily
2675 to ease the transition to the new meaning of YYERROR, for GCC.
2676 Once GCC version 2 has supplanted version 1, this can go. */
2678 #define YYFAIL goto yyerrlab
2680 #define YYRECOVERING() (!!yyerrstatus)
2682 #define YYBACKUP(Token, Value) \
2684 if (yychar == YYEMPTY && yylen == 1) \
2688 yytoken = YYTRANSLATE (yychar); \
2694 yyerror (YY_("syntax error: cannot back up")); \
2701 #define YYERRCODE 256
2704 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2705 If N is 0, then set CURRENT to the empty location which ends
2706 the previous symbol: RHS[0] (always defined). */
2708 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2709 #ifndef YYLLOC_DEFAULT
2710 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2714 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2715 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2716 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2717 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2721 (Current).first_line = (Current).last_line = \
2722 YYRHSLOC (Rhs, 0).last_line; \
2723 (Current).first_column = (Current).last_column = \
2724 YYRHSLOC (Rhs, 0).last_column; \
2730 /* YY_LOCATION_PRINT -- Print the location on the stream.
2731 This macro was not mandated originally: define only if we know
2732 we won't break user code: when these are the locations we know. */
2734 #ifndef YY_LOCATION_PRINT
2735 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2736 # define YY_LOCATION_PRINT(File, Loc) \
2737 fprintf (File, "%d.%d-%d.%d", \
2738 (Loc).first_line, (Loc).first_column, \
2739 (Loc).last_line, (Loc).last_column)
2741 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2746 /* YYLEX -- calling `yylex' with the right arguments. */
2749 # define YYLEX yylex (YYLEX_PARAM)
2751 # define YYLEX yylex ()
2754 /* Enable debugging if requested. */
2758 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2759 # define YYFPRINTF fprintf
2762 # define YYDPRINTF(Args) \
2768 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2772 YYFPRINTF (stderr, "%s ", Title); \
2773 yy_symbol_print (stderr, \
2775 YYFPRINTF (stderr, "\n"); \
2780 /*--------------------------------.
2781 | Print this symbol on YYOUTPUT. |
2782 `--------------------------------*/
2785 #if (defined __STDC__ || defined __C99__FUNC__ \
2786 || defined __cplusplus || defined _MSC_VER)
2788 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2791 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2794 YYSTYPE const * const yyvaluep;
2800 if (yytype < YYNTOKENS)
2801 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2813 /*--------------------------------.
2814 | Print this symbol on YYOUTPUT. |
2815 `--------------------------------*/
2817 #if (defined __STDC__ || defined __C99__FUNC__ \
2818 || defined __cplusplus || defined _MSC_VER)
2820 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2823 yy_symbol_print (yyoutput, yytype, yyvaluep)
2826 YYSTYPE const * const yyvaluep;
2829 if (yytype < YYNTOKENS)
2830 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2832 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2834 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2835 YYFPRINTF (yyoutput, ")");
2838 /*------------------------------------------------------------------.
2839 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2841 `------------------------------------------------------------------*/
2843 #if (defined __STDC__ || defined __C99__FUNC__ \
2844 || defined __cplusplus || defined _MSC_VER)
2846 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2849 yy_stack_print (bottom, top)
2850 yytype_int16 *bottom;
2854 YYFPRINTF (stderr, "Stack now");
2855 for (; bottom <= top; ++bottom)
2856 YYFPRINTF (stderr, " %d", *bottom);
2857 YYFPRINTF (stderr, "\n");
2860 # define YY_STACK_PRINT(Bottom, Top) \
2863 yy_stack_print ((Bottom), (Top)); \
2867 /*------------------------------------------------.
2868 | Report that the YYRULE is going to be reduced. |
2869 `------------------------------------------------*/
2871 #if (defined __STDC__ || defined __C99__FUNC__ \
2872 || defined __cplusplus || defined _MSC_VER)
2874 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2877 yy_reduce_print (yyvsp, yyrule)
2882 int yynrhs = yyr2[yyrule];
2884 unsigned long int yylno = yyrline[yyrule];
2885 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2887 /* The symbols being reduced. */
2888 for (yyi = 0; yyi < yynrhs; yyi++)
2890 fprintf (stderr, " $%d = ", yyi + 1);
2891 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2892 &(yyvsp[(yyi + 1) - (yynrhs)])
2894 fprintf (stderr, "\n");
2898 # define YY_REDUCE_PRINT(Rule) \
2901 yy_reduce_print (yyvsp, Rule); \
2904 /* Nonzero means print parse trace. It is left uninitialized so that
2905 multiple parsers can coexist. */
2907 #else /* !YYDEBUG */
2908 # define YYDPRINTF(Args)
2909 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2910 # define YY_STACK_PRINT(Bottom, Top)
2911 # define YY_REDUCE_PRINT(Rule)
2912 #endif /* !YYDEBUG */
2915 /* YYINITDEPTH -- initial size of the parser's stacks. */
2917 # define YYINITDEPTH 200
2920 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2921 if the built-in stack extension method is used).
2923 Do not make this value too large; the results are undefined if
2924 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2925 evaluated with infinite-precision integer arithmetic. */
2928 # define YYMAXDEPTH 10000
2936 # if defined __GLIBC__ && defined _STRING_H
2937 # define yystrlen strlen
2939 /* Return the length of YYSTR. */
2940 #if (defined __STDC__ || defined __C99__FUNC__ \
2941 || defined __cplusplus || defined _MSC_VER)
2943 yystrlen (const char *yystr)
2951 for (yylen = 0; yystr[yylen]; yylen++)
2959 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2960 # define yystpcpy stpcpy
2962 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2964 #if (defined __STDC__ || defined __C99__FUNC__ \
2965 || defined __cplusplus || defined _MSC_VER)
2967 yystpcpy (char *yydest, const char *yysrc)
2970 yystpcpy (yydest, yysrc)
2976 const char *yys = yysrc;
2978 while ((*yyd++ = *yys++) != '\0')
2987 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2988 quotes and backslashes, so that it's suitable for yyerror. The
2989 heuristic is that double-quoting is unnecessary unless the string
2990 contains an apostrophe, a comma, or backslash (other than
2991 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2992 null, do not copy; instead, return the length of what the result
2995 yytnamerr (char *yyres, const char *yystr)
3000 char const *yyp = yystr;
3007 goto do_not_strip_quotes;
3011 goto do_not_strip_quotes;
3024 do_not_strip_quotes: ;
3028 return yystrlen (yystr);
3030 return yystpcpy (yyres, yystr) - yyres;
3034 /* Copy into YYRESULT an error message about the unexpected token
3035 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3036 including the terminating null byte. If YYRESULT is null, do not
3037 copy anything; just return the number of bytes that would be
3038 copied. As a special case, return 0 if an ordinary "syntax error"
3039 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3040 size calculation. */
3042 yysyntax_error (char *yyresult, int yystate, int yychar)
3044 int yyn = yypact[yystate];
3046 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3050 int yytype = YYTRANSLATE (yychar);
3051 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3052 YYSIZE_T yysize = yysize0;
3054 int yysize_overflow = 0;
3055 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3056 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3060 /* This is so xgettext sees the translatable formats that are
3061 constructed on the fly. */
3062 YY_("syntax error, unexpected %s");
3063 YY_("syntax error, unexpected %s, expecting %s");
3064 YY_("syntax error, unexpected %s, expecting %s or %s");
3065 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3066 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3070 static char const yyunexpected[] = "syntax error, unexpected %s";
3071 static char const yyexpecting[] = ", expecting %s";
3072 static char const yyor[] = " or %s";
3073 char yyformat[sizeof yyunexpected
3074 + sizeof yyexpecting - 1
3075 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3076 * (sizeof yyor - 1))];
3077 char const *yyprefix = yyexpecting;
3079 /* Start YYX at -YYN if negative to avoid negative indexes in
3081 int yyxbegin = yyn < 0 ? -yyn : 0;
3083 /* Stay within bounds of both yycheck and yytname. */
3084 int yychecklim = YYLAST - yyn + 1;
3085 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3088 yyarg[0] = yytname[yytype];
3089 yyfmt = yystpcpy (yyformat, yyunexpected);
3091 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3092 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3094 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3098 yyformat[sizeof yyunexpected - 1] = '\0';
3101 yyarg[yycount++] = yytname[yyx];
3102 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3103 yysize_overflow |= (yysize1 < yysize);
3105 yyfmt = yystpcpy (yyfmt, yyprefix);
3109 yyf = YY_(yyformat);
3110 yysize1 = yysize + yystrlen (yyf);
3111 yysize_overflow |= (yysize1 < yysize);
3114 if (yysize_overflow)
3115 return YYSIZE_MAXIMUM;
3119 /* Avoid sprintf, as that infringes on the user's name space.
3120 Don't have undefined behavior even if the translation
3121 produced a string with the wrong number of "%s"s. */
3122 char *yyp = yyresult;
3124 while ((*yyp = *yyf) != '\0')
3126 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3128 yyp += yytnamerr (yyp, yyarg[yyi++]);
3141 #endif /* YYERROR_VERBOSE */
3144 /*-----------------------------------------------.
3145 | Release the memory associated to this symbol. |
3146 `-----------------------------------------------*/
3149 #if (defined __STDC__ || defined __C99__FUNC__ \
3150 || defined __cplusplus || defined _MSC_VER)
3152 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3155 yydestruct (yymsg, yytype, yyvaluep)
3165 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3176 /* Prevent warnings from -Wmissing-prototypes. */
3178 #ifdef YYPARSE_PARAM
3179 #if defined __STDC__ || defined __cplusplus
3180 int yyparse (void *YYPARSE_PARAM);
3184 #else /* ! YYPARSE_PARAM */
3185 #if defined __STDC__ || defined __cplusplus
3190 #endif /* ! YYPARSE_PARAM */
3194 /* The look-ahead symbol. */
3197 /* The semantic value of the look-ahead symbol. */
3200 /* Number of syntax errors so far. */
3209 #ifdef YYPARSE_PARAM
3210 #if (defined __STDC__ || defined __C99__FUNC__ \
3211 || defined __cplusplus || defined _MSC_VER)
3213 yyparse (void *YYPARSE_PARAM)
3216 yyparse (YYPARSE_PARAM)
3217 void *YYPARSE_PARAM;
3219 #else /* ! YYPARSE_PARAM */
3220 #if (defined __STDC__ || defined __C99__FUNC__ \
3221 || defined __cplusplus || defined _MSC_VER)
3235 /* Number of tokens to shift before error messages enabled. */
3237 /* Look-ahead token as an internal (translated) token number. */
3240 /* Buffer for error messages, and its allocated size. */
3242 char *yymsg = yymsgbuf;
3243 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3246 /* Three stacks and their tools:
3247 `yyss': related to states,
3248 `yyvs': related to semantic values,
3249 `yyls': related to locations.
3251 Refer to the stacks thru separate pointers, to allow yyoverflow
3252 to reallocate them elsewhere. */
3254 /* The state stack. */
3255 yytype_int16 yyssa[YYINITDEPTH];
3256 yytype_int16 *yyss = yyssa;
3257 yytype_int16 *yyssp;
3259 /* The semantic value stack. */
3260 YYSTYPE yyvsa[YYINITDEPTH];
3261 YYSTYPE *yyvs = yyvsa;
3266 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3268 YYSIZE_T yystacksize = YYINITDEPTH;
3270 /* The variables used to return semantic value and location from the
3275 /* The number of symbols on the RHS of the reduced rule.
3276 Keep to zero when no symbol should be popped. */
3279 YYDPRINTF ((stderr, "Starting parse\n"));
3284 yychar = YYEMPTY; /* Cause a token to be read. */
3286 /* Initialize stack pointers.
3287 Waste one element of value and location stack
3288 so that they stay on the same level as the state stack.
3289 The wasted elements are never initialized. */
3296 /*------------------------------------------------------------.
3297 | yynewstate -- Push a new state, which is found in yystate. |
3298 `------------------------------------------------------------*/
3300 /* In all cases, when you get here, the value and location stacks
3301 have just been pushed. So pushing a state here evens the stacks. */
3307 if (yyss + yystacksize - 1 <= yyssp)
3309 /* Get the current used size of the three stacks, in elements. */
3310 YYSIZE_T yysize = yyssp - yyss + 1;
3314 /* Give user a chance to reallocate the stack. Use copies of
3315 these so that the &'s don't force the real ones into
3317 YYSTYPE *yyvs1 = yyvs;
3318 yytype_int16 *yyss1 = yyss;
3321 /* Each stack pointer address is followed by the size of the
3322 data in use in that stack, in bytes. This used to be a
3323 conditional around just the two extra args, but that might
3324 be undefined if yyoverflow is a macro. */
3325 yyoverflow (YY_("memory exhausted"),
3326 &yyss1, yysize * sizeof (*yyssp),
3327 &yyvs1, yysize * sizeof (*yyvsp),
3334 #else /* no yyoverflow */
3335 # ifndef YYSTACK_RELOCATE
3336 goto yyexhaustedlab;
3338 /* Extend the stack our own way. */
3339 if (YYMAXDEPTH <= yystacksize)
3340 goto yyexhaustedlab;
3342 if (YYMAXDEPTH < yystacksize)
3343 yystacksize = YYMAXDEPTH;
3346 yytype_int16 *yyss1 = yyss;
3347 union yyalloc *yyptr =
3348 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3350 goto yyexhaustedlab;
3351 YYSTACK_RELOCATE (yyss);
3352 YYSTACK_RELOCATE (yyvs);
3354 # undef YYSTACK_RELOCATE
3356 YYSTACK_FREE (yyss1);
3359 #endif /* no yyoverflow */
3361 yyssp = yyss + yysize - 1;
3362 yyvsp = yyvs + yysize - 1;
3365 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3366 (unsigned long int) yystacksize));
3368 if (yyss + yystacksize - 1 <= yyssp)
3372 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3381 /* Do appropriate processing given the current state. Read a
3382 look-ahead token if we need one and don't already have one. */
3384 /* First try to decide what to do without reference to look-ahead token. */
3385 yyn = yypact[yystate];
3386 if (yyn == YYPACT_NINF)
3389 /* Not known => get a look-ahead token if don't already have one. */
3391 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3392 if (yychar == YYEMPTY)
3394 YYDPRINTF ((stderr, "Reading a token: "));
3398 if (yychar <= YYEOF)
3400 yychar = yytoken = YYEOF;
3401 YYDPRINTF ((stderr, "Now at end of input.\n"));
3405 yytoken = YYTRANSLATE (yychar);
3406 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3409 /* If the proper action on seeing token YYTOKEN is to reduce or to
3410 detect an error, take that action. */
3412 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3417 if (yyn == 0 || yyn == YYTABLE_NINF)
3426 /* Count tokens shifted since error; after three, turn off error
3431 /* Shift the look-ahead token. */
3432 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3434 /* Discard the shifted token unless it is eof. */
3435 if (yychar != YYEOF)
3444 /*-----------------------------------------------------------.
3445 | yydefault -- do the default action for the current state. |
3446 `-----------------------------------------------------------*/
3448 yyn = yydefact[yystate];
3454 /*-----------------------------.
3455 | yyreduce -- Do a reduction. |
3456 `-----------------------------*/
3458 /* yyn is the number of a rule to reduce with. */
3461 /* If YYLEN is nonzero, implement the default value of the action:
3464 Otherwise, the following line sets YYVAL to garbage.
3465 This behavior is undocumented and Bison
3466 users should not rely upon it. Assigning to YYVAL
3467 unconditionally makes the parser a bit smaller, and it avoids a
3468 GCC warning that YYVAL may be used uninitialized. */
3469 yyval = yyvsp[1-yylen];
3472 YY_REDUCE_PRINT (yyn);
3476 #line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3477 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3481 #line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3482 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3486 #line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3487 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3491 #line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3492 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3496 #line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3497 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3501 #line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3502 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3506 #line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3507 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3511 #line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3512 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3516 #line 1124 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3517 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3521 #line 1124 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3522 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3526 #line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3527 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3531 #line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3532 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3536 #line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3537 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3541 #line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3542 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3546 #line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3547 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3551 #line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3552 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3556 #line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3557 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3561 #line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3562 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3566 #line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3567 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3571 #line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3572 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3576 #line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3577 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3581 #line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3582 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3586 #line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3587 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3591 #line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3592 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3596 #line 1135 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3597 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3601 #line 1136 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3602 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3606 #line 1145 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3607 { (yyval.StrVal) = 0; ;}
3611 #line 1147 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3612 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3616 #line 1148 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3617 { (yyval.UIntVal)=0; ;}
3621 #line 1152 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3623 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3629 #line 1156 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3637 #line 1164 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3645 #line 1169 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3647 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3653 #line 1175 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3654 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3658 #line 1176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3659 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3663 #line 1177 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3664 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3668 #line 1178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3669 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3673 #line 1179 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3674 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3678 #line 1183 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3679 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3683 #line 1184 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3684 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3688 #line 1185 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3689 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3693 #line 1189 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3694 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3698 #line 1190 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3699 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3703 #line 1191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3704 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3708 #line 1192 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3709 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3713 #line 1196 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3714 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3718 #line 1197 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3719 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3723 #line 1198 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3724 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3728 #line 1202 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3729 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3733 #line 1203 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3734 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3738 #line 1204 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3739 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3743 #line 1205 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3744 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3748 #line 1206 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3749 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3753 #line 1210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3754 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3758 #line 1211 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3759 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3763 #line 1212 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3764 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3768 #line 1215 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3769 { (yyval.UIntVal) = CallingConv::C; ;}
3773 #line 1216 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3774 { (yyval.UIntVal) = CallingConv::C; ;}
3778 #line 1217 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3779 { (yyval.UIntVal) = CallingConv::Fast; ;}
3783 #line 1218 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3784 { (yyval.UIntVal) = CallingConv::Cold; ;}
3788 #line 1219 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3789 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3793 #line 1220 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3794 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3798 #line 1221 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3800 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3801 GEN_ERROR("Calling conv too large");
3802 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3808 #line 1228 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3809 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3813 #line 1229 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3814 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3818 #line 1230 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3819 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3823 #line 1231 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3824 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3828 #line 1232 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3829 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3833 #line 1233 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3834 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3838 #line 1234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3839 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3843 #line 1235 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3844 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3848 #line 1236 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3849 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3853 #line 1237 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3854 { (yyval.ParamAttrs) = (yyvsp[(2) - (2)].UInt64Val) << 16; ;}
3858 #line 1240 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3859 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3863 #line 1241 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3865 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3870 #line 1246 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3871 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3875 #line 1247 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3876 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3880 #line 1248 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3881 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3885 #line 1249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3886 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3890 #line 1250 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3891 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3895 #line 1251 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3896 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3900 #line 1254 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3901 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3905 #line 1255 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3907 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3912 #line 1260 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3913 { (yyval.StrVal) = 0; ;}
3917 #line 1261 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3919 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3924 #line 1268 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3925 { (yyval.UIntVal) = 0; ;}
3929 #line 1269 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3931 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3932 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3933 GEN_ERROR("Alignment must be a power of two");
3939 #line 1275 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3940 { (yyval.UIntVal) = 0; ;}
3944 #line 1276 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3946 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3947 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3948 GEN_ERROR("Alignment must be a power of two");
3954 #line 1285 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3956 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3957 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3958 GEN_ERROR("Invalid character in section name");
3959 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3965 #line 1293 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3966 { (yyval.StrVal) = 0; ;}
3970 #line 1294 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3971 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3975 #line 1299 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3980 #line 1300 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3985 #line 1301 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3987 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3988 delete (yyvsp[(1) - (1)].StrVal);
3994 #line 1306 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3996 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3997 GEN_ERROR("Alignment must be a power of two");
3998 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4004 #line 1322 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4006 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4012 #line 1326 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4014 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4020 #line 1330 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4022 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4023 GEN_ERROR("Cannot form a pointer to a basic block");
4024 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4025 delete (yyvsp[(1) - (3)].TypeVal);
4031 #line 1337 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4032 { // Named types are also simple types...
4033 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4035 (yyval.TypeVal) = new PATypeHolder(tmp);
4040 #line 1342 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4041 { // Type UpReference
4042 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4043 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4044 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4045 (yyval.TypeVal) = new PATypeHolder(OT);
4046 UR_OUT("New Upreference!\n");
4052 #line 1350 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4054 // Allow but ignore attributes on function types; this permits auto-upgrade.
4055 // FIXME: remove in LLVM 3.0.
4056 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
4057 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4058 isa<OpaqueType>(RetTy)))
4059 GEN_ERROR("LLVM Functions cannot return aggregates");
4061 std::vector<const Type*> Params;
4062 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4063 for (; I != E; ++I ) {
4064 const Type *Ty = I->Ty->get();
4065 Params.push_back(Ty);
4068 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4069 if (isVarArg) Params.pop_back();
4071 for (unsigned i = 0; i != Params.size(); ++i)
4072 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4073 GEN_ERROR("Function arguments must be value types!");
4077 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4078 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4079 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4080 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4086 #line 1380 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4088 // Allow but ignore attributes on function types; this permits auto-upgrade.
4089 // FIXME: remove in LLVM 3.0.
4090 std::vector<const Type*> Params;
4091 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4092 for ( ; I != E; ++I ) {
4093 const Type* Ty = I->Ty->get();
4094 Params.push_back(Ty);
4097 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4098 if (isVarArg) Params.pop_back();
4100 for (unsigned i = 0; i != Params.size(); ++i)
4101 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4102 GEN_ERROR("Function arguments must be value types!");
4106 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4107 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4108 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4114 #line 1405 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4115 { // Sized array type?
4116 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4117 delete (yyvsp[(4) - (5)].TypeVal);
4123 #line 1410 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4125 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4126 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4127 GEN_ERROR("Unsigned result not equal to signed result");
4128 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4129 GEN_ERROR("Element type of a VectorType must be primitive");
4130 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4131 delete (yyvsp[(4) - (5)].TypeVal);
4137 #line 1420 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4138 { // Structure type?
4139 std::vector<const Type*> Elements;
4140 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4141 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4142 Elements.push_back(*I);
4144 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4145 delete (yyvsp[(2) - (3)].TypeList);
4151 #line 1430 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4152 { // Empty structure type?
4153 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4159 #line 1434 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4161 std::vector<const Type*> Elements;
4162 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4163 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4164 Elements.push_back(*I);
4166 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4167 delete (yyvsp[(3) - (5)].TypeList);
4173 #line 1444 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4174 { // Empty structure type?
4175 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4181 #line 1451 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4183 // Allow but ignore attributes on function types; this permits auto-upgrade.
4184 // FIXME: remove in LLVM 3.0.
4185 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4186 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4191 #line 1460 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4193 if (!UpRefs.empty())
4194 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4195 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && (*(yyvsp[(1) - (1)].TypeVal))->getTypeID() != Type::StructTyID)
4196 GEN_ERROR("LLVM functions cannot return aggregate types");
4197 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4202 #line 1467 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4204 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4209 #line 1472 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4211 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4212 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4218 #line 1477 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4220 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4226 #line 1485 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4228 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4229 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4230 TWA.Ty = new PATypeHolder(Type::VoidTy);
4231 (yyval.TypeWithAttrsList)->push_back(TWA);
4237 #line 1492 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4239 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4240 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4241 TWA.Ty = new PATypeHolder(Type::VoidTy);
4242 (yyval.TypeWithAttrsList)->push_back(TWA);
4248 #line 1499 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4250 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4256 #line 1507 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4258 (yyval.TypeList) = new std::list<PATypeHolder>();
4259 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4260 delete (yyvsp[(1) - (1)].TypeVal);
4266 #line 1513 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4268 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4269 delete (yyvsp[(3) - (3)].TypeVal);
4275 #line 1525 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4276 { // Nonempty unsized arr
4277 if (!UpRefs.empty())
4278 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4279 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4281 GEN_ERROR("Cannot make array constant with type: '" +
4282 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4283 const Type *ETy = ATy->getElementType();
4284 int NumElements = ATy->getNumElements();
4286 // Verify that we have the correct size...
4287 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4288 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4289 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4290 itostr(NumElements) + "");
4292 // Verify all elements are correct type!
4293 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4294 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4295 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4296 ETy->getDescription() +"' as required!\nIt is of type '"+
4297 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4300 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4301 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4307 #line 1553 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4309 if (!UpRefs.empty())
4310 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4311 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4313 GEN_ERROR("Cannot make array constant with type: '" +
4314 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4316 int NumElements = ATy->getNumElements();
4317 if (NumElements != -1 && NumElements != 0)
4318 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4319 " arguments, but has size of " + itostr(NumElements) +"");
4320 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4321 delete (yyvsp[(1) - (3)].TypeVal);
4327 #line 1569 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4329 if (!UpRefs.empty())
4330 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4331 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4333 GEN_ERROR("Cannot make array constant with type: '" +
4334 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4336 int NumElements = ATy->getNumElements();
4337 const Type *ETy = ATy->getElementType();
4338 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4339 GEN_ERROR("Can't build string constant of size " +
4340 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4341 " when array has size " + itostr(NumElements) + "");
4342 std::vector<Constant*> Vals;
4343 if (ETy == Type::Int8Ty) {
4344 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4345 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4347 delete (yyvsp[(3) - (3)].StrVal);
4348 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4350 delete (yyvsp[(3) - (3)].StrVal);
4351 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4352 delete (yyvsp[(1) - (3)].TypeVal);
4358 #line 1596 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4359 { // Nonempty unsized arr
4360 if (!UpRefs.empty())
4361 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4362 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4364 GEN_ERROR("Cannot make packed constant with type: '" +
4365 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4366 const Type *ETy = PTy->getElementType();
4367 int NumElements = PTy->getNumElements();
4369 // Verify that we have the correct size...
4370 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4371 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4372 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4373 itostr(NumElements) + "");
4375 // Verify all elements are correct type!
4376 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4377 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4378 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4379 ETy->getDescription() +"' as required!\nIt is of type '"+
4380 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4383 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4384 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4390 #line 1624 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4392 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4394 GEN_ERROR("Cannot make struct constant with type: '" +
4395 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4397 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4398 GEN_ERROR("Illegal number of initializers for structure type");
4400 // Check to ensure that constants are compatible with the type initializer!
4401 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4402 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4403 GEN_ERROR("Expected type '" +
4404 STy->getElementType(i)->getDescription() +
4405 "' for element #" + utostr(i) +
4406 " of structure initializer");
4408 // Check to ensure that Type is not packed
4409 if (STy->isPacked())
4410 GEN_ERROR("Unpacked Initializer to vector type '" +
4411 STy->getDescription() + "'");
4413 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4414 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4420 #line 1650 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4422 if (!UpRefs.empty())
4423 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4424 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4426 GEN_ERROR("Cannot make struct constant with type: '" +
4427 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4429 if (STy->getNumContainedTypes() != 0)
4430 GEN_ERROR("Illegal number of initializers for structure type");
4432 // Check to ensure that Type is not packed
4433 if (STy->isPacked())
4434 GEN_ERROR("Unpacked Initializer to vector type '" +
4435 STy->getDescription() + "'");
4437 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4438 delete (yyvsp[(1) - (3)].TypeVal);
4444 #line 1670 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4446 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4448 GEN_ERROR("Cannot make struct constant with type: '" +
4449 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4451 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4452 GEN_ERROR("Illegal number of initializers for structure type");
4454 // Check to ensure that constants are compatible with the type initializer!
4455 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4456 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4457 GEN_ERROR("Expected type '" +
4458 STy->getElementType(i)->getDescription() +
4459 "' for element #" + utostr(i) +
4460 " of structure initializer");
4462 // Check to ensure that Type is packed
4463 if (!STy->isPacked())
4464 GEN_ERROR("Vector initializer to non-vector type '" +
4465 STy->getDescription() + "'");
4467 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4468 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4474 #line 1696 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4476 if (!UpRefs.empty())
4477 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4478 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4480 GEN_ERROR("Cannot make struct constant with type: '" +
4481 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4483 if (STy->getNumContainedTypes() != 0)
4484 GEN_ERROR("Illegal number of initializers for structure type");
4486 // Check to ensure that Type is packed
4487 if (!STy->isPacked())
4488 GEN_ERROR("Vector initializer to non-vector type '" +
4489 STy->getDescription() + "'");
4491 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4492 delete (yyvsp[(1) - (5)].TypeVal);
4498 #line 1716 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4500 if (!UpRefs.empty())
4501 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4502 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4504 GEN_ERROR("Cannot make null pointer constant with type: '" +
4505 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4507 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4508 delete (yyvsp[(1) - (2)].TypeVal);
4514 #line 1728 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4516 if (!UpRefs.empty())
4517 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4518 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4519 delete (yyvsp[(1) - (2)].TypeVal);
4525 #line 1735 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4527 if (!UpRefs.empty())
4528 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4529 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4531 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4533 // ConstExprs can exist in the body of a function, thus creating
4534 // GlobalValues whenever they refer to a variable. Because we are in
4535 // the context of a function, getExistingVal will search the functions
4536 // symbol table instead of the module symbol table for the global symbol,
4537 // which throws things all off. To get around this, we just tell
4538 // getExistingVal that we are at global scope here.
4540 Function *SavedCurFn = CurFun.CurrentFunction;
4541 CurFun.CurrentFunction = 0;
4543 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4546 CurFun.CurrentFunction = SavedCurFn;
4548 // If this is an initializer for a constant pointer, which is referencing a
4549 // (currently) undefined variable, create a stub now that shall be replaced
4550 // in the future with the right type of variable.
4553 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4554 const PointerType *PT = cast<PointerType>(Ty);
4556 // First check to see if the forward references value is already created!
4557 PerModuleInfo::GlobalRefsType::iterator I =
4558 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4560 if (I != CurModule.GlobalRefs.end()) {
4561 V = I->second; // Placeholder already exists, use it...
4562 (yyvsp[(2) - (2)].ValIDVal).destroy();
4565 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4566 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4567 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4568 GEN_ERROR("Invalid reference to global");
4570 // Create the forward referenced global.
4572 if (const FunctionType *FTy =
4573 dyn_cast<FunctionType>(PT->getElementType())) {
4574 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4575 CurModule.CurrentModule);
4577 GV = new GlobalVariable(PT->getElementType(), false,
4578 GlobalValue::ExternalWeakLinkage, 0,
4579 Name, CurModule.CurrentModule);
4582 // Keep track of the fact that we have a forward ref to recycle it
4583 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4588 (yyval.ConstVal) = cast<GlobalValue>(V);
4589 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4595 #line 1801 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4597 if (!UpRefs.empty())
4598 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4599 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4600 GEN_ERROR("Mismatched types for constant expression: " +
4601 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4602 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4603 delete (yyvsp[(1) - (2)].TypeVal);
4609 #line 1811 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4611 if (!UpRefs.empty())
4612 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4613 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4614 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4615 GEN_ERROR("Cannot create a null initialized value of this type");
4616 (yyval.ConstVal) = Constant::getNullValue(Ty);
4617 delete (yyvsp[(1) - (2)].TypeVal);
4623 #line 1821 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4624 { // integral constants
4625 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4626 GEN_ERROR("Constant value doesn't fit in type");
4627 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4633 #line 1827 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4634 { // arbitrary precision integer constants
4635 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4636 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4637 GEN_ERROR("Constant value does not fit in type");
4639 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4640 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4641 delete (yyvsp[(2) - (2)].APIntVal);
4647 #line 1837 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4648 { // integral constants
4649 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4650 GEN_ERROR("Constant value doesn't fit in type");
4651 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4657 #line 1843 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4658 { // arbitrary precision integer constants
4659 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4660 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4661 GEN_ERROR("Constant value does not fit in type");
4663 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4664 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4665 delete (yyvsp[(2) - (2)].APIntVal);
4671 #line 1853 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4672 { // Boolean constants
4673 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4674 (yyval.ConstVal) = ConstantInt::getTrue();
4680 #line 1858 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4681 { // Boolean constants
4682 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4683 (yyval.ConstVal) = ConstantInt::getFalse();
4689 #line 1863 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4690 { // Floating point constants
4691 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4692 GEN_ERROR("Floating point constant invalid for type");
4693 // Lexer has no type info, so builds all float and double FP constants
4694 // as double. Fix this here. Long double is done right.
4695 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4696 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4697 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4698 delete (yyvsp[(2) - (2)].FPVal);
4704 #line 1876 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4706 if (!UpRefs.empty())
4707 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4708 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4709 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4710 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4711 GEN_ERROR("invalid cast opcode for cast from '" +
4712 Val->getType()->getDescription() + "' to '" +
4713 DestTy->getDescription() + "'");
4714 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4715 delete (yyvsp[(5) - (6)].TypeVal);
4720 #line 1888 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4722 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4723 GEN_ERROR("GetElementPtr requires a pointer operand");
4726 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4729 GEN_ERROR("Index list invalid for constant getelementptr");
4731 SmallVector<Constant*, 8> IdxVec;
4732 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4733 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4734 IdxVec.push_back(C);
4736 GEN_ERROR("Indices to constant getelementptr must be constants");
4738 delete (yyvsp[(4) - (5)].ValueList);
4740 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4746 #line 1910 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4748 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4749 GEN_ERROR("Select condition must be of boolean type");
4750 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4751 GEN_ERROR("Select operand types must match");
4752 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4758 #line 1918 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4760 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4761 GEN_ERROR("Binary operator types must match");
4763 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4768 #line 1924 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4770 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4771 GEN_ERROR("Logical operator types must match");
4772 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4773 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4774 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4775 GEN_ERROR("Logical operator requires integral operands");
4777 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4783 #line 1935 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4785 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4786 GEN_ERROR("icmp operand types must match");
4787 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4792 #line 1940 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4794 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4795 GEN_ERROR("fcmp operand types must match");
4796 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4801 #line 1945 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4803 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4804 GEN_ERROR("Invalid extractelement operands");
4805 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4811 #line 1951 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4813 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4814 GEN_ERROR("Invalid insertelement operands");
4815 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4821 #line 1957 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4823 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4824 GEN_ERROR("Invalid shufflevector operands");
4825 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4831 #line 1966 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4833 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4839 #line 1970 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4841 (yyval.ConstVector) = new std::vector<Constant*>();
4842 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4848 #line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4849 { (yyval.BoolVal) = false; ;}
4853 #line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4854 { (yyval.BoolVal) = true; ;}
4858 #line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4859 { (yyval.BoolVal) = true; ;}
4863 #line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4864 { (yyval.BoolVal) = false; ;}
4868 #line 1984 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4870 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4871 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4873 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4875 GEN_ERROR("Aliases can be created only to global values");
4877 (yyval.ConstVal) = Aliasee;
4879 delete (yyvsp[(1) - (2)].TypeVal);
4884 #line 1996 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4886 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4887 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4888 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4889 GEN_ERROR("invalid cast opcode for cast from '" +
4890 Val->getType()->getDescription() + "' to '" +
4891 DestTy->getDescription() + "'");
4893 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4895 delete (yyvsp[(5) - (6)].TypeVal);
4900 #line 2017 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4902 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4903 CurModule.ModuleDone();
4909 #line 2022 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4911 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4912 CurModule.ModuleDone();
4918 #line 2035 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4919 { CurFun.isDeclare = false; ;}
4923 #line 2035 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4925 CurFun.FunctionDone();
4931 #line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4932 { CurFun.isDeclare = true; ;}
4936 #line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4943 #line 2042 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4950 #line 2045 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4952 if (!UpRefs.empty())
4953 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4954 // Eagerly resolve types. This is not an optimization, this is a
4955 // requirement that is due to the fact that we could have this:
4957 // %list = type { %list * }
4958 // %list = type { %list * } ; repeated type decl
4960 // If types are not resolved eagerly, then the two types will not be
4961 // determined to be the same type!
4963 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4965 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4967 // If this is a named type that is not a redefinition, add it to the slot
4969 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4972 delete (yyvsp[(3) - (3)].TypeVal);
4978 #line 2069 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4980 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4982 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4984 // If this is a named type that is not a redefinition, add it to the slot
4986 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4993 #line 2081 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4995 /* "Externally Visible" Linkage */
4996 if ((yyvsp[(5) - (6)].ConstVal) == 0)
4997 GEN_ERROR("Global value initializer is not a constant");
4998 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
4999 (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));
5005 #line 2088 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5012 #line 2092 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5014 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5015 GEN_ERROR("Global value initializer is not a constant");
5016 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));
5022 #line 2097 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5029 #line 2101 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5031 if (!UpRefs.empty())
5032 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5033 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));
5035 delete (yyvsp[(6) - (7)].TypeVal);
5040 #line 2107 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5048 #line 2111 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5051 if ((yyvsp[(1) - (5)].StrVal)) {
5052 Name = *(yyvsp[(1) - (5)].StrVal);
5053 delete (yyvsp[(1) - (5)].StrVal);
5056 GEN_ERROR("Alias name cannot be empty");
5058 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5060 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5062 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5063 CurModule.CurrentModule);
5064 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5065 InsertValue(GA, CurModule.Values);
5068 // If there was a forward reference of this alias, resolve it now.
5072 ID = ValID::createGlobalName(Name);
5074 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5076 if (GlobalValue *FWGV =
5077 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5078 // Replace uses of the fwdref with the actual alias.
5079 FWGV->replaceAllUsesWith(GA);
5080 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5081 GV->eraseFromParent();
5083 cast<Function>(FWGV)->eraseFromParent();
5092 #line 2151 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5099 #line 2154 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5106 #line 2160 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5108 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5109 if (AsmSoFar.empty())
5110 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5112 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5113 delete (yyvsp[(1) - (1)].StrVal);
5119 #line 2170 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5121 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5122 delete (yyvsp[(3) - (3)].StrVal);
5127 #line 2174 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5129 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5130 delete (yyvsp[(3) - (3)].StrVal);
5135 #line 2181 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5137 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5138 delete (yyvsp[(3) - (3)].StrVal);
5144 #line 2186 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5146 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5147 delete (yyvsp[(1) - (1)].StrVal);
5153 #line 2191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5160 #line 2200 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5162 if (!UpRefs.empty())
5163 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5164 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5165 GEN_ERROR("void typed arguments are invalid");
5166 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5167 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5168 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5174 #line 2210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5176 if (!UpRefs.empty())
5177 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5178 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5179 GEN_ERROR("void typed arguments are invalid");
5180 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5181 (yyval.ArgList) = new ArgListType;
5182 (yyval.ArgList)->push_back(E);
5188 #line 2221 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5190 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5196 #line 2225 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5198 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5199 struct ArgListEntry E;
5200 E.Ty = new PATypeHolder(Type::VoidTy);
5202 E.Attrs = ParamAttr::None;
5203 (yyval.ArgList)->push_back(E);
5209 #line 2234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5211 (yyval.ArgList) = new ArgListType;
5212 struct ArgListEntry E;
5213 E.Ty = new PATypeHolder(Type::VoidTy);
5215 E.Attrs = ParamAttr::None;
5216 (yyval.ArgList)->push_back(E);
5222 #line 2243 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5224 (yyval.ArgList) = 0;
5230 #line 2249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5232 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5233 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5235 // Check the function result for abstractness if this is a define. We should
5236 // have no abstract types at this point
5237 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5238 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5240 std::vector<const Type*> ParamTypeList;
5241 ParamAttrsVector Attrs;
5242 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
5243 ParamAttrsWithIndex PAWI;
5245 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
5246 Attrs.push_back(PAWI);
5248 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5250 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5251 const Type* Ty = I->Ty->get();
5252 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5253 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5254 ParamTypeList.push_back(Ty);
5255 if (Ty != Type::VoidTy)
5256 if (I->Attrs != ParamAttr::None) {
5257 ParamAttrsWithIndex PAWI;
5259 PAWI.attrs = I->Attrs;
5260 Attrs.push_back(PAWI);
5265 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5266 if (isVarArg) ParamTypeList.pop_back();
5268 const ParamAttrsList *PAL = 0;
5270 PAL = ParamAttrsList::get(Attrs);
5272 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5273 const PointerType *PFT = PointerType::getUnqual(FT);
5274 delete (yyvsp[(2) - (10)].TypeVal);
5277 if (!FunctionName.empty()) {
5278 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5280 ID = ValID::createGlobalID(CurModule.Values.size());
5284 // See if this function was forward referenced. If so, recycle the object.
5285 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5286 // Move the function to the end of the list, from whereever it was
5287 // previously inserted.
5288 Fn = cast<Function>(FWRef);
5289 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
5290 CurModule.CurrentModule->getFunctionList().remove(Fn);
5291 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5292 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5293 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5294 if (Fn->getFunctionType() != FT ) {
5295 // The existing function doesn't have the same type. This is an overload
5297 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5298 } else if (Fn->getParamAttrs() != PAL) {
5299 // The existing function doesn't have the same parameter attributes.
5300 // This is an overload error.
5301 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5302 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5303 // Neither the existing or the current function is a declaration and they
5304 // have the same name and same type. Clearly this is a redefinition.
5305 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5306 } else if (Fn->isDeclaration()) {
5307 // Make sure to strip off any argument names so we can't get conflicts.
5308 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5312 } else { // Not already defined?
5313 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5314 CurModule.CurrentModule);
5315 InsertValue(Fn, CurModule.Values);
5318 CurFun.FunctionStart(Fn);
5320 if (CurFun.isDeclare) {
5321 // If we have declaration, always overwrite linkage. This will allow us to
5322 // correctly handle cases, when pointer to function is passed as argument to
5323 // another function.
5324 Fn->setLinkage(CurFun.Linkage);
5325 Fn->setVisibility(CurFun.Visibility);
5327 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5328 Fn->setParamAttrs(PAL);
5329 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5330 if ((yyvsp[(8) - (10)].StrVal)) {
5331 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5332 delete (yyvsp[(8) - (10)].StrVal);
5334 if ((yyvsp[(10) - (10)].StrVal)) {
5335 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5336 delete (yyvsp[(10) - (10)].StrVal);
5339 // Add all of the arguments we parsed to the function...
5340 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5341 if (isVarArg) { // Nuke the last entry
5342 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5343 "Not a varargs marker!");
5344 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5345 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5347 Function::arg_iterator ArgIt = Fn->arg_begin();
5348 Function::arg_iterator ArgEnd = Fn->arg_end();
5350 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5351 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5352 delete I->Ty; // Delete the typeholder...
5353 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5359 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5366 #line 2384 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5368 (yyval.FunctionVal) = CurFun.CurrentFunction;
5370 // Make sure that we keep track of the linkage type even if there was a
5371 // previous "declare".
5372 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5373 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5378 #line 2395 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5380 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5386 #line 2400 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5388 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5389 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5390 (yyval.FunctionVal) = CurFun.CurrentFunction;
5391 CurFun.FunctionDone();
5397 #line 2412 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5399 (yyval.BoolVal) = false;
5405 #line 2416 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5407 (yyval.BoolVal) = true;
5413 #line 2421 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5414 { // A reference to a direct constant
5415 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5421 #line 2425 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5423 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5429 #line 2429 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5430 { // Perhaps it's an FP constant?
5431 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5437 #line 2433 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5439 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5445 #line 2437 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5447 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5453 #line 2441 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5455 (yyval.ValIDVal) = ValID::createNull();
5461 #line 2445 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5463 (yyval.ValIDVal) = ValID::createUndef();
5469 #line 2449 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5470 { // A vector zero constant.
5471 (yyval.ValIDVal) = ValID::createZeroInit();
5477 #line 2453 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5478 { // Nonempty unsized packed vector
5479 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5480 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5482 VectorType* pt = VectorType::get(ETy, NumElements);
5483 PATypeHolder* PTy = new PATypeHolder(
5491 // Verify all elements are correct type!
5492 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5493 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5494 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5495 ETy->getDescription() +"' as required!\nIt is of type '" +
5496 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5499 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5500 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5506 #line 2478 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5508 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5514 #line 2482 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5516 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5517 delete (yyvsp[(3) - (5)].StrVal);
5518 delete (yyvsp[(5) - (5)].StrVal);
5524 #line 2492 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5525 { // Is it an integer reference...?
5526 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5532 #line 2496 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5534 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5540 #line 2500 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5541 { // Is it a named reference...?
5542 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5543 delete (yyvsp[(1) - (1)].StrVal);
5549 #line 2505 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5550 { // Is it a named reference...?
5551 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5552 delete (yyvsp[(1) - (1)].StrVal);
5558 #line 2518 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5560 if (!UpRefs.empty())
5561 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5562 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5563 delete (yyvsp[(1) - (2)].TypeVal);
5569 #line 2527 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5571 (yyval.ValueList) = new std::vector<Value *>();
5572 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5578 #line 2532 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5580 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ConstVal));
5586 #line 2537 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5588 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5594 #line 2541 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5595 { // Do not allow functions with 0 basic blocks
5596 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5602 #line 2550 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5604 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5606 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5607 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5608 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5614 #line 2559 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5616 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5617 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5618 if (CI2->getParent() == 0)
5619 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5620 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5621 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5627 #line 2568 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5628 { // Empty space between instruction lists
5629 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5635 #line 2572 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5636 { // Labelled (named) basic block
5637 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5638 delete (yyvsp[(1) - (1)].StrVal);
5645 #line 2580 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5646 { // Return with a result...
5647 if((yyvsp[(2) - (2)].ValueList)->size() == 1)
5648 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueList)->back());
5651 std::vector<const Type*> Elements;
5652 std::vector<Constant*> Vals;
5653 for (std::vector<Value *>::iterator I = (yyvsp[(2) - (2)].ValueList)->begin(),
5654 E = (yyvsp[(2) - (2)].ValueList)->end(); I != E; ++I) {
5656 Constant *C = cast<Constant>(V);
5657 Elements.push_back(V->getType());
5661 const StructType *STy = StructType::get(Elements);
5663 new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
5665 Constant *CS = ConstantStruct::get(STy, Vals); // *$2);
5666 (yyval.TermInstVal) = new ReturnInst(CS);
5669 delete (yyvsp[(2) - (2)].ValueList);
5675 #line 2606 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5676 { // Return with no result...
5677 (yyval.TermInstVal) = new ReturnInst();
5683 #line 2610 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5684 { // Unconditional Branch...
5685 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5687 (yyval.TermInstVal) = new BranchInst(tmpBB);
5692 #line 2615 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5694 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5695 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5697 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5699 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5701 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5706 #line 2625 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5708 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5710 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5712 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5713 (yyval.TermInstVal) = S;
5715 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5716 E = (yyvsp[(8) - (9)].JumpTable)->end();
5717 for (; I != E; ++I) {
5718 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5719 S->addCase(CI, I->second);
5721 GEN_ERROR("Switch case is constant, but not a simple integer");
5723 delete (yyvsp[(8) - (9)].JumpTable);
5729 #line 2644 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5731 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5733 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5735 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5736 (yyval.TermInstVal) = S;
5742 #line 2654 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5745 // Handle the short syntax
5746 const PointerType *PFTy = 0;
5747 const FunctionType *Ty = 0;
5748 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5749 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5750 // Pull out the types of all of the arguments...
5751 std::vector<const Type*> ParamTypes;
5752 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5753 for (; I != E; ++I) {
5754 const Type *Ty = I->Val->getType();
5755 if (Ty == Type::VoidTy)
5756 GEN_ERROR("Short call syntax cannot be used with varargs");
5757 ParamTypes.push_back(Ty);
5759 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5760 PFTy = PointerType::getUnqual(Ty);
5763 delete (yyvsp[(3) - (14)].TypeVal);
5765 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5767 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5769 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5772 ParamAttrsVector Attrs;
5773 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5774 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5775 Attrs.push_back(PAWI);
5778 // Check the arguments
5780 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5781 // Make sure no arguments is a good thing!
5782 if (Ty->getNumParams() != 0)
5783 GEN_ERROR("No arguments passed to a function that "
5784 "expects arguments");
5785 } else { // Has arguments?
5786 // Loop through FunctionType's arguments and ensure they are specified
5788 FunctionType::param_iterator I = Ty->param_begin();
5789 FunctionType::param_iterator E = Ty->param_end();
5790 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5793 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5794 if (ArgI->Val->getType() != *I)
5795 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5796 (*I)->getDescription() + "'");
5797 Args.push_back(ArgI->Val);
5798 if (ArgI->Attrs != ParamAttr::None) {
5799 ParamAttrsWithIndex PAWI;
5801 PAWI.attrs = ArgI->Attrs;
5802 Attrs.push_back(PAWI);
5806 if (Ty->isVarArg()) {
5808 for (; ArgI != ArgE; ++ArgI, ++index) {
5809 Args.push_back(ArgI->Val); // push the remaining varargs
5810 if (ArgI->Attrs != ParamAttr::None) {
5811 ParamAttrsWithIndex PAWI;
5813 PAWI.attrs = ArgI->Attrs;
5814 Attrs.push_back(PAWI);
5817 } else if (I != E || ArgI != ArgE)
5818 GEN_ERROR("Invalid number of parameters detected");
5821 const ParamAttrsList *PAL = 0;
5823 PAL = ParamAttrsList::get(Attrs);
5825 // Create the InvokeInst
5826 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5827 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5828 II->setParamAttrs(PAL);
5829 (yyval.TermInstVal) = II;
5830 delete (yyvsp[(6) - (14)].ParamList);
5836 #line 2744 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5838 (yyval.TermInstVal) = new UnwindInst();
5844 #line 2748 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5846 (yyval.TermInstVal) = new UnreachableInst();
5852 #line 2755 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5854 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5855 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5858 GEN_ERROR("May only switch on a constant pool value");
5860 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5862 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5867 #line 2766 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5869 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5870 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5874 GEN_ERROR("May only switch on a constant pool value");
5876 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5878 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5883 #line 2779 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5885 // Is this definition named?? if so, assign the name...
5886 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5888 InsertValue((yyvsp[(2) - (2)].InstVal));
5889 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5895 #line 2789 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5896 { // Used for PHI nodes
5897 if (!UpRefs.empty())
5898 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5899 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5900 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5902 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5904 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5905 delete (yyvsp[(1) - (6)].TypeVal);
5910 #line 2800 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5912 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5913 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5915 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5917 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5922 #line 2810 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5924 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5925 if (!UpRefs.empty())
5926 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5927 // Used for call and invoke instructions
5928 (yyval.ParamList) = new ParamList();
5929 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5930 (yyval.ParamList)->push_back(E);
5931 delete (yyvsp[(1) - (4)].TypeVal);
5937 #line 2821 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5939 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5940 // Labels are only valid in ASMs
5941 (yyval.ParamList) = new ParamList();
5942 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5943 (yyval.ParamList)->push_back(E);
5949 #line 2829 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5951 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5952 if (!UpRefs.empty())
5953 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5954 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5955 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5956 (yyval.ParamList)->push_back(E);
5957 delete (yyvsp[(3) - (6)].TypeVal);
5963 #line 2839 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5965 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5966 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5967 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5968 (yyval.ParamList)->push_back(E);
5974 #line 2846 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5975 { (yyval.ParamList) = new ParamList(); ;}
5979 #line 2849 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5980 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5984 #line 2850 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5986 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5987 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5993 #line 2857 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5995 (yyval.BoolVal) = true;
6001 #line 2861 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6003 (yyval.BoolVal) = false;
6009 #line 2866 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6011 if (!UpRefs.empty())
6012 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6013 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6014 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6016 "Arithmetic operator requires integer, FP, or packed operands");
6017 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6019 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6021 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6022 if ((yyval.InstVal) == 0)
6023 GEN_ERROR("binary operator returned null");
6024 delete (yyvsp[(2) - (5)].TypeVal);
6029 #line 2882 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6031 if (!UpRefs.empty())
6032 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6033 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6034 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6035 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6036 GEN_ERROR("Logical operator requires integral operands");
6038 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6040 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6042 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6043 if ((yyval.InstVal) == 0)
6044 GEN_ERROR("binary operator returned null");
6045 delete (yyvsp[(2) - (5)].TypeVal);
6050 #line 2899 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6052 if (!UpRefs.empty())
6053 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6054 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6055 GEN_ERROR("Vector types not supported by icmp instruction");
6056 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6058 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6060 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6061 if ((yyval.InstVal) == 0)
6062 GEN_ERROR("icmp operator returned null");
6063 delete (yyvsp[(3) - (6)].TypeVal);
6068 #line 2913 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6070 if (!UpRefs.empty())
6071 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6072 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6073 GEN_ERROR("Vector types not supported by fcmp instruction");
6074 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6076 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6078 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6079 if ((yyval.InstVal) == 0)
6080 GEN_ERROR("fcmp operator returned null");
6081 delete (yyvsp[(3) - (6)].TypeVal);
6086 #line 2927 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6088 if (!UpRefs.empty())
6089 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6090 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6091 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6092 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6093 GEN_ERROR("invalid cast opcode for cast from '" +
6094 Val->getType()->getDescription() + "' to '" +
6095 DestTy->getDescription() + "'");
6096 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6097 delete (yyvsp[(4) - (4)].TypeVal);
6102 #line 2939 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6104 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6105 GEN_ERROR("select condition must be boolean");
6106 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6107 GEN_ERROR("select value types should match");
6108 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6114 #line 2947 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6116 if (!UpRefs.empty())
6117 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6118 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6119 delete (yyvsp[(4) - (4)].TypeVal);
6125 #line 2954 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6127 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6128 GEN_ERROR("Invalid extractelement operands");
6129 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6135 #line 2960 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6137 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6138 GEN_ERROR("Invalid insertelement operands");
6139 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6145 #line 2966 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6147 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6148 GEN_ERROR("Invalid shufflevector operands");
6149 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6155 #line 2972 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6157 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6158 if (!Ty->isFirstClassType())
6159 GEN_ERROR("PHI node operands must be of first class type");
6160 (yyval.InstVal) = new PHINode(Ty);
6161 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6162 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6163 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6164 GEN_ERROR("All elements of a PHI node must be of the same type");
6165 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6166 (yyvsp[(2) - (2)].PHIList)->pop_front();
6168 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6174 #line 2988 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6177 // Handle the short syntax
6178 const PointerType *PFTy = 0;
6179 const FunctionType *Ty = 0;
6180 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6181 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6182 // Pull out the types of all of the arguments...
6183 std::vector<const Type*> ParamTypes;
6184 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6185 for (; I != E; ++I) {
6186 const Type *Ty = I->Val->getType();
6187 if (Ty == Type::VoidTy)
6188 GEN_ERROR("Short call syntax cannot be used with varargs");
6189 ParamTypes.push_back(Ty);
6191 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6192 PFTy = PointerType::getUnqual(Ty);
6195 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6198 // Check for call to invalid intrinsic to avoid crashing later.
6199 if (Function *theF = dyn_cast<Function>(V)) {
6200 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6201 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6202 !theF->getIntrinsicID(true))
6203 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6204 theF->getName() + "'");
6207 // Set up the ParamAttrs for the function
6208 ParamAttrsVector Attrs;
6209 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6210 ParamAttrsWithIndex PAWI;
6212 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6213 Attrs.push_back(PAWI);
6215 // Check the arguments
6217 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6218 // Make sure no arguments is a good thing!
6219 if (Ty->getNumParams() != 0)
6220 GEN_ERROR("No arguments passed to a function that "
6221 "expects arguments");
6222 } else { // Has arguments?
6223 // Loop through FunctionType's arguments and ensure they are specified
6224 // correctly. Also, gather any parameter attributes.
6225 FunctionType::param_iterator I = Ty->param_begin();
6226 FunctionType::param_iterator E = Ty->param_end();
6227 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6230 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6231 if (ArgI->Val->getType() != *I)
6232 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6233 (*I)->getDescription() + "'");
6234 Args.push_back(ArgI->Val);
6235 if (ArgI->Attrs != ParamAttr::None) {
6236 ParamAttrsWithIndex PAWI;
6238 PAWI.attrs = ArgI->Attrs;
6239 Attrs.push_back(PAWI);
6242 if (Ty->isVarArg()) {
6244 for (; ArgI != ArgE; ++ArgI, ++index) {
6245 Args.push_back(ArgI->Val); // push the remaining varargs
6246 if (ArgI->Attrs != ParamAttr::None) {
6247 ParamAttrsWithIndex PAWI;
6249 PAWI.attrs = ArgI->Attrs;
6250 Attrs.push_back(PAWI);
6253 } else if (I != E || ArgI != ArgE)
6254 GEN_ERROR("Invalid number of parameters detected");
6257 // Finish off the ParamAttrs and check them
6258 const ParamAttrsList *PAL = 0;
6260 PAL = ParamAttrsList::get(Attrs);
6262 // Create the call node
6263 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
6264 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6265 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6266 CI->setParamAttrs(PAL);
6267 (yyval.InstVal) = CI;
6268 delete (yyvsp[(6) - (8)].ParamList);
6269 delete (yyvsp[(3) - (8)].TypeVal);
6275 #line 3085 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6277 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6283 #line 3090 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6285 (yyval.BoolVal) = true;
6291 #line 3094 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6293 (yyval.BoolVal) = false;
6299 #line 3101 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6301 if (!UpRefs.empty())
6302 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6303 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6304 delete (yyvsp[(2) - (3)].TypeVal);
6310 #line 3108 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6312 if (!UpRefs.empty())
6313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6314 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6316 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6317 delete (yyvsp[(2) - (6)].TypeVal);
6322 #line 3116 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6324 if (!UpRefs.empty())
6325 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6326 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6327 delete (yyvsp[(2) - (3)].TypeVal);
6333 #line 3123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6335 if (!UpRefs.empty())
6336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6337 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6339 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6340 delete (yyvsp[(2) - (6)].TypeVal);
6345 #line 3131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6347 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6348 GEN_ERROR("Trying to free nonpointer type " +
6349 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6350 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6356 #line 3139 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6358 if (!UpRefs.empty())
6359 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6360 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6361 GEN_ERROR("Can't load from nonpointer type: " +
6362 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6363 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6364 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6365 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6366 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6368 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6369 delete (yyvsp[(3) - (5)].TypeVal);
6374 #line 3153 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6376 if (!UpRefs.empty())
6377 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6378 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6380 GEN_ERROR("Can't store to a nonpointer type: " +
6381 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6382 const Type *ElTy = PT->getElementType();
6383 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6384 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6385 "' into space of type '" + ElTy->getDescription() + "'");
6387 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6389 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6390 delete (yyvsp[(5) - (7)].TypeVal);
6395 #line 3170 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6397 ValID TmpVID = ValID::createLocalName(*(yyvsp[(3) - (5)].StrVal));
6398 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), TmpVID);
6399 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6400 GEN_ERROR("Invalid getresult operands");
6401 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6407 #line 3178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6409 if (!UpRefs.empty())
6410 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6411 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6412 GEN_ERROR("getelementptr insn requires pointer operand");
6414 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6415 GEN_ERROR("Invalid getelementptr indices for type '" +
6416 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6417 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6419 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6420 delete (yyvsp[(2) - (4)].TypeVal);
6421 delete (yyvsp[(4) - (4)].ValueList);
6426 /* Line 1267 of yacc.c. */
6427 #line 6428 "llvmAsmParser.tab.c"
6430 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6434 YY_STACK_PRINT (yyss, yyssp);
6439 /* Now `shift' the result of the reduction. Determine what state
6440 that goes to, based on the state we popped back to and the rule
6441 number reduced by. */
6445 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6446 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6447 yystate = yytable[yystate];
6449 yystate = yydefgoto[yyn - YYNTOKENS];
6454 /*------------------------------------.
6455 | yyerrlab -- here on detecting error |
6456 `------------------------------------*/
6458 /* If not already recovering from an error, report this error. */
6462 #if ! YYERROR_VERBOSE
6463 yyerror (YY_("syntax error"));
6466 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6467 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6469 YYSIZE_T yyalloc = 2 * yysize;
6470 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6471 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6472 if (yymsg != yymsgbuf)
6473 YYSTACK_FREE (yymsg);
6474 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6476 yymsg_alloc = yyalloc;
6480 yymsg_alloc = sizeof yymsgbuf;
6484 if (0 < yysize && yysize <= yymsg_alloc)
6486 (void) yysyntax_error (yymsg, yystate, yychar);
6491 yyerror (YY_("syntax error"));
6493 goto yyexhaustedlab;
6501 if (yyerrstatus == 3)
6503 /* If just tried and failed to reuse look-ahead token after an
6504 error, discard it. */
6506 if (yychar <= YYEOF)
6508 /* Return failure if at end of input. */
6509 if (yychar == YYEOF)
6514 yydestruct ("Error: discarding",
6520 /* Else will try to reuse look-ahead token after shifting the error
6525 /*---------------------------------------------------.
6526 | yyerrorlab -- error raised explicitly by YYERROR. |
6527 `---------------------------------------------------*/
6530 /* Pacify compilers like GCC when the user code never invokes
6531 YYERROR and the label yyerrorlab therefore never appears in user
6533 if (/*CONSTCOND*/ 0)
6536 /* Do not reclaim the symbols of the rule which action triggered
6540 YY_STACK_PRINT (yyss, yyssp);
6545 /*-------------------------------------------------------------.
6546 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6547 `-------------------------------------------------------------*/
6549 yyerrstatus = 3; /* Each real token shifted decrements this. */
6553 yyn = yypact[yystate];
6554 if (yyn != YYPACT_NINF)
6557 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6565 /* Pop the current state because it cannot handle the error token. */
6570 yydestruct ("Error: popping",
6571 yystos[yystate], yyvsp);
6574 YY_STACK_PRINT (yyss, yyssp);
6583 /* Shift the error token. */
6584 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6590 /*-------------------------------------.
6591 | yyacceptlab -- YYACCEPT comes here. |
6592 `-------------------------------------*/
6597 /*-----------------------------------.
6598 | yyabortlab -- YYABORT comes here. |
6599 `-----------------------------------*/
6605 /*-------------------------------------------------.
6606 | yyexhaustedlab -- memory exhaustion comes here. |
6607 `-------------------------------------------------*/
6609 yyerror (YY_("memory exhausted"));
6615 if (yychar != YYEOF && yychar != YYEMPTY)
6616 yydestruct ("Cleanup: discarding lookahead",
6618 /* Do not reclaim the symbols of the rule which action triggered
6619 this YYABORT or YYACCEPT. */
6621 YY_STACK_PRINT (yyss, yyssp);
6622 while (yyssp != yyss)
6624 yydestruct ("Cleanup: popping",
6625 yystos[*yyssp], yyvsp);
6630 YYSTACK_FREE (yyss);
6633 if (yymsg != yymsgbuf)
6634 YYSTACK_FREE (yymsg);
6636 /* Make sure YYID is used. */
6637 return YYID (yyresult);
6641 #line 3195 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6644 // common code from the two 'RunVMAsmParser' functions
6645 static Module* RunParser(Module * M) {
6646 CurModule.CurrentModule = M;
6647 // Check to make sure the parser succeeded
6650 delete ParserResult;
6654 // Emit an error if there are any unresolved types left.
6655 if (!CurModule.LateResolveTypes.empty()) {
6656 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6657 if (DID.Type == ValID::LocalName) {
6658 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6660 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6663 delete ParserResult;
6667 // Emit an error if there are any unresolved values left.
6668 if (!CurModule.LateResolveValues.empty()) {
6669 Value *V = CurModule.LateResolveValues.back();
6670 std::map<Value*, std::pair<ValID, int> >::iterator I =
6671 CurModule.PlaceHolderInfo.find(V);
6673 if (I != CurModule.PlaceHolderInfo.end()) {
6674 ValID &DID = I->second.first;
6675 if (DID.Type == ValID::LocalName) {
6676 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6678 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6681 delete ParserResult;
6686 // Check to make sure that parsing produced a result
6690 // Reset ParserResult variable while saving its value for the result.
6691 Module *Result = ParserResult;
6697 void llvm::GenerateError(const std::string &message, int LineNo) {
6698 if (LineNo == -1) LineNo = LLLgetLineNo();
6699 // TODO: column number in exception
6701 TheParseError->setError(LLLgetFilename(), message, LineNo);
6705 int yyerror(const char *ErrorMsg) {
6706 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6707 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6708 if (yychar != YYEMPTY && yychar != 0) {
6709 errMsg += " while reading token: '";
6710 errMsg += std::string(LLLgetTokenStart(),
6711 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6713 GenerateError(errMsg);