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,
138 X86_STDCALLCC_TOK = 319,
139 X86_FASTCALLCC_TOK = 320,
205 EXTRACTELEMENT = 386,
225 #define ESINT64VAL 258
226 #define EUINT64VAL 259
227 #define ESAPINTVAL 260
228 #define EUAPINTVAL 261
229 #define LOCALVAL_ID 262
230 #define GLOBALVAL_ID 263
238 #define PPC_FP128 271
242 #define GLOBALVAR 275
244 #define STRINGCONSTANT 277
245 #define ATSTRINGCONSTANT 278
246 #define PCTSTRINGCONSTANT 279
247 #define ZEROINITIALIZER 280
259 #define THREAD_LOCAL 292
261 #define DOTDOTDOT 294
267 #define APPENDING 300
268 #define DLLIMPORT 301
269 #define DLLEXPORT 302
270 #define EXTERN_WEAK 303
281 #define SIDEEFFECT 314
284 #define FASTCC_TOK 317
285 #define COLDCC_TOK 318
286 #define X86_STDCALLCC_TOK 319
287 #define X86_FASTCALLCC_TOK 320
288 #define DATALAYOUT 321
294 #define UNREACHABLE 327
337 #define GETELEMENTPTR 370
353 #define EXTRACTELEMENT 386
354 #define INSERTELEMENT 387
355 #define SHUFFLEVECTOR 388
369 #define PROTECTED 402
374 /* Copy the first part of user declarations. */
375 #line 14 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
377 #include "ParserInternals.h"
378 #include "llvm/CallingConv.h"
379 #include "llvm/InlineAsm.h"
380 #include "llvm/Instructions.h"
381 #include "llvm/Module.h"
382 #include "llvm/ValueSymbolTable.h"
383 #include "llvm/AutoUpgrade.h"
384 #include "llvm/Support/GetElementPtrTypeIterator.h"
385 #include "llvm/Support/CommandLine.h"
386 #include "llvm/ADT/SmallVector.h"
387 #include "llvm/ADT/STLExtras.h"
388 #include "llvm/Support/MathExtras.h"
389 #include "llvm/Support/Streams.h"
395 // The following is a gross hack. In order to rid the libAsmParser library of
396 // exceptions, we have to have a way of getting the yyparse function to go into
397 // an error situation. So, whenever we want an error to occur, the GenerateError
398 // function (see bottom of file) sets TriggerError. Then, at the end of each
399 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
400 // (a goto) to put YACC in error state. Furthermore, several calls to
401 // GenerateError are made from inside productions and they must simulate the
402 // previous exception behavior by exiting the production immediately. We have
403 // replaced these with the GEN_ERROR macro which calls GeneratError and then
404 // immediately invokes YYERROR. This would be so much cleaner if it was a
405 // recursive descent parser.
406 static bool TriggerError = false;
407 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
408 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
410 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
411 int yylex(); // declaration" of xxx warnings.
413 using namespace llvm;
415 static Module *ParserResult;
417 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
418 // relating to upreferences in the input stream.
420 //#define DEBUG_UPREFS 1
422 #define UR_OUT(X) cerr << X
427 #define YYERROR_VERBOSE 1
429 static GlobalVariable *CurGV;
432 // This contains info used when building the body of a function. It is
433 // destroyed when the function is completed.
435 typedef std::vector<Value *> ValueList; // Numbered defs
438 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
440 static struct PerModuleInfo {
441 Module *CurrentModule;
442 ValueList Values; // Module level numbered definitions
443 ValueList LateResolveValues;
444 std::vector<PATypeHolder> Types;
445 std::map<ValID, PATypeHolder> LateResolveTypes;
447 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
448 /// how they were referenced and on which line of the input they came from so
449 /// that we can resolve them later and print error messages as appropriate.
450 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
452 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
453 // references to global values. Global values may be referenced before they
454 // are defined, and if so, the temporary object that they represent is held
455 // here. This is used for forward references of GlobalValues.
457 typedef std::map<std::pair<const PointerType *,
458 ValID>, GlobalValue*> GlobalRefsType;
459 GlobalRefsType GlobalRefs;
462 // If we could not resolve some functions at function compilation time
463 // (calls to functions before they are defined), resolve them now... Types
464 // are resolved when the constant pool has been completely parsed.
466 ResolveDefinitions(LateResolveValues);
470 // Check to make sure that all global value forward references have been
473 if (!GlobalRefs.empty()) {
474 std::string UndefinedReferences = "Unresolved global references exist:\n";
476 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
478 UndefinedReferences += " " + I->first.first->getDescription() + " " +
479 I->first.second.getName() + "\n";
481 GenerateError(UndefinedReferences);
485 // Look for intrinsic functions and CallInst that need to be upgraded
486 for (Module::iterator FI = CurrentModule->begin(),
487 FE = CurrentModule->end(); FI != FE; )
488 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
490 Values.clear(); // Clear out function local definitions
495 // GetForwardRefForGlobal - Check to see if there is a forward reference
496 // for this global. If so, remove it from the GlobalRefs map and return it.
497 // If not, just return null.
498 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
499 // Check to see if there is a forward reference to this global variable...
500 // if there is, eliminate it and patch the reference to use the new def'n.
501 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
502 GlobalValue *Ret = 0;
503 if (I != GlobalRefs.end()) {
510 bool TypeIsUnresolved(PATypeHolder* PATy) {
511 // If it isn't abstract, its resolved
512 const Type* Ty = PATy->get();
513 if (!Ty->isAbstract())
515 // Traverse the type looking for abstract types. If it isn't abstract then
516 // we don't need to traverse that leg of the type.
517 std::vector<const Type*> WorkList, SeenList;
518 WorkList.push_back(Ty);
519 while (!WorkList.empty()) {
520 const Type* Ty = WorkList.back();
521 SeenList.push_back(Ty);
523 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
524 // Check to see if this is an unresolved type
525 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
526 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
527 for ( ; I != E; ++I) {
528 if (I->second.get() == OpTy)
531 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
532 const Type* TheTy = SeqTy->getElementType();
533 if (TheTy->isAbstract() && TheTy != Ty) {
534 std::vector<const Type*>::iterator I = SeenList.begin(),
540 WorkList.push_back(TheTy);
542 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
543 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
544 const Type* TheTy = StrTy->getElementType(i);
545 if (TheTy->isAbstract() && TheTy != Ty) {
546 std::vector<const Type*>::iterator I = SeenList.begin(),
552 WorkList.push_back(TheTy);
561 static struct PerFunctionInfo {
562 Function *CurrentFunction; // Pointer to current function being created
564 ValueList Values; // Keep track of #'d definitions
566 ValueList LateResolveValues;
567 bool isDeclare; // Is this function a forward declararation?
568 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
569 GlobalValue::VisibilityTypes Visibility;
571 /// BBForwardRefs - When we see forward references to basic blocks, keep
572 /// track of them here.
573 std::map<ValID, BasicBlock*> BBForwardRefs;
575 inline PerFunctionInfo() {
578 Linkage = GlobalValue::ExternalLinkage;
579 Visibility = GlobalValue::DefaultVisibility;
582 inline void FunctionStart(Function *M) {
587 void FunctionDone() {
588 // Any forward referenced blocks left?
589 if (!BBForwardRefs.empty()) {
590 GenerateError("Undefined reference to label " +
591 BBForwardRefs.begin()->second->getName());
595 // Resolve all forward references now.
596 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
598 Values.clear(); // Clear out function local definitions
599 BBForwardRefs.clear();
602 Linkage = GlobalValue::ExternalLinkage;
603 Visibility = GlobalValue::DefaultVisibility;
605 } CurFun; // Info for the current function...
607 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
610 //===----------------------------------------------------------------------===//
611 // Code to handle definitions of all the types
612 //===----------------------------------------------------------------------===//
614 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
615 // Things that have names or are void typed don't get slot numbers
616 if (V->hasName() || (V->getType() == Type::VoidTy))
619 // In the case of function values, we have to allow for the forward reference
620 // of basic blocks, which are included in the numbering. Consequently, we keep
621 // track of the next insertion location with NextValNum. When a BB gets
622 // inserted, it could change the size of the CurFun.Values vector.
623 if (&ValueTab == &CurFun.Values) {
624 if (ValueTab.size() <= CurFun.NextValNum)
625 ValueTab.resize(CurFun.NextValNum+1);
626 ValueTab[CurFun.NextValNum++] = V;
629 // For all other lists, its okay to just tack it on the back of the vector.
630 ValueTab.push_back(V);
633 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
635 case ValID::LocalID: // Is it a numbered definition?
636 // Module constants occupy the lowest numbered slots...
637 if (D.Num < CurModule.Types.size())
638 return CurModule.Types[D.Num];
640 case ValID::LocalName: // Is it a named definition?
641 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
642 D.destroy(); // Free old strdup'd memory...
647 GenerateError("Internal parser error: Invalid symbol type reference");
651 // If we reached here, we referenced either a symbol that we don't know about
652 // or an id number that hasn't been read yet. We may be referencing something
653 // forward, so just create an entry to be resolved later and get to it...
655 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
658 if (inFunctionScope()) {
659 if (D.Type == ValID::LocalName) {
660 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
663 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
668 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
669 if (I != CurModule.LateResolveTypes.end())
672 Type *Typ = OpaqueType::get();
673 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
677 // getExistingVal - Look up the value specified by the provided type and
678 // the provided ValID. If the value exists and has already been defined, return
679 // it. Otherwise return null.
681 static Value *getExistingVal(const Type *Ty, const ValID &D) {
682 if (isa<FunctionType>(Ty)) {
683 GenerateError("Functions are not values and "
684 "must be referenced as pointers");
689 case ValID::LocalID: { // Is it a numbered definition?
690 // Check that the number is within bounds.
691 if (D.Num >= CurFun.Values.size())
693 Value *Result = CurFun.Values[D.Num];
694 if (Ty != Result->getType()) {
695 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
696 Result->getType()->getDescription() + "' does not match "
697 "expected type, '" + Ty->getDescription() + "'");
702 case ValID::GlobalID: { // Is it a numbered definition?
703 if (D.Num >= CurModule.Values.size())
705 Value *Result = CurModule.Values[D.Num];
706 if (Ty != Result->getType()) {
707 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
708 Result->getType()->getDescription() + "' does not match "
709 "expected type, '" + Ty->getDescription() + "'");
715 case ValID::LocalName: { // Is it a named definition?
716 if (!inFunctionScope())
718 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
719 Value *N = SymTab.lookup(D.getName());
722 if (N->getType() != Ty)
725 D.destroy(); // Free old strdup'd memory...
728 case ValID::GlobalName: { // Is it a named definition?
729 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
730 Value *N = SymTab.lookup(D.getName());
733 if (N->getType() != Ty)
736 D.destroy(); // Free old strdup'd memory...
740 // Check to make sure that "Ty" is an integral type, and that our
741 // value will fit into the specified type...
742 case ValID::ConstSIntVal: // Is it a constant pool reference??
743 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
744 GenerateError("Signed integral constant '" +
745 itostr(D.ConstPool64) + "' is invalid for type '" +
746 Ty->getDescription() + "'");
749 return ConstantInt::get(Ty, D.ConstPool64, true);
751 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
752 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
753 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
754 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
755 "' is invalid or out of range");
757 } else { // This is really a signed reference. Transmogrify.
758 return ConstantInt::get(Ty, D.ConstPool64, true);
761 return ConstantInt::get(Ty, D.UConstPool64);
764 case ValID::ConstFPVal: // Is it a floating point const pool reference?
765 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
766 GenerateError("FP constant invalid for type");
769 // Lexer has no type info, so builds all float and double FP constants
770 // as double. Fix this here. Long double does not need this.
771 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
773 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
774 return ConstantFP::get(Ty, *D.ConstPoolFP);
776 case ValID::ConstNullVal: // Is it a null value?
777 if (!isa<PointerType>(Ty)) {
778 GenerateError("Cannot create a a non pointer null");
781 return ConstantPointerNull::get(cast<PointerType>(Ty));
783 case ValID::ConstUndefVal: // Is it an undef value?
784 return UndefValue::get(Ty);
786 case ValID::ConstZeroVal: // Is it a zero value?
787 return Constant::getNullValue(Ty);
789 case ValID::ConstantVal: // Fully resolved constant?
790 if (D.ConstantValue->getType() != Ty) {
791 GenerateError("Constant expression type different from required type");
794 return D.ConstantValue;
796 case ValID::InlineAsmVal: { // Inline asm expression
797 const PointerType *PTy = dyn_cast<PointerType>(Ty);
798 const FunctionType *FTy =
799 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
800 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
801 GenerateError("Invalid type for asm constraint string");
804 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
805 D.IAD->HasSideEffects);
806 D.destroy(); // Free InlineAsmDescriptor.
810 assert(0 && "Unhandled case!");
814 assert(0 && "Unhandled case!");
818 // getVal - This function is identical to getExistingVal, except that if a
819 // value is not already defined, it "improvises" by creating a placeholder var
820 // that looks and acts just like the requested variable. When the value is
821 // defined later, all uses of the placeholder variable are replaced with the
824 static Value *getVal(const Type *Ty, const ValID &ID) {
825 if (Ty == Type::LabelTy) {
826 GenerateError("Cannot use a basic block here");
830 // See if the value has already been defined.
831 Value *V = getExistingVal(Ty, ID);
833 if (TriggerError) return 0;
835 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
836 GenerateError("Invalid use of a composite type");
840 // If we reached here, we referenced either a symbol that we don't know about
841 // or an id number that hasn't been read yet. We may be referencing something
842 // forward, so just create an entry to be resolved later and get to it...
845 case ValID::GlobalName:
846 case ValID::GlobalID: {
847 const PointerType *PTy = dyn_cast<PointerType>(Ty);
849 GenerateError("Invalid type for reference to global" );
852 const Type* ElTy = PTy->getElementType();
853 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
854 V = new Function(FTy, GlobalValue::ExternalLinkage);
856 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
860 V = new Argument(Ty);
863 // Remember where this forward reference came from. FIXME, shouldn't we try
864 // to recycle these things??
865 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
868 if (inFunctionScope())
869 InsertValue(V, CurFun.LateResolveValues);
871 InsertValue(V, CurModule.LateResolveValues);
875 /// defineBBVal - This is a definition of a new basic block with the specified
876 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
877 static BasicBlock *defineBBVal(const ValID &ID) {
878 assert(inFunctionScope() && "Can't get basic block at global scope!");
882 // First, see if this was forward referenced
884 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
885 if (BBI != CurFun.BBForwardRefs.end()) {
887 // The forward declaration could have been inserted anywhere in the
888 // function: insert it into the correct place now.
889 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
890 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
892 // We're about to erase the entry, save the key so we can clean it up.
893 ValID Tmp = BBI->first;
895 // Erase the forward ref from the map as its no longer "forward"
896 CurFun.BBForwardRefs.erase(ID);
898 // The key has been removed from the map but so we don't want to leave
899 // strdup'd memory around so destroy it too.
902 // If its a numbered definition, bump the number and set the BB value.
903 if (ID.Type == ValID::LocalID) {
904 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
912 // We haven't seen this BB before and its first mention is a definition.
913 // Just create it and return it.
914 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
915 BB = new BasicBlock(Name, CurFun.CurrentFunction);
916 if (ID.Type == ValID::LocalID) {
917 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
921 ID.destroy(); // Free strdup'd memory
925 /// getBBVal - get an existing BB value or create a forward reference for it.
927 static BasicBlock *getBBVal(const ValID &ID) {
928 assert(inFunctionScope() && "Can't get basic block at global scope!");
932 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
933 if (BBI != CurFun.BBForwardRefs.end()) {
935 } if (ID.Type == ValID::LocalName) {
936 std::string Name = ID.getName();
937 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
939 if (N->getType()->getTypeID() == Type::LabelTyID)
940 BB = cast<BasicBlock>(N);
942 GenerateError("Reference to label '" + Name + "' is actually of type '"+
943 N->getType()->getDescription() + "'");
944 } else if (ID.Type == ValID::LocalID) {
945 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
946 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
947 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
949 GenerateError("Reference to label '%" + utostr(ID.Num) +
950 "' is actually of type '"+
951 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
954 GenerateError("Illegal label reference " + ID.getName());
958 // If its already been defined, return it now.
960 ID.destroy(); // Free strdup'd memory.
964 // Otherwise, this block has not been seen before, create it.
966 if (ID.Type == ValID::LocalName)
968 BB = new BasicBlock(Name, CurFun.CurrentFunction);
970 // Insert it in the forward refs map.
971 CurFun.BBForwardRefs[ID] = BB;
977 //===----------------------------------------------------------------------===//
978 // Code to handle forward references in instructions
979 //===----------------------------------------------------------------------===//
981 // This code handles the late binding needed with statements that reference
982 // values not defined yet... for example, a forward branch, or the PHI node for
985 // This keeps a table (CurFun.LateResolveValues) of all such forward references
986 // and back patchs after we are done.
989 // ResolveDefinitions - If we could not resolve some defs at parsing
990 // time (forward branches, phi functions for loops, etc...) resolve the
994 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
995 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
996 while (!LateResolvers.empty()) {
997 Value *V = LateResolvers.back();
998 LateResolvers.pop_back();
1000 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1001 CurModule.PlaceHolderInfo.find(V);
1002 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1004 ValID &DID = PHI->second.first;
1006 Value *TheRealValue = getExistingVal(V->getType(), DID);
1010 V->replaceAllUsesWith(TheRealValue);
1012 CurModule.PlaceHolderInfo.erase(PHI);
1013 } else if (FutureLateResolvers) {
1014 // Functions have their unresolved items forwarded to the module late
1016 InsertValue(V, *FutureLateResolvers);
1018 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1019 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1020 "' of type '" + V->getType()->getDescription() + "'",
1021 PHI->second.second);
1024 GenerateError("Reference to an invalid definition: #" +
1025 itostr(DID.Num) + " of type '" +
1026 V->getType()->getDescription() + "'",
1027 PHI->second.second);
1032 LateResolvers.clear();
1035 // ResolveTypeTo - A brand new type was just declared. This means that (if
1036 // name is not null) things referencing Name can be resolved. Otherwise, things
1037 // refering to the number can be resolved. Do this now.
1039 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1042 D = ValID::createLocalName(*Name);
1044 D = ValID::createLocalID(CurModule.Types.size());
1046 std::map<ValID, PATypeHolder>::iterator I =
1047 CurModule.LateResolveTypes.find(D);
1048 if (I != CurModule.LateResolveTypes.end()) {
1049 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1050 CurModule.LateResolveTypes.erase(I);
1054 // setValueName - Set the specified value to the name given. The name may be
1055 // null potentially, in which case this is a noop. The string passed in is
1056 // assumed to be a malloc'd string buffer, and is free'd by this function.
1058 static void setValueName(Value *V, std::string *NameStr) {
1059 if (!NameStr) return;
1060 std::string Name(*NameStr); // Copy string
1061 delete NameStr; // Free old string
1063 if (V->getType() == Type::VoidTy) {
1064 GenerateError("Can't assign name '" + Name+"' to value with void type");
1068 assert(inFunctionScope() && "Must be in function scope!");
1069 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1070 if (ST.lookup(Name)) {
1071 GenerateError("Redefinition of value '" + Name + "' of type '" +
1072 V->getType()->getDescription() + "'");
1080 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1081 /// this is a declaration, otherwise it is a definition.
1082 static GlobalVariable *
1083 ParseGlobalVariable(std::string *NameStr,
1084 GlobalValue::LinkageTypes Linkage,
1085 GlobalValue::VisibilityTypes Visibility,
1086 bool isConstantGlobal, const Type *Ty,
1087 Constant *Initializer, bool IsThreadLocal) {
1088 if (isa<FunctionType>(Ty)) {
1089 GenerateError("Cannot declare global vars of function type");
1093 const PointerType *PTy = PointerType::get(Ty);
1097 Name = *NameStr; // Copy string
1098 delete NameStr; // Free old string
1101 // See if this global value was forward referenced. If so, recycle the
1104 if (!Name.empty()) {
1105 ID = ValID::createGlobalName(Name);
1107 ID = ValID::createGlobalID(CurModule.Values.size());
1110 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1111 // Move the global to the end of the list, from whereever it was
1112 // previously inserted.
1113 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1114 CurModule.CurrentModule->getGlobalList().remove(GV);
1115 CurModule.CurrentModule->getGlobalList().push_back(GV);
1116 GV->setInitializer(Initializer);
1117 GV->setLinkage(Linkage);
1118 GV->setVisibility(Visibility);
1119 GV->setConstant(isConstantGlobal);
1120 GV->setThreadLocal(IsThreadLocal);
1121 InsertValue(GV, CurModule.Values);
1125 // If this global has a name
1126 if (!Name.empty()) {
1127 // if the global we're parsing has an initializer (is a definition) and
1128 // has external linkage.
1129 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1130 // If there is already a global with external linkage with this name
1131 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1132 // If we allow this GVar to get created, it will be renamed in the
1133 // symbol table because it conflicts with an existing GVar. We can't
1134 // allow redefinition of GVars whose linking indicates that their name
1135 // must stay the same. Issue the error.
1136 GenerateError("Redefinition of global variable named '" + Name +
1137 "' of type '" + Ty->getDescription() + "'");
1142 // Otherwise there is no existing GV to use, create one now.
1143 GlobalVariable *GV =
1144 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1145 CurModule.CurrentModule, IsThreadLocal);
1146 GV->setVisibility(Visibility);
1147 InsertValue(GV, CurModule.Values);
1151 // setTypeName - Set the specified type to the name given. The name may be
1152 // null potentially, in which case this is a noop. The string passed in is
1153 // assumed to be a malloc'd string buffer, and is freed by this function.
1155 // This function returns true if the type has already been defined, but is
1156 // allowed to be redefined in the specified context. If the name is a new name
1157 // for the type plane, it is inserted and false is returned.
1158 static bool setTypeName(const Type *T, std::string *NameStr) {
1159 assert(!inFunctionScope() && "Can't give types function-local names!");
1160 if (NameStr == 0) return false;
1162 std::string Name(*NameStr); // Copy string
1163 delete NameStr; // Free old string
1165 // We don't allow assigning names to void type
1166 if (T == Type::VoidTy) {
1167 GenerateError("Can't assign name '" + Name + "' to the void type");
1171 // Set the type name, checking for conflicts as we do so.
1172 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1174 if (AlreadyExists) { // Inserting a name that is already defined???
1175 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1176 assert(Existing && "Conflict but no matching type?!");
1178 // There is only one case where this is allowed: when we are refining an
1179 // opaque type. In this case, Existing will be an opaque type.
1180 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1181 // We ARE replacing an opaque type!
1182 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1186 // Otherwise, this is an attempt to redefine a type. That's okay if
1187 // the redefinition is identical to the original. This will be so if
1188 // Existing and T point to the same Type object. In this one case we
1189 // allow the equivalent redefinition.
1190 if (Existing == T) return true; // Yes, it's equal.
1192 // Any other kind of (non-equivalent) redefinition is an error.
1193 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1194 T->getDescription() + "'");
1200 //===----------------------------------------------------------------------===//
1201 // Code for handling upreferences in type names...
1204 // TypeContains - Returns true if Ty directly contains E in it.
1206 static bool TypeContains(const Type *Ty, const Type *E) {
1207 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1208 E) != Ty->subtype_end();
1212 struct UpRefRecord {
1213 // NestingLevel - The number of nesting levels that need to be popped before
1214 // this type is resolved.
1215 unsigned NestingLevel;
1217 // LastContainedTy - This is the type at the current binding level for the
1218 // type. Every time we reduce the nesting level, this gets updated.
1219 const Type *LastContainedTy;
1221 // UpRefTy - This is the actual opaque type that the upreference is
1222 // represented with.
1223 OpaqueType *UpRefTy;
1225 UpRefRecord(unsigned NL, OpaqueType *URTy)
1226 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1230 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1231 static std::vector<UpRefRecord> UpRefs;
1233 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1234 /// called. It loops through the UpRefs vector, which is a list of the
1235 /// currently active types. For each type, if the up reference is contained in
1236 /// the newly completed type, we decrement the level count. When the level
1237 /// count reaches zero, the upreferenced type is the type that is passed in:
1238 /// thus we can complete the cycle.
1240 static PATypeHolder HandleUpRefs(const Type *ty) {
1241 // If Ty isn't abstract, or if there are no up-references in it, then there is
1242 // nothing to resolve here.
1243 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1245 PATypeHolder Ty(ty);
1246 UR_OUT("Type '" << Ty->getDescription() <<
1247 "' newly formed. Resolving upreferences.\n" <<
1248 UpRefs.size() << " upreferences active!\n");
1250 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1251 // to zero), we resolve them all together before we resolve them to Ty. At
1252 // the end of the loop, if there is anything to resolve to Ty, it will be in
1254 OpaqueType *TypeToResolve = 0;
1256 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1257 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1258 << UpRefs[i].second->getDescription() << ") = "
1259 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1260 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1261 // Decrement level of upreference
1262 unsigned Level = --UpRefs[i].NestingLevel;
1263 UpRefs[i].LastContainedTy = Ty;
1264 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1265 if (Level == 0) { // Upreference should be resolved!
1266 if (!TypeToResolve) {
1267 TypeToResolve = UpRefs[i].UpRefTy;
1269 UR_OUT(" * Resolving upreference for "
1270 << UpRefs[i].second->getDescription() << "\n";
1271 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1272 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1273 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1274 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1276 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1277 --i; // Do not skip the next element...
1282 if (TypeToResolve) {
1283 UR_OUT(" * Resolving upreference for "
1284 << UpRefs[i].second->getDescription() << "\n";
1285 std::string OldName = TypeToResolve->getDescription());
1286 TypeToResolve->refineAbstractTypeTo(Ty);
1292 //===----------------------------------------------------------------------===//
1293 // RunVMAsmParser - Define an interface to this parser
1294 //===----------------------------------------------------------------------===//
1296 static Module* RunParser(Module * M);
1298 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1300 Module *M = RunParser(new Module(LLLgetFilename()));
1307 /* Enabling traces. */
1312 /* Enabling verbose error messages. */
1313 #ifdef YYERROR_VERBOSE
1314 # undef YYERROR_VERBOSE
1315 # define YYERROR_VERBOSE 1
1317 # define YYERROR_VERBOSE 0
1320 /* Enabling the token table. */
1321 #ifndef YYTOKEN_TABLE
1322 # define YYTOKEN_TABLE 0
1325 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1326 typedef union YYSTYPE
1327 #line 945 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
1329 llvm::Module *ModuleVal;
1330 llvm::Function *FunctionVal;
1331 llvm::BasicBlock *BasicBlockVal;
1332 llvm::TerminatorInst *TermInstVal;
1333 llvm::Instruction *InstVal;
1334 llvm::Constant *ConstVal;
1336 const llvm::Type *PrimType;
1337 std::list<llvm::PATypeHolder> *TypeList;
1338 llvm::PATypeHolder *TypeVal;
1339 llvm::Value *ValueVal;
1340 std::vector<llvm::Value*> *ValueList;
1341 llvm::ArgListType *ArgList;
1342 llvm::TypeWithAttrs TypeWithAttrs;
1343 llvm::TypeWithAttrsList *TypeWithAttrsList;
1344 llvm::ParamList *ParamList;
1346 // Represent the RHS of PHI node
1347 std::list<std::pair<llvm::Value*,
1348 llvm::BasicBlock*> > *PHIList;
1349 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1350 std::vector<llvm::Constant*> *ConstVector;
1352 llvm::GlobalValue::LinkageTypes Linkage;
1353 llvm::GlobalValue::VisibilityTypes Visibility;
1354 uint16_t ParamAttrs;
1355 llvm::APInt *APIntVal;
1360 llvm::APFloat *FPVal;
1363 std::string *StrVal; // This memory must be deleted
1364 llvm::ValID ValIDVal;
1366 llvm::Instruction::BinaryOps BinaryOpVal;
1367 llvm::Instruction::TermOps TermOpVal;
1368 llvm::Instruction::MemoryOps MemOpVal;
1369 llvm::Instruction::CastOps CastOpVal;
1370 llvm::Instruction::OtherOps OtherOpVal;
1371 llvm::ICmpInst::Predicate IPredicate;
1372 llvm::FCmpInst::Predicate FPredicate;
1374 /* Line 187 of yacc.c. */
1375 #line 1376 "llvmAsmParser.tab.c"
1377 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1378 # define YYSTYPE_IS_DECLARED 1
1379 # define YYSTYPE_IS_TRIVIAL 1
1384 /* Copy the second part of user declarations. */
1387 /* Line 216 of yacc.c. */
1388 #line 1389 "llvmAsmParser.tab.c"
1395 typedef YYTYPE_UINT8 yytype_uint8;
1397 typedef unsigned char yytype_uint8;
1401 typedef YYTYPE_INT8 yytype_int8;
1402 #elif (defined __STDC__ || defined __C99__FUNC__ \
1403 || defined __cplusplus || defined _MSC_VER)
1404 typedef signed char yytype_int8;
1406 typedef short int yytype_int8;
1409 #ifdef YYTYPE_UINT16
1410 typedef YYTYPE_UINT16 yytype_uint16;
1412 typedef unsigned short int yytype_uint16;
1416 typedef YYTYPE_INT16 yytype_int16;
1418 typedef short int yytype_int16;
1422 # ifdef __SIZE_TYPE__
1423 # define YYSIZE_T __SIZE_TYPE__
1424 # elif defined size_t
1425 # define YYSIZE_T size_t
1426 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1427 || defined __cplusplus || defined _MSC_VER)
1428 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1429 # define YYSIZE_T size_t
1431 # define YYSIZE_T unsigned int
1435 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1440 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1441 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1445 # define YY_(msgid) msgid
1449 /* Suppress unused-variable warnings by "using" E. */
1450 #if ! defined lint || defined __GNUC__
1451 # define YYUSE(e) ((void) (e))
1453 # define YYUSE(e) /* empty */
1456 /* Identity function, used to suppress warnings about constant conditions. */
1458 # define YYID(n) (n)
1460 #if (defined __STDC__ || defined __C99__FUNC__ \
1461 || defined __cplusplus || defined _MSC_VER)
1474 #if ! defined yyoverflow || YYERROR_VERBOSE
1476 /* The parser invokes alloca or malloc; define the necessary symbols. */
1478 # ifdef YYSTACK_USE_ALLOCA
1479 # if YYSTACK_USE_ALLOCA
1481 # define YYSTACK_ALLOC __builtin_alloca
1482 # elif defined __BUILTIN_VA_ARG_INCR
1483 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1485 # define YYSTACK_ALLOC __alloca
1486 # elif defined _MSC_VER
1487 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1488 # define alloca _alloca
1490 # define YYSTACK_ALLOC alloca
1491 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1492 || defined __cplusplus || defined _MSC_VER)
1493 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1495 # define _STDLIB_H 1
1502 # ifdef YYSTACK_ALLOC
1503 /* Pacify GCC's `empty if-body' warning. */
1504 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1505 # ifndef YYSTACK_ALLOC_MAXIMUM
1506 /* The OS might guarantee only one guard page at the bottom of the stack,
1507 and a page size can be as small as 4096 bytes. So we cannot safely
1508 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1509 to allow for a few compiler-allocated temporary stack slots. */
1510 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1513 # define YYSTACK_ALLOC YYMALLOC
1514 # define YYSTACK_FREE YYFREE
1515 # ifndef YYSTACK_ALLOC_MAXIMUM
1516 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1518 # if (defined __cplusplus && ! defined _STDLIB_H \
1519 && ! ((defined YYMALLOC || defined malloc) \
1520 && (defined YYFREE || defined free)))
1521 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1523 # define _STDLIB_H 1
1527 # define YYMALLOC malloc
1528 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1529 || defined __cplusplus || defined _MSC_VER)
1530 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1534 # define YYFREE free
1535 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1536 || defined __cplusplus || defined _MSC_VER)
1537 void free (void *); /* INFRINGES ON USER NAME SPACE */
1541 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1544 #if (! defined yyoverflow \
1545 && (! defined __cplusplus \
1546 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1548 /* A type that is properly aligned for any stack member. */
1555 /* The size of the maximum gap between one aligned stack and the next. */
1556 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1558 /* The size of an array large to enough to hold all stacks, each with
1560 # define YYSTACK_BYTES(N) \
1561 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1562 + YYSTACK_GAP_MAXIMUM)
1564 /* Copy COUNT objects from FROM to TO. The source and destination do
1567 # if defined __GNUC__ && 1 < __GNUC__
1568 # define YYCOPY(To, From, Count) \
1569 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1571 # define YYCOPY(To, From, Count) \
1575 for (yyi = 0; yyi < (Count); yyi++) \
1576 (To)[yyi] = (From)[yyi]; \
1582 /* Relocate STACK from its old location to the new one. The
1583 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1584 elements in the stack, and YYPTR gives the new location of the
1585 stack. Advance YYPTR to a properly aligned location for the next
1587 # define YYSTACK_RELOCATE(Stack) \
1590 YYSIZE_T yynewbytes; \
1591 YYCOPY (&yyptr->Stack, Stack, yysize); \
1592 Stack = &yyptr->Stack; \
1593 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1594 yyptr += yynewbytes / sizeof (*yyptr); \
1600 /* YYFINAL -- State number of the termination state. */
1602 /* YYLAST -- Last index in YYTABLE. */
1605 /* YYNTOKENS -- Number of terminals. */
1606 #define YYNTOKENS 162
1607 /* YYNNTS -- Number of nonterminals. */
1609 /* YYNRULES -- Number of rules. */
1610 #define YYNRULES 314
1611 /* YYNRULES -- Number of states. */
1612 #define YYNSTATES 608
1614 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1615 #define YYUNDEFTOK 2
1616 #define YYMAXUTOK 402
1618 #define YYTRANSLATE(YYX) \
1619 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1621 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1622 static const yytype_uint8 yytranslate[] =
1624 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1628 152, 153, 150, 2, 149, 2, 2, 2, 2, 2,
1629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1630 157, 148, 158, 2, 2, 2, 2, 2, 2, 2,
1631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1633 2, 154, 151, 156, 2, 2, 2, 2, 2, 161,
1634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1636 155, 2, 2, 159, 2, 160, 2, 2, 2, 2,
1637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1650 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1651 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1652 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1653 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1654 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1655 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1656 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1657 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1658 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1659 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1660 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1661 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1662 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1663 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1668 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1670 static const yytype_uint16 yyprhs[] =
1672 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1673 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1674 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1675 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1676 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1677 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1678 119, 121, 123, 125, 127, 129, 130, 133, 134, 136,
1679 138, 140, 141, 144, 146, 148, 150, 152, 154, 156,
1680 158, 160, 161, 163, 165, 167, 168, 170, 172, 173,
1681 175, 177, 179, 181, 182, 184, 186, 187, 189, 191,
1682 193, 195, 197, 200, 202, 204, 206, 208, 210, 212,
1683 214, 216, 218, 219, 222, 224, 226, 228, 230, 232,
1684 234, 235, 238, 239, 242, 243, 247, 250, 251, 253,
1685 254, 258, 260, 263, 265, 267, 269, 271, 273, 275,
1686 277, 279, 281, 284, 286, 289, 295, 301, 307, 313,
1687 317, 320, 326, 331, 334, 336, 338, 340, 344, 346,
1688 350, 352, 353, 355, 359, 364, 368, 372, 377, 382,
1689 386, 393, 399, 402, 405, 408, 411, 414, 417, 420,
1690 423, 426, 429, 432, 435, 442, 448, 457, 464, 471,
1691 479, 487, 494, 503, 512, 516, 518, 520, 522, 524,
1692 525, 528, 535, 537, 538, 540, 543, 544, 548, 549,
1693 553, 557, 561, 565, 566, 574, 575, 584, 585, 594,
1694 600, 603, 607, 609, 613, 617, 621, 625, 627, 628,
1695 634, 638, 640, 644, 646, 647, 657, 659, 661, 666,
1696 668, 670, 673, 677, 678, 680, 682, 684, 686, 688,
1697 690, 692, 694, 696, 700, 702, 708, 710, 712, 714,
1698 716, 718, 720, 723, 726, 729, 733, 736, 737, 739,
1699 742, 745, 749, 759, 769, 778, 793, 795, 797, 804,
1700 810, 813, 820, 828, 833, 838, 845, 852, 853, 854,
1701 858, 861, 863, 869, 875, 882, 889, 894, 901, 906,
1702 911, 918, 925, 928, 937, 939, 941, 942, 946, 953,
1703 957, 964, 967, 973, 981
1706 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1707 static const yytype_int16 yyrhs[] =
1709 206, 0, -1, 73, -1, 74, -1, 75, -1, 76,
1710 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81,
1711 -1, 85, -1, 86, -1, 87, -1, 82, -1, 83,
1712 -1, 84, -1, 116, -1, 117, -1, 118, -1, 119,
1713 -1, 120, -1, 121, -1, 122, -1, 123, -1, 124,
1714 -1, 125, -1, 126, -1, 127, -1, 90, -1, 91,
1715 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1716 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1717 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1718 -1, 107, -1, 108, -1, 109, -1, 96, -1, 97,
1719 -1, 98, -1, 99, -1, 26, -1, 27, -1, 11,
1720 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1721 -1, 19, -1, 22, -1, 24, -1, 170, -1, -1,
1722 170, 148, -1, -1, 20, -1, 23, -1, 175, -1,
1723 -1, 173, 148, -1, 42, -1, 44, -1, 43, -1,
1724 45, -1, 47, -1, 46, -1, 48, -1, 50, -1,
1725 -1, 145, -1, 146, -1, 147, -1, -1, 46, -1,
1726 48, -1, -1, 42, -1, 43, -1, 44, -1, 47,
1727 -1, -1, 44, -1, 42, -1, -1, 61, -1, 62,
1728 -1, 63, -1, 64, -1, 65, -1, 60, 4, -1,
1729 135, -1, 117, -1, 134, -1, 118, -1, 137, -1,
1730 138, -1, 140, -1, 141, -1, 142, -1, -1, 184,
1731 183, -1, 136, -1, 139, -1, 135, -1, 134, -1,
1732 143, -1, 144, -1, -1, 186, 185, -1, -1, 53,
1733 4, -1, -1, 149, 53, 4, -1, 34, 22, -1,
1734 -1, 189, -1, -1, 149, 192, 191, -1, 189, -1,
1735 53, 4, -1, 11, -1, 12, -1, 13, -1, 16,
1736 -1, 15, -1, 14, -1, 17, -1, 49, -1, 193,
1737 -1, 194, 150, -1, 228, -1, 151, 4, -1, 194,
1738 152, 198, 153, 186, -1, 10, 152, 198, 153, 186,
1739 -1, 154, 4, 155, 194, 156, -1, 157, 4, 155,
1740 194, 158, -1, 159, 199, 160, -1, 159, 160, -1,
1741 157, 159, 199, 160, 158, -1, 157, 159, 160, 158,
1742 -1, 194, 184, -1, 194, -1, 10, -1, 195, -1,
1743 197, 149, 195, -1, 197, -1, 197, 149, 39, -1,
1744 39, -1, -1, 194, -1, 199, 149, 194, -1, 194,
1745 154, 202, 156, -1, 194, 154, 156, -1, 194, 161,
1746 22, -1, 194, 157, 202, 158, -1, 194, 159, 202,
1747 160, -1, 194, 159, 160, -1, 194, 157, 159, 202,
1748 160, 158, -1, 194, 157, 159, 160, 158, -1, 194,
1749 40, -1, 194, 41, -1, 194, 228, -1, 194, 201,
1750 -1, 194, 25, -1, 168, 3, -1, 168, 5, -1,
1751 168, 4, -1, 168, 6, -1, 11, 26, -1, 11,
1752 27, -1, 169, 9, -1, 165, 152, 200, 38, 194,
1753 153, -1, 115, 152, 200, 239, 153, -1, 129, 152,
1754 200, 149, 200, 149, 200, 153, -1, 163, 152, 200,
1755 149, 200, 153, -1, 164, 152, 200, 149, 200, 153,
1756 -1, 88, 166, 152, 200, 149, 200, 153, -1, 89,
1757 167, 152, 200, 149, 200, 153, -1, 131, 152, 200,
1758 149, 200, 153, -1, 132, 152, 200, 149, 200, 149,
1759 200, 153, -1, 133, 152, 200, 149, 200, 149, 200,
1760 153, -1, 202, 149, 200, -1, 200, -1, 32, -1,
1761 33, -1, 37, -1, -1, 196, 228, -1, 121, 152,
1762 205, 38, 194, 153, -1, 207, -1, -1, 208, -1,
1763 207, 208, -1, -1, 31, 209, 224, -1, -1, 30,
1764 210, 225, -1, 58, 57, 214, -1, 172, 18, 194,
1765 -1, 172, 18, 10, -1, -1, 174, 178, 204, 203,
1766 200, 211, 191, -1, -1, 174, 176, 178, 204, 203,
1767 200, 212, 191, -1, -1, 174, 177, 178, 204, 203,
1768 194, 213, 191, -1, 174, 178, 35, 181, 205, -1,
1769 51, 215, -1, 54, 148, 216, -1, 22, -1, 52,
1770 148, 22, -1, 66, 148, 22, -1, 154, 217, 156,
1771 -1, 217, 149, 22, -1, 22, -1, -1, 218, 149,
1772 194, 184, 171, -1, 194, 184, 171, -1, 218, -1,
1773 218, 149, 39, -1, 39, -1, -1, 182, 196, 173,
1774 152, 219, 153, 186, 190, 187, -1, 28, -1, 159,
1775 -1, 180, 178, 220, 221, -1, 29, -1, 160, -1,
1776 231, 223, -1, 179, 178, 220, -1, -1, 59, -1,
1777 3, -1, 4, -1, 9, -1, 26, -1, 27, -1,
1778 40, -1, 41, -1, 25, -1, 157, 202, 158, -1,
1779 201, -1, 57, 226, 22, 149, 22, -1, 7, -1,
1780 8, -1, 170, -1, 173, -1, 228, -1, 227, -1,
1781 194, 229, -1, 231, 232, -1, 222, 232, -1, 233,
1782 172, 234, -1, 233, 236, -1, -1, 21, -1, 67,
1783 230, -1, 67, 10, -1, 68, 17, 229, -1, 68,
1784 11, 229, 149, 17, 229, 149, 17, 229, -1, 69,
1785 168, 229, 149, 17, 229, 154, 235, 156, -1, 69,
1786 168, 229, 149, 17, 229, 154, 156, -1, 70, 182,
1787 196, 229, 152, 238, 153, 186, 38, 17, 229, 71,
1788 17, 229, -1, 71, -1, 72, -1, 235, 168, 227,
1789 149, 17, 229, -1, 168, 227, 149, 17, 229, -1,
1790 172, 241, -1, 194, 154, 229, 149, 229, 156, -1,
1791 237, 149, 154, 229, 149, 229, 156, -1, 194, 184,
1792 229, 184, -1, 17, 184, 229, 184, -1, 238, 149,
1793 194, 184, 229, 184, -1, 238, 149, 17, 184, 229,
1794 184, -1, -1, -1, 239, 149, 230, -1, 56, 55,
1795 -1, 55, -1, 163, 194, 229, 149, 229, -1, 164,
1796 194, 229, 149, 229, -1, 88, 166, 194, 229, 149,
1797 229, -1, 89, 167, 194, 229, 149, 229, -1, 165,
1798 230, 38, 194, -1, 129, 230, 149, 230, 149, 230,
1799 -1, 130, 230, 149, 194, -1, 131, 230, 149, 230,
1800 -1, 132, 230, 149, 230, 149, 230, -1, 133, 230,
1801 149, 230, 149, 230, -1, 128, 237, -1, 240, 182,
1802 196, 229, 152, 238, 153, 186, -1, 243, -1, 36,
1803 -1, -1, 110, 194, 188, -1, 110, 194, 149, 11,
1804 229, 188, -1, 111, 194, 188, -1, 111, 194, 149,
1805 11, 229, 188, -1, 112, 230, -1, 242, 113, 194,
1806 229, 188, -1, 242, 114, 230, 149, 194, 229, 188,
1807 -1, 115, 194, 229, 239, -1
1810 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1811 static const yytype_uint16 yyrline[] =
1813 0, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105,
1814 1105, 1106, 1106, 1106, 1106, 1106, 1106, 1107, 1107, 1107,
1815 1107, 1107, 1107, 1108, 1108, 1108, 1108, 1108, 1108, 1111,
1816 1111, 1112, 1112, 1113, 1113, 1114, 1114, 1115, 1115, 1119,
1817 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1124,
1818 1124, 1125, 1125, 1126, 1127, 1132, 1133, 1133, 1133, 1133,
1819 1133, 1135, 1135, 1135, 1136, 1136, 1140, 1144, 1149, 1149,
1820 1151, 1152, 1157, 1163, 1164, 1165, 1166, 1167, 1171, 1172,
1821 1173, 1177, 1178, 1179, 1180, 1184, 1185, 1186, 1190, 1191,
1822 1192, 1193, 1194, 1198, 1199, 1200, 1203, 1204, 1205, 1206,
1823 1207, 1208, 1209, 1216, 1217, 1218, 1219, 1220, 1221, 1222,
1824 1223, 1224, 1227, 1228, 1233, 1234, 1235, 1236, 1237, 1238,
1825 1241, 1242, 1249, 1250, 1256, 1257, 1265, 1273, 1274, 1279,
1826 1280, 1281, 1286, 1299, 1299, 1299, 1299, 1299, 1299, 1299,
1827 1302, 1306, 1310, 1317, 1322, 1330, 1360, 1385, 1390, 1400,
1828 1410, 1414, 1424, 1431, 1440, 1447, 1452, 1457, 1464, 1465,
1829 1472, 1479, 1487, 1493, 1505, 1533, 1549, 1576, 1604, 1630,
1830 1650, 1676, 1696, 1708, 1715, 1781, 1791, 1801, 1807, 1817,
1831 1823, 1833, 1838, 1843, 1856, 1868, 1890, 1898, 1904, 1915,
1832 1920, 1925, 1931, 1937, 1946, 1950, 1958, 1958, 1961, 1961,
1833 1964, 1976, 1997, 2002, 2010, 2011, 2015, 2015, 2019, 2019,
1834 2022, 2025, 2049, 2060, 2060, 2071, 2070, 2080, 2079, 2090,
1835 2130, 2133, 2139, 2149, 2153, 2158, 2160, 2165, 2170, 2179,
1836 2189, 2200, 2204, 2213, 2222, 2227, 2357, 2357, 2359, 2368,
1837 2368, 2370, 2375, 2387, 2391, 2396, 2400, 2404, 2408, 2412,
1838 2416, 2420, 2424, 2428, 2453, 2457, 2467, 2471, 2475, 2480,
1839 2487, 2487, 2493, 2502, 2506, 2515, 2524, 2533, 2537, 2544,
1840 2548, 2552, 2557, 2567, 2586, 2595, 2679, 2683, 2690, 2701,
1841 2714, 2724, 2735, 2745, 2756, 2764, 2774, 2781, 2784, 2785,
1842 2792, 2796, 2801, 2817, 2834, 2848, 2862, 2874, 2882, 2889,
1843 2895, 2901, 2907, 2922, 3013, 3018, 3022, 3029, 3036, 3044,
1844 3051, 3059, 3067, 3081, 3098
1848 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1849 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1850 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1851 static const char *const yytname[] =
1853 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1854 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1855 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1856 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1857 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1858 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1859 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1860 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1861 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1862 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1863 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1864 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1865 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1866 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1867 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1868 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1869 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1870 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1871 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1872 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1873 "INSERTELEMENT", "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN",
1874 "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE",
1875 "READONLY", "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'",
1876 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1877 "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1878 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1879 "OptLocalName", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1880 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1881 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1882 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1883 "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString",
1884 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1885 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1886 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1887 "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition",
1888 "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition",
1889 "LibrariesDefinition", "LibList", "ArgListH", "ArgList",
1890 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1891 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1892 "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock",
1893 "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1894 "ParamList", "IndexList", "OptTailCall", "InstVal", "OptVolatile",
1900 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1902 static const yytype_uint16 yytoknum[] =
1904 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1905 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1906 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1907 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1908 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1909 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1910 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1911 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1912 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1913 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1914 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1915 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1916 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1917 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1918 395, 396, 397, 398, 399, 400, 401, 402, 61, 44,
1919 42, 92, 40, 41, 91, 120, 93, 60, 62, 123,
1924 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1925 static const yytype_uint8 yyr1[] =
1927 0, 162, 163, 163, 163, 163, 163, 163, 163, 163,
1928 163, 164, 164, 164, 164, 164, 164, 165, 165, 165,
1929 165, 165, 165, 165, 165, 165, 165, 165, 165, 166,
1930 166, 166, 166, 166, 166, 166, 166, 166, 166, 167,
1931 167, 167, 167, 167, 167, 167, 167, 167, 167, 167,
1932 167, 167, 167, 167, 167, 168, 169, 169, 169, 169,
1933 169, 170, 170, 170, 171, 171, 172, 172, 173, 173,
1934 174, 174, 175, 176, 176, 176, 176, 176, 177, 177,
1935 177, 178, 178, 178, 178, 179, 179, 179, 180, 180,
1936 180, 180, 180, 181, 181, 181, 182, 182, 182, 182,
1937 182, 182, 182, 183, 183, 183, 183, 183, 183, 183,
1938 183, 183, 184, 184, 185, 185, 185, 185, 185, 185,
1939 186, 186, 187, 187, 188, 188, 189, 190, 190, 191,
1940 191, 192, 192, 193, 193, 193, 193, 193, 193, 193,
1941 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
1942 194, 194, 194, 195, 196, 196, 197, 197, 198, 198,
1943 198, 198, 199, 199, 200, 200, 200, 200, 200, 200,
1944 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
1945 200, 200, 200, 200, 201, 201, 201, 201, 201, 201,
1946 201, 201, 201, 201, 202, 202, 203, 203, 204, 204,
1947 205, 205, 206, 206, 207, 207, 209, 208, 210, 208,
1948 208, 208, 208, 211, 208, 212, 208, 213, 208, 208,
1949 208, 208, 214, 215, 215, 216, 217, 217, 217, 218,
1950 218, 219, 219, 219, 219, 220, 221, 221, 222, 223,
1951 223, 224, 225, 226, 226, 227, 227, 227, 227, 227,
1952 227, 227, 227, 227, 227, 227, 228, 228, 228, 228,
1953 229, 229, 230, 231, 231, 232, 233, 233, 233, 234,
1954 234, 234, 234, 234, 234, 234, 234, 234, 235, 235,
1955 236, 237, 237, 238, 238, 238, 238, 238, 239, 239,
1956 240, 240, 241, 241, 241, 241, 241, 241, 241, 241,
1957 241, 241, 241, 241, 241, 242, 242, 243, 243, 243,
1958 243, 243, 243, 243, 243
1961 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1962 static const yytype_uint8 yyr2[] =
1964 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1965 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1966 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1967 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1968 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1969 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1970 1, 1, 1, 1, 1, 0, 2, 0, 1, 1,
1971 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1972 1, 0, 1, 1, 1, 0, 1, 1, 0, 1,
1973 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1974 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1975 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
1976 0, 2, 0, 2, 0, 3, 2, 0, 1, 0,
1977 3, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1978 1, 1, 2, 1, 2, 5, 5, 5, 5, 3,
1979 2, 5, 4, 2, 1, 1, 1, 3, 1, 3,
1980 1, 0, 1, 3, 4, 3, 3, 4, 4, 3,
1981 6, 5, 2, 2, 2, 2, 2, 2, 2, 2,
1982 2, 2, 2, 2, 6, 5, 8, 6, 6, 7,
1983 7, 6, 8, 8, 3, 1, 1, 1, 1, 0,
1984 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
1985 3, 3, 3, 0, 7, 0, 8, 0, 8, 5,
1986 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
1987 3, 1, 3, 1, 0, 9, 1, 1, 4, 1,
1988 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
1989 1, 1, 1, 3, 1, 5, 1, 1, 1, 1,
1990 1, 1, 2, 2, 2, 3, 2, 0, 1, 2,
1991 2, 3, 9, 9, 8, 14, 1, 1, 6, 5,
1992 2, 6, 7, 4, 4, 6, 6, 0, 0, 3,
1993 2, 1, 5, 5, 6, 6, 4, 6, 4, 4,
1994 6, 6, 2, 8, 1, 1, 0, 3, 6, 3,
1998 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1999 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2000 means the default is an error. */
2001 static const yytype_uint16 yydefact[] =
2003 71, 61, 68, 62, 69, 63, 208, 206, 0, 0,
2004 0, 0, 0, 0, 81, 70, 0, 71, 204, 85,
2005 88, 0, 0, 220, 0, 0, 66, 0, 72, 73,
2006 75, 74, 76, 78, 77, 79, 80, 82, 83, 84,
2007 81, 81, 199, 1, 205, 86, 87, 81, 209, 89,
2008 90, 91, 92, 81, 267, 207, 267, 0, 0, 228,
2009 221, 222, 210, 256, 257, 212, 133, 134, 135, 138,
2010 137, 136, 139, 140, 0, 0, 0, 0, 258, 259,
2011 141, 211, 143, 199, 199, 93, 198, 0, 96, 96,
2012 268, 264, 67, 239, 240, 241, 263, 223, 224, 227,
2013 0, 161, 144, 0, 0, 0, 0, 150, 162, 0,
2014 142, 161, 0, 0, 95, 94, 0, 196, 197, 0,
2015 0, 97, 98, 99, 100, 101, 0, 242, 0, 306,
2016 266, 0, 225, 160, 112, 156, 158, 0, 0, 0,
2017 0, 0, 0, 149, 0, 0, 0, 155, 0, 154,
2018 0, 219, 133, 134, 135, 138, 137, 136, 0, 0,
2019 0, 213, 102, 0, 236, 237, 238, 305, 291, 0,
2020 0, 0, 0, 96, 276, 277, 2, 3, 4, 5,
2021 6, 7, 8, 9, 10, 14, 15, 16, 11, 12,
2022 13, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2023 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
2024 0, 0, 0, 0, 0, 0, 0, 0, 265, 96,
2025 280, 0, 304, 226, 153, 0, 120, 0, 0, 152,
2026 0, 163, 120, 215, 217, 0, 200, 181, 182, 177,
2027 179, 178, 180, 183, 176, 172, 173, 0, 0, 0,
2028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2029 0, 175, 174, 129, 0, 290, 270, 0, 269, 0,
2030 0, 55, 0, 0, 29, 30, 31, 32, 33, 34,
2031 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
2032 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
2033 48, 0, 124, 124, 311, 0, 0, 302, 0, 0,
2034 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
2035 106, 105, 103, 107, 108, 109, 110, 111, 113, 159,
2036 157, 146, 147, 148, 151, 145, 129, 129, 0, 0,
2037 0, 0, 0, 0, 0, 0, 165, 195, 0, 0,
2038 0, 169, 0, 166, 0, 0, 0, 0, 214, 234,
2039 245, 246, 247, 252, 248, 249, 250, 251, 243, 0,
2040 254, 261, 260, 262, 0, 271, 0, 0, 0, 0,
2041 0, 307, 0, 309, 288, 0, 0, 0, 0, 0,
2042 0, 0, 0, 0, 0, 0, 0, 0, 117, 116,
2043 114, 115, 118, 119, 121, 216, 218, 0, 0, 0,
2044 288, 0, 0, 0, 0, 0, 164, 150, 162, 0,
2045 167, 168, 0, 0, 0, 0, 0, 131, 129, 233,
2046 112, 231, 0, 244, 0, 0, 0, 0, 0, 0,
2047 0, 0, 0, 0, 314, 0, 0, 0, 298, 299,
2048 0, 0, 0, 0, 296, 0, 124, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 194, 171, 0, 0,
2050 0, 0, 126, 132, 130, 65, 0, 120, 0, 253,
2051 0, 0, 287, 0, 0, 124, 125, 124, 0, 0,
2052 0, 0, 0, 0, 292, 293, 287, 0, 312, 0,
2053 201, 0, 0, 185, 0, 0, 0, 0, 170, 0,
2054 0, 0, 64, 230, 232, 112, 127, 0, 0, 0,
2055 112, 112, 0, 294, 295, 308, 310, 289, 0, 0,
2056 297, 300, 301, 0, 124, 0, 0, 0, 191, 0,
2057 0, 187, 188, 184, 65, 128, 122, 255, 0, 0,
2058 0, 0, 0, 120, 281, 0, 120, 313, 189, 190,
2059 0, 0, 0, 229, 0, 235, 0, 274, 0, 0,
2060 104, 106, 112, 112, 112, 112, 0, 282, 303, 186,
2061 192, 193, 123, 272, 0, 273, 0, 284, 283, 0,
2062 0, 0, 0, 0, 112, 112, 0, 0, 0, 286,
2063 285, 0, 279, 0, 0, 278, 0, 275
2066 /* YYDEFGOTO[NTERM-NUM]. */
2067 static const yytype_int16 yydefgoto[] =
2069 -1, 258, 259, 260, 284, 301, 158, 159, 78, 513,
2070 12, 79, 14, 15, 40, 41, 42, 47, 53, 116,
2071 126, 328, 224, 404, 331, 565, 381, 427, 546, 358,
2072 428, 80, 160, 135, 150, 136, 137, 109, 347, 370,
2073 348, 119, 87, 151, 16, 17, 18, 20, 19, 263,
2074 336, 337, 62, 23, 60, 100, 431, 432, 127, 166,
2075 54, 95, 55, 48, 434, 371, 82, 373, 268, 56,
2076 91, 92, 218, 569, 130, 307, 522, 444, 219, 220,
2080 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2082 #define YYPACT_NINF -546
2083 static const yytype_int16 yypact[] =
2085 47, -546, -546, -546, -546, -546, -546, -546, -17, -95,
2086 52, -90, 86, 14, 183, -546, 135, 1758, -546, -10,
2087 64, 18, 33, -546, 5, 180, -546, 1341, -546, -546,
2088 -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,
2089 76, 76, 59, -546, -546, -546, -546, 76, -546, -546,
2090 -546, -546, -546, 76, 193, -546, 13, 202, 224, 233,
2091 -546, -546, -546, -546, -546, 111, -546, -546, -546, -546,
2092 -546, -546, -546, -546, 260, 261, 1, 378, -546, -546,
2093 -546, -7, -546, 231, 231, 150, -546, 55, 309, 309,
2094 -546, -546, 100, -546, -546, -546, -546, -546, -546, -546,
2095 -99, 1088, -546, 116, 122, 988, 111, -546, -7, -106,
2096 -546, 1088, 55, 55, -546, -546, 1142, -546, -546, 1359,
2097 274, -546, -546, -546, -546, -546, 1414, -546, -18, 1624,
2098 -546, 257, -546, -546, -7, -546, 131, 128, 1454, 1454,
2099 129, -105, 1454, -546, 136, 1359, 1454, 111, 141, -7,
2100 237, -546, 214, 279, 285, 289, 291, 294, 145, 299,
2101 803, -546, -546, 103, -546, -546, -546, -546, -546, 254,
2102 1512, 57, 301, 309, -546, -546, -546, -546, -546, -546,
2103 -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,
2104 -546, 596, 646, 1454, 1454, 1454, 1454, -546, -546, -546,
2105 -546, -546, -546, -546, -546, -546, -546, -546, -546, 1454,
2106 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, -546, 309,
2107 -546, 61, -546, -546, 132, 1182, -546, -57, -69, -546,
2108 155, -7, -546, -546, -7, 1142, -546, -546, -546, -546,
2109 -546, -546, -546, -546, -546, -546, -546, 596, 646, 162,
2110 163, 164, 166, 167, 1242, 1530, 1028, 303, 169, 174,
2111 179, -546, -546, 185, 191, -546, 111, 644, -546, 780,
2112 780, -546, 780, 1414, -546, -546, -546, -546, -546, -546,
2113 -546, -546, -546, -546, 1454, -546, -546, -546, -546, -546,
2114 -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,
2115 -546, 1454, 30, 48, -546, 644, -21, 197, 199, 203,
2116 204, 205, 206, 644, 644, 313, 1414, 1454, 1454, -546,
2117 -546, -546, -546, -546, -546, -546, -546, -546, -546, -546,
2118 -546, 201, -546, -546, -546, 201, 185, 185, 320, 207,
2119 208, 1359, 1359, 1359, 1359, 1359, -546, -546, -65, 1068,
2120 -86, -546, -104, -546, 1359, 1359, 1359, -20, -546, 1261,
2121 -546, -546, -546, -546, -546, -546, -546, -546, 273, 1359,
2122 -546, -546, -546, -546, 217, -546, 218, 780, 644, 644,
2123 8, -546, 11, -546, -546, 780, 221, 1454, 1454, 1454,
2124 1454, 1454, 227, 234, 1454, 780, 644, 235, -546, -546,
2125 -546, -546, -546, -546, -546, -546, -546, 1454, 1359, 1359,
2126 -546, 247, 258, 263, 265, 1359, -546, 259, 803, -101,
2127 -546, -546, 269, 270, 344, 398, 419, -546, 185, -546,
2128 -7, 276, 275, -546, 404, -76, 412, 413, 282, 288,
2129 292, 780, 440, 780, 297, 300, 780, 302, -7, -546,
2130 304, 308, 780, 780, -7, 306, 310, 1454, -35, 311,
2131 314, -73, 1359, 1359, 1359, 1359, -546, -546, 315, 1359,
2132 1359, 1454, -546, -546, -546, 298, 1301, -546, 319, -546,
2133 780, 780, 1570, 780, 780, 310, -546, 310, 1454, 780,
2134 322, 1454, 1454, 1454, -546, -546, 1570, 399, -546, 644,
2135 -546, 1359, 1359, -546, 323, 316, 325, 327, -546, 324,
2136 326, 60, -546, -546, -546, -7, 3, 460, 334, 330,
2137 82, -7, -13, -546, -546, -546, -546, -546, 332, 780,
2138 -546, -546, -546, 12, 310, 336, 337, 1359, -546, 1359,
2139 1359, -546, -546, -546, 298, -546, 438, -546, 475, -4,
2140 493, 493, 1610, -546, -546, 338, -546, -546, -546, -546,
2141 342, 345, 346, -546, 501, -546, 780, -546, 940, 2,
2142 354, 355, -546, -546, 82, -7, 72, -546, 201, -546,
2143 -546, -546, -546, -546, 359, -546, 940, 132, 132, 493,
2144 493, 492, 494, 361, -546, -546, 780, 780, 497, 132,
2145 132, 450, -546, 780, 505, -546, 780, -546
2148 /* YYPGOTO[NTERM-NUM]. */
2149 static const yytype_int16 yypgoto[] =
2151 -546, 394, 395, 396, 280, 283, -170, -546, 0, -16,
2152 444, 15, -546, -546, -546, -546, -1, -546, -546, -546,
2153 -157, -546, -418, -546, -229, -546, -292, 23, -546, -307,
2154 -546, -546, -26, 305, -120, -546, 429, 436, -59, -156,
2155 -235, 126, 168, 307, -546, -546, 526, -546, -546, -546,
2156 -546, -546, -546, -546, -546, -546, -546, -546, 456, -546,
2157 -546, -546, -546, -546, -546, -545, -142, 108, -186, -546,
2158 490, -546, -546, -546, -546, -546, 51, 138, -546, -546,
2162 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2163 positive, shift that token. If negative, reduce the rule which
2164 number is the opposite. If zero, do what YYDEFACT says.
2165 If YYTABLE_NINF, syntax error. */
2166 #define YYTABLE_NINF -204
2167 static const yytype_int16 yytable[] =
2169 11, 81, 272, 335, 261, 104, 163, 271, 236, 304,
2170 164, 383, 475, 271, 425, 13, 273, 11, 262, 441,
2171 350, 352, 443, 584, 308, 309, 310, 311, 312, 405,
2172 406, 315, 13, 426, 90, 21, 45, 425, 46, 83,
2173 84, 593, 93, 142, 142, 415, 88, -203, 415, 22,
2174 131, 108, 89, 24, 143, 230, 421, 132, 26, 468,
2175 161, 442, 316, 415, 442, -67, 1, 2, 269, 3,
2176 4, 5, 420, 415, 270, 134, 488, 6, 7, 108,
2177 503, 110, 479, 111, 415, 134, 233, 117, 118, 333,
2178 149, 416, 11, 110, 85, 111, 86, 544, 8, 332,
2179 149, 9, 550, 551, 27, 10, 49, 50, 51, 25,
2180 591, 52, 227, 228, 419, 110, 231, 111, 500, 1,
2181 234, 474, 3, 2, 5, 372, 4, 372, 372, 110,
2182 372, 111, 397, 385, 435, 43, 552, 398, 399, 400,
2183 553, 165, 401, 110, 267, 111, 402, 403, 239, 240,
2184 241, 242, 567, 377, 587, 588, 589, 590, 585, 59,
2185 105, 552, 28, 372, 498, 556, 57, 302, 303, 267,
2186 305, 372, 372, 94, 317, 318, 599, 600, 264, 380,
2187 110, 58, 111, 306, 267, 267, 267, 267, 267, 313,
2188 314, 267, 114, 525, 115, 526, 395, 382, 110, 134,
2189 111, 447, 61, 449, 450, 451, 398, 399, 400, 149,
2190 110, 401, 111, 543, 90, 402, 403, -55, -55, -55,
2191 -55, 37, 38, 39, 97, 29, 30, 31, 32, 33,
2192 34, 35, -139, 36, -139, 372, 372, 372, 145, 146,
2193 237, 238, 557, 372, 63, 64, 98, 149, 516, 319,
2194 320, 112, 113, 372, 372, 99, 1, 2, 378, 3,
2195 4, 5, 261, 101, 102, 103, 321, 322, 86, 323,
2196 324, 138, 325, 326, 327, 379, 262, 139, 162, 223,
2197 225, 226, 410, 411, 412, 413, 414, 229, -56, 232,
2198 149, 396, 267, 235, -57, 422, 423, 424, -60, 372,
2199 -59, 372, 527, -58, 372, 530, 531, 532, 243, 265,
2200 372, 372, 271, 334, 341, 342, 343, 1, 344, 345,
2201 3, 354, 5, 418, 576, 353, 355, 578, 37, 38,
2202 39, 356, 433, 430, 357, 398, 399, 400, 372, 372,
2203 401, 372, 372, 359, 402, 403, 386, 372, 387, 459,
2204 460, 394, 388, 389, 390, 391, 466, 372, 407, 408,
2205 409, 267, 448, 267, 267, 267, 436, 437, 454, 120,
2206 121, 122, 123, 124, 125, 446, 452, 374, 375, 568,
2207 376, 458, 471, 453, 457, 63, 64, 372, 106, 66,
2208 67, 68, 69, 70, 71, 72, 462, 1, 2, 586,
2209 3, 4, 5, 504, 505, 506, 507, 463, 372, 372,
2210 509, 510, 464, 384, 465, 319, 320, 467, 469, 470,
2211 472, 392, 393, 473, 372, 476, 478, 73, 477, 480,
2212 481, 499, 321, 322, 482, 323, 324, 483, 325, 326,
2213 327, 484, 535, 536, 486, 511, 488, 372, 372, 489,
2214 515, 491, 442, 492, 372, 372, 521, 493, 496, 497,
2215 501, 372, 267, 502, 372, 267, 267, 267, 517, 538,
2216 521, 529, 537, 508, 539, 512, 540, 541, 560, 542,
2217 561, 562, 547, 548, 549, 438, 439, 440, 554, 558,
2218 559, 564, 566, 445, 577, 579, 360, 361, 580, 581,
2219 63, 64, 362, 455, 456, 582, -18, -19, 592, 596,
2220 598, 597, 1, 2, 603, 3, 4, 5, 363, 364,
2221 365, 604, 606, 215, 216, 217, 575, 339, 563, 74,
2222 330, 340, 75, 366, 367, 76, 129, 77, 107, 545,
2223 144, 141, 338, 44, 512, 128, 96, 533, 461, 485,
2224 368, 487, 0, 0, 490, 0, 0, 0, 0, 0,
2225 494, 495, 0, 0, 0, 0, 176, 177, 178, 179,
2226 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2227 190, 247, 248, 0, 0, 0, 0, 0, 518, 519,
2228 0, 523, 524, 0, 0, 0, 0, 528, 0, 0,
2229 0, 0, 0, 0, 0, 0, 0, 534, 249, 197,
2230 570, 571, 200, 201, 202, 203, 204, 205, 206, 207,
2231 208, 0, 250, 0, 251, 252, 253, 321, 322, 0,
2232 323, 324, 0, 325, 326, 327, 0, 555, 0, 0,
2233 0, 0, 0, 0, 0, 0, 0, 360, 361, 0,
2234 369, 63, 64, 362, 0, 0, 0, 0, 572, 573,
2235 0, 0, 0, 1, 2, 0, 3, 4, 5, 363,
2236 364, 365, 285, 286, 583, 0, 0, 0, 0, 0,
2237 0, 0, 0, 0, 366, 367, 274, 275, 276, 277,
2238 278, 279, 280, 281, 282, 283, 0, 594, 595, 0,
2239 0, 368, 0, 0, 601, 602, 0, 0, 0, 0,
2240 0, 605, 0, 0, 607, 0, 0, 176, 177, 178,
2241 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2242 189, 190, 247, 248, 0, 0, 0, 0, 0, 0,
2243 0, 0, 287, 288, 289, 290, 291, 292, 293, 294,
2244 295, 296, 297, 298, 299, 300, 0, 0, 0, 249,
2245 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
2246 207, 208, 0, 250, 0, 251, 252, 253, 0, 0,
2247 0, 0, 0, 360, 361, 0, 0, 63, 64, 362,
2248 0, 0, 0, 0, 110, 0, 111, 0, 0, 1,
2249 2, 369, 3, 4, 5, 363, 364, 365, 0, 0,
2250 63, 64, 0, 0, 0, 0, 0, 0, 0, 0,
2251 366, 367, 1, 2, 0, 3, 4, 5, 244, 0,
2252 0, 0, 0, 0, 0, 0, 0, 368, 0, 0,
2253 0, 0, 0, 245, 246, 0, 0, 0, 0, 0,
2254 0, 0, 0, 176, 177, 178, 179, 180, 181, 182,
2255 183, 184, 185, 186, 187, 188, 189, 190, 247, 248,
2256 0, 0, 0, 0, 0, 0, 176, 177, 178, 179,
2257 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2258 190, 247, 248, 0, 0, 249, 197, 198, 199, 200,
2259 201, 202, 203, 204, 205, 206, 207, 208, 0, 250,
2260 0, 251, 252, 253, 0, 0, 0, 0, 249, 197,
2261 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2262 208, 0, 250, 0, 251, 252, 253, 369, 0, 0,
2263 0, 0, 0, 360, 361, 0, 0, 0, 0, 362,
2264 0, 0, 0, 110, 0, 111, 0, 254, 0, 0,
2265 255, 0, 256, 0, 257, 363, 364, 365, 0, 0,
2266 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2267 366, 367, 0, 0, 0, 0, 0, 0, 0, 0,
2268 0, 0, 0, 0, 0, 63, 64, 368, 106, 66,
2269 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2270 3, 4, 5, 176, 177, 178, 179, 180, 181, 182,
2271 183, 184, 185, 186, 187, 188, 189, 190, 247, 248,
2272 0, 0, 0, 0, 0, 63, 64, 73, 106, 152,
2273 153, 154, 155, 156, 157, 72, 0, 1, 2, 0,
2274 3, 4, 5, 0, 0, 249, 197, 198, 199, 200,
2275 201, 202, 203, 204, 205, 206, 207, 208, 0, 250,
2276 0, 251, 252, 253, 0, 63, 64, 73, 106, 152,
2277 153, 154, 155, 156, 157, 72, 0, 1, 2, 0,
2278 3, 4, 5, 0, 0, 63, 64, 369, 106, 66,
2279 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2280 3, 4, 5, 0, 0, 0, 0, 73, 0, 0,
2281 0, 0, 0, 0, 0, 0, 0, 133, 0, 0,
2282 0, 0, 0, 0, 0, 0, 0, 73, 0, 74,
2283 0, 0, 75, 0, 0, 76, 0, 77, 140, 63,
2284 64, 0, 147, 66, 67, 68, 69, 70, 71, 72,
2285 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2286 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2287 0, 0, 75, 0, 0, 76, 0, 77, 351, 63,
2288 64, 73, 106, 66, 67, 68, 69, 70, 71, 72,
2289 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2290 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2291 0, 329, 75, 0, 0, 76, 0, 77, 417, 0,
2292 0, 73, 0, 0, 0, 0, 0, 0, 0, 74,
2293 0, 0, 75, 0, 0, 76, 0, 77, 0, 63,
2294 64, 0, 106, 152, 153, 154, 155, 156, 157, 72,
2295 0, 1, 2, 148, 3, 4, 5, 0, 63, 64,
2296 0, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2297 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2298 0, 73, 0, 74, 0, 0, 75, 0, 0, 76,
2299 429, 77, 0, 0, 0, 0, 0, 0, 63, 64,
2300 73, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2301 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2302 0, 0, 0, 74, 0, 0, 75, 0, 0, 76,
2303 514, 77, 0, 0, 0, 0, 0, 0, 63, 64,
2304 73, 65, 66, 67, 68, 69, 70, 71, 72, 0,
2305 1, 2, 0, 3, 4, 5, 63, 64, 0, 106,
2306 152, 153, 154, 155, 156, 157, 72, 0, 1, 2,
2307 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2308 73, 0, 0, 74, 0, 0, 75, 0, 346, 76,
2309 0, 77, 0, 0, 0, 0, 0, 0, 73, 0,
2310 0, 0, 74, 0, 0, 75, 0, 0, 76, 0,
2311 77, 63, 64, 0, 147, 66, 67, 68, 69, 70,
2312 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2313 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2314 0, 0, 74, 0, 0, 75, 0, 0, 76, 0,
2315 77, 63, 64, 73, 106, 66, 67, 68, 69, 70,
2316 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2318 0, 0, 74, 0, 0, 75, 0, 0, 76, 0,
2319 77, 0, 0, 73, 0, 0, 0, 0, 0, 0,
2320 74, 0, 0, 75, 0, 0, 76, 0, 77, 63,
2321 64, 0, 266, 66, 67, 68, 69, 70, 71, 72,
2322 0, 1, 2, 0, 3, 4, 5, 63, 64, 0,
2323 106, 152, 153, 154, 155, 156, 157, 72, 0, 1,
2324 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2325 0, 73, 0, 0, 0, 74, 0, 0, 75, 0,
2326 0, 76, 0, 77, 0, 0, 0, 63, 64, 73,
2327 106, 66, 67, 68, 69, 70, 71, 520, 0, 1,
2328 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2329 0, 0, 0, 0, 0, 74, 0, 0, 75, 0,
2330 0, 76, 0, 77, 0, 0, 0, 63, 64, 73,
2331 106, 66, 67, 68, 69, 70, 71, 574, 0, 1,
2332 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2333 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 0, 0, 0, 0, 73,
2335 167, 0, 0, 74, 0, 0, 75, 0, 0, 76,
2336 0, 77, 0, 0, 0, 0, 0, 0, 0, 168,
2337 169, 74, 0, 0, 75, 0, 0, 76, 0, 349,
2338 0, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2339 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2340 189, 190, 191, 192, 0, 0, 0, 0, 0, 0,
2341 0, 74, 0, 0, 75, 0, 0, 76, 0, 77,
2342 0, 0, 0, 0, 193, 194, 195, 0, 0, 196,
2343 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
2344 207, 208, 209, 210, 211, 212, 213, 214, -202, 0,
2345 0, 74, 0, 0, 75, 0, 0, 76, 0, 77,
2346 0, 0, 0, 0, 0, 0, -67, 1, 2, 0,
2347 3, 4, 5, 0, 0, 0, 0, 0, 6, 7,
2348 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
2350 0, 0, 9, 0, 0, 0, 10
2353 static const yytype_int16 yycheck[] =
2355 0, 27, 172, 232, 160, 4, 126, 11, 150, 195,
2356 28, 303, 430, 11, 34, 0, 173, 17, 160, 11,
2357 255, 256, 11, 568, 210, 211, 212, 213, 214, 336,
2358 337, 217, 17, 53, 21, 52, 46, 34, 48, 40,
2359 41, 586, 29, 149, 149, 149, 47, 0, 149, 66,
2360 149, 77, 53, 148, 160, 160, 160, 156, 148, 160,
2361 119, 53, 219, 149, 53, 18, 19, 20, 11, 22,
2362 23, 24, 158, 149, 17, 101, 149, 30, 31, 105,
2363 153, 150, 158, 152, 149, 111, 145, 32, 33, 158,
2364 116, 156, 92, 150, 35, 152, 37, 515, 51, 156,
2365 126, 54, 520, 521, 18, 58, 42, 43, 44, 57,
2366 38, 47, 138, 139, 349, 150, 142, 152, 153, 19,
2367 146, 428, 22, 20, 24, 267, 23, 269, 270, 150,
2368 272, 152, 318, 154, 369, 0, 149, 134, 135, 136,
2369 153, 159, 139, 150, 170, 152, 143, 144, 3, 4,
2370 5, 6, 156, 273, 572, 573, 574, 575, 156, 154,
2371 159, 149, 148, 305, 456, 153, 148, 193, 194, 195,
2372 196, 313, 314, 160, 113, 114, 594, 595, 163, 149,
2373 150, 148, 152, 209, 210, 211, 212, 213, 214, 215,
2374 216, 217, 42, 485, 44, 487, 316, 149, 150, 225,
2375 152, 387, 22, 389, 390, 391, 134, 135, 136, 235,
2376 150, 139, 152, 153, 21, 143, 144, 3, 4, 5,
2377 6, 145, 146, 147, 22, 42, 43, 44, 45, 46,
2378 47, 48, 150, 50, 152, 377, 378, 379, 112, 113,
2379 26, 27, 534, 385, 7, 8, 22, 273, 477, 117,
2380 118, 83, 84, 395, 396, 22, 19, 20, 284, 22,
2381 23, 24, 418, 152, 4, 4, 134, 135, 37, 137,
2382 138, 155, 140, 141, 142, 301, 418, 155, 4, 22,
2383 149, 153, 341, 342, 343, 344, 345, 158, 9, 153,
2384 316, 317, 318, 152, 9, 354, 355, 356, 9, 441,
2385 9, 443, 488, 9, 446, 491, 492, 493, 9, 55,
2386 452, 453, 11, 158, 152, 152, 152, 19, 152, 152,
2387 22, 152, 24, 349, 553, 22, 152, 556, 145, 146,
2388 147, 152, 59, 359, 149, 134, 135, 136, 480, 481,
2389 139, 483, 484, 152, 143, 144, 149, 489, 149, 408,
2390 409, 38, 149, 149, 149, 149, 415, 499, 38, 152,
2391 152, 387, 388, 389, 390, 391, 149, 149, 394, 60,
2392 61, 62, 63, 64, 65, 154, 149, 269, 270, 549,
2393 272, 407, 38, 149, 149, 7, 8, 529, 10, 11,
2394 12, 13, 14, 15, 16, 17, 149, 19, 20, 569,
2395 22, 23, 24, 462, 463, 464, 465, 149, 550, 551,
2396 469, 470, 149, 305, 149, 117, 118, 158, 149, 149,
2397 22, 313, 314, 4, 566, 149, 22, 49, 153, 17,
2398 17, 457, 134, 135, 152, 137, 138, 149, 140, 141,
2399 142, 149, 501, 502, 4, 471, 149, 589, 590, 149,
2400 476, 149, 53, 149, 596, 597, 482, 149, 152, 149,
2401 149, 603, 488, 149, 606, 491, 492, 493, 149, 153,
2402 496, 149, 149, 158, 149, 475, 149, 153, 537, 153,
2403 539, 540, 22, 149, 154, 377, 378, 379, 156, 153,
2404 153, 53, 17, 385, 156, 153, 3, 4, 153, 153,
2405 7, 8, 9, 395, 396, 4, 152, 152, 149, 17,
2406 149, 17, 19, 20, 17, 22, 23, 24, 25, 26,
2407 27, 71, 17, 129, 129, 129, 552, 247, 544, 151,
2408 225, 248, 154, 40, 41, 157, 92, 159, 160, 516,
2409 111, 105, 235, 17, 544, 89, 56, 496, 410, 441,
2410 57, 443, -1, -1, 446, -1, -1, -1, -1, -1,
2411 452, 453, -1, -1, -1, -1, 73, 74, 75, 76,
2412 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2413 87, 88, 89, -1, -1, -1, -1, -1, 480, 481,
2414 -1, 483, 484, -1, -1, -1, -1, 489, -1, -1,
2415 -1, -1, -1, -1, -1, -1, -1, 499, 115, 116,
2416 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2417 127, -1, 129, -1, 131, 132, 133, 134, 135, -1,
2418 137, 138, -1, 140, 141, 142, -1, 529, -1, -1,
2419 -1, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2420 157, 7, 8, 9, -1, -1, -1, -1, 550, 551,
2421 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2422 26, 27, 26, 27, 566, -1, -1, -1, -1, -1,
2423 -1, -1, -1, -1, 40, 41, 90, 91, 92, 93,
2424 94, 95, 96, 97, 98, 99, -1, 589, 590, -1,
2425 -1, 57, -1, -1, 596, 597, -1, -1, -1, -1,
2426 -1, 603, -1, -1, 606, -1, -1, 73, 74, 75,
2427 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2428 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
2429 -1, -1, 96, 97, 98, 99, 100, 101, 102, 103,
2430 104, 105, 106, 107, 108, 109, -1, -1, -1, 115,
2431 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2432 126, 127, -1, 129, -1, 131, 132, 133, -1, -1,
2433 -1, -1, -1, 3, 4, -1, -1, 7, 8, 9,
2434 -1, -1, -1, -1, 150, -1, 152, -1, -1, 19,
2435 20, 157, 22, 23, 24, 25, 26, 27, -1, -1,
2436 7, 8, -1, -1, -1, -1, -1, -1, -1, -1,
2437 40, 41, 19, 20, -1, 22, 23, 24, 25, -1,
2438 -1, -1, -1, -1, -1, -1, -1, 57, -1, -1,
2439 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2440 -1, -1, -1, 73, 74, 75, 76, 77, 78, 79,
2441 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2442 -1, -1, -1, -1, -1, -1, 73, 74, 75, 76,
2443 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2444 87, 88, 89, -1, -1, 115, 116, 117, 118, 119,
2445 120, 121, 122, 123, 124, 125, 126, 127, -1, 129,
2446 -1, 131, 132, 133, -1, -1, -1, -1, 115, 116,
2447 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2448 127, -1, 129, -1, 131, 132, 133, 157, -1, -1,
2449 -1, -1, -1, 3, 4, -1, -1, -1, -1, 9,
2450 -1, -1, -1, 150, -1, 152, -1, 154, -1, -1,
2451 157, -1, 159, -1, 161, 25, 26, 27, -1, -1,
2452 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2453 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2454 -1, -1, -1, -1, -1, 7, 8, 57, 10, 11,
2455 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2456 22, 23, 24, 73, 74, 75, 76, 77, 78, 79,
2457 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2458 -1, -1, -1, -1, -1, 7, 8, 49, 10, 11,
2459 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2460 22, 23, 24, -1, -1, 115, 116, 117, 118, 119,
2461 120, 121, 122, 123, 124, 125, 126, 127, -1, 129,
2462 -1, 131, 132, 133, -1, 7, 8, 49, 10, 11,
2463 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2464 22, 23, 24, -1, -1, 7, 8, 157, 10, 11,
2465 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2466 22, 23, 24, -1, -1, -1, -1, 49, -1, -1,
2467 -1, -1, -1, -1, -1, -1, -1, 39, -1, -1,
2468 -1, -1, -1, -1, -1, -1, -1, 49, -1, 151,
2469 -1, -1, 154, -1, -1, 157, -1, 159, 160, 7,
2470 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2471 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2472 -1, -1, -1, -1, -1, -1, -1, -1, -1, 151,
2473 -1, -1, 154, -1, -1, 157, -1, 159, 160, 7,
2474 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2475 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2476 -1, -1, -1, -1, -1, -1, -1, -1, -1, 151,
2477 -1, 39, 154, -1, -1, 157, -1, 159, 160, -1,
2478 -1, 49, -1, -1, -1, -1, -1, -1, -1, 151,
2479 -1, -1, 154, -1, -1, 157, -1, 159, -1, 7,
2480 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2481 -1, 19, 20, 121, 22, 23, 24, -1, 7, 8,
2482 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2483 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2484 -1, 49, -1, 151, -1, -1, 154, -1, -1, 157,
2485 39, 159, -1, -1, -1, -1, -1, -1, 7, 8,
2486 49, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2487 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2488 -1, -1, -1, 151, -1, -1, 154, -1, -1, 157,
2489 39, 159, -1, -1, -1, -1, -1, -1, 7, 8,
2490 49, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2491 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2492 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2493 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2494 49, -1, -1, 151, -1, -1, 154, -1, 156, 157,
2495 -1, 159, -1, -1, -1, -1, -1, -1, 49, -1,
2496 -1, -1, 151, -1, -1, 154, -1, -1, 157, -1,
2497 159, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2498 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2499 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2500 -1, -1, 151, -1, -1, 154, -1, -1, 157, -1,
2501 159, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2502 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2503 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2504 -1, -1, 151, -1, -1, 154, -1, -1, 157, -1,
2505 159, -1, -1, 49, -1, -1, -1, -1, -1, -1,
2506 151, -1, -1, 154, -1, -1, 157, -1, 159, 7,
2507 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2508 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2509 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2510 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2511 -1, 49, -1, -1, -1, 151, -1, -1, 154, -1,
2512 -1, 157, -1, 159, -1, -1, -1, 7, 8, 49,
2513 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2514 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2515 -1, -1, -1, -1, -1, 151, -1, -1, 154, -1,
2516 -1, 157, -1, 159, -1, -1, -1, 7, 8, 49,
2517 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2518 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2519 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2520 -1, -1, -1, -1, -1, -1, -1, -1, -1, 49,
2521 36, -1, -1, 151, -1, -1, 154, -1, -1, 157,
2522 -1, 159, -1, -1, -1, -1, -1, -1, -1, 55,
2523 56, 151, -1, -1, 154, -1, -1, 157, -1, 159,
2524 -1, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2525 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2526 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
2527 -1, 151, -1, -1, 154, -1, -1, 157, -1, 159,
2528 -1, -1, -1, -1, 110, 111, 112, -1, -1, 115,
2529 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2530 126, 127, 128, 129, 130, 131, 132, 133, 0, -1,
2531 -1, 151, -1, -1, 154, -1, -1, 157, -1, 159,
2532 -1, -1, -1, -1, -1, -1, 18, 19, 20, -1,
2533 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
2534 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2535 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
2536 -1, -1, 54, -1, -1, -1, 58
2539 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2540 symbol of state STATE-NUM. */
2541 static const yytype_uint8 yystos[] =
2543 0, 19, 20, 22, 23, 24, 30, 31, 51, 54,
2544 58, 170, 172, 173, 174, 175, 206, 207, 208, 210,
2545 209, 52, 66, 215, 148, 57, 148, 18, 148, 42,
2546 43, 44, 45, 46, 47, 48, 50, 145, 146, 147,
2547 176, 177, 178, 0, 208, 46, 48, 179, 225, 42,
2548 43, 44, 47, 180, 222, 224, 231, 148, 148, 154,
2549 216, 22, 214, 7, 8, 10, 11, 12, 13, 14,
2550 15, 16, 17, 49, 151, 154, 157, 159, 170, 173,
2551 193, 194, 228, 178, 178, 35, 37, 204, 178, 178,
2552 21, 232, 233, 29, 160, 223, 232, 22, 22, 22,
2553 217, 152, 4, 4, 4, 159, 10, 160, 194, 199,
2554 150, 152, 204, 204, 42, 44, 181, 32, 33, 203,
2555 60, 61, 62, 63, 64, 65, 182, 220, 220, 172,
2556 236, 149, 156, 39, 194, 195, 197, 198, 155, 155,
2557 160, 199, 149, 160, 198, 203, 203, 10, 121, 194,
2558 196, 205, 11, 12, 13, 14, 15, 16, 168, 169,
2559 194, 200, 4, 196, 28, 159, 221, 36, 55, 56,
2560 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2561 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2562 87, 88, 89, 110, 111, 112, 115, 116, 117, 118,
2563 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2564 129, 130, 131, 132, 133, 163, 164, 165, 234, 240,
2565 241, 242, 243, 22, 184, 149, 153, 194, 194, 158,
2566 160, 194, 153, 200, 194, 152, 228, 26, 27, 3,
2567 4, 5, 6, 9, 25, 40, 41, 88, 89, 115,
2568 129, 131, 132, 133, 154, 157, 159, 161, 163, 164,
2569 165, 201, 228, 211, 173, 55, 10, 194, 230, 11,
2570 17, 11, 168, 182, 90, 91, 92, 93, 94, 95,
2571 96, 97, 98, 99, 166, 26, 27, 96, 97, 98,
2572 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2573 109, 167, 194, 194, 230, 194, 194, 237, 230, 230,
2574 230, 230, 230, 194, 194, 230, 182, 113, 114, 117,
2575 118, 134, 135, 137, 138, 140, 141, 142, 183, 39,
2576 195, 186, 156, 158, 158, 186, 212, 213, 205, 166,
2577 167, 152, 152, 152, 152, 152, 156, 200, 202, 159,
2578 202, 160, 202, 22, 152, 152, 152, 149, 191, 152,
2579 3, 4, 9, 25, 26, 27, 40, 41, 57, 157,
2580 201, 227, 228, 229, 229, 229, 229, 196, 194, 194,
2581 149, 188, 149, 188, 229, 154, 149, 149, 149, 149,
2582 149, 149, 229, 229, 38, 196, 194, 230, 134, 135,
2583 136, 139, 143, 144, 185, 191, 191, 38, 152, 152,
2584 200, 200, 200, 200, 200, 149, 156, 160, 194, 202,
2585 158, 160, 200, 200, 200, 34, 53, 189, 192, 39,
2586 194, 218, 219, 59, 226, 202, 149, 149, 229, 229,
2587 229, 11, 53, 11, 239, 229, 154, 230, 194, 230,
2588 230, 230, 149, 149, 194, 229, 229, 149, 194, 200,
2589 200, 239, 149, 149, 149, 149, 200, 158, 160, 149,
2590 149, 38, 22, 4, 191, 184, 149, 153, 22, 158,
2591 17, 17, 152, 149, 149, 229, 4, 229, 149, 149,
2592 229, 149, 149, 149, 229, 229, 152, 149, 188, 194,
2593 153, 149, 149, 153, 200, 200, 200, 200, 158, 200,
2594 200, 194, 170, 171, 39, 194, 186, 149, 229, 229,
2595 17, 194, 238, 229, 229, 188, 188, 230, 229, 149,
2596 230, 230, 230, 238, 229, 200, 200, 149, 153, 149,
2597 149, 153, 153, 153, 184, 189, 190, 22, 149, 154,
2598 184, 184, 149, 153, 156, 229, 153, 188, 153, 153,
2599 200, 200, 200, 171, 53, 187, 17, 156, 168, 235,
2600 117, 118, 229, 229, 17, 194, 186, 156, 186, 153,
2601 153, 153, 4, 229, 227, 156, 168, 184, 184, 184,
2602 184, 38, 149, 227, 229, 229, 17, 17, 149, 184,
2603 184, 229, 229, 17, 71, 229, 17, 229
2606 #define yyerrok (yyerrstatus = 0)
2607 #define yyclearin (yychar = YYEMPTY)
2608 #define YYEMPTY (-2)
2611 #define YYACCEPT goto yyacceptlab
2612 #define YYABORT goto yyabortlab
2613 #define YYERROR goto yyerrorlab
2616 /* Like YYERROR except do call yyerror. This remains here temporarily
2617 to ease the transition to the new meaning of YYERROR, for GCC.
2618 Once GCC version 2 has supplanted version 1, this can go. */
2620 #define YYFAIL goto yyerrlab
2622 #define YYRECOVERING() (!!yyerrstatus)
2624 #define YYBACKUP(Token, Value) \
2626 if (yychar == YYEMPTY && yylen == 1) \
2630 yytoken = YYTRANSLATE (yychar); \
2636 yyerror (YY_("syntax error: cannot back up")); \
2643 #define YYERRCODE 256
2646 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2647 If N is 0, then set CURRENT to the empty location which ends
2648 the previous symbol: RHS[0] (always defined). */
2650 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2651 #ifndef YYLLOC_DEFAULT
2652 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2656 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2657 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2658 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2659 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2663 (Current).first_line = (Current).last_line = \
2664 YYRHSLOC (Rhs, 0).last_line; \
2665 (Current).first_column = (Current).last_column = \
2666 YYRHSLOC (Rhs, 0).last_column; \
2672 /* YY_LOCATION_PRINT -- Print the location on the stream.
2673 This macro was not mandated originally: define only if we know
2674 we won't break user code: when these are the locations we know. */
2676 #ifndef YY_LOCATION_PRINT
2677 # if YYLTYPE_IS_TRIVIAL
2678 # define YY_LOCATION_PRINT(File, Loc) \
2679 fprintf (File, "%d.%d-%d.%d", \
2680 (Loc).first_line, (Loc).first_column, \
2681 (Loc).last_line, (Loc).last_column)
2683 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2688 /* YYLEX -- calling `yylex' with the right arguments. */
2691 # define YYLEX yylex (YYLEX_PARAM)
2693 # define YYLEX yylex ()
2696 /* Enable debugging if requested. */
2700 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2701 # define YYFPRINTF fprintf
2704 # define YYDPRINTF(Args) \
2710 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2714 YYFPRINTF (stderr, "%s ", Title); \
2715 yy_symbol_print (stderr, \
2717 YYFPRINTF (stderr, "\n"); \
2722 /*--------------------------------.
2723 | Print this symbol on YYOUTPUT. |
2724 `--------------------------------*/
2727 #if (defined __STDC__ || defined __C99__FUNC__ \
2728 || defined __cplusplus || defined _MSC_VER)
2730 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2733 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2736 YYSTYPE const * const yyvaluep;
2742 if (yytype < YYNTOKENS)
2743 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2755 /*--------------------------------.
2756 | Print this symbol on YYOUTPUT. |
2757 `--------------------------------*/
2759 #if (defined __STDC__ || defined __C99__FUNC__ \
2760 || defined __cplusplus || defined _MSC_VER)
2762 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2765 yy_symbol_print (yyoutput, yytype, yyvaluep)
2768 YYSTYPE const * const yyvaluep;
2771 if (yytype < YYNTOKENS)
2772 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2774 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2776 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2777 YYFPRINTF (yyoutput, ")");
2780 /*------------------------------------------------------------------.
2781 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2783 `------------------------------------------------------------------*/
2785 #if (defined __STDC__ || defined __C99__FUNC__ \
2786 || defined __cplusplus || defined _MSC_VER)
2788 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2791 yy_stack_print (bottom, top)
2792 yytype_int16 *bottom;
2796 YYFPRINTF (stderr, "Stack now");
2797 for (; bottom <= top; ++bottom)
2798 YYFPRINTF (stderr, " %d", *bottom);
2799 YYFPRINTF (stderr, "\n");
2802 # define YY_STACK_PRINT(Bottom, Top) \
2805 yy_stack_print ((Bottom), (Top)); \
2809 /*------------------------------------------------.
2810 | Report that the YYRULE is going to be reduced. |
2811 `------------------------------------------------*/
2813 #if (defined __STDC__ || defined __C99__FUNC__ \
2814 || defined __cplusplus || defined _MSC_VER)
2816 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2819 yy_reduce_print (yyvsp, yyrule)
2824 int yynrhs = yyr2[yyrule];
2826 unsigned long int yylno = yyrline[yyrule];
2827 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2829 /* The symbols being reduced. */
2830 for (yyi = 0; yyi < yynrhs; yyi++)
2832 fprintf (stderr, " $%d = ", yyi + 1);
2833 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2834 &(yyvsp[(yyi + 1) - (yynrhs)])
2836 fprintf (stderr, "\n");
2840 # define YY_REDUCE_PRINT(Rule) \
2843 yy_reduce_print (yyvsp, Rule); \
2846 /* Nonzero means print parse trace. It is left uninitialized so that
2847 multiple parsers can coexist. */
2849 #else /* !YYDEBUG */
2850 # define YYDPRINTF(Args)
2851 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2852 # define YY_STACK_PRINT(Bottom, Top)
2853 # define YY_REDUCE_PRINT(Rule)
2854 #endif /* !YYDEBUG */
2857 /* YYINITDEPTH -- initial size of the parser's stacks. */
2859 # define YYINITDEPTH 200
2862 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2863 if the built-in stack extension method is used).
2865 Do not make this value too large; the results are undefined if
2866 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2867 evaluated with infinite-precision integer arithmetic. */
2870 # define YYMAXDEPTH 10000
2878 # if defined __GLIBC__ && defined _STRING_H
2879 # define yystrlen strlen
2881 /* Return the length of YYSTR. */
2882 #if (defined __STDC__ || defined __C99__FUNC__ \
2883 || defined __cplusplus || defined _MSC_VER)
2885 yystrlen (const char *yystr)
2893 for (yylen = 0; yystr[yylen]; yylen++)
2901 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2902 # define yystpcpy stpcpy
2904 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2906 #if (defined __STDC__ || defined __C99__FUNC__ \
2907 || defined __cplusplus || defined _MSC_VER)
2909 yystpcpy (char *yydest, const char *yysrc)
2912 yystpcpy (yydest, yysrc)
2918 const char *yys = yysrc;
2920 while ((*yyd++ = *yys++) != '\0')
2929 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2930 quotes and backslashes, so that it's suitable for yyerror. The
2931 heuristic is that double-quoting is unnecessary unless the string
2932 contains an apostrophe, a comma, or backslash (other than
2933 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2934 null, do not copy; instead, return the length of what the result
2937 yytnamerr (char *yyres, const char *yystr)
2942 char const *yyp = yystr;
2949 goto do_not_strip_quotes;
2953 goto do_not_strip_quotes;
2966 do_not_strip_quotes: ;
2970 return yystrlen (yystr);
2972 return yystpcpy (yyres, yystr) - yyres;
2976 /* Copy into YYRESULT an error message about the unexpected token
2977 YYCHAR while in state YYSTATE. Return the number of bytes copied,
2978 including the terminating null byte. If YYRESULT is null, do not
2979 copy anything; just return the number of bytes that would be
2980 copied. As a special case, return 0 if an ordinary "syntax error"
2981 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
2982 size calculation. */
2984 yysyntax_error (char *yyresult, int yystate, int yychar)
2986 int yyn = yypact[yystate];
2988 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
2992 int yytype = YYTRANSLATE (yychar);
2993 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2994 YYSIZE_T yysize = yysize0;
2996 int yysize_overflow = 0;
2997 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2998 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3002 /* This is so xgettext sees the translatable formats that are
3003 constructed on the fly. */
3004 YY_("syntax error, unexpected %s");
3005 YY_("syntax error, unexpected %s, expecting %s");
3006 YY_("syntax error, unexpected %s, expecting %s or %s");
3007 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3008 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3012 static char const yyunexpected[] = "syntax error, unexpected %s";
3013 static char const yyexpecting[] = ", expecting %s";
3014 static char const yyor[] = " or %s";
3015 char yyformat[sizeof yyunexpected
3016 + sizeof yyexpecting - 1
3017 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3018 * (sizeof yyor - 1))];
3019 char const *yyprefix = yyexpecting;
3021 /* Start YYX at -YYN if negative to avoid negative indexes in
3023 int yyxbegin = yyn < 0 ? -yyn : 0;
3025 /* Stay within bounds of both yycheck and yytname. */
3026 int yychecklim = YYLAST - yyn + 1;
3027 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3030 yyarg[0] = yytname[yytype];
3031 yyfmt = yystpcpy (yyformat, yyunexpected);
3033 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3034 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3036 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3040 yyformat[sizeof yyunexpected - 1] = '\0';
3043 yyarg[yycount++] = yytname[yyx];
3044 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3045 yysize_overflow |= (yysize1 < yysize);
3047 yyfmt = yystpcpy (yyfmt, yyprefix);
3051 yyf = YY_(yyformat);
3052 yysize1 = yysize + yystrlen (yyf);
3053 yysize_overflow |= (yysize1 < yysize);
3056 if (yysize_overflow)
3057 return YYSIZE_MAXIMUM;
3061 /* Avoid sprintf, as that infringes on the user's name space.
3062 Don't have undefined behavior even if the translation
3063 produced a string with the wrong number of "%s"s. */
3064 char *yyp = yyresult;
3066 while ((*yyp = *yyf) != '\0')
3068 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3070 yyp += yytnamerr (yyp, yyarg[yyi++]);
3083 #endif /* YYERROR_VERBOSE */
3086 /*-----------------------------------------------.
3087 | Release the memory associated to this symbol. |
3088 `-----------------------------------------------*/
3091 #if (defined __STDC__ || defined __C99__FUNC__ \
3092 || defined __cplusplus || defined _MSC_VER)
3094 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3097 yydestruct (yymsg, yytype, yyvaluep)
3107 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3118 /* Prevent warnings from -Wmissing-prototypes. */
3120 #ifdef YYPARSE_PARAM
3121 #if defined __STDC__ || defined __cplusplus
3122 int yyparse (void *YYPARSE_PARAM);
3126 #else /* ! YYPARSE_PARAM */
3127 #if defined __STDC__ || defined __cplusplus
3132 #endif /* ! YYPARSE_PARAM */
3136 /* The look-ahead symbol. */
3139 /* The semantic value of the look-ahead symbol. */
3142 /* Number of syntax errors so far. */
3151 #ifdef YYPARSE_PARAM
3152 #if (defined __STDC__ || defined __C99__FUNC__ \
3153 || defined __cplusplus || defined _MSC_VER)
3155 yyparse (void *YYPARSE_PARAM)
3158 yyparse (YYPARSE_PARAM)
3159 void *YYPARSE_PARAM;
3161 #else /* ! YYPARSE_PARAM */
3162 #if (defined __STDC__ || defined __C99__FUNC__ \
3163 || defined __cplusplus || defined _MSC_VER)
3177 /* Number of tokens to shift before error messages enabled. */
3179 /* Look-ahead token as an internal (translated) token number. */
3182 /* Buffer for error messages, and its allocated size. */
3184 char *yymsg = yymsgbuf;
3185 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3188 /* Three stacks and their tools:
3189 `yyss': related to states,
3190 `yyvs': related to semantic values,
3191 `yyls': related to locations.
3193 Refer to the stacks thru separate pointers, to allow yyoverflow
3194 to reallocate them elsewhere. */
3196 /* The state stack. */
3197 yytype_int16 yyssa[YYINITDEPTH];
3198 yytype_int16 *yyss = yyssa;
3199 yytype_int16 *yyssp;
3201 /* The semantic value stack. */
3202 YYSTYPE yyvsa[YYINITDEPTH];
3203 YYSTYPE *yyvs = yyvsa;
3208 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3210 YYSIZE_T yystacksize = YYINITDEPTH;
3212 /* The variables used to return semantic value and location from the
3217 /* The number of symbols on the RHS of the reduced rule.
3218 Keep to zero when no symbol should be popped. */
3221 YYDPRINTF ((stderr, "Starting parse\n"));
3226 yychar = YYEMPTY; /* Cause a token to be read. */
3228 /* Initialize stack pointers.
3229 Waste one element of value and location stack
3230 so that they stay on the same level as the state stack.
3231 The wasted elements are never initialized. */
3238 /*------------------------------------------------------------.
3239 | yynewstate -- Push a new state, which is found in yystate. |
3240 `------------------------------------------------------------*/
3242 /* In all cases, when you get here, the value and location stacks
3243 have just been pushed. So pushing a state here evens the stacks. */
3249 if (yyss + yystacksize - 1 <= yyssp)
3251 /* Get the current used size of the three stacks, in elements. */
3252 YYSIZE_T yysize = yyssp - yyss + 1;
3256 /* Give user a chance to reallocate the stack. Use copies of
3257 these so that the &'s don't force the real ones into
3259 YYSTYPE *yyvs1 = yyvs;
3260 yytype_int16 *yyss1 = yyss;
3263 /* Each stack pointer address is followed by the size of the
3264 data in use in that stack, in bytes. This used to be a
3265 conditional around just the two extra args, but that might
3266 be undefined if yyoverflow is a macro. */
3267 yyoverflow (YY_("memory exhausted"),
3268 &yyss1, yysize * sizeof (*yyssp),
3269 &yyvs1, yysize * sizeof (*yyvsp),
3276 #else /* no yyoverflow */
3277 # ifndef YYSTACK_RELOCATE
3278 goto yyexhaustedlab;
3280 /* Extend the stack our own way. */
3281 if (YYMAXDEPTH <= yystacksize)
3282 goto yyexhaustedlab;
3284 if (YYMAXDEPTH < yystacksize)
3285 yystacksize = YYMAXDEPTH;
3288 yytype_int16 *yyss1 = yyss;
3289 union yyalloc *yyptr =
3290 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3292 goto yyexhaustedlab;
3293 YYSTACK_RELOCATE (yyss);
3294 YYSTACK_RELOCATE (yyvs);
3296 # undef YYSTACK_RELOCATE
3298 YYSTACK_FREE (yyss1);
3301 #endif /* no yyoverflow */
3303 yyssp = yyss + yysize - 1;
3304 yyvsp = yyvs + yysize - 1;
3307 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3308 (unsigned long int) yystacksize));
3310 if (yyss + yystacksize - 1 <= yyssp)
3314 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3323 /* Do appropriate processing given the current state. Read a
3324 look-ahead token if we need one and don't already have one. */
3326 /* First try to decide what to do without reference to look-ahead token. */
3327 yyn = yypact[yystate];
3328 if (yyn == YYPACT_NINF)
3331 /* Not known => get a look-ahead token if don't already have one. */
3333 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3334 if (yychar == YYEMPTY)
3336 YYDPRINTF ((stderr, "Reading a token: "));
3340 if (yychar <= YYEOF)
3342 yychar = yytoken = YYEOF;
3343 YYDPRINTF ((stderr, "Now at end of input.\n"));
3347 yytoken = YYTRANSLATE (yychar);
3348 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3351 /* If the proper action on seeing token YYTOKEN is to reduce or to
3352 detect an error, take that action. */
3354 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3359 if (yyn == 0 || yyn == YYTABLE_NINF)
3368 /* Count tokens shifted since error; after three, turn off error
3373 /* Shift the look-ahead token. */
3374 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3376 /* Discard the shifted token unless it is eof. */
3377 if (yychar != YYEOF)
3386 /*-----------------------------------------------------------.
3387 | yydefault -- do the default action for the current state. |
3388 `-----------------------------------------------------------*/
3390 yyn = yydefact[yystate];
3396 /*-----------------------------.
3397 | yyreduce -- Do a reduction. |
3398 `-----------------------------*/
3400 /* yyn is the number of a rule to reduce with. */
3403 /* If YYLEN is nonzero, implement the default value of the action:
3406 Otherwise, the following line sets YYVAL to garbage.
3407 This behavior is undocumented and Bison
3408 users should not rely upon it. Assigning to YYVAL
3409 unconditionally makes the parser a bit smaller, and it avoids a
3410 GCC warning that YYVAL may be used uninitialized. */
3411 yyval = yyvsp[1-yylen];
3414 YY_REDUCE_PRINT (yyn);
3418 #line 1111 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3419 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3423 #line 1111 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3424 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3428 #line 1112 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3429 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3433 #line 1112 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3434 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3438 #line 1113 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3439 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3443 #line 1113 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3444 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3448 #line 1114 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3449 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3453 #line 1114 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3454 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3458 #line 1115 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3459 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3463 #line 1115 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3464 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3468 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3469 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3473 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3474 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3478 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3479 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3483 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3484 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3488 #line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3489 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3493 #line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3494 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3498 #line 1122 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3499 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3503 #line 1122 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3504 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3508 #line 1123 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3509 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3513 #line 1123 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3514 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3518 #line 1124 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3519 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3523 #line 1124 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3524 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3528 #line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3529 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3533 #line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3534 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3538 #line 1126 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3539 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3543 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3544 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3548 #line 1136 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3549 { (yyval.StrVal) = 0; ;}
3553 #line 1140 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3555 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3561 #line 1144 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3569 #line 1152 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3577 #line 1157 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3579 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3585 #line 1163 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3586 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3590 #line 1164 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3591 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3595 #line 1165 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3596 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3600 #line 1166 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3601 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3605 #line 1167 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3606 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3610 #line 1171 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3611 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3615 #line 1172 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3616 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3620 #line 1173 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3621 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3625 #line 1177 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3626 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3630 #line 1178 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3631 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3635 #line 1179 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3636 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3640 #line 1180 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3641 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3645 #line 1184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3646 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3650 #line 1185 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3651 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3655 #line 1186 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3656 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3660 #line 1190 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3661 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3665 #line 1191 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3666 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3670 #line 1192 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3671 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3675 #line 1193 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3676 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3680 #line 1194 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3681 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3685 #line 1198 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3686 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3690 #line 1199 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3691 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3695 #line 1200 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3696 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3700 #line 1203 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3701 { (yyval.UIntVal) = CallingConv::C; ;}
3705 #line 1204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3706 { (yyval.UIntVal) = CallingConv::C; ;}
3710 #line 1205 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3711 { (yyval.UIntVal) = CallingConv::Fast; ;}
3715 #line 1206 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3716 { (yyval.UIntVal) = CallingConv::Cold; ;}
3720 #line 1207 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3721 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3725 #line 1208 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3726 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3730 #line 1209 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3732 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3733 GEN_ERROR("Calling conv too large");
3734 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3740 #line 1216 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3741 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3745 #line 1217 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3746 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3750 #line 1218 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3751 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3755 #line 1219 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3756 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3760 #line 1220 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3761 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3765 #line 1221 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3766 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3770 #line 1222 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3771 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3775 #line 1223 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3776 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3780 #line 1224 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3781 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3785 #line 1227 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3786 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3790 #line 1228 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3792 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3797 #line 1233 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3798 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3802 #line 1234 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3803 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3807 #line 1235 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3808 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3812 #line 1236 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3813 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3817 #line 1237 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3818 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3822 #line 1238 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3823 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3827 #line 1241 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3828 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3832 #line 1242 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3834 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3839 #line 1249 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3840 { (yyval.UIntVal) = 0; ;}
3844 #line 1250 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3846 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3847 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3848 GEN_ERROR("Alignment must be a power of two");
3854 #line 1256 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3855 { (yyval.UIntVal) = 0; ;}
3859 #line 1257 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3861 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3862 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3863 GEN_ERROR("Alignment must be a power of two");
3869 #line 1265 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3871 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3872 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3873 GEN_ERROR("Invalid character in section name");
3874 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3880 #line 1273 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3881 { (yyval.StrVal) = 0; ;}
3885 #line 1274 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3886 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3890 #line 1279 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3895 #line 1280 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3900 #line 1281 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3902 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3903 delete (yyvsp[(1) - (1)].StrVal);
3909 #line 1286 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3911 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3912 GEN_ERROR("Alignment must be a power of two");
3913 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3919 #line 1302 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3921 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3927 #line 1306 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3929 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
3935 #line 1310 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3937 if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
3938 GEN_ERROR("Cannot form a pointer to a basic block");
3939 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
3940 delete (yyvsp[(1) - (2)].TypeVal);
3946 #line 1317 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3947 { // Named types are also simple types...
3948 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
3950 (yyval.TypeVal) = new PATypeHolder(tmp);
3955 #line 1322 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3956 { // Type UpReference
3957 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3958 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3959 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
3960 (yyval.TypeVal) = new PATypeHolder(OT);
3961 UR_OUT("New Upreference!\n");
3967 #line 1330 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3969 // Allow but ignore attributes on function types; this permits auto-upgrade.
3970 // FIXME: remove in LLVM 3.0.
3971 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
3972 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
3973 isa<OpaqueType>(RetTy)))
3974 GEN_ERROR("LLVM Functions cannot return aggregates");
3976 std::vector<const Type*> Params;
3977 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
3978 for (; I != E; ++I ) {
3979 const Type *Ty = I->Ty->get();
3980 Params.push_back(Ty);
3983 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3984 if (isVarArg) Params.pop_back();
3986 for (unsigned i = 0; i != Params.size(); ++i)
3987 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
3988 GEN_ERROR("Function arguments must be value types!");
3992 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
3993 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3994 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
3995 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4001 #line 1360 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4003 // Allow but ignore attributes on function types; this permits auto-upgrade.
4004 // FIXME: remove in LLVM 3.0.
4005 std::vector<const Type*> Params;
4006 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4007 for ( ; I != E; ++I ) {
4008 const Type* Ty = I->Ty->get();
4009 Params.push_back(Ty);
4012 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4013 if (isVarArg) Params.pop_back();
4015 for (unsigned i = 0; i != Params.size(); ++i)
4016 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4017 GEN_ERROR("Function arguments must be value types!");
4021 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4022 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4023 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4029 #line 1385 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4030 { // Sized array type?
4031 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4032 delete (yyvsp[(4) - (5)].TypeVal);
4038 #line 1390 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4040 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4041 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4042 GEN_ERROR("Unsigned result not equal to signed result");
4043 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4044 GEN_ERROR("Element type of a VectorType must be primitive");
4045 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4046 delete (yyvsp[(4) - (5)].TypeVal);
4052 #line 1400 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4053 { // Structure type?
4054 std::vector<const Type*> Elements;
4055 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4056 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4057 Elements.push_back(*I);
4059 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4060 delete (yyvsp[(2) - (3)].TypeList);
4066 #line 1410 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4067 { // Empty structure type?
4068 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4074 #line 1414 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4076 std::vector<const Type*> Elements;
4077 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4078 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4079 Elements.push_back(*I);
4081 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4082 delete (yyvsp[(3) - (5)].TypeList);
4088 #line 1424 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4089 { // Empty structure type?
4090 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4096 #line 1431 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4098 // Allow but ignore attributes on function types; this permits auto-upgrade.
4099 // FIXME: remove in LLVM 3.0.
4100 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4101 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4106 #line 1440 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4108 if (!UpRefs.empty())
4109 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4110 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
4111 GEN_ERROR("LLVM functions cannot return aggregate types");
4112 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4117 #line 1447 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4119 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4124 #line 1452 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4126 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4127 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4133 #line 1457 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4135 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4141 #line 1465 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4143 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4144 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4145 TWA.Ty = new PATypeHolder(Type::VoidTy);
4146 (yyval.TypeWithAttrsList)->push_back(TWA);
4152 #line 1472 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4154 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4155 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4156 TWA.Ty = new PATypeHolder(Type::VoidTy);
4157 (yyval.TypeWithAttrsList)->push_back(TWA);
4163 #line 1479 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4165 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4171 #line 1487 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4173 (yyval.TypeList) = new std::list<PATypeHolder>();
4174 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4175 delete (yyvsp[(1) - (1)].TypeVal);
4181 #line 1493 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4183 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4184 delete (yyvsp[(3) - (3)].TypeVal);
4190 #line 1505 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4191 { // Nonempty unsized arr
4192 if (!UpRefs.empty())
4193 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4194 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4196 GEN_ERROR("Cannot make array constant with type: '" +
4197 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4198 const Type *ETy = ATy->getElementType();
4199 int NumElements = ATy->getNumElements();
4201 // Verify that we have the correct size...
4202 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4203 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4204 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4205 itostr(NumElements) + "");
4207 // Verify all elements are correct type!
4208 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4209 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4210 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4211 ETy->getDescription() +"' as required!\nIt is of type '"+
4212 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4215 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4216 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4222 #line 1533 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4224 if (!UpRefs.empty())
4225 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4226 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4228 GEN_ERROR("Cannot make array constant with type: '" +
4229 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4231 int NumElements = ATy->getNumElements();
4232 if (NumElements != -1 && NumElements != 0)
4233 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4234 " arguments, but has size of " + itostr(NumElements) +"");
4235 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4236 delete (yyvsp[(1) - (3)].TypeVal);
4242 #line 1549 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4244 if (!UpRefs.empty())
4245 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4246 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4248 GEN_ERROR("Cannot make array constant with type: '" +
4249 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4251 int NumElements = ATy->getNumElements();
4252 const Type *ETy = ATy->getElementType();
4253 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4254 GEN_ERROR("Can't build string constant of size " +
4255 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4256 " when array has size " + itostr(NumElements) + "");
4257 std::vector<Constant*> Vals;
4258 if (ETy == Type::Int8Ty) {
4259 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4260 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4262 delete (yyvsp[(3) - (3)].StrVal);
4263 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4265 delete (yyvsp[(3) - (3)].StrVal);
4266 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4267 delete (yyvsp[(1) - (3)].TypeVal);
4273 #line 1576 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4274 { // Nonempty unsized arr
4275 if (!UpRefs.empty())
4276 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4277 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4279 GEN_ERROR("Cannot make packed constant with type: '" +
4280 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4281 const Type *ETy = PTy->getElementType();
4282 int NumElements = PTy->getNumElements();
4284 // Verify that we have the correct size...
4285 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4286 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4287 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4288 itostr(NumElements) + "");
4290 // Verify all elements are correct type!
4291 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4292 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4293 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4294 ETy->getDescription() +"' as required!\nIt is of type '"+
4295 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4298 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4299 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4305 #line 1604 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4307 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4309 GEN_ERROR("Cannot make struct constant with type: '" +
4310 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4312 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4313 GEN_ERROR("Illegal number of initializers for structure type");
4315 // Check to ensure that constants are compatible with the type initializer!
4316 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4317 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4318 GEN_ERROR("Expected type '" +
4319 STy->getElementType(i)->getDescription() +
4320 "' for element #" + utostr(i) +
4321 " of structure initializer");
4323 // Check to ensure that Type is not packed
4324 if (STy->isPacked())
4325 GEN_ERROR("Unpacked Initializer to vector type '" +
4326 STy->getDescription() + "'");
4328 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4329 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4335 #line 1630 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4337 if (!UpRefs.empty())
4338 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4339 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4341 GEN_ERROR("Cannot make struct constant with type: '" +
4342 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4344 if (STy->getNumContainedTypes() != 0)
4345 GEN_ERROR("Illegal number of initializers for structure type");
4347 // Check to ensure that Type is not packed
4348 if (STy->isPacked())
4349 GEN_ERROR("Unpacked Initializer to vector type '" +
4350 STy->getDescription() + "'");
4352 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4353 delete (yyvsp[(1) - (3)].TypeVal);
4359 #line 1650 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4361 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4363 GEN_ERROR("Cannot make struct constant with type: '" +
4364 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4366 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4367 GEN_ERROR("Illegal number of initializers for structure type");
4369 // Check to ensure that constants are compatible with the type initializer!
4370 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4371 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4372 GEN_ERROR("Expected type '" +
4373 STy->getElementType(i)->getDescription() +
4374 "' for element #" + utostr(i) +
4375 " of structure initializer");
4377 // Check to ensure that Type is packed
4378 if (!STy->isPacked())
4379 GEN_ERROR("Vector initializer to non-vector type '" +
4380 STy->getDescription() + "'");
4382 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4383 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4389 #line 1676 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4391 if (!UpRefs.empty())
4392 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4393 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4395 GEN_ERROR("Cannot make struct constant with type: '" +
4396 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4398 if (STy->getNumContainedTypes() != 0)
4399 GEN_ERROR("Illegal number of initializers for structure type");
4401 // Check to ensure that Type is packed
4402 if (!STy->isPacked())
4403 GEN_ERROR("Vector initializer to non-vector type '" +
4404 STy->getDescription() + "'");
4406 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4407 delete (yyvsp[(1) - (5)].TypeVal);
4413 #line 1696 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4415 if (!UpRefs.empty())
4416 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4417 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4419 GEN_ERROR("Cannot make null pointer constant with type: '" +
4420 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4422 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4423 delete (yyvsp[(1) - (2)].TypeVal);
4429 #line 1708 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4431 if (!UpRefs.empty())
4432 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4433 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4434 delete (yyvsp[(1) - (2)].TypeVal);
4440 #line 1715 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4442 if (!UpRefs.empty())
4443 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4444 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4446 GEN_ERROR("Global const reference must be a pointer type");
4448 // ConstExprs can exist in the body of a function, thus creating
4449 // GlobalValues whenever they refer to a variable. Because we are in
4450 // the context of a function, getExistingVal will search the functions
4451 // symbol table instead of the module symbol table for the global symbol,
4452 // which throws things all off. To get around this, we just tell
4453 // getExistingVal that we are at global scope here.
4455 Function *SavedCurFn = CurFun.CurrentFunction;
4456 CurFun.CurrentFunction = 0;
4458 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4461 CurFun.CurrentFunction = SavedCurFn;
4463 // If this is an initializer for a constant pointer, which is referencing a
4464 // (currently) undefined variable, create a stub now that shall be replaced
4465 // in the future with the right type of variable.
4468 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4469 const PointerType *PT = cast<PointerType>(Ty);
4471 // First check to see if the forward references value is already created!
4472 PerModuleInfo::GlobalRefsType::iterator I =
4473 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4475 if (I != CurModule.GlobalRefs.end()) {
4476 V = I->second; // Placeholder already exists, use it...
4477 (yyvsp[(2) - (2)].ValIDVal).destroy();
4480 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4481 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4482 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4483 GEN_ERROR("Invalid reference to global");
4485 // Create the forward referenced global.
4487 if (const FunctionType *FTy =
4488 dyn_cast<FunctionType>(PT->getElementType())) {
4489 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4490 CurModule.CurrentModule);
4492 GV = new GlobalVariable(PT->getElementType(), false,
4493 GlobalValue::ExternalWeakLinkage, 0,
4494 Name, CurModule.CurrentModule);
4497 // Keep track of the fact that we have a forward ref to recycle it
4498 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4503 (yyval.ConstVal) = cast<GlobalValue>(V);
4504 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4510 #line 1781 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4512 if (!UpRefs.empty())
4513 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4514 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4515 GEN_ERROR("Mismatched types for constant expression: " +
4516 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4517 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4518 delete (yyvsp[(1) - (2)].TypeVal);
4524 #line 1791 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4526 if (!UpRefs.empty())
4527 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4528 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4529 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4530 GEN_ERROR("Cannot create a null initialized value of this type");
4531 (yyval.ConstVal) = Constant::getNullValue(Ty);
4532 delete (yyvsp[(1) - (2)].TypeVal);
4538 #line 1801 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4539 { // integral constants
4540 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4541 GEN_ERROR("Constant value doesn't fit in type");
4542 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4548 #line 1807 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4549 { // arbitrary precision integer constants
4550 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4551 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4552 GEN_ERROR("Constant value does not fit in type");
4554 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4555 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4556 delete (yyvsp[(2) - (2)].APIntVal);
4562 #line 1817 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4563 { // integral constants
4564 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4565 GEN_ERROR("Constant value doesn't fit in type");
4566 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4572 #line 1823 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4573 { // arbitrary precision integer constants
4574 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4575 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4576 GEN_ERROR("Constant value does not fit in type");
4578 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4579 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4580 delete (yyvsp[(2) - (2)].APIntVal);
4586 #line 1833 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4587 { // Boolean constants
4588 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4589 (yyval.ConstVal) = ConstantInt::getTrue();
4595 #line 1838 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4596 { // Boolean constants
4597 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4598 (yyval.ConstVal) = ConstantInt::getFalse();
4604 #line 1843 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4605 { // Floating point constants
4606 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4607 GEN_ERROR("Floating point constant invalid for type");
4608 // Lexer has no type info, so builds all float and double FP constants
4609 // as double. Fix this here. Long double is done right.
4610 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4611 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4612 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4613 delete (yyvsp[(2) - (2)].FPVal);
4619 #line 1856 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4621 if (!UpRefs.empty())
4622 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4623 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4624 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4625 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4626 GEN_ERROR("invalid cast opcode for cast from '" +
4627 Val->getType()->getDescription() + "' to '" +
4628 DestTy->getDescription() + "'");
4629 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4630 delete (yyvsp[(5) - (6)].TypeVal);
4635 #line 1868 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4637 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4638 GEN_ERROR("GetElementPtr requires a pointer operand");
4641 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4644 GEN_ERROR("Index list invalid for constant getelementptr");
4646 SmallVector<Constant*, 8> IdxVec;
4647 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4648 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4649 IdxVec.push_back(C);
4651 GEN_ERROR("Indices to constant getelementptr must be constants");
4653 delete (yyvsp[(4) - (5)].ValueList);
4655 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4661 #line 1890 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4663 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4664 GEN_ERROR("Select condition must be of boolean type");
4665 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4666 GEN_ERROR("Select operand types must match");
4667 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4673 #line 1898 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4675 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4676 GEN_ERROR("Binary operator types must match");
4678 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4683 #line 1904 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4685 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4686 GEN_ERROR("Logical operator types must match");
4687 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4688 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4689 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4690 GEN_ERROR("Logical operator requires integral operands");
4692 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4698 #line 1915 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4700 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4701 GEN_ERROR("icmp operand types must match");
4702 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4707 #line 1920 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4709 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4710 GEN_ERROR("fcmp operand types must match");
4711 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4716 #line 1925 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4718 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4719 GEN_ERROR("Invalid extractelement operands");
4720 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4726 #line 1931 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4728 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4729 GEN_ERROR("Invalid insertelement operands");
4730 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4736 #line 1937 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4738 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4739 GEN_ERROR("Invalid shufflevector operands");
4740 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4746 #line 1946 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4748 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4754 #line 1950 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4756 (yyval.ConstVector) = new std::vector<Constant*>();
4757 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4763 #line 1958 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4764 { (yyval.BoolVal) = false; ;}
4768 #line 1958 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4769 { (yyval.BoolVal) = true; ;}
4773 #line 1961 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4774 { (yyval.BoolVal) = true; ;}
4778 #line 1961 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4779 { (yyval.BoolVal) = false; ;}
4783 #line 1964 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4785 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4786 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4788 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4790 GEN_ERROR("Aliases can be created only to global values");
4792 (yyval.ConstVal) = Aliasee;
4794 delete (yyvsp[(1) - (2)].TypeVal);
4799 #line 1976 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4801 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4802 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4803 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4804 GEN_ERROR("invalid cast opcode for cast from '" +
4805 Val->getType()->getDescription() + "' to '" +
4806 DestTy->getDescription() + "'");
4808 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4810 delete (yyvsp[(5) - (6)].TypeVal);
4815 #line 1997 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4817 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4818 CurModule.ModuleDone();
4824 #line 2002 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4826 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4827 CurModule.ModuleDone();
4833 #line 2015 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4834 { CurFun.isDeclare = false; ;}
4838 #line 2015 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4840 CurFun.FunctionDone();
4846 #line 2019 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4847 { CurFun.isDeclare = true; ;}
4851 #line 2019 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4858 #line 2022 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4865 #line 2025 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4867 if (!UpRefs.empty())
4868 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4869 // Eagerly resolve types. This is not an optimization, this is a
4870 // requirement that is due to the fact that we could have this:
4872 // %list = type { %list * }
4873 // %list = type { %list * } ; repeated type decl
4875 // If types are not resolved eagerly, then the two types will not be
4876 // determined to be the same type!
4878 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4880 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4882 // If this is a named type that is not a redefinition, add it to the slot
4884 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4887 delete (yyvsp[(3) - (3)].TypeVal);
4893 #line 2049 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4895 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4897 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4899 // If this is a named type that is not a redefinition, add it to the slot
4901 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4908 #line 2060 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4910 /* "Externally Visible" Linkage */
4911 if ((yyvsp[(5) - (5)].ConstVal) == 0)
4912 GEN_ERROR("Global value initializer is not a constant");
4913 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), GlobalValue::ExternalLinkage,
4914 (yyvsp[(2) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal), (yyvsp[(3) - (5)].BoolVal));
4920 #line 2067 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4927 #line 2071 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4929 if ((yyvsp[(6) - (6)].ConstVal) == 0)
4930 GEN_ERROR("Global value initializer is not a constant");
4931 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), (yyvsp[(6) - (6)].ConstVal)->getType(), (yyvsp[(6) - (6)].ConstVal), (yyvsp[(4) - (6)].BoolVal));
4937 #line 2076 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4944 #line 2080 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4946 if (!UpRefs.empty())
4947 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription());
4948 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), *(yyvsp[(6) - (6)].TypeVal), 0, (yyvsp[(4) - (6)].BoolVal));
4950 delete (yyvsp[(6) - (6)].TypeVal);
4955 #line 2086 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4963 #line 2090 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4966 if ((yyvsp[(1) - (5)].StrVal)) {
4967 Name = *(yyvsp[(1) - (5)].StrVal);
4968 delete (yyvsp[(1) - (5)].StrVal);
4971 GEN_ERROR("Alias name cannot be empty");
4973 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
4975 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4977 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
4978 CurModule.CurrentModule);
4979 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
4980 InsertValue(GA, CurModule.Values);
4983 // If there was a forward reference of this alias, resolve it now.
4987 ID = ValID::createGlobalName(Name);
4989 ID = ValID::createGlobalID(CurModule.Values.size()-1);
4991 if (GlobalValue *FWGV =
4992 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
4993 // Replace uses of the fwdref with the actual alias.
4994 FWGV->replaceAllUsesWith(GA);
4995 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
4996 GV->eraseFromParent();
4998 cast<Function>(FWGV)->eraseFromParent();
5007 #line 2130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5014 #line 2133 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5021 #line 2139 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5023 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5024 if (AsmSoFar.empty())
5025 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5027 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5028 delete (yyvsp[(1) - (1)].StrVal);
5034 #line 2149 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5036 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5037 delete (yyvsp[(3) - (3)].StrVal);
5042 #line 2153 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5044 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5045 delete (yyvsp[(3) - (3)].StrVal);
5050 #line 2160 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5052 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5053 delete (yyvsp[(3) - (3)].StrVal);
5059 #line 2165 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5061 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5062 delete (yyvsp[(1) - (1)].StrVal);
5068 #line 2170 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5075 #line 2179 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5077 if (!UpRefs.empty())
5078 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5079 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5080 GEN_ERROR("void typed arguments are invalid");
5081 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5082 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5083 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5089 #line 2189 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5091 if (!UpRefs.empty())
5092 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5093 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5094 GEN_ERROR("void typed arguments are invalid");
5095 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5096 (yyval.ArgList) = new ArgListType;
5097 (yyval.ArgList)->push_back(E);
5103 #line 2200 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5105 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5111 #line 2204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5113 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5114 struct ArgListEntry E;
5115 E.Ty = new PATypeHolder(Type::VoidTy);
5117 E.Attrs = ParamAttr::None;
5118 (yyval.ArgList)->push_back(E);
5124 #line 2213 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5126 (yyval.ArgList) = new ArgListType;
5127 struct ArgListEntry E;
5128 E.Ty = new PATypeHolder(Type::VoidTy);
5130 E.Attrs = ParamAttr::None;
5131 (yyval.ArgList)->push_back(E);
5137 #line 2222 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5139 (yyval.ArgList) = 0;
5145 #line 2228 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5147 std::string FunctionName(*(yyvsp[(3) - (9)].StrVal));
5148 delete (yyvsp[(3) - (9)].StrVal); // Free strdup'd memory!
5150 // Check the function result for abstractness if this is a define. We should
5151 // have no abstract types at this point
5152 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (9)].TypeVal)))
5153 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (9)].TypeVal)->get()->getDescription());
5155 std::vector<const Type*> ParamTypeList;
5156 ParamAttrsVector Attrs;
5157 if ((yyvsp[(7) - (9)].ParamAttrs) != ParamAttr::None) {
5158 ParamAttrsWithIndex PAWI;
5160 PAWI.attrs = (yyvsp[(7) - (9)].ParamAttrs);
5161 Attrs.push_back(PAWI);
5163 if ((yyvsp[(5) - (9)].ArgList)) { // If there are arguments...
5165 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin(); I != (yyvsp[(5) - (9)].ArgList)->end(); ++I, ++index) {
5166 const Type* Ty = I->Ty->get();
5167 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5168 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5169 ParamTypeList.push_back(Ty);
5170 if (Ty != Type::VoidTy)
5171 if (I->Attrs != ParamAttr::None) {
5172 ParamAttrsWithIndex PAWI;
5174 PAWI.attrs = I->Attrs;
5175 Attrs.push_back(PAWI);
5180 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5181 if (isVarArg) ParamTypeList.pop_back();
5183 const ParamAttrsList *PAL = 0;
5185 PAL = ParamAttrsList::get(Attrs);
5187 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (9)].TypeVal), ParamTypeList, isVarArg);
5188 const PointerType *PFT = PointerType::get(FT);
5189 delete (yyvsp[(2) - (9)].TypeVal);
5192 if (!FunctionName.empty()) {
5193 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5195 ID = ValID::createGlobalID(CurModule.Values.size());
5199 // See if this function was forward referenced. If so, recycle the object.
5200 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5201 // Move the function to the end of the list, from whereever it was
5202 // previously inserted.
5203 Fn = cast<Function>(FWRef);
5204 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
5205 CurModule.CurrentModule->getFunctionList().remove(Fn);
5206 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5207 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5208 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5209 if (Fn->getFunctionType() != FT ) {
5210 // The existing function doesn't have the same type. This is an overload
5212 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5213 } else if (Fn->getParamAttrs() != PAL) {
5214 // The existing function doesn't have the same parameter attributes.
5215 // This is an overload error.
5216 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5217 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5218 // Neither the existing or the current function is a declaration and they
5219 // have the same name and same type. Clearly this is a redefinition.
5220 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5221 } else if (Fn->isDeclaration()) {
5222 // Make sure to strip off any argument names so we can't get conflicts.
5223 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5227 } else { // Not already defined?
5228 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5229 CurModule.CurrentModule);
5230 InsertValue(Fn, CurModule.Values);
5233 CurFun.FunctionStart(Fn);
5235 if (CurFun.isDeclare) {
5236 // If we have declaration, always overwrite linkage. This will allow us to
5237 // correctly handle cases, when pointer to function is passed as argument to
5238 // another function.
5239 Fn->setLinkage(CurFun.Linkage);
5240 Fn->setVisibility(CurFun.Visibility);
5242 Fn->setCallingConv((yyvsp[(1) - (9)].UIntVal));
5243 Fn->setParamAttrs(PAL);
5244 Fn->setAlignment((yyvsp[(9) - (9)].UIntVal));
5245 if ((yyvsp[(8) - (9)].StrVal)) {
5246 Fn->setSection(*(yyvsp[(8) - (9)].StrVal));
5247 delete (yyvsp[(8) - (9)].StrVal);
5250 // Add all of the arguments we parsed to the function...
5251 if ((yyvsp[(5) - (9)].ArgList)) { // Is null if empty...
5252 if (isVarArg) { // Nuke the last entry
5253 assert((yyvsp[(5) - (9)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (9)].ArgList)->back().Name == 0 &&
5254 "Not a varargs marker!");
5255 delete (yyvsp[(5) - (9)].ArgList)->back().Ty;
5256 (yyvsp[(5) - (9)].ArgList)->pop_back(); // Delete the last entry
5258 Function::arg_iterator ArgIt = Fn->arg_begin();
5259 Function::arg_iterator ArgEnd = Fn->arg_end();
5261 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin();
5262 I != (yyvsp[(5) - (9)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5263 delete I->Ty; // Delete the typeholder...
5264 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5270 delete (yyvsp[(5) - (9)].ArgList); // We're now done with the argument list
5277 #line 2359 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5279 (yyval.FunctionVal) = CurFun.CurrentFunction;
5281 // Make sure that we keep track of the linkage type even if there was a
5282 // previous "declare".
5283 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5284 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5289 #line 2370 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5291 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5297 #line 2375 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5299 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5300 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5301 (yyval.FunctionVal) = CurFun.CurrentFunction;
5302 CurFun.FunctionDone();
5308 #line 2387 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5310 (yyval.BoolVal) = false;
5316 #line 2391 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5318 (yyval.BoolVal) = true;
5324 #line 2396 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5325 { // A reference to a direct constant
5326 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5332 #line 2400 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5334 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5340 #line 2404 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5341 { // Perhaps it's an FP constant?
5342 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5348 #line 2408 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5350 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5356 #line 2412 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5358 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5364 #line 2416 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5366 (yyval.ValIDVal) = ValID::createNull();
5372 #line 2420 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5374 (yyval.ValIDVal) = ValID::createUndef();
5380 #line 2424 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5381 { // A vector zero constant.
5382 (yyval.ValIDVal) = ValID::createZeroInit();
5388 #line 2428 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5389 { // Nonempty unsized packed vector
5390 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5391 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5393 VectorType* pt = VectorType::get(ETy, NumElements);
5394 PATypeHolder* PTy = new PATypeHolder(
5402 // Verify all elements are correct type!
5403 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5404 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5405 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5406 ETy->getDescription() +"' as required!\nIt is of type '" +
5407 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5410 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5411 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5417 #line 2453 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5419 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5425 #line 2457 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5427 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5428 delete (yyvsp[(3) - (5)].StrVal);
5429 delete (yyvsp[(5) - (5)].StrVal);
5435 #line 2467 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5436 { // Is it an integer reference...?
5437 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5443 #line 2471 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5445 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5451 #line 2475 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5452 { // Is it a named reference...?
5453 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5454 delete (yyvsp[(1) - (1)].StrVal);
5460 #line 2480 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5461 { // Is it a named reference...?
5462 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5463 delete (yyvsp[(1) - (1)].StrVal);
5469 #line 2493 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5471 if (!UpRefs.empty())
5472 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5473 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5474 delete (yyvsp[(1) - (2)].TypeVal);
5480 #line 2502 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5482 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5488 #line 2506 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5489 { // Do not allow functions with 0 basic blocks
5490 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5496 #line 2515 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5498 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5500 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5501 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5502 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5508 #line 2524 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5510 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5511 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5512 if (CI2->getParent() == 0)
5513 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5514 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5515 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5521 #line 2533 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5522 { // Empty space between instruction lists
5523 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5529 #line 2537 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5530 { // Labelled (named) basic block
5531 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5532 delete (yyvsp[(1) - (1)].StrVal);
5539 #line 2544 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5540 { // Return with a result...
5541 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5547 #line 2548 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5548 { // Return with no result...
5549 (yyval.TermInstVal) = new ReturnInst();
5555 #line 2552 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5556 { // Unconditional Branch...
5557 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5559 (yyval.TermInstVal) = new BranchInst(tmpBB);
5564 #line 2557 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5566 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5567 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5569 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5571 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5573 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5578 #line 2567 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5580 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5582 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5584 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5585 (yyval.TermInstVal) = S;
5587 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5588 E = (yyvsp[(8) - (9)].JumpTable)->end();
5589 for (; I != E; ++I) {
5590 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5591 S->addCase(CI, I->second);
5593 GEN_ERROR("Switch case is constant, but not a simple integer");
5595 delete (yyvsp[(8) - (9)].JumpTable);
5601 #line 2586 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5603 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5605 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5607 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5608 (yyval.TermInstVal) = S;
5614 #line 2596 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5617 // Handle the short syntax
5618 const PointerType *PFTy = 0;
5619 const FunctionType *Ty = 0;
5620 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5621 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5622 // Pull out the types of all of the arguments...
5623 std::vector<const Type*> ParamTypes;
5624 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5625 for (; I != E; ++I) {
5626 const Type *Ty = I->Val->getType();
5627 if (Ty == Type::VoidTy)
5628 GEN_ERROR("Short call syntax cannot be used with varargs");
5629 ParamTypes.push_back(Ty);
5631 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5632 PFTy = PointerType::get(Ty);
5635 delete (yyvsp[(3) - (14)].TypeVal);
5637 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5639 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5641 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5644 ParamAttrsVector Attrs;
5645 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5646 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5647 Attrs.push_back(PAWI);
5650 // Check the arguments
5652 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5653 // Make sure no arguments is a good thing!
5654 if (Ty->getNumParams() != 0)
5655 GEN_ERROR("No arguments passed to a function that "
5656 "expects arguments");
5657 } else { // Has arguments?
5658 // Loop through FunctionType's arguments and ensure they are specified
5660 FunctionType::param_iterator I = Ty->param_begin();
5661 FunctionType::param_iterator E = Ty->param_end();
5662 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5665 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5666 if (ArgI->Val->getType() != *I)
5667 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5668 (*I)->getDescription() + "'");
5669 Args.push_back(ArgI->Val);
5670 if (ArgI->Attrs != ParamAttr::None) {
5671 ParamAttrsWithIndex PAWI;
5673 PAWI.attrs = ArgI->Attrs;
5674 Attrs.push_back(PAWI);
5678 if (Ty->isVarArg()) {
5680 for (; ArgI != ArgE; ++ArgI)
5681 Args.push_back(ArgI->Val); // push the remaining varargs
5682 } else if (I != E || ArgI != ArgE)
5683 GEN_ERROR("Invalid number of parameters detected");
5686 const ParamAttrsList *PAL = 0;
5688 PAL = ParamAttrsList::get(Attrs);
5690 // Create the InvokeInst
5691 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5692 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5693 II->setParamAttrs(PAL);
5694 (yyval.TermInstVal) = II;
5695 delete (yyvsp[(6) - (14)].ParamList);
5701 #line 2679 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5703 (yyval.TermInstVal) = new UnwindInst();
5709 #line 2683 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5711 (yyval.TermInstVal) = new UnreachableInst();
5717 #line 2690 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5719 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5720 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5723 GEN_ERROR("May only switch on a constant pool value");
5725 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5727 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5732 #line 2701 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5734 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5735 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5739 GEN_ERROR("May only switch on a constant pool value");
5741 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5743 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5748 #line 2714 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5750 // Is this definition named?? if so, assign the name...
5751 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5753 InsertValue((yyvsp[(2) - (2)].InstVal));
5754 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5760 #line 2724 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5761 { // Used for PHI nodes
5762 if (!UpRefs.empty())
5763 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5764 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5765 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5767 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5769 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5770 delete (yyvsp[(1) - (6)].TypeVal);
5775 #line 2735 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5777 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5778 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5780 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5782 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5787 #line 2745 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5789 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5790 if (!UpRefs.empty())
5791 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5792 // Used for call and invoke instructions
5793 (yyval.ParamList) = new ParamList();
5794 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5795 (yyval.ParamList)->push_back(E);
5796 delete (yyvsp[(1) - (4)].TypeVal);
5802 #line 2756 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5804 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5805 // Labels are only valid in ASMs
5806 (yyval.ParamList) = new ParamList();
5807 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5808 (yyval.ParamList)->push_back(E);
5814 #line 2764 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5816 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5817 if (!UpRefs.empty())
5818 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5819 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5820 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5821 (yyval.ParamList)->push_back(E);
5822 delete (yyvsp[(3) - (6)].TypeVal);
5828 #line 2774 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5830 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5831 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5832 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5833 (yyval.ParamList)->push_back(E);
5839 #line 2781 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5840 { (yyval.ParamList) = new ParamList(); ;}
5844 #line 2784 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5845 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5849 #line 2785 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5851 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5852 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5858 #line 2792 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5860 (yyval.BoolVal) = true;
5866 #line 2796 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5868 (yyval.BoolVal) = false;
5874 #line 2801 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5876 if (!UpRefs.empty())
5877 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5878 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5879 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5881 "Arithmetic operator requires integer, FP, or packed operands");
5882 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5884 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5886 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5887 if ((yyval.InstVal) == 0)
5888 GEN_ERROR("binary operator returned null");
5889 delete (yyvsp[(2) - (5)].TypeVal);
5894 #line 2817 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5896 if (!UpRefs.empty())
5897 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5898 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5899 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5900 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5901 GEN_ERROR("Logical operator requires integral operands");
5903 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5905 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5907 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5908 if ((yyval.InstVal) == 0)
5909 GEN_ERROR("binary operator returned null");
5910 delete (yyvsp[(2) - (5)].TypeVal);
5915 #line 2834 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5917 if (!UpRefs.empty())
5918 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5919 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5920 GEN_ERROR("Vector types not supported by icmp instruction");
5921 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5923 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5925 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
5926 if ((yyval.InstVal) == 0)
5927 GEN_ERROR("icmp operator returned null");
5928 delete (yyvsp[(3) - (6)].TypeVal);
5933 #line 2848 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5935 if (!UpRefs.empty())
5936 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5937 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5938 GEN_ERROR("Vector types not supported by fcmp instruction");
5939 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5941 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5943 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
5944 if ((yyval.InstVal) == 0)
5945 GEN_ERROR("fcmp operator returned null");
5946 delete (yyvsp[(3) - (6)].TypeVal);
5951 #line 2862 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5953 if (!UpRefs.empty())
5954 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5955 Value* Val = (yyvsp[(2) - (4)].ValueVal);
5956 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
5957 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
5958 GEN_ERROR("invalid cast opcode for cast from '" +
5959 Val->getType()->getDescription() + "' to '" +
5960 DestTy->getDescription() + "'");
5961 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
5962 delete (yyvsp[(4) - (4)].TypeVal);
5967 #line 2874 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5969 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
5970 GEN_ERROR("select condition must be boolean");
5971 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
5972 GEN_ERROR("select value types should match");
5973 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5979 #line 2882 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5981 if (!UpRefs.empty())
5982 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5983 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
5984 delete (yyvsp[(4) - (4)].TypeVal);
5990 #line 2889 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5992 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
5993 GEN_ERROR("Invalid extractelement operands");
5994 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6000 #line 2895 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6002 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6003 GEN_ERROR("Invalid insertelement operands");
6004 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6010 #line 2901 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6012 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6013 GEN_ERROR("Invalid shufflevector operands");
6014 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6020 #line 2907 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6022 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6023 if (!Ty->isFirstClassType())
6024 GEN_ERROR("PHI node operands must be of first class type");
6025 (yyval.InstVal) = new PHINode(Ty);
6026 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6027 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6028 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6029 GEN_ERROR("All elements of a PHI node must be of the same type");
6030 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6031 (yyvsp[(2) - (2)].PHIList)->pop_front();
6033 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6039 #line 2923 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6042 // Handle the short syntax
6043 const PointerType *PFTy = 0;
6044 const FunctionType *Ty = 0;
6045 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6046 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6047 // Pull out the types of all of the arguments...
6048 std::vector<const Type*> ParamTypes;
6049 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6050 for (; I != E; ++I) {
6051 const Type *Ty = I->Val->getType();
6052 if (Ty == Type::VoidTy)
6053 GEN_ERROR("Short call syntax cannot be used with varargs");
6054 ParamTypes.push_back(Ty);
6056 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6057 PFTy = PointerType::get(Ty);
6060 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6063 // Check for call to invalid intrinsic to avoid crashing later.
6064 if (Function *theF = dyn_cast<Function>(V)) {
6065 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6066 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6067 !theF->getIntrinsicID(true))
6068 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6069 theF->getName() + "'");
6072 // Set up the ParamAttrs for the function
6073 ParamAttrsVector Attrs;
6074 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6075 ParamAttrsWithIndex PAWI;
6077 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6078 Attrs.push_back(PAWI);
6080 // Check the arguments
6082 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6083 // Make sure no arguments is a good thing!
6084 if (Ty->getNumParams() != 0)
6085 GEN_ERROR("No arguments passed to a function that "
6086 "expects arguments");
6087 } else { // Has arguments?
6088 // Loop through FunctionType's arguments and ensure they are specified
6089 // correctly. Also, gather any parameter attributes.
6090 FunctionType::param_iterator I = Ty->param_begin();
6091 FunctionType::param_iterator E = Ty->param_end();
6092 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6095 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6096 if (ArgI->Val->getType() != *I)
6097 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6098 (*I)->getDescription() + "'");
6099 Args.push_back(ArgI->Val);
6100 if (ArgI->Attrs != ParamAttr::None) {
6101 ParamAttrsWithIndex PAWI;
6103 PAWI.attrs = ArgI->Attrs;
6104 Attrs.push_back(PAWI);
6107 if (Ty->isVarArg()) {
6109 for (; ArgI != ArgE; ++ArgI)
6110 Args.push_back(ArgI->Val); // push the remaining varargs
6111 } else if (I != E || ArgI != ArgE)
6112 GEN_ERROR("Invalid number of parameters detected");
6115 // Finish off the ParamAttrs and check them
6116 const ParamAttrsList *PAL = 0;
6118 PAL = ParamAttrsList::get(Attrs);
6120 // Create the call node
6121 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
6122 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6123 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6124 CI->setParamAttrs(PAL);
6125 (yyval.InstVal) = CI;
6126 delete (yyvsp[(6) - (8)].ParamList);
6127 delete (yyvsp[(3) - (8)].TypeVal);
6133 #line 3013 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6135 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6141 #line 3018 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6143 (yyval.BoolVal) = true;
6149 #line 3022 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6151 (yyval.BoolVal) = false;
6157 #line 3029 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6159 if (!UpRefs.empty())
6160 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6161 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6162 delete (yyvsp[(2) - (3)].TypeVal);
6168 #line 3036 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6170 if (!UpRefs.empty())
6171 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6172 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6174 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6175 delete (yyvsp[(2) - (6)].TypeVal);
6180 #line 3044 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6182 if (!UpRefs.empty())
6183 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6184 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6185 delete (yyvsp[(2) - (3)].TypeVal);
6191 #line 3051 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6193 if (!UpRefs.empty())
6194 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6195 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6197 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6198 delete (yyvsp[(2) - (6)].TypeVal);
6203 #line 3059 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6205 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6206 GEN_ERROR("Trying to free nonpointer type " +
6207 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6208 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6214 #line 3067 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6216 if (!UpRefs.empty())
6217 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6218 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6219 GEN_ERROR("Can't load from nonpointer type: " +
6220 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6221 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6222 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6223 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6224 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6226 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6227 delete (yyvsp[(3) - (5)].TypeVal);
6232 #line 3081 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6234 if (!UpRefs.empty())
6235 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6236 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6238 GEN_ERROR("Can't store to a nonpointer type: " +
6239 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6240 const Type *ElTy = PT->getElementType();
6241 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6242 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6243 "' into space of type '" + ElTy->getDescription() + "'");
6245 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6247 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6248 delete (yyvsp[(5) - (7)].TypeVal);
6253 #line 3098 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6255 if (!UpRefs.empty())
6256 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6257 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6258 GEN_ERROR("getelementptr insn requires pointer operand");
6260 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6261 GEN_ERROR("Invalid getelementptr indices for type '" +
6262 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6263 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6265 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6266 delete (yyvsp[(2) - (4)].TypeVal);
6267 delete (yyvsp[(4) - (4)].ValueList);
6272 /* Line 1267 of yacc.c. */
6273 #line 6274 "llvmAsmParser.tab.c"
6276 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6280 YY_STACK_PRINT (yyss, yyssp);
6285 /* Now `shift' the result of the reduction. Determine what state
6286 that goes to, based on the state we popped back to and the rule
6287 number reduced by. */
6291 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6292 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6293 yystate = yytable[yystate];
6295 yystate = yydefgoto[yyn - YYNTOKENS];
6300 /*------------------------------------.
6301 | yyerrlab -- here on detecting error |
6302 `------------------------------------*/
6304 /* If not already recovering from an error, report this error. */
6308 #if ! YYERROR_VERBOSE
6309 yyerror (YY_("syntax error"));
6312 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6313 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6315 YYSIZE_T yyalloc = 2 * yysize;
6316 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6317 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6318 if (yymsg != yymsgbuf)
6319 YYSTACK_FREE (yymsg);
6320 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6322 yymsg_alloc = yyalloc;
6326 yymsg_alloc = sizeof yymsgbuf;
6330 if (0 < yysize && yysize <= yymsg_alloc)
6332 (void) yysyntax_error (yymsg, yystate, yychar);
6337 yyerror (YY_("syntax error"));
6339 goto yyexhaustedlab;
6347 if (yyerrstatus == 3)
6349 /* If just tried and failed to reuse look-ahead token after an
6350 error, discard it. */
6352 if (yychar <= YYEOF)
6354 /* Return failure if at end of input. */
6355 if (yychar == YYEOF)
6360 yydestruct ("Error: discarding",
6366 /* Else will try to reuse look-ahead token after shifting the error
6371 /*---------------------------------------------------.
6372 | yyerrorlab -- error raised explicitly by YYERROR. |
6373 `---------------------------------------------------*/
6376 /* Pacify compilers like GCC when the user code never invokes
6377 YYERROR and the label yyerrorlab therefore never appears in user
6379 if (/*CONSTCOND*/ 0)
6382 /* Do not reclaim the symbols of the rule which action triggered
6386 YY_STACK_PRINT (yyss, yyssp);
6391 /*-------------------------------------------------------------.
6392 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6393 `-------------------------------------------------------------*/
6395 yyerrstatus = 3; /* Each real token shifted decrements this. */
6399 yyn = yypact[yystate];
6400 if (yyn != YYPACT_NINF)
6403 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6411 /* Pop the current state because it cannot handle the error token. */
6416 yydestruct ("Error: popping",
6417 yystos[yystate], yyvsp);
6420 YY_STACK_PRINT (yyss, yyssp);
6429 /* Shift the error token. */
6430 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6436 /*-------------------------------------.
6437 | yyacceptlab -- YYACCEPT comes here. |
6438 `-------------------------------------*/
6443 /*-----------------------------------.
6444 | yyabortlab -- YYABORT comes here. |
6445 `-----------------------------------*/
6451 /*-------------------------------------------------.
6452 | yyexhaustedlab -- memory exhaustion comes here. |
6453 `-------------------------------------------------*/
6455 yyerror (YY_("memory exhausted"));
6461 if (yychar != YYEOF && yychar != YYEMPTY)
6462 yydestruct ("Cleanup: discarding lookahead",
6464 /* Do not reclaim the symbols of the rule which action triggered
6465 this YYABORT or YYACCEPT. */
6467 YY_STACK_PRINT (yyss, yyssp);
6468 while (yyssp != yyss)
6470 yydestruct ("Cleanup: popping",
6471 yystos[*yyssp], yyvsp);
6476 YYSTACK_FREE (yyss);
6479 if (yymsg != yymsgbuf)
6480 YYSTACK_FREE (yymsg);
6482 /* Make sure YYID is used. */
6483 return YYID (yyresult);
6487 #line 3115 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6490 // common code from the two 'RunVMAsmParser' functions
6491 static Module* RunParser(Module * M) {
6492 CurModule.CurrentModule = M;
6493 // Check to make sure the parser succeeded
6496 delete ParserResult;
6500 // Emit an error if there are any unresolved types left.
6501 if (!CurModule.LateResolveTypes.empty()) {
6502 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6503 if (DID.Type == ValID::LocalName) {
6504 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6506 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6509 delete ParserResult;
6513 // Emit an error if there are any unresolved values left.
6514 if (!CurModule.LateResolveValues.empty()) {
6515 Value *V = CurModule.LateResolveValues.back();
6516 std::map<Value*, std::pair<ValID, int> >::iterator I =
6517 CurModule.PlaceHolderInfo.find(V);
6519 if (I != CurModule.PlaceHolderInfo.end()) {
6520 ValID &DID = I->second.first;
6521 if (DID.Type == ValID::LocalName) {
6522 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6524 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6527 delete ParserResult;
6532 // Check to make sure that parsing produced a result
6536 // Reset ParserResult variable while saving its value for the result.
6537 Module *Result = ParserResult;
6543 void llvm::GenerateError(const std::string &message, int LineNo) {
6544 if (LineNo == -1) LineNo = LLLgetLineNo();
6545 // TODO: column number in exception
6547 TheParseError->setError(LLLgetFilename(), message, LineNo);
6551 int yyerror(const char *ErrorMsg) {
6552 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6553 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6554 if (yychar != YYEMPTY && yychar != 0) {
6555 errMsg += " while reading token: '";
6556 errMsg += std::string(LLLgetTokenStart(),
6557 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6559 GenerateError(errMsg);