1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
207 EXTRACTELEMENT = 388,
229 #define ESINT64VAL 258
230 #define EUINT64VAL 259
231 #define ESAPINTVAL 260
232 #define EUAPINTVAL 261
233 #define LOCALVAL_ID 262
234 #define GLOBALVAL_ID 263
242 #define PPC_FP128 271
246 #define GLOBALVAR 275
248 #define STRINGCONSTANT 277
249 #define ATSTRINGCONSTANT 278
250 #define PCTSTRINGCONSTANT 279
251 #define ZEROINITIALIZER 280
263 #define THREAD_LOCAL 292
265 #define DOTDOTDOT 294
271 #define APPENDING 300
272 #define DLLIMPORT 301
273 #define DLLEXPORT 302
274 #define EXTERN_WEAK 303
280 #define ADDRSPACE 309
286 #define SIDEEFFECT 315
289 #define FASTCC_TOK 318
290 #define COLDCC_TOK 319
291 #define X86_STDCALLCC_TOK 320
292 #define X86_FASTCALLCC_TOK 321
293 #define DATALAYOUT 322
300 #define UNREACHABLE 329
343 #define GETELEMENTPTR 372
359 #define EXTRACTELEMENT 388
360 #define INSERTELEMENT 389
361 #define SHUFFLEVECTOR 390
362 #define GETRESULT 391
377 #define PROTECTED 406
382 /* Copy the first part of user declarations. */
383 #line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
385 #include "ParserInternals.h"
386 #include "llvm/CallingConv.h"
387 #include "llvm/InlineAsm.h"
388 #include "llvm/Instructions.h"
389 #include "llvm/Module.h"
390 #include "llvm/ValueSymbolTable.h"
391 #include "llvm/AutoUpgrade.h"
392 #include "llvm/Support/GetElementPtrTypeIterator.h"
393 #include "llvm/Support/CommandLine.h"
394 #include "llvm/ADT/SmallVector.h"
395 #include "llvm/ADT/STLExtras.h"
396 #include "llvm/Support/MathExtras.h"
397 #include "llvm/Support/Streams.h"
403 // The following is a gross hack. In order to rid the libAsmParser library of
404 // exceptions, we have to have a way of getting the yyparse function to go into
405 // an error situation. So, whenever we want an error to occur, the GenerateError
406 // function (see bottom of file) sets TriggerError. Then, at the end of each
407 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
408 // (a goto) to put YACC in error state. Furthermore, several calls to
409 // GenerateError are made from inside productions and they must simulate the
410 // previous exception behavior by exiting the production immediately. We have
411 // replaced these with the GEN_ERROR macro which calls GeneratError and then
412 // immediately invokes YYERROR. This would be so much cleaner if it was a
413 // recursive descent parser.
414 static bool TriggerError = false;
415 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
416 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
418 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
419 int yylex(); // declaration" of xxx warnings.
421 using namespace llvm;
423 static Module *ParserResult;
425 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
426 // relating to upreferences in the input stream.
428 //#define DEBUG_UPREFS 1
430 #define UR_OUT(X) cerr << X
435 #define YYERROR_VERBOSE 1
437 static GlobalVariable *CurGV;
440 // This contains info used when building the body of a function. It is
441 // destroyed when the function is completed.
443 typedef std::vector<Value *> ValueList; // Numbered defs
446 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
448 static struct PerModuleInfo {
449 Module *CurrentModule;
450 ValueList Values; // Module level numbered definitions
451 ValueList LateResolveValues;
452 std::vector<PATypeHolder> Types;
453 std::map<ValID, PATypeHolder> LateResolveTypes;
455 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
456 /// how they were referenced and on which line of the input they came from so
457 /// that we can resolve them later and print error messages as appropriate.
458 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
460 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
461 // references to global values. Global values may be referenced before they
462 // are defined, and if so, the temporary object that they represent is held
463 // here. This is used for forward references of GlobalValues.
465 typedef std::map<std::pair<const PointerType *,
466 ValID>, GlobalValue*> GlobalRefsType;
467 GlobalRefsType GlobalRefs;
470 // If we could not resolve some functions at function compilation time
471 // (calls to functions before they are defined), resolve them now... Types
472 // are resolved when the constant pool has been completely parsed.
474 ResolveDefinitions(LateResolveValues);
478 // Check to make sure that all global value forward references have been
481 if (!GlobalRefs.empty()) {
482 std::string UndefinedReferences = "Unresolved global references exist:\n";
484 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
486 UndefinedReferences += " " + I->first.first->getDescription() + " " +
487 I->first.second.getName() + "\n";
489 GenerateError(UndefinedReferences);
493 // Look for intrinsic functions and CallInst that need to be upgraded
494 for (Module::iterator FI = CurrentModule->begin(),
495 FE = CurrentModule->end(); FI != FE; )
496 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
498 Values.clear(); // Clear out function local definitions
503 // GetForwardRefForGlobal - Check to see if there is a forward reference
504 // for this global. If so, remove it from the GlobalRefs map and return it.
505 // If not, just return null.
506 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
507 // Check to see if there is a forward reference to this global variable...
508 // if there is, eliminate it and patch the reference to use the new def'n.
509 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
510 GlobalValue *Ret = 0;
511 if (I != GlobalRefs.end()) {
518 bool TypeIsUnresolved(PATypeHolder* PATy) {
519 // If it isn't abstract, its resolved
520 const Type* Ty = PATy->get();
521 if (!Ty->isAbstract())
523 // Traverse the type looking for abstract types. If it isn't abstract then
524 // we don't need to traverse that leg of the type.
525 std::vector<const Type*> WorkList, SeenList;
526 WorkList.push_back(Ty);
527 while (!WorkList.empty()) {
528 const Type* Ty = WorkList.back();
529 SeenList.push_back(Ty);
531 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
532 // Check to see if this is an unresolved type
533 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
534 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
535 for ( ; I != E; ++I) {
536 if (I->second.get() == OpTy)
539 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
540 const Type* TheTy = SeqTy->getElementType();
541 if (TheTy->isAbstract() && TheTy != Ty) {
542 std::vector<const Type*>::iterator I = SeenList.begin(),
548 WorkList.push_back(TheTy);
550 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
551 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
552 const Type* TheTy = StrTy->getElementType(i);
553 if (TheTy->isAbstract() && TheTy != Ty) {
554 std::vector<const Type*>::iterator I = SeenList.begin(),
560 WorkList.push_back(TheTy);
569 static struct PerFunctionInfo {
570 Function *CurrentFunction; // Pointer to current function being created
572 ValueList Values; // Keep track of #'d definitions
574 ValueList LateResolveValues;
575 bool isDeclare; // Is this function a forward declararation?
576 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
577 GlobalValue::VisibilityTypes Visibility;
579 /// BBForwardRefs - When we see forward references to basic blocks, keep
580 /// track of them here.
581 std::map<ValID, BasicBlock*> BBForwardRefs;
583 inline PerFunctionInfo() {
586 Linkage = GlobalValue::ExternalLinkage;
587 Visibility = GlobalValue::DefaultVisibility;
590 inline void FunctionStart(Function *M) {
595 void FunctionDone() {
596 // Any forward referenced blocks left?
597 if (!BBForwardRefs.empty()) {
598 GenerateError("Undefined reference to label " +
599 BBForwardRefs.begin()->second->getName());
603 // Resolve all forward references now.
604 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
606 Values.clear(); // Clear out function local definitions
607 BBForwardRefs.clear();
610 Linkage = GlobalValue::ExternalLinkage;
611 Visibility = GlobalValue::DefaultVisibility;
613 } CurFun; // Info for the current function...
615 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
618 //===----------------------------------------------------------------------===//
619 // Code to handle definitions of all the types
620 //===----------------------------------------------------------------------===//
622 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
623 // Things that have names or are void typed don't get slot numbers
624 if (V->hasName() || (V->getType() == Type::VoidTy))
627 // In the case of function values, we have to allow for the forward reference
628 // of basic blocks, which are included in the numbering. Consequently, we keep
629 // track of the next insertion location with NextValNum. When a BB gets
630 // inserted, it could change the size of the CurFun.Values vector.
631 if (&ValueTab == &CurFun.Values) {
632 if (ValueTab.size() <= CurFun.NextValNum)
633 ValueTab.resize(CurFun.NextValNum+1);
634 ValueTab[CurFun.NextValNum++] = V;
637 // For all other lists, its okay to just tack it on the back of the vector.
638 ValueTab.push_back(V);
641 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
643 case ValID::LocalID: // Is it a numbered definition?
644 // Module constants occupy the lowest numbered slots...
645 if (D.Num < CurModule.Types.size())
646 return CurModule.Types[D.Num];
648 case ValID::LocalName: // Is it a named definition?
649 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
650 D.destroy(); // Free old strdup'd memory...
655 GenerateError("Internal parser error: Invalid symbol type reference");
659 // If we reached here, we referenced either a symbol that we don't know about
660 // or an id number that hasn't been read yet. We may be referencing something
661 // forward, so just create an entry to be resolved later and get to it...
663 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
666 if (inFunctionScope()) {
667 if (D.Type == ValID::LocalName) {
668 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
671 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
676 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
677 if (I != CurModule.LateResolveTypes.end())
680 Type *Typ = OpaqueType::get();
681 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
685 // getExistingVal - Look up the value specified by the provided type and
686 // the provided ValID. If the value exists and has already been defined, return
687 // it. Otherwise return null.
689 static Value *getExistingVal(const Type *Ty, const ValID &D) {
690 if (isa<FunctionType>(Ty)) {
691 GenerateError("Functions are not values and "
692 "must be referenced as pointers");
697 case ValID::LocalID: { // Is it a numbered definition?
698 // Check that the number is within bounds.
699 if (D.Num >= CurFun.Values.size())
701 Value *Result = CurFun.Values[D.Num];
702 if (Ty != Result->getType()) {
703 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
704 Result->getType()->getDescription() + "' does not match "
705 "expected type, '" + Ty->getDescription() + "'");
710 case ValID::GlobalID: { // Is it a numbered definition?
711 if (D.Num >= CurModule.Values.size())
713 Value *Result = CurModule.Values[D.Num];
714 if (Ty != Result->getType()) {
715 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
716 Result->getType()->getDescription() + "' does not match "
717 "expected type, '" + Ty->getDescription() + "'");
723 case ValID::LocalName: { // Is it a named definition?
724 if (!inFunctionScope())
726 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
727 Value *N = SymTab.lookup(D.getName());
730 if (N->getType() != Ty)
733 D.destroy(); // Free old strdup'd memory...
736 case ValID::GlobalName: { // Is it a named definition?
737 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
738 Value *N = SymTab.lookup(D.getName());
741 if (N->getType() != Ty)
744 D.destroy(); // Free old strdup'd memory...
748 // Check to make sure that "Ty" is an integral type, and that our
749 // value will fit into the specified type...
750 case ValID::ConstSIntVal: // Is it a constant pool reference??
751 if (!isa<IntegerType>(Ty) ||
752 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
753 GenerateError("Signed integral constant '" +
754 itostr(D.ConstPool64) + "' is invalid for type '" +
755 Ty->getDescription() + "'");
758 return ConstantInt::get(Ty, D.ConstPool64, true);
760 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
761 if (isa<IntegerType>(Ty) &&
762 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
763 return ConstantInt::get(Ty, D.UConstPool64);
765 if (!isa<IntegerType>(Ty) ||
766 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
767 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
768 "' is invalid or out of range for type '" +
769 Ty->getDescription() + "'");
772 // This is really a signed reference. Transmogrify.
773 return ConstantInt::get(Ty, D.ConstPool64, true);
775 case ValID::ConstFPVal: // Is it a floating point const pool reference?
776 if (!Ty->isFloatingPoint() ||
777 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
778 GenerateError("FP constant invalid for type");
781 // Lexer has no type info, so builds all float and double FP constants
782 // as double. Fix this here. Long double does not need this.
783 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
785 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
786 return ConstantFP::get(*D.ConstPoolFP);
788 case ValID::ConstNullVal: // Is it a null value?
789 if (!isa<PointerType>(Ty)) {
790 GenerateError("Cannot create a a non pointer null");
793 return ConstantPointerNull::get(cast<PointerType>(Ty));
795 case ValID::ConstUndefVal: // Is it an undef value?
796 return UndefValue::get(Ty);
798 case ValID::ConstZeroVal: // Is it a zero value?
799 return Constant::getNullValue(Ty);
801 case ValID::ConstantVal: // Fully resolved constant?
802 if (D.ConstantValue->getType() != Ty) {
803 GenerateError("Constant expression type different from required type");
806 return D.ConstantValue;
808 case ValID::InlineAsmVal: { // Inline asm expression
809 const PointerType *PTy = dyn_cast<PointerType>(Ty);
810 const FunctionType *FTy =
811 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
812 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
813 GenerateError("Invalid type for asm constraint string");
816 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
817 D.IAD->HasSideEffects);
818 D.destroy(); // Free InlineAsmDescriptor.
822 assert(0 && "Unhandled case!");
826 assert(0 && "Unhandled case!");
830 // getVal - This function is identical to getExistingVal, except that if a
831 // value is not already defined, it "improvises" by creating a placeholder var
832 // that looks and acts just like the requested variable. When the value is
833 // defined later, all uses of the placeholder variable are replaced with the
836 static Value *getVal(const Type *Ty, const ValID &ID) {
837 if (Ty == Type::LabelTy) {
838 GenerateError("Cannot use a basic block here");
842 // See if the value has already been defined.
843 Value *V = getExistingVal(Ty, ID);
845 if (TriggerError) return 0;
847 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
848 GenerateError("Invalid use of a composite type");
852 // If we reached here, we referenced either a symbol that we don't know about
853 // or an id number that hasn't been read yet. We may be referencing something
854 // forward, so just create an entry to be resolved later and get to it...
857 case ValID::GlobalName:
858 case ValID::GlobalID: {
859 const PointerType *PTy = dyn_cast<PointerType>(Ty);
861 GenerateError("Invalid type for reference to global" );
864 const Type* ElTy = PTy->getElementType();
865 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
866 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
868 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
869 (Module*)0, false, PTy->getAddressSpace());
873 V = new Argument(Ty);
876 // Remember where this forward reference came from. FIXME, shouldn't we try
877 // to recycle these things??
878 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
881 if (inFunctionScope())
882 InsertValue(V, CurFun.LateResolveValues);
884 InsertValue(V, CurModule.LateResolveValues);
888 /// defineBBVal - This is a definition of a new basic block with the specified
889 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
890 static BasicBlock *defineBBVal(const ValID &ID, BasicBlock *unwindDest) {
891 assert(inFunctionScope() && "Can't get basic block at global scope!");
895 // First, see if this was forward referenced
897 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
898 if (BBI != CurFun.BBForwardRefs.end()) {
900 // The forward declaration could have been inserted anywhere in the
901 // function: insert it into the correct place now.
902 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
903 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
905 // We're about to erase the entry, save the key so we can clean it up.
906 ValID Tmp = BBI->first;
908 // Erase the forward ref from the map as its no longer "forward"
909 CurFun.BBForwardRefs.erase(ID);
911 // The key has been removed from the map but so we don't want to leave
912 // strdup'd memory around so destroy it too.
915 // If its a numbered definition, bump the number and set the BB value.
916 if (ID.Type == ValID::LocalID) {
917 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
921 // We haven't seen this BB before and its first mention is a definition.
922 // Just create it and return it.
923 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
924 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
925 if (ID.Type == ValID::LocalID) {
926 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
932 BB->setUnwindDest(unwindDest);
936 /// getBBVal - get an existing BB value or create a forward reference for it.
938 static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
946 } if (ID.Type == ValID::LocalName) {
947 std::string Name = ID.getName();
948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
966 GenerateError("Illegal label reference " + ID.getName());
970 // If its already been defined, return it now.
972 ID.destroy(); // Free strdup'd memory.
976 // Otherwise, this block has not been seen before, create it.
978 if (ID.Type == ValID::LocalName)
980 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
989 //===----------------------------------------------------------------------===//
990 // Code to handle forward references in instructions
991 //===----------------------------------------------------------------------===//
993 // This code handles the late binding needed with statements that reference
994 // values not defined yet... for example, a forward branch, or the PHI node for
997 // This keeps a table (CurFun.LateResolveValues) of all such forward references
998 // and back patchs after we are done.
1001 // ResolveDefinitions - If we could not resolve some defs at parsing
1002 // time (forward branches, phi functions for loops, etc...) resolve the
1006 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
1012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1016 ValID &DID = PHI->second.first;
1018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1022 V->replaceAllUsesWith(TheRealValue);
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1028 InsertValue(V, *FutureLateResolvers);
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
1036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1044 LateResolvers.clear();
1047 // ResolveTypeTo - A brand new type was just declared. This means that (if
1048 // name is not null) things referencing Name can be resolved. Otherwise, things
1049 // refering to the number can be resolved. Do this now.
1051 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1054 D = ValID::createLocalName(*Name);
1056 D = ValID::createLocalID(CurModule.Types.size());
1058 std::map<ValID, PATypeHolder>::iterator I =
1059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
1061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1062 CurModule.LateResolveTypes.erase(I);
1066 // setValueName - Set the specified value to the name given. The name may be
1067 // null potentially, in which case this is a noop. The string passed in is
1068 // assumed to be a malloc'd string buffer, and is free'd by this function.
1070 static void setValueName(Value *V, std::string *NameStr) {
1071 if (!NameStr) return;
1072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
1075 if (V->getType() == Type::VoidTy) {
1076 GenerateError("Can't assign name '" + Name+"' to value with void type");
1080 assert(inFunctionScope() && "Must be in function scope!");
1081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
1083 GenerateError("Redefinition of value '" + Name + "' of type '" +
1084 V->getType()->getDescription() + "'");
1092 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093 /// this is a declaration, otherwise it is a definition.
1094 static GlobalVariable *
1095 ParseGlobalVariable(std::string *NameStr,
1096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
1098 bool isConstantGlobal, const Type *Ty,
1099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
1101 if (isa<FunctionType>(Ty)) {
1102 GenerateError("Cannot declare global vars of function type");
1106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
1114 // See if this global value was forward referenced. If so, recycle the
1117 if (!Name.empty()) {
1118 ID = ValID::createGlobalName(Name);
1120 ID = ValID::createGlobalID(CurModule.Values.size());
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
1131 GV->setVisibility(Visibility);
1132 GV->setConstant(isConstantGlobal);
1133 GV->setThreadLocal(IsThreadLocal);
1134 InsertValue(GV, CurModule.Values);
1138 // If this global has a name
1139 if (!Name.empty()) {
1140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1159 GV->setVisibility(Visibility);
1160 InsertValue(GV, CurModule.Values);
1164 // setTypeName - Set the specified type to the name given. The name may be
1165 // null potentially, in which case this is a noop. The string passed in is
1166 // assumed to be a malloc'd string buffer, and is freed by this function.
1168 // This function returns true if the type has already been defined, but is
1169 // allowed to be redefined in the specified context. If the name is a new name
1170 // for the type plane, it is inserted and false is returned.
1171 static bool setTypeName(const Type *T, std::string *NameStr) {
1172 assert(!inFunctionScope() && "Can't give types function-local names!");
1173 if (NameStr == 0) return false;
1175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
1178 // We don't allow assigning names to void type
1179 if (T == Type::VoidTy) {
1180 GenerateError("Can't assign name '" + Name + "' to the void type");
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1189 assert(Existing && "Conflict but no matching type?!");
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1205 // Any other kind of (non-equivalent) redefinition is an error.
1206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1207 T->getDescription() + "'");
1213 //===----------------------------------------------------------------------===//
1214 // Code for handling upreferences in type names...
1217 // TypeContains - Returns true if Ty directly contains E in it.
1219 static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1243 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1244 static std::vector<UpRefRecord> UpRefs;
1246 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1247 /// called. It loops through the UpRefs vector, which is a list of the
1248 /// currently active types. For each type, if the up reference is contained in
1249 /// the newly completed type, we decrement the level count. When the level
1250 /// count reaches zero, the upreferenced type is the type that is passed in:
1251 /// thus we can complete the cycle.
1253 static PATypeHolder HandleUpRefs(const Type *ty) {
1254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1267 OpaqueType *TypeToResolve = 0;
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1305 //===----------------------------------------------------------------------===//
1306 // RunVMAsmParser - Define an interface to this parser
1307 //===----------------------------------------------------------------------===//
1309 static Module* RunParser(Module * M);
1311 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1320 /* Enabling traces. */
1325 /* Enabling verbose error messages. */
1326 #ifdef YYERROR_VERBOSE
1327 # undef YYERROR_VERBOSE
1328 # define YYERROR_VERBOSE 1
1330 # define YYERROR_VERBOSE 0
1333 /* Enabling the token table. */
1334 #ifndef YYTOKEN_TABLE
1335 # define YYTOKEN_TABLE 0
1338 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339 typedef union YYSTYPE
1340 #line 950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
1342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
1344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
1347 llvm::Constant *ConstVal;
1349 const llvm::Type *PrimType;
1350 std::list<llvm::PATypeHolder> *TypeList;
1351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
1353 std::vector<llvm::Value*> *ValueList;
1354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
1357 llvm::ParamList *ParamList;
1359 // Represent the RHS of PHI node
1360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
1362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1363 std::vector<llvm::Constant*> *ConstVector;
1365 llvm::GlobalValue::LinkageTypes Linkage;
1366 llvm::GlobalValue::VisibilityTypes Visibility;
1367 llvm::ParameterAttributes ParamAttrs;
1368 llvm::APInt *APIntVal;
1373 llvm::APFloat *FPVal;
1376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
1387 /* Line 193 of yacc.c. */
1388 #line 1389 "llvmAsmParser.tab.c"
1390 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391 # define YYSTYPE_IS_DECLARED 1
1392 # define YYSTYPE_IS_TRIVIAL 1
1397 /* Copy the second part of user declarations. */
1400 /* Line 216 of yacc.c. */
1401 #line 1402 "llvmAsmParser.tab.c"
1408 typedef YYTYPE_UINT8 yytype_uint8;
1410 typedef unsigned char yytype_uint8;
1414 typedef YYTYPE_INT8 yytype_int8;
1415 #elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417 typedef signed char yytype_int8;
1419 typedef short int yytype_int8;
1422 #ifdef YYTYPE_UINT16
1423 typedef YYTYPE_UINT16 yytype_uint16;
1425 typedef unsigned short int yytype_uint16;
1429 typedef YYTYPE_INT16 yytype_int16;
1431 typedef short int yytype_int16;
1435 # ifdef __SIZE_TYPE__
1436 # define YYSIZE_T __SIZE_TYPE__
1437 # elif defined size_t
1438 # define YYSIZE_T size_t
1439 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442 # define YYSIZE_T size_t
1444 # define YYSIZE_T unsigned int
1448 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1451 # if defined YYENABLE_NLS && YYENABLE_NLS
1453 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1458 # define YY_(msgid) msgid
1462 /* Suppress unused-variable warnings by "using" E. */
1463 #if ! defined lint || defined __GNUC__
1464 # define YYUSE(e) ((void) (e))
1466 # define YYUSE(e) /* empty */
1469 /* Identity function, used to suppress warnings about constant conditions. */
1471 # define YYID(n) (n)
1473 #if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1487 #if ! defined yyoverflow || YYERROR_VERBOSE
1489 /* The parser invokes alloca or malloc; define the necessary symbols. */
1491 # ifdef YYSTACK_USE_ALLOCA
1492 # if YYSTACK_USE_ALLOCA
1494 # define YYSTACK_ALLOC __builtin_alloca
1495 # elif defined __BUILTIN_VA_ARG_INCR
1496 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1498 # define YYSTACK_ALLOC __alloca
1499 # elif defined _MSC_VER
1500 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501 # define alloca _alloca
1503 # define YYSTACK_ALLOC alloca
1504 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1508 # define _STDLIB_H 1
1515 # ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518 # ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1526 # define YYSTACK_ALLOC YYMALLOC
1527 # define YYSTACK_FREE YYFREE
1528 # ifndef YYSTACK_ALLOC_MAXIMUM
1529 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1531 # if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1536 # define _STDLIB_H 1
1540 # define YYMALLOC malloc
1541 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1547 # define YYFREE free
1548 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550 void free (void *); /* INFRINGES ON USER NAME SPACE */
1554 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1557 #if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1561 /* A type that is properly aligned for any stack member. */
1568 /* The size of the maximum gap between one aligned stack and the next. */
1569 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1571 /* The size of an array large to enough to hold all stacks, each with
1573 # define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1577 /* Copy COUNT objects from FROM to TO. The source and destination do
1580 # if defined __GNUC__ && 1 < __GNUC__
1581 # define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1584 # define YYCOPY(To, From, Count) \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1595 /* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1600 # define YYSTACK_RELOCATE(Stack) \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1613 /* YYFINAL -- State number of the termination state. */
1615 /* YYLAST -- Last index in YYTABLE. */
1618 /* YYNTOKENS -- Number of terminals. */
1619 #define YYNTOKENS 166
1620 /* YYNNTS -- Number of nonterminals. */
1622 /* YYNRULES -- Number of rules. */
1623 #define YYNRULES 324
1624 /* YYNRULES -- Number of states. */
1625 #define YYNSTATES 635
1627 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628 #define YYUNDEFTOK 2
1629 #define YYMAXUTOK 406
1631 #define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1634 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635 static const yytype_uint8 yytranslate[] =
1637 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 152, 153, 156, 2, 155, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 161, 154, 162, 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, 158, 157, 160, 2, 2, 2, 2, 2, 165,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 159, 2, 2, 163, 2, 164, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1677 145, 146, 147, 148, 149, 150, 151
1681 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1683 static const yytype_uint16 yyprhs[] =
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1696 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1697 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1698 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1699 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1700 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1701 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1702 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1704 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1705 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1706 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1707 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1708 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1709 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1710 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
1711 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1712 747, 750, 753, 757, 760, 761, 765, 767, 772, 775,
1713 778, 782, 792, 802, 811, 826, 828, 830, 837, 843,
1714 846, 853, 861, 866, 871, 878, 885, 886, 887, 891,
1715 894, 896, 902, 908, 915, 922, 927, 934, 939, 944,
1716 951, 958, 961, 970, 972, 974, 975, 979, 986, 990,
1717 997, 1000, 1006, 1014, 1020
1720 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1721 static const yytype_int16 yyrhs[] =
1723 212, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1724 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1725 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1726 -1, 86, -1, 118, -1, 119, -1, 120, -1, 121,
1727 -1, 122, -1, 123, -1, 124, -1, 125, -1, 126,
1728 -1, 127, -1, 128, -1, 129, -1, 92, -1, 93,
1729 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1730 -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
1731 -1, 104, -1, 105, -1, 106, -1, 107, -1, 108,
1732 -1, 109, -1, 110, -1, 111, -1, 98, -1, 99,
1733 -1, 100, -1, 101, -1, 26, -1, 27, -1, 11,
1734 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1735 -1, 19, -1, 22, -1, 24, -1, 174, -1, -1,
1736 54, 152, 4, 153, -1, -1, 174, 154, -1, -1,
1737 20, -1, 23, -1, 180, -1, -1, 178, 154, -1,
1738 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1739 46, -1, 48, -1, 50, -1, -1, 149, -1, 150,
1740 -1, 151, -1, -1, 46, -1, 48, -1, -1, 42,
1741 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1742 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1743 -1, 66, -1, 61, 4, -1, 138, -1, 119, -1,
1744 137, -1, 120, -1, 140, -1, 141, -1, 143, -1,
1745 144, -1, 145, -1, 53, 4, -1, -1, 189, 188,
1746 -1, 139, -1, 142, -1, 138, -1, 137, -1, 146,
1747 -1, 147, -1, -1, 191, 190, -1, -1, 148, 22,
1748 -1, -1, 53, 4, -1, -1, 155, 53, 4, -1,
1749 34, 22, -1, -1, 195, -1, -1, 155, 198, 197,
1750 -1, 195, -1, 53, 4, -1, 11, -1, 12, -1,
1751 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1752 49, -1, 199, -1, 200, 176, 156, -1, 234, -1,
1753 157, 4, -1, 200, 152, 204, 153, 191, -1, 10,
1754 152, 204, 153, 191, -1, 158, 4, 159, 200, 160,
1755 -1, 161, 4, 159, 200, 162, -1, 163, 205, 164,
1756 -1, 163, 164, -1, 161, 163, 205, 164, 162, -1,
1757 161, 163, 164, 162, -1, 200, 189, -1, 200, -1,
1758 10, -1, 201, -1, 203, 155, 201, -1, 203, -1,
1759 203, 155, 39, -1, 39, -1, -1, 200, -1, 205,
1760 155, 200, -1, 200, 158, 208, 160, -1, 200, 158,
1761 160, -1, 200, 165, 22, -1, 200, 161, 208, 162,
1762 -1, 200, 163, 208, 164, -1, 200, 163, 164, -1,
1763 200, 161, 163, 208, 164, 162, -1, 200, 161, 163,
1764 164, 162, -1, 200, 40, -1, 200, 41, -1, 200,
1765 234, -1, 200, 207, -1, 200, 25, -1, 172, 3,
1766 -1, 172, 5, -1, 172, 4, -1, 172, 6, -1,
1767 11, 26, -1, 11, 27, -1, 173, 9, -1, 169,
1768 152, 206, 38, 200, 153, -1, 117, 152, 206, 246,
1769 153, -1, 131, 152, 206, 155, 206, 155, 206, 153,
1770 -1, 167, 152, 206, 155, 206, 153, -1, 168, 152,
1771 206, 155, 206, 153, -1, 90, 170, 152, 206, 155,
1772 206, 153, -1, 91, 171, 152, 206, 155, 206, 153,
1773 -1, 133, 152, 206, 155, 206, 153, -1, 134, 152,
1774 206, 155, 206, 155, 206, 153, -1, 135, 152, 206,
1775 155, 206, 155, 206, 153, -1, 208, 155, 206, -1,
1776 206, -1, 32, -1, 33, -1, 37, -1, -1, 202,
1777 234, -1, 123, 152, 211, 38, 200, 153, -1, 213,
1778 -1, -1, 214, -1, 213, 214, -1, -1, 31, 215,
1779 230, -1, -1, 30, 216, 231, -1, 59, 58, 220,
1780 -1, 177, 18, 200, -1, 177, 18, 10, -1, -1,
1781 179, 183, 210, 209, 206, 176, 217, 197, -1, -1,
1782 179, 181, 183, 210, 209, 206, 176, 218, 197, -1,
1783 -1, 179, 182, 183, 210, 209, 200, 176, 219, 197,
1784 -1, 179, 183, 35, 186, 211, -1, 51, 221, -1,
1785 55, 154, 222, -1, 22, -1, 52, 154, 22, -1,
1786 67, 154, 22, -1, 158, 223, 160, -1, 223, 155,
1787 22, -1, 22, -1, -1, 224, 155, 200, 189, 175,
1788 -1, 200, 189, 175, -1, 224, -1, 224, 155, 39,
1789 -1, 39, -1, -1, 187, 202, 178, 152, 225, 153,
1790 191, 196, 193, 192, -1, 28, -1, 163, -1, 185,
1791 183, 226, 227, -1, 29, -1, 164, -1, 238, 229,
1792 -1, 184, 183, 226, -1, -1, 60, -1, 3, -1,
1793 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1794 41, -1, 25, -1, 161, 208, 162, -1, 207, -1,
1795 58, 232, 22, 155, 22, -1, 7, -1, 8, -1,
1796 174, -1, 178, -1, 234, -1, 233, -1, 200, 235,
1797 -1, 236, -1, 237, 155, 236, -1, 238, 239, -1,
1798 228, 239, -1, 240, 177, 241, -1, 240, 243, -1,
1799 -1, 68, 38, 235, -1, 21, -1, 21, 68, 38,
1800 235, -1, 69, 237, -1, 69, 10, -1, 70, 17,
1801 235, -1, 70, 11, 235, 155, 17, 235, 155, 17,
1802 235, -1, 71, 172, 235, 155, 17, 235, 158, 242,
1803 160, -1, 71, 172, 235, 155, 17, 235, 158, 160,
1804 -1, 72, 187, 202, 235, 152, 245, 153, 191, 38,
1805 17, 235, 73, 17, 235, -1, 73, -1, 74, -1,
1806 242, 172, 233, 155, 17, 235, -1, 172, 233, 155,
1807 17, 235, -1, 177, 248, -1, 200, 158, 235, 155,
1808 235, 160, -1, 244, 155, 158, 235, 155, 235, 160,
1809 -1, 200, 189, 235, 189, -1, 17, 189, 235, 189,
1810 -1, 245, 155, 200, 189, 235, 189, -1, 245, 155,
1811 17, 189, 235, 189, -1, -1, -1, 246, 155, 236,
1812 -1, 57, 56, -1, 56, -1, 167, 200, 235, 155,
1813 235, -1, 168, 200, 235, 155, 235, -1, 90, 170,
1814 200, 235, 155, 235, -1, 91, 171, 200, 235, 155,
1815 235, -1, 169, 236, 38, 200, -1, 131, 236, 155,
1816 236, 155, 236, -1, 132, 236, 155, 200, -1, 133,
1817 236, 155, 236, -1, 134, 236, 155, 236, 155, 236,
1818 -1, 135, 236, 155, 236, 155, 236, -1, 130, 244,
1819 -1, 247, 187, 202, 235, 152, 245, 153, 191, -1,
1820 250, -1, 36, -1, -1, 112, 200, 194, -1, 112,
1821 200, 155, 11, 235, 194, -1, 113, 200, 194, -1,
1822 113, 200, 155, 11, 235, 194, -1, 114, 236, -1,
1823 249, 115, 200, 235, 194, -1, 249, 116, 236, 155,
1824 200, 235, 194, -1, 136, 200, 235, 155, 4, -1,
1825 117, 200, 235, 246, -1
1828 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1829 static const yytype_uint16 yyrline[] =
1831 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
1832 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
1833 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118,
1834 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126,
1835 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131,
1836 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140,
1837 1140, 1142, 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154,
1838 1159, 1159, 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177,
1839 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195, 1196,
1840 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213, 1214,
1841 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229, 1230,
1842 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1245, 1246, 1247,
1843 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268, 1274,
1844 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318, 1318,
1845 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336, 1341,
1846 1349, 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449, 1458,
1847 1465, 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511, 1523,
1848 1551, 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726, 1733,
1849 1799, 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861, 1874,
1850 1886, 1908, 1916, 1922, 1933, 1938, 1943, 1949, 1955, 1964,
1851 1968, 1976, 1976, 1979, 1979, 1982, 1994, 2015, 2020, 2028,
1852 2029, 2033, 2033, 2037, 2037, 2040, 2043, 2067, 2079, 2078,
1853 2090, 2089, 2099, 2098, 2109, 2149, 2152, 2158, 2168, 2172,
1854 2177, 2179, 2184, 2189, 2198, 2208, 2219, 2223, 2232, 2241,
1855 2246, 2375, 2375, 2377, 2386, 2386, 2388, 2393, 2405, 2409,
1856 2414, 2418, 2422, 2426, 2430, 2434, 2438, 2442, 2446, 2471,
1857 2475, 2485, 2489, 2493, 2498, 2505, 2505, 2511, 2520, 2525,
1858 2530, 2534, 2543, 2552, 2561, 2565, 2569, 2574, 2581, 2588,
1859 2592, 2597, 2607, 2626, 2635, 2720, 2724, 2731, 2742, 2755,
1860 2765, 2776, 2786, 2797, 2805, 2815, 2822, 2825, 2826, 2833,
1861 2837, 2842, 2858, 2875, 2889, 2903, 2915, 2923, 2930, 2936,
1862 2942, 2948, 2963, 3053, 3058, 3062, 3069, 3076, 3084, 3091,
1863 3099, 3107, 3121, 3138, 3146
1867 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1868 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1869 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1870 static const char *const yytname[] =
1872 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1873 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1874 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1875 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1876 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1877 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1878 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1879 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1880 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1881 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1882 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1883 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1884 "DATALAYOUT", "UNWINDS", "RET", "BR", "SWITCH", "INVOKE", "UNWIND",
1885 "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM",
1886 "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP",
1887 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1888 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1889 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1890 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1891 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1892 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1893 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1894 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1895 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1896 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1897 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1898 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1899 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1900 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1901 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1902 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1903 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1904 "SectionString", "OptSection", "GlobalVarAttributes",
1905 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1906 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1907 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1908 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1909 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1910 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1911 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1912 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1913 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1914 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1915 "InstVal", "OptVolatile", "MemoryInst", 0
1920 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1922 static const yytype_uint16 yytoknum[] =
1924 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1925 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1926 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1927 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1928 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1929 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1930 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1931 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1932 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1933 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1934 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1935 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1936 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1937 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1938 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1939 405, 406, 40, 41, 61, 44, 42, 92, 91, 120,
1940 93, 60, 62, 123, 125, 99
1944 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1945 static const yytype_uint8 yyr1[] =
1947 0, 166, 167, 167, 167, 167, 167, 167, 167, 167,
1948 167, 168, 168, 168, 168, 168, 168, 169, 169, 169,
1949 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1950 170, 170, 170, 170, 170, 170, 170, 170, 170, 171,
1951 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1952 171, 171, 171, 171, 171, 172, 173, 173, 173, 173,
1953 173, 174, 174, 174, 175, 175, 176, 176, 177, 177,
1954 178, 178, 179, 179, 180, 181, 181, 181, 181, 181,
1955 182, 182, 182, 183, 183, 183, 183, 184, 184, 184,
1956 185, 185, 185, 185, 185, 186, 186, 186, 187, 187,
1957 187, 187, 187, 187, 187, 188, 188, 188, 188, 188,
1958 188, 188, 188, 188, 188, 189, 189, 190, 190, 190,
1959 190, 190, 190, 191, 191, 192, 192, 193, 193, 194,
1960 194, 195, 196, 196, 197, 197, 198, 198, 199, 199,
1961 199, 199, 199, 199, 199, 200, 200, 200, 200, 200,
1962 200, 200, 200, 200, 200, 200, 200, 200, 201, 202,
1963 202, 203, 203, 204, 204, 204, 204, 205, 205, 206,
1964 206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
1965 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1966 207, 207, 207, 207, 207, 207, 207, 207, 207, 208,
1967 208, 209, 209, 210, 210, 211, 211, 212, 212, 213,
1968 213, 215, 214, 216, 214, 214, 214, 214, 217, 214,
1969 218, 214, 219, 214, 214, 214, 214, 220, 221, 221,
1970 222, 223, 223, 223, 224, 224, 225, 225, 225, 225,
1971 226, 227, 227, 228, 229, 229, 230, 231, 232, 232,
1972 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1973 233, 234, 234, 234, 234, 235, 235, 236, 237, 237,
1974 238, 238, 239, 240, 240, 240, 240, 240, 241, 241,
1975 241, 241, 241, 241, 241, 241, 241, 242, 242, 243,
1976 244, 244, 245, 245, 245, 245, 245, 246, 246, 247,
1977 247, 248, 248, 248, 248, 248, 248, 248, 248, 248,
1978 248, 248, 248, 248, 249, 249, 250, 250, 250, 250,
1979 250, 250, 250, 250, 250
1982 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1983 static const yytype_uint8 yyr2[] =
1985 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1986 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1987 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1988 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1992 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1993 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1994 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1995 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1996 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1997 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1998 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1999 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2000 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2001 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2002 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2003 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2004 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2005 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2006 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2007 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2008 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2009 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2010 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2011 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2012 2, 2, 3, 2, 0, 3, 1, 4, 2, 2,
2013 3, 9, 9, 8, 14, 1, 1, 6, 5, 2,
2014 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2015 1, 5, 5, 6, 6, 4, 6, 4, 4, 6,
2016 6, 2, 8, 1, 1, 0, 3, 6, 3, 6,
2020 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2021 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2022 means the default is an error. */
2023 static const yytype_uint16 yydefact[] =
2025 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2026 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2027 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
2028 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2029 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
2030 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
2031 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2032 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2033 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
2034 276, 0, 271, 69, 244, 245, 246, 270, 228, 229,
2035 232, 0, 166, 149, 0, 0, 0, 0, 155, 167,
2036 0, 0, 166, 0, 0, 0, 97, 96, 0, 201,
2037 202, 0, 0, 99, 100, 101, 102, 103, 0, 247,
2038 0, 0, 0, 315, 273, 0, 230, 165, 115, 161,
2039 163, 0, 0, 0, 0, 0, 0, 154, 0, 0,
2040 147, 0, 0, 160, 0, 159, 0, 224, 138, 139,
2041 140, 143, 142, 141, 0, 0, 67, 67, 104, 0,
2042 241, 242, 243, 0, 250, 251, 252, 257, 253, 254,
2043 255, 256, 248, 2, 3, 4, 5, 6, 7, 8,
2044 9, 10, 14, 15, 16, 11, 12, 13, 0, 0,
2045 0, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2046 26, 27, 28, 0, 0, 0, 0, 0, 0, 0,
2047 0, 259, 266, 265, 275, 314, 300, 0, 0, 0,
2048 0, 98, 285, 286, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050 272, 98, 289, 0, 313, 231, 158, 0, 123, 67,
2051 67, 157, 0, 168, 0, 123, 67, 67, 0, 205,
2052 186, 187, 182, 184, 183, 185, 188, 181, 177, 178,
2053 0, 0, 0, 0, 180, 179, 218, 0, 277, 249,
2054 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
2055 38, 0, 53, 54, 49, 50, 51, 52, 39, 40,
2056 41, 42, 43, 44, 45, 46, 47, 48, 0, 0,
2057 0, 0, 0, 0, 200, 0, 0, 0, 0, 299,
2058 279, 67, 268, 278, 0, 0, 55, 0, 0, 0,
2059 0, 129, 129, 320, 67, 67, 311, 0, 0, 0,
2060 0, 0, 67, 67, 67, 0, 0, 0, 0, 0,
2061 106, 108, 107, 105, 109, 110, 111, 112, 113, 116,
2062 164, 162, 151, 152, 153, 156, 66, 150, 220, 222,
2063 0, 170, 0, 0, 0, 174, 0, 171, 134, 239,
2064 0, 0, 0, 297, 0, 0, 0, 0, 0, 258,
2065 0, 0, 0, 267, 0, 0, 280, 0, 0, 67,
2066 67, 0, 316, 0, 318, 297, 0, 0, 0, 0,
2067 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
2068 114, 120, 119, 117, 118, 121, 122, 124, 134, 134,
2069 0, 169, 155, 167, 0, 172, 173, 0, 219, 238,
2070 115, 236, 0, 0, 0, 0, 0, 0, 0, 0,
2071 0, 199, 0, 0, 0, 269, 0, 0, 0, 0,
2072 0, 0, 0, 0, 324, 0, 0, 0, 307, 308,
2073 0, 0, 0, 0, 0, 305, 0, 129, 0, 221,
2074 223, 67, 176, 0, 0, 0, 136, 134, 65, 0,
2075 123, 260, 0, 0, 190, 0, 0, 0, 0, 0,
2076 0, 0, 67, 0, 0, 296, 0, 0, 129, 130,
2077 129, 0, 0, 0, 0, 0, 323, 301, 302, 296,
2078 0, 321, 67, 206, 175, 131, 137, 135, 64, 235,
2079 237, 115, 132, 0, 0, 298, 0, 196, 0, 0,
2080 192, 193, 189, 0, 0, 115, 115, 0, 303, 304,
2081 317, 319, 0, 0, 306, 309, 310, 0, 129, 65,
2082 133, 127, 194, 195, 0, 0, 0, 0, 0, 0,
2083 0, 123, 0, 290, 0, 123, 322, 234, 0, 125,
2084 191, 197, 198, 0, 283, 0, 0, 106, 108, 115,
2085 115, 0, 115, 115, 291, 312, 128, 0, 240, 281,
2086 0, 282, 0, 293, 292, 0, 0, 0, 126, 0,
2087 0, 0, 115, 115, 0, 0, 0, 295, 294, 288,
2091 /* YYDEFGOTO[NTERM-NUM]. */
2092 static const yytype_int16 yydefgoto[] =
2094 -1, 218, 219, 220, 301, 318, 164, 165, 78, 539,
2095 113, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2096 118, 128, 369, 256, 437, 372, 608, 589, 412, 496,
2097 571, 448, 497, 80, 166, 139, 156, 140, 141, 110,
2098 324, 221, 325, 121, 87, 157, 16, 17, 18, 20,
2099 19, 388, 438, 439, 62, 23, 60, 101, 451, 452,
2100 129, 172, 54, 96, 55, 48, 290, 222, 82, 224,
2101 332, 333, 56, 92, 93, 250, 596, 134, 346, 557,
2102 456, 251, 252, 253, 254
2105 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2107 #define YYPACT_NINF -536
2108 static const yytype_int16 yypact[] =
2110 369, -536, -536, -536, -536, -536, -536, -536, 39, -128,
2111 -20, -82, 67, -9, 258, -536, 177, 506, -536, 239,
2112 226, 57, 78, -536, 22, 214, -536, 1572, -536, -536,
2113 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2114 -35, -35, 244, -536, -536, -536, -536, -35, -536, -536,
2115 -536, -536, -536, -35, 15, -536, -2, 221, 232, 235,
2116 -536, -536, -536, -536, -536, 99, -536, -536, -536, -536,
2117 -536, -536, -536, -536, 262, 268, 8, 35, -536, -536,
2118 -536, -26, -536, 225, 225, 265, -536, 128, 233, 233,
2119 208, 254, -536, 256, -536, -536, -536, -536, -536, -536,
2120 -536, -22, 1126, -536, 161, 165, 815, 99, -536, -26,
2121 -91, 174, 1126, 171, 128, 128, -536, -536, 1372, -536,
2122 -536, 1612, 324, -536, -536, -536, -536, -536, 1652, -536,
2123 -6, 293, 906, 1867, -536, 313, -536, -536, -26, -536,
2124 181, 184, 1692, 1692, 179, -84, 1692, -536, 338, 190,
2125 -536, 1612, 1692, 99, 192, -26, 410, -536, 223, 336,
2126 343, 347, 351, 352, 204, 353, 1182, 309, -536, 126,
2127 -536, -536, -536, 906, -536, -536, -536, -536, -536, -536,
2128 -536, -536, 304, -536, -536, -536, -536, -536, -536, -536,
2129 -536, -536, -536, -536, -536, -536, -536, -536, 511, 491,
2130 216, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2131 -536, -536, -536, 218, 219, 220, 222, 1612, 231, 234,
2132 238, -536, -536, -536, -536, -536, -536, 310, 1732, 50,
2133 364, 233, -536, -536, 511, 491, 1692, 1692, 1692, 1692,
2134 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692,
2135 -536, 233, -536, 79, -536, -536, 210, 1452, -536, -25,
2136 -31, -536, 242, -26, 252, -536, 309, 2, 1372, -536,
2137 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2138 1412, 1772, 855, 362, -536, -536, -536, 259, -536, -536,
2139 363, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2140 -536, 260, -536, -536, -536, -536, -536, -536, -536, -536,
2141 -536, -536, -536, -536, -536, -536, -536, -536, 263, 1612,
2142 1612, 1612, 1612, 1612, -536, -42, 1612, 1612, 1612, -536,
2143 99, 766, -536, 255, 906, 906, -536, 906, 1652, 1692,
2144 1692, 20, 45, -536, 766, -29, 264, 270, 271, 272,
2145 276, 281, 766, 766, 766, 385, 1652, 1692, 1692, 433,
2146 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2147 -536, -536, -37, -536, -536, -536, -536, -37, -536, 171,
2148 404, -536, -7, 1080, -30, -536, -66, -536, 290, 1492,
2149 294, 1612, 1612, -536, 295, 297, 298, 299, 1612, -536,
2150 300, 305, 421, -536, 1692, 306, -536, 308, 906, 766,
2151 766, 10, -536, 26, -536, -536, 906, 311, 1692, 1692,
2152 1692, 1692, 1692, 315, 316, 317, 1692, 906, 766, 318,
2153 -536, -536, -536, -536, -536, -536, -536, -536, 290, 290,
2154 1692, -536, 312, 1035, -47, -536, -536, 42, -536, -536,
2155 -26, 321, 325, 444, 322, 327, 133, 1612, 1612, 1612,
2156 1612, -536, 1612, 1612, 1692, -536, 462, 463, 331, 329,
2157 330, 906, 482, 906, 332, 333, 906, 334, -26, -536,
2158 335, 337, 490, 906, 906, -26, 344, 340, 1692, -536,
2159 -536, 38, -536, 341, 475, 498, -536, 290, 115, 1532,
2160 -536, -536, 1612, 1612, -536, 1692, 349, 354, 356, 360,
2161 355, 366, 53, 906, 906, 1812, 906, 906, 340, -536,
2162 340, 906, 361, 1692, 1692, 1692, -536, -536, -536, 1812,
2163 468, -536, 766, -536, -536, -536, -536, -536, -536, -536,
2164 -536, -26, 5, 374, 380, -536, 1612, -536, 1612, 1612,
2165 -536, -536, -536, 367, 376, 33, -26, 166, -536, -536,
2166 -536, -536, 375, 906, -536, -536, -536, 170, 340, 115,
2167 -536, 485, -536, -536, 386, 387, 388, 525, 3, 623,
2168 623, -536, 1852, -536, 383, -536, -536, -536, 540, 397,
2169 -536, -536, -536, 906, -536, 1323, 7, 396, 398, -536,
2170 -536, 27, 33, -26, -536, -37, -536, 527, -536, -536,
2171 400, -536, 1323, 210, 210, 535, 623, 623, -536, 536,
2172 401, 906, -536, -536, 906, 542, 489, 210, 210, -536,
2173 906, 547, -536, 906, -536
2176 /* YYPGOTO[NTERM-NUM]. */
2177 static const yytype_int16 yypgoto[] =
2179 -536, 434, 435, 437, 339, 346, -229, -536, 0, -3,
2180 -126, 478, 13, -536, -536, -536, -536, 28, -536, -536,
2181 -536, -207, -536, -444, -536, -263, -536, -536, -337, 30,
2182 -536, -407, -536, -536, -24, 319, -108, -536, 466, 473,
2183 -81, -150, -247, 88, 229, 314, -536, -536, 557, -536,
2184 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2185 494, -536, -536, -536, -536, -536, -536, -535, -70, 104,
2186 -234, -536, -536, 528, -536, -536, -536, -536, -536, 56,
2187 198, -536, -536, -536, -536
2190 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2191 positive, shift that token. If negative, reduce the rule which
2192 number is the opposite. If zero, do what YYDEFACT says.
2193 If YYTABLE_NINF, syntax error. */
2194 #define YYTABLE_NINF -209
2195 static const yytype_int16 yytable[] =
2197 11, 337, 377, 81, 343, 414, 498, 347, 348, 349,
2198 350, 351, 105, 13, 336, 355, 284, 11, 336, 90,
2199 169, 471, 170, 111, 338, 111, 24, 94, 111, 111,
2200 13, 489, 490, 382, 384, 386, 90, 473, 25, 494,
2201 167, 286, 63, 64, 356, 107, 66, 67, 68, 69,
2202 70, 71, 72, 109, 1, 2, 111, 3, 4, 5,
2203 610, 334, 223, 472, 146, 615, 91, 335, 83, 84,
2204 266, 146, 26, 147, 111, 88, 494, 620, 138, 472,
2205 262, 89, 109, 91, 73, 27, 269, -144, 138, 398,
2206 537, 21, 111, 11, 155, 495, 285, 569, 446, 111,
2207 431, 432, 433, 223, 155, 434, 22, 111, 398, 435,
2208 436, 579, 580, 398, 37, 38, 39, 493, 259, 260,
2209 399, 112, 263, 112, 429, 398, 112, 112, 267, 416,
2210 -67, 374, 445, 135, 1, 373, 444, 3, 136, 5,
2211 378, 379, 431, 432, 433, 28, 2, 434, 398, 4,
2212 531, 435, 436, 441, 112, 613, 614, 171, 616, 617,
2213 119, 120, 95, 594, 431, 432, 433, 611, 359, 434,
2214 465, 106, 112, 435, 436, 411, -67, 43, 627, 628,
2215 59, 560, 287, 561, 477, -144, 479, 480, 481, -144,
2216 112, 533, 74, 75, 357, 358, 76, 112, 77, 108,
2217 413, -67, 151, 152, 331, 112, 552, 272, 273, 274,
2218 275, 57, 341, 342, 331, 344, 345, 331, 331, 331,
2219 331, 331, 352, 353, 354, 331, -55, -55, -55, -55,
2220 408, 586, 58, 138, 360, 361, 61, 542, 393, 394,
2221 395, 396, 397, 98, 155, 400, 401, 402, 427, 270,
2222 271, 102, 362, 363, 99, 364, 365, 100, 366, 367,
2223 368, 223, 86, 359, 223, 223, 103, 223, 49, 50,
2224 51, 545, 104, 52, 223, 1, 131, 288, 3, 85,
2225 5, 86, 223, 223, 223, 45, 504, 46, 505, 564,
2226 565, 566, 132, 284, 122, 123, 124, 125, 126, 127,
2227 29, 30, 31, 32, 33, 34, 35, 116, 36, 117,
2228 454, 455, 114, 115, 155, 409, 410, 461, 601, 581,
2229 142, 582, 605, 585, 143, 582, 148, 150, 168, 360,
2230 361, 173, 155, 428, 331, 255, 257, 258, 223, 223,
2231 223, 261, 264, 265, 268, -56, 223, 362, 363, 595,
2232 364, 365, -57, 366, 367, 368, -60, 223, 223, 443,
2233 -59, -58, 276, 111, 289, 450, 329, 612, 319, -208,
2234 320, 321, 322, 285, 323, 336, 506, 507, 508, 509,
2235 331, 510, 511, 326, 387, 390, 327, -69, 1, 2,
2236 328, 3, 4, 5, 331, 478, 331, 331, 331, 6,
2237 7, 223, 485, 223, 375, 376, 223, 37, 38, 39,
2238 404, 389, 391, 223, 223, 392, 491, 63, 64, 417,
2239 8, 543, 544, 426, 9, 418, 419, 420, 10, 1,
2240 2, 421, 3, 4, 5, 403, 422, 430, 405, 406,
2241 512, 407, 440, 223, 223, 447, 223, 223, 415, 453,
2242 457, 223, 458, 459, 460, 462, 423, 424, 425, 464,
2243 463, 466, 223, 467, 532, 574, 501, 575, 576, 476,
2244 482, 483, 484, 488, 492, 541, 499, 502, 500, 513,
2245 514, 331, 503, 515, 516, 517, 519, 505, 521, 523,
2246 524, 556, 525, 223, 526, 530, 529, 535, 538, 331,
2247 331, 331, 536, 534, 546, 556, -207, 547, 550, 223,
2248 223, 548, 468, 469, 470, 549, 563, 302, 303, 551,
2249 475, 472, 577, 223, -69, 1, 2, 572, 3, 4,
2250 5, 486, 487, 573, 578, 583, 6, 7, 588, 590,
2251 591, 592, 593, 604, 606, 607, 223, 223, -18, 618,
2252 -19, 223, 621, 624, 223, 619, 625, 8, 603, 630,
2253 223, 9, 631, 223, 633, 10, 587, 247, 248, 538,
2254 249, 133, 570, 339, 44, 518, 371, 520, 149, 145,
2255 522, 340, 380, 130, 97, 567, 0, 527, 528, 304,
2256 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
2257 315, 316, 317, 291, 292, 293, 294, 295, 296, 297,
2258 298, 299, 300, 474, 0, 0, 0, 553, 554, 0,
2259 558, 559, 0, 0, 0, 562, 174, 175, 0, 0,
2260 63, 64, 176, 0, 0, 0, 568, 0, 0, 0,
2261 0, 0, 1, 2, 0, 3, 4, 5, 177, 178,
2262 179, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2263 0, 0, 0, 180, 181, 0, 0, 584, 0, 0,
2264 0, 0, 0, 0, 0, 0, 359, 0, 0, 0,
2265 0, 182, 0, 599, 600, 0, 0, 0, 0, 0,
2266 0, 0, 0, 0, 0, 0, 0, 609, 183, 184,
2267 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2268 195, 196, 197, 198, 199, 0, 0, 0, 0, 0,
2269 622, 623, 0, 0, 0, 626, 0, 0, 629, 0,
2270 0, 0, 0, 0, 632, 0, 0, 634, 0, 0,
2271 200, 201, 597, 598, 204, 205, 206, 207, 208, 209,
2272 210, 211, 212, 0, 213, 0, 214, 215, 216, 0,
2273 362, 363, 0, 364, 365, 0, 366, 367, 368, 174,
2274 175, 0, 0, 63, 64, 176, 0, 0, 0, 0,
2275 0, 0, 0, 0, 217, 1, 2, 0, 3, 4,
2276 5, 177, 178, 179, 0, 0, 0, 0, 0, 0,
2277 0, 0, 0, 0, 0, 0, 180, 181, 0, 0,
2278 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2279 111, 0, 63, 64, 182, 107, 66, 67, 68, 69,
2280 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2281 0, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2282 192, 193, 194, 195, 196, 197, 198, 199, 0, 0,
2283 0, 0, 63, 64, 73, 107, 158, 159, 160, 161,
2284 162, 163, 72, 0, 1, 2, 0, 3, 4, 5,
2285 0, 0, 0, 200, 201, 202, 203, 204, 205, 206,
2286 207, 208, 209, 210, 211, 212, 0, 213, 0, 214,
2287 215, 216, 0, 0, 73, 0, 0, 0, 0, 174,
2288 175, 0, 0, 63, 64, 176, 0, 0, 112, 0,
2289 0, 0, 0, 0, 0, 1, 2, 217, 3, 4,
2290 5, 177, 178, 179, 0, 0, 0, 0, 0, 0,
2291 0, 0, 0, 0, 0, 0, 180, 181, 0, 0,
2292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2293 0, 0, 0, 0, 182, 0, 0, 0, 0, 0,
2294 0, 0, 74, 75, 0, 0, 76, 0, 77, 144,
2295 0, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2296 192, 193, 194, 195, 196, 197, 198, 199, 0, 0,
2297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2298 0, 0, 74, 75, 0, 0, 76, 0, 77, 385,
2299 0, 0, 0, 200, 201, 202, 203, 204, 205, 206,
2300 207, 208, 209, 210, 211, 212, 0, 213, 0, 214,
2301 215, 216, 63, 64, 0, 0, 0, 0, 0, 0,
2302 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
2303 277, 0, 0, 0, 0, 0, 0, 217, 0, 0,
2304 0, 0, 0, 0, 0, 278, 279, 0, 0, 0,
2305 0, 0, 0, 0, 0, 0, 0, 63, 64, 111,
2306 107, 158, 159, 160, 161, 162, 163, 72, 0, 1,
2307 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2308 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2309 193, 194, 195, 196, 197, 198, 199, 0, 0, 73,
2310 0, 0, 0, 63, 64, 0, 107, 66, 67, 68,
2311 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2312 5, 0, 200, 201, 202, 203, 204, 205, 206, 207,
2313 208, 209, 210, 211, 212, 137, 213, 0, 214, 215,
2314 216, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2315 0, 0, 0, 0, 0, 0, 0, 112, 0, 63,
2316 64, -67, 0, 280, 0, 0, 281, 0, 282, 0,
2317 283, 1, 2, 0, 3, 4, 5, 277, 0, 0,
2318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 278, 279, 0, 0, 0, 0, 0, 0,
2320 0, 0, 0, 0, 0, 0, 111, 74, 75, 0,
2321 0, 76, 0, 77, 442, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 183, 184, 185,
2323 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2324 196, 197, 198, 199, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2326 0, 0, 0, 0, 0, 0, 0, 0, 0, 200,
2327 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2328 211, 212, 0, 213, 0, 214, 215, 216, 0, 0,
2329 0, 0, 0, 0, 0, 0, 174, 175, 0, 0,
2330 0, 0, 176, 0, 112, 0, 0, 0, 0, 0,
2331 280, 0, 0, 281, 0, 282, 0, 283, 177, 178,
2332 179, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2333 0, 0, 0, 180, 181, 0, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
2335 64, 182, 153, 66, 67, 68, 69, 70, 71, 72,
2336 0, 1, 2, 0, 3, 4, 5, 0, 183, 184,
2337 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2338 195, 196, 197, 198, 199, 0, 0, 0, 0, 63,
2339 64, 73, 107, 158, 159, 160, 161, 162, 163, 72,
2340 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2341 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2342 210, 211, 212, 0, 213, 0, 214, 215, 216, 63,
2343 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2344 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2345 0, 0, 0, 0, 217, 0, 0, 0, 0, 0,
2346 0, 370, 0, 0, 0, 154, 0, 0, 0, 63,
2347 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2348 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2350 75, 449, 0, 76, 0, 77, 0, 0, 0, 63,
2351 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2352 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2354 75, 540, 381, 76, 0, 77, 0, 0, 0, 63,
2355 64, 73, 65, 66, 67, 68, 69, 70, 71, 72,
2356 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2357 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2358 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2359 64, 73, 107, 158, 159, 160, 161, 162, 163, 72,
2360 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2361 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2362 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2363 64, 73, 153, 66, 67, 68, 69, 70, 71, 72,
2364 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2365 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2366 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2367 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2368 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2370 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2371 64, 73, 330, 66, 67, 68, 69, 70, 71, 72,
2372 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2374 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2375 64, 73, 107, 158, 159, 160, 161, 162, 163, 72,
2376 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2378 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2379 64, 73, 107, 66, 67, 68, 69, 70, 71, 555,
2380 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2382 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2383 64, 73, 107, 66, 67, 68, 69, 70, 71, 602,
2384 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2385 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2386 75, 0, 0, 76, 0, 77, 0, 0, 0, 0,
2387 0, 73, 0, 225, 0, 0, 0, 0, 0, 0,
2388 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2389 0, 0, 0, 226, 227, 0, 0, 0, 0, 74,
2390 75, 0, 0, 76, 0, 383, 228, 229, 230, 231,
2391 232, 233, 183, 184, 185, 186, 187, 188, 189, 190,
2392 191, 192, 193, 194, 195, 196, 197, 234, 235, 0,
2393 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2394 75, 0, 0, 76, 0, 77, 0, 0, 0, 236,
2395 237, 238, 0, 0, 239, 201, 202, 203, 204, 205,
2396 206, 207, 208, 209, 210, 211, 212, 240, 241, 242,
2397 243, 244, 245, 246, 0, 0, 0, 0, 0, 74,
2401 static const yytype_int16 yycheck[] =
2403 0, 230, 265, 27, 238, 342, 450, 241, 242, 243,
2404 244, 245, 4, 0, 11, 249, 166, 17, 11, 21,
2405 128, 11, 28, 54, 231, 54, 154, 29, 54, 54,
2406 17, 438, 439, 280, 281, 282, 21, 11, 58, 34,
2407 121, 167, 7, 8, 251, 10, 11, 12, 13, 14,
2408 15, 16, 17, 77, 19, 20, 54, 22, 23, 24,
2409 595, 11, 132, 53, 155, 38, 68, 17, 40, 41,
2410 151, 155, 154, 164, 54, 47, 34, 612, 102, 53,
2411 164, 53, 106, 68, 49, 18, 156, 54, 112, 155,
2412 497, 52, 54, 93, 118, 53, 166, 541, 164, 54,
2413 137, 138, 139, 173, 128, 142, 67, 54, 155, 146,
2414 147, 555, 556, 155, 149, 150, 151, 164, 142, 143,
2415 162, 152, 146, 152, 358, 155, 152, 152, 152, 158,
2416 156, 162, 162, 155, 19, 160, 383, 22, 160, 24,
2417 266, 267, 137, 138, 139, 154, 20, 142, 155, 23,
2418 487, 146, 147, 160, 152, 599, 600, 163, 602, 603,
2419 32, 33, 164, 160, 137, 138, 139, 160, 53, 142,
2420 404, 163, 152, 146, 147, 155, 156, 0, 622, 623,
2421 158, 518, 169, 520, 418, 152, 420, 421, 422, 156,
2422 152, 153, 157, 158, 115, 116, 161, 152, 163, 164,
2423 155, 156, 114, 115, 228, 152, 153, 3, 4, 5,
2424 6, 154, 236, 237, 238, 239, 240, 241, 242, 243,
2425 244, 245, 246, 247, 248, 249, 3, 4, 5, 6,
2426 338, 568, 154, 257, 119, 120, 22, 500, 319, 320,
2427 321, 322, 323, 22, 268, 326, 327, 328, 356, 26,
2428 27, 152, 137, 138, 22, 140, 141, 22, 143, 144,
2429 145, 331, 37, 53, 334, 335, 4, 337, 42, 43,
2430 44, 505, 4, 47, 344, 19, 68, 173, 22, 35,
2431 24, 37, 352, 353, 354, 46, 153, 48, 155, 523,
2432 524, 525, 38, 443, 61, 62, 63, 64, 65, 66,
2433 42, 43, 44, 45, 46, 47, 48, 42, 50, 44,
2434 391, 392, 83, 84, 338, 339, 340, 398, 581, 153,
2435 159, 155, 585, 153, 159, 155, 152, 156, 4, 119,
2436 120, 38, 356, 357, 358, 22, 155, 153, 408, 409,
2437 410, 162, 4, 153, 152, 9, 416, 137, 138, 578,
2438 140, 141, 9, 143, 144, 145, 9, 427, 428, 383,
2439 9, 9, 9, 54, 60, 389, 56, 596, 152, 0,
2440 152, 152, 152, 443, 152, 11, 457, 458, 459, 460,
2441 404, 462, 463, 152, 22, 22, 152, 18, 19, 20,
2442 152, 22, 23, 24, 418, 419, 420, 421, 422, 30,
2443 31, 471, 426, 473, 162, 153, 476, 149, 150, 151,
2444 155, 152, 152, 483, 484, 152, 440, 7, 8, 155,
2445 51, 502, 503, 38, 55, 155, 155, 155, 59, 19,
2446 20, 155, 22, 23, 24, 331, 155, 4, 334, 335,
2447 464, 337, 38, 513, 514, 155, 516, 517, 344, 155,
2448 155, 521, 155, 155, 155, 155, 352, 353, 354, 38,
2449 155, 155, 532, 155, 488, 546, 22, 548, 549, 158,
2450 155, 155, 155, 155, 162, 499, 155, 155, 153, 17,
2451 17, 505, 155, 152, 155, 155, 4, 155, 155, 155,
2452 155, 515, 155, 563, 4, 155, 152, 22, 498, 523,
2453 524, 525, 4, 162, 155, 529, 0, 153, 153, 579,
2454 580, 155, 408, 409, 410, 155, 155, 26, 27, 153,
2455 416, 53, 155, 593, 18, 19, 20, 153, 22, 23,
2456 24, 427, 428, 153, 158, 160, 30, 31, 53, 153,
2457 153, 153, 17, 160, 4, 148, 616, 617, 152, 22,
2458 152, 621, 17, 17, 624, 155, 155, 51, 582, 17,
2459 630, 55, 73, 633, 17, 59, 569, 133, 133, 569,
2460 133, 93, 542, 234, 17, 471, 257, 473, 112, 106,
2461 476, 235, 268, 89, 56, 529, -1, 483, 484, 98,
2462 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2463 109, 110, 111, 92, 93, 94, 95, 96, 97, 98,
2464 99, 100, 101, 415, -1, -1, -1, 513, 514, -1,
2465 516, 517, -1, -1, -1, 521, 3, 4, -1, -1,
2466 7, 8, 9, -1, -1, -1, 532, -1, -1, -1,
2467 -1, -1, 19, 20, -1, 22, 23, 24, 25, 26,
2468 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2469 -1, -1, -1, 40, 41, -1, -1, 563, -1, -1,
2470 -1, -1, -1, -1, -1, -1, 53, -1, -1, -1,
2471 -1, 58, -1, 579, 580, -1, -1, -1, -1, -1,
2472 -1, -1, -1, -1, -1, -1, -1, 593, 75, 76,
2473 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2474 87, 88, 89, 90, 91, -1, -1, -1, -1, -1,
2475 616, 617, -1, -1, -1, 621, -1, -1, 624, -1,
2476 -1, -1, -1, -1, 630, -1, -1, 633, -1, -1,
2477 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2478 127, 128, 129, -1, 131, -1, 133, 134, 135, -1,
2479 137, 138, -1, 140, 141, -1, 143, 144, 145, 3,
2480 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
2481 -1, -1, -1, -1, 161, 19, 20, -1, 22, 23,
2482 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2483 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2484 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2485 54, -1, 7, 8, 58, 10, 11, 12, 13, 14,
2486 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2487 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2488 84, 85, 86, 87, 88, 89, 90, 91, -1, -1,
2489 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2490 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2491 -1, -1, -1, 117, 118, 119, 120, 121, 122, 123,
2492 124, 125, 126, 127, 128, 129, -1, 131, -1, 133,
2493 134, 135, -1, -1, 49, -1, -1, -1, -1, 3,
2494 4, -1, -1, 7, 8, 9, -1, -1, 152, -1,
2495 -1, -1, -1, -1, -1, 19, 20, 161, 22, 23,
2496 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2497 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2498 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2499 -1, -1, -1, -1, 58, -1, -1, -1, -1, -1,
2500 -1, -1, 157, 158, -1, -1, 161, -1, 163, 164,
2501 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2502 84, 85, 86, 87, 88, 89, 90, 91, -1, -1,
2503 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2504 -1, -1, 157, 158, -1, -1, 161, -1, 163, 164,
2505 -1, -1, -1, 117, 118, 119, 120, 121, 122, 123,
2506 124, 125, 126, 127, 128, 129, -1, 131, -1, 133,
2507 134, 135, 7, 8, -1, -1, -1, -1, -1, -1,
2508 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
2509 25, -1, -1, -1, -1, -1, -1, 161, -1, -1,
2510 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2511 -1, -1, -1, -1, -1, -1, -1, 7, 8, 54,
2512 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2513 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2514 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2515 85, 86, 87, 88, 89, 90, 91, -1, -1, 49,
2516 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2517 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2518 24, -1, 117, 118, 119, 120, 121, 122, 123, 124,
2519 125, 126, 127, 128, 129, 39, 131, -1, 133, 134,
2520 135, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2521 -1, -1, -1, -1, -1, -1, -1, 152, -1, 7,
2522 8, 156, -1, 158, -1, -1, 161, -1, 163, -1,
2523 165, 19, 20, -1, 22, 23, 24, 25, -1, -1,
2524 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2525 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2526 -1, -1, -1, -1, -1, -1, 54, 157, 158, -1,
2527 -1, 161, -1, 163, 164, -1, -1, -1, -1, -1,
2528 -1, -1, -1, -1, -1, -1, -1, 75, 76, 77,
2529 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2530 88, 89, 90, 91, -1, -1, -1, -1, -1, -1,
2531 -1, -1, -1, 157, 158, -1, -1, 161, -1, 163,
2532 -1, -1, -1, -1, -1, -1, -1, -1, -1, 117,
2533 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2534 128, 129, -1, 131, -1, 133, 134, 135, -1, -1,
2535 -1, -1, -1, -1, -1, -1, 3, 4, -1, -1,
2536 -1, -1, 9, -1, 152, -1, -1, -1, -1, -1,
2537 158, -1, -1, 161, -1, 163, -1, 165, 25, 26,
2538 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2539 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2540 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2541 8, 58, 10, 11, 12, 13, 14, 15, 16, 17,
2542 -1, 19, 20, -1, 22, 23, 24, -1, 75, 76,
2543 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2544 87, 88, 89, 90, 91, -1, -1, -1, -1, 7,
2545 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2546 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2547 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2548 127, 128, 129, -1, 131, -1, 133, 134, 135, 7,
2549 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2550 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2551 -1, -1, -1, -1, 161, -1, -1, -1, -1, -1,
2552 -1, 39, -1, -1, -1, 123, -1, -1, -1, 7,
2553 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2554 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2555 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2556 158, 39, -1, 161, -1, 163, -1, -1, -1, 7,
2557 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2558 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2559 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2560 158, 39, 160, 161, -1, 163, -1, -1, -1, 7,
2561 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2562 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2563 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2564 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2565 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2566 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2567 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2568 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2569 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2570 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2571 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2572 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2573 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2574 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2575 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2576 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2577 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2578 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2579 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2580 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2581 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2582 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2583 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2584 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2585 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2586 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2587 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2588 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2589 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2590 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2591 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2592 158, -1, -1, 161, -1, 163, -1, -1, -1, -1,
2593 -1, 49, -1, 36, -1, -1, -1, -1, -1, -1,
2594 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2595 -1, -1, -1, 56, 57, -1, -1, -1, -1, 157,
2596 158, -1, -1, 161, -1, 163, 69, 70, 71, 72,
2597 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2598 83, 84, 85, 86, 87, 88, 89, 90, 91, -1,
2599 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2600 158, -1, -1, 161, -1, 163, -1, -1, -1, 112,
2601 113, 114, -1, -1, 117, 118, 119, 120, 121, 122,
2602 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2603 133, 134, 135, 136, -1, -1, -1, -1, -1, 157,
2604 158, -1, -1, 161, -1, 163
2607 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2608 symbol of state STATE-NUM. */
2609 static const yytype_uint8 yystos[] =
2611 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2612 59, 174, 177, 178, 179, 180, 212, 213, 214, 216,
2613 215, 52, 67, 221, 154, 58, 154, 18, 154, 42,
2614 43, 44, 45, 46, 47, 48, 50, 149, 150, 151,
2615 181, 182, 183, 0, 214, 46, 48, 184, 231, 42,
2616 43, 44, 47, 185, 228, 230, 238, 154, 154, 158,
2617 222, 22, 220, 7, 8, 10, 11, 12, 13, 14,
2618 15, 16, 17, 49, 157, 158, 161, 163, 174, 178,
2619 199, 200, 234, 183, 183, 35, 37, 210, 183, 183,
2620 21, 68, 239, 240, 29, 164, 229, 239, 22, 22,
2621 22, 223, 152, 4, 4, 4, 163, 10, 164, 200,
2622 205, 54, 152, 176, 210, 210, 42, 44, 186, 32,
2623 33, 209, 61, 62, 63, 64, 65, 66, 187, 226,
2624 226, 68, 38, 177, 243, 155, 160, 39, 200, 201,
2625 203, 204, 159, 159, 164, 205, 155, 164, 152, 204,
2626 156, 209, 209, 10, 123, 200, 202, 211, 11, 12,
2627 13, 14, 15, 16, 172, 173, 200, 206, 4, 202,
2628 28, 163, 227, 38, 3, 4, 9, 25, 26, 27,
2629 40, 41, 58, 75, 76, 77, 78, 79, 80, 81,
2630 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2631 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2632 127, 128, 129, 131, 133, 134, 135, 161, 167, 168,
2633 169, 207, 233, 234, 235, 36, 56, 57, 69, 70,
2634 71, 72, 73, 74, 90, 91, 112, 113, 114, 117,
2635 130, 131, 132, 133, 134, 135, 136, 167, 168, 169,
2636 241, 247, 248, 249, 250, 22, 189, 155, 153, 200,
2637 200, 162, 164, 200, 4, 153, 206, 200, 152, 234,
2638 26, 27, 3, 4, 5, 6, 9, 25, 40, 41,
2639 158, 161, 163, 165, 207, 234, 176, 178, 235, 60,
2640 232, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2641 101, 170, 26, 27, 98, 99, 100, 101, 102, 103,
2642 104, 105, 106, 107, 108, 109, 110, 111, 171, 152,
2643 152, 152, 152, 152, 206, 208, 152, 152, 152, 56,
2644 10, 200, 236, 237, 11, 17, 11, 172, 187, 170,
2645 171, 200, 200, 236, 200, 200, 244, 236, 236, 236,
2646 236, 236, 200, 200, 200, 236, 187, 115, 116, 53,
2647 119, 120, 137, 138, 140, 141, 143, 144, 145, 188,
2648 39, 201, 191, 160, 162, 162, 153, 191, 176, 176,
2649 211, 160, 208, 163, 208, 164, 208, 22, 217, 152,
2650 22, 152, 152, 206, 206, 206, 206, 206, 155, 162,
2651 206, 206, 206, 235, 155, 235, 235, 235, 202, 200,
2652 200, 155, 194, 155, 194, 235, 158, 155, 155, 155,
2653 155, 155, 155, 235, 235, 235, 38, 202, 200, 236,
2654 4, 137, 138, 139, 142, 146, 147, 190, 218, 219,
2655 38, 160, 164, 200, 208, 162, 164, 155, 197, 39,
2656 200, 224, 225, 155, 206, 206, 246, 155, 155, 155,
2657 155, 206, 155, 155, 38, 236, 155, 155, 235, 235,
2658 235, 11, 53, 11, 246, 235, 158, 236, 200, 236,
2659 236, 236, 155, 155, 155, 200, 235, 235, 155, 197,
2660 197, 200, 162, 164, 34, 53, 195, 198, 189, 155,
2661 153, 22, 155, 155, 153, 155, 206, 206, 206, 206,
2662 206, 206, 200, 17, 17, 152, 155, 155, 235, 4,
2663 235, 155, 235, 155, 155, 155, 4, 235, 235, 152,
2664 155, 194, 200, 153, 162, 22, 4, 197, 174, 175,
2665 39, 200, 191, 206, 206, 236, 155, 153, 155, 155,
2666 153, 153, 153, 235, 235, 17, 200, 245, 235, 235,
2667 194, 194, 235, 155, 236, 236, 236, 245, 235, 189,
2668 195, 196, 153, 153, 206, 206, 206, 155, 158, 189,
2669 189, 153, 155, 160, 235, 153, 194, 175, 53, 193,
2670 153, 153, 153, 17, 160, 172, 242, 119, 120, 235,
2671 235, 191, 17, 200, 160, 191, 4, 148, 192, 235,
2672 233, 160, 172, 189, 189, 38, 189, 189, 22, 155,
2673 233, 17, 235, 235, 17, 155, 235, 189, 189, 235,
2674 17, 73, 235, 17, 235
2677 #define yyerrok (yyerrstatus = 0)
2678 #define yyclearin (yychar = YYEMPTY)
2679 #define YYEMPTY (-2)
2682 #define YYACCEPT goto yyacceptlab
2683 #define YYABORT goto yyabortlab
2684 #define YYERROR goto yyerrorlab
2687 /* Like YYERROR except do call yyerror. This remains here temporarily
2688 to ease the transition to the new meaning of YYERROR, for GCC.
2689 Once GCC version 2 has supplanted version 1, this can go. */
2691 #define YYFAIL goto yyerrlab
2693 #define YYRECOVERING() (!!yyerrstatus)
2695 #define YYBACKUP(Token, Value) \
2697 if (yychar == YYEMPTY && yylen == 1) \
2701 yytoken = YYTRANSLATE (yychar); \
2707 yyerror (YY_("syntax error: cannot back up")); \
2714 #define YYERRCODE 256
2717 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2718 If N is 0, then set CURRENT to the empty location which ends
2719 the previous symbol: RHS[0] (always defined). */
2721 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2722 #ifndef YYLLOC_DEFAULT
2723 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2727 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2728 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2729 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2730 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2734 (Current).first_line = (Current).last_line = \
2735 YYRHSLOC (Rhs, 0).last_line; \
2736 (Current).first_column = (Current).last_column = \
2737 YYRHSLOC (Rhs, 0).last_column; \
2743 /* YY_LOCATION_PRINT -- Print the location on the stream.
2744 This macro was not mandated originally: define only if we know
2745 we won't break user code: when these are the locations we know. */
2747 #ifndef YY_LOCATION_PRINT
2748 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2749 # define YY_LOCATION_PRINT(File, Loc) \
2750 fprintf (File, "%d.%d-%d.%d", \
2751 (Loc).first_line, (Loc).first_column, \
2752 (Loc).last_line, (Loc).last_column)
2754 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2759 /* YYLEX -- calling `yylex' with the right arguments. */
2762 # define YYLEX yylex (YYLEX_PARAM)
2764 # define YYLEX yylex ()
2767 /* Enable debugging if requested. */
2771 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2772 # define YYFPRINTF fprintf
2775 # define YYDPRINTF(Args) \
2781 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2785 YYFPRINTF (stderr, "%s ", Title); \
2786 yy_symbol_print (stderr, \
2788 YYFPRINTF (stderr, "\n"); \
2793 /*--------------------------------.
2794 | Print this symbol on YYOUTPUT. |
2795 `--------------------------------*/
2798 #if (defined __STDC__ || defined __C99__FUNC__ \
2799 || defined __cplusplus || defined _MSC_VER)
2801 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2804 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2807 YYSTYPE const * const yyvaluep;
2813 if (yytype < YYNTOKENS)
2814 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2826 /*--------------------------------.
2827 | Print this symbol on YYOUTPUT. |
2828 `--------------------------------*/
2830 #if (defined __STDC__ || defined __C99__FUNC__ \
2831 || defined __cplusplus || defined _MSC_VER)
2833 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2836 yy_symbol_print (yyoutput, yytype, yyvaluep)
2839 YYSTYPE const * const yyvaluep;
2842 if (yytype < YYNTOKENS)
2843 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2845 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2847 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2848 YYFPRINTF (yyoutput, ")");
2851 /*------------------------------------------------------------------.
2852 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2854 `------------------------------------------------------------------*/
2856 #if (defined __STDC__ || defined __C99__FUNC__ \
2857 || defined __cplusplus || defined _MSC_VER)
2859 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2862 yy_stack_print (bottom, top)
2863 yytype_int16 *bottom;
2867 YYFPRINTF (stderr, "Stack now");
2868 for (; bottom <= top; ++bottom)
2869 YYFPRINTF (stderr, " %d", *bottom);
2870 YYFPRINTF (stderr, "\n");
2873 # define YY_STACK_PRINT(Bottom, Top) \
2876 yy_stack_print ((Bottom), (Top)); \
2880 /*------------------------------------------------.
2881 | Report that the YYRULE is going to be reduced. |
2882 `------------------------------------------------*/
2884 #if (defined __STDC__ || defined __C99__FUNC__ \
2885 || defined __cplusplus || defined _MSC_VER)
2887 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2890 yy_reduce_print (yyvsp, yyrule)
2895 int yynrhs = yyr2[yyrule];
2897 unsigned long int yylno = yyrline[yyrule];
2898 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2900 /* The symbols being reduced. */
2901 for (yyi = 0; yyi < yynrhs; yyi++)
2903 fprintf (stderr, " $%d = ", yyi + 1);
2904 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2905 &(yyvsp[(yyi + 1) - (yynrhs)])
2907 fprintf (stderr, "\n");
2911 # define YY_REDUCE_PRINT(Rule) \
2914 yy_reduce_print (yyvsp, Rule); \
2917 /* Nonzero means print parse trace. It is left uninitialized so that
2918 multiple parsers can coexist. */
2920 #else /* !YYDEBUG */
2921 # define YYDPRINTF(Args)
2922 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2923 # define YY_STACK_PRINT(Bottom, Top)
2924 # define YY_REDUCE_PRINT(Rule)
2925 #endif /* !YYDEBUG */
2928 /* YYINITDEPTH -- initial size of the parser's stacks. */
2930 # define YYINITDEPTH 200
2933 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2934 if the built-in stack extension method is used).
2936 Do not make this value too large; the results are undefined if
2937 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2938 evaluated with infinite-precision integer arithmetic. */
2941 # define YYMAXDEPTH 10000
2949 # if defined __GLIBC__ && defined _STRING_H
2950 # define yystrlen strlen
2952 /* Return the length of YYSTR. */
2953 #if (defined __STDC__ || defined __C99__FUNC__ \
2954 || defined __cplusplus || defined _MSC_VER)
2956 yystrlen (const char *yystr)
2964 for (yylen = 0; yystr[yylen]; yylen++)
2972 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2973 # define yystpcpy stpcpy
2975 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2977 #if (defined __STDC__ || defined __C99__FUNC__ \
2978 || defined __cplusplus || defined _MSC_VER)
2980 yystpcpy (char *yydest, const char *yysrc)
2983 yystpcpy (yydest, yysrc)
2989 const char *yys = yysrc;
2991 while ((*yyd++ = *yys++) != '\0')
3000 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3001 quotes and backslashes, so that it's suitable for yyerror. The
3002 heuristic is that double-quoting is unnecessary unless the string
3003 contains an apostrophe, a comma, or backslash (other than
3004 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3005 null, do not copy; instead, return the length of what the result
3008 yytnamerr (char *yyres, const char *yystr)
3013 char const *yyp = yystr;
3020 goto do_not_strip_quotes;
3024 goto do_not_strip_quotes;
3037 do_not_strip_quotes: ;
3041 return yystrlen (yystr);
3043 return yystpcpy (yyres, yystr) - yyres;
3047 /* Copy into YYRESULT an error message about the unexpected token
3048 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3049 including the terminating null byte. If YYRESULT is null, do not
3050 copy anything; just return the number of bytes that would be
3051 copied. As a special case, return 0 if an ordinary "syntax error"
3052 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3053 size calculation. */
3055 yysyntax_error (char *yyresult, int yystate, int yychar)
3057 int yyn = yypact[yystate];
3059 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3063 int yytype = YYTRANSLATE (yychar);
3064 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3065 YYSIZE_T yysize = yysize0;
3067 int yysize_overflow = 0;
3068 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3069 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3073 /* This is so xgettext sees the translatable formats that are
3074 constructed on the fly. */
3075 YY_("syntax error, unexpected %s");
3076 YY_("syntax error, unexpected %s, expecting %s");
3077 YY_("syntax error, unexpected %s, expecting %s or %s");
3078 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3079 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3083 static char const yyunexpected[] = "syntax error, unexpected %s";
3084 static char const yyexpecting[] = ", expecting %s";
3085 static char const yyor[] = " or %s";
3086 char yyformat[sizeof yyunexpected
3087 + sizeof yyexpecting - 1
3088 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3089 * (sizeof yyor - 1))];
3090 char const *yyprefix = yyexpecting;
3092 /* Start YYX at -YYN if negative to avoid negative indexes in
3094 int yyxbegin = yyn < 0 ? -yyn : 0;
3096 /* Stay within bounds of both yycheck and yytname. */
3097 int yychecklim = YYLAST - yyn + 1;
3098 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3101 yyarg[0] = yytname[yytype];
3102 yyfmt = yystpcpy (yyformat, yyunexpected);
3104 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3105 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3107 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3111 yyformat[sizeof yyunexpected - 1] = '\0';
3114 yyarg[yycount++] = yytname[yyx];
3115 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3116 yysize_overflow |= (yysize1 < yysize);
3118 yyfmt = yystpcpy (yyfmt, yyprefix);
3122 yyf = YY_(yyformat);
3123 yysize1 = yysize + yystrlen (yyf);
3124 yysize_overflow |= (yysize1 < yysize);
3127 if (yysize_overflow)
3128 return YYSIZE_MAXIMUM;
3132 /* Avoid sprintf, as that infringes on the user's name space.
3133 Don't have undefined behavior even if the translation
3134 produced a string with the wrong number of "%s"s. */
3135 char *yyp = yyresult;
3137 while ((*yyp = *yyf) != '\0')
3139 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3141 yyp += yytnamerr (yyp, yyarg[yyi++]);
3154 #endif /* YYERROR_VERBOSE */
3157 /*-----------------------------------------------.
3158 | Release the memory associated to this symbol. |
3159 `-----------------------------------------------*/
3162 #if (defined __STDC__ || defined __C99__FUNC__ \
3163 || defined __cplusplus || defined _MSC_VER)
3165 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3168 yydestruct (yymsg, yytype, yyvaluep)
3178 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3189 /* Prevent warnings from -Wmissing-prototypes. */
3191 #ifdef YYPARSE_PARAM
3192 #if defined __STDC__ || defined __cplusplus
3193 int yyparse (void *YYPARSE_PARAM);
3197 #else /* ! YYPARSE_PARAM */
3198 #if defined __STDC__ || defined __cplusplus
3203 #endif /* ! YYPARSE_PARAM */
3207 /* The look-ahead symbol. */
3210 /* The semantic value of the look-ahead symbol. */
3213 /* Number of syntax errors so far. */
3222 #ifdef YYPARSE_PARAM
3223 #if (defined __STDC__ || defined __C99__FUNC__ \
3224 || defined __cplusplus || defined _MSC_VER)
3226 yyparse (void *YYPARSE_PARAM)
3229 yyparse (YYPARSE_PARAM)
3230 void *YYPARSE_PARAM;
3232 #else /* ! YYPARSE_PARAM */
3233 #if (defined __STDC__ || defined __C99__FUNC__ \
3234 || defined __cplusplus || defined _MSC_VER)
3248 /* Number of tokens to shift before error messages enabled. */
3250 /* Look-ahead token as an internal (translated) token number. */
3253 /* Buffer for error messages, and its allocated size. */
3255 char *yymsg = yymsgbuf;
3256 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3259 /* Three stacks and their tools:
3260 `yyss': related to states,
3261 `yyvs': related to semantic values,
3262 `yyls': related to locations.
3264 Refer to the stacks thru separate pointers, to allow yyoverflow
3265 to reallocate them elsewhere. */
3267 /* The state stack. */
3268 yytype_int16 yyssa[YYINITDEPTH];
3269 yytype_int16 *yyss = yyssa;
3270 yytype_int16 *yyssp;
3272 /* The semantic value stack. */
3273 YYSTYPE yyvsa[YYINITDEPTH];
3274 YYSTYPE *yyvs = yyvsa;
3279 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3281 YYSIZE_T yystacksize = YYINITDEPTH;
3283 /* The variables used to return semantic value and location from the
3288 /* The number of symbols on the RHS of the reduced rule.
3289 Keep to zero when no symbol should be popped. */
3292 YYDPRINTF ((stderr, "Starting parse\n"));
3297 yychar = YYEMPTY; /* Cause a token to be read. */
3299 /* Initialize stack pointers.
3300 Waste one element of value and location stack
3301 so that they stay on the same level as the state stack.
3302 The wasted elements are never initialized. */
3309 /*------------------------------------------------------------.
3310 | yynewstate -- Push a new state, which is found in yystate. |
3311 `------------------------------------------------------------*/
3313 /* In all cases, when you get here, the value and location stacks
3314 have just been pushed. So pushing a state here evens the stacks. */
3320 if (yyss + yystacksize - 1 <= yyssp)
3322 /* Get the current used size of the three stacks, in elements. */
3323 YYSIZE_T yysize = yyssp - yyss + 1;
3327 /* Give user a chance to reallocate the stack. Use copies of
3328 these so that the &'s don't force the real ones into
3330 YYSTYPE *yyvs1 = yyvs;
3331 yytype_int16 *yyss1 = yyss;
3334 /* Each stack pointer address is followed by the size of the
3335 data in use in that stack, in bytes. This used to be a
3336 conditional around just the two extra args, but that might
3337 be undefined if yyoverflow is a macro. */
3338 yyoverflow (YY_("memory exhausted"),
3339 &yyss1, yysize * sizeof (*yyssp),
3340 &yyvs1, yysize * sizeof (*yyvsp),
3347 #else /* no yyoverflow */
3348 # ifndef YYSTACK_RELOCATE
3349 goto yyexhaustedlab;
3351 /* Extend the stack our own way. */
3352 if (YYMAXDEPTH <= yystacksize)
3353 goto yyexhaustedlab;
3355 if (YYMAXDEPTH < yystacksize)
3356 yystacksize = YYMAXDEPTH;
3359 yytype_int16 *yyss1 = yyss;
3360 union yyalloc *yyptr =
3361 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3363 goto yyexhaustedlab;
3364 YYSTACK_RELOCATE (yyss);
3365 YYSTACK_RELOCATE (yyvs);
3367 # undef YYSTACK_RELOCATE
3369 YYSTACK_FREE (yyss1);
3372 #endif /* no yyoverflow */
3374 yyssp = yyss + yysize - 1;
3375 yyvsp = yyvs + yysize - 1;
3378 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3379 (unsigned long int) yystacksize));
3381 if (yyss + yystacksize - 1 <= yyssp)
3385 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3394 /* Do appropriate processing given the current state. Read a
3395 look-ahead token if we need one and don't already have one. */
3397 /* First try to decide what to do without reference to look-ahead token. */
3398 yyn = yypact[yystate];
3399 if (yyn == YYPACT_NINF)
3402 /* Not known => get a look-ahead token if don't already have one. */
3404 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3405 if (yychar == YYEMPTY)
3407 YYDPRINTF ((stderr, "Reading a token: "));
3411 if (yychar <= YYEOF)
3413 yychar = yytoken = YYEOF;
3414 YYDPRINTF ((stderr, "Now at end of input.\n"));
3418 yytoken = YYTRANSLATE (yychar);
3419 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3422 /* If the proper action on seeing token YYTOKEN is to reduce or to
3423 detect an error, take that action. */
3425 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3430 if (yyn == 0 || yyn == YYTABLE_NINF)
3439 /* Count tokens shifted since error; after three, turn off error
3444 /* Shift the look-ahead token. */
3445 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3447 /* Discard the shifted token unless it is eof. */
3448 if (yychar != YYEOF)
3457 /*-----------------------------------------------------------.
3458 | yydefault -- do the default action for the current state. |
3459 `-----------------------------------------------------------*/
3461 yyn = yydefact[yystate];
3467 /*-----------------------------.
3468 | yyreduce -- Do a reduction. |
3469 `-----------------------------*/
3471 /* yyn is the number of a rule to reduce with. */
3474 /* If YYLEN is nonzero, implement the default value of the action:
3477 Otherwise, the following line sets YYVAL to garbage.
3478 This behavior is undocumented and Bison
3479 users should not rely upon it. Assigning to YYVAL
3480 unconditionally makes the parser a bit smaller, and it avoids a
3481 GCC warning that YYVAL may be used uninitialized. */
3482 yyval = yyvsp[1-yylen];
3485 YY_REDUCE_PRINT (yyn);
3489 #line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3490 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3494 #line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3495 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3499 #line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3500 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3504 #line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3505 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3509 #line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3510 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3514 #line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3515 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3519 #line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3520 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3524 #line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3525 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3529 #line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3530 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3534 #line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3535 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3539 #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3540 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3544 #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3545 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3549 #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3550 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3554 #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3555 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3559 #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3560 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3564 #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3565 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3569 #line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3570 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3574 #line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3575 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3579 #line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3580 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3584 #line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3585 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3589 #line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3590 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3594 #line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3595 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3599 #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3600 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3604 #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3605 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3609 #line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3610 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3614 #line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3615 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3619 #line 1143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3620 { (yyval.StrVal) = 0; ;}
3624 #line 1145 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3625 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3629 #line 1146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3630 { (yyval.UIntVal)=0; ;}
3634 #line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3636 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3642 #line 1154 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3650 #line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3658 #line 1167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3660 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3666 #line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3667 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3671 #line 1174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3672 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3676 #line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3677 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3681 #line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3682 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3686 #line 1177 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3687 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3691 #line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3692 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3696 #line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3697 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3701 #line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3702 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3706 #line 1187 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3707 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3711 #line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3712 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3716 #line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3717 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3721 #line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3722 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3726 #line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3727 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3731 #line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3732 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3736 #line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3737 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3741 #line 1200 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3742 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3746 #line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3747 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3751 #line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3752 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3756 #line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3757 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3761 #line 1204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3762 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3766 #line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3767 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3771 #line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3772 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3776 #line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3777 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3781 #line 1213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3782 { (yyval.UIntVal) = CallingConv::C; ;}
3786 #line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3787 { (yyval.UIntVal) = CallingConv::C; ;}
3791 #line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3792 { (yyval.UIntVal) = CallingConv::Fast; ;}
3796 #line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3797 { (yyval.UIntVal) = CallingConv::Cold; ;}
3801 #line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3802 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3806 #line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3807 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3811 #line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3813 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3814 GEN_ERROR("Calling conv too large");
3815 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3821 #line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3822 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3826 #line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3827 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3831 #line 1228 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3832 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3836 #line 1229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3837 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3841 #line 1230 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3842 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3846 #line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3847 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3851 #line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3852 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3856 #line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3857 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3861 #line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3862 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3866 #line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3867 { (yyval.ParamAttrs) =
3868 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3872 #line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3873 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3877 #line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3879 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3884 #line 1245 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3885 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3889 #line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3890 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3894 #line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3895 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3899 #line 1248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3900 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3904 #line 1249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3905 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3909 #line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3910 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3914 #line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3915 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3919 #line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3921 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3926 #line 1259 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3927 { (yyval.StrVal) = 0; ;}
3931 #line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3933 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3938 #line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3939 { (yyval.UIntVal) = 0; ;}
3943 #line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3945 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3946 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3947 GEN_ERROR("Alignment must be a power of two");
3953 #line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3954 { (yyval.UIntVal) = 0; ;}
3958 #line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3960 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3961 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3962 GEN_ERROR("Alignment must be a power of two");
3968 #line 1284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3970 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3971 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3972 GEN_ERROR("Invalid character in section name");
3973 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3979 #line 1292 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3980 { (yyval.StrVal) = 0; ;}
3984 #line 1293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3985 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3989 #line 1298 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3994 #line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3999 #line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4001 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4002 delete (yyvsp[(1) - (1)].StrVal);
4008 #line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4010 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4011 GEN_ERROR("Alignment must be a power of two");
4012 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4018 #line 1321 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4020 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4026 #line 1325 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4028 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4034 #line 1329 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4036 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4037 GEN_ERROR("Cannot form a pointer to a basic block");
4038 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4039 delete (yyvsp[(1) - (3)].TypeVal);
4045 #line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4046 { // Named types are also simple types...
4047 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4049 (yyval.TypeVal) = new PATypeHolder(tmp);
4054 #line 1341 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4055 { // Type UpReference
4056 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4057 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
4058 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4059 (yyval.TypeVal) = new PATypeHolder(OT);
4060 UR_OUT("New Upreference!\n");
4066 #line 1349 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4068 // Allow but ignore attributes on function types; this permits auto-upgrade.
4069 // FIXME: remove in LLVM 3.0.
4070 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4071 if (!FunctionType::isValidReturnType(RetTy))
4072 GEN_ERROR("Invalid result type for LLVM function");
4074 std::vector<const Type*> Params;
4075 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4076 for (; I != E; ++I ) {
4077 const Type *Ty = I->Ty->get();
4078 Params.push_back(Ty);
4081 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4082 if (isVarArg) Params.pop_back();
4084 for (unsigned i = 0; i != Params.size(); ++i)
4085 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4086 GEN_ERROR("Function arguments must be value types!");
4090 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4091 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4092 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4093 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4099 #line 1378 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4101 // Allow but ignore attributes on function types; this permits auto-upgrade.
4102 // FIXME: remove in LLVM 3.0.
4103 std::vector<const Type*> Params;
4104 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4105 for ( ; I != E; ++I ) {
4106 const Type* Ty = I->Ty->get();
4107 Params.push_back(Ty);
4110 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4111 if (isVarArg) Params.pop_back();
4113 for (unsigned i = 0; i != Params.size(); ++i)
4114 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4115 GEN_ERROR("Function arguments must be value types!");
4119 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4120 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4121 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4127 #line 1403 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4128 { // Sized array type?
4129 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4130 delete (yyvsp[(4) - (5)].TypeVal);
4136 #line 1408 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4138 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4139 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4140 GEN_ERROR("Unsigned result not equal to signed result");
4141 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4142 GEN_ERROR("Element type of a VectorType must be primitive");
4143 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4144 delete (yyvsp[(4) - (5)].TypeVal);
4150 #line 1418 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4151 { // Structure type?
4152 std::vector<const Type*> Elements;
4153 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4154 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4155 Elements.push_back(*I);
4157 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4158 delete (yyvsp[(2) - (3)].TypeList);
4164 #line 1428 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4165 { // Empty structure type?
4166 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4172 #line 1432 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4174 std::vector<const Type*> Elements;
4175 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4176 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4177 Elements.push_back(*I);
4179 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4180 delete (yyvsp[(3) - (5)].TypeList);
4186 #line 1442 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4187 { // Empty structure type?
4188 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4194 #line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4196 // Allow but ignore attributes on function types; this permits auto-upgrade.
4197 // FIXME: remove in LLVM 3.0.
4198 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4199 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4204 #line 1458 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4206 if (!UpRefs.empty())
4207 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4208 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4209 GEN_ERROR("LLVM functions cannot return aggregate types");
4210 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4215 #line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4217 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4222 #line 1470 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4224 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4225 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4231 #line 1475 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4233 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4239 #line 1483 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4241 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4242 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4243 TWA.Ty = new PATypeHolder(Type::VoidTy);
4244 (yyval.TypeWithAttrsList)->push_back(TWA);
4250 #line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4252 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4253 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4254 TWA.Ty = new PATypeHolder(Type::VoidTy);
4255 (yyval.TypeWithAttrsList)->push_back(TWA);
4261 #line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4263 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4269 #line 1505 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4271 (yyval.TypeList) = new std::list<PATypeHolder>();
4272 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4273 delete (yyvsp[(1) - (1)].TypeVal);
4279 #line 1511 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4281 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4282 delete (yyvsp[(3) - (3)].TypeVal);
4288 #line 1523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4289 { // Nonempty unsized arr
4290 if (!UpRefs.empty())
4291 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4292 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4294 GEN_ERROR("Cannot make array constant with type: '" +
4295 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4296 const Type *ETy = ATy->getElementType();
4297 int NumElements = ATy->getNumElements();
4299 // Verify that we have the correct size...
4300 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4301 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4302 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4303 itostr(NumElements) + "");
4305 // Verify all elements are correct type!
4306 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4307 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4308 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4309 ETy->getDescription() +"' as required!\nIt is of type '"+
4310 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4313 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4314 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4320 #line 1551 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4322 if (!UpRefs.empty())
4323 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4324 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4326 GEN_ERROR("Cannot make array constant with type: '" +
4327 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4329 int NumElements = ATy->getNumElements();
4330 if (NumElements != -1 && NumElements != 0)
4331 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4332 " arguments, but has size of " + itostr(NumElements) +"");
4333 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4334 delete (yyvsp[(1) - (3)].TypeVal);
4340 #line 1567 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4342 if (!UpRefs.empty())
4343 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4344 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4346 GEN_ERROR("Cannot make array constant with type: '" +
4347 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4349 int NumElements = ATy->getNumElements();
4350 const Type *ETy = ATy->getElementType();
4351 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4352 GEN_ERROR("Can't build string constant of size " +
4353 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4354 " when array has size " + itostr(NumElements) + "");
4355 std::vector<Constant*> Vals;
4356 if (ETy == Type::Int8Ty) {
4357 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4358 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4360 delete (yyvsp[(3) - (3)].StrVal);
4361 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4363 delete (yyvsp[(3) - (3)].StrVal);
4364 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4365 delete (yyvsp[(1) - (3)].TypeVal);
4371 #line 1594 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4372 { // Nonempty unsized arr
4373 if (!UpRefs.empty())
4374 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4375 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4377 GEN_ERROR("Cannot make packed constant with type: '" +
4378 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4379 const Type *ETy = PTy->getElementType();
4380 int NumElements = PTy->getNumElements();
4382 // Verify that we have the correct size...
4383 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4384 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4385 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4386 itostr(NumElements) + "");
4388 // Verify all elements are correct type!
4389 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4390 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4391 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4392 ETy->getDescription() +"' as required!\nIt is of type '"+
4393 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4396 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4397 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4403 #line 1622 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4405 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4407 GEN_ERROR("Cannot make struct constant with type: '" +
4408 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4410 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4411 GEN_ERROR("Illegal number of initializers for structure type");
4413 // Check to ensure that constants are compatible with the type initializer!
4414 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4415 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4416 GEN_ERROR("Expected type '" +
4417 STy->getElementType(i)->getDescription() +
4418 "' for element #" + utostr(i) +
4419 " of structure initializer");
4421 // Check to ensure that Type is not packed
4422 if (STy->isPacked())
4423 GEN_ERROR("Unpacked Initializer to vector type '" +
4424 STy->getDescription() + "'");
4426 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4427 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4433 #line 1648 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4435 if (!UpRefs.empty())
4436 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4437 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4439 GEN_ERROR("Cannot make struct constant with type: '" +
4440 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4442 if (STy->getNumContainedTypes() != 0)
4443 GEN_ERROR("Illegal number of initializers for structure type");
4445 // Check to ensure that Type is not packed
4446 if (STy->isPacked())
4447 GEN_ERROR("Unpacked Initializer to vector type '" +
4448 STy->getDescription() + "'");
4450 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4451 delete (yyvsp[(1) - (3)].TypeVal);
4457 #line 1668 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4459 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4461 GEN_ERROR("Cannot make struct constant with type: '" +
4462 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4464 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4465 GEN_ERROR("Illegal number of initializers for structure type");
4467 // Check to ensure that constants are compatible with the type initializer!
4468 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4469 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4470 GEN_ERROR("Expected type '" +
4471 STy->getElementType(i)->getDescription() +
4472 "' for element #" + utostr(i) +
4473 " of structure initializer");
4475 // Check to ensure that Type is packed
4476 if (!STy->isPacked())
4477 GEN_ERROR("Vector initializer to non-vector type '" +
4478 STy->getDescription() + "'");
4480 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4481 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4487 #line 1694 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4489 if (!UpRefs.empty())
4490 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4491 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4493 GEN_ERROR("Cannot make struct constant with type: '" +
4494 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4496 if (STy->getNumContainedTypes() != 0)
4497 GEN_ERROR("Illegal number of initializers for structure type");
4499 // Check to ensure that Type is packed
4500 if (!STy->isPacked())
4501 GEN_ERROR("Vector initializer to non-vector type '" +
4502 STy->getDescription() + "'");
4504 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4505 delete (yyvsp[(1) - (5)].TypeVal);
4511 #line 1714 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4513 if (!UpRefs.empty())
4514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4515 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4517 GEN_ERROR("Cannot make null pointer constant with type: '" +
4518 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4520 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4521 delete (yyvsp[(1) - (2)].TypeVal);
4527 #line 1726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4529 if (!UpRefs.empty())
4530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4531 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4532 delete (yyvsp[(1) - (2)].TypeVal);
4538 #line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4540 if (!UpRefs.empty())
4541 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4542 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4544 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4546 // ConstExprs can exist in the body of a function, thus creating
4547 // GlobalValues whenever they refer to a variable. Because we are in
4548 // the context of a function, getExistingVal will search the functions
4549 // symbol table instead of the module symbol table for the global symbol,
4550 // which throws things all off. To get around this, we just tell
4551 // getExistingVal that we are at global scope here.
4553 Function *SavedCurFn = CurFun.CurrentFunction;
4554 CurFun.CurrentFunction = 0;
4556 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4559 CurFun.CurrentFunction = SavedCurFn;
4561 // If this is an initializer for a constant pointer, which is referencing a
4562 // (currently) undefined variable, create a stub now that shall be replaced
4563 // in the future with the right type of variable.
4566 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4567 const PointerType *PT = cast<PointerType>(Ty);
4569 // First check to see if the forward references value is already created!
4570 PerModuleInfo::GlobalRefsType::iterator I =
4571 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4573 if (I != CurModule.GlobalRefs.end()) {
4574 V = I->second; // Placeholder already exists, use it...
4575 (yyvsp[(2) - (2)].ValIDVal).destroy();
4578 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4579 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4580 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4581 GEN_ERROR("Invalid reference to global");
4583 // Create the forward referenced global.
4585 if (const FunctionType *FTy =
4586 dyn_cast<FunctionType>(PT->getElementType())) {
4587 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4588 CurModule.CurrentModule);
4590 GV = new GlobalVariable(PT->getElementType(), false,
4591 GlobalValue::ExternalWeakLinkage, 0,
4592 Name, CurModule.CurrentModule);
4595 // Keep track of the fact that we have a forward ref to recycle it
4596 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4601 (yyval.ConstVal) = cast<GlobalValue>(V);
4602 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4608 #line 1799 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4610 if (!UpRefs.empty())
4611 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4612 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4613 GEN_ERROR("Mismatched types for constant expression: " +
4614 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4615 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4616 delete (yyvsp[(1) - (2)].TypeVal);
4622 #line 1809 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4624 if (!UpRefs.empty())
4625 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4626 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4627 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4628 GEN_ERROR("Cannot create a null initialized value of this type");
4629 (yyval.ConstVal) = Constant::getNullValue(Ty);
4630 delete (yyvsp[(1) - (2)].TypeVal);
4636 #line 1819 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4637 { // integral constants
4638 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4639 GEN_ERROR("Constant value doesn't fit in type");
4640 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4646 #line 1825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4647 { // arbitrary precision integer constants
4648 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4649 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4650 GEN_ERROR("Constant value does not fit in type");
4652 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4653 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4654 delete (yyvsp[(2) - (2)].APIntVal);
4660 #line 1835 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4661 { // integral constants
4662 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4663 GEN_ERROR("Constant value doesn't fit in type");
4664 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4670 #line 1841 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4671 { // arbitrary precision integer constants
4672 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4673 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4674 GEN_ERROR("Constant value does not fit in type");
4676 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4677 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4678 delete (yyvsp[(2) - (2)].APIntVal);
4684 #line 1851 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4685 { // Boolean constants
4686 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4687 (yyval.ConstVal) = ConstantInt::getTrue();
4693 #line 1856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4694 { // Boolean constants
4695 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4696 (yyval.ConstVal) = ConstantInt::getFalse();
4702 #line 1861 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4703 { // Floating point constants
4704 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4705 GEN_ERROR("Floating point constant invalid for type");
4706 // Lexer has no type info, so builds all float and double FP constants
4707 // as double. Fix this here. Long double is done right.
4708 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4709 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4710 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4711 delete (yyvsp[(2) - (2)].FPVal);
4717 #line 1874 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4719 if (!UpRefs.empty())
4720 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4721 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4722 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4723 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4724 GEN_ERROR("invalid cast opcode for cast from '" +
4725 Val->getType()->getDescription() + "' to '" +
4726 DestTy->getDescription() + "'");
4727 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4728 delete (yyvsp[(5) - (6)].TypeVal);
4733 #line 1886 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4735 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4736 GEN_ERROR("GetElementPtr requires a pointer operand");
4739 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4742 GEN_ERROR("Index list invalid for constant getelementptr");
4744 SmallVector<Constant*, 8> IdxVec;
4745 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4746 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4747 IdxVec.push_back(C);
4749 GEN_ERROR("Indices to constant getelementptr must be constants");
4751 delete (yyvsp[(4) - (5)].ValueList);
4753 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4759 #line 1908 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4761 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4762 GEN_ERROR("Select condition must be of boolean type");
4763 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4764 GEN_ERROR("Select operand types must match");
4765 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4771 #line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4773 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4774 GEN_ERROR("Binary operator types must match");
4776 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4781 #line 1922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4783 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4784 GEN_ERROR("Logical operator types must match");
4785 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4786 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4787 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4788 GEN_ERROR("Logical operator requires integral operands");
4790 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4796 #line 1933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4798 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4799 GEN_ERROR("icmp operand types must match");
4800 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4805 #line 1938 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4807 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4808 GEN_ERROR("fcmp operand types must match");
4809 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4814 #line 1943 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4816 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4817 GEN_ERROR("Invalid extractelement operands");
4818 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4824 #line 1949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4826 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4827 GEN_ERROR("Invalid insertelement operands");
4828 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4834 #line 1955 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4836 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4837 GEN_ERROR("Invalid shufflevector operands");
4838 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4844 #line 1964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4846 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4852 #line 1968 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4854 (yyval.ConstVector) = new std::vector<Constant*>();
4855 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4861 #line 1976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4862 { (yyval.BoolVal) = false; ;}
4866 #line 1976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4867 { (yyval.BoolVal) = true; ;}
4871 #line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4872 { (yyval.BoolVal) = true; ;}
4876 #line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4877 { (yyval.BoolVal) = false; ;}
4881 #line 1982 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4883 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4884 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4886 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4888 GEN_ERROR("Aliases can be created only to global values");
4890 (yyval.ConstVal) = Aliasee;
4892 delete (yyvsp[(1) - (2)].TypeVal);
4897 #line 1994 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4899 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4900 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4901 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4902 GEN_ERROR("invalid cast opcode for cast from '" +
4903 Val->getType()->getDescription() + "' to '" +
4904 DestTy->getDescription() + "'");
4906 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4908 delete (yyvsp[(5) - (6)].TypeVal);
4913 #line 2015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4915 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4916 CurModule.ModuleDone();
4922 #line 2020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4924 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4925 CurModule.ModuleDone();
4931 #line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4932 { CurFun.isDeclare = false; ;}
4936 #line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4938 CurFun.FunctionDone();
4944 #line 2037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4945 { CurFun.isDeclare = true; ;}
4949 #line 2037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4956 #line 2040 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4963 #line 2043 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4965 if (!UpRefs.empty())
4966 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4967 // Eagerly resolve types. This is not an optimization, this is a
4968 // requirement that is due to the fact that we could have this:
4970 // %list = type { %list * }
4971 // %list = type { %list * } ; repeated type decl
4973 // If types are not resolved eagerly, then the two types will not be
4974 // determined to be the same type!
4976 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4978 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4980 // If this is a named type that is not a redefinition, add it to the slot
4982 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4985 delete (yyvsp[(3) - (3)].TypeVal);
4991 #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4993 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4995 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4997 // If this is a named type that is not a redefinition, add it to the slot
4999 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5006 #line 2079 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5008 /* "Externally Visible" Linkage */
5009 if ((yyvsp[(5) - (6)].ConstVal) == 0)
5010 GEN_ERROR("Global value initializer is not a constant");
5011 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5012 (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal));
5018 #line 2086 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5025 #line 2090 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5027 if ((yyvsp[(6) - (7)].ConstVal) == 0)
5028 GEN_ERROR("Global value initializer is not a constant");
5029 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5035 #line 2095 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5042 #line 2099 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5044 if (!UpRefs.empty())
5045 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5046 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5048 delete (yyvsp[(6) - (7)].TypeVal);
5053 #line 2105 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5061 #line 2109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5064 if ((yyvsp[(1) - (5)].StrVal)) {
5065 Name = *(yyvsp[(1) - (5)].StrVal);
5066 delete (yyvsp[(1) - (5)].StrVal);
5069 GEN_ERROR("Alias name cannot be empty");
5071 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5073 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5075 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5076 CurModule.CurrentModule);
5077 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5078 InsertValue(GA, CurModule.Values);
5081 // If there was a forward reference of this alias, resolve it now.
5085 ID = ValID::createGlobalName(Name);
5087 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5089 if (GlobalValue *FWGV =
5090 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5091 // Replace uses of the fwdref with the actual alias.
5092 FWGV->replaceAllUsesWith(GA);
5093 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5094 GV->eraseFromParent();
5096 cast<Function>(FWGV)->eraseFromParent();
5105 #line 2149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5112 #line 2152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5119 #line 2158 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5121 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5122 if (AsmSoFar.empty())
5123 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5125 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5126 delete (yyvsp[(1) - (1)].StrVal);
5132 #line 2168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5134 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5135 delete (yyvsp[(3) - (3)].StrVal);
5140 #line 2172 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5142 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5143 delete (yyvsp[(3) - (3)].StrVal);
5148 #line 2179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5150 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5151 delete (yyvsp[(3) - (3)].StrVal);
5157 #line 2184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5159 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5160 delete (yyvsp[(1) - (1)].StrVal);
5166 #line 2189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5173 #line 2198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5175 if (!UpRefs.empty())
5176 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5177 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5178 GEN_ERROR("void typed arguments are invalid");
5179 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5180 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5181 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5187 #line 2208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5189 if (!UpRefs.empty())
5190 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5191 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5192 GEN_ERROR("void typed arguments are invalid");
5193 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5194 (yyval.ArgList) = new ArgListType;
5195 (yyval.ArgList)->push_back(E);
5201 #line 2219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5203 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5209 #line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5211 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5212 struct ArgListEntry E;
5213 E.Ty = new PATypeHolder(Type::VoidTy);
5215 E.Attrs = ParamAttr::None;
5216 (yyval.ArgList)->push_back(E);
5222 #line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5224 (yyval.ArgList) = new ArgListType;
5225 struct ArgListEntry E;
5226 E.Ty = new PATypeHolder(Type::VoidTy);
5228 E.Attrs = ParamAttr::None;
5229 (yyval.ArgList)->push_back(E);
5235 #line 2241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5237 (yyval.ArgList) = 0;
5243 #line 2247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5245 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5246 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5248 // Check the function result for abstractness if this is a define. We should
5249 // have no abstract types at this point
5250 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5251 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5253 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5254 GEN_ERROR("Invalid result type for LLVM function");
5256 std::vector<const Type*> ParamTypeList;
5257 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5258 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5259 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5260 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5262 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5263 const Type* Ty = I->Ty->get();
5264 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5265 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5266 ParamTypeList.push_back(Ty);
5267 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5268 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5272 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5273 if (isVarArg) ParamTypeList.pop_back();
5277 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5279 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5280 const PointerType *PFT = PointerType::getUnqual(FT);
5281 delete (yyvsp[(2) - (10)].TypeVal);
5284 if (!FunctionName.empty()) {
5285 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5287 ID = ValID::createGlobalID(CurModule.Values.size());
5291 // See if this function was forward referenced. If so, recycle the object.
5292 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5293 // Move the function to the end of the list, from whereever it was
5294 // previously inserted.
5295 Fn = cast<Function>(FWRef);
5296 assert(Fn->getParamAttrs().isEmpty() &&
5297 "Forward reference has parameter attributes!");
5298 CurModule.CurrentModule->getFunctionList().remove(Fn);
5299 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5300 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5301 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5302 if (Fn->getFunctionType() != FT ) {
5303 // The existing function doesn't have the same type. This is an overload
5305 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5306 } else if (Fn->getParamAttrs() != PAL) {
5307 // The existing function doesn't have the same parameter attributes.
5308 // This is an overload error.
5309 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5310 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5311 // Neither the existing or the current function is a declaration and they
5312 // have the same name and same type. Clearly this is a redefinition.
5313 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5314 } else if (Fn->isDeclaration()) {
5315 // Make sure to strip off any argument names so we can't get conflicts.
5316 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5320 } else { // Not already defined?
5321 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5322 CurModule.CurrentModule);
5323 InsertValue(Fn, CurModule.Values);
5326 CurFun.FunctionStart(Fn);
5328 if (CurFun.isDeclare) {
5329 // If we have declaration, always overwrite linkage. This will allow us to
5330 // correctly handle cases, when pointer to function is passed as argument to
5331 // another function.
5332 Fn->setLinkage(CurFun.Linkage);
5333 Fn->setVisibility(CurFun.Visibility);
5335 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5336 Fn->setParamAttrs(PAL);
5337 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5338 if ((yyvsp[(8) - (10)].StrVal)) {
5339 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5340 delete (yyvsp[(8) - (10)].StrVal);
5342 if ((yyvsp[(10) - (10)].StrVal)) {
5343 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5344 delete (yyvsp[(10) - (10)].StrVal);
5347 // Add all of the arguments we parsed to the function...
5348 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5349 if (isVarArg) { // Nuke the last entry
5350 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5351 "Not a varargs marker!");
5352 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5353 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5355 Function::arg_iterator ArgIt = Fn->arg_begin();
5356 Function::arg_iterator ArgEnd = Fn->arg_end();
5358 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5359 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5360 delete I->Ty; // Delete the typeholder...
5361 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5367 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5374 #line 2377 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5376 (yyval.FunctionVal) = CurFun.CurrentFunction;
5378 // Make sure that we keep track of the linkage type even if there was a
5379 // previous "declare".
5380 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5381 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5386 #line 2388 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5388 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5394 #line 2393 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5396 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5397 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5398 (yyval.FunctionVal) = CurFun.CurrentFunction;
5399 CurFun.FunctionDone();
5405 #line 2405 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5407 (yyval.BoolVal) = false;
5413 #line 2409 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5415 (yyval.BoolVal) = true;
5421 #line 2414 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5422 { // A reference to a direct constant
5423 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5429 #line 2418 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5431 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5437 #line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5438 { // Perhaps it's an FP constant?
5439 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5445 #line 2426 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5447 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5453 #line 2430 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5455 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5461 #line 2434 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5463 (yyval.ValIDVal) = ValID::createNull();
5469 #line 2438 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5471 (yyval.ValIDVal) = ValID::createUndef();
5477 #line 2442 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5478 { // A vector zero constant.
5479 (yyval.ValIDVal) = ValID::createZeroInit();
5485 #line 2446 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5486 { // Nonempty unsized packed vector
5487 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5488 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5490 VectorType* pt = VectorType::get(ETy, NumElements);
5491 PATypeHolder* PTy = new PATypeHolder(
5499 // Verify all elements are correct type!
5500 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5501 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5502 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5503 ETy->getDescription() +"' as required!\nIt is of type '" +
5504 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5507 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5508 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5514 #line 2471 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5516 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5522 #line 2475 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5524 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5525 delete (yyvsp[(3) - (5)].StrVal);
5526 delete (yyvsp[(5) - (5)].StrVal);
5532 #line 2485 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5533 { // Is it an integer reference...?
5534 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5540 #line 2489 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5542 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5548 #line 2493 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5549 { // Is it a named reference...?
5550 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5551 delete (yyvsp[(1) - (1)].StrVal);
5557 #line 2498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5558 { // Is it a named reference...?
5559 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5560 delete (yyvsp[(1) - (1)].StrVal);
5566 #line 2511 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5568 if (!UpRefs.empty())
5569 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5570 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5571 delete (yyvsp[(1) - (2)].TypeVal);
5577 #line 2520 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5579 (yyval.ValueList) = new std::vector<Value *>();
5580 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
5586 #line 2525 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5588 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
5594 #line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5596 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5602 #line 2534 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5603 { // Do not allow functions with 0 basic blocks
5604 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5610 #line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5612 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5614 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5615 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5616 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5622 #line 2552 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5624 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5625 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5626 if (CI2->getParent() == 0)
5627 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5628 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5629 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5635 #line 2561 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5636 { // Empty space between instruction lists
5637 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0);
5643 #line 2565 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5644 { // Only the unwind to block
5645 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal((yyvsp[(3) - (3)].ValIDVal)));
5651 #line 2569 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5652 { // Labelled (named) basic block
5653 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)), 0);
5654 delete (yyvsp[(1) - (1)].StrVal);
5660 #line 2574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5662 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (4)].StrVal)), getBBVal((yyvsp[(4) - (4)].ValIDVal)));
5663 delete (yyvsp[(1) - (4)].StrVal);
5669 #line 2581 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5670 { // Return with a result...
5671 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5672 assert(!VL.empty() && "Invalid ret operands!");
5673 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5674 delete (yyvsp[(2) - (2)].ValueList);
5680 #line 2588 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5681 { // Return with no result...
5682 (yyval.TermInstVal) = ReturnInst::Create();
5688 #line 2592 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5689 { // Unconditional Branch...
5690 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5692 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5697 #line 2597 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5699 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5700 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5702 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5704 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5706 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5711 #line 2607 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5713 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5715 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5717 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5718 (yyval.TermInstVal) = S;
5720 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5721 E = (yyvsp[(8) - (9)].JumpTable)->end();
5722 for (; I != E; ++I) {
5723 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5724 S->addCase(CI, I->second);
5726 GEN_ERROR("Switch case is constant, but not a simple integer");
5728 delete (yyvsp[(8) - (9)].JumpTable);
5734 #line 2626 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5736 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5738 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5740 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
5741 (yyval.TermInstVal) = S;
5747 #line 2636 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5750 // Handle the short syntax
5751 const PointerType *PFTy = 0;
5752 const FunctionType *Ty = 0;
5753 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5754 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5755 // Pull out the types of all of the arguments...
5756 std::vector<const Type*> ParamTypes;
5757 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5758 for (; I != E; ++I) {
5759 const Type *Ty = I->Val->getType();
5760 if (Ty == Type::VoidTy)
5761 GEN_ERROR("Short call syntax cannot be used with varargs");
5762 ParamTypes.push_back(Ty);
5765 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5766 GEN_ERROR("Invalid result type for LLVM function");
5768 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5769 PFTy = PointerType::getUnqual(Ty);
5772 delete (yyvsp[(3) - (14)].TypeVal);
5774 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5776 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5778 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5781 SmallVector<ParamAttrsWithIndex, 8> Attrs;
5782 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5783 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
5785 // Check the arguments
5787 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5788 // Make sure no arguments is a good thing!
5789 if (Ty->getNumParams() != 0)
5790 GEN_ERROR("No arguments passed to a function that "
5791 "expects arguments");
5792 } else { // Has arguments?
5793 // Loop through FunctionType's arguments and ensure they are specified
5795 FunctionType::param_iterator I = Ty->param_begin();
5796 FunctionType::param_iterator E = Ty->param_end();
5797 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5800 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5801 if (ArgI->Val->getType() != *I)
5802 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5803 (*I)->getDescription() + "'");
5804 Args.push_back(ArgI->Val);
5805 if (ArgI->Attrs != ParamAttr::None)
5806 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5809 if (Ty->isVarArg()) {
5811 for (; ArgI != ArgE; ++ArgI, ++index) {
5812 Args.push_back(ArgI->Val); // push the remaining varargs
5813 if (ArgI->Attrs != ParamAttr::None)
5814 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5816 } else if (I != E || ArgI != ArgE)
5817 GEN_ERROR("Invalid number of parameters detected");
5822 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5824 // Create the InvokeInst
5825 InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end());
5826 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5827 II->setParamAttrs(PAL);
5828 (yyval.TermInstVal) = II;
5829 delete (yyvsp[(6) - (14)].ParamList);
5835 #line 2720 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5837 (yyval.TermInstVal) = new UnwindInst();
5843 #line 2724 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5845 (yyval.TermInstVal) = new UnreachableInst();
5851 #line 2731 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5853 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5854 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5857 GEN_ERROR("May only switch on a constant pool value");
5859 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5861 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5866 #line 2742 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5868 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5869 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5873 GEN_ERROR("May only switch on a constant pool value");
5875 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5877 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5882 #line 2755 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5884 // Is this definition named?? if so, assign the name...
5885 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5887 InsertValue((yyvsp[(2) - (2)].InstVal));
5888 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5894 #line 2765 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5895 { // Used for PHI nodes
5896 if (!UpRefs.empty())
5897 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5898 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5899 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5901 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5903 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5904 delete (yyvsp[(1) - (6)].TypeVal);
5909 #line 2776 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5911 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5912 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5914 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5916 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5921 #line 2786 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5923 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5924 if (!UpRefs.empty())
5925 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5926 // Used for call and invoke instructions
5927 (yyval.ParamList) = new ParamList();
5928 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5929 (yyval.ParamList)->push_back(E);
5930 delete (yyvsp[(1) - (4)].TypeVal);
5936 #line 2797 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5938 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5939 // Labels are only valid in ASMs
5940 (yyval.ParamList) = new ParamList();
5941 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5942 (yyval.ParamList)->push_back(E);
5948 #line 2805 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5950 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5951 if (!UpRefs.empty())
5952 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5953 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5954 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5955 (yyval.ParamList)->push_back(E);
5956 delete (yyvsp[(3) - (6)].TypeVal);
5962 #line 2815 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5964 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5965 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5966 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5967 (yyval.ParamList)->push_back(E);
5973 #line 2822 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5974 { (yyval.ParamList) = new ParamList(); ;}
5978 #line 2825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5979 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5983 #line 2826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5985 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5986 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5992 #line 2833 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5994 (yyval.BoolVal) = true;
6000 #line 2837 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6002 (yyval.BoolVal) = false;
6008 #line 2842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6010 if (!UpRefs.empty())
6011 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6012 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6013 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6015 "Arithmetic operator requires integer, FP, or packed operands");
6016 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6018 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6020 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6021 if ((yyval.InstVal) == 0)
6022 GEN_ERROR("binary operator returned null");
6023 delete (yyvsp[(2) - (5)].TypeVal);
6028 #line 2858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6030 if (!UpRefs.empty())
6031 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6032 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6033 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6034 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6035 GEN_ERROR("Logical operator requires integral operands");
6037 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6039 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6041 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6042 if ((yyval.InstVal) == 0)
6043 GEN_ERROR("binary operator returned null");
6044 delete (yyvsp[(2) - (5)].TypeVal);
6049 #line 2875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6051 if (!UpRefs.empty())
6052 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6053 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6054 GEN_ERROR("Vector types not supported by icmp instruction");
6055 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6057 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6059 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6060 if ((yyval.InstVal) == 0)
6061 GEN_ERROR("icmp operator returned null");
6062 delete (yyvsp[(3) - (6)].TypeVal);
6067 #line 2889 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6069 if (!UpRefs.empty())
6070 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6071 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6072 GEN_ERROR("Vector types not supported by fcmp instruction");
6073 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6075 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6077 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6078 if ((yyval.InstVal) == 0)
6079 GEN_ERROR("fcmp operator returned null");
6080 delete (yyvsp[(3) - (6)].TypeVal);
6085 #line 2903 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6087 if (!UpRefs.empty())
6088 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6089 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6090 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6091 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6092 GEN_ERROR("invalid cast opcode for cast from '" +
6093 Val->getType()->getDescription() + "' to '" +
6094 DestTy->getDescription() + "'");
6095 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6096 delete (yyvsp[(4) - (4)].TypeVal);
6101 #line 2915 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6103 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6104 GEN_ERROR("select condition must be boolean");
6105 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6106 GEN_ERROR("select value types should match");
6107 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6113 #line 2923 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6115 if (!UpRefs.empty())
6116 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6117 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6118 delete (yyvsp[(4) - (4)].TypeVal);
6124 #line 2930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6126 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6127 GEN_ERROR("Invalid extractelement operands");
6128 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6134 #line 2936 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6136 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6137 GEN_ERROR("Invalid insertelement operands");
6138 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6144 #line 2942 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6146 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6147 GEN_ERROR("Invalid shufflevector operands");
6148 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6154 #line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6156 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6157 if (!Ty->isFirstClassType())
6158 GEN_ERROR("PHI node operands must be of first class type");
6159 (yyval.InstVal) = PHINode::Create(Ty);
6160 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6161 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6162 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6163 GEN_ERROR("All elements of a PHI node must be of the same type");
6164 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6165 (yyvsp[(2) - (2)].PHIList)->pop_front();
6167 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6173 #line 2964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6176 // Handle the short syntax
6177 const PointerType *PFTy = 0;
6178 const FunctionType *Ty = 0;
6179 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6180 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6181 // Pull out the types of all of the arguments...
6182 std::vector<const Type*> ParamTypes;
6183 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6184 for (; I != E; ++I) {
6185 const Type *Ty = I->Val->getType();
6186 if (Ty == Type::VoidTy)
6187 GEN_ERROR("Short call syntax cannot be used with varargs");
6188 ParamTypes.push_back(Ty);
6191 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6192 GEN_ERROR("Invalid result type for LLVM function");
6194 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6195 PFTy = PointerType::getUnqual(Ty);
6198 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6201 // Check for call to invalid intrinsic to avoid crashing later.
6202 if (Function *theF = dyn_cast<Function>(V)) {
6203 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6204 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6205 !theF->getIntrinsicID(true))
6206 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6207 theF->getName() + "'");
6210 // Set up the ParamAttrs for the function
6211 SmallVector<ParamAttrsWithIndex, 8> Attrs;
6212 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6213 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6214 // Check the arguments
6216 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6217 // Make sure no arguments is a good thing!
6218 if (Ty->getNumParams() != 0)
6219 GEN_ERROR("No arguments passed to a function that "
6220 "expects arguments");
6221 } else { // Has arguments?
6222 // Loop through FunctionType's arguments and ensure they are specified
6223 // correctly. Also, gather any parameter attributes.
6224 FunctionType::param_iterator I = Ty->param_begin();
6225 FunctionType::param_iterator E = Ty->param_end();
6226 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6229 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6230 if (ArgI->Val->getType() != *I)
6231 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6232 (*I)->getDescription() + "'");
6233 Args.push_back(ArgI->Val);
6234 if (ArgI->Attrs != ParamAttr::None)
6235 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6237 if (Ty->isVarArg()) {
6239 for (; ArgI != ArgE; ++ArgI, ++index) {
6240 Args.push_back(ArgI->Val); // push the remaining varargs
6241 if (ArgI->Attrs != ParamAttr::None)
6242 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6244 } else if (I != E || ArgI != ArgE)
6245 GEN_ERROR("Invalid number of parameters detected");
6248 // Finish off the ParamAttrs and check them
6251 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6253 // Create the call node
6254 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6255 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6256 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6257 CI->setParamAttrs(PAL);
6258 (yyval.InstVal) = CI;
6259 delete (yyvsp[(6) - (8)].ParamList);
6260 delete (yyvsp[(3) - (8)].TypeVal);
6266 #line 3053 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6268 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6274 #line 3058 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6276 (yyval.BoolVal) = true;
6282 #line 3062 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6284 (yyval.BoolVal) = false;
6290 #line 3069 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6292 if (!UpRefs.empty())
6293 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6294 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6295 delete (yyvsp[(2) - (3)].TypeVal);
6301 #line 3076 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6303 if (!UpRefs.empty())
6304 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6305 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6307 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6308 delete (yyvsp[(2) - (6)].TypeVal);
6313 #line 3084 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6315 if (!UpRefs.empty())
6316 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6317 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6318 delete (yyvsp[(2) - (3)].TypeVal);
6324 #line 3091 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6326 if (!UpRefs.empty())
6327 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6328 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6330 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6331 delete (yyvsp[(2) - (6)].TypeVal);
6336 #line 3099 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6338 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6339 GEN_ERROR("Trying to free nonpointer type " +
6340 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6341 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6347 #line 3107 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6349 if (!UpRefs.empty())
6350 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6351 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6352 GEN_ERROR("Can't load from nonpointer type: " +
6353 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6354 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6355 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6356 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6357 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6359 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6360 delete (yyvsp[(3) - (5)].TypeVal);
6365 #line 3121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6367 if (!UpRefs.empty())
6368 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6369 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6371 GEN_ERROR("Can't store to a nonpointer type: " +
6372 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6373 const Type *ElTy = PT->getElementType();
6374 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6375 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6376 "' into space of type '" + ElTy->getDescription() + "'");
6378 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6380 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6381 delete (yyvsp[(5) - (7)].TypeVal);
6386 #line 3138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6388 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6389 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6390 GEN_ERROR("Invalid getresult operands");
6391 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6392 delete (yyvsp[(2) - (5)].TypeVal);
6398 #line 3146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6400 if (!UpRefs.empty())
6401 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6402 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6403 GEN_ERROR("getelementptr insn requires pointer operand");
6405 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6406 GEN_ERROR("Invalid getelementptr indices for type '" +
6407 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6408 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6410 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6411 delete (yyvsp[(2) - (4)].TypeVal);
6412 delete (yyvsp[(4) - (4)].ValueList);
6417 /* Line 1267 of yacc.c. */
6418 #line 6419 "llvmAsmParser.tab.c"
6421 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6425 YY_STACK_PRINT (yyss, yyssp);
6430 /* Now `shift' the result of the reduction. Determine what state
6431 that goes to, based on the state we popped back to and the rule
6432 number reduced by. */
6436 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6437 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6438 yystate = yytable[yystate];
6440 yystate = yydefgoto[yyn - YYNTOKENS];
6445 /*------------------------------------.
6446 | yyerrlab -- here on detecting error |
6447 `------------------------------------*/
6449 /* If not already recovering from an error, report this error. */
6453 #if ! YYERROR_VERBOSE
6454 yyerror (YY_("syntax error"));
6457 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6458 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6460 YYSIZE_T yyalloc = 2 * yysize;
6461 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6462 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6463 if (yymsg != yymsgbuf)
6464 YYSTACK_FREE (yymsg);
6465 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6467 yymsg_alloc = yyalloc;
6471 yymsg_alloc = sizeof yymsgbuf;
6475 if (0 < yysize && yysize <= yymsg_alloc)
6477 (void) yysyntax_error (yymsg, yystate, yychar);
6482 yyerror (YY_("syntax error"));
6484 goto yyexhaustedlab;
6492 if (yyerrstatus == 3)
6494 /* If just tried and failed to reuse look-ahead token after an
6495 error, discard it. */
6497 if (yychar <= YYEOF)
6499 /* Return failure if at end of input. */
6500 if (yychar == YYEOF)
6505 yydestruct ("Error: discarding",
6511 /* Else will try to reuse look-ahead token after shifting the error
6516 /*---------------------------------------------------.
6517 | yyerrorlab -- error raised explicitly by YYERROR. |
6518 `---------------------------------------------------*/
6521 /* Pacify compilers like GCC when the user code never invokes
6522 YYERROR and the label yyerrorlab therefore never appears in user
6524 if (/*CONSTCOND*/ 0)
6527 /* Do not reclaim the symbols of the rule which action triggered
6531 YY_STACK_PRINT (yyss, yyssp);
6536 /*-------------------------------------------------------------.
6537 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6538 `-------------------------------------------------------------*/
6540 yyerrstatus = 3; /* Each real token shifted decrements this. */
6544 yyn = yypact[yystate];
6545 if (yyn != YYPACT_NINF)
6548 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6556 /* Pop the current state because it cannot handle the error token. */
6561 yydestruct ("Error: popping",
6562 yystos[yystate], yyvsp);
6565 YY_STACK_PRINT (yyss, yyssp);
6574 /* Shift the error token. */
6575 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6581 /*-------------------------------------.
6582 | yyacceptlab -- YYACCEPT comes here. |
6583 `-------------------------------------*/
6588 /*-----------------------------------.
6589 | yyabortlab -- YYABORT comes here. |
6590 `-----------------------------------*/
6596 /*-------------------------------------------------.
6597 | yyexhaustedlab -- memory exhaustion comes here. |
6598 `-------------------------------------------------*/
6600 yyerror (YY_("memory exhausted"));
6606 if (yychar != YYEOF && yychar != YYEMPTY)
6607 yydestruct ("Cleanup: discarding lookahead",
6609 /* Do not reclaim the symbols of the rule which action triggered
6610 this YYABORT or YYACCEPT. */
6612 YY_STACK_PRINT (yyss, yyssp);
6613 while (yyssp != yyss)
6615 yydestruct ("Cleanup: popping",
6616 yystos[*yyssp], yyvsp);
6621 YYSTACK_FREE (yyss);
6624 if (yymsg != yymsgbuf)
6625 YYSTACK_FREE (yymsg);
6627 /* Make sure YYID is used. */
6628 return YYID (yyresult);
6632 #line 3163 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6635 // common code from the two 'RunVMAsmParser' functions
6636 static Module* RunParser(Module * M) {
6637 CurModule.CurrentModule = M;
6638 // Check to make sure the parser succeeded
6641 delete ParserResult;
6645 // Emit an error if there are any unresolved types left.
6646 if (!CurModule.LateResolveTypes.empty()) {
6647 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6648 if (DID.Type == ValID::LocalName) {
6649 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6651 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6654 delete ParserResult;
6658 // Emit an error if there are any unresolved values left.
6659 if (!CurModule.LateResolveValues.empty()) {
6660 Value *V = CurModule.LateResolveValues.back();
6661 std::map<Value*, std::pair<ValID, int> >::iterator I =
6662 CurModule.PlaceHolderInfo.find(V);
6664 if (I != CurModule.PlaceHolderInfo.end()) {
6665 ValID &DID = I->second.first;
6666 if (DID.Type == ValID::LocalName) {
6667 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6669 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6672 delete ParserResult;
6677 // Check to make sure that parsing produced a result
6681 // Reset ParserResult variable while saving its value for the result.
6682 Module *Result = ParserResult;
6688 void llvm::GenerateError(const std::string &message, int LineNo) {
6689 if (LineNo == -1) LineNo = LLLgetLineNo();
6690 // TODO: column number in exception
6692 TheParseError->setError(LLLgetFilename(), message, LineNo);
6696 int yyerror(const char *ErrorMsg) {
6697 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6698 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6699 if (yychar != YYEMPTY && yychar != 0) {
6700 errMsg += " while reading token: '";
6701 errMsg += std::string(LLLgetTokenStart(),
6702 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6704 GenerateError(errMsg);