1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
206 EXTRACTELEMENT = 387,
228 #define ESINT64VAL 258
229 #define EUINT64VAL 259
230 #define ESAPINTVAL 260
231 #define EUAPINTVAL 261
232 #define LOCALVAL_ID 262
233 #define GLOBALVAL_ID 263
241 #define PPC_FP128 271
245 #define GLOBALVAR 275
247 #define STRINGCONSTANT 277
248 #define ATSTRINGCONSTANT 278
249 #define PCTSTRINGCONSTANT 279
250 #define ZEROINITIALIZER 280
262 #define THREAD_LOCAL 292
264 #define DOTDOTDOT 294
270 #define APPENDING 300
271 #define DLLIMPORT 301
272 #define DLLEXPORT 302
273 #define EXTERN_WEAK 303
279 #define ADDRSPACE 309
285 #define SIDEEFFECT 315
288 #define FASTCC_TOK 318
289 #define COLDCC_TOK 319
290 #define X86_STDCALLCC_TOK 320
291 #define X86_FASTCALLCC_TOK 321
292 #define DATALAYOUT 322
298 #define UNREACHABLE 328
341 #define GETELEMENTPTR 371
357 #define EXTRACTELEMENT 387
358 #define INSERTELEMENT 388
359 #define SHUFFLEVECTOR 389
360 #define GETRESULT 390
375 #define PROTECTED 405
380 /* Copy the first part of user declarations. */
381 #line 14 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
383 #include "ParserInternals.h"
384 #include "llvm/CallingConv.h"
385 #include "llvm/InlineAsm.h"
386 #include "llvm/Instructions.h"
387 #include "llvm/Module.h"
388 #include "llvm/ValueSymbolTable.h"
389 #include "llvm/AutoUpgrade.h"
390 #include "llvm/Support/GetElementPtrTypeIterator.h"
391 #include "llvm/Support/CommandLine.h"
392 #include "llvm/ADT/SmallVector.h"
393 #include "llvm/ADT/STLExtras.h"
394 #include "llvm/Support/MathExtras.h"
395 #include "llvm/Support/Streams.h"
401 // The following is a gross hack. In order to rid the libAsmParser library of
402 // exceptions, we have to have a way of getting the yyparse function to go into
403 // an error situation. So, whenever we want an error to occur, the GenerateError
404 // function (see bottom of file) sets TriggerError. Then, at the end of each
405 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
406 // (a goto) to put YACC in error state. Furthermore, several calls to
407 // GenerateError are made from inside productions and they must simulate the
408 // previous exception behavior by exiting the production immediately. We have
409 // replaced these with the GEN_ERROR macro which calls GeneratError and then
410 // immediately invokes YYERROR. This would be so much cleaner if it was a
411 // recursive descent parser.
412 static bool TriggerError = false;
413 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
414 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
416 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
417 int yylex(); // declaration" of xxx warnings.
419 using namespace llvm;
421 static Module *ParserResult;
423 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
424 // relating to upreferences in the input stream.
426 //#define DEBUG_UPREFS 1
428 #define UR_OUT(X) cerr << X
433 #define YYERROR_VERBOSE 1
435 static GlobalVariable *CurGV;
438 // This contains info used when building the body of a function. It is
439 // destroyed when the function is completed.
441 typedef std::vector<Value *> ValueList; // Numbered defs
444 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
446 static struct PerModuleInfo {
447 Module *CurrentModule;
448 ValueList Values; // Module level numbered definitions
449 ValueList LateResolveValues;
450 std::vector<PATypeHolder> Types;
451 std::map<ValID, PATypeHolder> LateResolveTypes;
453 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
454 /// how they were referenced and on which line of the input they came from so
455 /// that we can resolve them later and print error messages as appropriate.
456 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
458 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
459 // references to global values. Global values may be referenced before they
460 // are defined, and if so, the temporary object that they represent is held
461 // here. This is used for forward references of GlobalValues.
463 typedef std::map<std::pair<const PointerType *,
464 ValID>, GlobalValue*> GlobalRefsType;
465 GlobalRefsType GlobalRefs;
468 // If we could not resolve some functions at function compilation time
469 // (calls to functions before they are defined), resolve them now... Types
470 // are resolved when the constant pool has been completely parsed.
472 ResolveDefinitions(LateResolveValues);
476 // Check to make sure that all global value forward references have been
479 if (!GlobalRefs.empty()) {
480 std::string UndefinedReferences = "Unresolved global references exist:\n";
482 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
484 UndefinedReferences += " " + I->first.first->getDescription() + " " +
485 I->first.second.getName() + "\n";
487 GenerateError(UndefinedReferences);
491 // Look for intrinsic functions and CallInst that need to be upgraded
492 for (Module::iterator FI = CurrentModule->begin(),
493 FE = CurrentModule->end(); FI != FE; )
494 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
496 Values.clear(); // Clear out function local definitions
501 // GetForwardRefForGlobal - Check to see if there is a forward reference
502 // for this global. If so, remove it from the GlobalRefs map and return it.
503 // If not, just return null.
504 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
505 // Check to see if there is a forward reference to this global variable...
506 // if there is, eliminate it and patch the reference to use the new def'n.
507 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
508 GlobalValue *Ret = 0;
509 if (I != GlobalRefs.end()) {
516 bool TypeIsUnresolved(PATypeHolder* PATy) {
517 // If it isn't abstract, its resolved
518 const Type* Ty = PATy->get();
519 if (!Ty->isAbstract())
521 // Traverse the type looking for abstract types. If it isn't abstract then
522 // we don't need to traverse that leg of the type.
523 std::vector<const Type*> WorkList, SeenList;
524 WorkList.push_back(Ty);
525 while (!WorkList.empty()) {
526 const Type* Ty = WorkList.back();
527 SeenList.push_back(Ty);
529 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
530 // Check to see if this is an unresolved type
531 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
532 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
533 for ( ; I != E; ++I) {
534 if (I->second.get() == OpTy)
537 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
538 const Type* TheTy = SeqTy->getElementType();
539 if (TheTy->isAbstract() && TheTy != Ty) {
540 std::vector<const Type*>::iterator I = SeenList.begin(),
546 WorkList.push_back(TheTy);
548 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
549 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
550 const Type* TheTy = StrTy->getElementType(i);
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
558 WorkList.push_back(TheTy);
567 static struct PerFunctionInfo {
568 Function *CurrentFunction; // Pointer to current function being created
570 ValueList Values; // Keep track of #'d definitions
572 ValueList LateResolveValues;
573 bool isDeclare; // Is this function a forward declararation?
574 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
575 GlobalValue::VisibilityTypes Visibility;
577 /// BBForwardRefs - When we see forward references to basic blocks, keep
578 /// track of them here.
579 std::map<ValID, BasicBlock*> BBForwardRefs;
581 inline PerFunctionInfo() {
584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
588 inline void FunctionStart(Function *M) {
593 void FunctionDone() {
594 // Any forward referenced blocks left?
595 if (!BBForwardRefs.empty()) {
596 GenerateError("Undefined reference to label " +
597 BBForwardRefs.begin()->second->getName());
601 // Resolve all forward references now.
602 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
604 Values.clear(); // Clear out function local definitions
605 BBForwardRefs.clear();
608 Linkage = GlobalValue::ExternalLinkage;
609 Visibility = GlobalValue::DefaultVisibility;
611 } CurFun; // Info for the current function...
613 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
616 //===----------------------------------------------------------------------===//
617 // Code to handle definitions of all the types
618 //===----------------------------------------------------------------------===//
620 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
621 // Things that have names or are void typed don't get slot numbers
622 if (V->hasName() || (V->getType() == Type::VoidTy))
625 // In the case of function values, we have to allow for the forward reference
626 // of basic blocks, which are included in the numbering. Consequently, we keep
627 // track of the next insertion location with NextValNum. When a BB gets
628 // inserted, it could change the size of the CurFun.Values vector.
629 if (&ValueTab == &CurFun.Values) {
630 if (ValueTab.size() <= CurFun.NextValNum)
631 ValueTab.resize(CurFun.NextValNum+1);
632 ValueTab[CurFun.NextValNum++] = V;
635 // For all other lists, its okay to just tack it on the back of the vector.
636 ValueTab.push_back(V);
639 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
641 case ValID::LocalID: // Is it a numbered definition?
642 // Module constants occupy the lowest numbered slots...
643 if (D.Num < CurModule.Types.size())
644 return CurModule.Types[D.Num];
646 case ValID::LocalName: // Is it a named definition?
647 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
648 D.destroy(); // Free old strdup'd memory...
653 GenerateError("Internal parser error: Invalid symbol type reference");
657 // If we reached here, we referenced either a symbol that we don't know about
658 // or an id number that hasn't been read yet. We may be referencing something
659 // forward, so just create an entry to be resolved later and get to it...
661 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
664 if (inFunctionScope()) {
665 if (D.Type == ValID::LocalName) {
666 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
669 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
674 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
675 if (I != CurModule.LateResolveTypes.end())
678 Type *Typ = OpaqueType::get();
679 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
683 // getExistingVal - Look up the value specified by the provided type and
684 // the provided ValID. If the value exists and has already been defined, return
685 // it. Otherwise return null.
687 static Value *getExistingVal(const Type *Ty, const ValID &D) {
688 if (isa<FunctionType>(Ty)) {
689 GenerateError("Functions are not values and "
690 "must be referenced as pointers");
695 case ValID::LocalID: { // Is it a numbered definition?
696 // Check that the number is within bounds.
697 if (D.Num >= CurFun.Values.size())
699 Value *Result = CurFun.Values[D.Num];
700 if (Ty != Result->getType()) {
701 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
702 Result->getType()->getDescription() + "' does not match "
703 "expected type, '" + Ty->getDescription() + "'");
708 case ValID::GlobalID: { // Is it a numbered definition?
709 if (D.Num >= CurModule.Values.size())
711 Value *Result = CurModule.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
721 case ValID::LocalName: { // Is it a named definition?
722 if (!inFunctionScope())
724 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
725 Value *N = SymTab.lookup(D.getName());
728 if (N->getType() != Ty)
731 D.destroy(); // Free old strdup'd memory...
734 case ValID::GlobalName: { // Is it a named definition?
735 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
736 Value *N = SymTab.lookup(D.getName());
739 if (N->getType() != Ty)
742 D.destroy(); // Free old strdup'd memory...
746 // Check to make sure that "Ty" is an integral type, and that our
747 // value will fit into the specified type...
748 case ValID::ConstSIntVal: // Is it a constant pool reference??
749 if (!isa<IntegerType>(Ty) ||
750 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
751 GenerateError("Signed integral constant '" +
752 itostr(D.ConstPool64) + "' is invalid for type '" +
753 Ty->getDescription() + "'");
756 return ConstantInt::get(Ty, D.ConstPool64, true);
758 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
759 if (isa<IntegerType>(Ty) &&
760 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
761 return ConstantInt::get(Ty, D.UConstPool64);
763 if (!isa<IntegerType>(Ty) ||
764 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
765 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
766 "' is invalid or out of range for type '" +
767 Ty->getDescription() + "'");
770 // This is really a signed reference. Transmogrify.
771 return ConstantInt::get(Ty, D.ConstPool64, true);
773 case ValID::ConstFPVal: // Is it a floating point const pool reference?
774 if (!Ty->isFloatingPoint() ||
775 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
776 GenerateError("FP constant invalid for type");
779 // Lexer has no type info, so builds all float and double FP constants
780 // as double. Fix this here. Long double does not need this.
781 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
783 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
784 return ConstantFP::get(*D.ConstPoolFP);
786 case ValID::ConstNullVal: // Is it a null value?
787 if (!isa<PointerType>(Ty)) {
788 GenerateError("Cannot create a a non pointer null");
791 return ConstantPointerNull::get(cast<PointerType>(Ty));
793 case ValID::ConstUndefVal: // Is it an undef value?
794 return UndefValue::get(Ty);
796 case ValID::ConstZeroVal: // Is it a zero value?
797 return Constant::getNullValue(Ty);
799 case ValID::ConstantVal: // Fully resolved constant?
800 if (D.ConstantValue->getType() != Ty) {
801 GenerateError("Constant expression type different from required type");
804 return D.ConstantValue;
806 case ValID::InlineAsmVal: { // Inline asm expression
807 const PointerType *PTy = dyn_cast<PointerType>(Ty);
808 const FunctionType *FTy =
809 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
810 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
811 GenerateError("Invalid type for asm constraint string");
814 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
815 D.IAD->HasSideEffects);
816 D.destroy(); // Free InlineAsmDescriptor.
820 assert(0 && "Unhandled case!");
824 assert(0 && "Unhandled case!");
828 // getVal - This function is identical to getExistingVal, except that if a
829 // value is not already defined, it "improvises" by creating a placeholder var
830 // that looks and acts just like the requested variable. When the value is
831 // defined later, all uses of the placeholder variable are replaced with the
834 static Value *getVal(const Type *Ty, const ValID &ID) {
835 if (Ty == Type::LabelTy) {
836 GenerateError("Cannot use a basic block here");
840 // See if the value has already been defined.
841 Value *V = getExistingVal(Ty, ID);
843 if (TriggerError) return 0;
845 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
846 GenerateError("Invalid use of a composite type");
850 // If we reached here, we referenced either a symbol that we don't know about
851 // or an id number that hasn't been read yet. We may be referencing something
852 // forward, so just create an entry to be resolved later and get to it...
855 case ValID::GlobalName:
856 case ValID::GlobalID: {
857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
859 GenerateError("Invalid type for reference to global" );
862 const Type* ElTy = PTy->getElementType();
863 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
864 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
866 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
867 (Module*)0, false, PTy->getAddressSpace());
871 V = new Argument(Ty);
874 // Remember where this forward reference came from. FIXME, shouldn't we try
875 // to recycle these things??
876 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
879 if (inFunctionScope())
880 InsertValue(V, CurFun.LateResolveValues);
882 InsertValue(V, CurModule.LateResolveValues);
886 /// defineBBVal - This is a definition of a new basic block with the specified
887 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
888 static BasicBlock *defineBBVal(const ValID &ID) {
889 assert(inFunctionScope() && "Can't get basic block at global scope!");
893 // First, see if this was forward referenced
895 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
896 if (BBI != CurFun.BBForwardRefs.end()) {
898 // The forward declaration could have been inserted anywhere in the
899 // function: insert it into the correct place now.
900 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
901 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
903 // We're about to erase the entry, save the key so we can clean it up.
904 ValID Tmp = BBI->first;
906 // Erase the forward ref from the map as its no longer "forward"
907 CurFun.BBForwardRefs.erase(ID);
909 // The key has been removed from the map but so we don't want to leave
910 // strdup'd memory around so destroy it too.
913 // If its a numbered definition, bump the number and set the BB value.
914 if (ID.Type == ValID::LocalID) {
915 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
919 // We haven't seen this BB before and its first mention is a definition.
920 // Just create it and return it.
921 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
922 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
923 if (ID.Type == ValID::LocalID) {
924 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
933 /// getBBVal - get an existing BB value or create a forward reference for it.
935 static BasicBlock *getBBVal(const ValID &ID) {
936 assert(inFunctionScope() && "Can't get basic block at global scope!");
940 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
941 if (BBI != CurFun.BBForwardRefs.end()) {
943 } if (ID.Type == ValID::LocalName) {
944 std::string Name = ID.getName();
945 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
947 if (N->getType()->getTypeID() == Type::LabelTyID)
948 BB = cast<BasicBlock>(N);
950 GenerateError("Reference to label '" + Name + "' is actually of type '"+
951 N->getType()->getDescription() + "'");
953 } else if (ID.Type == ValID::LocalID) {
954 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
955 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
956 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
958 GenerateError("Reference to label '%" + utostr(ID.Num) +
959 "' is actually of type '"+
960 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
963 GenerateError("Illegal label reference " + ID.getName());
967 // If its already been defined, return it now.
969 ID.destroy(); // Free strdup'd memory.
973 // Otherwise, this block has not been seen before, create it.
975 if (ID.Type == ValID::LocalName)
977 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
979 // Insert it in the forward refs map.
980 CurFun.BBForwardRefs[ID] = BB;
986 //===----------------------------------------------------------------------===//
987 // Code to handle forward references in instructions
988 //===----------------------------------------------------------------------===//
990 // This code handles the late binding needed with statements that reference
991 // values not defined yet... for example, a forward branch, or the PHI node for
994 // This keeps a table (CurFun.LateResolveValues) of all such forward references
995 // and back patchs after we are done.
998 // ResolveDefinitions - If we could not resolve some defs at parsing
999 // time (forward branches, phi functions for loops, etc...) resolve the
1003 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1004 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1005 while (!LateResolvers.empty()) {
1006 Value *V = LateResolvers.back();
1007 LateResolvers.pop_back();
1009 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1010 CurModule.PlaceHolderInfo.find(V);
1011 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1013 ValID &DID = PHI->second.first;
1015 Value *TheRealValue = getExistingVal(V->getType(), DID);
1019 V->replaceAllUsesWith(TheRealValue);
1021 CurModule.PlaceHolderInfo.erase(PHI);
1022 } else if (FutureLateResolvers) {
1023 // Functions have their unresolved items forwarded to the module late
1025 InsertValue(V, *FutureLateResolvers);
1027 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1028 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1029 "' of type '" + V->getType()->getDescription() + "'",
1030 PHI->second.second);
1033 GenerateError("Reference to an invalid definition: #" +
1034 itostr(DID.Num) + " of type '" +
1035 V->getType()->getDescription() + "'",
1036 PHI->second.second);
1041 LateResolvers.clear();
1044 // ResolveTypeTo - A brand new type was just declared. This means that (if
1045 // name is not null) things referencing Name can be resolved. Otherwise, things
1046 // refering to the number can be resolved. Do this now.
1048 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1051 D = ValID::createLocalName(*Name);
1053 D = ValID::createLocalID(CurModule.Types.size());
1055 std::map<ValID, PATypeHolder>::iterator I =
1056 CurModule.LateResolveTypes.find(D);
1057 if (I != CurModule.LateResolveTypes.end()) {
1058 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1059 CurModule.LateResolveTypes.erase(I);
1063 // setValueName - Set the specified value to the name given. The name may be
1064 // null potentially, in which case this is a noop. The string passed in is
1065 // assumed to be a malloc'd string buffer, and is free'd by this function.
1067 static void setValueName(Value *V, std::string *NameStr) {
1068 if (!NameStr) return;
1069 std::string Name(*NameStr); // Copy string
1070 delete NameStr; // Free old string
1072 if (V->getType() == Type::VoidTy) {
1073 GenerateError("Can't assign name '" + Name+"' to value with void type");
1077 assert(inFunctionScope() && "Must be in function scope!");
1078 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1079 if (ST.lookup(Name)) {
1080 GenerateError("Redefinition of value '" + Name + "' of type '" +
1081 V->getType()->getDescription() + "'");
1089 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1090 /// this is a declaration, otherwise it is a definition.
1091 static GlobalVariable *
1092 ParseGlobalVariable(std::string *NameStr,
1093 GlobalValue::LinkageTypes Linkage,
1094 GlobalValue::VisibilityTypes Visibility,
1095 bool isConstantGlobal, const Type *Ty,
1096 Constant *Initializer, bool IsThreadLocal,
1097 unsigned AddressSpace = 0) {
1098 if (isa<FunctionType>(Ty)) {
1099 GenerateError("Cannot declare global vars of function type");
1103 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1107 Name = *NameStr; // Copy string
1108 delete NameStr; // Free old string
1111 // See if this global value was forward referenced. If so, recycle the
1114 if (!Name.empty()) {
1115 ID = ValID::createGlobalName(Name);
1117 ID = ValID::createGlobalID(CurModule.Values.size());
1120 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1121 // Move the global to the end of the list, from whereever it was
1122 // previously inserted.
1123 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1124 CurModule.CurrentModule->getGlobalList().remove(GV);
1125 CurModule.CurrentModule->getGlobalList().push_back(GV);
1126 GV->setInitializer(Initializer);
1127 GV->setLinkage(Linkage);
1128 GV->setVisibility(Visibility);
1129 GV->setConstant(isConstantGlobal);
1130 GV->setThreadLocal(IsThreadLocal);
1131 InsertValue(GV, CurModule.Values);
1135 // If this global has a name
1136 if (!Name.empty()) {
1137 // if the global we're parsing has an initializer (is a definition) and
1138 // has external linkage.
1139 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1140 // If there is already a global with external linkage with this name
1141 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1142 // If we allow this GVar to get created, it will be renamed in the
1143 // symbol table because it conflicts with an existing GVar. We can't
1144 // allow redefinition of GVars whose linking indicates that their name
1145 // must stay the same. Issue the error.
1146 GenerateError("Redefinition of global variable named '" + Name +
1147 "' of type '" + Ty->getDescription() + "'");
1152 // Otherwise there is no existing GV to use, create one now.
1153 GlobalVariable *GV =
1154 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1155 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1156 GV->setVisibility(Visibility);
1157 InsertValue(GV, CurModule.Values);
1161 // setTypeName - Set the specified type to the name given. The name may be
1162 // null potentially, in which case this is a noop. The string passed in is
1163 // assumed to be a malloc'd string buffer, and is freed by this function.
1165 // This function returns true if the type has already been defined, but is
1166 // allowed to be redefined in the specified context. If the name is a new name
1167 // for the type plane, it is inserted and false is returned.
1168 static bool setTypeName(const Type *T, std::string *NameStr) {
1169 assert(!inFunctionScope() && "Can't give types function-local names!");
1170 if (NameStr == 0) return false;
1172 std::string Name(*NameStr); // Copy string
1173 delete NameStr; // Free old string
1175 // We don't allow assigning names to void type
1176 if (T == Type::VoidTy) {
1177 GenerateError("Can't assign name '" + Name + "' to the void type");
1181 // Set the type name, checking for conflicts as we do so.
1182 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1184 if (AlreadyExists) { // Inserting a name that is already defined???
1185 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1186 assert(Existing && "Conflict but no matching type?!");
1188 // There is only one case where this is allowed: when we are refining an
1189 // opaque type. In this case, Existing will be an opaque type.
1190 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1191 // We ARE replacing an opaque type!
1192 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1196 // Otherwise, this is an attempt to redefine a type. That's okay if
1197 // the redefinition is identical to the original. This will be so if
1198 // Existing and T point to the same Type object. In this one case we
1199 // allow the equivalent redefinition.
1200 if (Existing == T) return true; // Yes, it's equal.
1202 // Any other kind of (non-equivalent) redefinition is an error.
1203 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1204 T->getDescription() + "'");
1210 //===----------------------------------------------------------------------===//
1211 // Code for handling upreferences in type names...
1214 // TypeContains - Returns true if Ty directly contains E in it.
1216 static bool TypeContains(const Type *Ty, const Type *E) {
1217 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1218 E) != Ty->subtype_end();
1222 struct UpRefRecord {
1223 // NestingLevel - The number of nesting levels that need to be popped before
1224 // this type is resolved.
1225 unsigned NestingLevel;
1227 // LastContainedTy - This is the type at the current binding level for the
1228 // type. Every time we reduce the nesting level, this gets updated.
1229 const Type *LastContainedTy;
1231 // UpRefTy - This is the actual opaque type that the upreference is
1232 // represented with.
1233 OpaqueType *UpRefTy;
1235 UpRefRecord(unsigned NL, OpaqueType *URTy)
1236 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1240 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1241 static std::vector<UpRefRecord> UpRefs;
1243 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1244 /// called. It loops through the UpRefs vector, which is a list of the
1245 /// currently active types. For each type, if the up reference is contained in
1246 /// the newly completed type, we decrement the level count. When the level
1247 /// count reaches zero, the upreferenced type is the type that is passed in:
1248 /// thus we can complete the cycle.
1250 static PATypeHolder HandleUpRefs(const Type *ty) {
1251 // If Ty isn't abstract, or if there are no up-references in it, then there is
1252 // nothing to resolve here.
1253 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1255 PATypeHolder Ty(ty);
1256 UR_OUT("Type '" << Ty->getDescription() <<
1257 "' newly formed. Resolving upreferences.\n" <<
1258 UpRefs.size() << " upreferences active!\n");
1260 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1261 // to zero), we resolve them all together before we resolve them to Ty. At
1262 // the end of the loop, if there is anything to resolve to Ty, it will be in
1264 OpaqueType *TypeToResolve = 0;
1266 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1267 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1268 << UpRefs[i].second->getDescription() << ") = "
1269 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1270 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1271 // Decrement level of upreference
1272 unsigned Level = --UpRefs[i].NestingLevel;
1273 UpRefs[i].LastContainedTy = Ty;
1274 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1275 if (Level == 0) { // Upreference should be resolved!
1276 if (!TypeToResolve) {
1277 TypeToResolve = UpRefs[i].UpRefTy;
1279 UR_OUT(" * Resolving upreference for "
1280 << UpRefs[i].second->getDescription() << "\n";
1281 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1282 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1283 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1284 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1286 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1287 --i; // Do not skip the next element...
1292 if (TypeToResolve) {
1293 UR_OUT(" * Resolving upreference for "
1294 << UpRefs[i].second->getDescription() << "\n";
1295 std::string OldName = TypeToResolve->getDescription());
1296 TypeToResolve->refineAbstractTypeTo(Ty);
1302 //===----------------------------------------------------------------------===//
1303 // RunVMAsmParser - Define an interface to this parser
1304 //===----------------------------------------------------------------------===//
1306 static Module* RunParser(Module * M);
1308 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1310 Module *M = RunParser(new Module(LLLgetFilename()));
1317 /* Enabling traces. */
1322 /* Enabling verbose error messages. */
1323 #ifdef YYERROR_VERBOSE
1324 # undef YYERROR_VERBOSE
1325 # define YYERROR_VERBOSE 1
1327 # define YYERROR_VERBOSE 0
1330 /* Enabling the token table. */
1331 #ifndef YYTOKEN_TABLE
1332 # define YYTOKEN_TABLE 0
1335 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1336 typedef union YYSTYPE
1337 #line 949 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
1339 llvm::Module *ModuleVal;
1340 llvm::Function *FunctionVal;
1341 llvm::BasicBlock *BasicBlockVal;
1342 llvm::TerminatorInst *TermInstVal;
1343 llvm::Instruction *InstVal;
1344 llvm::Constant *ConstVal;
1346 const llvm::Type *PrimType;
1347 std::list<llvm::PATypeHolder> *TypeList;
1348 llvm::PATypeHolder *TypeVal;
1349 llvm::Value *ValueVal;
1350 std::vector<llvm::Value*> *ValueList;
1351 llvm::ArgListType *ArgList;
1352 llvm::TypeWithAttrs TypeWithAttrs;
1353 llvm::TypeWithAttrsList *TypeWithAttrsList;
1354 llvm::ParamList *ParamList;
1356 // Represent the RHS of PHI node
1357 std::list<std::pair<llvm::Value*,
1358 llvm::BasicBlock*> > *PHIList;
1359 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1360 std::vector<llvm::Constant*> *ConstVector;
1362 llvm::GlobalValue::LinkageTypes Linkage;
1363 llvm::GlobalValue::VisibilityTypes Visibility;
1364 llvm::ParameterAttributes ParamAttrs;
1365 llvm::APInt *APIntVal;
1370 llvm::APFloat *FPVal;
1373 std::string *StrVal; // This memory must be deleted
1374 llvm::ValID ValIDVal;
1376 llvm::Instruction::BinaryOps BinaryOpVal;
1377 llvm::Instruction::TermOps TermOpVal;
1378 llvm::Instruction::MemoryOps MemOpVal;
1379 llvm::Instruction::CastOps CastOpVal;
1380 llvm::Instruction::OtherOps OtherOpVal;
1381 llvm::ICmpInst::Predicate IPredicate;
1382 llvm::FCmpInst::Predicate FPredicate;
1384 /* Line 193 of yacc.c. */
1385 #line 1386 "llvmAsmParser.tab.c"
1387 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1388 # define YYSTYPE_IS_DECLARED 1
1389 # define YYSTYPE_IS_TRIVIAL 1
1394 /* Copy the second part of user declarations. */
1397 /* Line 216 of yacc.c. */
1398 #line 1399 "llvmAsmParser.tab.c"
1405 typedef YYTYPE_UINT8 yytype_uint8;
1407 typedef unsigned char yytype_uint8;
1411 typedef YYTYPE_INT8 yytype_int8;
1412 #elif (defined __STDC__ || defined __C99__FUNC__ \
1413 || defined __cplusplus || defined _MSC_VER)
1414 typedef signed char yytype_int8;
1416 typedef short int yytype_int8;
1419 #ifdef YYTYPE_UINT16
1420 typedef YYTYPE_UINT16 yytype_uint16;
1422 typedef unsigned short int yytype_uint16;
1426 typedef YYTYPE_INT16 yytype_int16;
1428 typedef short int yytype_int16;
1432 # ifdef __SIZE_TYPE__
1433 # define YYSIZE_T __SIZE_TYPE__
1434 # elif defined size_t
1435 # define YYSIZE_T size_t
1436 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1437 || defined __cplusplus || defined _MSC_VER)
1438 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1439 # define YYSIZE_T size_t
1441 # define YYSIZE_T unsigned int
1445 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1448 # if defined YYENABLE_NLS && YYENABLE_NLS
1450 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1451 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1455 # define YY_(msgid) msgid
1459 /* Suppress unused-variable warnings by "using" E. */
1460 #if ! defined lint || defined __GNUC__
1461 # define YYUSE(e) ((void) (e))
1463 # define YYUSE(e) /* empty */
1466 /* Identity function, used to suppress warnings about constant conditions. */
1468 # define YYID(n) (n)
1470 #if (defined __STDC__ || defined __C99__FUNC__ \
1471 || defined __cplusplus || defined _MSC_VER)
1484 #if ! defined yyoverflow || YYERROR_VERBOSE
1486 /* The parser invokes alloca or malloc; define the necessary symbols. */
1488 # ifdef YYSTACK_USE_ALLOCA
1489 # if YYSTACK_USE_ALLOCA
1491 # define YYSTACK_ALLOC __builtin_alloca
1492 # elif defined __BUILTIN_VA_ARG_INCR
1493 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1495 # define YYSTACK_ALLOC __alloca
1496 # elif defined _MSC_VER
1497 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1498 # define alloca _alloca
1500 # define YYSTACK_ALLOC alloca
1501 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1502 || defined __cplusplus || defined _MSC_VER)
1503 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1505 # define _STDLIB_H 1
1512 # ifdef YYSTACK_ALLOC
1513 /* Pacify GCC's `empty if-body' warning. */
1514 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1515 # ifndef YYSTACK_ALLOC_MAXIMUM
1516 /* The OS might guarantee only one guard page at the bottom of the stack,
1517 and a page size can be as small as 4096 bytes. So we cannot safely
1518 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1519 to allow for a few compiler-allocated temporary stack slots. */
1520 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1523 # define YYSTACK_ALLOC YYMALLOC
1524 # define YYSTACK_FREE YYFREE
1525 # ifndef YYSTACK_ALLOC_MAXIMUM
1526 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1528 # if (defined __cplusplus && ! defined _STDLIB_H \
1529 && ! ((defined YYMALLOC || defined malloc) \
1530 && (defined YYFREE || defined free)))
1531 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1533 # define _STDLIB_H 1
1537 # define YYMALLOC malloc
1538 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1539 || defined __cplusplus || defined _MSC_VER)
1540 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1544 # define YYFREE free
1545 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1546 || defined __cplusplus || defined _MSC_VER)
1547 void free (void *); /* INFRINGES ON USER NAME SPACE */
1551 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1554 #if (! defined yyoverflow \
1555 && (! defined __cplusplus \
1556 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1558 /* A type that is properly aligned for any stack member. */
1565 /* The size of the maximum gap between one aligned stack and the next. */
1566 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1568 /* The size of an array large to enough to hold all stacks, each with
1570 # define YYSTACK_BYTES(N) \
1571 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1572 + YYSTACK_GAP_MAXIMUM)
1574 /* Copy COUNT objects from FROM to TO. The source and destination do
1577 # if defined __GNUC__ && 1 < __GNUC__
1578 # define YYCOPY(To, From, Count) \
1579 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1581 # define YYCOPY(To, From, Count) \
1585 for (yyi = 0; yyi < (Count); yyi++) \
1586 (To)[yyi] = (From)[yyi]; \
1592 /* Relocate STACK from its old location to the new one. The
1593 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1594 elements in the stack, and YYPTR gives the new location of the
1595 stack. Advance YYPTR to a properly aligned location for the next
1597 # define YYSTACK_RELOCATE(Stack) \
1600 YYSIZE_T yynewbytes; \
1601 YYCOPY (&yyptr->Stack, Stack, yysize); \
1602 Stack = &yyptr->Stack; \
1603 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1604 yyptr += yynewbytes / sizeof (*yyptr); \
1610 /* YYFINAL -- State number of the termination state. */
1612 /* YYLAST -- Last index in YYTABLE. */
1615 /* YYNTOKENS -- Number of terminals. */
1616 #define YYNTOKENS 165
1617 /* YYNNTS -- Number of nonterminals. */
1619 /* YYNRULES -- Number of rules. */
1620 #define YYNRULES 322
1621 /* YYNRULES -- Number of states. */
1622 #define YYNSTATES 629
1624 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1625 #define YYUNDEFTOK 2
1626 #define YYMAXUTOK 405
1628 #define YYTRANSLATE(YYX) \
1629 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1631 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1632 static const yytype_uint8 yytranslate[] =
1634 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1660 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1661 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1662 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1663 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1664 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1665 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1666 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1667 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1668 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1669 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1670 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1671 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1672 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1673 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1674 145, 146, 147, 148, 149, 150
1678 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1680 static const yytype_uint16 yyprhs[] =
1682 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1683 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1684 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1685 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1686 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1687 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1688 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1689 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1690 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1691 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1692 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1693 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1694 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1695 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1696 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1697 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1698 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1699 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1700 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1701 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1702 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1703 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1704 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1705 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1706 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1707 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
1708 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1709 747, 750, 753, 757, 760, 761, 763, 766, 769, 773,
1710 783, 793, 802, 817, 819, 821, 828, 834, 837, 844,
1711 852, 857, 862, 869, 876, 877, 878, 882, 885, 887,
1712 893, 899, 906, 913, 918, 925, 930, 935, 942, 949,
1713 952, 961, 963, 965, 966, 970, 977, 981, 988, 991,
1717 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1718 static const yytype_int16 yyrhs[] =
1720 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
1721 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1722 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1723 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1724 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1725 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1726 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1727 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1728 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1729 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1730 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1731 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1732 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1733 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1734 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
1735 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1736 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1737 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
1738 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1739 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1740 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1741 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
1742 143, -1, 144, -1, 53, 4, -1, -1, 188, 187,
1743 -1, 138, -1, 141, -1, 137, -1, 136, -1, 145,
1744 -1, 146, -1, -1, 190, 189, -1, -1, 147, 22,
1745 -1, -1, 53, 4, -1, -1, 154, 53, 4, -1,
1746 34, 22, -1, -1, 194, -1, -1, 154, 197, 196,
1747 -1, 194, -1, 53, 4, -1, 11, -1, 12, -1,
1748 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1749 49, -1, 198, -1, 199, 175, 155, -1, 233, -1,
1750 156, 4, -1, 199, 151, 203, 152, 190, -1, 10,
1751 151, 203, 152, 190, -1, 157, 4, 158, 199, 159,
1752 -1, 160, 4, 158, 199, 161, -1, 162, 204, 163,
1753 -1, 162, 163, -1, 160, 162, 204, 163, 161, -1,
1754 160, 162, 163, 161, -1, 199, 188, -1, 199, -1,
1755 10, -1, 200, -1, 202, 154, 200, -1, 202, -1,
1756 202, 154, 39, -1, 39, -1, -1, 199, -1, 204,
1757 154, 199, -1, 199, 157, 207, 159, -1, 199, 157,
1758 159, -1, 199, 164, 22, -1, 199, 160, 207, 161,
1759 -1, 199, 162, 207, 163, -1, 199, 162, 163, -1,
1760 199, 160, 162, 207, 163, 161, -1, 199, 160, 162,
1761 163, 161, -1, 199, 40, -1, 199, 41, -1, 199,
1762 233, -1, 199, 206, -1, 199, 25, -1, 171, 3,
1763 -1, 171, 5, -1, 171, 4, -1, 171, 6, -1,
1764 11, 26, -1, 11, 27, -1, 172, 9, -1, 168,
1765 151, 205, 38, 199, 152, -1, 116, 151, 205, 245,
1766 152, -1, 130, 151, 205, 154, 205, 154, 205, 152,
1767 -1, 166, 151, 205, 154, 205, 152, -1, 167, 151,
1768 205, 154, 205, 152, -1, 89, 169, 151, 205, 154,
1769 205, 152, -1, 90, 170, 151, 205, 154, 205, 152,
1770 -1, 132, 151, 205, 154, 205, 152, -1, 133, 151,
1771 205, 154, 205, 154, 205, 152, -1, 134, 151, 205,
1772 154, 205, 154, 205, 152, -1, 207, 154, 205, -1,
1773 205, -1, 32, -1, 33, -1, 37, -1, -1, 201,
1774 233, -1, 122, 151, 210, 38, 199, 152, -1, 212,
1775 -1, -1, 213, -1, 212, 213, -1, -1, 31, 214,
1776 229, -1, -1, 30, 215, 230, -1, 59, 58, 219,
1777 -1, 176, 18, 199, -1, 176, 18, 10, -1, -1,
1778 178, 182, 209, 208, 205, 175, 216, 196, -1, -1,
1779 178, 180, 182, 209, 208, 205, 175, 217, 196, -1,
1780 -1, 178, 181, 182, 209, 208, 199, 175, 218, 196,
1781 -1, 178, 182, 35, 185, 210, -1, 51, 220, -1,
1782 55, 153, 221, -1, 22, -1, 52, 153, 22, -1,
1783 67, 153, 22, -1, 157, 222, 159, -1, 222, 154,
1784 22, -1, 22, -1, -1, 223, 154, 199, 188, 174,
1785 -1, 199, 188, 174, -1, 223, -1, 223, 154, 39,
1786 -1, 39, -1, -1, 186, 201, 177, 151, 224, 152,
1787 190, 195, 192, 191, -1, 28, -1, 162, -1, 184,
1788 182, 225, 226, -1, 29, -1, 163, -1, 237, 228,
1789 -1, 183, 182, 225, -1, -1, 60, -1, 3, -1,
1790 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1791 41, -1, 25, -1, 160, 207, 161, -1, 206, -1,
1792 58, 231, 22, 154, 22, -1, 7, -1, 8, -1,
1793 173, -1, 177, -1, 233, -1, 232, -1, 199, 234,
1794 -1, 235, -1, 236, 154, 235, -1, 237, 238, -1,
1795 227, 238, -1, 239, 176, 240, -1, 239, 242, -1,
1796 -1, 21, -1, 68, 236, -1, 68, 10, -1, 69,
1797 17, 234, -1, 69, 11, 234, 154, 17, 234, 154,
1798 17, 234, -1, 70, 171, 234, 154, 17, 234, 157,
1799 241, 159, -1, 70, 171, 234, 154, 17, 234, 157,
1800 159, -1, 71, 186, 201, 234, 151, 244, 152, 190,
1801 38, 17, 234, 72, 17, 234, -1, 72, -1, 73,
1802 -1, 241, 171, 232, 154, 17, 234, -1, 171, 232,
1803 154, 17, 234, -1, 176, 247, -1, 199, 157, 234,
1804 154, 234, 159, -1, 243, 154, 157, 234, 154, 234,
1805 159, -1, 199, 188, 234, 188, -1, 17, 188, 234,
1806 188, -1, 244, 154, 199, 188, 234, 188, -1, 244,
1807 154, 17, 188, 234, 188, -1, -1, -1, 245, 154,
1808 235, -1, 57, 56, -1, 56, -1, 166, 199, 234,
1809 154, 234, -1, 167, 199, 234, 154, 234, -1, 89,
1810 169, 199, 234, 154, 234, -1, 90, 170, 199, 234,
1811 154, 234, -1, 168, 235, 38, 199, -1, 130, 235,
1812 154, 235, 154, 235, -1, 131, 235, 154, 199, -1,
1813 132, 235, 154, 235, -1, 133, 235, 154, 235, 154,
1814 235, -1, 134, 235, 154, 235, 154, 235, -1, 129,
1815 243, -1, 246, 186, 201, 234, 151, 244, 152, 190,
1816 -1, 249, -1, 36, -1, -1, 111, 199, 193, -1,
1817 111, 199, 154, 11, 234, 193, -1, 112, 199, 193,
1818 -1, 112, 199, 154, 11, 234, 193, -1, 113, 235,
1819 -1, 248, 114, 199, 234, 193, -1, 248, 115, 235,
1820 154, 199, 234, 193, -1, 135, 199, 234, 154, 4,
1821 -1, 116, 199, 234, 245, -1
1824 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1825 static const yytype_uint16 yyrline[] =
1827 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1828 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1829 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117,
1830 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1831 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1832 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1139, 1139,
1833 1139, 1141, 1141, 1141, 1142, 1142, 1144, 1145, 1149, 1153,
1834 1158, 1158, 1160, 1161, 1166, 1172, 1173, 1174, 1175, 1176,
1835 1180, 1181, 1182, 1186, 1187, 1188, 1189, 1193, 1194, 1195,
1836 1199, 1200, 1201, 1202, 1203, 1207, 1208, 1209, 1212, 1213,
1837 1214, 1215, 1216, 1217, 1218, 1225, 1226, 1227, 1228, 1229,
1838 1230, 1231, 1232, 1233, 1234, 1238, 1239, 1244, 1245, 1246,
1839 1247, 1248, 1249, 1252, 1253, 1258, 1259, 1266, 1267, 1273,
1840 1274, 1283, 1291, 1292, 1297, 1298, 1299, 1304, 1317, 1317,
1841 1317, 1317, 1317, 1317, 1317, 1320, 1324, 1328, 1335, 1340,
1842 1348, 1377, 1402, 1407, 1417, 1427, 1431, 1441, 1448, 1457,
1843 1464, 1469, 1474, 1481, 1482, 1489, 1496, 1504, 1510, 1522,
1844 1550, 1566, 1593, 1621, 1647, 1667, 1693, 1713, 1725, 1732,
1845 1798, 1808, 1818, 1824, 1834, 1840, 1850, 1855, 1860, 1873,
1846 1885, 1907, 1915, 1921, 1932, 1937, 1942, 1948, 1954, 1963,
1847 1967, 1975, 1975, 1978, 1978, 1981, 1993, 2014, 2019, 2027,
1848 2028, 2032, 2032, 2036, 2036, 2039, 2042, 2066, 2078, 2077,
1849 2089, 2088, 2098, 2097, 2108, 2148, 2151, 2157, 2167, 2171,
1850 2176, 2178, 2183, 2188, 2197, 2207, 2218, 2222, 2231, 2240,
1851 2245, 2374, 2374, 2376, 2385, 2385, 2387, 2392, 2404, 2408,
1852 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445, 2470,
1853 2474, 2484, 2488, 2492, 2497, 2504, 2504, 2510, 2519, 2524,
1854 2529, 2533, 2542, 2551, 2560, 2564, 2572, 2579, 2583, 2588,
1855 2598, 2617, 2626, 2711, 2715, 2722, 2733, 2746, 2756, 2767,
1856 2777, 2788, 2796, 2806, 2813, 2816, 2817, 2824, 2828, 2833,
1857 2849, 2866, 2880, 2894, 2906, 2914, 2921, 2927, 2933, 2939,
1858 2954, 3044, 3049, 3053, 3060, 3067, 3075, 3082, 3090, 3098,
1863 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1864 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1865 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1866 static const char *const yytname[] =
1868 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1869 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1870 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1871 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1872 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1873 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1874 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1875 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1876 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1877 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1878 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1879 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1880 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1881 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1882 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1883 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1884 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1885 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1886 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1887 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
1888 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1889 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1890 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1891 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1892 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1893 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1894 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1895 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1896 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1897 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1898 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1899 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1900 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1901 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1902 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1903 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1904 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1905 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1906 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1907 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1908 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1909 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1910 "InstVal", "OptVolatile", "MemoryInst", 0
1915 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1917 static const yytype_uint16 yytoknum[] =
1919 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1920 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1921 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1922 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1923 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1924 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1925 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1926 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1927 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1928 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1929 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1930 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1931 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1932 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1933 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1934 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1935 60, 62, 123, 125, 99
1939 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1940 static const yytype_uint8 yyr1[] =
1942 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1943 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1944 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
1945 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1946 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1947 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1948 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1949 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1950 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1951 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1952 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
1953 187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
1954 189, 189, 189, 190, 190, 191, 191, 192, 192, 193,
1955 193, 194, 195, 195, 196, 196, 197, 197, 198, 198,
1956 198, 198, 198, 198, 198, 199, 199, 199, 199, 199,
1957 199, 199, 199, 199, 199, 199, 199, 199, 200, 201,
1958 201, 202, 202, 203, 203, 203, 203, 204, 204, 205,
1959 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
1960 205, 205, 205, 205, 205, 205, 205, 205, 205, 206,
1961 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1962 207, 208, 208, 209, 209, 210, 210, 211, 211, 212,
1963 212, 214, 213, 215, 213, 213, 213, 213, 216, 213,
1964 217, 213, 218, 213, 213, 213, 213, 219, 220, 220,
1965 221, 222, 222, 222, 223, 223, 224, 224, 224, 224,
1966 225, 226, 226, 227, 228, 228, 229, 230, 231, 231,
1967 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1968 232, 233, 233, 233, 233, 234, 234, 235, 236, 236,
1969 237, 237, 238, 239, 239, 239, 240, 240, 240, 240,
1970 240, 240, 240, 240, 240, 241, 241, 242, 243, 243,
1971 244, 244, 244, 244, 244, 245, 245, 246, 246, 247,
1972 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
1973 247, 247, 248, 248, 249, 249, 249, 249, 249, 249,
1977 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1978 static const yytype_uint8 yyr2[] =
1980 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1981 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1982 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1983 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1986 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1987 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1988 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1989 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1990 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1992 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1993 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1994 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
1995 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
1996 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
1997 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
1998 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
1999 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2000 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2001 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2002 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2003 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2004 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2005 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2006 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2007 2, 2, 3, 2, 0, 1, 2, 2, 3, 9,
2008 9, 8, 14, 1, 1, 6, 5, 2, 6, 7,
2009 4, 4, 6, 6, 0, 0, 3, 2, 1, 5,
2010 5, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2011 8, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2015 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2016 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2017 means the default is an error. */
2018 static const yytype_uint16 yydefact[] =
2020 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2021 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2022 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
2023 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2024 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
2025 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
2026 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2027 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2028 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
2029 275, 271, 69, 244, 245, 246, 270, 228, 229, 232,
2030 0, 166, 149, 0, 0, 0, 0, 155, 167, 0,
2031 0, 166, 0, 0, 0, 97, 96, 0, 201, 202,
2032 0, 0, 99, 100, 101, 102, 103, 0, 247, 0,
2033 313, 273, 0, 230, 165, 115, 161, 163, 0, 0,
2034 0, 0, 0, 0, 154, 0, 0, 147, 0, 0,
2035 160, 0, 159, 0, 224, 138, 139, 140, 143, 142,
2036 141, 0, 0, 67, 67, 104, 0, 241, 242, 243,
2037 312, 298, 0, 0, 0, 0, 98, 283, 284, 2,
2038 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2039 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2040 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2041 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
2042 0, 0, 272, 98, 287, 0, 311, 231, 158, 0,
2043 123, 67, 67, 157, 0, 168, 0, 123, 67, 67,
2044 0, 205, 186, 187, 182, 184, 183, 185, 188, 181,
2045 177, 178, 0, 0, 0, 0, 0, 0, 0, 0,
2046 0, 0, 0, 0, 0, 0, 180, 179, 218, 0,
2047 297, 277, 67, 268, 276, 0, 0, 55, 0, 0,
2048 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2049 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2050 42, 43, 44, 45, 46, 47, 48, 0, 129, 129,
2051 318, 67, 67, 309, 0, 0, 0, 0, 0, 67,
2052 67, 67, 0, 0, 0, 0, 0, 106, 108, 107,
2053 105, 109, 110, 111, 112, 113, 116, 164, 162, 151,
2054 152, 153, 156, 66, 150, 220, 222, 0, 0, 0,
2055 0, 0, 0, 0, 0, 170, 200, 0, 0, 0,
2056 174, 0, 171, 0, 0, 0, 134, 239, 250, 251,
2057 252, 257, 253, 254, 255, 256, 248, 0, 259, 266,
2058 265, 267, 0, 0, 278, 0, 0, 67, 67, 0,
2059 314, 0, 316, 295, 0, 0, 0, 0, 0, 0,
2060 0, 0, 0, 0, 0, 0, 67, 0, 114, 120,
2061 119, 117, 118, 121, 122, 124, 134, 134, 0, 0,
2062 0, 295, 0, 0, 0, 0, 0, 169, 155, 167,
2063 0, 172, 173, 0, 0, 0, 0, 219, 238, 115,
2064 236, 0, 249, 0, 0, 269, 0, 0, 0, 0,
2065 0, 0, 0, 0, 322, 0, 0, 0, 305, 306,
2066 0, 0, 0, 0, 0, 303, 0, 129, 0, 221,
2067 223, 67, 0, 0, 0, 0, 0, 0, 0, 199,
2068 176, 0, 0, 0, 0, 0, 0, 136, 134, 65,
2069 0, 123, 0, 258, 0, 0, 294, 0, 0, 129,
2070 130, 129, 0, 0, 0, 0, 0, 0, 321, 299,
2071 300, 294, 0, 319, 67, 206, 0, 0, 190, 0,
2072 0, 0, 0, 175, 0, 0, 67, 131, 137, 135,
2073 64, 235, 237, 115, 132, 0, 0, 0, 115, 115,
2074 0, 301, 302, 315, 317, 296, 0, 0, 304, 307,
2075 308, 0, 129, 0, 0, 0, 196, 0, 0, 192,
2076 193, 189, 65, 133, 127, 260, 0, 0, 0, 0,
2077 123, 0, 288, 0, 123, 320, 194, 195, 0, 0,
2078 0, 234, 0, 125, 0, 281, 0, 0, 106, 108,
2079 115, 115, 0, 115, 115, 289, 310, 191, 197, 198,
2080 128, 0, 240, 279, 0, 280, 0, 291, 290, 0,
2081 0, 0, 126, 0, 0, 0, 115, 115, 0, 0,
2082 0, 293, 292, 286, 0, 0, 285, 0, 282
2085 /* YYDEFGOTO[NTERM-NUM]. */
2086 static const yytype_int16 yydefgoto[] =
2088 -1, 263, 264, 265, 290, 307, 161, 162, 78, 531,
2089 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2090 117, 127, 336, 228, 415, 339, 602, 583, 390, 487,
2091 564, 437, 488, 80, 163, 136, 153, 137, 138, 109,
2092 356, 378, 357, 120, 87, 154, 16, 17, 18, 20,
2093 19, 366, 416, 417, 62, 23, 60, 100, 440, 441,
2094 128, 169, 54, 95, 55, 48, 443, 379, 82, 381,
2095 273, 274, 56, 91, 92, 222, 587, 131, 313, 540,
2096 454, 223, 224, 225, 226
2099 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2101 #define YYPACT_NINF -561
2102 static const yytype_int16 yypact[] =
2104 284, -561, -561, -561, -561, -561, -561, -561, -34, -121,
2105 14, -63, 101, -22, 17, -561, 127, 883, -561, 22,
2106 162, 10, 23, -561, 12, 158, -561, 1464, -561, -561,
2107 -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2108 -46, -46, 176, -561, -561, -561, -561, -46, -561, -561,
2109 -561, -561, -561, -46, 200, -561, -10, 209, 219, 234,
2110 -561, -561, -561, -561, -561, 124, -561, -561, -561, -561,
2111 -561, -561, -561, -561, 272, 275, 2, 126, -561, -561,
2112 -561, 28, -561, 243, 243, 196, -561, 165, 33, 33,
2113 -561, -561, 215, -561, -561, -561, -561, -561, -561, -561,
2114 -73, 1059, -561, 129, 132, 506, 124, -561, 28, -111,
2115 134, 1059, 137, 165, 165, -561, -561, 1014, -561, -561,
2116 1504, 292, -561, -561, -561, -561, -561, 1562, -561, -6,
2117 1843, -561, 278, -561, -561, 28, -561, 147, 153, 1620,
2118 1620, 148, -110, 1620, -561, 309, 164, -561, 1504, 1620,
2119 124, 166, 28, 388, -561, 342, 310, 311, 314, 316,
2120 317, 156, 322, 1115, 279, -561, 16, -561, -561, -561,
2121 -561, -561, 281, 1660, 20, 327, 33, -561, -561, -561,
2122 -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2123 -561, -561, -561, -561, 511, 787, 1620, 1620, 1620, 1620,
2124 -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2125 -561, -561, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620,
2126 1620, 1620, -561, 33, -561, -60, -561, -561, 434, 1345,
2127 -561, -7, -33, -561, 181, 28, 192, -561, 279, -16,
2128 1014, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2129 -561, -561, 511, 787, 198, 199, 201, 203, 204, 1385,
2130 1678, 609, 329, 207, 208, 210, -561, -561, -561, 211,
2131 -561, 124, 702, -561, 206, 841, 841, -561, 841, 1562,
2132 -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2133 1620, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2134 -561, -561, -561, -561, -561, -561, -561, 1620, 100, 114,
2135 -561, 702, -31, 222, 225, 227, 228, 235, 239, 702,
2136 702, 702, 325, 1562, 1620, 1620, 360, -561, -561, -561,
2137 -561, -561, -561, -561, -561, -561, -561, -561, -561, -96,
2138 -561, -561, -561, -561, -96, -561, 137, 361, 247, 252,
2139 1504, 1504, 1504, 1504, 1504, -561, -561, -54, 788, -88,
2140 -561, -85, -561, 1504, 1504, 1504, 250, 1406, -561, -561,
2141 -561, -561, -561, -561, -561, -561, 345, 1504, -561, -561,
2142 -561, -561, 1620, 255, -561, 259, 841, 702, 702, 4,
2143 -561, 5, -561, -561, 841, 249, 1620, 1620, 1620, 1620,
2144 1620, 261, 262, 263, 1620, 841, 702, 266, -561, -561,
2145 -561, -561, -561, -561, -561, -561, 250, 250, 1620, 1504,
2146 1504, -561, 269, 274, 276, 277, 1504, -561, 265, 969,
2147 -83, -561, -561, 282, 283, 391, -5, -561, -561, 28,
2148 285, 289, -561, 413, -78, -561, 426, 427, 294, 293,
2149 295, 841, 442, 841, 296, 299, 841, 300, 28, -561,
2150 301, 302, 444, 841, 841, 28, 306, 305, 1620, -561,
2151 -561, -45, 307, 308, 94, 1504, 1504, 1504, 1504, -561,
2152 -561, 312, 1504, 1504, 1620, 438, 463, -561, 250, 1746,
2153 1446, -561, 315, -561, 841, 841, 1718, 841, 841, 305,
2154 -561, 305, 1620, 841, 318, 1620, 1620, 1620, -561, -561,
2155 -561, 1718, 415, -561, 702, -561, 1504, 1504, -561, 320,
2156 323, 324, 328, -561, 331, 332, -30, -561, -561, -561,
2157 -561, -561, -561, 28, 81, 455, 334, 333, 123, 28,
2158 95, -561, -561, -561, -561, -561, 335, 841, -561, -561,
2159 -561, 98, 305, 339, 343, 1504, -561, 1504, 1504, -561,
2160 -561, -561, 1746, -561, 433, -561, 479, -4, 560, 560,
2161 -561, 1736, -561, 341, -561, -561, -561, -561, 346, 349,
2162 351, -561, 500, 358, 841, -561, 1255, -1, 355, 356,
2163 -561, -561, 87, 123, 28, -561, -96, -561, -561, -561,
2164 -561, 489, -561, -561, 370, -561, 1255, 434, 434, 495,
2165 560, 560, -561, 498, 373, 841, -561, -561, 841, 514,
2166 460, 434, 434, -561, 841, 516, -561, 841, -561
2169 /* YYPGOTO[NTERM-NUM]. */
2170 static const yytype_int16 yypgoto[] =
2172 -561, 406, 407, 408, 298, 303, -173, -561, 0, -15,
2173 -150, 454, 8, -561, -561, -561, -561, 189, -561, -561,
2174 -561, -149, -561, -409, -561, -234, -561, -561, -289, 24,
2175 -561, -404, -561, -561, -26, 330, -122, -561, 443, 452,
2176 -92, -159, -226, 102, 183, 321, -561, -561, 548, -561,
2177 -561, -561, -561, -561, -561, -561, -561, -561, -561, -561,
2178 477, -561, -561, -561, -561, -561, -561, -560, -76, 46,
2179 -105, -561, -561, 519, -561, -561, -561, -561, -561, 61,
2180 160, -561, -561, -561, -561
2183 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2184 positive, shift that token. If negative, reduce the rule which
2185 number is the opposite. If zero, do what YYDEFACT says.
2186 If YYTABLE_NINF, syntax error. */
2187 #define YYTABLE_NINF -209
2188 static const yytype_int16 yytable[] =
2190 11, 81, 278, 344, 266, 166, 104, 277, 13, 110,
2191 277, 90, 469, 470, 268, 451, 453, 11, 21, 93,
2192 392, 110, 167, 110, 110, 13, 604, 279, 164, 485,
2193 489, 275, 24, 22, 359, 361, 2, 276, 110, 4,
2194 409, 410, 411, 143, 143, 412, 614, 110, 486, 413,
2195 414, 108, 144, 234, 324, 325, 238, 452, 452, 29,
2196 30, 31, 32, 33, 34, 35, 426, 36, 45, 426,
2197 46, 426, 25, 431, 323, 135, 426, 241, 432, 108,
2198 481, 132, 110, 493, 529, 135, 133, 267, 345, 346,
2199 26, 152, 11, 310, 121, 122, 123, 124, 125, 126,
2200 426, 152, 37, 38, 39, 427, 111, 515, 314, 315,
2201 316, 317, 318, 231, 232, 485, 322, 235, 111, 27,
2202 111, 111, 561, 239, 562, 609, 394, 43, 341, 568,
2203 569, 28, 430, 63, 64, 111, 106, 66, 67, 68,
2204 69, 70, 71, 72, 111, 1, 2, 272, 3, 4,
2205 5, 444, 340, 94, 110, 585, 168, 386, 605, 244,
2206 245, 246, 247, 57, 105, 37, 38, 39, 110, 59,
2207 308, 309, 272, 311, 269, 73, 58, -144, 513, 111,
2208 61, 607, 608, -67, 610, 611, 312, 272, 272, 272,
2209 272, 272, 319, 320, 321, 272, 380, 118, 119, 380,
2210 380, 405, 380, 135, 49, 50, 51, 621, 622, 52,
2211 543, 85, 544, 86, 152, 148, 149, 409, 410, 411,
2212 407, 90, 412, 409, 410, 411, 413, 414, 412, 83,
2213 84, 97, 413, 414, 1, 380, 88, 3, 115, 5,
2214 116, 98, 89, 380, 380, 380, 518, 570, 502, 571,
2215 574, 111, 571, 152, 389, -67, 99, 534, 421, 422,
2216 423, 424, 425, 575, 387, 111, 113, 114, 391, -67,
2217 266, 433, 434, 435, -144, 101, 102, 445, -144, 103,
2218 86, 388, 74, 75, -208, 145, 76, 139, 77, 107,
2219 140, 457, 147, 459, 460, 461, 165, 152, 406, 272,
2220 227, 229, -69, 1, 2, 230, 3, 4, 5, 233,
2221 380, 380, 380, 236, 6, 7, 237, 240, 380, -56,
2222 -57, 383, 384, -60, 385, -59, -58, 472, 473, 380,
2223 380, 248, 429, 110, 479, 8, 592, 270, 277, 9,
2224 596, 439, 342, 10, 343, -55, -55, -55, -55, 350,
2225 351, 362, 352, 267, 353, 354, 272, 393, 363, 364,
2226 382, 365, 367, 404, 408, 401, 402, 403, 242, 243,
2227 272, 458, 272, 272, 272, 380, 395, 380, 465, 396,
2228 380, 397, 398, 519, 520, 521, 522, 380, 380, 399,
2229 524, 525, 471, 400, 586, 63, 64, 545, 419, 418,
2230 548, 549, 550, 420, 436, 442, 456, 1, 2, 446,
2231 3, 4, 5, 447, 606, 462, 463, 464, 380, 380,
2232 468, 380, 380, 475, 553, 554, 480, 380, 476, 484,
2233 477, 478, 448, 449, 450, 492, 482, 483, 380, 490,
2234 455, 491, 514, 494, 495, 496, 500, 497, 508, 498,
2235 502, 466, 467, 503, 505, 506, 507, 511, 526, 512,
2236 527, 516, 517, 578, 533, 579, 580, 528, 452, 535,
2237 539, 380, 547, 523, 555, 556, 272, 565, 557, 272,
2238 272, 272, 558, 559, 560, 539, 582, 326, 566, 530,
2239 567, 576, 380, 380, 572, 577, 584, 499, 597, 501,
2240 595, 598, 504, 599, 600, 601, -18, -19, 380, 509,
2241 510, 612, 615, 63, 64, 618, 106, 66, 67, 68,
2242 69, 70, 71, 72, 613, 1, 2, 619, 3, 4,
2243 5, 624, 625, 627, 380, 380, 219, 220, 221, 380,
2244 536, 537, 380, 541, 542, 594, 130, 581, 380, 546,
2245 348, 380, 327, 328, 146, 73, 349, 142, 563, 338,
2246 552, 347, 530, 368, 369, 44, 129, 63, 64, 370,
2247 329, 330, 551, 331, 332, 96, 333, 334, 335, 1,
2248 2, 474, 3, 4, 5, 371, 372, 373, 0, 0,
2249 0, 0, 0, 573, 0, 0, 0, 0, 0, 0,
2250 374, 375, 280, 281, 282, 283, 284, 285, 286, 287,
2251 288, 289, 0, 326, 590, 591, 63, 64, 376, 106,
2252 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2253 603, 3, 4, 5, 179, 180, 181, 182, 183, 184,
2254 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2255 253, 0, 0, 0, 0, 0, 616, 617, 73, 0,
2256 0, 620, 74, 75, 623, 0, 76, 0, 77, 141,
2257 626, 0, 0, 628, 0, 0, 254, 200, 588, 589,
2258 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
2259 255, 0, 256, 257, 258, 0, 329, 330, 0, 331,
2260 332, 0, 333, 334, 335, 368, 369, 0, 0, 63,
2261 64, 370, 0, 0, 0, 0, 0, 0, 0, 0,
2262 377, 1, 2, 0, 3, 4, 5, 371, 372, 373,
2263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2264 0, 0, 374, 375, 0, 0, 0, 0, 0, 0,
2265 0, 0, 0, 0, 0, 0, 110, 0, 0, 0,
2266 376, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2267 0, 77, 360, 0, 0, 0, 179, 180, 181, 182,
2268 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2269 193, 252, 253, 0, 0, 63, 64, 0, 106, 155,
2270 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
2271 3, 4, 5, 291, 292, 0, 0, 0, 254, 200,
2272 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2273 211, 0, 255, 0, 256, 257, 258, 73, 0, 0,
2274 0, 0, 0, 0, 368, 369, 0, 0, 63, 64,
2275 370, 0, 0, 111, 0, 0, 0, 0, 0, 0,
2276 1, 2, 377, 3, 4, 5, 371, 372, 373, 0,
2277 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2278 0, 374, 375, -207, 293, 294, 295, 296, 297, 298,
2279 299, 300, 301, 302, 303, 304, 305, 306, 0, 376,
2280 0, -69, 1, 2, 0, 3, 4, 5, 0, 0,
2281 0, 0, 0, 6, 7, 179, 180, 181, 182, 183,
2282 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2283 252, 253, 0, 0, 8, 0, 0, 0, 9, 0,
2284 0, 0, 10, 0, 74, 75, 0, 0, 76, 0,
2285 77, 428, 0, 0, 0, 0, 0, 254, 200, 201,
2286 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2287 0, 255, 0, 256, 257, 258, 63, 64, 0, 0,
2288 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2289 0, 3, 4, 5, 249, 0, 0, 0, 0, 0,
2290 0, 377, 0, 0, 0, 0, 0, 0, 0, 250,
2291 251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2292 0, 63, 64, 110, 150, 66, 67, 68, 69, 70,
2293 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2294 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2295 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2296 0, 0, 0, 73, 0, 0, 63, 64, 0, 106,
2297 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2298 0, 3, 4, 5, 0, 254, 200, 201, 202, 203,
2299 204, 205, 206, 207, 208, 209, 210, 211, 134, 255,
2300 0, 256, 257, 258, 0, 0, 0, 0, 73, 0,
2301 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2302 111, 0, 63, 64, -67, 0, 259, 0, 0, 260,
2303 0, 261, 0, 262, 1, 2, 151, 3, 4, 5,
2304 249, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2305 0, 0, 0, 0, 0, 250, 251, 0, 0, 0,
2306 0, 0, 0, 0, 0, 0, 0, 0, 0, 110,
2307 74, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2308 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2309 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2310 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2311 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2312 0, 77, 0, 0, 0, 0, 0, 0, 0, 0,
2313 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2314 208, 209, 210, 211, 0, 255, 0, 256, 257, 258,
2315 0, 0, 0, 0, 0, 0, 0, 0, 368, 369,
2316 0, 0, 0, 0, 370, 0, 111, 0, 0, 0,
2317 0, 0, 259, 0, 0, 260, 0, 261, 0, 262,
2318 371, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 0, 0, 0, 374, 375, 0, 0, 0,
2320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2321 0, 0, 0, 376, 0, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
2323 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2324 190, 191, 192, 193, 252, 253, 0, 0, 0, 0,
2325 0, 0, 63, 64, 0, 106, 66, 67, 68, 69,
2326 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2327 0, 254, 200, 201, 202, 203, 204, 205, 206, 207,
2328 208, 209, 210, 211, 337, 255, 0, 256, 257, 258,
2329 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2330 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2331 0, 0, 0, 63, 64, 377, 106, 66, 67, 68,
2332 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2333 5, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 438, 0, 0, 0, 0,
2335 0, 0, 0, 63, 64, 73, 106, 66, 67, 68,
2336 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2337 5, 63, 64, 0, 65, 66, 67, 68, 69, 70,
2338 71, 72, 0, 1, 2, 532, 3, 4, 5, 0,
2339 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2340 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2341 0, 63, 64, 73, 106, 155, 156, 157, 158, 159,
2342 160, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2344 0, 74, 75, 0, 355, 76, 0, 77, 0, 0,
2345 0, 0, 0, 73, 0, 0, 0, 0, 0, 0,
2346 0, 0, 74, 75, 0, 0, 76, 0, 77, 63,
2347 64, 0, 150, 66, 67, 68, 69, 70, 71, 72,
2348 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2350 0, 0, 74, 75, 0, 0, 76, 0, 77, 0,
2351 0, 73, 0, 0, 0, 0, 0, 0, 0, 0,
2352 74, 75, 0, 0, 76, 0, 77, 63, 64, 0,
2353 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2354 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2355 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2356 74, 75, 0, 0, 76, 0, 77, 63, 64, 73,
2357 271, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2358 2, 0, 3, 4, 5, 63, 64, 0, 106, 155,
2359 156, 157, 158, 159, 160, 72, 0, 1, 2, 0,
2360 3, 4, 5, 0, 0, 0, 0, 0, 0, 73,
2361 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
2362 0, 0, 76, 0, 77, 63, 64, 73, 106, 66,
2363 67, 68, 69, 70, 71, 538, 0, 1, 2, 0,
2364 3, 4, 5, 63, 64, 0, 106, 66, 67, 68,
2365 69, 70, 71, 593, 0, 1, 2, 0, 3, 4,
2366 5, 0, 0, 0, 0, 1, 0, 73, 3, 0,
2367 5, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2368 76, 0, 77, 0, 0, 73, 0, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 0, 0, 326,
2370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2371 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2372 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
2373 0, 0, 0, 0, 74, 75, 0, 0, 76, 0,
2374 358, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 327, 328, 0, 0, 0, 0,
2377 0, 0, 0, 0, 74, 75, 0, 0, 76, 170,
2378 77, 0, 329, 330, 0, 331, 332, 0, 333, 334,
2379 335, 0, 74, 75, 0, 0, 76, 0, 77, 171,
2380 172, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2381 0, 173, 174, 175, 176, 177, 178, 179, 180, 181,
2382 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2383 192, 193, 194, 195, 0, 0, 0, 0, 0, 0,
2384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2385 0, 0, 0, 0, 196, 197, 198, 0, 0, 199,
2386 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2387 210, 211, 212, 213, 214, 215, 216, 217, 218
2390 static const yytype_int16 yycheck[] =
2392 0, 27, 175, 237, 163, 127, 4, 11, 0, 54,
2393 11, 21, 416, 417, 164, 11, 11, 17, 52, 29,
2394 309, 54, 28, 54, 54, 17, 586, 176, 120, 34,
2395 439, 11, 153, 67, 260, 261, 20, 17, 54, 23,
2396 136, 137, 138, 154, 154, 141, 606, 54, 53, 145,
2397 146, 77, 163, 163, 114, 115, 148, 53, 53, 42,
2398 43, 44, 45, 46, 47, 48, 154, 50, 46, 154,
2399 48, 154, 58, 161, 223, 101, 154, 153, 163, 105,
2400 163, 154, 54, 161, 488, 111, 159, 163, 238, 239,
2401 153, 117, 92, 198, 61, 62, 63, 64, 65, 66,
2402 154, 127, 148, 149, 150, 159, 151, 152, 213, 214,
2403 215, 216, 217, 139, 140, 34, 221, 143, 151, 18,
2404 151, 151, 152, 149, 533, 38, 157, 0, 161, 538,
2405 539, 153, 358, 7, 8, 151, 10, 11, 12, 13,
2406 14, 15, 16, 17, 151, 19, 20, 173, 22, 23,
2407 24, 377, 159, 163, 54, 159, 162, 279, 159, 3,
2408 4, 5, 6, 153, 162, 148, 149, 150, 54, 157,
2409 196, 197, 198, 199, 166, 49, 153, 54, 467, 151,
2410 22, 590, 591, 155, 593, 594, 212, 213, 214, 215,
2411 216, 217, 218, 219, 220, 221, 272, 32, 33, 275,
2412 276, 323, 278, 229, 42, 43, 44, 616, 617, 47,
2413 499, 35, 501, 37, 240, 113, 114, 136, 137, 138,
2414 325, 21, 141, 136, 137, 138, 145, 146, 141, 40,
2415 41, 22, 145, 146, 19, 311, 47, 22, 42, 24,
2416 44, 22, 53, 319, 320, 321, 152, 152, 154, 154,
2417 152, 151, 154, 279, 154, 155, 22, 491, 350, 351,
2418 352, 353, 354, 552, 290, 151, 83, 84, 154, 155,
2419 429, 363, 364, 365, 151, 151, 4, 382, 155, 4,
2420 37, 307, 156, 157, 0, 151, 160, 158, 162, 163,
2421 158, 396, 155, 398, 399, 400, 4, 323, 324, 325,
2422 22, 154, 18, 19, 20, 152, 22, 23, 24, 161,
2423 386, 387, 388, 4, 30, 31, 152, 151, 394, 9,
2424 9, 275, 276, 9, 278, 9, 9, 419, 420, 405,
2425 406, 9, 358, 54, 426, 51, 570, 56, 11, 55,
2426 574, 367, 161, 59, 152, 3, 4, 5, 6, 151,
2427 151, 22, 151, 429, 151, 151, 382, 311, 151, 151,
2428 154, 151, 151, 38, 4, 319, 320, 321, 26, 27,
2429 396, 397, 398, 399, 400, 451, 154, 453, 404, 154,
2430 456, 154, 154, 475, 476, 477, 478, 463, 464, 154,
2431 482, 483, 418, 154, 567, 7, 8, 502, 151, 38,
2432 505, 506, 507, 151, 154, 60, 157, 19, 20, 154,
2433 22, 23, 24, 154, 587, 154, 154, 154, 494, 495,
2434 154, 497, 498, 154, 516, 517, 161, 503, 154, 38,
2435 154, 154, 386, 387, 388, 22, 154, 154, 514, 154,
2436 394, 152, 468, 17, 17, 151, 4, 154, 4, 154,
2437 154, 405, 406, 154, 154, 154, 154, 151, 484, 154,
2438 22, 154, 154, 555, 490, 557, 558, 4, 53, 154,
2439 496, 547, 154, 161, 154, 152, 502, 22, 154, 505,
2440 506, 507, 154, 152, 152, 511, 53, 53, 154, 489,
2441 157, 152, 568, 569, 159, 152, 17, 451, 152, 453,
2442 159, 152, 456, 152, 4, 147, 151, 151, 584, 463,
2443 464, 22, 17, 7, 8, 17, 10, 11, 12, 13,
2444 14, 15, 16, 17, 154, 19, 20, 154, 22, 23,
2445 24, 17, 72, 17, 610, 611, 130, 130, 130, 615,
2446 494, 495, 618, 497, 498, 571, 92, 562, 624, 503,
2447 252, 627, 118, 119, 111, 49, 253, 105, 534, 229,
2448 514, 240, 562, 3, 4, 17, 89, 7, 8, 9,
2449 136, 137, 511, 139, 140, 56, 142, 143, 144, 19,
2450 20, 421, 22, 23, 24, 25, 26, 27, -1, -1,
2451 -1, -1, -1, 547, -1, -1, -1, -1, -1, -1,
2452 40, 41, 91, 92, 93, 94, 95, 96, 97, 98,
2453 99, 100, -1, 53, 568, 569, 7, 8, 58, 10,
2454 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2455 584, 22, 23, 24, 74, 75, 76, 77, 78, 79,
2456 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2457 90, -1, -1, -1, -1, -1, 610, 611, 49, -1,
2458 -1, 615, 156, 157, 618, -1, 160, -1, 162, 163,
2459 624, -1, -1, 627, -1, -1, 116, 117, 118, 119,
2460 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
2461 130, -1, 132, 133, 134, -1, 136, 137, -1, 139,
2462 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
2463 8, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2464 160, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2465 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2466 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2467 -1, -1, -1, -1, -1, -1, 54, -1, -1, -1,
2468 58, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2469 -1, 162, 163, -1, -1, -1, 74, 75, 76, 77,
2470 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2471 88, 89, 90, -1, -1, 7, 8, -1, 10, 11,
2472 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2473 22, 23, 24, 26, 27, -1, -1, -1, 116, 117,
2474 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2475 128, -1, 130, -1, 132, 133, 134, 49, -1, -1,
2476 -1, -1, -1, -1, 3, 4, -1, -1, 7, 8,
2477 9, -1, -1, 151, -1, -1, -1, -1, -1, -1,
2478 19, 20, 160, 22, 23, 24, 25, 26, 27, -1,
2479 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2480 -1, 40, 41, 0, 97, 98, 99, 100, 101, 102,
2481 103, 104, 105, 106, 107, 108, 109, 110, -1, 58,
2482 -1, 18, 19, 20, -1, 22, 23, 24, -1, -1,
2483 -1, -1, -1, 30, 31, 74, 75, 76, 77, 78,
2484 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2485 89, 90, -1, -1, 51, -1, -1, -1, 55, -1,
2486 -1, -1, 59, -1, 156, 157, -1, -1, 160, -1,
2487 162, 163, -1, -1, -1, -1, -1, 116, 117, 118,
2488 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2489 -1, 130, -1, 132, 133, 134, 7, 8, -1, -1,
2490 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2491 -1, 22, 23, 24, 25, -1, -1, -1, -1, -1,
2492 -1, 160, -1, -1, -1, -1, -1, -1, -1, 40,
2493 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2494 -1, 7, 8, 54, 10, 11, 12, 13, 14, 15,
2495 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2496 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2497 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2498 -1, -1, -1, 49, -1, -1, 7, 8, -1, 10,
2499 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2500 -1, 22, 23, 24, -1, 116, 117, 118, 119, 120,
2501 121, 122, 123, 124, 125, 126, 127, 128, 39, 130,
2502 -1, 132, 133, 134, -1, -1, -1, -1, 49, -1,
2503 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2504 151, -1, 7, 8, 155, -1, 157, -1, -1, 160,
2505 -1, 162, -1, 164, 19, 20, 122, 22, 23, 24,
2506 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2507 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2508 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2509 156, 157, -1, -1, 160, -1, 162, -1, -1, -1,
2510 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2511 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2512 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2513 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2514 -1, 162, -1, -1, -1, -1, -1, -1, -1, -1,
2515 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2516 125, 126, 127, 128, -1, 130, -1, 132, 133, 134,
2517 -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2518 -1, -1, -1, -1, 9, -1, 151, -1, -1, -1,
2519 -1, -1, 157, -1, -1, 160, -1, 162, -1, 164,
2520 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2521 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2522 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2523 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1,
2524 -1, -1, -1, -1, -1, -1, -1, -1, -1, 74,
2525 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2526 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2527 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2528 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2529 -1, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2530 125, 126, 127, 128, 39, 130, -1, 132, 133, 134,
2531 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2532 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2533 -1, -1, -1, 7, 8, 160, 10, 11, 12, 13,
2534 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2535 24, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2536 -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
2537 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
2538 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2539 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2540 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
2541 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2542 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2543 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2544 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2545 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2546 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2547 -1, -1, -1, 49, -1, -1, -1, -1, -1, -1,
2548 -1, -1, 156, 157, -1, -1, 160, -1, 162, 7,
2549 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2550 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2551 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2552 -1, -1, 156, 157, -1, -1, 160, -1, 162, -1,
2553 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
2554 156, 157, -1, -1, 160, -1, 162, 7, 8, -1,
2555 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2556 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2557 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2558 156, 157, -1, -1, 160, -1, 162, 7, 8, 49,
2559 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2560 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2561 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2562 22, 23, 24, -1, -1, -1, -1, -1, -1, 49,
2563 -1, -1, -1, -1, -1, -1, -1, -1, 156, 157,
2564 -1, -1, 160, -1, 162, 7, 8, 49, 10, 11,
2565 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2566 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
2567 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2568 24, -1, -1, -1, -1, 19, -1, 49, 22, -1,
2569 24, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2570 160, -1, 162, -1, -1, 49, -1, -1, -1, -1,
2571 -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
2572 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2573 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2574 160, -1, 162, -1, -1, -1, -1, -1, -1, -1,
2575 -1, -1, -1, -1, 156, 157, -1, -1, 160, -1,
2576 162, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2577 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2578 -1, -1, -1, -1, 118, 119, -1, -1, -1, -1,
2579 -1, -1, -1, -1, 156, 157, -1, -1, 160, 36,
2580 162, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2581 144, -1, 156, 157, -1, -1, 160, -1, 162, 56,
2582 57, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2583 -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2584 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2585 87, 88, 89, 90, -1, -1, -1, -1, -1, -1,
2586 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2587 -1, -1, -1, -1, 111, 112, 113, -1, -1, 116,
2588 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2589 127, 128, 129, 130, 131, 132, 133, 134, 135
2592 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2593 symbol of state STATE-NUM. */
2594 static const yytype_uint8 yystos[] =
2596 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2597 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2598 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2599 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2600 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
2601 43, 44, 47, 184, 227, 229, 237, 153, 153, 157,
2602 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2603 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2604 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
2605 21, 238, 239, 29, 163, 228, 238, 22, 22, 22,
2606 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2607 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2608 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
2609 176, 242, 154, 159, 39, 199, 200, 202, 203, 158,
2610 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2611 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2612 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
2613 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2614 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2615 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2616 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2617 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
2618 167, 168, 240, 246, 247, 248, 249, 22, 188, 154,
2619 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2620 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2621 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2622 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
2623 56, 10, 199, 235, 236, 11, 17, 11, 171, 186,
2624 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2625 169, 26, 27, 97, 98, 99, 100, 101, 102, 103,
2626 104, 105, 106, 107, 108, 109, 110, 170, 199, 199,
2627 235, 199, 199, 243, 235, 235, 235, 235, 235, 199,
2628 199, 199, 235, 186, 114, 115, 53, 118, 119, 136,
2629 137, 139, 140, 142, 143, 144, 187, 39, 200, 190,
2630 159, 161, 161, 152, 190, 175, 175, 210, 169, 170,
2631 151, 151, 151, 151, 151, 159, 205, 207, 162, 207,
2632 163, 207, 22, 151, 151, 151, 216, 151, 3, 4,
2633 9, 25, 26, 27, 40, 41, 58, 160, 206, 232,
2634 233, 234, 154, 234, 234, 234, 201, 199, 199, 154,
2635 193, 154, 193, 234, 157, 154, 154, 154, 154, 154,
2636 154, 234, 234, 234, 38, 201, 199, 235, 4, 136,
2637 137, 138, 141, 145, 146, 189, 217, 218, 38, 151,
2638 151, 205, 205, 205, 205, 205, 154, 159, 163, 199,
2639 207, 161, 163, 205, 205, 205, 154, 196, 39, 199,
2640 223, 224, 60, 231, 207, 235, 154, 154, 234, 234,
2641 234, 11, 53, 11, 245, 234, 157, 235, 199, 235,
2642 235, 235, 154, 154, 154, 199, 234, 234, 154, 196,
2643 196, 199, 205, 205, 245, 154, 154, 154, 154, 205,
2644 161, 163, 154, 154, 38, 34, 53, 194, 197, 188,
2645 154, 152, 22, 161, 17, 17, 151, 154, 154, 234,
2646 4, 234, 154, 154, 234, 154, 154, 154, 4, 234,
2647 234, 151, 154, 193, 199, 152, 154, 154, 152, 205,
2648 205, 205, 205, 161, 205, 205, 199, 22, 4, 196,
2649 173, 174, 39, 199, 190, 154, 234, 234, 17, 199,
2650 244, 234, 234, 193, 193, 235, 234, 154, 235, 235,
2651 235, 244, 234, 205, 205, 154, 152, 154, 154, 152,
2652 152, 152, 188, 194, 195, 22, 154, 157, 188, 188,
2653 152, 154, 159, 234, 152, 193, 152, 152, 205, 205,
2654 205, 174, 53, 192, 17, 159, 171, 241, 118, 119,
2655 234, 234, 190, 17, 199, 159, 190, 152, 152, 152,
2656 4, 147, 191, 234, 232, 159, 171, 188, 188, 38,
2657 188, 188, 22, 154, 232, 17, 234, 234, 17, 154,
2658 234, 188, 188, 234, 17, 72, 234, 17, 234
2661 #define yyerrok (yyerrstatus = 0)
2662 #define yyclearin (yychar = YYEMPTY)
2663 #define YYEMPTY (-2)
2666 #define YYACCEPT goto yyacceptlab
2667 #define YYABORT goto yyabortlab
2668 #define YYERROR goto yyerrorlab
2671 /* Like YYERROR except do call yyerror. This remains here temporarily
2672 to ease the transition to the new meaning of YYERROR, for GCC.
2673 Once GCC version 2 has supplanted version 1, this can go. */
2675 #define YYFAIL goto yyerrlab
2677 #define YYRECOVERING() (!!yyerrstatus)
2679 #define YYBACKUP(Token, Value) \
2681 if (yychar == YYEMPTY && yylen == 1) \
2685 yytoken = YYTRANSLATE (yychar); \
2691 yyerror (YY_("syntax error: cannot back up")); \
2698 #define YYERRCODE 256
2701 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2702 If N is 0, then set CURRENT to the empty location which ends
2703 the previous symbol: RHS[0] (always defined). */
2705 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2706 #ifndef YYLLOC_DEFAULT
2707 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2711 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2712 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2713 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2714 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2718 (Current).first_line = (Current).last_line = \
2719 YYRHSLOC (Rhs, 0).last_line; \
2720 (Current).first_column = (Current).last_column = \
2721 YYRHSLOC (Rhs, 0).last_column; \
2727 /* YY_LOCATION_PRINT -- Print the location on the stream.
2728 This macro was not mandated originally: define only if we know
2729 we won't break user code: when these are the locations we know. */
2731 #ifndef YY_LOCATION_PRINT
2732 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2733 # define YY_LOCATION_PRINT(File, Loc) \
2734 fprintf (File, "%d.%d-%d.%d", \
2735 (Loc).first_line, (Loc).first_column, \
2736 (Loc).last_line, (Loc).last_column)
2738 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2743 /* YYLEX -- calling `yylex' with the right arguments. */
2746 # define YYLEX yylex (YYLEX_PARAM)
2748 # define YYLEX yylex ()
2751 /* Enable debugging if requested. */
2755 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2756 # define YYFPRINTF fprintf
2759 # define YYDPRINTF(Args) \
2765 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2769 YYFPRINTF (stderr, "%s ", Title); \
2770 yy_symbol_print (stderr, \
2772 YYFPRINTF (stderr, "\n"); \
2777 /*--------------------------------.
2778 | Print this symbol on YYOUTPUT. |
2779 `--------------------------------*/
2782 #if (defined __STDC__ || defined __C99__FUNC__ \
2783 || defined __cplusplus || defined _MSC_VER)
2785 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2788 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2791 YYSTYPE const * const yyvaluep;
2797 if (yytype < YYNTOKENS)
2798 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2810 /*--------------------------------.
2811 | Print this symbol on YYOUTPUT. |
2812 `--------------------------------*/
2814 #if (defined __STDC__ || defined __C99__FUNC__ \
2815 || defined __cplusplus || defined _MSC_VER)
2817 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2820 yy_symbol_print (yyoutput, yytype, yyvaluep)
2823 YYSTYPE const * const yyvaluep;
2826 if (yytype < YYNTOKENS)
2827 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2829 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2831 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2832 YYFPRINTF (yyoutput, ")");
2835 /*------------------------------------------------------------------.
2836 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2838 `------------------------------------------------------------------*/
2840 #if (defined __STDC__ || defined __C99__FUNC__ \
2841 || defined __cplusplus || defined _MSC_VER)
2843 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2846 yy_stack_print (bottom, top)
2847 yytype_int16 *bottom;
2851 YYFPRINTF (stderr, "Stack now");
2852 for (; bottom <= top; ++bottom)
2853 YYFPRINTF (stderr, " %d", *bottom);
2854 YYFPRINTF (stderr, "\n");
2857 # define YY_STACK_PRINT(Bottom, Top) \
2860 yy_stack_print ((Bottom), (Top)); \
2864 /*------------------------------------------------.
2865 | Report that the YYRULE is going to be reduced. |
2866 `------------------------------------------------*/
2868 #if (defined __STDC__ || defined __C99__FUNC__ \
2869 || defined __cplusplus || defined _MSC_VER)
2871 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2874 yy_reduce_print (yyvsp, yyrule)
2879 int yynrhs = yyr2[yyrule];
2881 unsigned long int yylno = yyrline[yyrule];
2882 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2884 /* The symbols being reduced. */
2885 for (yyi = 0; yyi < yynrhs; yyi++)
2887 fprintf (stderr, " $%d = ", yyi + 1);
2888 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2889 &(yyvsp[(yyi + 1) - (yynrhs)])
2891 fprintf (stderr, "\n");
2895 # define YY_REDUCE_PRINT(Rule) \
2898 yy_reduce_print (yyvsp, Rule); \
2901 /* Nonzero means print parse trace. It is left uninitialized so that
2902 multiple parsers can coexist. */
2904 #else /* !YYDEBUG */
2905 # define YYDPRINTF(Args)
2906 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2907 # define YY_STACK_PRINT(Bottom, Top)
2908 # define YY_REDUCE_PRINT(Rule)
2909 #endif /* !YYDEBUG */
2912 /* YYINITDEPTH -- initial size of the parser's stacks. */
2914 # define YYINITDEPTH 200
2917 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2918 if the built-in stack extension method is used).
2920 Do not make this value too large; the results are undefined if
2921 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2922 evaluated with infinite-precision integer arithmetic. */
2925 # define YYMAXDEPTH 10000
2933 # if defined __GLIBC__ && defined _STRING_H
2934 # define yystrlen strlen
2936 /* Return the length of YYSTR. */
2937 #if (defined __STDC__ || defined __C99__FUNC__ \
2938 || defined __cplusplus || defined _MSC_VER)
2940 yystrlen (const char *yystr)
2948 for (yylen = 0; yystr[yylen]; yylen++)
2956 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2957 # define yystpcpy stpcpy
2959 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2961 #if (defined __STDC__ || defined __C99__FUNC__ \
2962 || defined __cplusplus || defined _MSC_VER)
2964 yystpcpy (char *yydest, const char *yysrc)
2967 yystpcpy (yydest, yysrc)
2973 const char *yys = yysrc;
2975 while ((*yyd++ = *yys++) != '\0')
2984 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2985 quotes and backslashes, so that it's suitable for yyerror. The
2986 heuristic is that double-quoting is unnecessary unless the string
2987 contains an apostrophe, a comma, or backslash (other than
2988 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2989 null, do not copy; instead, return the length of what the result
2992 yytnamerr (char *yyres, const char *yystr)
2997 char const *yyp = yystr;
3004 goto do_not_strip_quotes;
3008 goto do_not_strip_quotes;
3021 do_not_strip_quotes: ;
3025 return yystrlen (yystr);
3027 return yystpcpy (yyres, yystr) - yyres;
3031 /* Copy into YYRESULT an error message about the unexpected token
3032 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3033 including the terminating null byte. If YYRESULT is null, do not
3034 copy anything; just return the number of bytes that would be
3035 copied. As a special case, return 0 if an ordinary "syntax error"
3036 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3037 size calculation. */
3039 yysyntax_error (char *yyresult, int yystate, int yychar)
3041 int yyn = yypact[yystate];
3043 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3047 int yytype = YYTRANSLATE (yychar);
3048 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3049 YYSIZE_T yysize = yysize0;
3051 int yysize_overflow = 0;
3052 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3053 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3057 /* This is so xgettext sees the translatable formats that are
3058 constructed on the fly. */
3059 YY_("syntax error, unexpected %s");
3060 YY_("syntax error, unexpected %s, expecting %s");
3061 YY_("syntax error, unexpected %s, expecting %s or %s");
3062 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3063 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3067 static char const yyunexpected[] = "syntax error, unexpected %s";
3068 static char const yyexpecting[] = ", expecting %s";
3069 static char const yyor[] = " or %s";
3070 char yyformat[sizeof yyunexpected
3071 + sizeof yyexpecting - 1
3072 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3073 * (sizeof yyor - 1))];
3074 char const *yyprefix = yyexpecting;
3076 /* Start YYX at -YYN if negative to avoid negative indexes in
3078 int yyxbegin = yyn < 0 ? -yyn : 0;
3080 /* Stay within bounds of both yycheck and yytname. */
3081 int yychecklim = YYLAST - yyn + 1;
3082 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3085 yyarg[0] = yytname[yytype];
3086 yyfmt = yystpcpy (yyformat, yyunexpected);
3088 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3089 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3091 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3095 yyformat[sizeof yyunexpected - 1] = '\0';
3098 yyarg[yycount++] = yytname[yyx];
3099 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3100 yysize_overflow |= (yysize1 < yysize);
3102 yyfmt = yystpcpy (yyfmt, yyprefix);
3106 yyf = YY_(yyformat);
3107 yysize1 = yysize + yystrlen (yyf);
3108 yysize_overflow |= (yysize1 < yysize);
3111 if (yysize_overflow)
3112 return YYSIZE_MAXIMUM;
3116 /* Avoid sprintf, as that infringes on the user's name space.
3117 Don't have undefined behavior even if the translation
3118 produced a string with the wrong number of "%s"s. */
3119 char *yyp = yyresult;
3121 while ((*yyp = *yyf) != '\0')
3123 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3125 yyp += yytnamerr (yyp, yyarg[yyi++]);
3138 #endif /* YYERROR_VERBOSE */
3141 /*-----------------------------------------------.
3142 | Release the memory associated to this symbol. |
3143 `-----------------------------------------------*/
3146 #if (defined __STDC__ || defined __C99__FUNC__ \
3147 || defined __cplusplus || defined _MSC_VER)
3149 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3152 yydestruct (yymsg, yytype, yyvaluep)
3162 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3173 /* Prevent warnings from -Wmissing-prototypes. */
3175 #ifdef YYPARSE_PARAM
3176 #if defined __STDC__ || defined __cplusplus
3177 int yyparse (void *YYPARSE_PARAM);
3181 #else /* ! YYPARSE_PARAM */
3182 #if defined __STDC__ || defined __cplusplus
3187 #endif /* ! YYPARSE_PARAM */
3191 /* The look-ahead symbol. */
3194 /* The semantic value of the look-ahead symbol. */
3197 /* Number of syntax errors so far. */
3206 #ifdef YYPARSE_PARAM
3207 #if (defined __STDC__ || defined __C99__FUNC__ \
3208 || defined __cplusplus || defined _MSC_VER)
3210 yyparse (void *YYPARSE_PARAM)
3213 yyparse (YYPARSE_PARAM)
3214 void *YYPARSE_PARAM;
3216 #else /* ! YYPARSE_PARAM */
3217 #if (defined __STDC__ || defined __C99__FUNC__ \
3218 || defined __cplusplus || defined _MSC_VER)
3232 /* Number of tokens to shift before error messages enabled. */
3234 /* Look-ahead token as an internal (translated) token number. */
3237 /* Buffer for error messages, and its allocated size. */
3239 char *yymsg = yymsgbuf;
3240 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3243 /* Three stacks and their tools:
3244 `yyss': related to states,
3245 `yyvs': related to semantic values,
3246 `yyls': related to locations.
3248 Refer to the stacks thru separate pointers, to allow yyoverflow
3249 to reallocate them elsewhere. */
3251 /* The state stack. */
3252 yytype_int16 yyssa[YYINITDEPTH];
3253 yytype_int16 *yyss = yyssa;
3254 yytype_int16 *yyssp;
3256 /* The semantic value stack. */
3257 YYSTYPE yyvsa[YYINITDEPTH];
3258 YYSTYPE *yyvs = yyvsa;
3263 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3265 YYSIZE_T yystacksize = YYINITDEPTH;
3267 /* The variables used to return semantic value and location from the
3272 /* The number of symbols on the RHS of the reduced rule.
3273 Keep to zero when no symbol should be popped. */
3276 YYDPRINTF ((stderr, "Starting parse\n"));
3281 yychar = YYEMPTY; /* Cause a token to be read. */
3283 /* Initialize stack pointers.
3284 Waste one element of value and location stack
3285 so that they stay on the same level as the state stack.
3286 The wasted elements are never initialized. */
3293 /*------------------------------------------------------------.
3294 | yynewstate -- Push a new state, which is found in yystate. |
3295 `------------------------------------------------------------*/
3297 /* In all cases, when you get here, the value and location stacks
3298 have just been pushed. So pushing a state here evens the stacks. */
3304 if (yyss + yystacksize - 1 <= yyssp)
3306 /* Get the current used size of the three stacks, in elements. */
3307 YYSIZE_T yysize = yyssp - yyss + 1;
3311 /* Give user a chance to reallocate the stack. Use copies of
3312 these so that the &'s don't force the real ones into
3314 YYSTYPE *yyvs1 = yyvs;
3315 yytype_int16 *yyss1 = yyss;
3318 /* Each stack pointer address is followed by the size of the
3319 data in use in that stack, in bytes. This used to be a
3320 conditional around just the two extra args, but that might
3321 be undefined if yyoverflow is a macro. */
3322 yyoverflow (YY_("memory exhausted"),
3323 &yyss1, yysize * sizeof (*yyssp),
3324 &yyvs1, yysize * sizeof (*yyvsp),
3331 #else /* no yyoverflow */
3332 # ifndef YYSTACK_RELOCATE
3333 goto yyexhaustedlab;
3335 /* Extend the stack our own way. */
3336 if (YYMAXDEPTH <= yystacksize)
3337 goto yyexhaustedlab;
3339 if (YYMAXDEPTH < yystacksize)
3340 yystacksize = YYMAXDEPTH;
3343 yytype_int16 *yyss1 = yyss;
3344 union yyalloc *yyptr =
3345 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3347 goto yyexhaustedlab;
3348 YYSTACK_RELOCATE (yyss);
3349 YYSTACK_RELOCATE (yyvs);
3351 # undef YYSTACK_RELOCATE
3353 YYSTACK_FREE (yyss1);
3356 #endif /* no yyoverflow */
3358 yyssp = yyss + yysize - 1;
3359 yyvsp = yyvs + yysize - 1;
3362 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3363 (unsigned long int) yystacksize));
3365 if (yyss + yystacksize - 1 <= yyssp)
3369 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3378 /* Do appropriate processing given the current state. Read a
3379 look-ahead token if we need one and don't already have one. */
3381 /* First try to decide what to do without reference to look-ahead token. */
3382 yyn = yypact[yystate];
3383 if (yyn == YYPACT_NINF)
3386 /* Not known => get a look-ahead token if don't already have one. */
3388 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3389 if (yychar == YYEMPTY)
3391 YYDPRINTF ((stderr, "Reading a token: "));
3395 if (yychar <= YYEOF)
3397 yychar = yytoken = YYEOF;
3398 YYDPRINTF ((stderr, "Now at end of input.\n"));
3402 yytoken = YYTRANSLATE (yychar);
3403 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3406 /* If the proper action on seeing token YYTOKEN is to reduce or to
3407 detect an error, take that action. */
3409 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3414 if (yyn == 0 || yyn == YYTABLE_NINF)
3423 /* Count tokens shifted since error; after three, turn off error
3428 /* Shift the look-ahead token. */
3429 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3431 /* Discard the shifted token unless it is eof. */
3432 if (yychar != YYEOF)
3441 /*-----------------------------------------------------------.
3442 | yydefault -- do the default action for the current state. |
3443 `-----------------------------------------------------------*/
3445 yyn = yydefact[yystate];
3451 /*-----------------------------.
3452 | yyreduce -- Do a reduction. |
3453 `-----------------------------*/
3455 /* yyn is the number of a rule to reduce with. */
3458 /* If YYLEN is nonzero, implement the default value of the action:
3461 Otherwise, the following line sets YYVAL to garbage.
3462 This behavior is undocumented and Bison
3463 users should not rely upon it. Assigning to YYVAL
3464 unconditionally makes the parser a bit smaller, and it avoids a
3465 GCC warning that YYVAL may be used uninitialized. */
3466 yyval = yyvsp[1-yylen];
3469 YY_REDUCE_PRINT (yyn);
3473 #line 1117 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3474 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3478 #line 1117 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3479 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3483 #line 1118 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3484 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3488 #line 1118 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3489 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3493 #line 1119 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3494 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3498 #line 1119 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3499 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3503 #line 1120 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3504 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3508 #line 1120 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3509 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3513 #line 1121 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3514 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3518 #line 1121 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3519 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3523 #line 1125 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3524 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3528 #line 1125 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3529 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3533 #line 1126 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3534 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3538 #line 1126 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3539 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3543 #line 1127 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3544 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3548 #line 1127 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3549 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3553 #line 1128 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3554 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3558 #line 1128 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3559 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3563 #line 1129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3564 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3568 #line 1129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3569 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3573 #line 1130 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3574 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3578 #line 1130 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3579 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3583 #line 1131 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3584 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3588 #line 1131 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3589 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3593 #line 1132 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3594 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3598 #line 1133 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3599 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3603 #line 1142 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3604 { (yyval.StrVal) = 0; ;}
3608 #line 1144 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3609 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3613 #line 1145 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3614 { (yyval.UIntVal)=0; ;}
3618 #line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3620 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3626 #line 1153 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3634 #line 1161 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3642 #line 1166 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3644 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3650 #line 1172 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3651 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3655 #line 1173 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3656 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3660 #line 1174 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3661 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3665 #line 1175 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3666 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3670 #line 1176 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3671 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3675 #line 1180 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3676 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3680 #line 1181 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3681 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3685 #line 1182 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3686 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3690 #line 1186 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3691 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3695 #line 1187 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3696 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3700 #line 1188 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3701 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3705 #line 1189 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3706 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3710 #line 1193 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3711 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3715 #line 1194 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3716 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3720 #line 1195 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3721 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3725 #line 1199 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3726 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3730 #line 1200 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3731 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3735 #line 1201 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3736 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3740 #line 1202 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3741 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3745 #line 1203 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3746 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3750 #line 1207 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3751 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3755 #line 1208 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3756 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3760 #line 1209 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3761 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3765 #line 1212 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3766 { (yyval.UIntVal) = CallingConv::C; ;}
3770 #line 1213 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3771 { (yyval.UIntVal) = CallingConv::C; ;}
3775 #line 1214 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3776 { (yyval.UIntVal) = CallingConv::Fast; ;}
3780 #line 1215 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3781 { (yyval.UIntVal) = CallingConv::Cold; ;}
3785 #line 1216 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3786 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3790 #line 1217 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3791 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3795 #line 1218 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3797 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3798 GEN_ERROR("Calling conv too large");
3799 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3805 #line 1225 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3806 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3810 #line 1226 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3811 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3815 #line 1227 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3816 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3820 #line 1228 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3821 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3825 #line 1229 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3826 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3830 #line 1230 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3831 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3835 #line 1231 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3836 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3840 #line 1232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3841 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3845 #line 1233 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3846 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3850 #line 1234 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3851 { (yyval.ParamAttrs) =
3852 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3856 #line 1238 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3857 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3861 #line 1239 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3863 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3868 #line 1244 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3869 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3873 #line 1245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3874 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3878 #line 1246 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3879 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3883 #line 1247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3884 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3888 #line 1248 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3889 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3893 #line 1249 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3894 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3898 #line 1252 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3899 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3903 #line 1253 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3905 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3910 #line 1258 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3911 { (yyval.StrVal) = 0; ;}
3915 #line 1259 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3917 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3922 #line 1266 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3923 { (yyval.UIntVal) = 0; ;}
3927 #line 1267 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3929 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3930 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3931 GEN_ERROR("Alignment must be a power of two");
3937 #line 1273 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3938 { (yyval.UIntVal) = 0; ;}
3942 #line 1274 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3944 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3945 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3946 GEN_ERROR("Alignment must be a power of two");
3952 #line 1283 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3954 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3955 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3956 GEN_ERROR("Invalid character in section name");
3957 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3963 #line 1291 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3964 { (yyval.StrVal) = 0; ;}
3968 #line 1292 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3969 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3973 #line 1297 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3978 #line 1298 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3983 #line 1299 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3985 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3986 delete (yyvsp[(1) - (1)].StrVal);
3992 #line 1304 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
3994 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3995 GEN_ERROR("Alignment must be a power of two");
3996 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4002 #line 1320 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4004 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4010 #line 1324 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4012 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4018 #line 1328 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4020 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4021 GEN_ERROR("Cannot form a pointer to a basic block");
4022 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4023 delete (yyvsp[(1) - (3)].TypeVal);
4029 #line 1335 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4030 { // Named types are also simple types...
4031 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4033 (yyval.TypeVal) = new PATypeHolder(tmp);
4038 #line 1340 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4039 { // Type UpReference
4040 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4041 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4042 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4043 (yyval.TypeVal) = new PATypeHolder(OT);
4044 UR_OUT("New Upreference!\n");
4050 #line 1348 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4052 // Allow but ignore attributes on function types; this permits auto-upgrade.
4053 // FIXME: remove in LLVM 3.0.
4054 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4055 if (!FunctionType::isValidReturnType(RetTy))
4056 GEN_ERROR("Invalid result type for LLVM function");
4058 std::vector<const Type*> Params;
4059 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4060 for (; I != E; ++I ) {
4061 const Type *Ty = I->Ty->get();
4062 Params.push_back(Ty);
4065 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4066 if (isVarArg) Params.pop_back();
4068 for (unsigned i = 0; i != Params.size(); ++i)
4069 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4070 GEN_ERROR("Function arguments must be value types!");
4074 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4075 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4076 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4077 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4083 #line 1377 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4085 // Allow but ignore attributes on function types; this permits auto-upgrade.
4086 // FIXME: remove in LLVM 3.0.
4087 std::vector<const Type*> Params;
4088 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4089 for ( ; I != E; ++I ) {
4090 const Type* Ty = I->Ty->get();
4091 Params.push_back(Ty);
4094 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4095 if (isVarArg) Params.pop_back();
4097 for (unsigned i = 0; i != Params.size(); ++i)
4098 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4099 GEN_ERROR("Function arguments must be value types!");
4103 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4104 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4105 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4111 #line 1402 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4112 { // Sized array type?
4113 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4114 delete (yyvsp[(4) - (5)].TypeVal);
4120 #line 1407 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4122 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4123 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4124 GEN_ERROR("Unsigned result not equal to signed result");
4125 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4126 GEN_ERROR("Element type of a VectorType must be primitive");
4127 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4128 delete (yyvsp[(4) - (5)].TypeVal);
4134 #line 1417 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4135 { // Structure type?
4136 std::vector<const Type*> Elements;
4137 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4138 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4139 Elements.push_back(*I);
4141 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4142 delete (yyvsp[(2) - (3)].TypeList);
4148 #line 1427 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4149 { // Empty structure type?
4150 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4156 #line 1431 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4158 std::vector<const Type*> Elements;
4159 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4160 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4161 Elements.push_back(*I);
4163 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4164 delete (yyvsp[(3) - (5)].TypeList);
4170 #line 1441 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4171 { // Empty structure type?
4172 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4178 #line 1448 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4180 // Allow but ignore attributes on function types; this permits auto-upgrade.
4181 // FIXME: remove in LLVM 3.0.
4182 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4183 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4188 #line 1457 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4190 if (!UpRefs.empty())
4191 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4192 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4193 GEN_ERROR("LLVM functions cannot return aggregate types");
4194 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4199 #line 1464 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4201 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4206 #line 1469 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4208 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4209 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4215 #line 1474 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4217 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4223 #line 1482 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4225 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4226 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4227 TWA.Ty = new PATypeHolder(Type::VoidTy);
4228 (yyval.TypeWithAttrsList)->push_back(TWA);
4234 #line 1489 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4236 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4237 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4238 TWA.Ty = new PATypeHolder(Type::VoidTy);
4239 (yyval.TypeWithAttrsList)->push_back(TWA);
4245 #line 1496 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4247 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4253 #line 1504 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4255 (yyval.TypeList) = new std::list<PATypeHolder>();
4256 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4257 delete (yyvsp[(1) - (1)].TypeVal);
4263 #line 1510 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4265 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4266 delete (yyvsp[(3) - (3)].TypeVal);
4272 #line 1522 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4273 { // Nonempty unsized arr
4274 if (!UpRefs.empty())
4275 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4276 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4278 GEN_ERROR("Cannot make array constant with type: '" +
4279 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4280 const Type *ETy = ATy->getElementType();
4281 int NumElements = ATy->getNumElements();
4283 // Verify that we have the correct size...
4284 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4285 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4286 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4287 itostr(NumElements) + "");
4289 // Verify all elements are correct type!
4290 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4291 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4292 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4293 ETy->getDescription() +"' as required!\nIt is of type '"+
4294 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4297 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4298 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4304 #line 1550 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4306 if (!UpRefs.empty())
4307 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4308 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4310 GEN_ERROR("Cannot make array constant with type: '" +
4311 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4313 int NumElements = ATy->getNumElements();
4314 if (NumElements != -1 && NumElements != 0)
4315 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4316 " arguments, but has size of " + itostr(NumElements) +"");
4317 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4318 delete (yyvsp[(1) - (3)].TypeVal);
4324 #line 1566 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4326 if (!UpRefs.empty())
4327 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4328 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4330 GEN_ERROR("Cannot make array constant with type: '" +
4331 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4333 int NumElements = ATy->getNumElements();
4334 const Type *ETy = ATy->getElementType();
4335 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4336 GEN_ERROR("Can't build string constant of size " +
4337 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4338 " when array has size " + itostr(NumElements) + "");
4339 std::vector<Constant*> Vals;
4340 if (ETy == Type::Int8Ty) {
4341 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4342 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4344 delete (yyvsp[(3) - (3)].StrVal);
4345 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4347 delete (yyvsp[(3) - (3)].StrVal);
4348 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4349 delete (yyvsp[(1) - (3)].TypeVal);
4355 #line 1593 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4356 { // Nonempty unsized arr
4357 if (!UpRefs.empty())
4358 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4359 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4361 GEN_ERROR("Cannot make packed constant with type: '" +
4362 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4363 const Type *ETy = PTy->getElementType();
4364 int NumElements = PTy->getNumElements();
4366 // Verify that we have the correct size...
4367 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4368 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4369 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4370 itostr(NumElements) + "");
4372 // Verify all elements are correct type!
4373 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4374 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4375 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4376 ETy->getDescription() +"' as required!\nIt is of type '"+
4377 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4380 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4381 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4387 #line 1621 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4389 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4391 GEN_ERROR("Cannot make struct constant with type: '" +
4392 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4394 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4395 GEN_ERROR("Illegal number of initializers for structure type");
4397 // Check to ensure that constants are compatible with the type initializer!
4398 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4399 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4400 GEN_ERROR("Expected type '" +
4401 STy->getElementType(i)->getDescription() +
4402 "' for element #" + utostr(i) +
4403 " of structure initializer");
4405 // Check to ensure that Type is not packed
4406 if (STy->isPacked())
4407 GEN_ERROR("Unpacked Initializer to vector type '" +
4408 STy->getDescription() + "'");
4410 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4411 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4417 #line 1647 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4419 if (!UpRefs.empty())
4420 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4421 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4423 GEN_ERROR("Cannot make struct constant with type: '" +
4424 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4426 if (STy->getNumContainedTypes() != 0)
4427 GEN_ERROR("Illegal number of initializers for structure type");
4429 // Check to ensure that Type is not packed
4430 if (STy->isPacked())
4431 GEN_ERROR("Unpacked Initializer to vector type '" +
4432 STy->getDescription() + "'");
4434 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4435 delete (yyvsp[(1) - (3)].TypeVal);
4441 #line 1667 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4443 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4445 GEN_ERROR("Cannot make struct constant with type: '" +
4446 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4448 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4449 GEN_ERROR("Illegal number of initializers for structure type");
4451 // Check to ensure that constants are compatible with the type initializer!
4452 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4453 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4454 GEN_ERROR("Expected type '" +
4455 STy->getElementType(i)->getDescription() +
4456 "' for element #" + utostr(i) +
4457 " of structure initializer");
4459 // Check to ensure that Type is packed
4460 if (!STy->isPacked())
4461 GEN_ERROR("Vector initializer to non-vector type '" +
4462 STy->getDescription() + "'");
4464 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4465 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4471 #line 1693 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4473 if (!UpRefs.empty())
4474 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4475 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4477 GEN_ERROR("Cannot make struct constant with type: '" +
4478 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4480 if (STy->getNumContainedTypes() != 0)
4481 GEN_ERROR("Illegal number of initializers for structure type");
4483 // Check to ensure that Type is packed
4484 if (!STy->isPacked())
4485 GEN_ERROR("Vector initializer to non-vector type '" +
4486 STy->getDescription() + "'");
4488 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4489 delete (yyvsp[(1) - (5)].TypeVal);
4495 #line 1713 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4497 if (!UpRefs.empty())
4498 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4499 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4501 GEN_ERROR("Cannot make null pointer constant with type: '" +
4502 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4504 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4505 delete (yyvsp[(1) - (2)].TypeVal);
4511 #line 1725 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4513 if (!UpRefs.empty())
4514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4515 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4516 delete (yyvsp[(1) - (2)].TypeVal);
4522 #line 1732 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4524 if (!UpRefs.empty())
4525 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4526 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4528 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4530 // ConstExprs can exist in the body of a function, thus creating
4531 // GlobalValues whenever they refer to a variable. Because we are in
4532 // the context of a function, getExistingVal will search the functions
4533 // symbol table instead of the module symbol table for the global symbol,
4534 // which throws things all off. To get around this, we just tell
4535 // getExistingVal that we are at global scope here.
4537 Function *SavedCurFn = CurFun.CurrentFunction;
4538 CurFun.CurrentFunction = 0;
4540 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4543 CurFun.CurrentFunction = SavedCurFn;
4545 // If this is an initializer for a constant pointer, which is referencing a
4546 // (currently) undefined variable, create a stub now that shall be replaced
4547 // in the future with the right type of variable.
4550 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4551 const PointerType *PT = cast<PointerType>(Ty);
4553 // First check to see if the forward references value is already created!
4554 PerModuleInfo::GlobalRefsType::iterator I =
4555 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4557 if (I != CurModule.GlobalRefs.end()) {
4558 V = I->second; // Placeholder already exists, use it...
4559 (yyvsp[(2) - (2)].ValIDVal).destroy();
4562 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4563 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4564 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4565 GEN_ERROR("Invalid reference to global");
4567 // Create the forward referenced global.
4569 if (const FunctionType *FTy =
4570 dyn_cast<FunctionType>(PT->getElementType())) {
4571 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4572 CurModule.CurrentModule);
4574 GV = new GlobalVariable(PT->getElementType(), false,
4575 GlobalValue::ExternalWeakLinkage, 0,
4576 Name, CurModule.CurrentModule);
4579 // Keep track of the fact that we have a forward ref to recycle it
4580 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4585 (yyval.ConstVal) = cast<GlobalValue>(V);
4586 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4592 #line 1798 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4594 if (!UpRefs.empty())
4595 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4596 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4597 GEN_ERROR("Mismatched types for constant expression: " +
4598 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4599 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4600 delete (yyvsp[(1) - (2)].TypeVal);
4606 #line 1808 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4608 if (!UpRefs.empty())
4609 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4610 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4611 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4612 GEN_ERROR("Cannot create a null initialized value of this type");
4613 (yyval.ConstVal) = Constant::getNullValue(Ty);
4614 delete (yyvsp[(1) - (2)].TypeVal);
4620 #line 1818 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4621 { // integral constants
4622 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4623 GEN_ERROR("Constant value doesn't fit in type");
4624 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4630 #line 1824 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4631 { // arbitrary precision integer constants
4632 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4633 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4634 GEN_ERROR("Constant value does not fit in type");
4636 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4637 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4638 delete (yyvsp[(2) - (2)].APIntVal);
4644 #line 1834 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4645 { // integral constants
4646 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4647 GEN_ERROR("Constant value doesn't fit in type");
4648 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4654 #line 1840 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4655 { // arbitrary precision integer constants
4656 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4657 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4658 GEN_ERROR("Constant value does not fit in type");
4660 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4661 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4662 delete (yyvsp[(2) - (2)].APIntVal);
4668 #line 1850 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4669 { // Boolean constants
4670 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4671 (yyval.ConstVal) = ConstantInt::getTrue();
4677 #line 1855 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4678 { // Boolean constants
4679 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4680 (yyval.ConstVal) = ConstantInt::getFalse();
4686 #line 1860 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4687 { // Floating point constants
4688 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4689 GEN_ERROR("Floating point constant invalid for type");
4690 // Lexer has no type info, so builds all float and double FP constants
4691 // as double. Fix this here. Long double is done right.
4692 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4693 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4694 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4695 delete (yyvsp[(2) - (2)].FPVal);
4701 #line 1873 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4703 if (!UpRefs.empty())
4704 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4705 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4706 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4707 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4708 GEN_ERROR("invalid cast opcode for cast from '" +
4709 Val->getType()->getDescription() + "' to '" +
4710 DestTy->getDescription() + "'");
4711 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4712 delete (yyvsp[(5) - (6)].TypeVal);
4717 #line 1885 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4719 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4720 GEN_ERROR("GetElementPtr requires a pointer operand");
4723 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4726 GEN_ERROR("Index list invalid for constant getelementptr");
4728 SmallVector<Constant*, 8> IdxVec;
4729 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4730 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4731 IdxVec.push_back(C);
4733 GEN_ERROR("Indices to constant getelementptr must be constants");
4735 delete (yyvsp[(4) - (5)].ValueList);
4737 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4743 #line 1907 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4745 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4746 GEN_ERROR("Select condition must be of boolean type");
4747 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4748 GEN_ERROR("Select operand types must match");
4749 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4755 #line 1915 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4757 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4758 GEN_ERROR("Binary operator types must match");
4760 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4765 #line 1921 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4767 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4768 GEN_ERROR("Logical operator types must match");
4769 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4770 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4771 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4772 GEN_ERROR("Logical operator requires integral operands");
4774 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4780 #line 1932 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4782 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4783 GEN_ERROR("icmp operand types must match");
4784 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4789 #line 1937 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4791 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4792 GEN_ERROR("fcmp operand types must match");
4793 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4798 #line 1942 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4800 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4801 GEN_ERROR("Invalid extractelement operands");
4802 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4808 #line 1948 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4810 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4811 GEN_ERROR("Invalid insertelement operands");
4812 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4818 #line 1954 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4820 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4821 GEN_ERROR("Invalid shufflevector operands");
4822 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4828 #line 1963 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4830 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4836 #line 1967 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4838 (yyval.ConstVector) = new std::vector<Constant*>();
4839 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4845 #line 1975 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4846 { (yyval.BoolVal) = false; ;}
4850 #line 1975 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4851 { (yyval.BoolVal) = true; ;}
4855 #line 1978 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4856 { (yyval.BoolVal) = true; ;}
4860 #line 1978 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4861 { (yyval.BoolVal) = false; ;}
4865 #line 1981 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4867 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4868 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4870 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4872 GEN_ERROR("Aliases can be created only to global values");
4874 (yyval.ConstVal) = Aliasee;
4876 delete (yyvsp[(1) - (2)].TypeVal);
4881 #line 1993 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4883 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4884 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4885 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4886 GEN_ERROR("invalid cast opcode for cast from '" +
4887 Val->getType()->getDescription() + "' to '" +
4888 DestTy->getDescription() + "'");
4890 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4892 delete (yyvsp[(5) - (6)].TypeVal);
4897 #line 2014 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4899 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4900 CurModule.ModuleDone();
4906 #line 2019 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4908 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4909 CurModule.ModuleDone();
4915 #line 2032 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4916 { CurFun.isDeclare = false; ;}
4920 #line 2032 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4922 CurFun.FunctionDone();
4928 #line 2036 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4929 { CurFun.isDeclare = true; ;}
4933 #line 2036 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4940 #line 2039 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4947 #line 2042 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4949 if (!UpRefs.empty())
4950 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4951 // Eagerly resolve types. This is not an optimization, this is a
4952 // requirement that is due to the fact that we could have this:
4954 // %list = type { %list * }
4955 // %list = type { %list * } ; repeated type decl
4957 // If types are not resolved eagerly, then the two types will not be
4958 // determined to be the same type!
4960 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4962 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4964 // If this is a named type that is not a redefinition, add it to the slot
4966 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4969 delete (yyvsp[(3) - (3)].TypeVal);
4975 #line 2066 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4977 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4979 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4981 // If this is a named type that is not a redefinition, add it to the slot
4983 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4990 #line 2078 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4992 /* "Externally Visible" Linkage */
4993 if ((yyvsp[(5) - (6)].ConstVal) == 0)
4994 GEN_ERROR("Global value initializer is not a constant");
4995 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
4996 (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));
5002 #line 2085 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5009 #line 2089 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5011 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5012 GEN_ERROR("Global value initializer is not a constant");
5013 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));
5019 #line 2094 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5026 #line 2098 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5028 if (!UpRefs.empty())
5029 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5030 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));
5032 delete (yyvsp[(6) - (7)].TypeVal);
5037 #line 2104 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5045 #line 2108 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5048 if ((yyvsp[(1) - (5)].StrVal)) {
5049 Name = *(yyvsp[(1) - (5)].StrVal);
5050 delete (yyvsp[(1) - (5)].StrVal);
5053 GEN_ERROR("Alias name cannot be empty");
5055 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5057 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5059 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5060 CurModule.CurrentModule);
5061 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5062 InsertValue(GA, CurModule.Values);
5065 // If there was a forward reference of this alias, resolve it now.
5069 ID = ValID::createGlobalName(Name);
5071 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5073 if (GlobalValue *FWGV =
5074 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5075 // Replace uses of the fwdref with the actual alias.
5076 FWGV->replaceAllUsesWith(GA);
5077 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5078 GV->eraseFromParent();
5080 cast<Function>(FWGV)->eraseFromParent();
5089 #line 2148 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5096 #line 2151 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5103 #line 2157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5105 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5106 if (AsmSoFar.empty())
5107 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5109 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5110 delete (yyvsp[(1) - (1)].StrVal);
5116 #line 2167 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5118 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5119 delete (yyvsp[(3) - (3)].StrVal);
5124 #line 2171 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5126 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5127 delete (yyvsp[(3) - (3)].StrVal);
5132 #line 2178 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5134 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5135 delete (yyvsp[(3) - (3)].StrVal);
5141 #line 2183 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5143 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5144 delete (yyvsp[(1) - (1)].StrVal);
5150 #line 2188 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5157 #line 2197 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5159 if (!UpRefs.empty())
5160 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5161 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5162 GEN_ERROR("void typed arguments are invalid");
5163 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5164 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5165 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5171 #line 2207 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5173 if (!UpRefs.empty())
5174 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5175 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5176 GEN_ERROR("void typed arguments are invalid");
5177 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5178 (yyval.ArgList) = new ArgListType;
5179 (yyval.ArgList)->push_back(E);
5185 #line 2218 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5187 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5193 #line 2222 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5195 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5196 struct ArgListEntry E;
5197 E.Ty = new PATypeHolder(Type::VoidTy);
5199 E.Attrs = ParamAttr::None;
5200 (yyval.ArgList)->push_back(E);
5206 #line 2231 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5208 (yyval.ArgList) = new ArgListType;
5209 struct ArgListEntry E;
5210 E.Ty = new PATypeHolder(Type::VoidTy);
5212 E.Attrs = ParamAttr::None;
5213 (yyval.ArgList)->push_back(E);
5219 #line 2240 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5221 (yyval.ArgList) = 0;
5227 #line 2246 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5229 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5230 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5232 // Check the function result for abstractness if this is a define. We should
5233 // have no abstract types at this point
5234 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5235 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5237 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5238 GEN_ERROR("Invalid result type for LLVM function");
5240 std::vector<const Type*> ParamTypeList;
5241 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5242 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5243 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5244 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5246 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5247 const Type* Ty = I->Ty->get();
5248 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5249 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5250 ParamTypeList.push_back(Ty);
5251 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5252 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5256 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5257 if (isVarArg) ParamTypeList.pop_back();
5261 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5263 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5264 const PointerType *PFT = PointerType::getUnqual(FT);
5265 delete (yyvsp[(2) - (10)].TypeVal);
5268 if (!FunctionName.empty()) {
5269 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5271 ID = ValID::createGlobalID(CurModule.Values.size());
5275 // See if this function was forward referenced. If so, recycle the object.
5276 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5277 // Move the function to the end of the list, from whereever it was
5278 // previously inserted.
5279 Fn = cast<Function>(FWRef);
5280 assert(Fn->getParamAttrs().isEmpty() &&
5281 "Forward reference has parameter attributes!");
5282 CurModule.CurrentModule->getFunctionList().remove(Fn);
5283 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5284 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5285 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5286 if (Fn->getFunctionType() != FT ) {
5287 // The existing function doesn't have the same type. This is an overload
5289 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5290 } else if (Fn->getParamAttrs() != PAL) {
5291 // The existing function doesn't have the same parameter attributes.
5292 // This is an overload error.
5293 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5294 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5295 // Neither the existing or the current function is a declaration and they
5296 // have the same name and same type. Clearly this is a redefinition.
5297 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5298 } else if (Fn->isDeclaration()) {
5299 // Make sure to strip off any argument names so we can't get conflicts.
5300 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5304 } else { // Not already defined?
5305 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5306 CurModule.CurrentModule);
5307 InsertValue(Fn, CurModule.Values);
5310 CurFun.FunctionStart(Fn);
5312 if (CurFun.isDeclare) {
5313 // If we have declaration, always overwrite linkage. This will allow us to
5314 // correctly handle cases, when pointer to function is passed as argument to
5315 // another function.
5316 Fn->setLinkage(CurFun.Linkage);
5317 Fn->setVisibility(CurFun.Visibility);
5319 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5320 Fn->setParamAttrs(PAL);
5321 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5322 if ((yyvsp[(8) - (10)].StrVal)) {
5323 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5324 delete (yyvsp[(8) - (10)].StrVal);
5326 if ((yyvsp[(10) - (10)].StrVal)) {
5327 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5328 delete (yyvsp[(10) - (10)].StrVal);
5331 // Add all of the arguments we parsed to the function...
5332 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5333 if (isVarArg) { // Nuke the last entry
5334 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5335 "Not a varargs marker!");
5336 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5337 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5339 Function::arg_iterator ArgIt = Fn->arg_begin();
5340 Function::arg_iterator ArgEnd = Fn->arg_end();
5342 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5343 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5344 delete I->Ty; // Delete the typeholder...
5345 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5351 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5358 #line 2376 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5360 (yyval.FunctionVal) = CurFun.CurrentFunction;
5362 // Make sure that we keep track of the linkage type even if there was a
5363 // previous "declare".
5364 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5365 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5370 #line 2387 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5372 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5378 #line 2392 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5380 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5381 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5382 (yyval.FunctionVal) = CurFun.CurrentFunction;
5383 CurFun.FunctionDone();
5389 #line 2404 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5391 (yyval.BoolVal) = false;
5397 #line 2408 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5399 (yyval.BoolVal) = true;
5405 #line 2413 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5406 { // A reference to a direct constant
5407 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5413 #line 2417 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5415 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5421 #line 2421 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5422 { // Perhaps it's an FP constant?
5423 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5429 #line 2425 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5431 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5437 #line 2429 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5439 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5445 #line 2433 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5447 (yyval.ValIDVal) = ValID::createNull();
5453 #line 2437 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5455 (yyval.ValIDVal) = ValID::createUndef();
5461 #line 2441 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5462 { // A vector zero constant.
5463 (yyval.ValIDVal) = ValID::createZeroInit();
5469 #line 2445 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5470 { // Nonempty unsized packed vector
5471 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5472 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5474 VectorType* pt = VectorType::get(ETy, NumElements);
5475 PATypeHolder* PTy = new PATypeHolder(
5483 // Verify all elements are correct type!
5484 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5485 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5486 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5487 ETy->getDescription() +"' as required!\nIt is of type '" +
5488 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5491 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5492 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5498 #line 2470 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5500 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5506 #line 2474 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5508 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5509 delete (yyvsp[(3) - (5)].StrVal);
5510 delete (yyvsp[(5) - (5)].StrVal);
5516 #line 2484 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5517 { // Is it an integer reference...?
5518 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5524 #line 2488 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5526 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5532 #line 2492 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5533 { // Is it a named reference...?
5534 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5535 delete (yyvsp[(1) - (1)].StrVal);
5541 #line 2497 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5542 { // Is it a named reference...?
5543 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5544 delete (yyvsp[(1) - (1)].StrVal);
5550 #line 2510 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5552 if (!UpRefs.empty())
5553 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5554 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5555 delete (yyvsp[(1) - (2)].TypeVal);
5561 #line 2519 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5563 (yyval.ValueList) = new std::vector<Value *>();
5564 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5570 #line 2524 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5572 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5578 #line 2529 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5580 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5586 #line 2533 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5587 { // Do not allow functions with 0 basic blocks
5588 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5594 #line 2542 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5596 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5598 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5599 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5600 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5606 #line 2551 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5608 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5609 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5610 if (CI2->getParent() == 0)
5611 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5612 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5613 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5619 #line 2560 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5620 { // Empty space between instruction lists
5621 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5627 #line 2564 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5628 { // Labelled (named) basic block
5629 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5630 delete (yyvsp[(1) - (1)].StrVal);
5637 #line 2572 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5638 { // Return with a result...
5639 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5640 assert(!VL.empty() && "Invalid ret operands!");
5641 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5642 delete (yyvsp[(2) - (2)].ValueList);
5648 #line 2579 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5649 { // Return with no result...
5650 (yyval.TermInstVal) = ReturnInst::Create();
5656 #line 2583 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5657 { // Unconditional Branch...
5658 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5660 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5665 #line 2588 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5667 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5668 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5670 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5672 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5674 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5679 #line 2598 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5681 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5683 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5685 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5686 (yyval.TermInstVal) = S;
5688 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5689 E = (yyvsp[(8) - (9)].JumpTable)->end();
5690 for (; I != E; ++I) {
5691 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5692 S->addCase(CI, I->second);
5694 GEN_ERROR("Switch case is constant, but not a simple integer");
5696 delete (yyvsp[(8) - (9)].JumpTable);
5702 #line 2617 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5704 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5706 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5708 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
5709 (yyval.TermInstVal) = S;
5715 #line 2627 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5718 // Handle the short syntax
5719 const PointerType *PFTy = 0;
5720 const FunctionType *Ty = 0;
5721 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5722 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5723 // Pull out the types of all of the arguments...
5724 std::vector<const Type*> ParamTypes;
5725 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5726 for (; I != E; ++I) {
5727 const Type *Ty = I->Val->getType();
5728 if (Ty == Type::VoidTy)
5729 GEN_ERROR("Short call syntax cannot be used with varargs");
5730 ParamTypes.push_back(Ty);
5733 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5734 GEN_ERROR("Invalid result type for LLVM function");
5736 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5737 PFTy = PointerType::getUnqual(Ty);
5740 delete (yyvsp[(3) - (14)].TypeVal);
5742 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5744 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5746 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5749 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5750 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5751 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
5753 // Check the arguments
5755 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5756 // Make sure no arguments is a good thing!
5757 if (Ty->getNumParams() != 0)
5758 GEN_ERROR("No arguments passed to a function that "
5759 "expects arguments");
5760 } else { // Has arguments?
5761 // Loop through FunctionType's arguments and ensure they are specified
5763 FunctionType::param_iterator I = Ty->param_begin();
5764 FunctionType::param_iterator E = Ty->param_end();
5765 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5768 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5769 if (ArgI->Val->getType() != *I)
5770 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5771 (*I)->getDescription() + "'");
5772 Args.push_back(ArgI->Val);
5773 if (ArgI->Attrs != ParamAttr::None)
5774 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5777 if (Ty->isVarArg()) {
5779 for (; ArgI != ArgE; ++ArgI, ++index) {
5780 Args.push_back(ArgI->Val); // push the remaining varargs
5781 if (ArgI->Attrs != ParamAttr::None)
5782 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5784 } else if (I != E || ArgI != ArgE)
5785 GEN_ERROR("Invalid number of parameters detected");
5790 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5792 // Create the InvokeInst
5793 InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end());
5794 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5795 II->setParamAttrs(PAL);
5796 (yyval.TermInstVal) = II;
5797 delete (yyvsp[(6) - (14)].ParamList);
5803 #line 2711 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5805 (yyval.TermInstVal) = new UnwindInst();
5811 #line 2715 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5813 (yyval.TermInstVal) = new UnreachableInst();
5819 #line 2722 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5821 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5822 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5825 GEN_ERROR("May only switch on a constant pool value");
5827 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5829 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5834 #line 2733 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5836 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5837 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5841 GEN_ERROR("May only switch on a constant pool value");
5843 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5845 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5850 #line 2746 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5852 // Is this definition named?? if so, assign the name...
5853 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5855 InsertValue((yyvsp[(2) - (2)].InstVal));
5856 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5862 #line 2756 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5863 { // Used for PHI nodes
5864 if (!UpRefs.empty())
5865 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5866 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5867 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5869 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5871 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5872 delete (yyvsp[(1) - (6)].TypeVal);
5877 #line 2767 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5879 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5880 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5882 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5884 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5889 #line 2777 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5891 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5892 if (!UpRefs.empty())
5893 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5894 // Used for call and invoke instructions
5895 (yyval.ParamList) = new ParamList();
5896 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5897 (yyval.ParamList)->push_back(E);
5898 delete (yyvsp[(1) - (4)].TypeVal);
5904 #line 2788 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5906 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5907 // Labels are only valid in ASMs
5908 (yyval.ParamList) = new ParamList();
5909 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5910 (yyval.ParamList)->push_back(E);
5916 #line 2796 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5918 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5919 if (!UpRefs.empty())
5920 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5921 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5922 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5923 (yyval.ParamList)->push_back(E);
5924 delete (yyvsp[(3) - (6)].TypeVal);
5930 #line 2806 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5932 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5933 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5934 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5935 (yyval.ParamList)->push_back(E);
5941 #line 2813 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5942 { (yyval.ParamList) = new ParamList(); ;}
5946 #line 2816 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5947 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5951 #line 2817 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5953 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5954 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5960 #line 2824 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5962 (yyval.BoolVal) = true;
5968 #line 2828 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5970 (yyval.BoolVal) = false;
5976 #line 2833 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5978 if (!UpRefs.empty())
5979 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5980 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5981 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5983 "Arithmetic operator requires integer, FP, or packed operands");
5984 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5986 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5988 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5989 if ((yyval.InstVal) == 0)
5990 GEN_ERROR("binary operator returned null");
5991 delete (yyvsp[(2) - (5)].TypeVal);
5996 #line 2849 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5998 if (!UpRefs.empty())
5999 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6000 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6001 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6002 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6003 GEN_ERROR("Logical operator requires integral operands");
6005 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6007 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6009 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6010 if ((yyval.InstVal) == 0)
6011 GEN_ERROR("binary operator returned null");
6012 delete (yyvsp[(2) - (5)].TypeVal);
6017 #line 2866 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6019 if (!UpRefs.empty())
6020 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6021 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6022 GEN_ERROR("Vector types not supported by icmp instruction");
6023 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6025 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6027 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6028 if ((yyval.InstVal) == 0)
6029 GEN_ERROR("icmp operator returned null");
6030 delete (yyvsp[(3) - (6)].TypeVal);
6035 #line 2880 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6037 if (!UpRefs.empty())
6038 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6039 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6040 GEN_ERROR("Vector types not supported by fcmp instruction");
6041 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6043 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6045 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6046 if ((yyval.InstVal) == 0)
6047 GEN_ERROR("fcmp operator returned null");
6048 delete (yyvsp[(3) - (6)].TypeVal);
6053 #line 2894 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6055 if (!UpRefs.empty())
6056 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6057 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6058 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6059 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6060 GEN_ERROR("invalid cast opcode for cast from '" +
6061 Val->getType()->getDescription() + "' to '" +
6062 DestTy->getDescription() + "'");
6063 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6064 delete (yyvsp[(4) - (4)].TypeVal);
6069 #line 2906 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6071 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6072 GEN_ERROR("select condition must be boolean");
6073 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6074 GEN_ERROR("select value types should match");
6075 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6081 #line 2914 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6083 if (!UpRefs.empty())
6084 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6085 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6086 delete (yyvsp[(4) - (4)].TypeVal);
6092 #line 2921 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6094 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6095 GEN_ERROR("Invalid extractelement operands");
6096 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6102 #line 2927 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6104 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6105 GEN_ERROR("Invalid insertelement operands");
6106 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6112 #line 2933 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6114 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6115 GEN_ERROR("Invalid shufflevector operands");
6116 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6122 #line 2939 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6124 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6125 if (!Ty->isFirstClassType())
6126 GEN_ERROR("PHI node operands must be of first class type");
6127 (yyval.InstVal) = PHINode::Create(Ty);
6128 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6129 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6130 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6131 GEN_ERROR("All elements of a PHI node must be of the same type");
6132 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6133 (yyvsp[(2) - (2)].PHIList)->pop_front();
6135 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6141 #line 2955 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6144 // Handle the short syntax
6145 const PointerType *PFTy = 0;
6146 const FunctionType *Ty = 0;
6147 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6148 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6149 // Pull out the types of all of the arguments...
6150 std::vector<const Type*> ParamTypes;
6151 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6152 for (; I != E; ++I) {
6153 const Type *Ty = I->Val->getType();
6154 if (Ty == Type::VoidTy)
6155 GEN_ERROR("Short call syntax cannot be used with varargs");
6156 ParamTypes.push_back(Ty);
6159 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6160 GEN_ERROR("Invalid result type for LLVM function");
6162 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6163 PFTy = PointerType::getUnqual(Ty);
6166 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6169 // Check for call to invalid intrinsic to avoid crashing later.
6170 if (Function *theF = dyn_cast<Function>(V)) {
6171 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6172 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6173 !theF->getIntrinsicID(true))
6174 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6175 theF->getName() + "'");
6178 // Set up the ParamAttrs for the function
6179 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6180 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6181 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6182 // Check the arguments
6184 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6185 // Make sure no arguments is a good thing!
6186 if (Ty->getNumParams() != 0)
6187 GEN_ERROR("No arguments passed to a function that "
6188 "expects arguments");
6189 } else { // Has arguments?
6190 // Loop through FunctionType's arguments and ensure they are specified
6191 // correctly. Also, gather any parameter attributes.
6192 FunctionType::param_iterator I = Ty->param_begin();
6193 FunctionType::param_iterator E = Ty->param_end();
6194 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6197 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6198 if (ArgI->Val->getType() != *I)
6199 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6200 (*I)->getDescription() + "'");
6201 Args.push_back(ArgI->Val);
6202 if (ArgI->Attrs != ParamAttr::None)
6203 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6205 if (Ty->isVarArg()) {
6207 for (; ArgI != ArgE; ++ArgI, ++index) {
6208 Args.push_back(ArgI->Val); // push the remaining varargs
6209 if (ArgI->Attrs != ParamAttr::None)
6210 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6212 } else if (I != E || ArgI != ArgE)
6213 GEN_ERROR("Invalid number of parameters detected");
6216 // Finish off the ParamAttrs and check them
6219 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6221 // Create the call node
6222 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6223 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6224 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6225 CI->setParamAttrs(PAL);
6226 (yyval.InstVal) = CI;
6227 delete (yyvsp[(6) - (8)].ParamList);
6228 delete (yyvsp[(3) - (8)].TypeVal);
6234 #line 3044 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6236 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6242 #line 3049 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6244 (yyval.BoolVal) = true;
6250 #line 3053 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6252 (yyval.BoolVal) = false;
6258 #line 3060 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6260 if (!UpRefs.empty())
6261 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6262 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6263 delete (yyvsp[(2) - (3)].TypeVal);
6269 #line 3067 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6271 if (!UpRefs.empty())
6272 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6273 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6275 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6276 delete (yyvsp[(2) - (6)].TypeVal);
6281 #line 3075 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6283 if (!UpRefs.empty())
6284 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6285 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6286 delete (yyvsp[(2) - (3)].TypeVal);
6292 #line 3082 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6294 if (!UpRefs.empty())
6295 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6296 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6298 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6299 delete (yyvsp[(2) - (6)].TypeVal);
6304 #line 3090 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6306 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6307 GEN_ERROR("Trying to free nonpointer type " +
6308 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6309 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6315 #line 3098 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6317 if (!UpRefs.empty())
6318 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6319 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6320 GEN_ERROR("Can't load from nonpointer type: " +
6321 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6322 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6323 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6324 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6325 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6327 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6328 delete (yyvsp[(3) - (5)].TypeVal);
6333 #line 3112 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6335 if (!UpRefs.empty())
6336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6337 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6339 GEN_ERROR("Can't store to a nonpointer type: " +
6340 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6341 const Type *ElTy = PT->getElementType();
6342 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6343 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6344 "' into space of type '" + ElTy->getDescription() + "'");
6346 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6348 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6349 delete (yyvsp[(5) - (7)].TypeVal);
6354 #line 3129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6356 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6357 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6358 GEN_ERROR("Invalid getresult operands");
6359 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6360 delete (yyvsp[(2) - (5)].TypeVal);
6366 #line 3137 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6368 if (!UpRefs.empty())
6369 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6370 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6371 GEN_ERROR("getelementptr insn requires pointer operand");
6373 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6374 GEN_ERROR("Invalid getelementptr indices for type '" +
6375 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6376 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6378 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6379 delete (yyvsp[(2) - (4)].TypeVal);
6380 delete (yyvsp[(4) - (4)].ValueList);
6385 /* Line 1267 of yacc.c. */
6386 #line 6387 "llvmAsmParser.tab.c"
6389 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6393 YY_STACK_PRINT (yyss, yyssp);
6398 /* Now `shift' the result of the reduction. Determine what state
6399 that goes to, based on the state we popped back to and the rule
6400 number reduced by. */
6404 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6405 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6406 yystate = yytable[yystate];
6408 yystate = yydefgoto[yyn - YYNTOKENS];
6413 /*------------------------------------.
6414 | yyerrlab -- here on detecting error |
6415 `------------------------------------*/
6417 /* If not already recovering from an error, report this error. */
6421 #if ! YYERROR_VERBOSE
6422 yyerror (YY_("syntax error"));
6425 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6426 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6428 YYSIZE_T yyalloc = 2 * yysize;
6429 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6430 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6431 if (yymsg != yymsgbuf)
6432 YYSTACK_FREE (yymsg);
6433 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6435 yymsg_alloc = yyalloc;
6439 yymsg_alloc = sizeof yymsgbuf;
6443 if (0 < yysize && yysize <= yymsg_alloc)
6445 (void) yysyntax_error (yymsg, yystate, yychar);
6450 yyerror (YY_("syntax error"));
6452 goto yyexhaustedlab;
6460 if (yyerrstatus == 3)
6462 /* If just tried and failed to reuse look-ahead token after an
6463 error, discard it. */
6465 if (yychar <= YYEOF)
6467 /* Return failure if at end of input. */
6468 if (yychar == YYEOF)
6473 yydestruct ("Error: discarding",
6479 /* Else will try to reuse look-ahead token after shifting the error
6484 /*---------------------------------------------------.
6485 | yyerrorlab -- error raised explicitly by YYERROR. |
6486 `---------------------------------------------------*/
6489 /* Pacify compilers like GCC when the user code never invokes
6490 YYERROR and the label yyerrorlab therefore never appears in user
6492 if (/*CONSTCOND*/ 0)
6495 /* Do not reclaim the symbols of the rule which action triggered
6499 YY_STACK_PRINT (yyss, yyssp);
6504 /*-------------------------------------------------------------.
6505 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6506 `-------------------------------------------------------------*/
6508 yyerrstatus = 3; /* Each real token shifted decrements this. */
6512 yyn = yypact[yystate];
6513 if (yyn != YYPACT_NINF)
6516 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6524 /* Pop the current state because it cannot handle the error token. */
6529 yydestruct ("Error: popping",
6530 yystos[yystate], yyvsp);
6533 YY_STACK_PRINT (yyss, yyssp);
6542 /* Shift the error token. */
6543 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6549 /*-------------------------------------.
6550 | yyacceptlab -- YYACCEPT comes here. |
6551 `-------------------------------------*/
6556 /*-----------------------------------.
6557 | yyabortlab -- YYABORT comes here. |
6558 `-----------------------------------*/
6564 /*-------------------------------------------------.
6565 | yyexhaustedlab -- memory exhaustion comes here. |
6566 `-------------------------------------------------*/
6568 yyerror (YY_("memory exhausted"));
6574 if (yychar != YYEOF && yychar != YYEMPTY)
6575 yydestruct ("Cleanup: discarding lookahead",
6577 /* Do not reclaim the symbols of the rule which action triggered
6578 this YYABORT or YYACCEPT. */
6580 YY_STACK_PRINT (yyss, yyssp);
6581 while (yyssp != yyss)
6583 yydestruct ("Cleanup: popping",
6584 yystos[*yyssp], yyvsp);
6589 YYSTACK_FREE (yyss);
6592 if (yymsg != yymsgbuf)
6593 YYSTACK_FREE (yymsg);
6595 /* Make sure YYID is used. */
6596 return YYID (yyresult);
6600 #line 3154 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
6603 // common code from the two 'RunVMAsmParser' functions
6604 static Module* RunParser(Module * M) {
6605 CurModule.CurrentModule = M;
6606 // Check to make sure the parser succeeded
6609 delete ParserResult;
6613 // Emit an error if there are any unresolved types left.
6614 if (!CurModule.LateResolveTypes.empty()) {
6615 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6616 if (DID.Type == ValID::LocalName) {
6617 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6619 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6622 delete ParserResult;
6626 // Emit an error if there are any unresolved values left.
6627 if (!CurModule.LateResolveValues.empty()) {
6628 Value *V = CurModule.LateResolveValues.back();
6629 std::map<Value*, std::pair<ValID, int> >::iterator I =
6630 CurModule.PlaceHolderInfo.find(V);
6632 if (I != CurModule.PlaceHolderInfo.end()) {
6633 ValID &DID = I->second.first;
6634 if (DID.Type == ValID::LocalName) {
6635 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6637 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6640 delete ParserResult;
6645 // Check to make sure that parsing produced a result
6649 // Reset ParserResult variable while saving its value for the result.
6650 Module *Result = ParserResult;
6656 void llvm::GenerateError(const std::string &message, int LineNo) {
6657 if (LineNo == -1) LineNo = LLLgetLineNo();
6658 // TODO: column number in exception
6660 TheParseError->setError(LLLgetFilename(), message, LineNo);
6664 int yyerror(const char *ErrorMsg) {
6665 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6666 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6667 if (yychar != YYEMPTY && yychar != 0) {
6668 errMsg += " while reading token: '";
6669 errMsg += std::string(LLLgetTokenStart(),
6670 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6672 GenerateError(errMsg);