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,
207 EXTRACTELEMENT = 388,
229 #define ESINT64VAL 258
230 #define EUINT64VAL 259
231 #define ESAPINTVAL 260
232 #define EUAPINTVAL 261
233 #define LOCALVAL_ID 262
234 #define GLOBALVAL_ID 263
242 #define PPC_FP128 271
246 #define GLOBALVAR 275
248 #define STRINGCONSTANT 277
249 #define ATSTRINGCONSTANT 278
250 #define PCTSTRINGCONSTANT 279
251 #define ZEROINITIALIZER 280
263 #define THREAD_LOCAL 292
265 #define DOTDOTDOT 294
271 #define APPENDING 300
272 #define DLLIMPORT 301
273 #define DLLEXPORT 302
274 #define EXTERN_WEAK 303
280 #define ADDRSPACE 309
286 #define SIDEEFFECT 315
289 #define FASTCC_TOK 318
290 #define COLDCC_TOK 319
291 #define X86_STDCALLCC_TOK 320
292 #define X86_FASTCALLCC_TOK 321
293 #define DATALAYOUT 322
294 #define UNWIND_TO 323
300 #define UNREACHABLE 329
343 #define GETELEMENTPTR 372
359 #define EXTRACTELEMENT 388
360 #define INSERTELEMENT 389
361 #define SHUFFLEVECTOR 390
362 #define GETRESULT 391
377 #define PROTECTED 406
382 /* Copy the first part of user declarations. */
383 #line 14 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
385 #include "ParserInternals.h"
386 #include "llvm/CallingConv.h"
387 #include "llvm/InlineAsm.h"
388 #include "llvm/Instructions.h"
389 #include "llvm/Module.h"
390 #include "llvm/ValueSymbolTable.h"
391 #include "llvm/AutoUpgrade.h"
392 #include "llvm/Support/GetElementPtrTypeIterator.h"
393 #include "llvm/Support/CommandLine.h"
394 #include "llvm/ADT/SmallVector.h"
395 #include "llvm/ADT/STLExtras.h"
396 #include "llvm/Support/MathExtras.h"
397 #include "llvm/Support/Streams.h"
398 #include "llvm/ParamAttrsList.h"
404 // The following is a gross hack. In order to rid the libAsmParser library of
405 // exceptions, we have to have a way of getting the yyparse function to go into
406 // an error situation. So, whenever we want an error to occur, the GenerateError
407 // function (see bottom of file) sets TriggerError. Then, at the end of each
408 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
409 // (a goto) to put YACC in error state. Furthermore, several calls to
410 // GenerateError are made from inside productions and they must simulate the
411 // previous exception behavior by exiting the production immediately. We have
412 // replaced these with the GEN_ERROR macro which calls GeneratError and then
413 // immediately invokes YYERROR. This would be so much cleaner if it was a
414 // recursive descent parser.
415 static bool TriggerError = false;
416 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
417 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
419 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
420 int yylex(); // declaration" of xxx warnings.
422 using namespace llvm;
424 static Module *ParserResult;
426 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
427 // relating to upreferences in the input stream.
429 //#define DEBUG_UPREFS 1
431 #define UR_OUT(X) cerr << X
436 #define YYERROR_VERBOSE 1
438 static GlobalVariable *CurGV;
441 // This contains info used when building the body of a function. It is
442 // destroyed when the function is completed.
444 typedef std::vector<Value *> ValueList; // Numbered defs
447 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
449 static struct PerModuleInfo {
450 Module *CurrentModule;
451 ValueList Values; // Module level numbered definitions
452 ValueList LateResolveValues;
453 std::vector<PATypeHolder> Types;
454 std::map<ValID, PATypeHolder> LateResolveTypes;
456 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
457 /// how they were referenced and on which line of the input they came from so
458 /// that we can resolve them later and print error messages as appropriate.
459 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
461 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
462 // references to global values. Global values may be referenced before they
463 // are defined, and if so, the temporary object that they represent is held
464 // here. This is used for forward references of GlobalValues.
466 typedef std::map<std::pair<const PointerType *,
467 ValID>, GlobalValue*> GlobalRefsType;
468 GlobalRefsType GlobalRefs;
471 // If we could not resolve some functions at function compilation time
472 // (calls to functions before they are defined), resolve them now... Types
473 // are resolved when the constant pool has been completely parsed.
475 ResolveDefinitions(LateResolveValues);
479 // Check to make sure that all global value forward references have been
482 if (!GlobalRefs.empty()) {
483 std::string UndefinedReferences = "Unresolved global references exist:\n";
485 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
487 UndefinedReferences += " " + I->first.first->getDescription() + " " +
488 I->first.second.getName() + "\n";
490 GenerateError(UndefinedReferences);
494 // Look for intrinsic functions and CallInst that need to be upgraded
495 for (Module::iterator FI = CurrentModule->begin(),
496 FE = CurrentModule->end(); FI != FE; )
497 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
499 Values.clear(); // Clear out function local definitions
504 // GetForwardRefForGlobal - Check to see if there is a forward reference
505 // for this global. If so, remove it from the GlobalRefs map and return it.
506 // If not, just return null.
507 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
508 // Check to see if there is a forward reference to this global variable...
509 // if there is, eliminate it and patch the reference to use the new def'n.
510 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
511 GlobalValue *Ret = 0;
512 if (I != GlobalRefs.end()) {
519 bool TypeIsUnresolved(PATypeHolder* PATy) {
520 // If it isn't abstract, its resolved
521 const Type* Ty = PATy->get();
522 if (!Ty->isAbstract())
524 // Traverse the type looking for abstract types. If it isn't abstract then
525 // we don't need to traverse that leg of the type.
526 std::vector<const Type*> WorkList, SeenList;
527 WorkList.push_back(Ty);
528 while (!WorkList.empty()) {
529 const Type* Ty = WorkList.back();
530 SeenList.push_back(Ty);
532 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
533 // Check to see if this is an unresolved type
534 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
535 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
536 for ( ; I != E; ++I) {
537 if (I->second.get() == OpTy)
540 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
541 const Type* TheTy = SeqTy->getElementType();
542 if (TheTy->isAbstract() && TheTy != Ty) {
543 std::vector<const Type*>::iterator I = SeenList.begin(),
549 WorkList.push_back(TheTy);
551 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
552 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
553 const Type* TheTy = StrTy->getElementType(i);
554 if (TheTy->isAbstract() && TheTy != Ty) {
555 std::vector<const Type*>::iterator I = SeenList.begin(),
561 WorkList.push_back(TheTy);
570 static struct PerFunctionInfo {
571 Function *CurrentFunction; // Pointer to current function being created
573 ValueList Values; // Keep track of #'d definitions
575 ValueList LateResolveValues;
576 bool isDeclare; // Is this function a forward declararation?
577 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
578 GlobalValue::VisibilityTypes Visibility;
580 /// BBForwardRefs - When we see forward references to basic blocks, keep
581 /// track of them here.
582 std::map<ValID, BasicBlock*> BBForwardRefs;
584 inline PerFunctionInfo() {
587 Linkage = GlobalValue::ExternalLinkage;
588 Visibility = GlobalValue::DefaultVisibility;
591 inline void FunctionStart(Function *M) {
596 void FunctionDone() {
597 // Any forward referenced blocks left?
598 if (!BBForwardRefs.empty()) {
599 GenerateError("Undefined reference to label " +
600 BBForwardRefs.begin()->second->getName());
604 // Resolve all forward references now.
605 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
607 Values.clear(); // Clear out function local definitions
608 BBForwardRefs.clear();
611 Linkage = GlobalValue::ExternalLinkage;
612 Visibility = GlobalValue::DefaultVisibility;
614 } CurFun; // Info for the current function...
616 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
619 //===----------------------------------------------------------------------===//
620 // Code to handle definitions of all the types
621 //===----------------------------------------------------------------------===//
623 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
624 // Things that have names or are void typed don't get slot numbers
625 if (V->hasName() || (V->getType() == Type::VoidTy))
628 // In the case of function values, we have to allow for the forward reference
629 // of basic blocks, which are included in the numbering. Consequently, we keep
630 // track of the next insertion location with NextValNum. When a BB gets
631 // inserted, it could change the size of the CurFun.Values vector.
632 if (&ValueTab == &CurFun.Values) {
633 if (ValueTab.size() <= CurFun.NextValNum)
634 ValueTab.resize(CurFun.NextValNum+1);
635 ValueTab[CurFun.NextValNum++] = V;
638 // For all other lists, its okay to just tack it on the back of the vector.
639 ValueTab.push_back(V);
642 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
644 case ValID::LocalID: // Is it a numbered definition?
645 // Module constants occupy the lowest numbered slots...
646 if (D.Num < CurModule.Types.size())
647 return CurModule.Types[D.Num];
649 case ValID::LocalName: // Is it a named definition?
650 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
651 D.destroy(); // Free old strdup'd memory...
656 GenerateError("Internal parser error: Invalid symbol type reference");
660 // If we reached here, we referenced either a symbol that we don't know about
661 // or an id number that hasn't been read yet. We may be referencing something
662 // forward, so just create an entry to be resolved later and get to it...
664 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
667 if (inFunctionScope()) {
668 if (D.Type == ValID::LocalName) {
669 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
672 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
677 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
678 if (I != CurModule.LateResolveTypes.end())
681 Type *Typ = OpaqueType::get();
682 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
686 // getExistingVal - Look up the value specified by the provided type and
687 // the provided ValID. If the value exists and has already been defined, return
688 // it. Otherwise return null.
690 static Value *getExistingVal(const Type *Ty, const ValID &D) {
691 if (isa<FunctionType>(Ty)) {
692 GenerateError("Functions are not values and "
693 "must be referenced as pointers");
698 case ValID::LocalID: { // Is it a numbered definition?
699 // Check that the number is within bounds.
700 if (D.Num >= CurFun.Values.size())
702 Value *Result = CurFun.Values[D.Num];
703 if (Ty != Result->getType()) {
704 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
705 Result->getType()->getDescription() + "' does not match "
706 "expected type, '" + Ty->getDescription() + "'");
711 case ValID::GlobalID: { // Is it a numbered definition?
712 if (D.Num >= CurModule.Values.size())
714 Value *Result = CurModule.Values[D.Num];
715 if (Ty != Result->getType()) {
716 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
717 Result->getType()->getDescription() + "' does not match "
718 "expected type, '" + Ty->getDescription() + "'");
724 case ValID::LocalName: { // Is it a named definition?
725 if (!inFunctionScope())
727 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
728 Value *N = SymTab.lookup(D.getName());
731 if (N->getType() != Ty)
734 D.destroy(); // Free old strdup'd memory...
737 case ValID::GlobalName: { // Is it a named definition?
738 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
739 Value *N = SymTab.lookup(D.getName());
742 if (N->getType() != Ty)
745 D.destroy(); // Free old strdup'd memory...
749 // Check to make sure that "Ty" is an integral type, and that our
750 // value will fit into the specified type...
751 case ValID::ConstSIntVal: // Is it a constant pool reference??
752 if (!isa<IntegerType>(Ty) ||
753 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
754 GenerateError("Signed integral constant '" +
755 itostr(D.ConstPool64) + "' is invalid for type '" +
756 Ty->getDescription() + "'");
759 return ConstantInt::get(Ty, D.ConstPool64, true);
761 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
762 if (isa<IntegerType>(Ty) &&
763 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
764 return ConstantInt::get(Ty, D.UConstPool64);
766 if (!isa<IntegerType>(Ty) ||
767 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
768 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
769 "' is invalid or out of range for type '" +
770 Ty->getDescription() + "'");
773 // This is really a signed reference. Transmogrify.
774 return ConstantInt::get(Ty, D.ConstPool64, true);
776 case ValID::ConstFPVal: // Is it a floating point const pool reference?
777 if (!Ty->isFloatingPoint() ||
778 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
779 GenerateError("FP constant invalid for type");
782 // Lexer has no type info, so builds all float and double FP constants
783 // as double. Fix this here. Long double does not need this.
784 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
786 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
787 return ConstantFP::get(Ty, *D.ConstPoolFP);
789 case ValID::ConstNullVal: // Is it a null value?
790 if (!isa<PointerType>(Ty)) {
791 GenerateError("Cannot create a a non pointer null");
794 return ConstantPointerNull::get(cast<PointerType>(Ty));
796 case ValID::ConstUndefVal: // Is it an undef value?
797 return UndefValue::get(Ty);
799 case ValID::ConstZeroVal: // Is it a zero value?
800 return Constant::getNullValue(Ty);
802 case ValID::ConstantVal: // Fully resolved constant?
803 if (D.ConstantValue->getType() != Ty) {
804 GenerateError("Constant expression type different from required type");
807 return D.ConstantValue;
809 case ValID::InlineAsmVal: { // Inline asm expression
810 const PointerType *PTy = dyn_cast<PointerType>(Ty);
811 const FunctionType *FTy =
812 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
813 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
814 GenerateError("Invalid type for asm constraint string");
817 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
818 D.IAD->HasSideEffects);
819 D.destroy(); // Free InlineAsmDescriptor.
823 assert(0 && "Unhandled case!");
827 assert(0 && "Unhandled case!");
831 // getVal - This function is identical to getExistingVal, except that if a
832 // value is not already defined, it "improvises" by creating a placeholder var
833 // that looks and acts just like the requested variable. When the value is
834 // defined later, all uses of the placeholder variable are replaced with the
837 static Value *getVal(const Type *Ty, const ValID &ID) {
838 if (Ty == Type::LabelTy) {
839 GenerateError("Cannot use a basic block here");
843 // See if the value has already been defined.
844 Value *V = getExistingVal(Ty, ID);
846 if (TriggerError) return 0;
848 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
849 GenerateError("Invalid use of a composite type");
853 // If we reached here, we referenced either a symbol that we don't know about
854 // or an id number that hasn't been read yet. We may be referencing something
855 // forward, so just create an entry to be resolved later and get to it...
858 case ValID::GlobalName:
859 case ValID::GlobalID: {
860 const PointerType *PTy = dyn_cast<PointerType>(Ty);
862 GenerateError("Invalid type for reference to global" );
865 const Type* ElTy = PTy->getElementType();
866 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
867 V = new Function(FTy, GlobalValue::ExternalLinkage);
869 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
870 (Module*)0, false, PTy->getAddressSpace());
874 V = new Argument(Ty);
877 // Remember where this forward reference came from. FIXME, shouldn't we try
878 // to recycle these things??
879 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
882 if (inFunctionScope())
883 InsertValue(V, CurFun.LateResolveValues);
885 InsertValue(V, CurModule.LateResolveValues);
889 /// defineBBVal - This is a definition of a new basic block with the specified
890 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
891 static BasicBlock *defineBBVal(const ValID &ID, BasicBlock *unwindDest) {
892 assert(inFunctionScope() && "Can't get basic block at global scope!");
896 // First, see if this was forward referenced
898 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
899 if (BBI != CurFun.BBForwardRefs.end()) {
901 // The forward declaration could have been inserted anywhere in the
902 // function: insert it into the correct place now.
903 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
904 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
906 // We're about to erase the entry, save the key so we can clean it up.
907 ValID Tmp = BBI->first;
909 // Erase the forward ref from the map as its no longer "forward"
910 CurFun.BBForwardRefs.erase(ID);
912 // The key has been removed from the map but so we don't want to leave
913 // strdup'd memory around so destroy it too.
916 // If its a numbered definition, bump the number and set the BB value.
917 if (ID.Type == ValID::LocalID) {
918 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
922 // We haven't seen this BB before and its first mention is a definition.
923 // Just create it and return it.
924 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
925 BB = new BasicBlock(Name, CurFun.CurrentFunction);
926 if (ID.Type == ValID::LocalID) {
927 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
933 BB->setUnwindDest(unwindDest);
937 /// getBBVal - get an existing BB value or create a forward reference for it.
939 static BasicBlock *getBBVal(const ValID &ID) {
940 assert(inFunctionScope() && "Can't get basic block at global scope!");
944 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
945 if (BBI != CurFun.BBForwardRefs.end()) {
947 } if (ID.Type == ValID::LocalName) {
948 std::string Name = ID.getName();
949 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
951 if (N->getType()->getTypeID() == Type::LabelTyID)
952 BB = cast<BasicBlock>(N);
954 GenerateError("Reference to label '" + Name + "' is actually of type '"+
955 N->getType()->getDescription() + "'");
957 } else if (ID.Type == ValID::LocalID) {
958 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
959 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
960 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
962 GenerateError("Reference to label '%" + utostr(ID.Num) +
963 "' is actually of type '"+
964 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
967 GenerateError("Illegal label reference " + ID.getName());
971 // If its already been defined, return it now.
973 ID.destroy(); // Free strdup'd memory.
977 // Otherwise, this block has not been seen before, create it.
979 if (ID.Type == ValID::LocalName)
981 BB = new BasicBlock(Name, CurFun.CurrentFunction);
983 // Insert it in the forward refs map.
984 CurFun.BBForwardRefs[ID] = BB;
990 //===----------------------------------------------------------------------===//
991 // Code to handle forward references in instructions
992 //===----------------------------------------------------------------------===//
994 // This code handles the late binding needed with statements that reference
995 // values not defined yet... for example, a forward branch, or the PHI node for
998 // This keeps a table (CurFun.LateResolveValues) of all such forward references
999 // and back patchs after we are done.
1002 // ResolveDefinitions - If we could not resolve some defs at parsing
1003 // time (forward branches, phi functions for loops, etc...) resolve the
1007 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1008 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1009 while (!LateResolvers.empty()) {
1010 Value *V = LateResolvers.back();
1011 LateResolvers.pop_back();
1013 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1014 CurModule.PlaceHolderInfo.find(V);
1015 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1017 ValID &DID = PHI->second.first;
1019 Value *TheRealValue = getExistingVal(V->getType(), DID);
1023 V->replaceAllUsesWith(TheRealValue);
1025 CurModule.PlaceHolderInfo.erase(PHI);
1026 } else if (FutureLateResolvers) {
1027 // Functions have their unresolved items forwarded to the module late
1029 InsertValue(V, *FutureLateResolvers);
1031 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1032 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1033 "' of type '" + V->getType()->getDescription() + "'",
1034 PHI->second.second);
1037 GenerateError("Reference to an invalid definition: #" +
1038 itostr(DID.Num) + " of type '" +
1039 V->getType()->getDescription() + "'",
1040 PHI->second.second);
1045 LateResolvers.clear();
1048 // ResolveTypeTo - A brand new type was just declared. This means that (if
1049 // name is not null) things referencing Name can be resolved. Otherwise, things
1050 // refering to the number can be resolved. Do this now.
1052 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1055 D = ValID::createLocalName(*Name);
1057 D = ValID::createLocalID(CurModule.Types.size());
1059 std::map<ValID, PATypeHolder>::iterator I =
1060 CurModule.LateResolveTypes.find(D);
1061 if (I != CurModule.LateResolveTypes.end()) {
1062 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1063 CurModule.LateResolveTypes.erase(I);
1067 // setValueName - Set the specified value to the name given. The name may be
1068 // null potentially, in which case this is a noop. The string passed in is
1069 // assumed to be a malloc'd string buffer, and is free'd by this function.
1071 static void setValueName(Value *V, std::string *NameStr) {
1072 if (!NameStr) return;
1073 std::string Name(*NameStr); // Copy string
1074 delete NameStr; // Free old string
1076 if (V->getType() == Type::VoidTy) {
1077 GenerateError("Can't assign name '" + Name+"' to value with void type");
1081 assert(inFunctionScope() && "Must be in function scope!");
1082 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1083 if (ST.lookup(Name)) {
1084 GenerateError("Redefinition of value '" + Name + "' of type '" +
1085 V->getType()->getDescription() + "'");
1093 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1094 /// this is a declaration, otherwise it is a definition.
1095 static GlobalVariable *
1096 ParseGlobalVariable(std::string *NameStr,
1097 GlobalValue::LinkageTypes Linkage,
1098 GlobalValue::VisibilityTypes Visibility,
1099 bool isConstantGlobal, const Type *Ty,
1100 Constant *Initializer, bool IsThreadLocal,
1101 unsigned AddressSpace = 0) {
1102 if (isa<FunctionType>(Ty)) {
1103 GenerateError("Cannot declare global vars of function type");
1107 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1111 Name = *NameStr; // Copy string
1112 delete NameStr; // Free old string
1115 // See if this global value was forward referenced. If so, recycle the
1118 if (!Name.empty()) {
1119 ID = ValID::createGlobalName(Name);
1121 ID = ValID::createGlobalID(CurModule.Values.size());
1124 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1125 // Move the global to the end of the list, from whereever it was
1126 // previously inserted.
1127 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1128 CurModule.CurrentModule->getGlobalList().remove(GV);
1129 CurModule.CurrentModule->getGlobalList().push_back(GV);
1130 GV->setInitializer(Initializer);
1131 GV->setLinkage(Linkage);
1132 GV->setVisibility(Visibility);
1133 GV->setConstant(isConstantGlobal);
1134 GV->setThreadLocal(IsThreadLocal);
1135 InsertValue(GV, CurModule.Values);
1139 // If this global has a name
1140 if (!Name.empty()) {
1141 // if the global we're parsing has an initializer (is a definition) and
1142 // has external linkage.
1143 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1144 // If there is already a global with external linkage with this name
1145 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1146 // If we allow this GVar to get created, it will be renamed in the
1147 // symbol table because it conflicts with an existing GVar. We can't
1148 // allow redefinition of GVars whose linking indicates that their name
1149 // must stay the same. Issue the error.
1150 GenerateError("Redefinition of global variable named '" + Name +
1151 "' of type '" + Ty->getDescription() + "'");
1156 // Otherwise there is no existing GV to use, create one now.
1157 GlobalVariable *GV =
1158 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1159 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1160 GV->setVisibility(Visibility);
1161 InsertValue(GV, CurModule.Values);
1165 // setTypeName - Set the specified type to the name given. The name may be
1166 // null potentially, in which case this is a noop. The string passed in is
1167 // assumed to be a malloc'd string buffer, and is freed by this function.
1169 // This function returns true if the type has already been defined, but is
1170 // allowed to be redefined in the specified context. If the name is a new name
1171 // for the type plane, it is inserted and false is returned.
1172 static bool setTypeName(const Type *T, std::string *NameStr) {
1173 assert(!inFunctionScope() && "Can't give types function-local names!");
1174 if (NameStr == 0) return false;
1176 std::string Name(*NameStr); // Copy string
1177 delete NameStr; // Free old string
1179 // We don't allow assigning names to void type
1180 if (T == Type::VoidTy) {
1181 GenerateError("Can't assign name '" + Name + "' to the void type");
1185 // Set the type name, checking for conflicts as we do so.
1186 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1188 if (AlreadyExists) { // Inserting a name that is already defined???
1189 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1190 assert(Existing && "Conflict but no matching type?!");
1192 // There is only one case where this is allowed: when we are refining an
1193 // opaque type. In this case, Existing will be an opaque type.
1194 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1195 // We ARE replacing an opaque type!
1196 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1200 // Otherwise, this is an attempt to redefine a type. That's okay if
1201 // the redefinition is identical to the original. This will be so if
1202 // Existing and T point to the same Type object. In this one case we
1203 // allow the equivalent redefinition.
1204 if (Existing == T) return true; // Yes, it's equal.
1206 // Any other kind of (non-equivalent) redefinition is an error.
1207 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1208 T->getDescription() + "'");
1214 //===----------------------------------------------------------------------===//
1215 // Code for handling upreferences in type names...
1218 // TypeContains - Returns true if Ty directly contains E in it.
1220 static bool TypeContains(const Type *Ty, const Type *E) {
1221 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1222 E) != Ty->subtype_end();
1226 struct UpRefRecord {
1227 // NestingLevel - The number of nesting levels that need to be popped before
1228 // this type is resolved.
1229 unsigned NestingLevel;
1231 // LastContainedTy - This is the type at the current binding level for the
1232 // type. Every time we reduce the nesting level, this gets updated.
1233 const Type *LastContainedTy;
1235 // UpRefTy - This is the actual opaque type that the upreference is
1236 // represented with.
1237 OpaqueType *UpRefTy;
1239 UpRefRecord(unsigned NL, OpaqueType *URTy)
1240 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1244 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1245 static std::vector<UpRefRecord> UpRefs;
1247 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1248 /// called. It loops through the UpRefs vector, which is a list of the
1249 /// currently active types. For each type, if the up reference is contained in
1250 /// the newly completed type, we decrement the level count. When the level
1251 /// count reaches zero, the upreferenced type is the type that is passed in:
1252 /// thus we can complete the cycle.
1254 static PATypeHolder HandleUpRefs(const Type *ty) {
1255 // If Ty isn't abstract, or if there are no up-references in it, then there is
1256 // nothing to resolve here.
1257 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1259 PATypeHolder Ty(ty);
1260 UR_OUT("Type '" << Ty->getDescription() <<
1261 "' newly formed. Resolving upreferences.\n" <<
1262 UpRefs.size() << " upreferences active!\n");
1264 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1265 // to zero), we resolve them all together before we resolve them to Ty. At
1266 // the end of the loop, if there is anything to resolve to Ty, it will be in
1268 OpaqueType *TypeToResolve = 0;
1270 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1271 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1272 << UpRefs[i].second->getDescription() << ") = "
1273 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1274 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1275 // Decrement level of upreference
1276 unsigned Level = --UpRefs[i].NestingLevel;
1277 UpRefs[i].LastContainedTy = Ty;
1278 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1279 if (Level == 0) { // Upreference should be resolved!
1280 if (!TypeToResolve) {
1281 TypeToResolve = UpRefs[i].UpRefTy;
1283 UR_OUT(" * Resolving upreference for "
1284 << UpRefs[i].second->getDescription() << "\n";
1285 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1286 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1287 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1288 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1290 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1291 --i; // Do not skip the next element...
1296 if (TypeToResolve) {
1297 UR_OUT(" * Resolving upreference for "
1298 << UpRefs[i].second->getDescription() << "\n";
1299 std::string OldName = TypeToResolve->getDescription());
1300 TypeToResolve->refineAbstractTypeTo(Ty);
1306 //===----------------------------------------------------------------------===//
1307 // RunVMAsmParser - Define an interface to this parser
1308 //===----------------------------------------------------------------------===//
1310 static Module* RunParser(Module * M);
1312 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1314 Module *M = RunParser(new Module(LLLgetFilename()));
1321 /* Enabling traces. */
1326 /* Enabling verbose error messages. */
1327 #ifdef YYERROR_VERBOSE
1328 # undef YYERROR_VERBOSE
1329 # define YYERROR_VERBOSE 1
1331 # define YYERROR_VERBOSE 0
1334 /* Enabling the token table. */
1335 #ifndef YYTOKEN_TABLE
1336 # define YYTOKEN_TABLE 0
1339 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1340 typedef union YYSTYPE
1341 #line 951 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
1343 llvm::Module *ModuleVal;
1344 llvm::Function *FunctionVal;
1345 llvm::BasicBlock *BasicBlockVal;
1346 llvm::TerminatorInst *TermInstVal;
1347 llvm::Instruction *InstVal;
1348 llvm::Constant *ConstVal;
1350 const llvm::Type *PrimType;
1351 std::list<llvm::PATypeHolder> *TypeList;
1352 llvm::PATypeHolder *TypeVal;
1353 llvm::Value *ValueVal;
1354 std::vector<llvm::Value*> *ValueList;
1355 llvm::ArgListType *ArgList;
1356 llvm::TypeWithAttrs TypeWithAttrs;
1357 llvm::TypeWithAttrsList *TypeWithAttrsList;
1358 llvm::ParamList *ParamList;
1360 // Represent the RHS of PHI node
1361 std::list<std::pair<llvm::Value*,
1362 llvm::BasicBlock*> > *PHIList;
1363 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1364 std::vector<llvm::Constant*> *ConstVector;
1366 llvm::GlobalValue::LinkageTypes Linkage;
1367 llvm::GlobalValue::VisibilityTypes Visibility;
1368 llvm::ParameterAttributes ParamAttrs;
1369 llvm::APInt *APIntVal;
1374 llvm::APFloat *FPVal;
1377 std::string *StrVal; // This memory must be deleted
1378 llvm::ValID ValIDVal;
1380 llvm::Instruction::BinaryOps BinaryOpVal;
1381 llvm::Instruction::TermOps TermOpVal;
1382 llvm::Instruction::MemoryOps MemOpVal;
1383 llvm::Instruction::CastOps CastOpVal;
1384 llvm::Instruction::OtherOps OtherOpVal;
1385 llvm::ICmpInst::Predicate IPredicate;
1386 llvm::FCmpInst::Predicate FPredicate;
1388 /* Line 193 of yacc.c. */
1389 #line 1390 "llvmAsmParser.tab.c"
1391 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1392 # define YYSTYPE_IS_DECLARED 1
1393 # define YYSTYPE_IS_TRIVIAL 1
1398 /* Copy the second part of user declarations. */
1401 /* Line 216 of yacc.c. */
1402 #line 1403 "llvmAsmParser.tab.c"
1409 typedef YYTYPE_UINT8 yytype_uint8;
1411 typedef unsigned char yytype_uint8;
1415 typedef YYTYPE_INT8 yytype_int8;
1416 #elif (defined __STDC__ || defined __C99__FUNC__ \
1417 || defined __cplusplus || defined _MSC_VER)
1418 typedef signed char yytype_int8;
1420 typedef short int yytype_int8;
1423 #ifdef YYTYPE_UINT16
1424 typedef YYTYPE_UINT16 yytype_uint16;
1426 typedef unsigned short int yytype_uint16;
1430 typedef YYTYPE_INT16 yytype_int16;
1432 typedef short int yytype_int16;
1436 # ifdef __SIZE_TYPE__
1437 # define YYSIZE_T __SIZE_TYPE__
1438 # elif defined size_t
1439 # define YYSIZE_T size_t
1440 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1441 || defined __cplusplus || defined _MSC_VER)
1442 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1443 # define YYSIZE_T size_t
1445 # define YYSIZE_T unsigned int
1449 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1452 # if defined YYENABLE_NLS && YYENABLE_NLS
1454 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1455 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1459 # define YY_(msgid) msgid
1463 /* Suppress unused-variable warnings by "using" E. */
1464 #if ! defined lint || defined __GNUC__
1465 # define YYUSE(e) ((void) (e))
1467 # define YYUSE(e) /* empty */
1470 /* Identity function, used to suppress warnings about constant conditions. */
1472 # define YYID(n) (n)
1474 #if (defined __STDC__ || defined __C99__FUNC__ \
1475 || defined __cplusplus || defined _MSC_VER)
1488 #if ! defined yyoverflow || YYERROR_VERBOSE
1490 /* The parser invokes alloca or malloc; define the necessary symbols. */
1492 # ifdef YYSTACK_USE_ALLOCA
1493 # if YYSTACK_USE_ALLOCA
1495 # define YYSTACK_ALLOC __builtin_alloca
1496 # elif defined __BUILTIN_VA_ARG_INCR
1497 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1499 # define YYSTACK_ALLOC __alloca
1500 # elif defined _MSC_VER
1501 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1502 # define alloca _alloca
1504 # define YYSTACK_ALLOC alloca
1505 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1506 || defined __cplusplus || defined _MSC_VER)
1507 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1509 # define _STDLIB_H 1
1516 # ifdef YYSTACK_ALLOC
1517 /* Pacify GCC's `empty if-body' warning. */
1518 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1519 # ifndef YYSTACK_ALLOC_MAXIMUM
1520 /* The OS might guarantee only one guard page at the bottom of the stack,
1521 and a page size can be as small as 4096 bytes. So we cannot safely
1522 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1523 to allow for a few compiler-allocated temporary stack slots. */
1524 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1527 # define YYSTACK_ALLOC YYMALLOC
1528 # define YYSTACK_FREE YYFREE
1529 # ifndef YYSTACK_ALLOC_MAXIMUM
1530 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1532 # if (defined __cplusplus && ! defined _STDLIB_H \
1533 && ! ((defined YYMALLOC || defined malloc) \
1534 && (defined YYFREE || defined free)))
1535 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1537 # define _STDLIB_H 1
1541 # define YYMALLOC malloc
1542 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1543 || defined __cplusplus || defined _MSC_VER)
1544 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1548 # define YYFREE free
1549 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1550 || defined __cplusplus || defined _MSC_VER)
1551 void free (void *); /* INFRINGES ON USER NAME SPACE */
1555 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1558 #if (! defined yyoverflow \
1559 && (! defined __cplusplus \
1560 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1562 /* A type that is properly aligned for any stack member. */
1569 /* The size of the maximum gap between one aligned stack and the next. */
1570 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1572 /* The size of an array large to enough to hold all stacks, each with
1574 # define YYSTACK_BYTES(N) \
1575 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1576 + YYSTACK_GAP_MAXIMUM)
1578 /* Copy COUNT objects from FROM to TO. The source and destination do
1581 # if defined __GNUC__ && 1 < __GNUC__
1582 # define YYCOPY(To, From, Count) \
1583 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1585 # define YYCOPY(To, From, Count) \
1589 for (yyi = 0; yyi < (Count); yyi++) \
1590 (To)[yyi] = (From)[yyi]; \
1596 /* Relocate STACK from its old location to the new one. The
1597 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1598 elements in the stack, and YYPTR gives the new location of the
1599 stack. Advance YYPTR to a properly aligned location for the next
1601 # define YYSTACK_RELOCATE(Stack) \
1604 YYSIZE_T yynewbytes; \
1605 YYCOPY (&yyptr->Stack, Stack, yysize); \
1606 Stack = &yyptr->Stack; \
1607 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1608 yyptr += yynewbytes / sizeof (*yyptr); \
1614 /* YYFINAL -- State number of the termination state. */
1616 /* YYLAST -- Last index in YYTABLE. */
1619 /* YYNTOKENS -- Number of terminals. */
1620 #define YYNTOKENS 166
1621 /* YYNNTS -- Number of nonterminals. */
1623 /* YYNRULES -- Number of rules. */
1624 #define YYNRULES 324
1625 /* YYNRULES -- Number of states. */
1626 #define YYNSTATES 633
1628 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1629 #define YYUNDEFTOK 2
1630 #define YYMAXUTOK 406
1632 #define YYTRANSLATE(YYX) \
1633 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1635 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1636 static const yytype_uint8 yytranslate[] =
1638 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 152, 153, 156, 2, 155, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1644 161, 154, 162, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 158, 157, 160, 2, 2, 2, 2, 2, 165,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 159, 2, 2, 163, 2, 164, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1664 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1665 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1666 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1667 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1668 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1669 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1670 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1671 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1672 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1673 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1674 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1675 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1676 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1677 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1678 145, 146, 147, 148, 149, 150, 151
1682 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1684 static const yytype_uint16 yyprhs[] =
1686 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1687 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1688 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1689 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1690 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1691 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1692 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1693 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1694 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1695 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1696 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1697 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1698 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1699 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1700 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1701 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1702 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1703 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1704 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1705 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1706 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1707 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1708 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1709 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1710 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1711 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
1712 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1713 747, 750, 753, 757, 760, 761, 764, 766, 770, 773,
1714 776, 780, 790, 800, 809, 824, 826, 828, 835, 841,
1715 844, 851, 859, 864, 869, 876, 883, 884, 885, 889,
1716 892, 894, 900, 906, 913, 920, 925, 932, 937, 942,
1717 949, 956, 959, 968, 970, 972, 973, 977, 984, 988,
1718 995, 998, 1004, 1012, 1018
1721 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1722 static const yytype_int16 yyrhs[] =
1724 212, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1725 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1726 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1727 -1, 86, -1, 118, -1, 119, -1, 120, -1, 121,
1728 -1, 122, -1, 123, -1, 124, -1, 125, -1, 126,
1729 -1, 127, -1, 128, -1, 129, -1, 92, -1, 93,
1730 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1731 -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
1732 -1, 104, -1, 105, -1, 106, -1, 107, -1, 108,
1733 -1, 109, -1, 110, -1, 111, -1, 98, -1, 99,
1734 -1, 100, -1, 101, -1, 26, -1, 27, -1, 11,
1735 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1736 -1, 19, -1, 22, -1, 24, -1, 174, -1, -1,
1737 54, 152, 4, 153, -1, -1, 174, 154, -1, -1,
1738 20, -1, 23, -1, 180, -1, -1, 178, 154, -1,
1739 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1740 46, -1, 48, -1, 50, -1, -1, 149, -1, 150,
1741 -1, 151, -1, -1, 46, -1, 48, -1, -1, 42,
1742 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1743 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1744 -1, 66, -1, 61, 4, -1, 138, -1, 119, -1,
1745 137, -1, 120, -1, 140, -1, 141, -1, 143, -1,
1746 144, -1, 145, -1, 53, 4, -1, -1, 189, 188,
1747 -1, 139, -1, 142, -1, 138, -1, 137, -1, 146,
1748 -1, 147, -1, -1, 191, 190, -1, -1, 148, 22,
1749 -1, -1, 53, 4, -1, -1, 155, 53, 4, -1,
1750 34, 22, -1, -1, 195, -1, -1, 155, 198, 197,
1751 -1, 195, -1, 53, 4, -1, 11, -1, 12, -1,
1752 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1753 49, -1, 199, -1, 200, 176, 156, -1, 234, -1,
1754 157, 4, -1, 200, 152, 204, 153, 191, -1, 10,
1755 152, 204, 153, 191, -1, 158, 4, 159, 200, 160,
1756 -1, 161, 4, 159, 200, 162, -1, 163, 205, 164,
1757 -1, 163, 164, -1, 161, 163, 205, 164, 162, -1,
1758 161, 163, 164, 162, -1, 200, 189, -1, 200, -1,
1759 10, -1, 201, -1, 203, 155, 201, -1, 203, -1,
1760 203, 155, 39, -1, 39, -1, -1, 200, -1, 205,
1761 155, 200, -1, 200, 158, 208, 160, -1, 200, 158,
1762 160, -1, 200, 165, 22, -1, 200, 161, 208, 162,
1763 -1, 200, 163, 208, 164, -1, 200, 163, 164, -1,
1764 200, 161, 163, 208, 164, 162, -1, 200, 161, 163,
1765 164, 162, -1, 200, 40, -1, 200, 41, -1, 200,
1766 234, -1, 200, 207, -1, 200, 25, -1, 172, 3,
1767 -1, 172, 5, -1, 172, 4, -1, 172, 6, -1,
1768 11, 26, -1, 11, 27, -1, 173, 9, -1, 169,
1769 152, 206, 38, 200, 153, -1, 117, 152, 206, 246,
1770 153, -1, 131, 152, 206, 155, 206, 155, 206, 153,
1771 -1, 167, 152, 206, 155, 206, 153, -1, 168, 152,
1772 206, 155, 206, 153, -1, 90, 170, 152, 206, 155,
1773 206, 153, -1, 91, 171, 152, 206, 155, 206, 153,
1774 -1, 133, 152, 206, 155, 206, 153, -1, 134, 152,
1775 206, 155, 206, 155, 206, 153, -1, 135, 152, 206,
1776 155, 206, 155, 206, 153, -1, 208, 155, 206, -1,
1777 206, -1, 32, -1, 33, -1, 37, -1, -1, 202,
1778 234, -1, 123, 152, 211, 38, 200, 153, -1, 213,
1779 -1, -1, 214, -1, 213, 214, -1, -1, 31, 215,
1780 230, -1, -1, 30, 216, 231, -1, 59, 58, 220,
1781 -1, 177, 18, 200, -1, 177, 18, 10, -1, -1,
1782 179, 183, 210, 209, 206, 176, 217, 197, -1, -1,
1783 179, 181, 183, 210, 209, 206, 176, 218, 197, -1,
1784 -1, 179, 182, 183, 210, 209, 200, 176, 219, 197,
1785 -1, 179, 183, 35, 186, 211, -1, 51, 221, -1,
1786 55, 154, 222, -1, 22, -1, 52, 154, 22, -1,
1787 67, 154, 22, -1, 158, 223, 160, -1, 223, 155,
1788 22, -1, 22, -1, -1, 224, 155, 200, 189, 175,
1789 -1, 200, 189, 175, -1, 224, -1, 224, 155, 39,
1790 -1, 39, -1, -1, 187, 202, 178, 152, 225, 153,
1791 191, 196, 193, 192, -1, 28, -1, 163, -1, 185,
1792 183, 226, 227, -1, 29, -1, 164, -1, 238, 229,
1793 -1, 184, 183, 226, -1, -1, 60, -1, 3, -1,
1794 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1795 41, -1, 25, -1, 161, 208, 162, -1, 207, -1,
1796 58, 232, 22, 155, 22, -1, 7, -1, 8, -1,
1797 174, -1, 178, -1, 234, -1, 233, -1, 200, 235,
1798 -1, 236, -1, 237, 155, 236, -1, 238, 239, -1,
1799 228, 239, -1, 240, 177, 241, -1, 240, 243, -1,
1800 -1, 68, 235, -1, 21, -1, 21, 68, 235, -1,
1801 69, 237, -1, 69, 10, -1, 70, 17, 235, -1,
1802 70, 11, 235, 155, 17, 235, 155, 17, 235, -1,
1803 71, 172, 235, 155, 17, 235, 158, 242, 160, -1,
1804 71, 172, 235, 155, 17, 235, 158, 160, -1, 72,
1805 187, 202, 235, 152, 245, 153, 191, 38, 17, 235,
1806 73, 17, 235, -1, 73, -1, 74, -1, 242, 172,
1807 233, 155, 17, 235, -1, 172, 233, 155, 17, 235,
1808 -1, 177, 248, -1, 200, 158, 235, 155, 235, 160,
1809 -1, 244, 155, 158, 235, 155, 235, 160, -1, 200,
1810 189, 235, 189, -1, 17, 189, 235, 189, -1, 245,
1811 155, 200, 189, 235, 189, -1, 245, 155, 17, 189,
1812 235, 189, -1, -1, -1, 246, 155, 236, -1, 57,
1813 56, -1, 56, -1, 167, 200, 235, 155, 235, -1,
1814 168, 200, 235, 155, 235, -1, 90, 170, 200, 235,
1815 155, 235, -1, 91, 171, 200, 235, 155, 235, -1,
1816 169, 236, 38, 200, -1, 131, 236, 155, 236, 155,
1817 236, -1, 132, 236, 155, 200, -1, 133, 236, 155,
1818 236, -1, 134, 236, 155, 236, 155, 236, -1, 135,
1819 236, 155, 236, 155, 236, -1, 130, 244, -1, 247,
1820 187, 202, 235, 152, 245, 153, 191, -1, 250, -1,
1821 36, -1, -1, 112, 200, 194, -1, 112, 200, 155,
1822 11, 235, 194, -1, 113, 200, 194, -1, 113, 200,
1823 155, 11, 235, 194, -1, 114, 236, -1, 249, 115,
1824 200, 235, 194, -1, 249, 116, 236, 155, 200, 235,
1825 194, -1, 136, 200, 234, 155, 4, -1, 117, 200,
1829 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1830 static const yytype_uint16 yyrline[] =
1832 0, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
1833 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115,
1834 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1116, 1116, 1119,
1835 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1127,
1836 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132,
1837 1132, 1133, 1133, 1134, 1135, 1140, 1141, 1141, 1141, 1141,
1838 1141, 1143, 1143, 1143, 1144, 1144, 1146, 1147, 1151, 1155,
1839 1160, 1160, 1162, 1163, 1168, 1174, 1175, 1176, 1177, 1178,
1840 1182, 1183, 1184, 1188, 1189, 1190, 1191, 1195, 1196, 1197,
1841 1201, 1202, 1203, 1204, 1205, 1209, 1210, 1211, 1214, 1215,
1842 1216, 1217, 1218, 1219, 1220, 1227, 1228, 1229, 1230, 1231,
1843 1232, 1233, 1234, 1235, 1236, 1240, 1241, 1246, 1247, 1248,
1844 1249, 1250, 1251, 1254, 1255, 1260, 1261, 1268, 1269, 1275,
1845 1276, 1285, 1293, 1294, 1299, 1300, 1301, 1306, 1319, 1319,
1846 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337, 1342,
1847 1350, 1380, 1405, 1410, 1420, 1430, 1434, 1444, 1451, 1460,
1848 1467, 1472, 1477, 1484, 1485, 1492, 1499, 1507, 1513, 1525,
1849 1553, 1569, 1596, 1624, 1650, 1670, 1696, 1716, 1728, 1735,
1850 1801, 1811, 1821, 1827, 1837, 1843, 1853, 1858, 1863, 1876,
1851 1888, 1910, 1918, 1924, 1935, 1940, 1945, 1951, 1957, 1966,
1852 1970, 1978, 1978, 1981, 1981, 1984, 1996, 2017, 2022, 2030,
1853 2031, 2035, 2035, 2039, 2039, 2042, 2045, 2069, 2081, 2080,
1854 2092, 2091, 2101, 2100, 2111, 2151, 2154, 2160, 2170, 2174,
1855 2179, 2181, 2186, 2191, 2200, 2210, 2221, 2225, 2234, 2243,
1856 2248, 2382, 2382, 2384, 2393, 2393, 2395, 2400, 2412, 2416,
1857 2421, 2425, 2429, 2433, 2437, 2441, 2445, 2449, 2453, 2478,
1858 2482, 2492, 2496, 2500, 2505, 2512, 2512, 2518, 2527, 2532,
1859 2537, 2541, 2550, 2559, 2568, 2572, 2576, 2581, 2588, 2595,
1860 2599, 2604, 2614, 2633, 2642, 2733, 2737, 2744, 2755, 2768,
1861 2778, 2789, 2799, 2810, 2818, 2828, 2835, 2838, 2839, 2846,
1862 2850, 2855, 2871, 2888, 2902, 2916, 2928, 2936, 2943, 2949,
1863 2955, 2961, 2976, 3074, 3079, 3083, 3090, 3097, 3105, 3112,
1864 3120, 3128, 3142, 3159, 3167
1868 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1869 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1870 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1871 static const char *const yytname[] =
1873 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1874 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1875 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1876 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1877 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1878 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1879 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1880 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1881 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1882 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1883 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1884 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1885 "DATALAYOUT", "UNWIND_TO", "RET", "BR", "SWITCH", "INVOKE", "UNWIND",
1886 "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM",
1887 "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP",
1888 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1889 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1890 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1891 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1892 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1893 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1894 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1895 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1896 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1897 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1898 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1899 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1900 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1901 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1902 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1903 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1904 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1905 "SectionString", "OptSection", "GlobalVarAttributes",
1906 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1907 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1908 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1909 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1910 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1911 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1912 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1913 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1914 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1915 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1916 "InstVal", "OptVolatile", "MemoryInst", 0
1921 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1923 static const yytype_uint16 yytoknum[] =
1925 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1926 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1927 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1928 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1929 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1930 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1931 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1932 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1933 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1934 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1935 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1936 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1937 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1938 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1939 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1940 405, 406, 40, 41, 61, 44, 42, 92, 91, 120,
1941 93, 60, 62, 123, 125, 99
1945 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1946 static const yytype_uint8 yyr1[] =
1948 0, 166, 167, 167, 167, 167, 167, 167, 167, 167,
1949 167, 168, 168, 168, 168, 168, 168, 169, 169, 169,
1950 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1951 170, 170, 170, 170, 170, 170, 170, 170, 170, 171,
1952 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1953 171, 171, 171, 171, 171, 172, 173, 173, 173, 173,
1954 173, 174, 174, 174, 175, 175, 176, 176, 177, 177,
1955 178, 178, 179, 179, 180, 181, 181, 181, 181, 181,
1956 182, 182, 182, 183, 183, 183, 183, 184, 184, 184,
1957 185, 185, 185, 185, 185, 186, 186, 186, 187, 187,
1958 187, 187, 187, 187, 187, 188, 188, 188, 188, 188,
1959 188, 188, 188, 188, 188, 189, 189, 190, 190, 190,
1960 190, 190, 190, 191, 191, 192, 192, 193, 193, 194,
1961 194, 195, 196, 196, 197, 197, 198, 198, 199, 199,
1962 199, 199, 199, 199, 199, 200, 200, 200, 200, 200,
1963 200, 200, 200, 200, 200, 200, 200, 200, 201, 202,
1964 202, 203, 203, 204, 204, 204, 204, 205, 205, 206,
1965 206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
1966 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1967 207, 207, 207, 207, 207, 207, 207, 207, 207, 208,
1968 208, 209, 209, 210, 210, 211, 211, 212, 212, 213,
1969 213, 215, 214, 216, 214, 214, 214, 214, 217, 214,
1970 218, 214, 219, 214, 214, 214, 214, 220, 221, 221,
1971 222, 223, 223, 223, 224, 224, 225, 225, 225, 225,
1972 226, 227, 227, 228, 229, 229, 230, 231, 232, 232,
1973 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1974 233, 234, 234, 234, 234, 235, 235, 236, 237, 237,
1975 238, 238, 239, 240, 240, 240, 240, 240, 241, 241,
1976 241, 241, 241, 241, 241, 241, 241, 242, 242, 243,
1977 244, 244, 245, 245, 245, 245, 245, 246, 246, 247,
1978 247, 248, 248, 248, 248, 248, 248, 248, 248, 248,
1979 248, 248, 248, 248, 249, 249, 250, 250, 250, 250,
1980 250, 250, 250, 250, 250
1983 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1984 static const yytype_uint8 yyr2[] =
1986 0, 2, 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, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1993 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1994 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1995 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1996 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1997 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1998 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1999 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
2000 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2001 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2002 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2003 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2004 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2005 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2006 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2007 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2008 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2009 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2010 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2011 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2012 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2013 2, 2, 3, 2, 0, 2, 1, 3, 2, 2,
2014 3, 9, 9, 8, 14, 1, 1, 6, 5, 2,
2015 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2016 1, 5, 5, 6, 6, 4, 6, 4, 4, 6,
2017 6, 2, 8, 1, 1, 0, 3, 6, 3, 6,
2021 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2022 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2023 means the default is an error. */
2024 static const yytype_uint16 yydefact[] =
2026 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2027 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2028 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
2029 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2030 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
2031 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
2032 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2033 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2034 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
2035 276, 0, 271, 69, 244, 245, 246, 270, 228, 229,
2036 232, 0, 166, 149, 0, 0, 0, 0, 155, 167,
2037 0, 0, 166, 0, 0, 0, 97, 96, 0, 201,
2038 202, 0, 0, 99, 100, 101, 102, 103, 0, 247,
2039 0, 0, 250, 251, 252, 257, 253, 254, 255, 256,
2040 248, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2041 14, 15, 16, 11, 12, 13, 0, 0, 0, 17,
2042 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
2043 28, 0, 0, 0, 0, 0, 0, 0, 0, 259,
2044 266, 265, 275, 315, 273, 0, 230, 165, 115, 161,
2045 163, 0, 0, 0, 0, 0, 0, 154, 0, 0,
2046 147, 0, 0, 160, 0, 159, 0, 224, 138, 139,
2047 140, 143, 142, 141, 0, 0, 67, 67, 104, 0,
2048 241, 242, 243, 277, 249, 0, 29, 30, 31, 32,
2049 33, 34, 35, 36, 37, 38, 0, 53, 54, 49,
2050 50, 51, 52, 39, 40, 41, 42, 43, 44, 45,
2051 46, 47, 48, 0, 0, 0, 0, 0, 0, 200,
2052 0, 0, 0, 0, 314, 300, 0, 0, 0, 0,
2053 98, 285, 286, 0, 0, 0, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 0, 0, 0, 0, 272,
2055 98, 289, 0, 313, 231, 158, 0, 123, 67, 67,
2056 157, 0, 168, 0, 123, 67, 67, 0, 205, 186,
2057 187, 182, 184, 183, 185, 188, 181, 177, 178, 0,
2058 0, 0, 0, 180, 179, 218, 0, 0, 0, 0,
2059 297, 0, 0, 0, 0, 0, 258, 0, 0, 0,
2060 299, 279, 67, 268, 278, 0, 0, 55, 0, 0,
2061 0, 0, 129, 129, 320, 67, 67, 311, 0, 0,
2062 0, 0, 0, 67, 67, 67, 0, 0, 0, 0,
2063 0, 106, 108, 107, 105, 109, 110, 111, 112, 113,
2064 116, 164, 162, 151, 152, 153, 156, 66, 150, 220,
2065 222, 0, 170, 0, 0, 0, 174, 0, 171, 134,
2066 239, 0, 0, 0, 0, 0, 0, 0, 0, 199,
2067 0, 0, 0, 267, 0, 0, 280, 0, 0, 67,
2068 67, 0, 316, 0, 318, 297, 0, 0, 0, 0,
2069 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
2070 114, 120, 119, 117, 118, 121, 122, 124, 134, 134,
2071 0, 169, 155, 167, 0, 172, 173, 0, 219, 238,
2072 115, 236, 0, 260, 0, 0, 190, 0, 0, 0,
2073 0, 0, 0, 0, 67, 269, 0, 0, 0, 0,
2074 0, 0, 0, 0, 324, 0, 0, 0, 307, 308,
2075 0, 0, 0, 0, 0, 305, 0, 129, 0, 221,
2076 223, 67, 176, 0, 0, 0, 136, 134, 65, 0,
2077 123, 0, 0, 298, 0, 196, 0, 0, 192, 193,
2078 189, 0, 0, 296, 0, 0, 129, 130, 129, 0,
2079 0, 0, 0, 0, 323, 301, 302, 296, 0, 321,
2080 67, 206, 175, 131, 137, 135, 64, 235, 237, 115,
2081 132, 194, 195, 0, 0, 0, 0, 0, 115, 115,
2082 0, 303, 304, 317, 319, 0, 0, 306, 309, 310,
2083 0, 129, 65, 133, 127, 191, 197, 198, 0, 0,
2084 0, 0, 123, 0, 290, 0, 123, 322, 234, 0,
2085 125, 0, 283, 0, 0, 106, 108, 115, 115, 0,
2086 115, 115, 291, 312, 128, 0, 240, 281, 0, 282,
2087 0, 293, 292, 0, 0, 0, 126, 0, 0, 0,
2088 115, 115, 0, 0, 0, 295, 294, 288, 0, 0,
2092 /* YYDEFGOTO[NTERM-NUM]. */
2093 static const yytype_int16 yydefgoto[] =
2095 -1, 176, 177, 178, 236, 253, 214, 215, 78, 547,
2096 113, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2097 118, 128, 380, 295, 447, 383, 606, 590, 422, 506,
2098 574, 458, 507, 80, 216, 189, 206, 190, 191, 110,
2099 259, 179, 260, 121, 87, 207, 16, 17, 18, 20,
2100 19, 399, 448, 449, 62, 23, 60, 101, 461, 462,
2101 129, 222, 54, 96, 55, 48, 225, 180, 82, 182,
2102 343, 344, 56, 92, 93, 289, 594, 184, 357, 560,
2103 404, 290, 291, 292, 293
2106 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2108 #define YYPACT_NINF -565
2109 static const yytype_int16 yypact[] =
2111 641, -565, -565, -565, -565, -565, -565, -565, -29, -130,
2112 -24, -105, 35, -59, 335, -565, 103, 1109, -565, 53,
2113 231, -28, 10, -565, 31, 139, -565, 1574, -565, -565,
2114 -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,
2115 95, 95, 164, -565, -565, -565, -565, 95, -565, -565,
2116 -565, -565, -565, 95, -12, -565, 7, 151, 155, 181,
2117 -565, -565, -565, -565, -565, -68, -565, -565, -565, -565,
2118 -565, -565, -565, -565, 205, 225, 9, 108, -565, -565,
2119 -565, 50, -565, 149, 149, 242, -565, 182, 414, 414,
2120 166, 965, -565, 198, -565, -565, -565, -565, -565, -565,
2121 -565, -110, 1185, -565, 89, 118, 590, -68, -565, 50,
2122 -81, 69, 1185, 82, 182, 182, -565, -565, 1139, -565,
2123 -565, 1592, 281, -565, -565, -565, -565, -565, 1632, -565,
2124 -21, 965, -565, -565, -565, -565, -565, -565, -565, -565,
2125 228, -565, -565, -565, -565, -565, -565, -565, -565, -565,
2126 -565, -565, -565, -565, -565, -565, 395, 547, 143, -565,
2127 -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,
2128 -565, 154, 159, 163, 169, 1592, 177, 184, 188, -565,
2129 -565, -565, -565, 1902, -565, 311, -565, -565, 50, -565,
2130 189, 192, 1691, 1691, 196, -74, 1691, -565, 346, 203,
2131 -565, 1592, 1691, -68, 199, 50, 411, -565, 343, 350,
2132 354, 355, 356, 357, 314, 358, 1241, 319, -565, 12,
2133 -565, -565, -565, -565, -565, 353, -565, -565, -565, -565,
2134 -565, -565, -565, -565, -565, -565, 224, -565, -565, -565,
2135 -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,
2136 -565, -565, -565, 232, 1592, 1592, 1592, 1592, 1592, -565,
2137 -50, 1592, 1592, 1592, -565, -565, 336, 1749, 62, 382,
2138 414, -565, -565, 395, 547, 1691, 1691, 1691, 1691, 1691,
2139 1691, 1691, 1691, 1691, 1691, 1691, 1691, 1691, 1691, -565,
2140 414, -565, 148, -565, -565, 393, 1473, -565, -43, -15,
2141 -565, 233, 50, 243, -565, 319, -39, 1139, -565, -565,
2142 -565, -565, -565, -565, -565, -565, -565, -565, -565, 47,
2143 1789, 769, 375, -565, -565, -565, 248, 246, 1592, 1592,
2144 -565, 253, 254, 257, 261, 1592, -565, 266, 267, 369,
2145 -565, -68, 825, -565, 268, 965, 965, -565, 965, 1632,
2146 1691, 1691, 23, 28, -565, 825, -44, 270, 271, 274,
2147 277, 282, 283, 174, 825, 825, 398, 1632, 1691, 1691,
2148 435, -565, -565, -565, -565, -565, -565, -565, -565, -565,
2149 -565, -565, -565, 323, -565, -565, -565, -565, 323, -565,
2150 82, 402, -565, 40, 874, 57, -565, -70, -565, 287,
2151 1513, 421, 290, 294, 141, 1592, 1592, 1592, 1592, -565,
2152 1592, 1592, 1691, -565, 1691, 296, -565, 297, 965, 825,
2153 825, 15, -565, 19, -565, -565, 965, 295, 1691, 1691,
2154 1691, 1691, 1691, 299, 309, 313, 1691, 965, 825, 316,
2155 -565, -565, -565, -565, -565, -565, -565, -565, 287, 287,
2156 1691, -565, 320, 1094, -64, -565, -565, -1, -565, -565,
2157 50, 318, 328, -565, 1592, 1592, -565, 1691, 344, 345,
2158 347, 348, 351, 363, 84, -565, 484, 492, 365, 364,
2159 368, 965, 506, 965, 371, 372, 965, 374, 50, -565,
2160 377, 380, 514, 965, 965, 50, 389, 387, 1691, -565,
2161 -565, 87, -565, 362, 521, 540, -565, 287, 194, 1534,
2162 -565, 392, 394, -565, 1592, -565, 1592, 1592, -565, -565,
2163 -565, 965, 965, 1807, 965, 965, 387, -565, 387, 965,
2164 391, 1691, 1691, 1691, -565, -565, -565, 1807, 497, -565,
2165 825, -565, -565, -565, -565, -565, -565, -565, -565, 50,
2166 -3, -565, -565, 399, 401, 405, 396, 397, 79, 50,
2167 175, -565, -565, -565, -565, 400, 965, -565, -565, -565,
2168 202, 387, 194, -565, 508, -565, -565, -565, 542, 3,
2169 682, 682, -565, 1850, -565, 403, -565, -565, -565, 560,
2170 418, 965, -565, 1382, 5, 415, 416, -565, -565, 252,
2171 79, 50, -565, 323, -565, 548, -565, -565, 420, -565,
2172 1382, 393, 393, 552, 682, 682, -565, 554, 422, 965,
2173 -565, -565, 965, 559, 505, 393, 393, -565, 965, 562,
2177 /* YYPGOTO[NTERM-NUM]. */
2178 static const yytype_int16 yypgoto[] =
2180 -565, 404, 406, 407, 307, 308, -267, -565, 0, 14,
2181 -195, 488, 4, -565, -565, -565, -565, 269, -565, -565,
2182 -565, -243, -565, -452, -565, -299, -565, -565, -341, 34,
2183 -565, -429, -565, -565, -26, 298, -125, -565, 479, 486,
2184 -103, -210, -232, 153, 217, 286, -565, -565, 582, -565,
2185 -565, -565, -565, -565, -565, -565, -565, -565, -565, -565,
2186 519, -565, -565, -565, -565, -565, -565, -564, -66, 102,
2187 -240, -565, -565, 555, -565, -565, -565, -565, -565, 78,
2188 191, -565, -565, -565, -565
2191 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2192 positive, shift that token. If negative, reduce the rule which
2193 number is the opposite. If zero, do what YYDEFACT says.
2194 If YYTABLE_NINF, syntax error. */
2195 #define YYTABLE_NINF -209
2196 static const yytype_int16 yytable[] =
2198 11, 81, 348, 219, 13, 388, 323, 220, 508, 90,
2199 111, 111, 424, 105, 347, 111, 347, 11, 217, 499,
2200 500, 13, 325, 21, 24, 181, 481, 349, 90, 608,
2201 483, 504, 2, 504, 25, 4, 94, 354, 22, 111,
2202 358, 359, 360, 361, 362, 185, 618, 367, 366, 26,
2203 186, 109, 505, 27, 63, 64, 91, 107, 208, 209,
2204 210, 211, 212, 213, 72, 181, 1, 2, 482, 3,
2205 4, 5, 482, 345, 196, 91, 188, 111, 545, 346,
2206 109, 196, 111, 197, 102, 335, 188, 393, 395, 397,
2207 301, 335, 205, 11, 456, 28, 73, 572, 305, 45,
2208 503, 46, 205, 43, 111, 335, 580, 581, 112, 112,
2209 389, 390, 336, 112, 426, 63, 64, 384, 107, 66,
2210 67, 68, 69, 70, 71, 72, 57, 1, 2, 439,
2211 3, 4, 5, -144, 441, 442, 443, 112, 111, 444,
2212 308, 111, 221, 445, 446, 611, 612, 385, 614, 615,
2213 324, 330, 331, 332, 333, 334, 539, 73, 337, 338,
2214 339, 61, 454, 592, 58, 609, 298, 299, 625, 626,
2215 302, 95, 106, 98, 475, 112, 306, 99, 421, -67,
2216 112, 63, 64, 423, -67, 563, 86, 564, 487, 59,
2217 489, 490, 491, 1, 2, 335, 3, 4, 5, 85,
2218 451, 86, 112, 100, 74, 75, -67, 392, 76, 103,
2219 77, 550, 335, 1, 119, 120, 3, 1, 5, 455,
2220 3, 198, 5, 326, 418, 402, 403, 513, 111, 104,
2221 587, -144, 409, 223, 131, -144, 112, 520, 200, 112,
2222 541, 342, 437, 323, 37, 38, 39, 370, 192, 352,
2223 353, 342, 355, 356, 342, 342, 342, 342, 342, 363,
2224 364, 365, 342, 368, 369, 74, 75, 201, 202, 76,
2225 188, 77, 108, 49, 50, 51, 181, 193, 52, 181,
2226 181, 205, 181, 599, 116, 218, 117, 603, 224, 181,
2227 613, 567, 568, 569, 466, 254, 467, 433, 181, 181,
2228 114, 115, 468, 469, 470, 471, 255, 472, 473, 83,
2229 84, 256, 593, 371, 372, 257, 88, 311, 312, 313,
2230 314, 258, 89, 205, 419, 420, 112, 610, 582, 261,
2231 583, 373, 374, 294, 375, 376, 262, 377, 378, 379,
2232 263, 205, 438, 342, 296, 297, -55, -55, -55, -55,
2233 303, 307, 181, 181, 181, 586, 304, 583, 300, -56,
2234 181, 511, 512, -57, -60, -59, -58, 315, 453, 309,
2235 310, 181, 181, 111, 460, 327, 328, 29, 30, 31,
2236 32, 33, 34, 35, 329, 36, 474, 324, 342, 441,
2237 442, 443, 340, 347, 444, 386, 387, 398, 445, 446,
2238 400, 401, 342, 488, 342, 342, 342, 412, 405, 406,
2239 495, 553, 407, 554, 555, 181, 408, 181, 63, 64,
2240 181, 410, 411, 414, 501, 427, 428, 181, 181, 429,
2241 1, 2, 430, 3, 4, 5, 436, 431, 432, 440,
2242 450, 342, 457, 463, 413, 464, 370, 415, 416, 465,
2243 417, 476, 477, 486, 492, 181, 181, 425, 181, 181,
2244 441, 442, 443, 181, 493, 444, 434, 435, 494, 445,
2245 446, 498, 540, 509, 181, 122, 123, 124, 125, 126,
2246 127, 510, 502, 549, 37, 38, 39, 226, 227, 228,
2247 229, 230, 231, 232, 233, 234, 235, 559, 515, 514,
2248 181, 521, 516, 517, 518, 342, 342, 342, 546, 522,
2249 527, 559, 371, 372, 181, 181, 519, 523, 534, 524,
2250 478, 479, 480, 525, 542, 181, 467, 529, 485, 531,
2251 373, 374, 532, 375, 376, 533, 377, 378, 379, 496,
2252 497, 537, 538, 543, 544, 551, 566, 552, 181, 181,
2253 482, 578, 575, 181, 576, 579, 181, 601, 577, 591,
2254 584, 589, 181, 602, 604, 181, 605, -18, -19, 619,
2255 616, 622, 546, 237, 238, 617, 628, 623, 629, 631,
2256 350, 183, 351, 526, 573, 528, 588, 286, 530, 287,
2257 288, 199, 195, 391, 382, 535, 536, 63, 64, 44,
2258 107, 66, 67, 68, 69, 70, 71, 72, 130, 1,
2259 2, 97, 3, 4, 5, 570, 484, 0, 0, 0,
2260 0, 0, 0, 556, 557, 0, 561, 562, 0, 0,
2261 0, 565, 0, 0, 0, 0, 0, 0, 0, 73,
2262 0, -208, 571, 0, 0, 239, 240, 241, 242, 243,
2263 244, 245, 246, 247, 248, 249, 250, 251, 252, -69,
2264 1, 2, 0, 3, 4, 5, 0, 0, 585, 0,
2265 0, 6, 7, 0, 0, 0, 0, 0, 0, 0,
2266 0, 0, 597, 598, 0, 132, 133, 0, 0, 63,
2267 64, 134, 8, 607, 0, 0, 9, 0, 0, 0,
2268 10, 1, 2, 0, 3, 4, 5, 135, 136, 137,
2269 0, 0, 0, 0, 0, 0, 620, 621, 0, 0,
2270 0, 624, 138, 139, 627, 0, 0, 0, 0, 0,
2271 630, 0, 0, 632, 0, 370, 0, 0, 0, 0,
2272 140, 0, 0, 0, 0, 0, 0, 74, 75, 0,
2273 0, 76, 0, 77, 194, 0, 0, 141, 142, 143,
2274 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
2275 154, 155, 156, 157, 0, 0, 63, 64, 0, 107,
2276 208, 209, 210, 211, 212, 213, 72, 0, 1, 2,
2277 0, 3, 4, 5, 0, 0, 0, 0, 0, 158,
2278 159, 595, 596, 162, 163, 164, 165, 166, 167, 168,
2279 169, 170, 0, 171, 0, 172, 173, 174, 73, 373,
2280 374, 0, 375, 376, 0, 377, 378, 379, 132, 133,
2281 0, 0, 63, 64, 134, 0, 0, 0, 0, 0,
2282 0, 0, 0, 175, 1, 2, 0, 3, 4, 5,
2283 135, 136, 137, 0, 0, 0, 0, 0, 0, 0,
2284 0, 0, 0, 0, 0, 138, 139, 0, 0, 0,
2285 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2286 0, 63, 64, 140, 107, 208, 209, 210, 211, 212,
2287 213, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2288 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2289 151, 152, 153, 154, 155, 156, 157, 0, 0, 0,
2290 0, 0, 0, 73, 0, 0, 74, 75, 0, 0,
2291 76, 0, 77, 396, 0, 0, 0, 0, 0, 0,
2292 0, 0, 158, 159, 160, 161, 162, 163, 164, 165,
2293 166, 167, 168, 169, 170, 0, 171, 0, 172, 173,
2294 174, 0, 0, 0, 0, 0, 0, 0, 132, 133,
2295 0, 0, 63, 64, 134, 0, 0, 112, 0, 0,
2296 0, 0, 0, 0, 1, 2, 175, 3, 4, 5,
2297 135, 136, 137, 0, 0, 0, 0, 0, 0, 0,
2298 0, 0, 0, 0, 0, 138, 139, 0, 0, 0,
2299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2300 0, 0, 0, 140, 0, 0, 0, 0, 0, 0,
2301 0, 74, 75, 0, 0, 76, 0, 77, 452, 0,
2302 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2303 151, 152, 153, 154, 155, 156, 157, 0, 0, 0,
2304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2305 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2306 0, 0, 158, 159, 160, 161, 162, 163, 164, 165,
2307 166, 167, 168, 169, 170, 0, 171, 0, 172, 173,
2308 174, 63, 64, 0, 0, 0, 0, 0, 0, -207,
2309 0, 0, 0, 1, 2, 0, 3, 4, 5, 316,
2310 0, 0, 0, 0, 0, 0, 175, -69, 1, 2,
2311 0, 3, 4, 5, 317, 318, 0, 0, 0, 6,
2312 7, 0, 0, 0, 0, 0, 63, 64, 111, 203,
2313 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2314 8, 3, 4, 5, 9, 0, 0, 0, 10, 141,
2315 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
2316 152, 153, 154, 155, 156, 157, 0, 0, 73, 0,
2317 0, 0, 63, 64, 0, 107, 66, 67, 68, 69,
2318 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2319 0, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2320 167, 168, 169, 170, 187, 171, 0, 172, 173, 174,
2321 0, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 112, 0, 63, 64,
2323 -67, 0, 319, 0, 0, 320, 0, 321, 0, 322,
2324 1, 2, 204, 3, 4, 5, 316, 0, 0, 0,
2325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2326 0, 317, 318, 0, 0, 0, 0, 0, 0, 0,
2327 0, 0, 0, 0, 0, 111, 74, 75, 0, 0,
2328 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
2329 0, 0, 0, 0, 0, 0, 141, 142, 143, 144,
2330 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
2331 155, 156, 157, 0, 0, 0, 0, 0, 0, 0,
2332 0, 0, 74, 75, 0, 0, 76, 0, 77, 0,
2333 0, 0, 0, 0, 0, 0, 0, 0, 158, 159,
2334 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
2335 170, 0, 171, 0, 172, 173, 174, 0, 0, 0,
2336 0, 0, 0, 0, 0, 132, 133, 0, 0, 0,
2337 0, 134, 0, 112, 0, 0, 0, 0, 0, 319,
2338 0, 0, 320, 0, 321, 0, 322, 135, 136, 137,
2339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2340 0, 0, 138, 139, 0, 0, 0, 0, 0, 0,
2341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2342 140, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2343 0, 0, 0, 0, 0, 0, 0, 141, 142, 143,
2344 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
2345 154, 155, 156, 157, 0, 0, 0, 0, 0, 0,
2346 63, 64, 0, 107, 66, 67, 68, 69, 70, 71,
2347 72, 0, 1, 2, 0, 3, 4, 5, 0, 158,
2348 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
2349 169, 170, 381, 171, 0, 172, 173, 174, 0, 0,
2350 63, 64, 73, 107, 66, 67, 68, 69, 70, 71,
2351 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2352 0, 63, 64, 175, 107, 66, 67, 68, 69, 70,
2353 71, 72, 459, 1, 2, 0, 3, 4, 5, 0,
2354 0, 0, 73, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 548, 0, 0, 0, 0, 0, 0,
2356 0, 63, 64, 73, 65, 66, 67, 68, 69, 70,
2357 71, 72, 0, 1, 2, 0, 3, 4, 5, 63,
2358 64, 0, 107, 208, 209, 210, 211, 212, 213, 72,
2359 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2360 0, 0, 0, 73, 0, 0, 0, 0, 0, 0,
2361 74, 75, 0, 0, 76, 0, 77, 0, 0, 63,
2362 64, 73, 203, 66, 67, 68, 69, 70, 71, 72,
2363 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2365 74, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2366 0, 73, 0, 0, 0, 0, 0, 0, 0, 0,
2367 0, 74, 75, 0, 0, 76, 0, 77, 63, 64,
2368 0, 107, 66, 67, 68, 69, 70, 71, 72, 0,
2369 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2371 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2372 73, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2373 75, 0, 0, 76, 0, 77, 63, 64, 0, 341,
2374 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2375 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2377 75, 0, 0, 76, 0, 77, 63, 64, 73, 107,
2378 208, 209, 210, 211, 212, 213, 72, 0, 1, 2,
2379 0, 3, 4, 5, 63, 64, 0, 107, 66, 67,
2380 68, 69, 70, 71, 558, 0, 1, 2, 0, 3,
2381 4, 5, 0, 0, 0, 0, 0, 0, 73, 0,
2382 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
2383 0, 0, 76, 0, 77, 0, 73, 63, 64, 0,
2384 107, 66, 67, 68, 69, 70, 71, 600, 0, 1,
2385 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2387 0, 0, 0, 0, 0, 0, 0, 0, 0, 73,
2388 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2389 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
2390 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2391 0, 0, 0, 0, 0, 0, 0, 0, 264, 0,
2392 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2393 76, 0, 394, 0, 0, 0, 0, 0, 265, 266,
2394 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2395 77, 267, 268, 269, 270, 271, 272, 141, 142, 143,
2396 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
2397 154, 155, 273, 274, 0, 0, 0, 0, 0, 0,
2398 0, 0, 0, 0, 0, 0, 0, 74, 75, 0,
2399 0, 76, 0, 77, 275, 276, 277, 0, 0, 278,
2400 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
2401 169, 170, 279, 280, 281, 282, 283, 284, 285
2404 static const yytype_int16 yycheck[] =
2406 0, 27, 269, 128, 0, 304, 216, 28, 460, 21,
2407 54, 54, 353, 4, 11, 54, 11, 17, 121, 448,
2408 449, 17, 217, 52, 154, 91, 11, 270, 21, 593,
2409 11, 34, 20, 34, 58, 23, 29, 277, 67, 54,
2410 280, 281, 282, 283, 284, 155, 610, 290, 288, 154,
2411 160, 77, 53, 18, 7, 8, 68, 10, 11, 12,
2412 13, 14, 15, 16, 17, 131, 19, 20, 53, 22,
2413 23, 24, 53, 11, 155, 68, 102, 54, 507, 17,
2414 106, 155, 54, 164, 152, 155, 112, 319, 320, 321,
2415 164, 155, 118, 93, 164, 154, 49, 549, 201, 46,
2416 164, 48, 128, 0, 54, 155, 558, 559, 152, 152,
2417 305, 306, 162, 152, 158, 7, 8, 160, 10, 11,
2418 12, 13, 14, 15, 16, 17, 154, 19, 20, 369,
2419 22, 23, 24, 54, 137, 138, 139, 152, 54, 142,
2420 206, 54, 163, 146, 147, 597, 598, 162, 600, 601,
2421 216, 254, 255, 256, 257, 258, 497, 49, 261, 262,
2422 263, 22, 394, 160, 154, 160, 192, 193, 620, 621,
2423 196, 164, 163, 22, 414, 152, 202, 22, 155, 156,
2424 152, 7, 8, 155, 156, 526, 37, 528, 428, 158,
2425 430, 431, 432, 19, 20, 155, 22, 23, 24, 35,
2426 160, 37, 152, 22, 157, 158, 156, 160, 161, 4,
2427 163, 510, 155, 19, 32, 33, 22, 19, 24, 162,
2428 22, 152, 24, 219, 349, 328, 329, 467, 54, 4,
2429 571, 152, 335, 131, 68, 156, 152, 153, 156, 152,
2430 153, 267, 367, 453, 149, 150, 151, 53, 159, 275,
2431 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
2432 286, 287, 288, 115, 116, 157, 158, 114, 115, 161,
2433 296, 163, 164, 42, 43, 44, 342, 159, 47, 345,
2434 346, 307, 348, 582, 42, 4, 44, 586, 60, 355,
2435 38, 531, 532, 533, 153, 152, 155, 363, 364, 365,
2436 83, 84, 405, 406, 407, 408, 152, 410, 411, 40,
2437 41, 152, 579, 119, 120, 152, 47, 3, 4, 5,
2438 6, 152, 53, 349, 350, 351, 152, 594, 153, 152,
2439 155, 137, 138, 22, 140, 141, 152, 143, 144, 145,
2440 152, 367, 368, 369, 155, 153, 3, 4, 5, 6,
2441 4, 152, 418, 419, 420, 153, 153, 155, 162, 9,
2442 426, 464, 465, 9, 9, 9, 9, 9, 394, 26,
2443 27, 437, 438, 54, 400, 22, 152, 42, 43, 44,
2444 45, 46, 47, 48, 152, 50, 412, 453, 414, 137,
2445 138, 139, 56, 11, 142, 162, 153, 22, 146, 147,
2446 152, 155, 428, 429, 430, 431, 432, 38, 155, 155,
2447 436, 514, 155, 516, 517, 481, 155, 483, 7, 8,
2448 486, 155, 155, 155, 450, 155, 155, 493, 494, 155,
2449 19, 20, 155, 22, 23, 24, 38, 155, 155, 4,
2450 38, 467, 155, 22, 342, 155, 53, 345, 346, 155,
2451 348, 155, 155, 158, 155, 521, 522, 355, 524, 525,
2452 137, 138, 139, 529, 155, 142, 364, 365, 155, 146,
2453 147, 155, 498, 155, 540, 61, 62, 63, 64, 65,
2454 66, 153, 162, 509, 149, 150, 151, 92, 93, 94,
2455 95, 96, 97, 98, 99, 100, 101, 523, 153, 155,
2456 566, 17, 155, 155, 153, 531, 532, 533, 508, 17,
2457 4, 537, 119, 120, 580, 581, 153, 152, 4, 155,
2458 418, 419, 420, 155, 162, 591, 155, 155, 426, 155,
2459 137, 138, 155, 140, 141, 155, 143, 144, 145, 437,
2460 438, 152, 155, 22, 4, 153, 155, 153, 614, 615,
2461 53, 155, 153, 619, 153, 158, 622, 583, 153, 17,
2462 160, 53, 628, 160, 4, 631, 148, 152, 152, 17,
2463 22, 17, 572, 26, 27, 155, 17, 155, 73, 17,
2464 273, 93, 274, 481, 550, 483, 572, 183, 486, 183,
2465 183, 112, 106, 307, 296, 493, 494, 7, 8, 17,
2466 10, 11, 12, 13, 14, 15, 16, 17, 89, 19,
2467 20, 56, 22, 23, 24, 537, 425, -1, -1, -1,
2468 -1, -1, -1, 521, 522, -1, 524, 525, -1, -1,
2469 -1, 529, -1, -1, -1, -1, -1, -1, -1, 49,
2470 -1, 0, 540, -1, -1, 98, 99, 100, 101, 102,
2471 103, 104, 105, 106, 107, 108, 109, 110, 111, 18,
2472 19, 20, -1, 22, 23, 24, -1, -1, 566, -1,
2473 -1, 30, 31, -1, -1, -1, -1, -1, -1, -1,
2474 -1, -1, 580, 581, -1, 3, 4, -1, -1, 7,
2475 8, 9, 51, 591, -1, -1, 55, -1, -1, -1,
2476 59, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2477 -1, -1, -1, -1, -1, -1, 614, 615, -1, -1,
2478 -1, 619, 40, 41, 622, -1, -1, -1, -1, -1,
2479 628, -1, -1, 631, -1, 53, -1, -1, -1, -1,
2480 58, -1, -1, -1, -1, -1, -1, 157, 158, -1,
2481 -1, 161, -1, 163, 164, -1, -1, 75, 76, 77,
2482 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2483 88, 89, 90, 91, -1, -1, 7, 8, -1, 10,
2484 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2485 -1, 22, 23, 24, -1, -1, -1, -1, -1, 117,
2486 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2487 128, 129, -1, 131, -1, 133, 134, 135, 49, 137,
2488 138, -1, 140, 141, -1, 143, 144, 145, 3, 4,
2489 -1, -1, 7, 8, 9, -1, -1, -1, -1, -1,
2490 -1, -1, -1, 161, 19, 20, -1, 22, 23, 24,
2491 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2492 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2493 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2494 -1, 7, 8, 58, 10, 11, 12, 13, 14, 15,
2495 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2496 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2497 85, 86, 87, 88, 89, 90, 91, -1, -1, -1,
2498 -1, -1, -1, 49, -1, -1, 157, 158, -1, -1,
2499 161, -1, 163, 164, -1, -1, -1, -1, -1, -1,
2500 -1, -1, 117, 118, 119, 120, 121, 122, 123, 124,
2501 125, 126, 127, 128, 129, -1, 131, -1, 133, 134,
2502 135, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2503 -1, -1, 7, 8, 9, -1, -1, 152, -1, -1,
2504 -1, -1, -1, -1, 19, 20, 161, 22, 23, 24,
2505 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2506 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2507 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2508 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1,
2509 -1, 157, 158, -1, -1, 161, -1, 163, 164, -1,
2510 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2511 85, 86, 87, 88, 89, 90, 91, -1, -1, -1,
2512 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2514 -1, -1, 117, 118, 119, 120, 121, 122, 123, 124,
2515 125, 126, 127, 128, 129, -1, 131, -1, 133, 134,
2516 135, 7, 8, -1, -1, -1, -1, -1, -1, 0,
2517 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2518 -1, -1, -1, -1, -1, -1, 161, 18, 19, 20,
2519 -1, 22, 23, 24, 40, 41, -1, -1, -1, 30,
2520 31, -1, -1, -1, -1, -1, 7, 8, 54, 10,
2521 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2522 51, 22, 23, 24, 55, -1, -1, -1, 59, 75,
2523 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2524 86, 87, 88, 89, 90, 91, -1, -1, 49, -1,
2525 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2526 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2527 -1, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2528 126, 127, 128, 129, 39, 131, -1, 133, 134, 135,
2529 -1, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2530 -1, -1, -1, -1, -1, -1, 152, -1, 7, 8,
2531 156, -1, 158, -1, -1, 161, -1, 163, -1, 165,
2532 19, 20, 123, 22, 23, 24, 25, -1, -1, -1,
2533 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2534 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2535 -1, -1, -1, -1, -1, 54, 157, 158, -1, -1,
2536 161, -1, 163, -1, -1, -1, -1, -1, -1, -1,
2537 -1, -1, -1, -1, -1, -1, 75, 76, 77, 78,
2538 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2539 89, 90, 91, -1, -1, -1, -1, -1, -1, -1,
2540 -1, -1, 157, 158, -1, -1, 161, -1, 163, -1,
2541 -1, -1, -1, -1, -1, -1, -1, -1, 117, 118,
2542 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2543 129, -1, 131, -1, 133, 134, 135, -1, -1, -1,
2544 -1, -1, -1, -1, -1, 3, 4, -1, -1, -1,
2545 -1, 9, -1, 152, -1, -1, -1, -1, -1, 158,
2546 -1, -1, 161, -1, 163, -1, 165, 25, 26, 27,
2547 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2548 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2549 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2550 58, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2551 -1, -1, -1, -1, -1, -1, -1, 75, 76, 77,
2552 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2553 88, 89, 90, 91, -1, -1, -1, -1, -1, -1,
2554 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2555 17, -1, 19, 20, -1, 22, 23, 24, -1, 117,
2556 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2557 128, 129, 39, 131, -1, 133, 134, 135, -1, -1,
2558 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
2559 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2560 -1, 7, 8, 161, 10, 11, 12, 13, 14, 15,
2561 16, 17, 39, 19, 20, -1, 22, 23, 24, -1,
2562 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2563 -1, -1, -1, 39, -1, -1, -1, -1, -1, -1,
2564 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2565 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2566 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2567 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2568 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
2569 157, 158, -1, -1, 161, -1, 163, -1, -1, 7,
2570 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2571 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2572 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2573 157, 158, -1, -1, 161, -1, 163, -1, -1, -1,
2574 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
2575 -1, 157, 158, -1, -1, 161, -1, 163, 7, 8,
2576 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2577 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2578 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2579 -1, 157, 158, -1, -1, 161, -1, 163, -1, -1,
2580 49, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2581 158, -1, -1, 161, -1, 163, 7, 8, -1, 10,
2582 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2583 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2584 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2585 158, -1, -1, 161, -1, 163, 7, 8, 49, 10,
2586 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2587 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2588 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2589 23, 24, -1, -1, -1, -1, -1, -1, 49, -1,
2590 -1, -1, -1, -1, -1, -1, -1, -1, 157, 158,
2591 -1, -1, 161, -1, 163, -1, 49, 7, 8, -1,
2592 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2593 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2594 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2595 -1, -1, -1, -1, -1, -1, -1, -1, -1, 49,
2596 -1, -1, -1, -1, -1, -1, 157, 158, -1, -1,
2597 161, -1, 163, -1, -1, -1, -1, -1, -1, -1,
2598 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2599 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2600 -1, -1, -1, -1, -1, -1, 157, 158, -1, -1,
2601 161, -1, 163, -1, -1, -1, -1, -1, 56, 57,
2602 -1, -1, -1, -1, 157, 158, -1, -1, 161, -1,
2603 163, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2604 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2605 88, 89, 90, 91, -1, -1, -1, -1, -1, -1,
2606 -1, -1, -1, -1, -1, -1, -1, 157, 158, -1,
2607 -1, 161, -1, 163, 112, 113, 114, -1, -1, 117,
2608 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2609 128, 129, 130, 131, 132, 133, 134, 135, 136
2612 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2613 symbol of state STATE-NUM. */
2614 static const yytype_uint8 yystos[] =
2616 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2617 59, 174, 177, 178, 179, 180, 212, 213, 214, 216,
2618 215, 52, 67, 221, 154, 58, 154, 18, 154, 42,
2619 43, 44, 45, 46, 47, 48, 50, 149, 150, 151,
2620 181, 182, 183, 0, 214, 46, 48, 184, 231, 42,
2621 43, 44, 47, 185, 228, 230, 238, 154, 154, 158,
2622 222, 22, 220, 7, 8, 10, 11, 12, 13, 14,
2623 15, 16, 17, 49, 157, 158, 161, 163, 174, 178,
2624 199, 200, 234, 183, 183, 35, 37, 210, 183, 183,
2625 21, 68, 239, 240, 29, 164, 229, 239, 22, 22,
2626 22, 223, 152, 4, 4, 4, 163, 10, 164, 200,
2627 205, 54, 152, 176, 210, 210, 42, 44, 186, 32,
2628 33, 209, 61, 62, 63, 64, 65, 66, 187, 226,
2629 226, 68, 3, 4, 9, 25, 26, 27, 40, 41,
2630 58, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2631 84, 85, 86, 87, 88, 89, 90, 91, 117, 118,
2632 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2633 129, 131, 133, 134, 135, 161, 167, 168, 169, 207,
2634 233, 234, 235, 177, 243, 155, 160, 39, 200, 201,
2635 203, 204, 159, 159, 164, 205, 155, 164, 152, 204,
2636 156, 209, 209, 10, 123, 200, 202, 211, 11, 12,
2637 13, 14, 15, 16, 172, 173, 200, 206, 4, 202,
2638 28, 163, 227, 235, 60, 232, 92, 93, 94, 95,
2639 96, 97, 98, 99, 100, 101, 170, 26, 27, 98,
2640 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2641 109, 110, 111, 171, 152, 152, 152, 152, 152, 206,
2642 208, 152, 152, 152, 36, 56, 57, 69, 70, 71,
2643 72, 73, 74, 90, 91, 112, 113, 114, 117, 130,
2644 131, 132, 133, 134, 135, 136, 167, 168, 169, 241,
2645 247, 248, 249, 250, 22, 189, 155, 153, 200, 200,
2646 162, 164, 200, 4, 153, 206, 200, 152, 234, 26,
2647 27, 3, 4, 5, 6, 9, 25, 40, 41, 158,
2648 161, 163, 165, 207, 234, 176, 178, 22, 152, 152,
2649 206, 206, 206, 206, 206, 155, 162, 206, 206, 206,
2650 56, 10, 200, 236, 237, 11, 17, 11, 172, 187,
2651 170, 171, 200, 200, 236, 200, 200, 244, 236, 236,
2652 236, 236, 236, 200, 200, 200, 236, 187, 115, 116,
2653 53, 119, 120, 137, 138, 140, 141, 143, 144, 145,
2654 188, 39, 201, 191, 160, 162, 162, 153, 191, 176,
2655 176, 211, 160, 208, 163, 208, 164, 208, 22, 217,
2656 152, 155, 206, 206, 246, 155, 155, 155, 155, 206,
2657 155, 155, 38, 235, 155, 235, 235, 235, 202, 200,
2658 200, 155, 194, 155, 194, 235, 158, 155, 155, 155,
2659 155, 155, 155, 234, 235, 235, 38, 202, 200, 236,
2660 4, 137, 138, 139, 142, 146, 147, 190, 218, 219,
2661 38, 160, 164, 200, 208, 162, 164, 155, 197, 39,
2662 200, 224, 225, 22, 155, 155, 153, 155, 206, 206,
2663 206, 206, 206, 206, 200, 236, 155, 155, 235, 235,
2664 235, 11, 53, 11, 246, 235, 158, 236, 200, 236,
2665 236, 236, 155, 155, 155, 200, 235, 235, 155, 197,
2666 197, 200, 162, 164, 34, 53, 195, 198, 189, 155,
2667 153, 206, 206, 236, 155, 153, 155, 155, 153, 153,
2668 153, 17, 17, 152, 155, 155, 235, 4, 235, 155,
2669 235, 155, 155, 155, 4, 235, 235, 152, 155, 194,
2670 200, 153, 162, 22, 4, 197, 174, 175, 39, 200,
2671 191, 153, 153, 206, 206, 206, 235, 235, 17, 200,
2672 245, 235, 235, 194, 194, 235, 155, 236, 236, 236,
2673 245, 235, 189, 195, 196, 153, 153, 153, 155, 158,
2674 189, 189, 153, 155, 160, 235, 153, 194, 175, 53,
2675 193, 17, 160, 172, 242, 119, 120, 235, 235, 191,
2676 17, 200, 160, 191, 4, 148, 192, 235, 233, 160,
2677 172, 189, 189, 38, 189, 189, 22, 155, 233, 17,
2678 235, 235, 17, 155, 235, 189, 189, 235, 17, 73,
2682 #define yyerrok (yyerrstatus = 0)
2683 #define yyclearin (yychar = YYEMPTY)
2684 #define YYEMPTY (-2)
2687 #define YYACCEPT goto yyacceptlab
2688 #define YYABORT goto yyabortlab
2689 #define YYERROR goto yyerrorlab
2692 /* Like YYERROR except do call yyerror. This remains here temporarily
2693 to ease the transition to the new meaning of YYERROR, for GCC.
2694 Once GCC version 2 has supplanted version 1, this can go. */
2696 #define YYFAIL goto yyerrlab
2698 #define YYRECOVERING() (!!yyerrstatus)
2700 #define YYBACKUP(Token, Value) \
2702 if (yychar == YYEMPTY && yylen == 1) \
2706 yytoken = YYTRANSLATE (yychar); \
2712 yyerror (YY_("syntax error: cannot back up")); \
2719 #define YYERRCODE 256
2722 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2723 If N is 0, then set CURRENT to the empty location which ends
2724 the previous symbol: RHS[0] (always defined). */
2726 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2727 #ifndef YYLLOC_DEFAULT
2728 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2732 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2733 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2734 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2735 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2739 (Current).first_line = (Current).last_line = \
2740 YYRHSLOC (Rhs, 0).last_line; \
2741 (Current).first_column = (Current).last_column = \
2742 YYRHSLOC (Rhs, 0).last_column; \
2748 /* YY_LOCATION_PRINT -- Print the location on the stream.
2749 This macro was not mandated originally: define only if we know
2750 we won't break user code: when these are the locations we know. */
2752 #ifndef YY_LOCATION_PRINT
2753 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2754 # define YY_LOCATION_PRINT(File, Loc) \
2755 fprintf (File, "%d.%d-%d.%d", \
2756 (Loc).first_line, (Loc).first_column, \
2757 (Loc).last_line, (Loc).last_column)
2759 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2764 /* YYLEX -- calling `yylex' with the right arguments. */
2767 # define YYLEX yylex (YYLEX_PARAM)
2769 # define YYLEX yylex ()
2772 /* Enable debugging if requested. */
2776 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2777 # define YYFPRINTF fprintf
2780 # define YYDPRINTF(Args) \
2786 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2790 YYFPRINTF (stderr, "%s ", Title); \
2791 yy_symbol_print (stderr, \
2793 YYFPRINTF (stderr, "\n"); \
2798 /*--------------------------------.
2799 | Print this symbol on YYOUTPUT. |
2800 `--------------------------------*/
2803 #if (defined __STDC__ || defined __C99__FUNC__ \
2804 || defined __cplusplus || defined _MSC_VER)
2806 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2809 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2812 YYSTYPE const * const yyvaluep;
2818 if (yytype < YYNTOKENS)
2819 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2831 /*--------------------------------.
2832 | Print this symbol on YYOUTPUT. |
2833 `--------------------------------*/
2835 #if (defined __STDC__ || defined __C99__FUNC__ \
2836 || defined __cplusplus || defined _MSC_VER)
2838 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2841 yy_symbol_print (yyoutput, yytype, yyvaluep)
2844 YYSTYPE const * const yyvaluep;
2847 if (yytype < YYNTOKENS)
2848 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2850 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2852 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2853 YYFPRINTF (yyoutput, ")");
2856 /*------------------------------------------------------------------.
2857 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2859 `------------------------------------------------------------------*/
2861 #if (defined __STDC__ || defined __C99__FUNC__ \
2862 || defined __cplusplus || defined _MSC_VER)
2864 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2867 yy_stack_print (bottom, top)
2868 yytype_int16 *bottom;
2872 YYFPRINTF (stderr, "Stack now");
2873 for (; bottom <= top; ++bottom)
2874 YYFPRINTF (stderr, " %d", *bottom);
2875 YYFPRINTF (stderr, "\n");
2878 # define YY_STACK_PRINT(Bottom, Top) \
2881 yy_stack_print ((Bottom), (Top)); \
2885 /*------------------------------------------------.
2886 | Report that the YYRULE is going to be reduced. |
2887 `------------------------------------------------*/
2889 #if (defined __STDC__ || defined __C99__FUNC__ \
2890 || defined __cplusplus || defined _MSC_VER)
2892 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2895 yy_reduce_print (yyvsp, yyrule)
2900 int yynrhs = yyr2[yyrule];
2902 unsigned long int yylno = yyrline[yyrule];
2903 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2905 /* The symbols being reduced. */
2906 for (yyi = 0; yyi < yynrhs; yyi++)
2908 fprintf (stderr, " $%d = ", yyi + 1);
2909 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2910 &(yyvsp[(yyi + 1) - (yynrhs)])
2912 fprintf (stderr, "\n");
2916 # define YY_REDUCE_PRINT(Rule) \
2919 yy_reduce_print (yyvsp, Rule); \
2922 /* Nonzero means print parse trace. It is left uninitialized so that
2923 multiple parsers can coexist. */
2925 #else /* !YYDEBUG */
2926 # define YYDPRINTF(Args)
2927 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2928 # define YY_STACK_PRINT(Bottom, Top)
2929 # define YY_REDUCE_PRINT(Rule)
2930 #endif /* !YYDEBUG */
2933 /* YYINITDEPTH -- initial size of the parser's stacks. */
2935 # define YYINITDEPTH 200
2938 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2939 if the built-in stack extension method is used).
2941 Do not make this value too large; the results are undefined if
2942 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2943 evaluated with infinite-precision integer arithmetic. */
2946 # define YYMAXDEPTH 10000
2954 # if defined __GLIBC__ && defined _STRING_H
2955 # define yystrlen strlen
2957 /* Return the length of YYSTR. */
2958 #if (defined __STDC__ || defined __C99__FUNC__ \
2959 || defined __cplusplus || defined _MSC_VER)
2961 yystrlen (const char *yystr)
2969 for (yylen = 0; yystr[yylen]; yylen++)
2977 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2978 # define yystpcpy stpcpy
2980 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2982 #if (defined __STDC__ || defined __C99__FUNC__ \
2983 || defined __cplusplus || defined _MSC_VER)
2985 yystpcpy (char *yydest, const char *yysrc)
2988 yystpcpy (yydest, yysrc)
2994 const char *yys = yysrc;
2996 while ((*yyd++ = *yys++) != '\0')
3005 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3006 quotes and backslashes, so that it's suitable for yyerror. The
3007 heuristic is that double-quoting is unnecessary unless the string
3008 contains an apostrophe, a comma, or backslash (other than
3009 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3010 null, do not copy; instead, return the length of what the result
3013 yytnamerr (char *yyres, const char *yystr)
3018 char const *yyp = yystr;
3025 goto do_not_strip_quotes;
3029 goto do_not_strip_quotes;
3042 do_not_strip_quotes: ;
3046 return yystrlen (yystr);
3048 return yystpcpy (yyres, yystr) - yyres;
3052 /* Copy into YYRESULT an error message about the unexpected token
3053 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3054 including the terminating null byte. If YYRESULT is null, do not
3055 copy anything; just return the number of bytes that would be
3056 copied. As a special case, return 0 if an ordinary "syntax error"
3057 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3058 size calculation. */
3060 yysyntax_error (char *yyresult, int yystate, int yychar)
3062 int yyn = yypact[yystate];
3064 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3068 int yytype = YYTRANSLATE (yychar);
3069 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3070 YYSIZE_T yysize = yysize0;
3072 int yysize_overflow = 0;
3073 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3074 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3078 /* This is so xgettext sees the translatable formats that are
3079 constructed on the fly. */
3080 YY_("syntax error, unexpected %s");
3081 YY_("syntax error, unexpected %s, expecting %s");
3082 YY_("syntax error, unexpected %s, expecting %s or %s");
3083 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3084 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3088 static char const yyunexpected[] = "syntax error, unexpected %s";
3089 static char const yyexpecting[] = ", expecting %s";
3090 static char const yyor[] = " or %s";
3091 char yyformat[sizeof yyunexpected
3092 + sizeof yyexpecting - 1
3093 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3094 * (sizeof yyor - 1))];
3095 char const *yyprefix = yyexpecting;
3097 /* Start YYX at -YYN if negative to avoid negative indexes in
3099 int yyxbegin = yyn < 0 ? -yyn : 0;
3101 /* Stay within bounds of both yycheck and yytname. */
3102 int yychecklim = YYLAST - yyn + 1;
3103 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3106 yyarg[0] = yytname[yytype];
3107 yyfmt = yystpcpy (yyformat, yyunexpected);
3109 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3110 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3112 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3116 yyformat[sizeof yyunexpected - 1] = '\0';
3119 yyarg[yycount++] = yytname[yyx];
3120 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3121 yysize_overflow |= (yysize1 < yysize);
3123 yyfmt = yystpcpy (yyfmt, yyprefix);
3127 yyf = YY_(yyformat);
3128 yysize1 = yysize + yystrlen (yyf);
3129 yysize_overflow |= (yysize1 < yysize);
3132 if (yysize_overflow)
3133 return YYSIZE_MAXIMUM;
3137 /* Avoid sprintf, as that infringes on the user's name space.
3138 Don't have undefined behavior even if the translation
3139 produced a string with the wrong number of "%s"s. */
3140 char *yyp = yyresult;
3142 while ((*yyp = *yyf) != '\0')
3144 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3146 yyp += yytnamerr (yyp, yyarg[yyi++]);
3159 #endif /* YYERROR_VERBOSE */
3162 /*-----------------------------------------------.
3163 | Release the memory associated to this symbol. |
3164 `-----------------------------------------------*/
3167 #if (defined __STDC__ || defined __C99__FUNC__ \
3168 || defined __cplusplus || defined _MSC_VER)
3170 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3173 yydestruct (yymsg, yytype, yyvaluep)
3183 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3194 /* Prevent warnings from -Wmissing-prototypes. */
3196 #ifdef YYPARSE_PARAM
3197 #if defined __STDC__ || defined __cplusplus
3198 int yyparse (void *YYPARSE_PARAM);
3202 #else /* ! YYPARSE_PARAM */
3203 #if defined __STDC__ || defined __cplusplus
3208 #endif /* ! YYPARSE_PARAM */
3212 /* The look-ahead symbol. */
3215 /* The semantic value of the look-ahead symbol. */
3218 /* Number of syntax errors so far. */
3227 #ifdef YYPARSE_PARAM
3228 #if (defined __STDC__ || defined __C99__FUNC__ \
3229 || defined __cplusplus || defined _MSC_VER)
3231 yyparse (void *YYPARSE_PARAM)
3234 yyparse (YYPARSE_PARAM)
3235 void *YYPARSE_PARAM;
3237 #else /* ! YYPARSE_PARAM */
3238 #if (defined __STDC__ || defined __C99__FUNC__ \
3239 || defined __cplusplus || defined _MSC_VER)
3253 /* Number of tokens to shift before error messages enabled. */
3255 /* Look-ahead token as an internal (translated) token number. */
3258 /* Buffer for error messages, and its allocated size. */
3260 char *yymsg = yymsgbuf;
3261 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3264 /* Three stacks and their tools:
3265 `yyss': related to states,
3266 `yyvs': related to semantic values,
3267 `yyls': related to locations.
3269 Refer to the stacks thru separate pointers, to allow yyoverflow
3270 to reallocate them elsewhere. */
3272 /* The state stack. */
3273 yytype_int16 yyssa[YYINITDEPTH];
3274 yytype_int16 *yyss = yyssa;
3275 yytype_int16 *yyssp;
3277 /* The semantic value stack. */
3278 YYSTYPE yyvsa[YYINITDEPTH];
3279 YYSTYPE *yyvs = yyvsa;
3284 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3286 YYSIZE_T yystacksize = YYINITDEPTH;
3288 /* The variables used to return semantic value and location from the
3293 /* The number of symbols on the RHS of the reduced rule.
3294 Keep to zero when no symbol should be popped. */
3297 YYDPRINTF ((stderr, "Starting parse\n"));
3302 yychar = YYEMPTY; /* Cause a token to be read. */
3304 /* Initialize stack pointers.
3305 Waste one element of value and location stack
3306 so that they stay on the same level as the state stack.
3307 The wasted elements are never initialized. */
3314 /*------------------------------------------------------------.
3315 | yynewstate -- Push a new state, which is found in yystate. |
3316 `------------------------------------------------------------*/
3318 /* In all cases, when you get here, the value and location stacks
3319 have just been pushed. So pushing a state here evens the stacks. */
3325 if (yyss + yystacksize - 1 <= yyssp)
3327 /* Get the current used size of the three stacks, in elements. */
3328 YYSIZE_T yysize = yyssp - yyss + 1;
3332 /* Give user a chance to reallocate the stack. Use copies of
3333 these so that the &'s don't force the real ones into
3335 YYSTYPE *yyvs1 = yyvs;
3336 yytype_int16 *yyss1 = yyss;
3339 /* Each stack pointer address is followed by the size of the
3340 data in use in that stack, in bytes. This used to be a
3341 conditional around just the two extra args, but that might
3342 be undefined if yyoverflow is a macro. */
3343 yyoverflow (YY_("memory exhausted"),
3344 &yyss1, yysize * sizeof (*yyssp),
3345 &yyvs1, yysize * sizeof (*yyvsp),
3352 #else /* no yyoverflow */
3353 # ifndef YYSTACK_RELOCATE
3354 goto yyexhaustedlab;
3356 /* Extend the stack our own way. */
3357 if (YYMAXDEPTH <= yystacksize)
3358 goto yyexhaustedlab;
3360 if (YYMAXDEPTH < yystacksize)
3361 yystacksize = YYMAXDEPTH;
3364 yytype_int16 *yyss1 = yyss;
3365 union yyalloc *yyptr =
3366 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3368 goto yyexhaustedlab;
3369 YYSTACK_RELOCATE (yyss);
3370 YYSTACK_RELOCATE (yyvs);
3372 # undef YYSTACK_RELOCATE
3374 YYSTACK_FREE (yyss1);
3377 #endif /* no yyoverflow */
3379 yyssp = yyss + yysize - 1;
3380 yyvsp = yyvs + yysize - 1;
3383 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3384 (unsigned long int) yystacksize));
3386 if (yyss + yystacksize - 1 <= yyssp)
3390 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3399 /* Do appropriate processing given the current state. Read a
3400 look-ahead token if we need one and don't already have one. */
3402 /* First try to decide what to do without reference to look-ahead token. */
3403 yyn = yypact[yystate];
3404 if (yyn == YYPACT_NINF)
3407 /* Not known => get a look-ahead token if don't already have one. */
3409 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3410 if (yychar == YYEMPTY)
3412 YYDPRINTF ((stderr, "Reading a token: "));
3416 if (yychar <= YYEOF)
3418 yychar = yytoken = YYEOF;
3419 YYDPRINTF ((stderr, "Now at end of input.\n"));
3423 yytoken = YYTRANSLATE (yychar);
3424 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3427 /* If the proper action on seeing token YYTOKEN is to reduce or to
3428 detect an error, take that action. */
3430 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3435 if (yyn == 0 || yyn == YYTABLE_NINF)
3444 /* Count tokens shifted since error; after three, turn off error
3449 /* Shift the look-ahead token. */
3450 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3452 /* Discard the shifted token unless it is eof. */
3453 if (yychar != YYEOF)
3462 /*-----------------------------------------------------------.
3463 | yydefault -- do the default action for the current state. |
3464 `-----------------------------------------------------------*/
3466 yyn = yydefact[yystate];
3472 /*-----------------------------.
3473 | yyreduce -- Do a reduction. |
3474 `-----------------------------*/
3476 /* yyn is the number of a rule to reduce with. */
3479 /* If YYLEN is nonzero, implement the default value of the action:
3482 Otherwise, the following line sets YYVAL to garbage.
3483 This behavior is undocumented and Bison
3484 users should not rely upon it. Assigning to YYVAL
3485 unconditionally makes the parser a bit smaller, and it avoids a
3486 GCC warning that YYVAL may be used uninitialized. */
3487 yyval = yyvsp[1-yylen];
3490 YY_REDUCE_PRINT (yyn);
3494 #line 1119 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3495 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3499 #line 1119 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3500 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3504 #line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3505 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3509 #line 1120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3510 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3514 #line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3515 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3519 #line 1121 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3520 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3524 #line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3525 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3529 #line 1122 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3530 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3534 #line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3535 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3539 #line 1123 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3540 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3544 #line 1127 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3545 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3549 #line 1127 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3550 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3554 #line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3555 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3559 #line 1128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3560 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3564 #line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3565 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3569 #line 1129 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3570 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3574 #line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3575 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3579 #line 1130 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3580 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3584 #line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3585 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3589 #line 1131 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3590 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3594 #line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3595 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3599 #line 1132 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3600 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3604 #line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3605 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3609 #line 1133 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3610 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3614 #line 1134 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3615 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3619 #line 1135 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3620 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3624 #line 1144 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3625 { (yyval.StrVal) = 0; ;}
3629 #line 1146 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3630 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3634 #line 1147 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3635 { (yyval.UIntVal)=0; ;}
3639 #line 1151 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3641 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3647 #line 1155 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3655 #line 1163 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3663 #line 1168 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3665 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3671 #line 1174 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3672 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3676 #line 1175 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3677 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3681 #line 1176 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3682 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3686 #line 1177 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3687 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3691 #line 1178 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3692 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3696 #line 1182 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3697 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3701 #line 1183 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3702 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3706 #line 1184 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3707 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3711 #line 1188 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3712 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3716 #line 1189 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3717 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3721 #line 1190 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3722 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3726 #line 1191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3727 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3731 #line 1195 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3732 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3736 #line 1196 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3737 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3741 #line 1197 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3742 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3746 #line 1201 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3747 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3751 #line 1202 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3752 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3756 #line 1203 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3757 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3761 #line 1204 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3762 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3766 #line 1205 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3767 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3771 #line 1209 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3772 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3776 #line 1210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3777 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3781 #line 1211 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3782 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3786 #line 1214 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3787 { (yyval.UIntVal) = CallingConv::C; ;}
3791 #line 1215 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3792 { (yyval.UIntVal) = CallingConv::C; ;}
3796 #line 1216 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3797 { (yyval.UIntVal) = CallingConv::Fast; ;}
3801 #line 1217 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3802 { (yyval.UIntVal) = CallingConv::Cold; ;}
3806 #line 1218 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3807 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3811 #line 1219 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3812 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3816 #line 1220 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3818 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3819 GEN_ERROR("Calling conv too large");
3820 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3826 #line 1227 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3827 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3831 #line 1228 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3832 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3836 #line 1229 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3837 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3841 #line 1230 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3842 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3846 #line 1231 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3847 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3851 #line 1232 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3852 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3856 #line 1233 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3857 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3861 #line 1234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3862 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3866 #line 1235 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3867 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3871 #line 1236 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3872 { (yyval.ParamAttrs) =
3873 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3877 #line 1240 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3878 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3882 #line 1241 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3884 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3889 #line 1246 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3890 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3894 #line 1247 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3895 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3899 #line 1248 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3900 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3904 #line 1249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3905 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3909 #line 1250 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3910 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3914 #line 1251 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3915 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3919 #line 1254 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3920 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3924 #line 1255 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3926 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3931 #line 1260 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3932 { (yyval.StrVal) = 0; ;}
3936 #line 1261 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3938 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3943 #line 1268 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3944 { (yyval.UIntVal) = 0; ;}
3948 #line 1269 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3950 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3951 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3952 GEN_ERROR("Alignment must be a power of two");
3958 #line 1275 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3959 { (yyval.UIntVal) = 0; ;}
3963 #line 1276 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3965 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3966 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3967 GEN_ERROR("Alignment must be a power of two");
3973 #line 1285 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3975 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3976 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3977 GEN_ERROR("Invalid character in section name");
3978 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3984 #line 1293 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3985 { (yyval.StrVal) = 0; ;}
3989 #line 1294 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3990 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3994 #line 1299 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
3999 #line 1300 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4004 #line 1301 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4006 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4007 delete (yyvsp[(1) - (1)].StrVal);
4013 #line 1306 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4015 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4016 GEN_ERROR("Alignment must be a power of two");
4017 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4023 #line 1322 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4025 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4031 #line 1326 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4033 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4039 #line 1330 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4041 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4042 GEN_ERROR("Cannot form a pointer to a basic block");
4043 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4044 delete (yyvsp[(1) - (3)].TypeVal);
4050 #line 1337 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4051 { // Named types are also simple types...
4052 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4054 (yyval.TypeVal) = new PATypeHolder(tmp);
4059 #line 1342 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4060 { // Type UpReference
4061 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4062 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4063 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4064 (yyval.TypeVal) = new PATypeHolder(OT);
4065 UR_OUT("New Upreference!\n");
4071 #line 1350 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4073 // Allow but ignore attributes on function types; this permits auto-upgrade.
4074 // FIXME: remove in LLVM 3.0.
4075 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
4076 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4077 isa<OpaqueType>(RetTy)))
4078 GEN_ERROR("LLVM Functions cannot return aggregates");
4080 std::vector<const Type*> Params;
4081 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4082 for (; I != E; ++I ) {
4083 const Type *Ty = I->Ty->get();
4084 Params.push_back(Ty);
4087 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4088 if (isVarArg) Params.pop_back();
4090 for (unsigned i = 0; i != Params.size(); ++i)
4091 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4092 GEN_ERROR("Function arguments must be value types!");
4096 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4097 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4098 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4099 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4105 #line 1380 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4107 // Allow but ignore attributes on function types; this permits auto-upgrade.
4108 // FIXME: remove in LLVM 3.0.
4109 std::vector<const Type*> Params;
4110 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4111 for ( ; I != E; ++I ) {
4112 const Type* Ty = I->Ty->get();
4113 Params.push_back(Ty);
4116 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4117 if (isVarArg) Params.pop_back();
4119 for (unsigned i = 0; i != Params.size(); ++i)
4120 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4121 GEN_ERROR("Function arguments must be value types!");
4125 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4126 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4127 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4133 #line 1405 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4134 { // Sized array type?
4135 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4136 delete (yyvsp[(4) - (5)].TypeVal);
4142 #line 1410 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4144 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4145 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4146 GEN_ERROR("Unsigned result not equal to signed result");
4147 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4148 GEN_ERROR("Element type of a VectorType must be primitive");
4149 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4150 delete (yyvsp[(4) - (5)].TypeVal);
4156 #line 1420 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4157 { // Structure type?
4158 std::vector<const Type*> Elements;
4159 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4160 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4161 Elements.push_back(*I);
4163 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4164 delete (yyvsp[(2) - (3)].TypeList);
4170 #line 1430 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4171 { // Empty structure type?
4172 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4178 #line 1434 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4180 std::vector<const Type*> Elements;
4181 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4182 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4183 Elements.push_back(*I);
4185 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4186 delete (yyvsp[(3) - (5)].TypeList);
4192 #line 1444 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4193 { // Empty structure type?
4194 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4200 #line 1451 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4202 // Allow but ignore attributes on function types; this permits auto-upgrade.
4203 // FIXME: remove in LLVM 3.0.
4204 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4205 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4210 #line 1460 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4212 if (!UpRefs.empty())
4213 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4214 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4215 GEN_ERROR("LLVM functions cannot return aggregate types");
4216 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4221 #line 1467 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4223 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4228 #line 1472 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4230 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4231 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4237 #line 1477 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4239 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4245 #line 1485 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4247 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4248 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4249 TWA.Ty = new PATypeHolder(Type::VoidTy);
4250 (yyval.TypeWithAttrsList)->push_back(TWA);
4256 #line 1492 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4258 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4259 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4260 TWA.Ty = new PATypeHolder(Type::VoidTy);
4261 (yyval.TypeWithAttrsList)->push_back(TWA);
4267 #line 1499 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4269 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4275 #line 1507 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4277 (yyval.TypeList) = new std::list<PATypeHolder>();
4278 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4279 delete (yyvsp[(1) - (1)].TypeVal);
4285 #line 1513 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4287 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4288 delete (yyvsp[(3) - (3)].TypeVal);
4294 #line 1525 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4295 { // Nonempty unsized arr
4296 if (!UpRefs.empty())
4297 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4298 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4300 GEN_ERROR("Cannot make array constant with type: '" +
4301 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4302 const Type *ETy = ATy->getElementType();
4303 int NumElements = ATy->getNumElements();
4305 // Verify that we have the correct size...
4306 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4307 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4308 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4309 itostr(NumElements) + "");
4311 // Verify all elements are correct type!
4312 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4313 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4314 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4315 ETy->getDescription() +"' as required!\nIt is of type '"+
4316 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4319 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4320 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4326 #line 1553 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4328 if (!UpRefs.empty())
4329 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4330 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4332 GEN_ERROR("Cannot make array constant with type: '" +
4333 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4335 int NumElements = ATy->getNumElements();
4336 if (NumElements != -1 && NumElements != 0)
4337 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4338 " arguments, but has size of " + itostr(NumElements) +"");
4339 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4340 delete (yyvsp[(1) - (3)].TypeVal);
4346 #line 1569 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4348 if (!UpRefs.empty())
4349 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4350 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4352 GEN_ERROR("Cannot make array constant with type: '" +
4353 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4355 int NumElements = ATy->getNumElements();
4356 const Type *ETy = ATy->getElementType();
4357 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4358 GEN_ERROR("Can't build string constant of size " +
4359 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4360 " when array has size " + itostr(NumElements) + "");
4361 std::vector<Constant*> Vals;
4362 if (ETy == Type::Int8Ty) {
4363 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4364 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4366 delete (yyvsp[(3) - (3)].StrVal);
4367 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4369 delete (yyvsp[(3) - (3)].StrVal);
4370 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4371 delete (yyvsp[(1) - (3)].TypeVal);
4377 #line 1596 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4378 { // Nonempty unsized arr
4379 if (!UpRefs.empty())
4380 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4381 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4383 GEN_ERROR("Cannot make packed constant with type: '" +
4384 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4385 const Type *ETy = PTy->getElementType();
4386 int NumElements = PTy->getNumElements();
4388 // Verify that we have the correct size...
4389 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4390 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4391 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4392 itostr(NumElements) + "");
4394 // Verify all elements are correct type!
4395 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4396 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4397 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4398 ETy->getDescription() +"' as required!\nIt is of type '"+
4399 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4402 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4403 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4409 #line 1624 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4411 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4413 GEN_ERROR("Cannot make struct constant with type: '" +
4414 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4416 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4417 GEN_ERROR("Illegal number of initializers for structure type");
4419 // Check to ensure that constants are compatible with the type initializer!
4420 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4421 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4422 GEN_ERROR("Expected type '" +
4423 STy->getElementType(i)->getDescription() +
4424 "' for element #" + utostr(i) +
4425 " of structure initializer");
4427 // Check to ensure that Type is not packed
4428 if (STy->isPacked())
4429 GEN_ERROR("Unpacked Initializer to vector type '" +
4430 STy->getDescription() + "'");
4432 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4433 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4439 #line 1650 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4441 if (!UpRefs.empty())
4442 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4443 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4445 GEN_ERROR("Cannot make struct constant with type: '" +
4446 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4448 if (STy->getNumContainedTypes() != 0)
4449 GEN_ERROR("Illegal number of initializers for structure type");
4451 // Check to ensure that Type is not packed
4452 if (STy->isPacked())
4453 GEN_ERROR("Unpacked Initializer to vector type '" +
4454 STy->getDescription() + "'");
4456 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4457 delete (yyvsp[(1) - (3)].TypeVal);
4463 #line 1670 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4465 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4467 GEN_ERROR("Cannot make struct constant with type: '" +
4468 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4470 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4471 GEN_ERROR("Illegal number of initializers for structure type");
4473 // Check to ensure that constants are compatible with the type initializer!
4474 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4475 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4476 GEN_ERROR("Expected type '" +
4477 STy->getElementType(i)->getDescription() +
4478 "' for element #" + utostr(i) +
4479 " of structure initializer");
4481 // Check to ensure that Type is packed
4482 if (!STy->isPacked())
4483 GEN_ERROR("Vector initializer to non-vector type '" +
4484 STy->getDescription() + "'");
4486 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4487 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4493 #line 1696 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4495 if (!UpRefs.empty())
4496 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4497 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4499 GEN_ERROR("Cannot make struct constant with type: '" +
4500 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4502 if (STy->getNumContainedTypes() != 0)
4503 GEN_ERROR("Illegal number of initializers for structure type");
4505 // Check to ensure that Type is packed
4506 if (!STy->isPacked())
4507 GEN_ERROR("Vector initializer to non-vector type '" +
4508 STy->getDescription() + "'");
4510 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4511 delete (yyvsp[(1) - (5)].TypeVal);
4517 #line 1716 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4519 if (!UpRefs.empty())
4520 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4521 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4523 GEN_ERROR("Cannot make null pointer constant with type: '" +
4524 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4526 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4527 delete (yyvsp[(1) - (2)].TypeVal);
4533 #line 1728 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4535 if (!UpRefs.empty())
4536 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4537 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4538 delete (yyvsp[(1) - (2)].TypeVal);
4544 #line 1735 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4546 if (!UpRefs.empty())
4547 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4548 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4550 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4552 // ConstExprs can exist in the body of a function, thus creating
4553 // GlobalValues whenever they refer to a variable. Because we are in
4554 // the context of a function, getExistingVal will search the functions
4555 // symbol table instead of the module symbol table for the global symbol,
4556 // which throws things all off. To get around this, we just tell
4557 // getExistingVal that we are at global scope here.
4559 Function *SavedCurFn = CurFun.CurrentFunction;
4560 CurFun.CurrentFunction = 0;
4562 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4565 CurFun.CurrentFunction = SavedCurFn;
4567 // If this is an initializer for a constant pointer, which is referencing a
4568 // (currently) undefined variable, create a stub now that shall be replaced
4569 // in the future with the right type of variable.
4572 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4573 const PointerType *PT = cast<PointerType>(Ty);
4575 // First check to see if the forward references value is already created!
4576 PerModuleInfo::GlobalRefsType::iterator I =
4577 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4579 if (I != CurModule.GlobalRefs.end()) {
4580 V = I->second; // Placeholder already exists, use it...
4581 (yyvsp[(2) - (2)].ValIDVal).destroy();
4584 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4585 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4586 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4587 GEN_ERROR("Invalid reference to global");
4589 // Create the forward referenced global.
4591 if (const FunctionType *FTy =
4592 dyn_cast<FunctionType>(PT->getElementType())) {
4593 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4594 CurModule.CurrentModule);
4596 GV = new GlobalVariable(PT->getElementType(), false,
4597 GlobalValue::ExternalWeakLinkage, 0,
4598 Name, CurModule.CurrentModule);
4601 // Keep track of the fact that we have a forward ref to recycle it
4602 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4607 (yyval.ConstVal) = cast<GlobalValue>(V);
4608 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4614 #line 1801 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4616 if (!UpRefs.empty())
4617 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4618 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4619 GEN_ERROR("Mismatched types for constant expression: " +
4620 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4621 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4622 delete (yyvsp[(1) - (2)].TypeVal);
4628 #line 1811 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4630 if (!UpRefs.empty())
4631 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4632 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4633 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4634 GEN_ERROR("Cannot create a null initialized value of this type");
4635 (yyval.ConstVal) = Constant::getNullValue(Ty);
4636 delete (yyvsp[(1) - (2)].TypeVal);
4642 #line 1821 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4643 { // integral constants
4644 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4645 GEN_ERROR("Constant value doesn't fit in type");
4646 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4652 #line 1827 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4653 { // arbitrary precision integer constants
4654 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4655 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4656 GEN_ERROR("Constant value does not fit in type");
4658 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4659 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4660 delete (yyvsp[(2) - (2)].APIntVal);
4666 #line 1837 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4667 { // integral constants
4668 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4669 GEN_ERROR("Constant value doesn't fit in type");
4670 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4676 #line 1843 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4677 { // arbitrary precision integer constants
4678 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4679 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4680 GEN_ERROR("Constant value does not fit in type");
4682 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4683 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4684 delete (yyvsp[(2) - (2)].APIntVal);
4690 #line 1853 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4691 { // Boolean constants
4692 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4693 (yyval.ConstVal) = ConstantInt::getTrue();
4699 #line 1858 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4700 { // Boolean constants
4701 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4702 (yyval.ConstVal) = ConstantInt::getFalse();
4708 #line 1863 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4709 { // Floating point constants
4710 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4711 GEN_ERROR("Floating point constant invalid for type");
4712 // Lexer has no type info, so builds all float and double FP constants
4713 // as double. Fix this here. Long double is done right.
4714 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4715 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4716 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4717 delete (yyvsp[(2) - (2)].FPVal);
4723 #line 1876 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4725 if (!UpRefs.empty())
4726 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4727 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4728 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4729 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4730 GEN_ERROR("invalid cast opcode for cast from '" +
4731 Val->getType()->getDescription() + "' to '" +
4732 DestTy->getDescription() + "'");
4733 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4734 delete (yyvsp[(5) - (6)].TypeVal);
4739 #line 1888 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4741 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4742 GEN_ERROR("GetElementPtr requires a pointer operand");
4745 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4748 GEN_ERROR("Index list invalid for constant getelementptr");
4750 SmallVector<Constant*, 8> IdxVec;
4751 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4752 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4753 IdxVec.push_back(C);
4755 GEN_ERROR("Indices to constant getelementptr must be constants");
4757 delete (yyvsp[(4) - (5)].ValueList);
4759 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4765 #line 1910 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4767 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4768 GEN_ERROR("Select condition must be of boolean type");
4769 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4770 GEN_ERROR("Select operand types must match");
4771 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4777 #line 1918 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4779 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4780 GEN_ERROR("Binary operator types must match");
4782 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4787 #line 1924 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4789 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4790 GEN_ERROR("Logical operator types must match");
4791 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4792 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4793 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4794 GEN_ERROR("Logical operator requires integral operands");
4796 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4802 #line 1935 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4804 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4805 GEN_ERROR("icmp operand types must match");
4806 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4811 #line 1940 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4813 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4814 GEN_ERROR("fcmp operand types must match");
4815 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4820 #line 1945 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4822 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4823 GEN_ERROR("Invalid extractelement operands");
4824 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4830 #line 1951 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4832 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4833 GEN_ERROR("Invalid insertelement operands");
4834 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4840 #line 1957 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4842 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4843 GEN_ERROR("Invalid shufflevector operands");
4844 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4850 #line 1966 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4852 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4858 #line 1970 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4860 (yyval.ConstVector) = new std::vector<Constant*>();
4861 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4867 #line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4868 { (yyval.BoolVal) = false; ;}
4872 #line 1978 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4873 { (yyval.BoolVal) = true; ;}
4877 #line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4878 { (yyval.BoolVal) = true; ;}
4882 #line 1981 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4883 { (yyval.BoolVal) = false; ;}
4887 #line 1984 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4889 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4890 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4892 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4894 GEN_ERROR("Aliases can be created only to global values");
4896 (yyval.ConstVal) = Aliasee;
4898 delete (yyvsp[(1) - (2)].TypeVal);
4903 #line 1996 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4905 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4906 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4907 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4908 GEN_ERROR("invalid cast opcode for cast from '" +
4909 Val->getType()->getDescription() + "' to '" +
4910 DestTy->getDescription() + "'");
4912 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4914 delete (yyvsp[(5) - (6)].TypeVal);
4919 #line 2017 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4921 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4922 CurModule.ModuleDone();
4928 #line 2022 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4930 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4931 CurModule.ModuleDone();
4937 #line 2035 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4938 { CurFun.isDeclare = false; ;}
4942 #line 2035 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4944 CurFun.FunctionDone();
4950 #line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4951 { CurFun.isDeclare = true; ;}
4955 #line 2039 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4962 #line 2042 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4969 #line 2045 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4971 if (!UpRefs.empty())
4972 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4973 // Eagerly resolve types. This is not an optimization, this is a
4974 // requirement that is due to the fact that we could have this:
4976 // %list = type { %list * }
4977 // %list = type { %list * } ; repeated type decl
4979 // If types are not resolved eagerly, then the two types will not be
4980 // determined to be the same type!
4982 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4984 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4986 // If this is a named type that is not a redefinition, add it to the slot
4988 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4991 delete (yyvsp[(3) - (3)].TypeVal);
4997 #line 2069 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
4999 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5001 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5003 // If this is a named type that is not a redefinition, add it to the slot
5005 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5012 #line 2081 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5014 /* "Externally Visible" Linkage */
5015 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5016 GEN_ERROR("Global value initializer is not a constant");
5017 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5018 (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));
5024 #line 2088 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5031 #line 2092 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5033 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5034 GEN_ERROR("Global value initializer is not a constant");
5035 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));
5041 #line 2097 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5048 #line 2101 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5050 if (!UpRefs.empty())
5051 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5052 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));
5054 delete (yyvsp[(6) - (7)].TypeVal);
5059 #line 2107 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5067 #line 2111 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5070 if ((yyvsp[(1) - (5)].StrVal)) {
5071 Name = *(yyvsp[(1) - (5)].StrVal);
5072 delete (yyvsp[(1) - (5)].StrVal);
5075 GEN_ERROR("Alias name cannot be empty");
5077 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5079 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5081 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5082 CurModule.CurrentModule);
5083 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5084 InsertValue(GA, CurModule.Values);
5087 // If there was a forward reference of this alias, resolve it now.
5091 ID = ValID::createGlobalName(Name);
5093 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5095 if (GlobalValue *FWGV =
5096 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5097 // Replace uses of the fwdref with the actual alias.
5098 FWGV->replaceAllUsesWith(GA);
5099 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5100 GV->eraseFromParent();
5102 cast<Function>(FWGV)->eraseFromParent();
5111 #line 2151 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5118 #line 2154 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5125 #line 2160 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5127 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5128 if (AsmSoFar.empty())
5129 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5131 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5132 delete (yyvsp[(1) - (1)].StrVal);
5138 #line 2170 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5140 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5141 delete (yyvsp[(3) - (3)].StrVal);
5146 #line 2174 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5148 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5149 delete (yyvsp[(3) - (3)].StrVal);
5154 #line 2181 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5156 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5157 delete (yyvsp[(3) - (3)].StrVal);
5163 #line 2186 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5165 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5166 delete (yyvsp[(1) - (1)].StrVal);
5172 #line 2191 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5179 #line 2200 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5181 if (!UpRefs.empty())
5182 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5183 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5184 GEN_ERROR("void typed arguments are invalid");
5185 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5186 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5187 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5193 #line 2210 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5195 if (!UpRefs.empty())
5196 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5197 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5198 GEN_ERROR("void typed arguments are invalid");
5199 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5200 (yyval.ArgList) = new ArgListType;
5201 (yyval.ArgList)->push_back(E);
5207 #line 2221 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5209 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5215 #line 2225 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5217 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5218 struct ArgListEntry E;
5219 E.Ty = new PATypeHolder(Type::VoidTy);
5221 E.Attrs = ParamAttr::None;
5222 (yyval.ArgList)->push_back(E);
5228 #line 2234 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5230 (yyval.ArgList) = new ArgListType;
5231 struct ArgListEntry E;
5232 E.Ty = new PATypeHolder(Type::VoidTy);
5234 E.Attrs = ParamAttr::None;
5235 (yyval.ArgList)->push_back(E);
5241 #line 2243 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5243 (yyval.ArgList) = 0;
5249 #line 2249 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5251 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5252 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5254 // Check the function result for abstractness if this is a define. We should
5255 // have no abstract types at this point
5256 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5257 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5259 std::vector<const Type*> ParamTypeList;
5260 ParamAttrsVector Attrs;
5261 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
5262 ParamAttrsWithIndex PAWI;
5264 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
5265 Attrs.push_back(PAWI);
5267 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5269 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5270 const Type* Ty = I->Ty->get();
5271 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5272 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5273 ParamTypeList.push_back(Ty);
5274 if (Ty != Type::VoidTy)
5275 if (I->Attrs != ParamAttr::None) {
5276 ParamAttrsWithIndex PAWI;
5278 PAWI.attrs = I->Attrs;
5279 Attrs.push_back(PAWI);
5284 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5285 if (isVarArg) ParamTypeList.pop_back();
5287 const ParamAttrsList *PAL = 0;
5289 PAL = ParamAttrsList::get(Attrs);
5291 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5292 const PointerType *PFT = PointerType::getUnqual(FT);
5293 delete (yyvsp[(2) - (10)].TypeVal);
5296 if (!FunctionName.empty()) {
5297 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5299 ID = ValID::createGlobalID(CurModule.Values.size());
5303 // See if this function was forward referenced. If so, recycle the object.
5304 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5305 // Move the function to the end of the list, from whereever it was
5306 // previously inserted.
5307 Fn = cast<Function>(FWRef);
5308 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
5309 CurModule.CurrentModule->getFunctionList().remove(Fn);
5310 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5311 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5312 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5313 if (Fn->getFunctionType() != FT ) {
5314 // The existing function doesn't have the same type. This is an overload
5316 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5317 } else if (Fn->getParamAttrs() != PAL) {
5318 // The existing function doesn't have the same parameter attributes.
5319 // This is an overload error.
5320 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5321 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5322 // Neither the existing or the current function is a declaration and they
5323 // have the same name and same type. Clearly this is a redefinition.
5324 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5325 } else if (Fn->isDeclaration()) {
5326 // Make sure to strip off any argument names so we can't get conflicts.
5327 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5331 } else { // Not already defined?
5332 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5333 CurModule.CurrentModule);
5334 InsertValue(Fn, CurModule.Values);
5337 CurFun.FunctionStart(Fn);
5339 if (CurFun.isDeclare) {
5340 // If we have declaration, always overwrite linkage. This will allow us to
5341 // correctly handle cases, when pointer to function is passed as argument to
5342 // another function.
5343 Fn->setLinkage(CurFun.Linkage);
5344 Fn->setVisibility(CurFun.Visibility);
5346 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5347 Fn->setParamAttrs(PAL);
5348 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5349 if ((yyvsp[(8) - (10)].StrVal)) {
5350 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5351 delete (yyvsp[(8) - (10)].StrVal);
5353 if ((yyvsp[(10) - (10)].StrVal)) {
5354 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5355 delete (yyvsp[(10) - (10)].StrVal);
5358 // Add all of the arguments we parsed to the function...
5359 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5360 if (isVarArg) { // Nuke the last entry
5361 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5362 "Not a varargs marker!");
5363 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5364 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5366 Function::arg_iterator ArgIt = Fn->arg_begin();
5367 Function::arg_iterator ArgEnd = Fn->arg_end();
5369 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5370 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5371 delete I->Ty; // Delete the typeholder...
5372 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5378 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5385 #line 2384 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5387 (yyval.FunctionVal) = CurFun.CurrentFunction;
5389 // Make sure that we keep track of the linkage type even if there was a
5390 // previous "declare".
5391 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5392 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5397 #line 2395 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5399 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5405 #line 2400 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5407 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5408 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5409 (yyval.FunctionVal) = CurFun.CurrentFunction;
5410 CurFun.FunctionDone();
5416 #line 2412 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5418 (yyval.BoolVal) = false;
5424 #line 2416 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5426 (yyval.BoolVal) = true;
5432 #line 2421 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5433 { // A reference to a direct constant
5434 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5440 #line 2425 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5442 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5448 #line 2429 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5449 { // Perhaps it's an FP constant?
5450 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5456 #line 2433 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5458 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5464 #line 2437 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5466 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5472 #line 2441 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5474 (yyval.ValIDVal) = ValID::createNull();
5480 #line 2445 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5482 (yyval.ValIDVal) = ValID::createUndef();
5488 #line 2449 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5489 { // A vector zero constant.
5490 (yyval.ValIDVal) = ValID::createZeroInit();
5496 #line 2453 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5497 { // Nonempty unsized packed vector
5498 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5499 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5501 VectorType* pt = VectorType::get(ETy, NumElements);
5502 PATypeHolder* PTy = new PATypeHolder(
5510 // Verify all elements are correct type!
5511 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5512 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5513 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5514 ETy->getDescription() +"' as required!\nIt is of type '" +
5515 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5518 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5519 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5525 #line 2478 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5527 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5533 #line 2482 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5535 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5536 delete (yyvsp[(3) - (5)].StrVal);
5537 delete (yyvsp[(5) - (5)].StrVal);
5543 #line 2492 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5544 { // Is it an integer reference...?
5545 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5551 #line 2496 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5553 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5559 #line 2500 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5560 { // Is it a named reference...?
5561 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5562 delete (yyvsp[(1) - (1)].StrVal);
5568 #line 2505 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5569 { // Is it a named reference...?
5570 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5571 delete (yyvsp[(1) - (1)].StrVal);
5577 #line 2518 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5579 if (!UpRefs.empty())
5580 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5581 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5582 delete (yyvsp[(1) - (2)].TypeVal);
5588 #line 2527 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5590 (yyval.ValueList) = new std::vector<Value *>();
5591 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5597 #line 2532 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5599 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5605 #line 2537 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5607 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5613 #line 2541 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5614 { // Do not allow functions with 0 basic blocks
5615 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5621 #line 2550 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5623 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5625 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5626 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5627 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5633 #line 2559 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5635 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5636 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5637 if (CI2->getParent() == 0)
5638 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5639 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5640 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5646 #line 2568 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5647 { // Empty space between instruction lists
5648 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0);
5654 #line 2572 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5655 { // Only the unwind to block
5656 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal((yyvsp[(2) - (2)].ValIDVal)));
5662 #line 2576 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5663 { // Labelled (named) basic block
5664 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)), 0);
5665 delete (yyvsp[(1) - (1)].StrVal);
5671 #line 2581 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5673 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (3)].StrVal)), getBBVal((yyvsp[(3) - (3)].ValIDVal)));
5674 delete (yyvsp[(1) - (3)].StrVal);
5680 #line 2588 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5681 { // Return with a result...
5682 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5683 assert(!VL.empty() && "Invalid ret operands!");
5684 (yyval.TermInstVal) = new ReturnInst(&VL[0], VL.size());
5685 delete (yyvsp[(2) - (2)].ValueList);
5691 #line 2595 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5692 { // Return with no result...
5693 (yyval.TermInstVal) = new ReturnInst();
5699 #line 2599 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5700 { // Unconditional Branch...
5701 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5703 (yyval.TermInstVal) = new BranchInst(tmpBB);
5708 #line 2604 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5710 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5711 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5713 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5715 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5717 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5722 #line 2614 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5724 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5726 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5728 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5729 (yyval.TermInstVal) = S;
5731 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5732 E = (yyvsp[(8) - (9)].JumpTable)->end();
5733 for (; I != E; ++I) {
5734 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5735 S->addCase(CI, I->second);
5737 GEN_ERROR("Switch case is constant, but not a simple integer");
5739 delete (yyvsp[(8) - (9)].JumpTable);
5745 #line 2633 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5747 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5749 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5751 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5752 (yyval.TermInstVal) = S;
5758 #line 2643 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5761 // Handle the short syntax
5762 const PointerType *PFTy = 0;
5763 const FunctionType *Ty = 0;
5764 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5765 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5766 // Pull out the types of all of the arguments...
5767 std::vector<const Type*> ParamTypes;
5768 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5769 for (; I != E; ++I) {
5770 const Type *Ty = I->Val->getType();
5771 if (Ty == Type::VoidTy)
5772 GEN_ERROR("Short call syntax cannot be used with varargs");
5773 ParamTypes.push_back(Ty);
5775 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5776 PFTy = PointerType::getUnqual(Ty);
5779 delete (yyvsp[(3) - (14)].TypeVal);
5781 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5783 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5785 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5788 ParamAttrsVector Attrs;
5789 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5790 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5791 Attrs.push_back(PAWI);
5794 // Check the arguments
5796 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5797 // Make sure no arguments is a good thing!
5798 if (Ty->getNumParams() != 0)
5799 GEN_ERROR("No arguments passed to a function that "
5800 "expects arguments");
5801 } else { // Has arguments?
5802 // Loop through FunctionType's arguments and ensure they are specified
5804 FunctionType::param_iterator I = Ty->param_begin();
5805 FunctionType::param_iterator E = Ty->param_end();
5806 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5809 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5810 if (ArgI->Val->getType() != *I)
5811 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5812 (*I)->getDescription() + "'");
5813 Args.push_back(ArgI->Val);
5814 if (ArgI->Attrs != ParamAttr::None) {
5815 ParamAttrsWithIndex PAWI;
5817 PAWI.attrs = ArgI->Attrs;
5818 Attrs.push_back(PAWI);
5822 if (Ty->isVarArg()) {
5824 for (; ArgI != ArgE; ++ArgI, ++index) {
5825 Args.push_back(ArgI->Val); // push the remaining varargs
5826 if (ArgI->Attrs != ParamAttr::None) {
5827 ParamAttrsWithIndex PAWI;
5829 PAWI.attrs = ArgI->Attrs;
5830 Attrs.push_back(PAWI);
5833 } else if (I != E || ArgI != ArgE)
5834 GEN_ERROR("Invalid number of parameters detected");
5837 const ParamAttrsList *PAL = 0;
5839 PAL = ParamAttrsList::get(Attrs);
5841 // Create the InvokeInst
5842 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5843 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5844 II->setParamAttrs(PAL);
5845 (yyval.TermInstVal) = II;
5846 delete (yyvsp[(6) - (14)].ParamList);
5852 #line 2733 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5854 (yyval.TermInstVal) = new UnwindInst();
5860 #line 2737 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5862 (yyval.TermInstVal) = new UnreachableInst();
5868 #line 2744 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5870 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5871 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5874 GEN_ERROR("May only switch on a constant pool value");
5876 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5878 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5883 #line 2755 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5885 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5886 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5890 GEN_ERROR("May only switch on a constant pool value");
5892 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5894 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5899 #line 2768 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5901 // Is this definition named?? if so, assign the name...
5902 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5904 InsertValue((yyvsp[(2) - (2)].InstVal));
5905 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5911 #line 2778 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5912 { // Used for PHI nodes
5913 if (!UpRefs.empty())
5914 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5915 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5916 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5918 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5920 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5921 delete (yyvsp[(1) - (6)].TypeVal);
5926 #line 2789 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5928 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5929 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5931 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5933 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5938 #line 2799 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5940 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5941 if (!UpRefs.empty())
5942 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5943 // Used for call and invoke instructions
5944 (yyval.ParamList) = new ParamList();
5945 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5946 (yyval.ParamList)->push_back(E);
5947 delete (yyvsp[(1) - (4)].TypeVal);
5953 #line 2810 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5955 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5956 // Labels are only valid in ASMs
5957 (yyval.ParamList) = new ParamList();
5958 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5959 (yyval.ParamList)->push_back(E);
5965 #line 2818 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5967 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5968 if (!UpRefs.empty())
5969 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5970 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5971 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5972 (yyval.ParamList)->push_back(E);
5973 delete (yyvsp[(3) - (6)].TypeVal);
5979 #line 2828 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5981 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5982 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5983 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5984 (yyval.ParamList)->push_back(E);
5990 #line 2835 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5991 { (yyval.ParamList) = new ParamList(); ;}
5995 #line 2838 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
5996 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6000 #line 2839 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6002 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6003 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6009 #line 2846 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6011 (yyval.BoolVal) = true;
6017 #line 2850 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6019 (yyval.BoolVal) = false;
6025 #line 2855 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6027 if (!UpRefs.empty())
6028 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6029 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6030 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6032 "Arithmetic operator requires integer, FP, or packed operands");
6033 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6035 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6037 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6038 if ((yyval.InstVal) == 0)
6039 GEN_ERROR("binary operator returned null");
6040 delete (yyvsp[(2) - (5)].TypeVal);
6045 #line 2871 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6047 if (!UpRefs.empty())
6048 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6049 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6050 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6051 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6052 GEN_ERROR("Logical operator requires integral operands");
6054 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6056 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6058 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6059 if ((yyval.InstVal) == 0)
6060 GEN_ERROR("binary operator returned null");
6061 delete (yyvsp[(2) - (5)].TypeVal);
6066 #line 2888 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6068 if (!UpRefs.empty())
6069 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6070 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6071 GEN_ERROR("Vector types not supported by icmp instruction");
6072 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6074 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6076 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6077 if ((yyval.InstVal) == 0)
6078 GEN_ERROR("icmp operator returned null");
6079 delete (yyvsp[(3) - (6)].TypeVal);
6084 #line 2902 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6086 if (!UpRefs.empty())
6087 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6088 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6089 GEN_ERROR("Vector types not supported by fcmp instruction");
6090 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6092 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6094 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6095 if ((yyval.InstVal) == 0)
6096 GEN_ERROR("fcmp operator returned null");
6097 delete (yyvsp[(3) - (6)].TypeVal);
6102 #line 2916 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6104 if (!UpRefs.empty())
6105 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6106 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6107 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6108 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6109 GEN_ERROR("invalid cast opcode for cast from '" +
6110 Val->getType()->getDescription() + "' to '" +
6111 DestTy->getDescription() + "'");
6112 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6113 delete (yyvsp[(4) - (4)].TypeVal);
6118 #line 2928 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6120 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6121 GEN_ERROR("select condition must be boolean");
6122 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6123 GEN_ERROR("select value types should match");
6124 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6130 #line 2936 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6132 if (!UpRefs.empty())
6133 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6134 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6135 delete (yyvsp[(4) - (4)].TypeVal);
6141 #line 2943 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6143 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6144 GEN_ERROR("Invalid extractelement operands");
6145 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6151 #line 2949 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6153 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6154 GEN_ERROR("Invalid insertelement operands");
6155 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6161 #line 2955 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6163 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6164 GEN_ERROR("Invalid shufflevector operands");
6165 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6171 #line 2961 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6173 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6174 if (!Ty->isFirstClassType())
6175 GEN_ERROR("PHI node operands must be of first class type");
6176 (yyval.InstVal) = new PHINode(Ty);
6177 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6178 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6179 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6180 GEN_ERROR("All elements of a PHI node must be of the same type");
6181 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6182 (yyvsp[(2) - (2)].PHIList)->pop_front();
6184 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6190 #line 2977 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6193 // Handle the short syntax
6194 const PointerType *PFTy = 0;
6195 const FunctionType *Ty = 0;
6196 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6197 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6198 // Pull out the types of all of the arguments...
6199 std::vector<const Type*> ParamTypes;
6200 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6201 for (; I != E; ++I) {
6202 const Type *Ty = I->Val->getType();
6203 if (Ty == Type::VoidTy)
6204 GEN_ERROR("Short call syntax cannot be used with varargs");
6205 ParamTypes.push_back(Ty);
6207 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6208 PFTy = PointerType::getUnqual(Ty);
6211 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6214 // Check for call to invalid intrinsic to avoid crashing later.
6215 if (Function *theF = dyn_cast<Function>(V)) {
6216 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6217 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6218 !theF->getIntrinsicID(true))
6219 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6220 theF->getName() + "'");
6223 // Set up the ParamAttrs for the function
6224 ParamAttrsVector Attrs;
6225 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6226 ParamAttrsWithIndex PAWI;
6228 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6229 Attrs.push_back(PAWI);
6231 // Check the arguments
6233 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6234 // Make sure no arguments is a good thing!
6235 if (Ty->getNumParams() != 0)
6236 GEN_ERROR("No arguments passed to a function that "
6237 "expects arguments");
6238 } else { // Has arguments?
6239 // Loop through FunctionType's arguments and ensure they are specified
6240 // correctly. Also, gather any parameter attributes.
6241 FunctionType::param_iterator I = Ty->param_begin();
6242 FunctionType::param_iterator E = Ty->param_end();
6243 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6246 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6247 if (ArgI->Val->getType() != *I)
6248 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6249 (*I)->getDescription() + "'");
6250 Args.push_back(ArgI->Val);
6251 if (ArgI->Attrs != ParamAttr::None) {
6252 ParamAttrsWithIndex PAWI;
6254 PAWI.attrs = ArgI->Attrs;
6255 Attrs.push_back(PAWI);
6258 if (Ty->isVarArg()) {
6260 for (; ArgI != ArgE; ++ArgI, ++index) {
6261 Args.push_back(ArgI->Val); // push the remaining varargs
6262 if (ArgI->Attrs != ParamAttr::None) {
6263 ParamAttrsWithIndex PAWI;
6265 PAWI.attrs = ArgI->Attrs;
6266 Attrs.push_back(PAWI);
6269 } else if (I != E || ArgI != ArgE)
6270 GEN_ERROR("Invalid number of parameters detected");
6273 // Finish off the ParamAttrs and check them
6274 const ParamAttrsList *PAL = 0;
6276 PAL = ParamAttrsList::get(Attrs);
6278 // Create the call node
6279 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
6280 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6281 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6282 CI->setParamAttrs(PAL);
6283 (yyval.InstVal) = CI;
6284 delete (yyvsp[(6) - (8)].ParamList);
6285 delete (yyvsp[(3) - (8)].TypeVal);
6291 #line 3074 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6293 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6299 #line 3079 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6301 (yyval.BoolVal) = true;
6307 #line 3083 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6309 (yyval.BoolVal) = false;
6315 #line 3090 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6317 if (!UpRefs.empty())
6318 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6319 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6320 delete (yyvsp[(2) - (3)].TypeVal);
6326 #line 3097 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6328 if (!UpRefs.empty())
6329 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6330 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6332 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6333 delete (yyvsp[(2) - (6)].TypeVal);
6338 #line 3105 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6340 if (!UpRefs.empty())
6341 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6342 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6343 delete (yyvsp[(2) - (3)].TypeVal);
6349 #line 3112 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6351 if (!UpRefs.empty())
6352 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6353 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6355 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6356 delete (yyvsp[(2) - (6)].TypeVal);
6361 #line 3120 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6363 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6364 GEN_ERROR("Trying to free nonpointer type " +
6365 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6366 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6372 #line 3128 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6374 if (!UpRefs.empty())
6375 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6376 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6377 GEN_ERROR("Can't load from nonpointer type: " +
6378 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6379 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6380 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6381 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6382 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6384 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6385 delete (yyvsp[(3) - (5)].TypeVal);
6390 #line 3142 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6392 if (!UpRefs.empty())
6393 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6394 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6396 GEN_ERROR("Can't store to a nonpointer type: " +
6397 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6398 const Type *ElTy = PT->getElementType();
6399 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6400 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6401 "' into space of type '" + ElTy->getDescription() + "'");
6403 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6405 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6406 delete (yyvsp[(5) - (7)].TypeVal);
6411 #line 3159 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6413 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6414 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6415 GEN_ERROR("Invalid getresult operands");
6416 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6417 delete (yyvsp[(2) - (5)].TypeVal);
6423 #line 3167 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6425 if (!UpRefs.empty())
6426 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6427 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6428 GEN_ERROR("getelementptr insn requires pointer operand");
6430 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6431 GEN_ERROR("Invalid getelementptr indices for type '" +
6432 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6433 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6435 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6436 delete (yyvsp[(2) - (4)].TypeVal);
6437 delete (yyvsp[(4) - (4)].ValueList);
6442 /* Line 1267 of yacc.c. */
6443 #line 6444 "llvmAsmParser.tab.c"
6446 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6450 YY_STACK_PRINT (yyss, yyssp);
6455 /* Now `shift' the result of the reduction. Determine what state
6456 that goes to, based on the state we popped back to and the rule
6457 number reduced by. */
6461 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6462 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6463 yystate = yytable[yystate];
6465 yystate = yydefgoto[yyn - YYNTOKENS];
6470 /*------------------------------------.
6471 | yyerrlab -- here on detecting error |
6472 `------------------------------------*/
6474 /* If not already recovering from an error, report this error. */
6478 #if ! YYERROR_VERBOSE
6479 yyerror (YY_("syntax error"));
6482 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6483 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6485 YYSIZE_T yyalloc = 2 * yysize;
6486 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6487 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6488 if (yymsg != yymsgbuf)
6489 YYSTACK_FREE (yymsg);
6490 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6492 yymsg_alloc = yyalloc;
6496 yymsg_alloc = sizeof yymsgbuf;
6500 if (0 < yysize && yysize <= yymsg_alloc)
6502 (void) yysyntax_error (yymsg, yystate, yychar);
6507 yyerror (YY_("syntax error"));
6509 goto yyexhaustedlab;
6517 if (yyerrstatus == 3)
6519 /* If just tried and failed to reuse look-ahead token after an
6520 error, discard it. */
6522 if (yychar <= YYEOF)
6524 /* Return failure if at end of input. */
6525 if (yychar == YYEOF)
6530 yydestruct ("Error: discarding",
6536 /* Else will try to reuse look-ahead token after shifting the error
6541 /*---------------------------------------------------.
6542 | yyerrorlab -- error raised explicitly by YYERROR. |
6543 `---------------------------------------------------*/
6546 /* Pacify compilers like GCC when the user code never invokes
6547 YYERROR and the label yyerrorlab therefore never appears in user
6549 if (/*CONSTCOND*/ 0)
6552 /* Do not reclaim the symbols of the rule which action triggered
6556 YY_STACK_PRINT (yyss, yyssp);
6561 /*-------------------------------------------------------------.
6562 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6563 `-------------------------------------------------------------*/
6565 yyerrstatus = 3; /* Each real token shifted decrements this. */
6569 yyn = yypact[yystate];
6570 if (yyn != YYPACT_NINF)
6573 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6581 /* Pop the current state because it cannot handle the error token. */
6586 yydestruct ("Error: popping",
6587 yystos[yystate], yyvsp);
6590 YY_STACK_PRINT (yyss, yyssp);
6599 /* Shift the error token. */
6600 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6606 /*-------------------------------------.
6607 | yyacceptlab -- YYACCEPT comes here. |
6608 `-------------------------------------*/
6613 /*-----------------------------------.
6614 | yyabortlab -- YYABORT comes here. |
6615 `-----------------------------------*/
6621 /*-------------------------------------------------.
6622 | yyexhaustedlab -- memory exhaustion comes here. |
6623 `-------------------------------------------------*/
6625 yyerror (YY_("memory exhausted"));
6631 if (yychar != YYEOF && yychar != YYEMPTY)
6632 yydestruct ("Cleanup: discarding lookahead",
6634 /* Do not reclaim the symbols of the rule which action triggered
6635 this YYABORT or YYACCEPT. */
6637 YY_STACK_PRINT (yyss, yyssp);
6638 while (yyssp != yyss)
6640 yydestruct ("Cleanup: popping",
6641 yystos[*yyssp], yyvsp);
6646 YYSTACK_FREE (yyss);
6649 if (yymsg != yymsgbuf)
6650 YYSTACK_FREE (yymsg);
6652 /* Make sure YYID is used. */
6653 return YYID (yyresult);
6657 #line 3184 "/Volumes/Nanpura/mrv/llvm/lib/AsmParser/llvmAsmParser.y"
6660 // common code from the two 'RunVMAsmParser' functions
6661 static Module* RunParser(Module * M) {
6662 CurModule.CurrentModule = M;
6663 // Check to make sure the parser succeeded
6666 delete ParserResult;
6670 // Emit an error if there are any unresolved types left.
6671 if (!CurModule.LateResolveTypes.empty()) {
6672 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6673 if (DID.Type == ValID::LocalName) {
6674 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6676 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6679 delete ParserResult;
6683 // Emit an error if there are any unresolved values left.
6684 if (!CurModule.LateResolveValues.empty()) {
6685 Value *V = CurModule.LateResolveValues.back();
6686 std::map<Value*, std::pair<ValID, int> >::iterator I =
6687 CurModule.PlaceHolderInfo.find(V);
6689 if (I != CurModule.PlaceHolderInfo.end()) {
6690 ValID &DID = I->second.first;
6691 if (DID.Type == ValID::LocalName) {
6692 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6694 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6697 delete ParserResult;
6702 // Check to make sure that parsing produced a result
6706 // Reset ParserResult variable while saving its value for the result.
6707 Module *Result = ParserResult;
6713 void llvm::GenerateError(const std::string &message, int LineNo) {
6714 if (LineNo == -1) LineNo = LLLgetLineNo();
6715 // TODO: column number in exception
6717 TheParseError->setError(LLLgetFilename(), message, LineNo);
6721 int yyerror(const char *ErrorMsg) {
6722 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6723 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6724 if (yychar != YYEMPTY && yychar != 0) {
6725 errMsg += " while reading token: '";
6726 errMsg += std::string(LLLgetTokenStart(),
6727 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6729 GenerateError(errMsg);