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 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
383 #include "ParserInternals.h"
384 #include "llvm/CallingConv.h"
385 #include "llvm/InlineAsm.h"
386 #include "llvm/Instructions.h"
387 #include "llvm/Module.h"
388 #include "llvm/ValueSymbolTable.h"
389 #include "llvm/AutoUpgrade.h"
390 #include "llvm/Support/GetElementPtrTypeIterator.h"
391 #include "llvm/Support/CommandLine.h"
392 #include "llvm/ADT/SmallVector.h"
393 #include "llvm/ADT/STLExtras.h"
394 #include "llvm/Support/MathExtras.h"
395 #include "llvm/Support/Streams.h"
401 // The following is a gross hack. In order to rid the libAsmParser library of
402 // exceptions, we have to have a way of getting the yyparse function to go into
403 // an error situation. So, whenever we want an error to occur, the GenerateError
404 // function (see bottom of file) sets TriggerError. Then, at the end of each
405 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
406 // (a goto) to put YACC in error state. Furthermore, several calls to
407 // GenerateError are made from inside productions and they must simulate the
408 // previous exception behavior by exiting the production immediately. We have
409 // replaced these with the GEN_ERROR macro which calls GeneratError and then
410 // immediately invokes YYERROR. This would be so much cleaner if it was a
411 // recursive descent parser.
412 static bool TriggerError = false;
413 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
414 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
416 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
417 int yylex(); // declaration" of xxx warnings.
419 using namespace llvm;
421 static Module *ParserResult;
423 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
424 // relating to upreferences in the input stream.
426 //#define DEBUG_UPREFS 1
428 #define UR_OUT(X) cerr << X
433 #define YYERROR_VERBOSE 1
435 static GlobalVariable *CurGV;
438 // This contains info used when building the body of a function. It is
439 // destroyed when the function is completed.
441 typedef std::vector<Value *> ValueList; // Numbered defs
444 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
446 static struct PerModuleInfo {
447 Module *CurrentModule;
448 ValueList Values; // Module level numbered definitions
449 ValueList LateResolveValues;
450 std::vector<PATypeHolder> Types;
451 std::map<ValID, PATypeHolder> LateResolveTypes;
453 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
454 /// how they were referenced and on which line of the input they came from so
455 /// that we can resolve them later and print error messages as appropriate.
456 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
458 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
459 // references to global values. Global values may be referenced before they
460 // are defined, and if so, the temporary object that they represent is held
461 // here. This is used for forward references of GlobalValues.
463 typedef std::map<std::pair<const PointerType *,
464 ValID>, GlobalValue*> GlobalRefsType;
465 GlobalRefsType GlobalRefs;
468 // If we could not resolve some functions at function compilation time
469 // (calls to functions before they are defined), resolve them now... Types
470 // are resolved when the constant pool has been completely parsed.
472 ResolveDefinitions(LateResolveValues);
476 // Check to make sure that all global value forward references have been
479 if (!GlobalRefs.empty()) {
480 std::string UndefinedReferences = "Unresolved global references exist:\n";
482 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
484 UndefinedReferences += " " + I->first.first->getDescription() + " " +
485 I->first.second.getName() + "\n";
487 GenerateError(UndefinedReferences);
491 // Look for intrinsic functions and CallInst that need to be upgraded
492 for (Module::iterator FI = CurrentModule->begin(),
493 FE = CurrentModule->end(); FI != FE; )
494 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
496 Values.clear(); // Clear out function local definitions
501 // GetForwardRefForGlobal - Check to see if there is a forward reference
502 // for this global. If so, remove it from the GlobalRefs map and return it.
503 // If not, just return null.
504 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
505 // Check to see if there is a forward reference to this global variable...
506 // if there is, eliminate it and patch the reference to use the new def'n.
507 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
508 GlobalValue *Ret = 0;
509 if (I != GlobalRefs.end()) {
516 bool TypeIsUnresolved(PATypeHolder* PATy) {
517 // If it isn't abstract, its resolved
518 const Type* Ty = PATy->get();
519 if (!Ty->isAbstract())
521 // Traverse the type looking for abstract types. If it isn't abstract then
522 // we don't need to traverse that leg of the type.
523 std::vector<const Type*> WorkList, SeenList;
524 WorkList.push_back(Ty);
525 while (!WorkList.empty()) {
526 const Type* Ty = WorkList.back();
527 SeenList.push_back(Ty);
529 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
530 // Check to see if this is an unresolved type
531 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
532 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
533 for ( ; I != E; ++I) {
534 if (I->second.get() == OpTy)
537 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
538 const Type* TheTy = SeqTy->getElementType();
539 if (TheTy->isAbstract() && TheTy != Ty) {
540 std::vector<const Type*>::iterator I = SeenList.begin(),
546 WorkList.push_back(TheTy);
548 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
549 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
550 const Type* TheTy = StrTy->getElementType(i);
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
558 WorkList.push_back(TheTy);
567 static struct PerFunctionInfo {
568 Function *CurrentFunction; // Pointer to current function being created
570 ValueList Values; // Keep track of #'d definitions
572 ValueList LateResolveValues;
573 bool isDeclare; // Is this function a forward declararation?
574 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
575 GlobalValue::VisibilityTypes Visibility;
577 /// BBForwardRefs - When we see forward references to basic blocks, keep
578 /// track of them here.
579 std::map<ValID, BasicBlock*> BBForwardRefs;
581 inline PerFunctionInfo() {
584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
588 inline void FunctionStart(Function *M) {
593 void FunctionDone() {
594 // Any forward referenced blocks left?
595 if (!BBForwardRefs.empty()) {
596 GenerateError("Undefined reference to label " +
597 BBForwardRefs.begin()->second->getName());
601 // Resolve all forward references now.
602 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
604 Values.clear(); // Clear out function local definitions
605 BBForwardRefs.clear();
608 Linkage = GlobalValue::ExternalLinkage;
609 Visibility = GlobalValue::DefaultVisibility;
611 } CurFun; // Info for the current function...
613 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
616 //===----------------------------------------------------------------------===//
617 // Code to handle definitions of all the types
618 //===----------------------------------------------------------------------===//
620 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
621 // Things that have names or are void typed don't get slot numbers
622 if (V->hasName() || (V->getType() == Type::VoidTy))
625 // In the case of function values, we have to allow for the forward reference
626 // of basic blocks, which are included in the numbering. Consequently, we keep
627 // track of the next insertion location with NextValNum. When a BB gets
628 // inserted, it could change the size of the CurFun.Values vector.
629 if (&ValueTab == &CurFun.Values) {
630 if (ValueTab.size() <= CurFun.NextValNum)
631 ValueTab.resize(CurFun.NextValNum+1);
632 ValueTab[CurFun.NextValNum++] = V;
635 // For all other lists, its okay to just tack it on the back of the vector.
636 ValueTab.push_back(V);
639 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
641 case ValID::LocalID: // Is it a numbered definition?
642 // Module constants occupy the lowest numbered slots...
643 if (D.Num < CurModule.Types.size())
644 return CurModule.Types[D.Num];
646 case ValID::LocalName: // Is it a named definition?
647 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
648 D.destroy(); // Free old strdup'd memory...
653 GenerateError("Internal parser error: Invalid symbol type reference");
657 // If we reached here, we referenced either a symbol that we don't know about
658 // or an id number that hasn't been read yet. We may be referencing something
659 // forward, so just create an entry to be resolved later and get to it...
661 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
664 if (inFunctionScope()) {
665 if (D.Type == ValID::LocalName) {
666 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
669 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
674 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
675 if (I != CurModule.LateResolveTypes.end())
678 Type *Typ = OpaqueType::get();
679 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
683 // getExistingVal - Look up the value specified by the provided type and
684 // the provided ValID. If the value exists and has already been defined, return
685 // it. Otherwise return null.
687 static Value *getExistingVal(const Type *Ty, const ValID &D) {
688 if (isa<FunctionType>(Ty)) {
689 GenerateError("Functions are not values and "
690 "must be referenced as pointers");
695 case ValID::LocalID: { // Is it a numbered definition?
696 // Check that the number is within bounds.
697 if (D.Num >= CurFun.Values.size())
699 Value *Result = CurFun.Values[D.Num];
700 if (Ty != Result->getType()) {
701 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
702 Result->getType()->getDescription() + "' does not match "
703 "expected type, '" + Ty->getDescription() + "'");
708 case ValID::GlobalID: { // Is it a numbered definition?
709 if (D.Num >= CurModule.Values.size())
711 Value *Result = CurModule.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
721 case ValID::LocalName: { // Is it a named definition?
722 if (!inFunctionScope())
724 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
725 Value *N = SymTab.lookup(D.getName());
728 if (N->getType() != Ty)
731 D.destroy(); // Free old strdup'd memory...
734 case ValID::GlobalName: { // Is it a named definition?
735 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
736 Value *N = SymTab.lookup(D.getName());
739 if (N->getType() != Ty)
742 D.destroy(); // Free old strdup'd memory...
746 // Check to make sure that "Ty" is an integral type, and that our
747 // value will fit into the specified type...
748 case ValID::ConstSIntVal: // Is it a constant pool reference??
749 if (!isa<IntegerType>(Ty) ||
750 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
751 GenerateError("Signed integral constant '" +
752 itostr(D.ConstPool64) + "' is invalid for type '" +
753 Ty->getDescription() + "'");
756 return ConstantInt::get(Ty, D.ConstPool64, true);
758 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
759 if (isa<IntegerType>(Ty) &&
760 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
761 return ConstantInt::get(Ty, D.UConstPool64);
763 if (!isa<IntegerType>(Ty) ||
764 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
765 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
766 "' is invalid or out of range for type '" +
767 Ty->getDescription() + "'");
770 // This is really a signed reference. Transmogrify.
771 return ConstantInt::get(Ty, D.ConstPool64, true);
773 case ValID::ConstFPVal: // Is it a floating point const pool reference?
774 if (!Ty->isFloatingPoint() ||
775 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
776 GenerateError("FP constant invalid for type");
779 // Lexer has no type info, so builds all float and double FP constants
780 // as double. Fix this here. Long double does not need this.
781 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
783 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
784 return ConstantFP::get(Ty, *D.ConstPoolFP);
786 case ValID::ConstNullVal: // Is it a null value?
787 if (!isa<PointerType>(Ty)) {
788 GenerateError("Cannot create a a non pointer null");
791 return ConstantPointerNull::get(cast<PointerType>(Ty));
793 case ValID::ConstUndefVal: // Is it an undef value?
794 return UndefValue::get(Ty);
796 case ValID::ConstZeroVal: // Is it a zero value?
797 return Constant::getNullValue(Ty);
799 case ValID::ConstantVal: // Fully resolved constant?
800 if (D.ConstantValue->getType() != Ty) {
801 GenerateError("Constant expression type different from required type");
804 return D.ConstantValue;
806 case ValID::InlineAsmVal: { // Inline asm expression
807 const PointerType *PTy = dyn_cast<PointerType>(Ty);
808 const FunctionType *FTy =
809 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
810 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
811 GenerateError("Invalid type for asm constraint string");
814 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
815 D.IAD->HasSideEffects);
816 D.destroy(); // Free InlineAsmDescriptor.
820 assert(0 && "Unhandled case!");
824 assert(0 && "Unhandled case!");
828 // getVal - This function is identical to getExistingVal, except that if a
829 // value is not already defined, it "improvises" by creating a placeholder var
830 // that looks and acts just like the requested variable. When the value is
831 // defined later, all uses of the placeholder variable are replaced with the
834 static Value *getVal(const Type *Ty, const ValID &ID) {
835 if (Ty == Type::LabelTy) {
836 GenerateError("Cannot use a basic block here");
840 // See if the value has already been defined.
841 Value *V = getExistingVal(Ty, ID);
843 if (TriggerError) return 0;
845 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
846 GenerateError("Invalid use of a composite type");
850 // If we reached here, we referenced either a symbol that we don't know about
851 // or an id number that hasn't been read yet. We may be referencing something
852 // forward, so just create an entry to be resolved later and get to it...
855 case ValID::GlobalName:
856 case ValID::GlobalID: {
857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
859 GenerateError("Invalid type for reference to global" );
862 const Type* ElTy = PTy->getElementType();
863 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
864 V = new Function(FTy, GlobalValue::ExternalLinkage);
866 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
867 (Module*)0, false, PTy->getAddressSpace());
871 V = new Argument(Ty);
874 // Remember where this forward reference came from. FIXME, shouldn't we try
875 // to recycle these things??
876 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
879 if (inFunctionScope())
880 InsertValue(V, CurFun.LateResolveValues);
882 InsertValue(V, CurModule.LateResolveValues);
886 /// defineBBVal - This is a definition of a new basic block with the specified
887 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
888 static BasicBlock *defineBBVal(const ValID &ID) {
889 assert(inFunctionScope() && "Can't get basic block at global scope!");
893 // First, see if this was forward referenced
895 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
896 if (BBI != CurFun.BBForwardRefs.end()) {
898 // The forward declaration could have been inserted anywhere in the
899 // function: insert it into the correct place now.
900 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
901 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
903 // We're about to erase the entry, save the key so we can clean it up.
904 ValID Tmp = BBI->first;
906 // Erase the forward ref from the map as its no longer "forward"
907 CurFun.BBForwardRefs.erase(ID);
909 // The key has been removed from the map but so we don't want to leave
910 // strdup'd memory around so destroy it too.
913 // If its a numbered definition, bump the number and set the BB value.
914 if (ID.Type == ValID::LocalID) {
915 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
923 // We haven't seen this BB before and its first mention is a definition.
924 // Just create it and return it.
925 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
926 BB = new BasicBlock(Name, CurFun.CurrentFunction);
927 if (ID.Type == ValID::LocalID) {
928 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
932 ID.destroy(); // Free strdup'd memory
936 /// getBBVal - get an existing BB value or create a forward reference for it.
938 static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
946 } if (ID.Type == ValID::LocalName) {
947 std::string Name = ID.getName();
948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
966 GenerateError("Illegal label reference " + ID.getName());
970 // If its already been defined, return it now.
972 ID.destroy(); // Free strdup'd memory.
976 // Otherwise, this block has not been seen before, create it.
978 if (ID.Type == ValID::LocalName)
980 BB = new BasicBlock(Name, CurFun.CurrentFunction);
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
989 //===----------------------------------------------------------------------===//
990 // Code to handle forward references in instructions
991 //===----------------------------------------------------------------------===//
993 // This code handles the late binding needed with statements that reference
994 // values not defined yet... for example, a forward branch, or the PHI node for
997 // This keeps a table (CurFun.LateResolveValues) of all such forward references
998 // and back patchs after we are done.
1001 // ResolveDefinitions - If we could not resolve some defs at parsing
1002 // time (forward branches, phi functions for loops, etc...) resolve the
1006 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
1012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1016 ValID &DID = PHI->second.first;
1018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1022 V->replaceAllUsesWith(TheRealValue);
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1028 InsertValue(V, *FutureLateResolvers);
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
1036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1044 LateResolvers.clear();
1047 // ResolveTypeTo - A brand new type was just declared. This means that (if
1048 // name is not null) things referencing Name can be resolved. Otherwise, things
1049 // refering to the number can be resolved. Do this now.
1051 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1054 D = ValID::createLocalName(*Name);
1056 D = ValID::createLocalID(CurModule.Types.size());
1058 std::map<ValID, PATypeHolder>::iterator I =
1059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
1061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1062 CurModule.LateResolveTypes.erase(I);
1066 // setValueName - Set the specified value to the name given. The name may be
1067 // null potentially, in which case this is a noop. The string passed in is
1068 // assumed to be a malloc'd string buffer, and is free'd by this function.
1070 static void setValueName(Value *V, std::string *NameStr) {
1071 if (!NameStr) return;
1072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
1075 if (V->getType() == Type::VoidTy) {
1076 GenerateError("Can't assign name '" + Name+"' to value with void type");
1080 assert(inFunctionScope() && "Must be in function scope!");
1081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
1083 GenerateError("Redefinition of value '" + Name + "' of type '" +
1084 V->getType()->getDescription() + "'");
1092 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093 /// this is a declaration, otherwise it is a definition.
1094 static GlobalVariable *
1095 ParseGlobalVariable(std::string *NameStr,
1096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
1098 bool isConstantGlobal, const Type *Ty,
1099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
1101 if (isa<FunctionType>(Ty)) {
1102 GenerateError("Cannot declare global vars of function type");
1106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
1114 // See if this global value was forward referenced. If so, recycle the
1117 if (!Name.empty()) {
1118 ID = ValID::createGlobalName(Name);
1120 ID = ValID::createGlobalID(CurModule.Values.size());
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
1131 GV->setVisibility(Visibility);
1132 GV->setConstant(isConstantGlobal);
1133 GV->setThreadLocal(IsThreadLocal);
1134 InsertValue(GV, CurModule.Values);
1138 // If this global has a name
1139 if (!Name.empty()) {
1140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1159 GV->setVisibility(Visibility);
1160 InsertValue(GV, CurModule.Values);
1164 // setTypeName - Set the specified type to the name given. The name may be
1165 // null potentially, in which case this is a noop. The string passed in is
1166 // assumed to be a malloc'd string buffer, and is freed by this function.
1168 // This function returns true if the type has already been defined, but is
1169 // allowed to be redefined in the specified context. If the name is a new name
1170 // for the type plane, it is inserted and false is returned.
1171 static bool setTypeName(const Type *T, std::string *NameStr) {
1172 assert(!inFunctionScope() && "Can't give types function-local names!");
1173 if (NameStr == 0) return false;
1175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
1178 // We don't allow assigning names to void type
1179 if (T == Type::VoidTy) {
1180 GenerateError("Can't assign name '" + Name + "' to the void type");
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1189 assert(Existing && "Conflict but no matching type?!");
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1205 // Any other kind of (non-equivalent) redefinition is an error.
1206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1207 T->getDescription() + "'");
1213 //===----------------------------------------------------------------------===//
1214 // Code for handling upreferences in type names...
1217 // TypeContains - Returns true if Ty directly contains E in it.
1219 static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1243 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1244 static std::vector<UpRefRecord> UpRefs;
1246 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1247 /// called. It loops through the UpRefs vector, which is a list of the
1248 /// currently active types. For each type, if the up reference is contained in
1249 /// the newly completed type, we decrement the level count. When the level
1250 /// count reaches zero, the upreferenced type is the type that is passed in:
1251 /// thus we can complete the cycle.
1253 static PATypeHolder HandleUpRefs(const Type *ty) {
1254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1267 OpaqueType *TypeToResolve = 0;
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1305 //===----------------------------------------------------------------------===//
1306 // RunVMAsmParser - Define an interface to this parser
1307 //===----------------------------------------------------------------------===//
1309 static Module* RunParser(Module * M);
1311 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1320 /* Enabling traces. */
1325 /* Enabling verbose error messages. */
1326 #ifdef YYERROR_VERBOSE
1327 # undef YYERROR_VERBOSE
1328 # define YYERROR_VERBOSE 1
1330 # define YYERROR_VERBOSE 0
1333 /* Enabling the token table. */
1334 #ifndef YYTOKEN_TABLE
1335 # define YYTOKEN_TABLE 0
1338 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339 typedef union YYSTYPE
1340 #line 952 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
1342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
1344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
1347 llvm::Constant *ConstVal;
1349 const llvm::Type *PrimType;
1350 std::list<llvm::PATypeHolder> *TypeList;
1351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
1353 std::vector<llvm::Value*> *ValueList;
1354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
1357 llvm::ParamList *ParamList;
1359 // Represent the RHS of PHI node
1360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
1362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1363 std::vector<llvm::Constant*> *ConstVector;
1365 llvm::GlobalValue::LinkageTypes Linkage;
1366 llvm::GlobalValue::VisibilityTypes Visibility;
1367 llvm::ParameterAttributes ParamAttrs;
1368 llvm::APInt *APIntVal;
1373 llvm::APFloat *FPVal;
1376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
1387 /* Line 187 of yacc.c. */
1388 #line 1389 "llvmAsmParser.tab.c"
1390 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391 # define YYSTYPE_IS_DECLARED 1
1392 # define YYSTYPE_IS_TRIVIAL 1
1397 /* Copy the second part of user declarations. */
1400 /* Line 216 of yacc.c. */
1401 #line 1402 "llvmAsmParser.tab.c"
1408 typedef YYTYPE_UINT8 yytype_uint8;
1410 typedef unsigned char yytype_uint8;
1414 typedef YYTYPE_INT8 yytype_int8;
1415 #elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417 typedef signed char yytype_int8;
1419 typedef short int yytype_int8;
1422 #ifdef YYTYPE_UINT16
1423 typedef YYTYPE_UINT16 yytype_uint16;
1425 typedef unsigned short int yytype_uint16;
1429 typedef YYTYPE_INT16 yytype_int16;
1431 typedef short int yytype_int16;
1435 # ifdef __SIZE_TYPE__
1436 # define YYSIZE_T __SIZE_TYPE__
1437 # elif defined size_t
1438 # define YYSIZE_T size_t
1439 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442 # define YYSIZE_T size_t
1444 # define YYSIZE_T unsigned int
1448 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1453 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1458 # define YY_(msgid) msgid
1462 /* Suppress unused-variable warnings by "using" E. */
1463 #if ! defined lint || defined __GNUC__
1464 # define YYUSE(e) ((void) (e))
1466 # define YYUSE(e) /* empty */
1469 /* Identity function, used to suppress warnings about constant conditions. */
1471 # define YYID(n) (n)
1473 #if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1487 #if ! defined yyoverflow || YYERROR_VERBOSE
1489 /* The parser invokes alloca or malloc; define the necessary symbols. */
1491 # ifdef YYSTACK_USE_ALLOCA
1492 # if YYSTACK_USE_ALLOCA
1494 # define YYSTACK_ALLOC __builtin_alloca
1495 # elif defined __BUILTIN_VA_ARG_INCR
1496 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1498 # define YYSTACK_ALLOC __alloca
1499 # elif defined _MSC_VER
1500 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501 # define alloca _alloca
1503 # define YYSTACK_ALLOC alloca
1504 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1508 # define _STDLIB_H 1
1515 # ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518 # ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1526 # define YYSTACK_ALLOC YYMALLOC
1527 # define YYSTACK_FREE YYFREE
1528 # ifndef YYSTACK_ALLOC_MAXIMUM
1529 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1531 # if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1536 # define _STDLIB_H 1
1540 # define YYMALLOC malloc
1541 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1547 # define YYFREE free
1548 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550 void free (void *); /* INFRINGES ON USER NAME SPACE */
1554 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1557 #if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1561 /* A type that is properly aligned for any stack member. */
1568 /* The size of the maximum gap between one aligned stack and the next. */
1569 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1571 /* The size of an array large to enough to hold all stacks, each with
1573 # define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1577 /* Copy COUNT objects from FROM to TO. The source and destination do
1580 # if defined __GNUC__ && 1 < __GNUC__
1581 # define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1584 # define YYCOPY(To, From, Count) \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1595 /* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1600 # define YYSTACK_RELOCATE(Stack) \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1613 /* YYFINAL -- State number of the termination state. */
1615 /* YYLAST -- Last index in YYTABLE. */
1618 /* YYNTOKENS -- Number of terminals. */
1619 #define YYNTOKENS 165
1620 /* YYNNTS -- Number of nonterminals. */
1622 /* YYNRULES -- Number of rules. */
1623 #define YYNRULES 319
1624 /* YYNRULES -- Number of states. */
1625 #define YYNSTATES 624
1627 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628 #define YYUNDEFTOK 2
1629 #define YYMAXUTOK 405
1631 #define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1634 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635 static const yytype_uint8 yytranslate[] =
1637 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1677 145, 146, 147, 148, 149, 150
1681 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1683 static const yytype_uint16 yyprhs[] =
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1696 216, 218, 220, 222, 224, 225, 228, 230, 232, 234,
1697 236, 238, 240, 241, 244, 245, 248, 249, 252, 253,
1698 257, 260, 261, 263, 264, 268, 270, 273, 275, 277,
1699 279, 281, 283, 285, 287, 289, 291, 295, 297, 300,
1700 306, 312, 318, 324, 328, 331, 337, 342, 345, 347,
1701 349, 351, 355, 357, 361, 363, 364, 366, 370, 375,
1702 379, 383, 388, 393, 397, 404, 410, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 453,
1704 459, 468, 475, 482, 490, 498, 505, 514, 523, 527,
1705 529, 531, 533, 535, 536, 539, 546, 548, 549, 551,
1706 554, 555, 559, 560, 564, 568, 572, 576, 577, 586,
1707 587, 597, 598, 608, 614, 617, 621, 623, 627, 631,
1708 635, 639, 641, 642, 648, 652, 654, 658, 660, 661,
1709 672, 674, 676, 681, 683, 685, 688, 692, 693, 695,
1710 697, 699, 701, 703, 705, 707, 709, 711, 715, 717,
1711 723, 725, 727, 729, 731, 733, 735, 738, 741, 744,
1712 748, 751, 752, 754, 757, 760, 764, 774, 784, 793,
1713 808, 810, 812, 819, 825, 828, 835, 843, 848, 853,
1714 860, 867, 868, 869, 873, 876, 878, 884, 890, 897,
1715 904, 909, 916, 921, 926, 933, 940, 943, 952, 954,
1716 956, 957, 961, 968, 972, 979, 982, 988, 996, 1002
1719 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1720 static const yytype_int16 yyrhs[] =
1722 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
1723 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1724 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1725 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1726 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1727 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1728 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1729 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1730 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1731 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1732 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1733 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1734 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1735 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1736 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
1737 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1738 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1739 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
1740 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1741 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1742 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1743 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
1744 143, -1, 144, -1, -1, 188, 187, -1, 138, -1,
1745 141, -1, 137, -1, 136, -1, 145, -1, 146, -1,
1746 -1, 190, 189, -1, -1, 147, 22, -1, -1, 53,
1747 4, -1, -1, 154, 53, 4, -1, 34, 22, -1,
1748 -1, 194, -1, -1, 154, 197, 196, -1, 194, -1,
1749 53, 4, -1, 11, -1, 12, -1, 13, -1, 16,
1750 -1, 15, -1, 14, -1, 17, -1, 49, -1, 198,
1751 -1, 199, 175, 155, -1, 233, -1, 156, 4, -1,
1752 199, 151, 203, 152, 190, -1, 10, 151, 203, 152,
1753 190, -1, 157, 4, 158, 199, 159, -1, 160, 4,
1754 158, 199, 161, -1, 162, 204, 163, -1, 162, 163,
1755 -1, 160, 162, 204, 163, 161, -1, 160, 162, 163,
1756 161, -1, 199, 188, -1, 199, -1, 10, -1, 200,
1757 -1, 202, 154, 200, -1, 202, -1, 202, 154, 39,
1758 -1, 39, -1, -1, 199, -1, 204, 154, 199, -1,
1759 199, 157, 207, 159, -1, 199, 157, 159, -1, 199,
1760 164, 22, -1, 199, 160, 207, 161, -1, 199, 162,
1761 207, 163, -1, 199, 162, 163, -1, 199, 160, 162,
1762 207, 163, 161, -1, 199, 160, 162, 163, 161, -1,
1763 199, 40, -1, 199, 41, -1, 199, 233, -1, 199,
1764 206, -1, 199, 25, -1, 171, 3, -1, 171, 5,
1765 -1, 171, 4, -1, 171, 6, -1, 11, 26, -1,
1766 11, 27, -1, 172, 9, -1, 168, 151, 205, 38,
1767 199, 152, -1, 116, 151, 205, 244, 152, -1, 130,
1768 151, 205, 154, 205, 154, 205, 152, -1, 166, 151,
1769 205, 154, 205, 152, -1, 167, 151, 205, 154, 205,
1770 152, -1, 89, 169, 151, 205, 154, 205, 152, -1,
1771 90, 170, 151, 205, 154, 205, 152, -1, 132, 151,
1772 205, 154, 205, 152, -1, 133, 151, 205, 154, 205,
1773 154, 205, 152, -1, 134, 151, 205, 154, 205, 154,
1774 205, 152, -1, 207, 154, 205, -1, 205, -1, 32,
1775 -1, 33, -1, 37, -1, -1, 201, 233, -1, 122,
1776 151, 210, 38, 199, 152, -1, 212, -1, -1, 213,
1777 -1, 212, 213, -1, -1, 31, 214, 229, -1, -1,
1778 30, 215, 230, -1, 59, 58, 219, -1, 176, 18,
1779 199, -1, 176, 18, 10, -1, -1, 178, 182, 209,
1780 208, 205, 175, 216, 196, -1, -1, 178, 180, 182,
1781 209, 208, 205, 175, 217, 196, -1, -1, 178, 181,
1782 182, 209, 208, 199, 175, 218, 196, -1, 178, 182,
1783 35, 185, 210, -1, 51, 220, -1, 55, 153, 221,
1784 -1, 22, -1, 52, 153, 22, -1, 67, 153, 22,
1785 -1, 157, 222, 159, -1, 222, 154, 22, -1, 22,
1786 -1, -1, 223, 154, 199, 188, 174, -1, 199, 188,
1787 174, -1, 223, -1, 223, 154, 39, -1, 39, -1,
1788 -1, 186, 201, 177, 151, 224, 152, 190, 195, 192,
1789 191, -1, 28, -1, 162, -1, 184, 182, 225, 226,
1790 -1, 29, -1, 163, -1, 236, 228, -1, 183, 182,
1791 225, -1, -1, 60, -1, 3, -1, 4, -1, 9,
1792 -1, 26, -1, 27, -1, 40, -1, 41, -1, 25,
1793 -1, 160, 207, 161, -1, 206, -1, 58, 231, 22,
1794 154, 22, -1, 7, -1, 8, -1, 173, -1, 177,
1795 -1, 233, -1, 232, -1, 199, 234, -1, 236, 237,
1796 -1, 227, 237, -1, 238, 176, 239, -1, 238, 241,
1797 -1, -1, 21, -1, 68, 235, -1, 68, 10, -1,
1798 69, 17, 234, -1, 69, 11, 234, 154, 17, 234,
1799 154, 17, 234, -1, 70, 171, 234, 154, 17, 234,
1800 157, 240, 159, -1, 70, 171, 234, 154, 17, 234,
1801 157, 159, -1, 71, 186, 201, 234, 151, 243, 152,
1802 190, 38, 17, 234, 72, 17, 234, -1, 72, -1,
1803 73, -1, 240, 171, 232, 154, 17, 234, -1, 171,
1804 232, 154, 17, 234, -1, 176, 246, -1, 199, 157,
1805 234, 154, 234, 159, -1, 242, 154, 157, 234, 154,
1806 234, 159, -1, 199, 188, 234, 188, -1, 17, 188,
1807 234, 188, -1, 243, 154, 199, 188, 234, 188, -1,
1808 243, 154, 17, 188, 234, 188, -1, -1, -1, 244,
1809 154, 235, -1, 57, 56, -1, 56, -1, 166, 199,
1810 234, 154, 234, -1, 167, 199, 234, 154, 234, -1,
1811 89, 169, 199, 234, 154, 234, -1, 90, 170, 199,
1812 234, 154, 234, -1, 168, 235, 38, 199, -1, 130,
1813 235, 154, 235, 154, 235, -1, 131, 235, 154, 199,
1814 -1, 132, 235, 154, 235, -1, 133, 235, 154, 235,
1815 154, 235, -1, 134, 235, 154, 235, 154, 235, -1,
1816 129, 242, -1, 245, 186, 201, 234, 151, 243, 152,
1817 190, -1, 248, -1, 36, -1, -1, 111, 199, 193,
1818 -1, 111, 199, 154, 11, 234, 193, -1, 112, 199,
1819 193, -1, 112, 199, 154, 11, 234, 193, -1, 113,
1820 235, -1, 247, 114, 199, 234, 193, -1, 247, 115,
1821 235, 154, 199, 234, 193, -1, 135, 199, 173, 154,
1822 205, -1, 116, 199, 234, 244, -1
1825 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1826 static const yytype_uint16 yyrline[] =
1828 0, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
1829 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115,
1830 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1116, 1116, 1119,
1831 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1127,
1832 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132,
1833 1132, 1133, 1133, 1134, 1135, 1140, 1141, 1141, 1141, 1141,
1834 1141, 1143, 1143, 1143, 1144, 1144, 1146, 1147, 1151, 1155,
1835 1160, 1160, 1162, 1163, 1168, 1174, 1175, 1176, 1177, 1178,
1836 1182, 1183, 1184, 1188, 1189, 1190, 1191, 1195, 1196, 1197,
1837 1201, 1202, 1203, 1204, 1205, 1209, 1210, 1211, 1214, 1215,
1838 1216, 1217, 1218, 1219, 1220, 1227, 1228, 1229, 1230, 1231,
1839 1232, 1233, 1234, 1235, 1238, 1239, 1244, 1245, 1246, 1247,
1840 1248, 1249, 1252, 1253, 1258, 1259, 1266, 1267, 1273, 1274,
1841 1283, 1291, 1292, 1297, 1298, 1299, 1304, 1317, 1317, 1317,
1842 1317, 1317, 1317, 1317, 1320, 1324, 1328, 1335, 1340, 1348,
1843 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449, 1458, 1465,
1844 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511, 1523, 1551,
1845 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726, 1733, 1799,
1846 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861, 1874, 1886,
1847 1908, 1916, 1922, 1933, 1938, 1943, 1949, 1955, 1964, 1968,
1848 1976, 1976, 1979, 1979, 1982, 1994, 2015, 2020, 2028, 2029,
1849 2033, 2033, 2037, 2037, 2040, 2043, 2067, 2079, 2078, 2090,
1850 2089, 2099, 2098, 2109, 2149, 2152, 2158, 2168, 2172, 2177,
1851 2179, 2184, 2189, 2198, 2208, 2219, 2223, 2232, 2241, 2246,
1852 2380, 2380, 2382, 2391, 2391, 2393, 2398, 2410, 2414, 2419,
1853 2423, 2427, 2431, 2435, 2439, 2443, 2447, 2451, 2476, 2480,
1854 2490, 2494, 2498, 2503, 2510, 2510, 2516, 2525, 2529, 2538,
1855 2547, 2556, 2560, 2567, 2571, 2575, 2580, 2590, 2609, 2618,
1856 2709, 2713, 2720, 2731, 2744, 2754, 2765, 2775, 2786, 2794,
1857 2804, 2811, 2814, 2815, 2822, 2826, 2831, 2847, 2864, 2878,
1858 2892, 2904, 2912, 2919, 2925, 2931, 2937, 2952, 3050, 3055,
1859 3059, 3066, 3073, 3081, 3088, 3096, 3104, 3118, 3135, 3143
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", "BasicBlockList",
1908 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1909 "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
1910 "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, 188, 188, 189, 189, 189, 189,
1954 189, 189, 190, 190, 191, 191, 192, 192, 193, 193,
1955 194, 195, 195, 196, 196, 197, 197, 198, 198, 198,
1956 198, 198, 198, 198, 199, 199, 199, 199, 199, 199,
1957 199, 199, 199, 199, 199, 199, 199, 200, 201, 201,
1958 202, 202, 203, 203, 203, 203, 204, 204, 205, 205,
1959 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
1960 205, 205, 205, 205, 205, 205, 205, 205, 206, 206,
1961 206, 206, 206, 206, 206, 206, 206, 206, 207, 207,
1962 208, 208, 209, 209, 210, 210, 211, 211, 212, 212,
1963 214, 213, 215, 213, 213, 213, 213, 216, 213, 217,
1964 213, 218, 213, 213, 213, 213, 219, 220, 220, 221,
1965 222, 222, 222, 223, 223, 224, 224, 224, 224, 225,
1966 226, 226, 227, 228, 228, 229, 230, 231, 231, 232,
1967 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1968 233, 233, 233, 233, 234, 234, 235, 236, 236, 237,
1969 238, 238, 238, 239, 239, 239, 239, 239, 239, 239,
1970 239, 239, 240, 240, 241, 242, 242, 243, 243, 243,
1971 243, 243, 244, 244, 245, 245, 246, 246, 246, 246,
1972 246, 246, 246, 246, 246, 246, 246, 246, 246, 247,
1973 247, 248, 248, 248, 248, 248, 248, 248, 248, 248
1976 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1977 static const yytype_uint8 yyr2[] =
1979 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1980 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1981 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1982 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1983 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1986 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1987 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1988 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1989 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 0, 2, 1, 1, 1, 1,
1991 1, 1, 0, 2, 0, 2, 0, 2, 0, 3,
1992 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
1993 1, 1, 1, 1, 1, 1, 3, 1, 2, 5,
1994 5, 5, 5, 3, 2, 5, 4, 2, 1, 1,
1995 1, 3, 1, 3, 1, 0, 1, 3, 4, 3,
1996 3, 4, 4, 3, 6, 5, 2, 2, 2, 2,
1997 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1998 8, 6, 6, 7, 7, 6, 8, 8, 3, 1,
1999 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
2000 0, 3, 0, 3, 3, 3, 3, 0, 8, 0,
2001 9, 0, 9, 5, 2, 3, 1, 3, 3, 3,
2002 3, 1, 0, 5, 3, 1, 3, 1, 0, 10,
2003 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
2004 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
2005 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
2006 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
2007 1, 1, 6, 5, 2, 6, 7, 4, 4, 6,
2008 6, 0, 0, 3, 2, 1, 5, 5, 6, 6,
2009 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
2010 0, 3, 6, 3, 6, 2, 5, 7, 5, 4
2013 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2014 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2015 means the default is an error. */
2016 static const yytype_uint16 yydefact[] =
2018 73, 61, 70, 62, 71, 63, 212, 210, 0, 0,
2019 0, 0, 0, 0, 83, 72, 0, 73, 208, 87,
2020 90, 0, 0, 224, 0, 0, 68, 0, 74, 75,
2021 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2022 83, 83, 203, 1, 209, 88, 89, 83, 213, 91,
2023 92, 93, 94, 83, 271, 211, 271, 0, 0, 232,
2024 225, 226, 214, 260, 261, 216, 137, 138, 139, 142,
2025 141, 140, 143, 144, 0, 0, 0, 0, 262, 263,
2026 145, 215, 147, 203, 203, 95, 202, 0, 98, 98,
2027 272, 268, 69, 243, 244, 245, 267, 227, 228, 231,
2028 0, 165, 148, 0, 0, 0, 0, 154, 166, 0,
2029 0, 165, 0, 0, 0, 97, 96, 0, 200, 201,
2030 0, 0, 99, 100, 101, 102, 103, 0, 246, 0,
2031 310, 270, 0, 229, 164, 114, 160, 162, 0, 0,
2032 0, 0, 0, 0, 153, 0, 0, 146, 0, 0,
2033 159, 0, 158, 0, 223, 137, 138, 139, 142, 141,
2034 140, 0, 0, 67, 67, 104, 0, 240, 241, 242,
2035 309, 295, 0, 0, 0, 0, 98, 280, 281, 2,
2036 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2037 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2038 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2039 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
2040 0, 0, 269, 98, 284, 0, 308, 230, 157, 0,
2041 122, 67, 67, 156, 0, 167, 0, 122, 67, 67,
2042 0, 204, 185, 186, 181, 183, 182, 184, 187, 180,
2043 176, 177, 0, 0, 0, 0, 0, 0, 0, 0,
2044 0, 0, 0, 0, 0, 0, 179, 178, 217, 0,
2045 294, 274, 67, 273, 0, 0, 55, 0, 0, 29,
2046 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2047 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2048 43, 44, 45, 46, 47, 48, 0, 128, 128, 315,
2049 67, 67, 306, 0, 0, 0, 0, 0, 67, 67,
2050 67, 0, 0, 0, 0, 106, 108, 107, 105, 109,
2051 110, 111, 112, 113, 115, 163, 161, 150, 151, 152,
2052 155, 66, 149, 219, 221, 0, 0, 0, 0, 0,
2053 0, 0, 0, 169, 199, 0, 0, 0, 173, 0,
2054 170, 0, 0, 0, 133, 238, 249, 250, 251, 256,
2055 252, 253, 254, 255, 247, 0, 258, 265, 264, 266,
2056 0, 275, 0, 0, 67, 67, 0, 311, 0, 313,
2057 292, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2058 0, 0, 0, 67, 0, 119, 118, 116, 117, 120,
2059 121, 123, 133, 133, 0, 0, 0, 292, 0, 0,
2060 0, 0, 0, 168, 154, 166, 0, 171, 172, 0,
2061 0, 0, 0, 218, 237, 114, 235, 0, 248, 0,
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,
2063 0, 0, 0, 302, 303, 0, 0, 0, 0, 0,
2064 300, 0, 128, 0, 220, 222, 67, 0, 0, 0,
2065 0, 0, 0, 0, 198, 175, 0, 0, 0, 0,
2066 0, 0, 135, 133, 65, 0, 122, 0, 257, 0,
2067 0, 291, 0, 0, 128, 129, 128, 0, 0, 0,
2068 0, 0, 0, 318, 296, 297, 291, 0, 316, 67,
2069 205, 0, 0, 189, 0, 0, 0, 0, 174, 0,
2070 0, 67, 130, 136, 134, 64, 234, 236, 114, 131,
2071 0, 0, 0, 114, 114, 0, 298, 299, 312, 314,
2072 293, 0, 0, 301, 304, 305, 0, 128, 0, 0,
2073 0, 195, 0, 0, 191, 192, 188, 65, 132, 126,
2074 259, 0, 0, 0, 0, 122, 0, 285, 0, 122,
2075 317, 193, 194, 0, 0, 0, 233, 0, 124, 0,
2076 278, 0, 0, 106, 108, 114, 114, 0, 114, 114,
2077 286, 307, 190, 196, 197, 127, 0, 239, 276, 0,
2078 277, 0, 288, 287, 0, 0, 0, 125, 0, 0,
2079 0, 114, 114, 0, 0, 0, 290, 289, 283, 0,
2083 /* YYDEFGOTO[NTERM-NUM]. */
2084 static const yytype_int16 yydefgoto[] =
2086 -1, 263, 264, 265, 289, 306, 161, 162, 78, 526,
2087 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2088 117, 127, 334, 228, 411, 337, 597, 578, 387, 482,
2089 559, 433, 483, 80, 163, 136, 153, 137, 138, 109,
2090 354, 376, 355, 120, 87, 154, 16, 17, 18, 20,
2091 19, 364, 412, 413, 62, 23, 60, 100, 436, 437,
2092 128, 169, 54, 95, 55, 48, 439, 377, 82, 379,
2093 273, 56, 91, 92, 222, 582, 131, 312, 535, 449,
2097 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2099 #define YYPACT_NINF -566
2100 static const yytype_int16 yypact[] =
2102 331, -566, -566, -566, -566, -566, -566, -566, -9, -100,
2103 18, -71, 93, 30, 60, -566, 155, 403, -566, 193,
2104 186, 62, 87, -566, 120, 228, -566, 1521, -566, -566,
2105 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2106 63, 63, 223, -566, -566, -566, -566, 63, -566, -566,
2107 -566, -566, -566, 63, 258, -566, -11, 259, 260, 263,
2108 -566, -566, -566, -566, -566, 136, -566, -566, -566, -566,
2109 -566, -566, -566, -566, 284, 287, 1, 710, -566, -566,
2110 -566, -31, -566, 255, 255, 217, -566, 57, 34, 34,
2111 -566, -566, 177, -566, -566, -566, -566, -566, -566, -566,
2112 -88, 1304, -566, 135, 137, 750, 136, -566, -31, -102,
2113 143, 1304, 144, 57, 57, -566, -566, 1347, -566, -566,
2114 1579, 296, -566, -566, -566, -566, -566, 1619, -566, -17,
2115 1790, -566, 281, -566, -566, -31, -566, 150, 153, 1637,
2116 1637, 145, -99, 1637, -566, 303, 164, -566, 1579, 1637,
2117 136, 166, -31, 302, -566, 240, 311, 314, 318, 325,
2118 328, 251, 332, 1074, 286, -566, 128, -566, -566, -566,
2119 -566, -566, 288, 1677, 20, 336, 34, -566, -566, -566,
2120 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2121 -566, -566, -566, -566, 349, 1159, 1637, 1637, 1637, 1637,
2122 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2123 -566, -566, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1637,
2124 1637, 1637, -566, 34, -566, 53, -566, -566, -56, 1365,
2125 -566, -22, -39, -566, 181, -31, 196, -566, 286, -21,
2126 1347, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2127 -566, -566, 349, 1159, 201, 209, 214, 215, 221, 1405,
2128 1695, 973, 351, 227, 230, 232, -566, -566, -566, 233,
2129 -566, 136, 661, -566, 800, 800, -566, 800, 1619, -566,
2130 -566, -566, -566, -566, -566, -566, -566, -566, -566, 1637,
2131 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2132 -566, -566, -566, -566, -566, -566, 1637, -13, -5, -566,
2133 661, -32, 220, 237, 241, 245, 247, 248, 5, 661,
2134 661, 366, 1619, 1637, 1637, -566, -566, -566, -566, -566,
2135 -566, -566, -566, -566, -566, -566, -566, 86, -566, -566,
2136 -566, -566, 86, -566, 144, 367, 236, 256, 1579, 1579,
2137 1579, 1579, 1579, -566, -566, 6, 1016, -119, -566, -89,
2138 -566, 1579, 1579, 1579, 252, 1423, -566, -566, -566, -566,
2139 -566, -566, -566, -566, 348, 1579, -566, -566, -566, -566,
2140 262, -566, 270, 800, 661, 661, 15, -566, 19, -566,
2141 -566, 800, 253, 1637, 1637, 1637, 1637, 1637, 274, 276,
2142 277, 1637, 800, 661, 278, -566, -566, -566, -566, -566,
2143 -566, -566, 252, 252, 1637, 1579, 1579, -566, 298, 307,
2144 309, 310, 1579, -566, 295, 928, -85, -566, -566, 315,
2145 316, 375, 4, -566, -566, -31, 319, 265, -566, 392,
2146 -84, 418, 455, 326, 324, 327, 800, 475, 800, 329,
2147 333, 800, 334, -31, -566, 335, 337, 1579, 800, 800,
2148 -31, 339, 340, 1637, -566, -566, -8, 341, 342, 110,
2149 1579, 1579, 1579, 1579, -566, -566, 321, 1579, 1579, 1637,
2150 463, 482, -566, 252, 556, 1463, -566, 350, -566, 800,
2151 800, 1735, 800, 800, 340, -566, 340, 1637, 800, 354,
2152 1637, 1637, 1637, -566, -566, -566, 1735, 450, -566, 661,
2153 -566, 1579, 1579, -566, 356, 353, 357, 358, -566, 361,
2154 362, 2, -566, -566, -566, -566, -566, -566, -31, 39,
2155 493, 363, 359, -15, -31, 121, -566, -566, -566, -566,
2156 -566, 360, 800, -566, -566, -566, 122, 340, 368, 369,
2157 1579, -566, 1579, 1579, -566, -566, -566, 556, -566, 471,
2158 -566, 508, -2, 519, 519, -566, 1793, -566, 370, -566,
2159 -566, -566, -566, 378, 379, 380, -566, 529, 387, 800,
2160 -566, 1214, 10, 384, 385, -566, -566, 80, -15, -31,
2161 -566, 86, -566, -566, -566, -566, 515, -566, -566, 393,
2162 -566, 1214, -56, -56, 531, 519, 519, -566, 532, 396,
2163 800, -566, -566, 800, 535, 481, -56, -56, -566, 800,
2164 537, -566, 800, -566
2167 /* YYPGOTO[NTERM-NUM]. */
2168 static const yytype_int16 yypgoto[] =
2170 -566, 425, 426, 428, 312, 308, -173, -566, 0, 11,
2171 -145, 470, 8, -566, -566, -566, -566, 7, -566, -566,
2172 -566, -156, -566, -407, -566, -233, -566, -566, -296, 36,
2173 -566, -368, -566, -566, -26, 338, -120, -566, 452, 461,
2174 -114, -160, -247, 106, 185, 330, -566, -566, 552, -566,
2175 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2176 485, -566, -566, -566, -566, -566, -566, -565, -113, 9,
2177 -82, -566, 520, -566, -566, -566, -566, -566, 65, 162,
2178 -566, -566, -566, -566
2181 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2182 positive, shift that token. If negative, reduce the rule which
2183 number is the opposite. If zero, do what YYDEFACT says.
2184 If YYTABLE_NINF, syntax error. */
2185 #define YYTABLE_NINF -208
2186 static const yytype_int16 yytable[] =
2188 11, 81, 277, 266, 342, 104, 164, 166, 13, 276,
2189 90, 167, 389, 357, 359, 110, 599, 11, 93, 268,
2190 278, 276, 110, 110, 1, 13, 446, 3, 484, 5,
2191 448, 274, 110, 110, 238, 422, 609, 275, 480, -143,
2192 241, 110, 427, 21, 464, 465, 110, 83, 84, 110,
2193 267, 108, 143, 24, 88, 143, 110, 481, 22, 110,
2194 89, 144, 325, 326, 234, 422, 132, 322, 447, 422,
2195 422, 133, 447, 480, 428, 135, 25, 488, 476, 108,
2196 327, 328, 26, 329, 330, 135, 331, 332, 333, 118,
2197 119, 152, 11, 343, 344, 121, 122, 123, 124, 125,
2198 126, 152, 29, 30, 31, 32, 33, 34, 35, 426,
2199 36, 27, 111, 231, 232, 524, 309, 235, 604, 111,
2200 111, 557, 339, 239, -67, 391, 563, 564, 440, 111,
2201 111, 313, 314, 315, 316, 317, -143, 338, 111, 321,
2202 -143, 386, -67, 111, 510, 168, 111, 272, 2, 388,
2203 -67, 4, 94, 111, 556, 43, 111, 580, 383, 378,
2204 422, 378, 378, 105, 378, 423, 508, 323, 324, 600,
2205 307, 308, 272, 310, 269, 405, 406, 407, 602, 603,
2206 408, 605, 606, 28, 409, 410, 311, 272, 272, 272,
2207 272, 272, 318, 319, 320, 272, 1, 378, 538, 3,
2208 539, 5, 402, 135, 616, 617, 378, 378, 37, 38,
2209 39, 37, 38, 39, 152, 57, 405, 406, 407, 148,
2210 149, 408, 405, 406, 407, 409, 410, 408, 49, 50,
2211 51, 409, 410, 52, 417, 418, 419, 420, 421, 45,
2212 58, 46, 404, -55, -55, -55, -55, 429, 430, 431,
2213 61, 570, 152, 529, 244, 245, 246, 247, 85, 115,
2214 86, 116, 513, 384, 497, 266, 242, 243, 113, 114,
2215 378, 378, 378, 565, 569, 566, 566, 59, 378, 90,
2216 385, 97, 98, 380, 381, 99, 382, 101, 102, 378,
2217 378, 103, 86, 139, 145, 140, 152, 403, 272, 147,
2218 165, 467, 468, 227, 229, 230, 233, 236, 474, 63,
2219 64, 452, 267, 454, 455, 456, 237, 240, 398, 390,
2220 -56, 1, 2, -57, 3, 4, 5, -60, 399, 400,
2221 425, -207, 587, 378, -59, 378, 591, -58, 378, 435,
2222 110, 248, 340, 503, 270, 378, 378, 276, 341, -69,
2223 1, 2, 348, 3, 4, 5, 514, 515, 516, 517,
2224 349, 6, 7, 519, 520, 350, 351, 272, 453, 272,
2225 272, 272, 352, 360, 392, 460, 378, 378, 361, 378,
2226 378, 362, 8, 363, 365, 378, 9, 415, 466, 581,
2227 10, 393, 443, 444, 445, 394, 378, 548, 549, 395,
2228 450, 396, 397, -206, 401, 414, 432, 416, 438, 601,
2229 451, 461, 462, 479, 487, 540, 441, 486, 543, 544,
2230 545, -69, 1, 2, 442, 3, 4, 5, 457, 378,
2231 458, 459, 463, 6, 7, 489, 573, 509, 574, 575,
2232 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
2233 378, 378, 470, 521, 8, 494, 475, 496, 9, 528,
2234 499, 471, 10, 472, 473, 534, 378, 504, 505, 477,
2235 478, 272, 490, 485, 272, 272, 272, 491, 492, 495,
2236 534, 493, 518, 497, 525, 522, 523, 498, 500, 501,
2237 506, 502, 378, 378, 507, 511, 512, 378, 531, 532,
2238 378, 536, 537, 447, 530, 551, 378, 541, 542, 378,
2239 550, 552, 553, 554, 555, 560, 562, 561, 547, 567,
2240 571, 572, 366, 367, 577, 579, 63, 64, 368, 590,
2241 592, 593, 594, 595, 596, -18, -19, 607, 1, 2,
2242 589, 3, 4, 5, 369, 370, 371, 608, 610, 613,
2243 614, 568, 619, 620, 622, 219, 220, 525, 221, 372,
2244 373, 347, 130, 146, 346, 558, 142, 336, 576, 44,
2245 345, 546, 585, 586, 129, 1, 96, 374, 3, 469,
2246 5, 0, 0, 0, 0, 0, 0, 0, 598, 0,
2247 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2248 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2249 0, 0, 0, 0, 611, 612, 0, 0, 0, 615,
2250 0, 0, 618, 0, 0, 0, 0, 0, 621, 0,
2251 0, 623, 0, 0, 0, 254, 200, 583, 584, 203,
2252 204, 205, 206, 207, 208, 209, 210, 211, 0, 255,
2253 0, 256, 257, 258, 0, 327, 328, 0, 329, 330,
2254 0, 331, 332, 333, 366, 367, 0, 0, 63, 64,
2255 368, 0, 0, 0, 325, 326, 0, 0, 0, 375,
2256 1, 2, 0, 3, 4, 5, 369, 370, 371, 0,
2257 0, 0, 327, 328, 0, 329, 330, 0, 331, 332,
2258 333, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2259 0, 0, 0, 0, 0, 110, 0, 63, 64, 374,
2260 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2261 2, 0, 3, 4, 5, 179, 180, 181, 182, 183,
2262 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2263 252, 253, 0, 0, 0, 0, 0, 63, 64, 73,
2264 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2265 2, 0, 3, 4, 5, 0, 0, 254, 200, 201,
2266 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2267 0, 255, 0, 256, 257, 258, 0, 0, 0, 73,
2268 0, 0, 0, 366, 367, 0, 0, 63, 64, 368,
2269 0, 0, 111, 0, 0, 0, 0, 0, 0, 1,
2270 2, 375, 3, 4, 5, 369, 370, 371, 0, 0,
2271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2272 372, 373, 0, 0, 0, 0, 0, 0, 0, 0,
2273 0, 0, 0, 0, 0, 0, 0, 0, 374, 0,
2274 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2275 76, 0, 77, 107, 179, 180, 181, 182, 183, 184,
2276 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2277 253, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2278 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2279 76, 0, 77, 141, 0, 0, 254, 200, 201, 202,
2280 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
2281 255, 0, 256, 257, 258, 63, 64, 0, 0, 0,
2282 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2283 3, 4, 5, 249, 0, 0, 0, 0, 0, 0,
2284 375, 0, 0, 0, 0, 0, 0, 0, 250, 251,
2285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2286 63, 64, 110, 106, 155, 156, 157, 158, 159, 160,
2287 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2288 0, 0, 179, 180, 181, 182, 183, 184, 185, 186,
2289 187, 188, 189, 190, 191, 192, 193, 252, 253, 0,
2290 0, 0, 73, 63, 64, 0, 106, 155, 156, 157,
2291 158, 159, 160, 72, 0, 1, 2, 0, 3, 4,
2292 5, 0, 0, 0, 254, 200, 201, 202, 203, 204,
2293 205, 206, 207, 208, 209, 210, 211, 0, 255, 0,
2294 256, 257, 258, 0, 0, 73, 0, 0, 0, 0,
2295 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2296 0, 63, 64, -67, 0, 259, 0, 0, 260, 0,
2297 261, 0, 262, 1, 2, 0, 3, 4, 5, 249,
2298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2299 0, 0, 0, 0, 250, 251, 0, 0, 0, 0,
2300 0, 0, 0, 0, 0, 0, 0, 0, 110, 74,
2301 75, 0, 0, 76, 0, 77, 358, 0, 0, 0,
2302 0, 0, 0, 0, 0, 0, 0, 0, 179, 180,
2303 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2304 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
2305 0, 0, 74, 75, 0, 0, 76, 0, 77, 424,
2306 0, 0, 0, 0, 0, 290, 291, 0, 0, 0,
2307 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2308 209, 210, 211, 0, 255, 0, 256, 257, 258, 0,
2309 0, 0, 0, 0, 0, 0, 0, 366, 367, 0,
2310 0, 0, 0, 368, 0, 111, 0, 0, 0, 0,
2311 0, 259, 0, 0, 260, 0, 261, 0, 262, 369,
2312 370, 371, 0, 0, 0, 0, 0, 0, 0, 0,
2313 0, 0, 0, 0, 372, 373, 292, 293, 294, 295,
2314 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
2315 0, 0, 374, 0, 0, 0, 0, 0, 0, 0,
2316 0, 0, 0, 0, 0, 0, 0, 0, 179, 180,
2317 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2318 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
2319 0, 63, 64, 0, 106, 66, 67, 68, 69, 70,
2320 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2321 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2322 209, 210, 211, 134, 255, 0, 256, 257, 258, 0,
2323 0, 0, 0, 73, 63, 64, 0, 150, 66, 67,
2324 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2325 4, 5, 63, 64, 375, 106, 66, 67, 68, 69,
2326 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2327 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
2328 0, 0, 0, 0, 335, 0, 0, 0, 0, 0,
2329 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2330 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2331 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
2332 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2333 0, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2334 74, 75, 434, 0, 76, 0, 77, 0, 0, 151,
2335 63, 64, 73, 106, 66, 67, 68, 69, 70, 71,
2336 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2338 0, 0, 527, 74, 75, 0, 0, 76, 0, 77,
2339 0, 0, 73, 0, 0, 0, 0, 0, 0, 0,
2340 0, 74, 75, 0, 0, 76, 0, 77, 63, 64,
2341 0, 65, 66, 67, 68, 69, 70, 71, 72, 0,
2342 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2344 0, 74, 75, 0, 353, 76, 0, 77, 0, 0,
2345 73, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2346 75, 0, 0, 76, 0, 77, 63, 64, 0, 106,
2347 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2348 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2350 75, 0, 0, 76, 0, 77, 63, 64, 73, 150,
2351 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2352 0, 3, 4, 5, 63, 64, 0, 106, 66, 67,
2353 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2354 4, 5, 0, 0, 0, 0, 0, 0, 73, 0,
2355 0, 0, 0, 0, 0, 0, 0, 74, 75, 0,
2356 0, 76, 0, 77, 63, 64, 73, 271, 66, 67,
2357 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2358 4, 5, 63, 64, 0, 106, 155, 156, 157, 158,
2359 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2360 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
2361 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2362 0, 77, 63, 64, 73, 106, 66, 67, 68, 69,
2363 70, 71, 533, 0, 1, 2, 0, 3, 4, 5,
2364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2365 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2366 0, 77, 0, 0, 73, 0, 0, 0, 0, 0,
2367 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2368 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
2369 588, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2370 0, 0, 0, 0, 0, 0, 170, 0, 0, 0,
2371 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2372 0, 0, 73, 0, 0, 0, 171, 172, 0, 0,
2373 0, 74, 75, 0, 0, 76, 0, 356, 173, 174,
2374 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2375 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2376 195, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2377 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
2378 0, 196, 197, 198, 0, 0, 199, 200, 201, 202,
2379 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2380 213, 214, 215, 216, 217, 218, 0, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2382 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2386 static const yytype_int16 yycheck[] =
2388 0, 27, 175, 163, 237, 4, 120, 127, 0, 11,
2389 21, 28, 308, 260, 261, 54, 581, 17, 29, 164,
2390 176, 11, 54, 54, 19, 17, 11, 22, 435, 24,
2391 11, 11, 54, 54, 148, 154, 601, 17, 34, 54,
2392 153, 54, 161, 52, 412, 413, 54, 40, 41, 54,
2393 163, 77, 154, 153, 47, 154, 54, 53, 67, 54,
2394 53, 163, 118, 119, 163, 154, 154, 223, 53, 154,
2395 154, 159, 53, 34, 163, 101, 58, 161, 163, 105,
2396 136, 137, 153, 139, 140, 111, 142, 143, 144, 32,
2397 33, 117, 92, 238, 239, 61, 62, 63, 64, 65,
2398 66, 127, 42, 43, 44, 45, 46, 47, 48, 356,
2399 50, 18, 151, 139, 140, 483, 198, 143, 38, 151,
2400 151, 528, 161, 149, 155, 157, 533, 534, 375, 151,
2401 151, 213, 214, 215, 216, 217, 151, 159, 151, 221,
2402 155, 154, 155, 151, 152, 162, 151, 173, 20, 154,
2403 155, 23, 163, 151, 152, 0, 151, 159, 278, 272,
2404 154, 274, 275, 162, 277, 159, 462, 114, 115, 159,
2405 196, 197, 198, 199, 166, 136, 137, 138, 585, 586,
2406 141, 588, 589, 153, 145, 146, 212, 213, 214, 215,
2407 216, 217, 218, 219, 220, 221, 19, 310, 494, 22,
2408 496, 24, 322, 229, 611, 612, 319, 320, 148, 149,
2409 150, 148, 149, 150, 240, 153, 136, 137, 138, 113,
2410 114, 141, 136, 137, 138, 145, 146, 141, 42, 43,
2411 44, 145, 146, 47, 348, 349, 350, 351, 352, 46,
2412 153, 48, 324, 3, 4, 5, 6, 361, 362, 363,
2413 22, 547, 278, 486, 3, 4, 5, 6, 35, 42,
2414 37, 44, 152, 289, 154, 425, 26, 27, 83, 84,
2415 383, 384, 385, 152, 152, 154, 154, 157, 391, 21,
2416 306, 22, 22, 274, 275, 22, 277, 151, 4, 402,
2417 403, 4, 37, 158, 151, 158, 322, 323, 324, 155,
2418 4, 415, 416, 22, 154, 152, 161, 4, 422, 7,
2419 8, 393, 425, 395, 396, 397, 152, 151, 318, 310,
2420 9, 19, 20, 9, 22, 23, 24, 9, 319, 320,
2421 356, 0, 565, 446, 9, 448, 569, 9, 451, 365,
2422 54, 9, 161, 457, 56, 458, 459, 11, 152, 18,
2423 19, 20, 151, 22, 23, 24, 470, 471, 472, 473,
2424 151, 30, 31, 477, 478, 151, 151, 393, 394, 395,
2425 396, 397, 151, 22, 154, 401, 489, 490, 151, 492,
2426 493, 151, 51, 151, 151, 498, 55, 151, 414, 562,
2427 59, 154, 383, 384, 385, 154, 509, 511, 512, 154,
2428 391, 154, 154, 0, 38, 38, 154, 151, 60, 582,
2429 157, 402, 403, 38, 22, 497, 154, 152, 500, 501,
2430 502, 18, 19, 20, 154, 22, 23, 24, 154, 542,
2431 154, 154, 154, 30, 31, 17, 550, 463, 552, 553,
2432 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2433 563, 564, 154, 479, 51, 446, 161, 448, 55, 485,
2434 451, 154, 59, 154, 154, 491, 579, 458, 459, 154,
2435 154, 497, 17, 154, 500, 501, 502, 151, 154, 4,
2436 506, 154, 161, 154, 484, 22, 4, 154, 154, 154,
2437 151, 154, 605, 606, 154, 154, 154, 610, 489, 490,
2438 613, 492, 493, 53, 154, 152, 619, 498, 154, 622,
2439 154, 154, 154, 152, 152, 22, 157, 154, 509, 159,
2440 152, 152, 3, 4, 53, 17, 7, 8, 9, 159,
2441 152, 152, 152, 4, 147, 151, 151, 22, 19, 20,
2442 566, 22, 23, 24, 25, 26, 27, 154, 17, 17,
2443 154, 542, 17, 72, 17, 130, 130, 557, 130, 40,
2444 41, 253, 92, 111, 252, 529, 105, 229, 557, 17,
2445 240, 506, 563, 564, 89, 19, 56, 58, 22, 417,
2446 24, -1, -1, -1, -1, -1, -1, -1, 579, -1,
2447 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2448 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2449 -1, -1, -1, -1, 605, 606, -1, -1, -1, 610,
2450 -1, -1, 613, -1, -1, -1, -1, -1, 619, -1,
2451 -1, 622, -1, -1, -1, 116, 117, 118, 119, 120,
2452 121, 122, 123, 124, 125, 126, 127, 128, -1, 130,
2453 -1, 132, 133, 134, -1, 136, 137, -1, 139, 140,
2454 -1, 142, 143, 144, 3, 4, -1, -1, 7, 8,
2455 9, -1, -1, -1, 118, 119, -1, -1, -1, 160,
2456 19, 20, -1, 22, 23, 24, 25, 26, 27, -1,
2457 -1, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2458 144, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2459 -1, -1, -1, -1, -1, 54, -1, 7, 8, 58,
2460 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2461 20, -1, 22, 23, 24, 74, 75, 76, 77, 78,
2462 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2463 89, 90, -1, -1, -1, -1, -1, 7, 8, 49,
2464 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2465 20, -1, 22, 23, 24, -1, -1, 116, 117, 118,
2466 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2467 -1, 130, -1, 132, 133, 134, -1, -1, -1, 49,
2468 -1, -1, -1, 3, 4, -1, -1, 7, 8, 9,
2469 -1, -1, 151, -1, -1, -1, -1, -1, -1, 19,
2470 20, 160, 22, 23, 24, 25, 26, 27, -1, -1,
2471 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2472 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2473 -1, -1, -1, -1, -1, -1, -1, -1, 58, -1,
2474 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2475 160, -1, 162, 163, 74, 75, 76, 77, 78, 79,
2476 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2477 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2478 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2479 160, -1, 162, 163, -1, -1, 116, 117, 118, 119,
2480 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
2481 130, -1, 132, 133, 134, 7, 8, -1, -1, -1,
2482 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
2483 22, 23, 24, 25, -1, -1, -1, -1, -1, -1,
2484 160, -1, -1, -1, -1, -1, -1, -1, 40, 41,
2485 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2486 7, 8, 54, 10, 11, 12, 13, 14, 15, 16,
2487 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2488 -1, -1, 74, 75, 76, 77, 78, 79, 80, 81,
2489 82, 83, 84, 85, 86, 87, 88, 89, 90, -1,
2490 -1, -1, 49, 7, 8, -1, 10, 11, 12, 13,
2491 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2492 24, -1, -1, -1, 116, 117, 118, 119, 120, 121,
2493 122, 123, 124, 125, 126, 127, 128, -1, 130, -1,
2494 132, 133, 134, -1, -1, 49, -1, -1, -1, -1,
2495 -1, -1, -1, -1, -1, -1, -1, -1, -1, 151,
2496 -1, 7, 8, 155, -1, 157, -1, -1, 160, -1,
2497 162, -1, 164, 19, 20, -1, 22, 23, 24, 25,
2498 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2499 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2500 -1, -1, -1, -1, -1, -1, -1, -1, 54, 156,
2501 157, -1, -1, 160, -1, 162, 163, -1, -1, -1,
2502 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
2503 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2504 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
2505 -1, -1, 156, 157, -1, -1, 160, -1, 162, 163,
2506 -1, -1, -1, -1, -1, 26, 27, -1, -1, -1,
2507 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2508 126, 127, 128, -1, 130, -1, 132, 133, 134, -1,
2509 -1, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2510 -1, -1, -1, 9, -1, 151, -1, -1, -1, -1,
2511 -1, 157, -1, -1, 160, -1, 162, -1, 164, 25,
2512 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2513 -1, -1, -1, -1, 40, 41, 97, 98, 99, 100,
2514 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
2515 -1, -1, 58, -1, -1, -1, -1, -1, -1, -1,
2516 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
2517 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2518 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
2519 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2520 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2521 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2522 126, 127, 128, 39, 130, -1, 132, 133, 134, -1,
2523 -1, -1, -1, 49, 7, 8, -1, 10, 11, 12,
2524 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2525 23, 24, 7, 8, 160, 10, 11, 12, 13, 14,
2526 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2527 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2528 -1, -1, -1, -1, 39, -1, -1, -1, -1, -1,
2529 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2530 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2531 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2532 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2533 -1, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2534 156, 157, 39, -1, 160, -1, 162, -1, -1, 122,
2535 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
2536 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2537 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2538 -1, -1, 39, 156, 157, -1, -1, 160, -1, 162,
2539 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2540 -1, 156, 157, -1, -1, 160, -1, 162, 7, 8,
2541 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2542 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2543 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2544 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2545 49, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2546 157, -1, -1, 160, -1, 162, 7, 8, -1, 10,
2547 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2548 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2549 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2550 157, -1, -1, 160, -1, 162, 7, 8, 49, 10,
2551 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2552 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2553 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2554 23, 24, -1, -1, -1, -1, -1, -1, 49, -1,
2555 -1, -1, -1, -1, -1, -1, -1, 156, 157, -1,
2556 -1, 160, -1, 162, 7, 8, 49, 10, 11, 12,
2557 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2558 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2559 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2560 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2561 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2562 -1, 162, 7, 8, 49, 10, 11, 12, 13, 14,
2563 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2564 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2565 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2566 -1, 162, -1, -1, 49, -1, -1, -1, -1, -1,
2567 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
2568 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2569 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2570 -1, -1, -1, -1, -1, -1, 36, -1, -1, -1,
2571 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
2572 -1, -1, 49, -1, -1, -1, 56, 57, -1, -1,
2573 -1, 156, 157, -1, -1, 160, -1, 162, 68, 69,
2574 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2575 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2576 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2577 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2578 -1, 111, 112, 113, -1, -1, 116, 117, 118, 119,
2579 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2580 130, 131, 132, 133, 134, 135, -1, -1, -1, -1,
2581 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2583 157, -1, -1, 160, -1, 162
2586 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2587 symbol of state STATE-NUM. */
2588 static const yytype_uint8 yystos[] =
2590 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2591 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2592 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2593 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2594 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
2595 43, 44, 47, 184, 227, 229, 236, 153, 153, 157,
2596 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2597 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2598 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
2599 21, 237, 238, 29, 163, 228, 237, 22, 22, 22,
2600 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2601 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2602 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
2603 176, 241, 154, 159, 39, 199, 200, 202, 203, 158,
2604 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2605 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2606 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
2607 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2608 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2609 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2610 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2611 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
2612 167, 168, 239, 245, 246, 247, 248, 22, 188, 154,
2613 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2614 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2615 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2616 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
2617 56, 10, 199, 235, 11, 17, 11, 171, 186, 91,
2618 92, 93, 94, 95, 96, 97, 98, 99, 100, 169,
2619 26, 27, 97, 98, 99, 100, 101, 102, 103, 104,
2620 105, 106, 107, 108, 109, 110, 170, 199, 199, 235,
2621 199, 199, 242, 235, 235, 235, 235, 235, 199, 199,
2622 199, 235, 186, 114, 115, 118, 119, 136, 137, 139,
2623 140, 142, 143, 144, 187, 39, 200, 190, 159, 161,
2624 161, 152, 190, 175, 175, 210, 169, 170, 151, 151,
2625 151, 151, 151, 159, 205, 207, 162, 207, 163, 207,
2626 22, 151, 151, 151, 216, 151, 3, 4, 9, 25,
2627 26, 27, 40, 41, 58, 160, 206, 232, 233, 234,
2628 234, 234, 234, 201, 199, 199, 154, 193, 154, 193,
2629 234, 157, 154, 154, 154, 154, 154, 154, 173, 234,
2630 234, 38, 201, 199, 235, 136, 137, 138, 141, 145,
2631 146, 189, 217, 218, 38, 151, 151, 205, 205, 205,
2632 205, 205, 154, 159, 163, 199, 207, 161, 163, 205,
2633 205, 205, 154, 196, 39, 199, 223, 224, 60, 231,
2634 207, 154, 154, 234, 234, 234, 11, 53, 11, 244,
2635 234, 157, 235, 199, 235, 235, 235, 154, 154, 154,
2636 199, 234, 234, 154, 196, 196, 199, 205, 205, 244,
2637 154, 154, 154, 154, 205, 161, 163, 154, 154, 38,
2638 34, 53, 194, 197, 188, 154, 152, 22, 161, 17,
2639 17, 151, 154, 154, 234, 4, 234, 154, 154, 234,
2640 154, 154, 154, 205, 234, 234, 151, 154, 193, 199,
2641 152, 154, 154, 152, 205, 205, 205, 205, 161, 205,
2642 205, 199, 22, 4, 196, 173, 174, 39, 199, 190,
2643 154, 234, 234, 17, 199, 243, 234, 234, 193, 193,
2644 235, 234, 154, 235, 235, 235, 243, 234, 205, 205,
2645 154, 152, 154, 154, 152, 152, 152, 188, 194, 195,
2646 22, 154, 157, 188, 188, 152, 154, 159, 234, 152,
2647 193, 152, 152, 205, 205, 205, 174, 53, 192, 17,
2648 159, 171, 240, 118, 119, 234, 234, 190, 17, 199,
2649 159, 190, 152, 152, 152, 4, 147, 191, 234, 232,
2650 159, 171, 188, 188, 38, 188, 188, 22, 154, 232,
2651 17, 234, 234, 17, 154, 234, 188, 188, 234, 17,
2655 #define yyerrok (yyerrstatus = 0)
2656 #define yyclearin (yychar = YYEMPTY)
2657 #define YYEMPTY (-2)
2660 #define YYACCEPT goto yyacceptlab
2661 #define YYABORT goto yyabortlab
2662 #define YYERROR goto yyerrorlab
2665 /* Like YYERROR except do call yyerror. This remains here temporarily
2666 to ease the transition to the new meaning of YYERROR, for GCC.
2667 Once GCC version 2 has supplanted version 1, this can go. */
2669 #define YYFAIL goto yyerrlab
2671 #define YYRECOVERING() (!!yyerrstatus)
2673 #define YYBACKUP(Token, Value) \
2675 if (yychar == YYEMPTY && yylen == 1) \
2679 yytoken = YYTRANSLATE (yychar); \
2685 yyerror (YY_("syntax error: cannot back up")); \
2692 #define YYERRCODE 256
2695 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2696 If N is 0, then set CURRENT to the empty location which ends
2697 the previous symbol: RHS[0] (always defined). */
2699 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2700 #ifndef YYLLOC_DEFAULT
2701 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2705 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2706 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2707 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2708 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2712 (Current).first_line = (Current).last_line = \
2713 YYRHSLOC (Rhs, 0).last_line; \
2714 (Current).first_column = (Current).last_column = \
2715 YYRHSLOC (Rhs, 0).last_column; \
2721 /* YY_LOCATION_PRINT -- Print the location on the stream.
2722 This macro was not mandated originally: define only if we know
2723 we won't break user code: when these are the locations we know. */
2725 #ifndef YY_LOCATION_PRINT
2726 # if YYLTYPE_IS_TRIVIAL
2727 # define YY_LOCATION_PRINT(File, Loc) \
2728 fprintf (File, "%d.%d-%d.%d", \
2729 (Loc).first_line, (Loc).first_column, \
2730 (Loc).last_line, (Loc).last_column)
2732 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2737 /* YYLEX -- calling `yylex' with the right arguments. */
2740 # define YYLEX yylex (YYLEX_PARAM)
2742 # define YYLEX yylex ()
2745 /* Enable debugging if requested. */
2749 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2750 # define YYFPRINTF fprintf
2753 # define YYDPRINTF(Args) \
2759 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2763 YYFPRINTF (stderr, "%s ", Title); \
2764 yy_symbol_print (stderr, \
2766 YYFPRINTF (stderr, "\n"); \
2771 /*--------------------------------.
2772 | Print this symbol on YYOUTPUT. |
2773 `--------------------------------*/
2776 #if (defined __STDC__ || defined __C99__FUNC__ \
2777 || defined __cplusplus || defined _MSC_VER)
2779 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2782 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2785 YYSTYPE const * const yyvaluep;
2791 if (yytype < YYNTOKENS)
2792 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2804 /*--------------------------------.
2805 | Print this symbol on YYOUTPUT. |
2806 `--------------------------------*/
2808 #if (defined __STDC__ || defined __C99__FUNC__ \
2809 || defined __cplusplus || defined _MSC_VER)
2811 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2814 yy_symbol_print (yyoutput, yytype, yyvaluep)
2817 YYSTYPE const * const yyvaluep;
2820 if (yytype < YYNTOKENS)
2821 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2823 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2825 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2826 YYFPRINTF (yyoutput, ")");
2829 /*------------------------------------------------------------------.
2830 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2832 `------------------------------------------------------------------*/
2834 #if (defined __STDC__ || defined __C99__FUNC__ \
2835 || defined __cplusplus || defined _MSC_VER)
2837 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2840 yy_stack_print (bottom, top)
2841 yytype_int16 *bottom;
2845 YYFPRINTF (stderr, "Stack now");
2846 for (; bottom <= top; ++bottom)
2847 YYFPRINTF (stderr, " %d", *bottom);
2848 YYFPRINTF (stderr, "\n");
2851 # define YY_STACK_PRINT(Bottom, Top) \
2854 yy_stack_print ((Bottom), (Top)); \
2858 /*------------------------------------------------.
2859 | Report that the YYRULE is going to be reduced. |
2860 `------------------------------------------------*/
2862 #if (defined __STDC__ || defined __C99__FUNC__ \
2863 || defined __cplusplus || defined _MSC_VER)
2865 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2868 yy_reduce_print (yyvsp, yyrule)
2873 int yynrhs = yyr2[yyrule];
2875 unsigned long int yylno = yyrline[yyrule];
2876 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2878 /* The symbols being reduced. */
2879 for (yyi = 0; yyi < yynrhs; yyi++)
2881 fprintf (stderr, " $%d = ", yyi + 1);
2882 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2883 &(yyvsp[(yyi + 1) - (yynrhs)])
2885 fprintf (stderr, "\n");
2889 # define YY_REDUCE_PRINT(Rule) \
2892 yy_reduce_print (yyvsp, Rule); \
2895 /* Nonzero means print parse trace. It is left uninitialized so that
2896 multiple parsers can coexist. */
2898 #else /* !YYDEBUG */
2899 # define YYDPRINTF(Args)
2900 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2901 # define YY_STACK_PRINT(Bottom, Top)
2902 # define YY_REDUCE_PRINT(Rule)
2903 #endif /* !YYDEBUG */
2906 /* YYINITDEPTH -- initial size of the parser's stacks. */
2908 # define YYINITDEPTH 200
2911 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2912 if the built-in stack extension method is used).
2914 Do not make this value too large; the results are undefined if
2915 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2916 evaluated with infinite-precision integer arithmetic. */
2919 # define YYMAXDEPTH 10000
2927 # if defined __GLIBC__ && defined _STRING_H
2928 # define yystrlen strlen
2930 /* Return the length of YYSTR. */
2931 #if (defined __STDC__ || defined __C99__FUNC__ \
2932 || defined __cplusplus || defined _MSC_VER)
2934 yystrlen (const char *yystr)
2942 for (yylen = 0; yystr[yylen]; yylen++)
2950 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2951 # define yystpcpy stpcpy
2953 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2955 #if (defined __STDC__ || defined __C99__FUNC__ \
2956 || defined __cplusplus || defined _MSC_VER)
2958 yystpcpy (char *yydest, const char *yysrc)
2961 yystpcpy (yydest, yysrc)
2967 const char *yys = yysrc;
2969 while ((*yyd++ = *yys++) != '\0')
2978 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2979 quotes and backslashes, so that it's suitable for yyerror. The
2980 heuristic is that double-quoting is unnecessary unless the string
2981 contains an apostrophe, a comma, or backslash (other than
2982 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2983 null, do not copy; instead, return the length of what the result
2986 yytnamerr (char *yyres, const char *yystr)
2991 char const *yyp = yystr;
2998 goto do_not_strip_quotes;
3002 goto do_not_strip_quotes;
3015 do_not_strip_quotes: ;
3019 return yystrlen (yystr);
3021 return yystpcpy (yyres, yystr) - yyres;
3025 /* Copy into YYRESULT an error message about the unexpected token
3026 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3027 including the terminating null byte. If YYRESULT is null, do not
3028 copy anything; just return the number of bytes that would be
3029 copied. As a special case, return 0 if an ordinary "syntax error"
3030 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3031 size calculation. */
3033 yysyntax_error (char *yyresult, int yystate, int yychar)
3035 int yyn = yypact[yystate];
3037 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3041 int yytype = YYTRANSLATE (yychar);
3042 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3043 YYSIZE_T yysize = yysize0;
3045 int yysize_overflow = 0;
3046 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3047 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3051 /* This is so xgettext sees the translatable formats that are
3052 constructed on the fly. */
3053 YY_("syntax error, unexpected %s");
3054 YY_("syntax error, unexpected %s, expecting %s");
3055 YY_("syntax error, unexpected %s, expecting %s or %s");
3056 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3057 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3061 static char const yyunexpected[] = "syntax error, unexpected %s";
3062 static char const yyexpecting[] = ", expecting %s";
3063 static char const yyor[] = " or %s";
3064 char yyformat[sizeof yyunexpected
3065 + sizeof yyexpecting - 1
3066 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3067 * (sizeof yyor - 1))];
3068 char const *yyprefix = yyexpecting;
3070 /* Start YYX at -YYN if negative to avoid negative indexes in
3072 int yyxbegin = yyn < 0 ? -yyn : 0;
3074 /* Stay within bounds of both yycheck and yytname. */
3075 int yychecklim = YYLAST - yyn + 1;
3076 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3079 yyarg[0] = yytname[yytype];
3080 yyfmt = yystpcpy (yyformat, yyunexpected);
3082 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3083 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3085 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3089 yyformat[sizeof yyunexpected - 1] = '\0';
3092 yyarg[yycount++] = yytname[yyx];
3093 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3094 yysize_overflow |= (yysize1 < yysize);
3096 yyfmt = yystpcpy (yyfmt, yyprefix);
3100 yyf = YY_(yyformat);
3101 yysize1 = yysize + yystrlen (yyf);
3102 yysize_overflow |= (yysize1 < yysize);
3105 if (yysize_overflow)
3106 return YYSIZE_MAXIMUM;
3110 /* Avoid sprintf, as that infringes on the user's name space.
3111 Don't have undefined behavior even if the translation
3112 produced a string with the wrong number of "%s"s. */
3113 char *yyp = yyresult;
3115 while ((*yyp = *yyf) != '\0')
3117 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3119 yyp += yytnamerr (yyp, yyarg[yyi++]);
3132 #endif /* YYERROR_VERBOSE */
3135 /*-----------------------------------------------.
3136 | Release the memory associated to this symbol. |
3137 `-----------------------------------------------*/
3140 #if (defined __STDC__ || defined __C99__FUNC__ \
3141 || defined __cplusplus || defined _MSC_VER)
3143 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3146 yydestruct (yymsg, yytype, yyvaluep)
3156 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3167 /* Prevent warnings from -Wmissing-prototypes. */
3169 #ifdef YYPARSE_PARAM
3170 #if defined __STDC__ || defined __cplusplus
3171 int yyparse (void *YYPARSE_PARAM);
3175 #else /* ! YYPARSE_PARAM */
3176 #if defined __STDC__ || defined __cplusplus
3181 #endif /* ! YYPARSE_PARAM */
3185 /* The look-ahead symbol. */
3188 /* The semantic value of the look-ahead symbol. */
3191 /* Number of syntax errors so far. */
3200 #ifdef YYPARSE_PARAM
3201 #if (defined __STDC__ || defined __C99__FUNC__ \
3202 || defined __cplusplus || defined _MSC_VER)
3204 yyparse (void *YYPARSE_PARAM)
3207 yyparse (YYPARSE_PARAM)
3208 void *YYPARSE_PARAM;
3210 #else /* ! YYPARSE_PARAM */
3211 #if (defined __STDC__ || defined __C99__FUNC__ \
3212 || defined __cplusplus || defined _MSC_VER)
3226 /* Number of tokens to shift before error messages enabled. */
3228 /* Look-ahead token as an internal (translated) token number. */
3231 /* Buffer for error messages, and its allocated size. */
3233 char *yymsg = yymsgbuf;
3234 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3237 /* Three stacks and their tools:
3238 `yyss': related to states,
3239 `yyvs': related to semantic values,
3240 `yyls': related to locations.
3242 Refer to the stacks thru separate pointers, to allow yyoverflow
3243 to reallocate them elsewhere. */
3245 /* The state stack. */
3246 yytype_int16 yyssa[YYINITDEPTH];
3247 yytype_int16 *yyss = yyssa;
3248 yytype_int16 *yyssp;
3250 /* The semantic value stack. */
3251 YYSTYPE yyvsa[YYINITDEPTH];
3252 YYSTYPE *yyvs = yyvsa;
3257 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3259 YYSIZE_T yystacksize = YYINITDEPTH;
3261 /* The variables used to return semantic value and location from the
3266 /* The number of symbols on the RHS of the reduced rule.
3267 Keep to zero when no symbol should be popped. */
3270 YYDPRINTF ((stderr, "Starting parse\n"));
3275 yychar = YYEMPTY; /* Cause a token to be read. */
3277 /* Initialize stack pointers.
3278 Waste one element of value and location stack
3279 so that they stay on the same level as the state stack.
3280 The wasted elements are never initialized. */
3287 /*------------------------------------------------------------.
3288 | yynewstate -- Push a new state, which is found in yystate. |
3289 `------------------------------------------------------------*/
3291 /* In all cases, when you get here, the value and location stacks
3292 have just been pushed. So pushing a state here evens the stacks. */
3298 if (yyss + yystacksize - 1 <= yyssp)
3300 /* Get the current used size of the three stacks, in elements. */
3301 YYSIZE_T yysize = yyssp - yyss + 1;
3305 /* Give user a chance to reallocate the stack. Use copies of
3306 these so that the &'s don't force the real ones into
3308 YYSTYPE *yyvs1 = yyvs;
3309 yytype_int16 *yyss1 = yyss;
3312 /* Each stack pointer address is followed by the size of the
3313 data in use in that stack, in bytes. This used to be a
3314 conditional around just the two extra args, but that might
3315 be undefined if yyoverflow is a macro. */
3316 yyoverflow (YY_("memory exhausted"),
3317 &yyss1, yysize * sizeof (*yyssp),
3318 &yyvs1, yysize * sizeof (*yyvsp),
3325 #else /* no yyoverflow */
3326 # ifndef YYSTACK_RELOCATE
3327 goto yyexhaustedlab;
3329 /* Extend the stack our own way. */
3330 if (YYMAXDEPTH <= yystacksize)
3331 goto yyexhaustedlab;
3333 if (YYMAXDEPTH < yystacksize)
3334 yystacksize = YYMAXDEPTH;
3337 yytype_int16 *yyss1 = yyss;
3338 union yyalloc *yyptr =
3339 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3341 goto yyexhaustedlab;
3342 YYSTACK_RELOCATE (yyss);
3343 YYSTACK_RELOCATE (yyvs);
3345 # undef YYSTACK_RELOCATE
3347 YYSTACK_FREE (yyss1);
3350 #endif /* no yyoverflow */
3352 yyssp = yyss + yysize - 1;
3353 yyvsp = yyvs + yysize - 1;
3356 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3357 (unsigned long int) yystacksize));
3359 if (yyss + yystacksize - 1 <= yyssp)
3363 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3372 /* Do appropriate processing given the current state. Read a
3373 look-ahead token if we need one and don't already have one. */
3375 /* First try to decide what to do without reference to look-ahead token. */
3376 yyn = yypact[yystate];
3377 if (yyn == YYPACT_NINF)
3380 /* Not known => get a look-ahead token if don't already have one. */
3382 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3383 if (yychar == YYEMPTY)
3385 YYDPRINTF ((stderr, "Reading a token: "));
3389 if (yychar <= YYEOF)
3391 yychar = yytoken = YYEOF;
3392 YYDPRINTF ((stderr, "Now at end of input.\n"));
3396 yytoken = YYTRANSLATE (yychar);
3397 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3400 /* If the proper action on seeing token YYTOKEN is to reduce or to
3401 detect an error, take that action. */
3403 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3408 if (yyn == 0 || yyn == YYTABLE_NINF)
3417 /* Count tokens shifted since error; after three, turn off error
3422 /* Shift the look-ahead token. */
3423 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3425 /* Discard the shifted token unless it is eof. */
3426 if (yychar != YYEOF)
3435 /*-----------------------------------------------------------.
3436 | yydefault -- do the default action for the current state. |
3437 `-----------------------------------------------------------*/
3439 yyn = yydefact[yystate];
3445 /*-----------------------------.
3446 | yyreduce -- Do a reduction. |
3447 `-----------------------------*/
3449 /* yyn is the number of a rule to reduce with. */
3452 /* If YYLEN is nonzero, implement the default value of the action:
3455 Otherwise, the following line sets YYVAL to garbage.
3456 This behavior is undocumented and Bison
3457 users should not rely upon it. Assigning to YYVAL
3458 unconditionally makes the parser a bit smaller, and it avoids a
3459 GCC warning that YYVAL may be used uninitialized. */
3460 yyval = yyvsp[1-yylen];
3463 YY_REDUCE_PRINT (yyn);
3467 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3468 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3472 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3473 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3477 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3478 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3482 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3483 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3487 #line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3488 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3492 #line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3493 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3497 #line 1122 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3498 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3502 #line 1122 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3503 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3507 #line 1123 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3508 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3512 #line 1123 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3513 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3517 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3518 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3522 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3523 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3527 #line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3528 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3532 #line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3533 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3537 #line 1129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3538 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3542 #line 1129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3543 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3547 #line 1130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3548 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3552 #line 1130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3553 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3557 #line 1131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3558 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3562 #line 1131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3563 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3567 #line 1132 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3568 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3572 #line 1132 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3573 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3577 #line 1133 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3578 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3582 #line 1133 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3583 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3587 #line 1134 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3588 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3592 #line 1135 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3593 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3597 #line 1144 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3598 { (yyval.StrVal) = 0; ;}
3602 #line 1146 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3603 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3607 #line 1147 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3608 { (yyval.UIntVal)=0; ;}
3612 #line 1151 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3614 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3620 #line 1155 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3628 #line 1163 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3636 #line 1168 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3638 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3644 #line 1174 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3645 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3649 #line 1175 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3650 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3654 #line 1176 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3655 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3659 #line 1177 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3660 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3664 #line 1178 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3665 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3669 #line 1182 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3670 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3674 #line 1183 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3675 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3679 #line 1184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3680 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3684 #line 1188 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3685 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3689 #line 1189 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3690 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3694 #line 1190 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3695 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3699 #line 1191 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3700 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3704 #line 1195 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3705 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3709 #line 1196 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3710 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3714 #line 1197 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3715 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3719 #line 1201 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3720 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3724 #line 1202 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3725 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3729 #line 1203 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3730 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3734 #line 1204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3735 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3739 #line 1205 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3740 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3744 #line 1209 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3745 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3749 #line 1210 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3750 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3754 #line 1211 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3755 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3759 #line 1214 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3760 { (yyval.UIntVal) = CallingConv::C; ;}
3764 #line 1215 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3765 { (yyval.UIntVal) = CallingConv::C; ;}
3769 #line 1216 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3770 { (yyval.UIntVal) = CallingConv::Fast; ;}
3774 #line 1217 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3775 { (yyval.UIntVal) = CallingConv::Cold; ;}
3779 #line 1218 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3780 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3784 #line 1219 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3785 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3789 #line 1220 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3791 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3792 GEN_ERROR("Calling conv too large");
3793 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3799 #line 1227 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3800 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3804 #line 1228 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3805 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3809 #line 1229 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3810 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3814 #line 1230 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3815 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3819 #line 1231 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3820 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3824 #line 1232 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3825 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3829 #line 1233 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3830 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3834 #line 1234 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3835 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3839 #line 1235 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3840 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3844 #line 1238 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3845 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3849 #line 1239 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3851 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3856 #line 1244 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3857 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3861 #line 1245 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3862 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3866 #line 1246 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3867 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3871 #line 1247 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3872 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3876 #line 1248 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3877 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3881 #line 1249 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3882 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3886 #line 1252 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3887 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3891 #line 1253 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3893 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3898 #line 1258 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3899 { (yyval.StrVal) = 0; ;}
3903 #line 1259 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3905 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3910 #line 1266 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3911 { (yyval.UIntVal) = 0; ;}
3915 #line 1267 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3917 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3918 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3919 GEN_ERROR("Alignment must be a power of two");
3925 #line 1273 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3926 { (yyval.UIntVal) = 0; ;}
3930 #line 1274 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3932 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3933 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3934 GEN_ERROR("Alignment must be a power of two");
3940 #line 1283 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3942 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3943 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3944 GEN_ERROR("Invalid character in section name");
3945 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3951 #line 1291 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3952 { (yyval.StrVal) = 0; ;}
3956 #line 1292 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3957 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3961 #line 1297 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3966 #line 1298 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3971 #line 1299 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3973 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3974 delete (yyvsp[(1) - (1)].StrVal);
3980 #line 1304 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3982 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3983 GEN_ERROR("Alignment must be a power of two");
3984 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3990 #line 1320 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3992 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3998 #line 1324 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4000 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4006 #line 1328 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4008 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4009 GEN_ERROR("Cannot form a pointer to a basic block");
4010 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4011 delete (yyvsp[(1) - (3)].TypeVal);
4017 #line 1335 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4018 { // Named types are also simple types...
4019 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4021 (yyval.TypeVal) = new PATypeHolder(tmp);
4026 #line 1340 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4027 { // Type UpReference
4028 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4029 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4030 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4031 (yyval.TypeVal) = new PATypeHolder(OT);
4032 UR_OUT("New Upreference!\n");
4038 #line 1348 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4040 // Allow but ignore attributes on function types; this permits auto-upgrade.
4041 // FIXME: remove in LLVM 3.0.
4042 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
4043 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4044 isa<OpaqueType>(RetTy)))
4045 GEN_ERROR("LLVM Functions cannot return aggregates");
4047 std::vector<const Type*> Params;
4048 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4049 for (; I != E; ++I ) {
4050 const Type *Ty = I->Ty->get();
4051 Params.push_back(Ty);
4054 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4055 if (isVarArg) Params.pop_back();
4057 for (unsigned i = 0; i != Params.size(); ++i)
4058 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4059 GEN_ERROR("Function arguments must be value types!");
4063 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4064 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4065 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4066 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4072 #line 1378 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4074 // Allow but ignore attributes on function types; this permits auto-upgrade.
4075 // FIXME: remove in LLVM 3.0.
4076 std::vector<const Type*> Params;
4077 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4078 for ( ; I != E; ++I ) {
4079 const Type* Ty = I->Ty->get();
4080 Params.push_back(Ty);
4083 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4084 if (isVarArg) Params.pop_back();
4086 for (unsigned i = 0; i != Params.size(); ++i)
4087 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4088 GEN_ERROR("Function arguments must be value types!");
4092 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4093 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4094 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4100 #line 1403 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4101 { // Sized array type?
4102 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4103 delete (yyvsp[(4) - (5)].TypeVal);
4109 #line 1408 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4111 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4112 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4113 GEN_ERROR("Unsigned result not equal to signed result");
4114 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4115 GEN_ERROR("Element type of a VectorType must be primitive");
4116 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4117 delete (yyvsp[(4) - (5)].TypeVal);
4123 #line 1418 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4124 { // Structure type?
4125 std::vector<const Type*> Elements;
4126 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4127 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4128 Elements.push_back(*I);
4130 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4131 delete (yyvsp[(2) - (3)].TypeList);
4137 #line 1428 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4138 { // Empty structure type?
4139 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4145 #line 1432 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4147 std::vector<const Type*> Elements;
4148 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4149 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4150 Elements.push_back(*I);
4152 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4153 delete (yyvsp[(3) - (5)].TypeList);
4159 #line 1442 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4160 { // Empty structure type?
4161 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4167 #line 1449 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4169 // Allow but ignore attributes on function types; this permits auto-upgrade.
4170 // FIXME: remove in LLVM 3.0.
4171 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4172 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4177 #line 1458 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4179 if (!UpRefs.empty())
4180 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4181 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
4182 GEN_ERROR("LLVM functions cannot return aggregate types");
4183 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4188 #line 1465 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4190 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4195 #line 1470 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4197 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4198 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4204 #line 1475 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4206 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4212 #line 1483 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4214 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4215 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4216 TWA.Ty = new PATypeHolder(Type::VoidTy);
4217 (yyval.TypeWithAttrsList)->push_back(TWA);
4223 #line 1490 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4225 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4226 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4227 TWA.Ty = new PATypeHolder(Type::VoidTy);
4228 (yyval.TypeWithAttrsList)->push_back(TWA);
4234 #line 1497 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4236 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4242 #line 1505 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4244 (yyval.TypeList) = new std::list<PATypeHolder>();
4245 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4246 delete (yyvsp[(1) - (1)].TypeVal);
4252 #line 1511 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4254 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4255 delete (yyvsp[(3) - (3)].TypeVal);
4261 #line 1523 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4262 { // Nonempty unsized arr
4263 if (!UpRefs.empty())
4264 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4265 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4267 GEN_ERROR("Cannot make array constant with type: '" +
4268 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4269 const Type *ETy = ATy->getElementType();
4270 int NumElements = ATy->getNumElements();
4272 // Verify that we have the correct size...
4273 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4274 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4275 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4276 itostr(NumElements) + "");
4278 // Verify all elements are correct type!
4279 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4280 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4281 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4282 ETy->getDescription() +"' as required!\nIt is of type '"+
4283 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4286 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4287 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4293 #line 1551 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4295 if (!UpRefs.empty())
4296 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4297 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4299 GEN_ERROR("Cannot make array constant with type: '" +
4300 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4302 int NumElements = ATy->getNumElements();
4303 if (NumElements != -1 && NumElements != 0)
4304 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4305 " arguments, but has size of " + itostr(NumElements) +"");
4306 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4307 delete (yyvsp[(1) - (3)].TypeVal);
4313 #line 1567 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4315 if (!UpRefs.empty())
4316 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4317 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4319 GEN_ERROR("Cannot make array constant with type: '" +
4320 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4322 int NumElements = ATy->getNumElements();
4323 const Type *ETy = ATy->getElementType();
4324 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4325 GEN_ERROR("Can't build string constant of size " +
4326 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4327 " when array has size " + itostr(NumElements) + "");
4328 std::vector<Constant*> Vals;
4329 if (ETy == Type::Int8Ty) {
4330 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4331 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4333 delete (yyvsp[(3) - (3)].StrVal);
4334 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4336 delete (yyvsp[(3) - (3)].StrVal);
4337 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4338 delete (yyvsp[(1) - (3)].TypeVal);
4344 #line 1594 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4345 { // Nonempty unsized arr
4346 if (!UpRefs.empty())
4347 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4348 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4350 GEN_ERROR("Cannot make packed constant with type: '" +
4351 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4352 const Type *ETy = PTy->getElementType();
4353 int NumElements = PTy->getNumElements();
4355 // Verify that we have the correct size...
4356 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4357 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4358 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4359 itostr(NumElements) + "");
4361 // Verify all elements are correct type!
4362 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4363 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4364 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4365 ETy->getDescription() +"' as required!\nIt is of type '"+
4366 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4369 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4370 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4376 #line 1622 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4378 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4380 GEN_ERROR("Cannot make struct constant with type: '" +
4381 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4383 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4384 GEN_ERROR("Illegal number of initializers for structure type");
4386 // Check to ensure that constants are compatible with the type initializer!
4387 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4388 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4389 GEN_ERROR("Expected type '" +
4390 STy->getElementType(i)->getDescription() +
4391 "' for element #" + utostr(i) +
4392 " of structure initializer");
4394 // Check to ensure that Type is not packed
4395 if (STy->isPacked())
4396 GEN_ERROR("Unpacked Initializer to vector type '" +
4397 STy->getDescription() + "'");
4399 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4400 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4406 #line 1648 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4408 if (!UpRefs.empty())
4409 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4410 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4412 GEN_ERROR("Cannot make struct constant with type: '" +
4413 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4415 if (STy->getNumContainedTypes() != 0)
4416 GEN_ERROR("Illegal number of initializers for structure type");
4418 // Check to ensure that Type is not packed
4419 if (STy->isPacked())
4420 GEN_ERROR("Unpacked Initializer to vector type '" +
4421 STy->getDescription() + "'");
4423 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4424 delete (yyvsp[(1) - (3)].TypeVal);
4430 #line 1668 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4432 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4434 GEN_ERROR("Cannot make struct constant with type: '" +
4435 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4437 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4438 GEN_ERROR("Illegal number of initializers for structure type");
4440 // Check to ensure that constants are compatible with the type initializer!
4441 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4442 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4443 GEN_ERROR("Expected type '" +
4444 STy->getElementType(i)->getDescription() +
4445 "' for element #" + utostr(i) +
4446 " of structure initializer");
4448 // Check to ensure that Type is packed
4449 if (!STy->isPacked())
4450 GEN_ERROR("Vector initializer to non-vector type '" +
4451 STy->getDescription() + "'");
4453 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4454 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4460 #line 1694 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4462 if (!UpRefs.empty())
4463 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4464 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4466 GEN_ERROR("Cannot make struct constant with type: '" +
4467 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4469 if (STy->getNumContainedTypes() != 0)
4470 GEN_ERROR("Illegal number of initializers for structure type");
4472 // Check to ensure that Type is packed
4473 if (!STy->isPacked())
4474 GEN_ERROR("Vector initializer to non-vector type '" +
4475 STy->getDescription() + "'");
4477 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4478 delete (yyvsp[(1) - (5)].TypeVal);
4484 #line 1714 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4486 if (!UpRefs.empty())
4487 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4488 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4490 GEN_ERROR("Cannot make null pointer constant with type: '" +
4491 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4493 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4494 delete (yyvsp[(1) - (2)].TypeVal);
4500 #line 1726 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4502 if (!UpRefs.empty())
4503 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4504 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4505 delete (yyvsp[(1) - (2)].TypeVal);
4511 #line 1733 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4513 if (!UpRefs.empty())
4514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4515 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4517 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4519 // ConstExprs can exist in the body of a function, thus creating
4520 // GlobalValues whenever they refer to a variable. Because we are in
4521 // the context of a function, getExistingVal will search the functions
4522 // symbol table instead of the module symbol table for the global symbol,
4523 // which throws things all off. To get around this, we just tell
4524 // getExistingVal that we are at global scope here.
4526 Function *SavedCurFn = CurFun.CurrentFunction;
4527 CurFun.CurrentFunction = 0;
4529 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4532 CurFun.CurrentFunction = SavedCurFn;
4534 // If this is an initializer for a constant pointer, which is referencing a
4535 // (currently) undefined variable, create a stub now that shall be replaced
4536 // in the future with the right type of variable.
4539 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4540 const PointerType *PT = cast<PointerType>(Ty);
4542 // First check to see if the forward references value is already created!
4543 PerModuleInfo::GlobalRefsType::iterator I =
4544 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4546 if (I != CurModule.GlobalRefs.end()) {
4547 V = I->second; // Placeholder already exists, use it...
4548 (yyvsp[(2) - (2)].ValIDVal).destroy();
4551 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4552 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4553 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4554 GEN_ERROR("Invalid reference to global");
4556 // Create the forward referenced global.
4558 if (const FunctionType *FTy =
4559 dyn_cast<FunctionType>(PT->getElementType())) {
4560 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4561 CurModule.CurrentModule);
4563 GV = new GlobalVariable(PT->getElementType(), false,
4564 GlobalValue::ExternalWeakLinkage, 0,
4565 Name, CurModule.CurrentModule);
4568 // Keep track of the fact that we have a forward ref to recycle it
4569 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4574 (yyval.ConstVal) = cast<GlobalValue>(V);
4575 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4581 #line 1799 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4583 if (!UpRefs.empty())
4584 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4585 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4586 GEN_ERROR("Mismatched types for constant expression: " +
4587 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4588 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4589 delete (yyvsp[(1) - (2)].TypeVal);
4595 #line 1809 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4597 if (!UpRefs.empty())
4598 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4599 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4600 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4601 GEN_ERROR("Cannot create a null initialized value of this type");
4602 (yyval.ConstVal) = Constant::getNullValue(Ty);
4603 delete (yyvsp[(1) - (2)].TypeVal);
4609 #line 1819 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4610 { // integral constants
4611 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4612 GEN_ERROR("Constant value doesn't fit in type");
4613 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4619 #line 1825 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4620 { // arbitrary precision integer constants
4621 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4622 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4623 GEN_ERROR("Constant value does not fit in type");
4625 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4626 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4627 delete (yyvsp[(2) - (2)].APIntVal);
4633 #line 1835 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4634 { // integral constants
4635 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4636 GEN_ERROR("Constant value doesn't fit in type");
4637 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4643 #line 1841 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4644 { // arbitrary precision integer constants
4645 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4646 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4647 GEN_ERROR("Constant value does not fit in type");
4649 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4650 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4651 delete (yyvsp[(2) - (2)].APIntVal);
4657 #line 1851 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4658 { // Boolean constants
4659 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4660 (yyval.ConstVal) = ConstantInt::getTrue();
4666 #line 1856 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4667 { // Boolean constants
4668 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4669 (yyval.ConstVal) = ConstantInt::getFalse();
4675 #line 1861 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4676 { // Floating point constants
4677 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4678 GEN_ERROR("Floating point constant invalid for type");
4679 // Lexer has no type info, so builds all float and double FP constants
4680 // as double. Fix this here. Long double is done right.
4681 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4682 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4683 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4684 delete (yyvsp[(2) - (2)].FPVal);
4690 #line 1874 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4692 if (!UpRefs.empty())
4693 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4694 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4695 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4696 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4697 GEN_ERROR("invalid cast opcode for cast from '" +
4698 Val->getType()->getDescription() + "' to '" +
4699 DestTy->getDescription() + "'");
4700 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4701 delete (yyvsp[(5) - (6)].TypeVal);
4706 #line 1886 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4708 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4709 GEN_ERROR("GetElementPtr requires a pointer operand");
4712 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4715 GEN_ERROR("Index list invalid for constant getelementptr");
4717 SmallVector<Constant*, 8> IdxVec;
4718 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4719 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4720 IdxVec.push_back(C);
4722 GEN_ERROR("Indices to constant getelementptr must be constants");
4724 delete (yyvsp[(4) - (5)].ValueList);
4726 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4732 #line 1908 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4734 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4735 GEN_ERROR("Select condition must be of boolean type");
4736 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4737 GEN_ERROR("Select operand types must match");
4738 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4744 #line 1916 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4746 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4747 GEN_ERROR("Binary operator types must match");
4749 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4754 #line 1922 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4756 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4757 GEN_ERROR("Logical operator types must match");
4758 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4759 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4760 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4761 GEN_ERROR("Logical operator requires integral operands");
4763 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4769 #line 1933 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4771 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4772 GEN_ERROR("icmp operand types must match");
4773 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4778 #line 1938 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4780 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4781 GEN_ERROR("fcmp operand types must match");
4782 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4787 #line 1943 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4789 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4790 GEN_ERROR("Invalid extractelement operands");
4791 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4797 #line 1949 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4799 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4800 GEN_ERROR("Invalid insertelement operands");
4801 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4807 #line 1955 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4809 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4810 GEN_ERROR("Invalid shufflevector operands");
4811 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4817 #line 1964 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4819 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4825 #line 1968 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4827 (yyval.ConstVector) = new std::vector<Constant*>();
4828 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4834 #line 1976 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4835 { (yyval.BoolVal) = false; ;}
4839 #line 1976 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4840 { (yyval.BoolVal) = true; ;}
4844 #line 1979 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4845 { (yyval.BoolVal) = true; ;}
4849 #line 1979 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4850 { (yyval.BoolVal) = false; ;}
4854 #line 1982 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4856 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4857 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4859 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4861 GEN_ERROR("Aliases can be created only to global values");
4863 (yyval.ConstVal) = Aliasee;
4865 delete (yyvsp[(1) - (2)].TypeVal);
4870 #line 1994 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4872 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4873 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4874 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4875 GEN_ERROR("invalid cast opcode for cast from '" +
4876 Val->getType()->getDescription() + "' to '" +
4877 DestTy->getDescription() + "'");
4879 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4881 delete (yyvsp[(5) - (6)].TypeVal);
4886 #line 2015 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4888 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4889 CurModule.ModuleDone();
4895 #line 2020 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4897 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4898 CurModule.ModuleDone();
4904 #line 2033 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4905 { CurFun.isDeclare = false; ;}
4909 #line 2033 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4911 CurFun.FunctionDone();
4917 #line 2037 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4918 { CurFun.isDeclare = true; ;}
4922 #line 2037 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4929 #line 2040 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4936 #line 2043 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4938 if (!UpRefs.empty())
4939 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4940 // Eagerly resolve types. This is not an optimization, this is a
4941 // requirement that is due to the fact that we could have this:
4943 // %list = type { %list * }
4944 // %list = type { %list * } ; repeated type decl
4946 // If types are not resolved eagerly, then the two types will not be
4947 // determined to be the same type!
4949 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4951 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4953 // If this is a named type that is not a redefinition, add it to the slot
4955 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4958 delete (yyvsp[(3) - (3)].TypeVal);
4964 #line 2067 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4966 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4968 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4970 // If this is a named type that is not a redefinition, add it to the slot
4972 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4979 #line 2079 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4981 /* "Externally Visible" Linkage */
4982 if ((yyvsp[(5) - (6)].ConstVal) == 0)
4983 GEN_ERROR("Global value initializer is not a constant");
4984 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
4985 (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));
4991 #line 2086 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4998 #line 2090 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5000 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5001 GEN_ERROR("Global value initializer is not a constant");
5002 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));
5008 #line 2095 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5015 #line 2099 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5017 if (!UpRefs.empty())
5018 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5019 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));
5021 delete (yyvsp[(6) - (7)].TypeVal);
5026 #line 2105 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5034 #line 2109 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5037 if ((yyvsp[(1) - (5)].StrVal)) {
5038 Name = *(yyvsp[(1) - (5)].StrVal);
5039 delete (yyvsp[(1) - (5)].StrVal);
5042 GEN_ERROR("Alias name cannot be empty");
5044 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5046 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5048 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5049 CurModule.CurrentModule);
5050 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5051 InsertValue(GA, CurModule.Values);
5054 // If there was a forward reference of this alias, resolve it now.
5058 ID = ValID::createGlobalName(Name);
5060 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5062 if (GlobalValue *FWGV =
5063 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5064 // Replace uses of the fwdref with the actual alias.
5065 FWGV->replaceAllUsesWith(GA);
5066 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5067 GV->eraseFromParent();
5069 cast<Function>(FWGV)->eraseFromParent();
5078 #line 2149 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5085 #line 2152 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5092 #line 2158 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5094 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5095 if (AsmSoFar.empty())
5096 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5098 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5099 delete (yyvsp[(1) - (1)].StrVal);
5105 #line 2168 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5107 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5108 delete (yyvsp[(3) - (3)].StrVal);
5113 #line 2172 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5115 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5116 delete (yyvsp[(3) - (3)].StrVal);
5121 #line 2179 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5123 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5124 delete (yyvsp[(3) - (3)].StrVal);
5130 #line 2184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5132 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5133 delete (yyvsp[(1) - (1)].StrVal);
5139 #line 2189 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5146 #line 2198 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5148 if (!UpRefs.empty())
5149 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5150 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5151 GEN_ERROR("void typed arguments are invalid");
5152 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5153 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5154 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5160 #line 2208 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5162 if (!UpRefs.empty())
5163 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5164 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5165 GEN_ERROR("void typed arguments are invalid");
5166 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5167 (yyval.ArgList) = new ArgListType;
5168 (yyval.ArgList)->push_back(E);
5174 #line 2219 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5176 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5182 #line 2223 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5184 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5185 struct ArgListEntry E;
5186 E.Ty = new PATypeHolder(Type::VoidTy);
5188 E.Attrs = ParamAttr::None;
5189 (yyval.ArgList)->push_back(E);
5195 #line 2232 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5197 (yyval.ArgList) = new ArgListType;
5198 struct ArgListEntry E;
5199 E.Ty = new PATypeHolder(Type::VoidTy);
5201 E.Attrs = ParamAttr::None;
5202 (yyval.ArgList)->push_back(E);
5208 #line 2241 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5210 (yyval.ArgList) = 0;
5216 #line 2247 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5218 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5219 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5221 // Check the function result for abstractness if this is a define. We should
5222 // have no abstract types at this point
5223 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5224 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5226 std::vector<const Type*> ParamTypeList;
5227 ParamAttrsVector Attrs;
5228 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
5229 ParamAttrsWithIndex PAWI;
5231 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
5232 Attrs.push_back(PAWI);
5234 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5236 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5237 const Type* Ty = I->Ty->get();
5238 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5239 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5240 ParamTypeList.push_back(Ty);
5241 if (Ty != Type::VoidTy)
5242 if (I->Attrs != ParamAttr::None) {
5243 ParamAttrsWithIndex PAWI;
5245 PAWI.attrs = I->Attrs;
5246 Attrs.push_back(PAWI);
5251 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5252 if (isVarArg) ParamTypeList.pop_back();
5254 const ParamAttrsList *PAL = 0;
5256 PAL = ParamAttrsList::get(Attrs);
5258 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5259 const PointerType *PFT = PointerType::getUnqual(FT);
5260 delete (yyvsp[(2) - (10)].TypeVal);
5263 if (!FunctionName.empty()) {
5264 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5266 ID = ValID::createGlobalID(CurModule.Values.size());
5270 // See if this function was forward referenced. If so, recycle the object.
5271 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5272 // Move the function to the end of the list, from whereever it was
5273 // previously inserted.
5274 Fn = cast<Function>(FWRef);
5275 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
5276 CurModule.CurrentModule->getFunctionList().remove(Fn);
5277 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5278 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5279 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5280 if (Fn->getFunctionType() != FT ) {
5281 // The existing function doesn't have the same type. This is an overload
5283 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5284 } else if (Fn->getParamAttrs() != PAL) {
5285 // The existing function doesn't have the same parameter attributes.
5286 // This is an overload error.
5287 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5288 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5289 // Neither the existing or the current function is a declaration and they
5290 // have the same name and same type. Clearly this is a redefinition.
5291 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5292 } else if (Fn->isDeclaration()) {
5293 // Make sure to strip off any argument names so we can't get conflicts.
5294 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5298 } else { // Not already defined?
5299 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5300 CurModule.CurrentModule);
5301 InsertValue(Fn, CurModule.Values);
5304 CurFun.FunctionStart(Fn);
5306 if (CurFun.isDeclare) {
5307 // If we have declaration, always overwrite linkage. This will allow us to
5308 // correctly handle cases, when pointer to function is passed as argument to
5309 // another function.
5310 Fn->setLinkage(CurFun.Linkage);
5311 Fn->setVisibility(CurFun.Visibility);
5313 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5314 Fn->setParamAttrs(PAL);
5315 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5316 if ((yyvsp[(8) - (10)].StrVal)) {
5317 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5318 delete (yyvsp[(8) - (10)].StrVal);
5320 if ((yyvsp[(10) - (10)].StrVal)) {
5321 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5322 delete (yyvsp[(10) - (10)].StrVal);
5325 // Add all of the arguments we parsed to the function...
5326 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5327 if (isVarArg) { // Nuke the last entry
5328 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5329 "Not a varargs marker!");
5330 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5331 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5333 Function::arg_iterator ArgIt = Fn->arg_begin();
5334 Function::arg_iterator ArgEnd = Fn->arg_end();
5336 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5337 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5338 delete I->Ty; // Delete the typeholder...
5339 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5345 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5352 #line 2382 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5354 (yyval.FunctionVal) = CurFun.CurrentFunction;
5356 // Make sure that we keep track of the linkage type even if there was a
5357 // previous "declare".
5358 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5359 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5364 #line 2393 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5366 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5372 #line 2398 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5374 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5375 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5376 (yyval.FunctionVal) = CurFun.CurrentFunction;
5377 CurFun.FunctionDone();
5383 #line 2410 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5385 (yyval.BoolVal) = false;
5391 #line 2414 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5393 (yyval.BoolVal) = true;
5399 #line 2419 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5400 { // A reference to a direct constant
5401 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5407 #line 2423 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5409 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5415 #line 2427 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5416 { // Perhaps it's an FP constant?
5417 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5423 #line 2431 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5425 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5431 #line 2435 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5433 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5439 #line 2439 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5441 (yyval.ValIDVal) = ValID::createNull();
5447 #line 2443 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5449 (yyval.ValIDVal) = ValID::createUndef();
5455 #line 2447 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5456 { // A vector zero constant.
5457 (yyval.ValIDVal) = ValID::createZeroInit();
5463 #line 2451 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5464 { // Nonempty unsized packed vector
5465 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5466 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5468 VectorType* pt = VectorType::get(ETy, NumElements);
5469 PATypeHolder* PTy = new PATypeHolder(
5477 // Verify all elements are correct type!
5478 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5479 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5480 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5481 ETy->getDescription() +"' as required!\nIt is of type '" +
5482 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5485 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5486 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5492 #line 2476 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5494 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5500 #line 2480 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5502 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5503 delete (yyvsp[(3) - (5)].StrVal);
5504 delete (yyvsp[(5) - (5)].StrVal);
5510 #line 2490 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5511 { // Is it an integer reference...?
5512 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5518 #line 2494 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5520 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5526 #line 2498 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5527 { // Is it a named reference...?
5528 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5529 delete (yyvsp[(1) - (1)].StrVal);
5535 #line 2503 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5536 { // Is it a named reference...?
5537 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5538 delete (yyvsp[(1) - (1)].StrVal);
5544 #line 2516 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5546 if (!UpRefs.empty())
5547 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5548 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5549 delete (yyvsp[(1) - (2)].TypeVal);
5555 #line 2525 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5557 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5563 #line 2529 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5564 { // Do not allow functions with 0 basic blocks
5565 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5571 #line 2538 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5573 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5575 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5576 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5577 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5583 #line 2547 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5585 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5586 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5587 if (CI2->getParent() == 0)
5588 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5589 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5590 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5596 #line 2556 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5597 { // Empty space between instruction lists
5598 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5604 #line 2560 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5605 { // Labelled (named) basic block
5606 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5607 delete (yyvsp[(1) - (1)].StrVal);
5614 #line 2567 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5615 { // Return with a result...
5616 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5622 #line 2571 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5623 { // Return with no result...
5624 (yyval.TermInstVal) = new ReturnInst();
5630 #line 2575 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5631 { // Unconditional Branch...
5632 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5634 (yyval.TermInstVal) = new BranchInst(tmpBB);
5639 #line 2580 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5641 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5642 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5644 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5646 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5648 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5653 #line 2590 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5655 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5657 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5659 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5660 (yyval.TermInstVal) = S;
5662 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5663 E = (yyvsp[(8) - (9)].JumpTable)->end();
5664 for (; I != E; ++I) {
5665 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5666 S->addCase(CI, I->second);
5668 GEN_ERROR("Switch case is constant, but not a simple integer");
5670 delete (yyvsp[(8) - (9)].JumpTable);
5676 #line 2609 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5678 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5680 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5682 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5683 (yyval.TermInstVal) = S;
5689 #line 2619 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5692 // Handle the short syntax
5693 const PointerType *PFTy = 0;
5694 const FunctionType *Ty = 0;
5695 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5696 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5697 // Pull out the types of all of the arguments...
5698 std::vector<const Type*> ParamTypes;
5699 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5700 for (; I != E; ++I) {
5701 const Type *Ty = I->Val->getType();
5702 if (Ty == Type::VoidTy)
5703 GEN_ERROR("Short call syntax cannot be used with varargs");
5704 ParamTypes.push_back(Ty);
5706 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5707 PFTy = PointerType::getUnqual(Ty);
5710 delete (yyvsp[(3) - (14)].TypeVal);
5712 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5714 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5716 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5719 ParamAttrsVector Attrs;
5720 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5721 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5722 Attrs.push_back(PAWI);
5725 // Check the arguments
5727 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5728 // Make sure no arguments is a good thing!
5729 if (Ty->getNumParams() != 0)
5730 GEN_ERROR("No arguments passed to a function that "
5731 "expects arguments");
5732 } else { // Has arguments?
5733 // Loop through FunctionType's arguments and ensure they are specified
5735 FunctionType::param_iterator I = Ty->param_begin();
5736 FunctionType::param_iterator E = Ty->param_end();
5737 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5740 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5741 if (ArgI->Val->getType() != *I)
5742 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5743 (*I)->getDescription() + "'");
5744 Args.push_back(ArgI->Val);
5745 if (ArgI->Attrs != ParamAttr::None) {
5746 ParamAttrsWithIndex PAWI;
5748 PAWI.attrs = ArgI->Attrs;
5749 Attrs.push_back(PAWI);
5753 if (Ty->isVarArg()) {
5755 for (; ArgI != ArgE; ++ArgI, ++index) {
5756 Args.push_back(ArgI->Val); // push the remaining varargs
5757 if (ArgI->Attrs != ParamAttr::None) {
5758 ParamAttrsWithIndex PAWI;
5760 PAWI.attrs = ArgI->Attrs;
5761 Attrs.push_back(PAWI);
5764 } else if (I != E || ArgI != ArgE)
5765 GEN_ERROR("Invalid number of parameters detected");
5768 const ParamAttrsList *PAL = 0;
5770 PAL = ParamAttrsList::get(Attrs);
5772 // Create the InvokeInst
5773 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5774 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5775 II->setParamAttrs(PAL);
5776 (yyval.TermInstVal) = II;
5777 delete (yyvsp[(6) - (14)].ParamList);
5783 #line 2709 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5785 (yyval.TermInstVal) = new UnwindInst();
5791 #line 2713 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5793 (yyval.TermInstVal) = new UnreachableInst();
5799 #line 2720 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5801 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5802 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5805 GEN_ERROR("May only switch on a constant pool value");
5807 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5809 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5814 #line 2731 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5816 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5817 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5821 GEN_ERROR("May only switch on a constant pool value");
5823 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5825 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5830 #line 2744 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5832 // Is this definition named?? if so, assign the name...
5833 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5835 InsertValue((yyvsp[(2) - (2)].InstVal));
5836 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5842 #line 2754 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5843 { // Used for PHI nodes
5844 if (!UpRefs.empty())
5845 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5846 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5847 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5849 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5851 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5852 delete (yyvsp[(1) - (6)].TypeVal);
5857 #line 2765 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5859 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5860 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5862 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5864 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5869 #line 2775 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5871 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5872 if (!UpRefs.empty())
5873 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5874 // Used for call and invoke instructions
5875 (yyval.ParamList) = new ParamList();
5876 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5877 (yyval.ParamList)->push_back(E);
5878 delete (yyvsp[(1) - (4)].TypeVal);
5884 #line 2786 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5886 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5887 // Labels are only valid in ASMs
5888 (yyval.ParamList) = new ParamList();
5889 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5890 (yyval.ParamList)->push_back(E);
5896 #line 2794 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5898 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5899 if (!UpRefs.empty())
5900 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5901 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5902 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5903 (yyval.ParamList)->push_back(E);
5904 delete (yyvsp[(3) - (6)].TypeVal);
5910 #line 2804 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5912 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5913 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5914 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5915 (yyval.ParamList)->push_back(E);
5921 #line 2811 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5922 { (yyval.ParamList) = new ParamList(); ;}
5926 #line 2814 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5927 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5931 #line 2815 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5933 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5934 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5940 #line 2822 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5942 (yyval.BoolVal) = true;
5948 #line 2826 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5950 (yyval.BoolVal) = false;
5956 #line 2831 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5958 if (!UpRefs.empty())
5959 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5960 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5961 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5963 "Arithmetic operator requires integer, FP, or packed operands");
5964 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5966 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5968 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5969 if ((yyval.InstVal) == 0)
5970 GEN_ERROR("binary operator returned null");
5971 delete (yyvsp[(2) - (5)].TypeVal);
5976 #line 2847 "/home/asl/proj/llvm/src/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()) {
5981 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5982 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5983 GEN_ERROR("Logical operator requires integral operands");
5985 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5987 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5989 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5990 if ((yyval.InstVal) == 0)
5991 GEN_ERROR("binary operator returned null");
5992 delete (yyvsp[(2) - (5)].TypeVal);
5997 #line 2864 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5999 if (!UpRefs.empty())
6000 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6001 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6002 GEN_ERROR("Vector types not supported by icmp instruction");
6003 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6005 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6007 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6008 if ((yyval.InstVal) == 0)
6009 GEN_ERROR("icmp operator returned null");
6010 delete (yyvsp[(3) - (6)].TypeVal);
6015 #line 2878 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6017 if (!UpRefs.empty())
6018 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6019 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6020 GEN_ERROR("Vector types not supported by fcmp instruction");
6021 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6023 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6025 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6026 if ((yyval.InstVal) == 0)
6027 GEN_ERROR("fcmp operator returned null");
6028 delete (yyvsp[(3) - (6)].TypeVal);
6033 #line 2892 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6035 if (!UpRefs.empty())
6036 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6037 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6038 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6039 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6040 GEN_ERROR("invalid cast opcode for cast from '" +
6041 Val->getType()->getDescription() + "' to '" +
6042 DestTy->getDescription() + "'");
6043 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6044 delete (yyvsp[(4) - (4)].TypeVal);
6049 #line 2904 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6051 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6052 GEN_ERROR("select condition must be boolean");
6053 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6054 GEN_ERROR("select value types should match");
6055 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6061 #line 2912 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6063 if (!UpRefs.empty())
6064 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6065 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6066 delete (yyvsp[(4) - (4)].TypeVal);
6072 #line 2919 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6074 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6075 GEN_ERROR("Invalid extractelement operands");
6076 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6082 #line 2925 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6084 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6085 GEN_ERROR("Invalid insertelement operands");
6086 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6092 #line 2931 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6094 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6095 GEN_ERROR("Invalid shufflevector operands");
6096 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6102 #line 2937 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6104 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6105 if (!Ty->isFirstClassType())
6106 GEN_ERROR("PHI node operands must be of first class type");
6107 (yyval.InstVal) = new PHINode(Ty);
6108 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6109 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6110 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6111 GEN_ERROR("All elements of a PHI node must be of the same type");
6112 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6113 (yyvsp[(2) - (2)].PHIList)->pop_front();
6115 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6121 #line 2953 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6124 // Handle the short syntax
6125 const PointerType *PFTy = 0;
6126 const FunctionType *Ty = 0;
6127 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6128 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6129 // Pull out the types of all of the arguments...
6130 std::vector<const Type*> ParamTypes;
6131 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6132 for (; I != E; ++I) {
6133 const Type *Ty = I->Val->getType();
6134 if (Ty == Type::VoidTy)
6135 GEN_ERROR("Short call syntax cannot be used with varargs");
6136 ParamTypes.push_back(Ty);
6138 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6139 PFTy = PointerType::getUnqual(Ty);
6142 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6145 // Check for call to invalid intrinsic to avoid crashing later.
6146 if (Function *theF = dyn_cast<Function>(V)) {
6147 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6148 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6149 !theF->getIntrinsicID(true))
6150 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6151 theF->getName() + "'");
6154 // Set up the ParamAttrs for the function
6155 ParamAttrsVector Attrs;
6156 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6157 ParamAttrsWithIndex PAWI;
6159 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6160 Attrs.push_back(PAWI);
6162 // Check the arguments
6164 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6165 // Make sure no arguments is a good thing!
6166 if (Ty->getNumParams() != 0)
6167 GEN_ERROR("No arguments passed to a function that "
6168 "expects arguments");
6169 } else { // Has arguments?
6170 // Loop through FunctionType's arguments and ensure they are specified
6171 // correctly. Also, gather any parameter attributes.
6172 FunctionType::param_iterator I = Ty->param_begin();
6173 FunctionType::param_iterator E = Ty->param_end();
6174 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6177 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6178 if (ArgI->Val->getType() != *I)
6179 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6180 (*I)->getDescription() + "'");
6181 Args.push_back(ArgI->Val);
6182 if (ArgI->Attrs != ParamAttr::None) {
6183 ParamAttrsWithIndex PAWI;
6185 PAWI.attrs = ArgI->Attrs;
6186 Attrs.push_back(PAWI);
6189 if (Ty->isVarArg()) {
6191 for (; ArgI != ArgE; ++ArgI, ++index) {
6192 Args.push_back(ArgI->Val); // push the remaining varargs
6193 if (ArgI->Attrs != ParamAttr::None) {
6194 ParamAttrsWithIndex PAWI;
6196 PAWI.attrs = ArgI->Attrs;
6197 Attrs.push_back(PAWI);
6200 } else if (I != E || ArgI != ArgE)
6201 GEN_ERROR("Invalid number of parameters detected");
6204 // Finish off the ParamAttrs and check them
6205 const ParamAttrsList *PAL = 0;
6207 PAL = ParamAttrsList::get(Attrs);
6209 // Create the call node
6210 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
6211 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6212 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6213 CI->setParamAttrs(PAL);
6214 (yyval.InstVal) = CI;
6215 delete (yyvsp[(6) - (8)].ParamList);
6216 delete (yyvsp[(3) - (8)].TypeVal);
6222 #line 3050 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6224 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6230 #line 3055 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6232 (yyval.BoolVal) = true;
6238 #line 3059 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6240 (yyval.BoolVal) = false;
6246 #line 3066 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6248 if (!UpRefs.empty())
6249 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6250 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6251 delete (yyvsp[(2) - (3)].TypeVal);
6257 #line 3073 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6259 if (!UpRefs.empty())
6260 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6261 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6263 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6264 delete (yyvsp[(2) - (6)].TypeVal);
6269 #line 3081 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6271 if (!UpRefs.empty())
6272 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6273 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6274 delete (yyvsp[(2) - (3)].TypeVal);
6280 #line 3088 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6282 if (!UpRefs.empty())
6283 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6284 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6286 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6287 delete (yyvsp[(2) - (6)].TypeVal);
6292 #line 3096 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6294 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6295 GEN_ERROR("Trying to free nonpointer type " +
6296 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6297 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6303 #line 3104 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6305 if (!UpRefs.empty())
6306 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6307 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6308 GEN_ERROR("Can't load from nonpointer type: " +
6309 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6310 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6311 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6312 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6313 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6315 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6316 delete (yyvsp[(3) - (5)].TypeVal);
6321 #line 3118 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6323 if (!UpRefs.empty())
6324 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6325 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6327 GEN_ERROR("Can't store to a nonpointer type: " +
6328 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6329 const Type *ElTy = PT->getElementType();
6330 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6331 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6332 "' into space of type '" + ElTy->getDescription() + "'");
6334 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6336 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6337 delete (yyvsp[(5) - (7)].TypeVal);
6342 #line 3135 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6344 ValID TmpVID = ValID::createLocalName(*(yyvsp[(3) - (5)].StrVal));
6345 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), TmpVID);
6346 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].ConstVal)))
6347 GEN_ERROR("Invalid getresult operands");
6348 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].ConstVal));
6354 #line 3143 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6356 if (!UpRefs.empty())
6357 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6358 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6359 GEN_ERROR("getelementptr insn requires pointer operand");
6361 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6362 GEN_ERROR("Invalid getelementptr indices for type '" +
6363 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6364 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6366 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6367 delete (yyvsp[(2) - (4)].TypeVal);
6368 delete (yyvsp[(4) - (4)].ValueList);
6373 /* Line 1267 of yacc.c. */
6374 #line 6375 "llvmAsmParser.tab.c"
6377 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6381 YY_STACK_PRINT (yyss, yyssp);
6386 /* Now `shift' the result of the reduction. Determine what state
6387 that goes to, based on the state we popped back to and the rule
6388 number reduced by. */
6392 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6393 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6394 yystate = yytable[yystate];
6396 yystate = yydefgoto[yyn - YYNTOKENS];
6401 /*------------------------------------.
6402 | yyerrlab -- here on detecting error |
6403 `------------------------------------*/
6405 /* If not already recovering from an error, report this error. */
6409 #if ! YYERROR_VERBOSE
6410 yyerror (YY_("syntax error"));
6413 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6414 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6416 YYSIZE_T yyalloc = 2 * yysize;
6417 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6418 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6419 if (yymsg != yymsgbuf)
6420 YYSTACK_FREE (yymsg);
6421 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6423 yymsg_alloc = yyalloc;
6427 yymsg_alloc = sizeof yymsgbuf;
6431 if (0 < yysize && yysize <= yymsg_alloc)
6433 (void) yysyntax_error (yymsg, yystate, yychar);
6438 yyerror (YY_("syntax error"));
6440 goto yyexhaustedlab;
6448 if (yyerrstatus == 3)
6450 /* If just tried and failed to reuse look-ahead token after an
6451 error, discard it. */
6453 if (yychar <= YYEOF)
6455 /* Return failure if at end of input. */
6456 if (yychar == YYEOF)
6461 yydestruct ("Error: discarding",
6467 /* Else will try to reuse look-ahead token after shifting the error
6472 /*---------------------------------------------------.
6473 | yyerrorlab -- error raised explicitly by YYERROR. |
6474 `---------------------------------------------------*/
6477 /* Pacify compilers like GCC when the user code never invokes
6478 YYERROR and the label yyerrorlab therefore never appears in user
6480 if (/*CONSTCOND*/ 0)
6483 /* Do not reclaim the symbols of the rule which action triggered
6487 YY_STACK_PRINT (yyss, yyssp);
6492 /*-------------------------------------------------------------.
6493 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6494 `-------------------------------------------------------------*/
6496 yyerrstatus = 3; /* Each real token shifted decrements this. */
6500 yyn = yypact[yystate];
6501 if (yyn != YYPACT_NINF)
6504 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6512 /* Pop the current state because it cannot handle the error token. */
6517 yydestruct ("Error: popping",
6518 yystos[yystate], yyvsp);
6521 YY_STACK_PRINT (yyss, yyssp);
6530 /* Shift the error token. */
6531 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6537 /*-------------------------------------.
6538 | yyacceptlab -- YYACCEPT comes here. |
6539 `-------------------------------------*/
6544 /*-----------------------------------.
6545 | yyabortlab -- YYABORT comes here. |
6546 `-----------------------------------*/
6552 /*-------------------------------------------------.
6553 | yyexhaustedlab -- memory exhaustion comes here. |
6554 `-------------------------------------------------*/
6556 yyerror (YY_("memory exhausted"));
6562 if (yychar != YYEOF && yychar != YYEMPTY)
6563 yydestruct ("Cleanup: discarding lookahead",
6565 /* Do not reclaim the symbols of the rule which action triggered
6566 this YYABORT or YYACCEPT. */
6568 YY_STACK_PRINT (yyss, yyssp);
6569 while (yyssp != yyss)
6571 yydestruct ("Cleanup: popping",
6572 yystos[*yyssp], yyvsp);
6577 YYSTACK_FREE (yyss);
6580 if (yymsg != yymsgbuf)
6581 YYSTACK_FREE (yymsg);
6583 /* Make sure YYID is used. */
6584 return YYID (yyresult);
6588 #line 3160 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6591 // common code from the two 'RunVMAsmParser' functions
6592 static Module* RunParser(Module * M) {
6593 CurModule.CurrentModule = M;
6594 // Check to make sure the parser succeeded
6597 delete ParserResult;
6601 // Emit an error if there are any unresolved types left.
6602 if (!CurModule.LateResolveTypes.empty()) {
6603 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6604 if (DID.Type == ValID::LocalName) {
6605 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6607 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6610 delete ParserResult;
6614 // Emit an error if there are any unresolved values left.
6615 if (!CurModule.LateResolveValues.empty()) {
6616 Value *V = CurModule.LateResolveValues.back();
6617 std::map<Value*, std::pair<ValID, int> >::iterator I =
6618 CurModule.PlaceHolderInfo.find(V);
6620 if (I != CurModule.PlaceHolderInfo.end()) {
6621 ValID &DID = I->second.first;
6622 if (DID.Type == ValID::LocalName) {
6623 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6625 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6628 delete ParserResult;
6633 // Check to make sure that parsing produced a result
6637 // Reset ParserResult variable while saving its value for the result.
6638 Module *Result = ParserResult;
6644 void llvm::GenerateError(const std::string &message, int LineNo) {
6645 if (LineNo == -1) LineNo = LLLgetLineNo();
6646 // TODO: column number in exception
6648 TheParseError->setError(LLLgetFilename(), message, LineNo);
6652 int yyerror(const char *ErrorMsg) {
6653 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6654 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6655 if (yychar != YYEMPTY && yychar != 0) {
6656 errMsg += " while reading token: '";
6657 errMsg += std::string(LLLgetTokenStart(),
6658 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6660 GenerateError(errMsg);