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
94 ATSTRINGCONSTANT = 275,
95 ZEROINITIALIZER = 276,
134 X86_STDCALLCC_TOK = 315,
135 X86_FASTCALLCC_TOK = 316,
201 EXTRACTELEMENT = 382,
213 #define ESINT64VAL 258
214 #define EUINT64VAL 259
215 #define ESAPINTVAL 260
216 #define EUAPINTVAL 261
217 #define LOCALVAL_ID 262
218 #define GLOBALVAL_ID 263
227 #define GLOBALVAR 272
229 #define STRINGCONSTANT 274
230 #define ATSTRINGCONSTANT 275
231 #define ZEROINITIALIZER 276
243 #define THREAD_LOCAL 288
245 #define DOTDOTDOT 290
251 #define APPENDING 296
252 #define DLLIMPORT 297
253 #define DLLEXPORT 298
254 #define EXTERN_WEAK 299
265 #define SIDEEFFECT 310
268 #define FASTCC_TOK 313
269 #define COLDCC_TOK 314
270 #define X86_STDCALLCC_TOK 315
271 #define X86_FASTCALLCC_TOK 316
272 #define DATALAYOUT 317
278 #define UNREACHABLE 323
321 #define GETELEMENTPTR 366
337 #define EXTRACTELEMENT 382
338 #define INSERTELEMENT 383
339 #define SHUFFLEVECTOR 384
350 /* Copy the first part of user declarations. */
351 #line 14 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
353 #include "ParserInternals.h"
354 #include "llvm/CallingConv.h"
355 #include "llvm/InlineAsm.h"
356 #include "llvm/Instructions.h"
357 #include "llvm/Module.h"
358 #include "llvm/ValueSymbolTable.h"
359 #include "llvm/Support/GetElementPtrTypeIterator.h"
360 #include "llvm/Support/CommandLine.h"
361 #include "llvm/ADT/SmallVector.h"
362 #include "llvm/ADT/STLExtras.h"
363 #include "llvm/Support/MathExtras.h"
364 #include "llvm/Support/Streams.h"
373 // The following is a gross hack. In order to rid the libAsmParser library of
374 // exceptions, we have to have a way of getting the yyparse function to go into
375 // an error situation. So, whenever we want an error to occur, the GenerateError
376 // function (see bottom of file) sets TriggerError. Then, at the end of each
377 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
378 // (a goto) to put YACC in error state. Furthermore, several calls to
379 // GenerateError are made from inside productions and they must simulate the
380 // previous exception behavior by exiting the production immediately. We have
381 // replaced these with the GEN_ERROR macro which calls GeneratError and then
382 // immediately invokes YYERROR. This would be so much cleaner if it was a
383 // recursive descent parser.
384 static bool TriggerError = false;
385 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
386 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
388 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
389 int yylex(); // declaration" of xxx warnings.
393 std::string CurFilename;
396 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
397 cl::Hidden, cl::init(false));
400 using namespace llvm;
402 static Module *ParserResult;
404 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
405 // relating to upreferences in the input stream.
407 //#define DEBUG_UPREFS 1
409 #define UR_OUT(X) cerr << X
414 #define YYERROR_VERBOSE 1
416 static GlobalVariable *CurGV;
419 // This contains info used when building the body of a function. It is
420 // destroyed when the function is completed.
422 typedef std::vector<Value *> ValueList; // Numbered defs
425 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
427 static struct PerModuleInfo {
428 Module *CurrentModule;
429 ValueList Values; // Module level numbered definitions
430 ValueList LateResolveValues;
431 std::vector<PATypeHolder> Types;
432 std::map<ValID, PATypeHolder> LateResolveTypes;
434 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
435 /// how they were referenced and on which line of the input they came from so
436 /// that we can resolve them later and print error messages as appropriate.
437 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
439 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
440 // references to global values. Global values may be referenced before they
441 // are defined, and if so, the temporary object that they represent is held
442 // here. This is used for forward references of GlobalValues.
444 typedef std::map<std::pair<const PointerType *,
445 ValID>, GlobalValue*> GlobalRefsType;
446 GlobalRefsType GlobalRefs;
449 // If we could not resolve some functions at function compilation time
450 // (calls to functions before they are defined), resolve them now... Types
451 // are resolved when the constant pool has been completely parsed.
453 ResolveDefinitions(LateResolveValues);
457 // Check to make sure that all global value forward references have been
460 if (!GlobalRefs.empty()) {
461 std::string UndefinedReferences = "Unresolved global references exist:\n";
463 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
465 UndefinedReferences += " " + I->first.first->getDescription() + " " +
466 I->first.second.getName() + "\n";
468 GenerateError(UndefinedReferences);
472 Values.clear(); // Clear out function local definitions
477 // GetForwardRefForGlobal - Check to see if there is a forward reference
478 // for this global. If so, remove it from the GlobalRefs map and return it.
479 // If not, just return null.
480 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
481 // Check to see if there is a forward reference to this global variable...
482 // if there is, eliminate it and patch the reference to use the new def'n.
483 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
484 GlobalValue *Ret = 0;
485 if (I != GlobalRefs.end()) {
492 bool TypeIsUnresolved(PATypeHolder* PATy) {
493 // If it isn't abstract, its resolved
494 const Type* Ty = PATy->get();
495 if (!Ty->isAbstract())
497 // Traverse the type looking for abstract types. If it isn't abstract then
498 // we don't need to traverse that leg of the type.
499 std::vector<const Type*> WorkList, SeenList;
500 WorkList.push_back(Ty);
501 while (!WorkList.empty()) {
502 const Type* Ty = WorkList.back();
503 SeenList.push_back(Ty);
505 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
506 // Check to see if this is an unresolved type
507 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
508 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
509 for ( ; I != E; ++I) {
510 if (I->second.get() == OpTy)
513 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
514 const Type* TheTy = SeqTy->getElementType();
515 if (TheTy->isAbstract() && TheTy != Ty) {
516 std::vector<const Type*>::iterator I = SeenList.begin(),
522 WorkList.push_back(TheTy);
524 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
525 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
526 const Type* TheTy = StrTy->getElementType(i);
527 if (TheTy->isAbstract() && TheTy != Ty) {
528 std::vector<const Type*>::iterator I = SeenList.begin(),
534 WorkList.push_back(TheTy);
543 static struct PerFunctionInfo {
544 Function *CurrentFunction; // Pointer to current function being created
546 ValueList Values; // Keep track of #'d definitions
548 ValueList LateResolveValues;
549 bool isDeclare; // Is this function a forward declararation?
550 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
551 GlobalValue::VisibilityTypes Visibility;
553 /// BBForwardRefs - When we see forward references to basic blocks, keep
554 /// track of them here.
555 std::map<ValID, BasicBlock*> BBForwardRefs;
557 inline PerFunctionInfo() {
560 Linkage = GlobalValue::ExternalLinkage;
561 Visibility = GlobalValue::DefaultVisibility;
564 inline void FunctionStart(Function *M) {
569 void FunctionDone() {
570 // Any forward referenced blocks left?
571 if (!BBForwardRefs.empty()) {
572 GenerateError("Undefined reference to label " +
573 BBForwardRefs.begin()->second->getName());
577 // Resolve all forward references now.
578 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
580 Values.clear(); // Clear out function local definitions
581 BBForwardRefs.clear();
584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
587 } CurFun; // Info for the current function...
589 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
592 //===----------------------------------------------------------------------===//
593 // Code to handle definitions of all the types
594 //===----------------------------------------------------------------------===//
596 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
597 // Things that have names or are void typed don't get slot numbers
598 if (V->hasName() || (V->getType() == Type::VoidTy))
601 // In the case of function values, we have to allow for the forward reference
602 // of basic blocks, which are included in the numbering. Consequently, we keep
603 // track of the next insertion location with NextValNum. When a BB gets
604 // inserted, it could change the size of the CurFun.Values vector.
605 if (&ValueTab == &CurFun.Values) {
606 if (ValueTab.size() <= CurFun.NextValNum)
607 ValueTab.resize(CurFun.NextValNum+1);
608 ValueTab[CurFun.NextValNum++] = V;
611 // For all other lists, its okay to just tack it on the back of the vector.
612 ValueTab.push_back(V);
615 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
617 case ValID::LocalID: // Is it a numbered definition?
618 // Module constants occupy the lowest numbered slots...
619 if (D.Num < CurModule.Types.size())
620 return CurModule.Types[D.Num];
622 case ValID::LocalName: // Is it a named definition?
623 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
624 D.destroy(); // Free old strdup'd memory...
629 GenerateError("Internal parser error: Invalid symbol type reference");
633 // If we reached here, we referenced either a symbol that we don't know about
634 // or an id number that hasn't been read yet. We may be referencing something
635 // forward, so just create an entry to be resolved later and get to it...
637 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
640 if (inFunctionScope()) {
641 if (D.Type == ValID::LocalName) {
642 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
645 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
650 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
651 if (I != CurModule.LateResolveTypes.end())
654 Type *Typ = OpaqueType::get();
655 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
659 // getExistingVal - Look up the value specified by the provided type and
660 // the provided ValID. If the value exists and has already been defined, return
661 // it. Otherwise return null.
663 static Value *getExistingVal(const Type *Ty, const ValID &D) {
664 if (isa<FunctionType>(Ty)) {
665 GenerateError("Functions are not values and "
666 "must be referenced as pointers");
671 case ValID::LocalID: { // Is it a numbered definition?
672 // Check that the number is within bounds.
673 if (D.Num >= CurFun.Values.size())
675 Value *Result = CurFun.Values[D.Num];
676 if (Ty != Result->getType()) {
677 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
678 Result->getType()->getDescription() + "' does not match "
679 "expected type, '" + Ty->getDescription() + "'");
684 case ValID::GlobalID: { // Is it a numbered definition?
685 if (D.Num >= CurModule.Values.size())
687 Value *Result = CurModule.Values[D.Num];
688 if (Ty != Result->getType()) {
689 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
690 Result->getType()->getDescription() + "' does not match "
691 "expected type, '" + Ty->getDescription() + "'");
697 case ValID::LocalName: { // Is it a named definition?
698 if (!inFunctionScope())
700 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
701 Value *N = SymTab.lookup(D.Name);
704 if (N->getType() != Ty)
707 D.destroy(); // Free old strdup'd memory...
710 case ValID::GlobalName: { // Is it a named definition?
711 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
712 Value *N = SymTab.lookup(D.Name);
715 if (N->getType() != Ty)
718 D.destroy(); // Free old strdup'd memory...
722 // Check to make sure that "Ty" is an integral type, and that our
723 // value will fit into the specified type...
724 case ValID::ConstSIntVal: // Is it a constant pool reference??
725 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
726 GenerateError("Signed integral constant '" +
727 itostr(D.ConstPool64) + "' is invalid for type '" +
728 Ty->getDescription() + "'");
731 return ConstantInt::get(Ty, D.ConstPool64, true);
733 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
734 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
735 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
736 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
737 "' is invalid or out of range");
739 } else { // This is really a signed reference. Transmogrify.
740 return ConstantInt::get(Ty, D.ConstPool64, true);
743 return ConstantInt::get(Ty, D.UConstPool64);
746 case ValID::ConstFPVal: // Is it a floating point const pool reference?
747 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
748 GenerateError("FP constant invalid for type");
751 return ConstantFP::get(Ty, D.ConstPoolFP);
753 case ValID::ConstNullVal: // Is it a null value?
754 if (!isa<PointerType>(Ty)) {
755 GenerateError("Cannot create a a non pointer null");
758 return ConstantPointerNull::get(cast<PointerType>(Ty));
760 case ValID::ConstUndefVal: // Is it an undef value?
761 return UndefValue::get(Ty);
763 case ValID::ConstZeroVal: // Is it a zero value?
764 return Constant::getNullValue(Ty);
766 case ValID::ConstantVal: // Fully resolved constant?
767 if (D.ConstantValue->getType() != Ty) {
768 GenerateError("Constant expression type different from required type");
771 return D.ConstantValue;
773 case ValID::InlineAsmVal: { // Inline asm expression
774 const PointerType *PTy = dyn_cast<PointerType>(Ty);
775 const FunctionType *FTy =
776 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
777 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
778 GenerateError("Invalid type for asm constraint string");
781 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
782 D.IAD->HasSideEffects);
783 D.destroy(); // Free InlineAsmDescriptor.
787 assert(0 && "Unhandled case!");
791 assert(0 && "Unhandled case!");
795 // getVal - This function is identical to getExistingVal, except that if a
796 // value is not already defined, it "improvises" by creating a placeholder var
797 // that looks and acts just like the requested variable. When the value is
798 // defined later, all uses of the placeholder variable are replaced with the
801 static Value *getVal(const Type *Ty, const ValID &ID) {
802 if (Ty == Type::LabelTy) {
803 GenerateError("Cannot use a basic block here");
807 // See if the value has already been defined.
808 Value *V = getExistingVal(Ty, ID);
810 if (TriggerError) return 0;
812 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
813 GenerateError("Invalid use of a composite type");
817 // If we reached here, we referenced either a symbol that we don't know about
818 // or an id number that hasn't been read yet. We may be referencing something
819 // forward, so just create an entry to be resolved later and get to it...
822 case ValID::GlobalName:
823 case ValID::GlobalID:
824 const PointerType *PTy = dyn_cast<PointerType>(Ty);
826 GenerateError("Invalid type for reference to global" );
829 const Type* ElTy = PTy->getElementType();
830 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
831 V = new Function(FTy, GlobalValue::ExternalLinkage);
833 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
836 V = new Argument(Ty);
839 // Remember where this forward reference came from. FIXME, shouldn't we try
840 // to recycle these things??
841 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
844 if (inFunctionScope())
845 InsertValue(V, CurFun.LateResolveValues);
847 InsertValue(V, CurModule.LateResolveValues);
851 /// defineBBVal - This is a definition of a new basic block with the specified
852 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
853 static BasicBlock *defineBBVal(const ValID &ID) {
854 assert(inFunctionScope() && "Can't get basic block at global scope!");
858 // First, see if this was forward referenced
860 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
861 if (BBI != CurFun.BBForwardRefs.end()) {
863 // The forward declaration could have been inserted anywhere in the
864 // function: insert it into the correct place now.
865 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
866 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
868 // We're about to erase the entry, save the key so we can clean it up.
869 ValID Tmp = BBI->first;
871 // Erase the forward ref from the map as its no longer "forward"
872 CurFun.BBForwardRefs.erase(ID);
874 // The key has been removed from the map but so we don't want to leave
875 // strdup'd memory around so destroy it too.
878 // If its a numbered definition, bump the number and set the BB value.
879 if (ID.Type == ValID::LocalID) {
880 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
888 // We haven't seen this BB before and its first mention is a definition.
889 // Just create it and return it.
890 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
891 BB = new BasicBlock(Name, CurFun.CurrentFunction);
892 if (ID.Type == ValID::LocalID) {
893 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
897 ID.destroy(); // Free strdup'd memory
901 /// getBBVal - get an existing BB value or create a forward reference for it.
903 static BasicBlock *getBBVal(const ValID &ID) {
904 assert(inFunctionScope() && "Can't get basic block at global scope!");
908 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
909 if (BBI != CurFun.BBForwardRefs.end()) {
911 } if (ID.Type == ValID::LocalName) {
912 std::string Name = ID.Name;
913 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
915 if (N->getType()->getTypeID() == Type::LabelTyID)
916 BB = cast<BasicBlock>(N);
918 GenerateError("Reference to label '" + Name + "' is actually of type '"+
919 N->getType()->getDescription() + "'");
920 } else if (ID.Type == ValID::LocalID) {
921 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
922 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
923 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
925 GenerateError("Reference to label '%" + utostr(ID.Num) +
926 "' is actually of type '"+
927 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
930 GenerateError("Illegal label reference " + ID.getName());
934 // If its already been defined, return it now.
936 ID.destroy(); // Free strdup'd memory.
940 // Otherwise, this block has not been seen before, create it.
942 if (ID.Type == ValID::LocalName)
944 BB = new BasicBlock(Name, CurFun.CurrentFunction);
946 // Insert it in the forward refs map.
947 CurFun.BBForwardRefs[ID] = BB;
953 //===----------------------------------------------------------------------===//
954 // Code to handle forward references in instructions
955 //===----------------------------------------------------------------------===//
957 // This code handles the late binding needed with statements that reference
958 // values not defined yet... for example, a forward branch, or the PHI node for
961 // This keeps a table (CurFun.LateResolveValues) of all such forward references
962 // and back patchs after we are done.
965 // ResolveDefinitions - If we could not resolve some defs at parsing
966 // time (forward branches, phi functions for loops, etc...) resolve the
970 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
971 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
972 while (!LateResolvers.empty()) {
973 Value *V = LateResolvers.back();
974 LateResolvers.pop_back();
976 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
977 CurModule.PlaceHolderInfo.find(V);
978 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
980 ValID &DID = PHI->second.first;
982 Value *TheRealValue = getExistingVal(V->getType(), DID);
986 V->replaceAllUsesWith(TheRealValue);
988 CurModule.PlaceHolderInfo.erase(PHI);
989 } else if (FutureLateResolvers) {
990 // Functions have their unresolved items forwarded to the module late
992 InsertValue(V, *FutureLateResolvers);
994 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
995 GenerateError("Reference to an invalid definition: '" +DID.getName()+
996 "' of type '" + V->getType()->getDescription() + "'",
1000 GenerateError("Reference to an invalid definition: #" +
1001 itostr(DID.Num) + " of type '" +
1002 V->getType()->getDescription() + "'",
1003 PHI->second.second);
1008 LateResolvers.clear();
1011 // ResolveTypeTo - A brand new type was just declared. This means that (if
1012 // name is not null) things referencing Name can be resolved. Otherwise, things
1013 // refering to the number can be resolved. Do this now.
1015 static void ResolveTypeTo(char *Name, const Type *ToTy) {
1017 if (Name) D = ValID::createLocalName(Name);
1018 else D = ValID::createLocalID(CurModule.Types.size());
1020 std::map<ValID, PATypeHolder>::iterator I =
1021 CurModule.LateResolveTypes.find(D);
1022 if (I != CurModule.LateResolveTypes.end()) {
1023 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1024 CurModule.LateResolveTypes.erase(I);
1028 // setValueName - Set the specified value to the name given. The name may be
1029 // null potentially, in which case this is a noop. The string passed in is
1030 // assumed to be a malloc'd string buffer, and is free'd by this function.
1032 static void setValueName(Value *V, char *NameStr) {
1033 if (!NameStr) return;
1034 std::string Name(NameStr); // Copy string
1035 free(NameStr); // Free old string
1037 if (V->getType() == Type::VoidTy) {
1038 GenerateError("Can't assign name '" + Name+"' to value with void type");
1042 assert(inFunctionScope() && "Must be in function scope!");
1043 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1044 if (ST.lookup(Name)) {
1045 GenerateError("Redefinition of value '" + Name + "' of type '" +
1046 V->getType()->getDescription() + "'");
1054 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1055 /// this is a declaration, otherwise it is a definition.
1056 static GlobalVariable *
1057 ParseGlobalVariable(char *NameStr,
1058 GlobalValue::LinkageTypes Linkage,
1059 GlobalValue::VisibilityTypes Visibility,
1060 bool isConstantGlobal, const Type *Ty,
1061 Constant *Initializer, bool IsThreadLocal) {
1062 if (isa<FunctionType>(Ty)) {
1063 GenerateError("Cannot declare global vars of function type");
1067 const PointerType *PTy = PointerType::get(Ty);
1071 Name = NameStr; // Copy string
1072 free(NameStr); // Free old string
1075 // See if this global value was forward referenced. If so, recycle the
1078 if (!Name.empty()) {
1079 ID = ValID::createGlobalName((char*)Name.c_str());
1081 ID = ValID::createGlobalID(CurModule.Values.size());
1084 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1085 // Move the global to the end of the list, from whereever it was
1086 // previously inserted.
1087 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1088 CurModule.CurrentModule->getGlobalList().remove(GV);
1089 CurModule.CurrentModule->getGlobalList().push_back(GV);
1090 GV->setInitializer(Initializer);
1091 GV->setLinkage(Linkage);
1092 GV->setVisibility(Visibility);
1093 GV->setConstant(isConstantGlobal);
1094 GV->setThreadLocal(IsThreadLocal);
1095 InsertValue(GV, CurModule.Values);
1099 // If this global has a name
1100 if (!Name.empty()) {
1101 // if the global we're parsing has an initializer (is a definition) and
1102 // has external linkage.
1103 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1104 // If there is already a global with external linkage with this name
1105 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1106 // If we allow this GVar to get created, it will be renamed in the
1107 // symbol table because it conflicts with an existing GVar. We can't
1108 // allow redefinition of GVars whose linking indicates that their name
1109 // must stay the same. Issue the error.
1110 GenerateError("Redefinition of global variable named '" + Name +
1111 "' of type '" + Ty->getDescription() + "'");
1116 // Otherwise there is no existing GV to use, create one now.
1117 GlobalVariable *GV =
1118 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1119 CurModule.CurrentModule, IsThreadLocal);
1120 GV->setVisibility(Visibility);
1121 InsertValue(GV, CurModule.Values);
1125 // setTypeName - Set the specified type to the name given. The name may be
1126 // null potentially, in which case this is a noop. The string passed in is
1127 // assumed to be a malloc'd string buffer, and is freed by this function.
1129 // This function returns true if the type has already been defined, but is
1130 // allowed to be redefined in the specified context. If the name is a new name
1131 // for the type plane, it is inserted and false is returned.
1132 static bool setTypeName(const Type *T, char *NameStr) {
1133 assert(!inFunctionScope() && "Can't give types function-local names!");
1134 if (NameStr == 0) return false;
1136 std::string Name(NameStr); // Copy string
1137 free(NameStr); // Free old string
1139 // We don't allow assigning names to void type
1140 if (T == Type::VoidTy) {
1141 GenerateError("Can't assign name '" + Name + "' to the void type");
1145 // Set the type name, checking for conflicts as we do so.
1146 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1148 if (AlreadyExists) { // Inserting a name that is already defined???
1149 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1150 assert(Existing && "Conflict but no matching type?!");
1152 // There is only one case where this is allowed: when we are refining an
1153 // opaque type. In this case, Existing will be an opaque type.
1154 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1155 // We ARE replacing an opaque type!
1156 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1160 // Otherwise, this is an attempt to redefine a type. That's okay if
1161 // the redefinition is identical to the original. This will be so if
1162 // Existing and T point to the same Type object. In this one case we
1163 // allow the equivalent redefinition.
1164 if (Existing == T) return true; // Yes, it's equal.
1166 // Any other kind of (non-equivalent) redefinition is an error.
1167 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1168 T->getDescription() + "'");
1174 //===----------------------------------------------------------------------===//
1175 // Code for handling upreferences in type names...
1178 // TypeContains - Returns true if Ty directly contains E in it.
1180 static bool TypeContains(const Type *Ty, const Type *E) {
1181 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1182 E) != Ty->subtype_end();
1186 struct UpRefRecord {
1187 // NestingLevel - The number of nesting levels that need to be popped before
1188 // this type is resolved.
1189 unsigned NestingLevel;
1191 // LastContainedTy - This is the type at the current binding level for the
1192 // type. Every time we reduce the nesting level, this gets updated.
1193 const Type *LastContainedTy;
1195 // UpRefTy - This is the actual opaque type that the upreference is
1196 // represented with.
1197 OpaqueType *UpRefTy;
1199 UpRefRecord(unsigned NL, OpaqueType *URTy)
1200 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1204 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1205 static std::vector<UpRefRecord> UpRefs;
1207 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1208 /// called. It loops through the UpRefs vector, which is a list of the
1209 /// currently active types. For each type, if the up reference is contained in
1210 /// the newly completed type, we decrement the level count. When the level
1211 /// count reaches zero, the upreferenced type is the type that is passed in:
1212 /// thus we can complete the cycle.
1214 static PATypeHolder HandleUpRefs(const Type *ty) {
1215 // If Ty isn't abstract, or if there are no up-references in it, then there is
1216 // nothing to resolve here.
1217 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1219 PATypeHolder Ty(ty);
1220 UR_OUT("Type '" << Ty->getDescription() <<
1221 "' newly formed. Resolving upreferences.\n" <<
1222 UpRefs.size() << " upreferences active!\n");
1224 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1225 // to zero), we resolve them all together before we resolve them to Ty. At
1226 // the end of the loop, if there is anything to resolve to Ty, it will be in
1228 OpaqueType *TypeToResolve = 0;
1230 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1231 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1232 << UpRefs[i].second->getDescription() << ") = "
1233 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1234 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1235 // Decrement level of upreference
1236 unsigned Level = --UpRefs[i].NestingLevel;
1237 UpRefs[i].LastContainedTy = Ty;
1238 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1239 if (Level == 0) { // Upreference should be resolved!
1240 if (!TypeToResolve) {
1241 TypeToResolve = UpRefs[i].UpRefTy;
1243 UR_OUT(" * Resolving upreference for "
1244 << UpRefs[i].second->getDescription() << "\n";
1245 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1246 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1247 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1248 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1250 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1251 --i; // Do not skip the next element...
1256 if (TypeToResolve) {
1257 UR_OUT(" * Resolving upreference for "
1258 << UpRefs[i].second->getDescription() << "\n";
1259 std::string OldName = TypeToResolve->getDescription());
1260 TypeToResolve->refineAbstractTypeTo(Ty);
1266 //===----------------------------------------------------------------------===//
1267 // RunVMAsmParser - Define an interface to this parser
1268 //===----------------------------------------------------------------------===//
1270 static Module* RunParser(Module * M);
1272 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1275 CurFilename = Filename;
1276 return RunParser(new Module(CurFilename));
1279 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1280 set_scan_string(AsmString);
1282 CurFilename = "from_memory";
1284 return RunParser(new Module (CurFilename));
1286 return RunParser(M);
1292 /* Enabling traces. */
1297 /* Enabling verbose error messages. */
1298 #ifdef YYERROR_VERBOSE
1299 # undef YYERROR_VERBOSE
1300 # define YYERROR_VERBOSE 1
1302 # define YYERROR_VERBOSE 0
1305 /* Enabling the token table. */
1306 #ifndef YYTOKEN_TABLE
1307 # define YYTOKEN_TABLE 0
1310 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1311 typedef union YYSTYPE
1312 #line 954 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
1314 llvm::Module *ModuleVal;
1315 llvm::Function *FunctionVal;
1316 llvm::BasicBlock *BasicBlockVal;
1317 llvm::TerminatorInst *TermInstVal;
1318 llvm::Instruction *InstVal;
1319 llvm::Constant *ConstVal;
1321 const llvm::Type *PrimType;
1322 std::list<llvm::PATypeHolder> *TypeList;
1323 llvm::PATypeHolder *TypeVal;
1324 llvm::Value *ValueVal;
1325 std::vector<llvm::Value*> *ValueList;
1326 llvm::ArgListType *ArgList;
1327 llvm::TypeWithAttrs TypeWithAttrs;
1328 llvm::TypeWithAttrsList *TypeWithAttrsList;
1329 llvm::ValueRefList *ValueRefList;
1331 // Represent the RHS of PHI node
1332 std::list<std::pair<llvm::Value*,
1333 llvm::BasicBlock*> > *PHIList;
1334 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1335 std::vector<llvm::Constant*> *ConstVector;
1337 llvm::GlobalValue::LinkageTypes Linkage;
1338 llvm::GlobalValue::VisibilityTypes Visibility;
1339 uint16_t ParamAttrs;
1340 llvm::APInt *APIntVal;
1348 char *StrVal; // This memory is strdup'd!
1349 llvm::ValID ValIDVal; // strdup'd memory maybe!
1351 llvm::Instruction::BinaryOps BinaryOpVal;
1352 llvm::Instruction::TermOps TermOpVal;
1353 llvm::Instruction::MemoryOps MemOpVal;
1354 llvm::Instruction::CastOps CastOpVal;
1355 llvm::Instruction::OtherOps OtherOpVal;
1356 llvm::ICmpInst::Predicate IPredicate;
1357 llvm::FCmpInst::Predicate FPredicate;
1359 /* Line 187 of yacc.c. */
1360 #line 1361 "llvmAsmParser.tab.c"
1362 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1363 # define YYSTYPE_IS_DECLARED 1
1364 # define YYSTYPE_IS_TRIVIAL 1
1369 /* Copy the second part of user declarations. */
1372 /* Line 216 of yacc.c. */
1373 #line 1374 "llvmAsmParser.tab.c"
1380 typedef YYTYPE_UINT8 yytype_uint8;
1382 typedef unsigned char yytype_uint8;
1386 typedef YYTYPE_INT8 yytype_int8;
1387 #elif (defined __STDC__ || defined __C99__FUNC__ \
1388 || defined __cplusplus || defined _MSC_VER)
1389 typedef signed char yytype_int8;
1391 typedef short int yytype_int8;
1394 #ifdef YYTYPE_UINT16
1395 typedef YYTYPE_UINT16 yytype_uint16;
1397 typedef unsigned short int yytype_uint16;
1401 typedef YYTYPE_INT16 yytype_int16;
1403 typedef short int yytype_int16;
1407 # ifdef __SIZE_TYPE__
1408 # define YYSIZE_T __SIZE_TYPE__
1409 # elif defined size_t
1410 # define YYSIZE_T size_t
1411 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1412 || defined __cplusplus || defined _MSC_VER)
1413 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1414 # define YYSIZE_T size_t
1416 # define YYSIZE_T unsigned int
1420 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1425 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1426 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1430 # define YY_(msgid) msgid
1434 /* Suppress unused-variable warnings by "using" E. */
1435 #if ! defined lint || defined __GNUC__
1436 # define YYUSE(e) ((void) (e))
1438 # define YYUSE(e) /* empty */
1441 /* Identity function, used to suppress warnings about constant conditions. */
1443 # define YYID(n) (n)
1445 #if (defined __STDC__ || defined __C99__FUNC__ \
1446 || defined __cplusplus || defined _MSC_VER)
1459 #if ! defined yyoverflow || YYERROR_VERBOSE
1461 /* The parser invokes alloca or malloc; define the necessary symbols. */
1463 # ifdef YYSTACK_USE_ALLOCA
1464 # if YYSTACK_USE_ALLOCA
1466 # define YYSTACK_ALLOC __builtin_alloca
1467 # elif defined __BUILTIN_VA_ARG_INCR
1468 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1470 # define YYSTACK_ALLOC __alloca
1471 # elif defined _MSC_VER
1472 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1473 # define alloca _alloca
1475 # define YYSTACK_ALLOC alloca
1476 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1477 || defined __cplusplus || defined _MSC_VER)
1478 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1480 # define _STDLIB_H 1
1487 # ifdef YYSTACK_ALLOC
1488 /* Pacify GCC's `empty if-body' warning. */
1489 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1490 # ifndef YYSTACK_ALLOC_MAXIMUM
1491 /* The OS might guarantee only one guard page at the bottom of the stack,
1492 and a page size can be as small as 4096 bytes. So we cannot safely
1493 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1494 to allow for a few compiler-allocated temporary stack slots. */
1495 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1498 # define YYSTACK_ALLOC YYMALLOC
1499 # define YYSTACK_FREE YYFREE
1500 # ifndef YYSTACK_ALLOC_MAXIMUM
1501 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1503 # if (defined __cplusplus && ! defined _STDLIB_H \
1504 && ! ((defined YYMALLOC || defined malloc) \
1505 && (defined YYFREE || defined free)))
1506 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1508 # define _STDLIB_H 1
1512 # define YYMALLOC malloc
1513 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1514 || defined __cplusplus || defined _MSC_VER)
1515 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1519 # define YYFREE free
1520 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1521 || defined __cplusplus || defined _MSC_VER)
1522 void free (void *); /* INFRINGES ON USER NAME SPACE */
1526 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1529 #if (! defined yyoverflow \
1530 && (! defined __cplusplus \
1531 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1533 /* A type that is properly aligned for any stack member. */
1540 /* The size of the maximum gap between one aligned stack and the next. */
1541 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1543 /* The size of an array large to enough to hold all stacks, each with
1545 # define YYSTACK_BYTES(N) \
1546 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1547 + YYSTACK_GAP_MAXIMUM)
1549 /* Copy COUNT objects from FROM to TO. The source and destination do
1552 # if defined __GNUC__ && 1 < __GNUC__
1553 # define YYCOPY(To, From, Count) \
1554 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1556 # define YYCOPY(To, From, Count) \
1560 for (yyi = 0; yyi < (Count); yyi++) \
1561 (To)[yyi] = (From)[yyi]; \
1567 /* Relocate STACK from its old location to the new one. The
1568 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1569 elements in the stack, and YYPTR gives the new location of the
1570 stack. Advance YYPTR to a properly aligned location for the next
1572 # define YYSTACK_RELOCATE(Stack) \
1575 YYSIZE_T yynewbytes; \
1576 YYCOPY (&yyptr->Stack, Stack, yysize); \
1577 Stack = &yyptr->Stack; \
1578 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1579 yyptr += yynewbytes / sizeof (*yyptr); \
1585 /* YYFINAL -- State number of the termination state. */
1587 /* YYLAST -- Last index in YYTABLE. */
1590 /* YYNTOKENS -- Number of terminals. */
1591 #define YYNTOKENS 150
1592 /* YYNNTS -- Number of nonterminals. */
1594 /* YYNRULES -- Number of rules. */
1595 #define YYNRULES 296
1596 /* YYNRULES -- Number of states. */
1597 #define YYNSTATES 580
1599 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1600 #define YYUNDEFTOK 2
1601 #define YYMAXUTOK 390
1603 #define YYTRANSLATE(YYX) \
1604 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1606 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1607 static const yytype_uint8 yytranslate[] =
1609 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1613 140, 141, 138, 2, 137, 2, 2, 2, 2, 2,
1614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1615 145, 136, 146, 2, 2, 2, 2, 2, 2, 2,
1616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1618 2, 142, 139, 144, 2, 2, 2, 2, 2, 149,
1619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1621 143, 2, 2, 147, 2, 148, 2, 2, 2, 2,
1622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1634 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1635 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1636 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1637 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1638 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1639 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1640 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1641 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1642 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1643 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1644 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1645 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1646 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1647 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1652 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1654 static const yytype_uint16 yyprhs[] =
1656 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1657 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1658 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1659 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1660 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1661 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1662 119, 121, 122, 125, 126, 128, 130, 132, 133, 136,
1663 138, 140, 142, 144, 146, 148, 150, 152, 153, 155,
1664 157, 158, 160, 162, 163, 165, 167, 169, 171, 172,
1665 174, 176, 177, 179, 181, 183, 185, 187, 190, 192,
1666 194, 196, 198, 199, 202, 204, 206, 208, 209, 212,
1667 213, 216, 217, 221, 224, 225, 227, 228, 232, 234,
1668 237, 239, 241, 243, 245, 247, 249, 252, 254, 257,
1669 263, 269, 275, 281, 285, 288, 294, 299, 302, 304,
1670 306, 308, 312, 314, 318, 320, 321, 323, 327, 332,
1671 336, 340, 345, 350, 354, 361, 367, 370, 373, 376,
1672 379, 382, 385, 388, 391, 394, 397, 400, 403, 410,
1673 416, 425, 432, 439, 447, 455, 462, 471, 480, 484,
1674 486, 488, 490, 492, 493, 496, 503, 505, 506, 508,
1675 511, 512, 516, 517, 521, 525, 529, 533, 534, 542,
1676 543, 552, 553, 562, 568, 571, 575, 577, 581, 585,
1677 589, 593, 595, 596, 602, 606, 608, 612, 614, 615,
1678 625, 627, 629, 634, 636, 638, 641, 645, 646, 648,
1679 650, 652, 654, 656, 658, 660, 662, 664, 668, 670,
1680 676, 678, 680, 682, 684, 686, 688, 691, 694, 697,
1681 701, 704, 705, 707, 710, 713, 717, 727, 737, 746,
1682 761, 763, 765, 772, 778, 781, 788, 796, 800, 806,
1683 807, 808, 812, 815, 817, 823, 829, 836, 843, 848,
1684 855, 860, 865, 872, 879, 882, 891, 893, 895, 896,
1685 900, 907, 911, 918, 921, 927, 935
1688 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1689 static const yytype_int16 yyrhs[] =
1691 194, 0, -1, 69, -1, 70, -1, 71, -1, 72,
1692 -1, 73, -1, 74, -1, 75, -1, 76, -1, 77,
1693 -1, 81, -1, 82, -1, 83, -1, 78, -1, 79,
1694 -1, 80, -1, 112, -1, 113, -1, 114, -1, 115,
1695 -1, 116, -1, 117, -1, 118, -1, 119, -1, 120,
1696 -1, 121, -1, 122, -1, 123, -1, 86, -1, 87,
1697 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1698 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1699 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1700 -1, 103, -1, 104, -1, 105, -1, 92, -1, 93,
1701 -1, 94, -1, 95, -1, 22, -1, 23, -1, 11,
1702 -1, 12, -1, 13, -1, 16, -1, 19, -1, 158,
1703 -1, -1, 158, 136, -1, -1, 17, -1, 20, -1,
1704 163, -1, -1, 161, 136, -1, 38, -1, 40, -1,
1705 39, -1, 41, -1, 43, -1, 42, -1, 44, -1,
1706 46, -1, -1, 134, -1, 135, -1, -1, 42, -1,
1707 44, -1, -1, 38, -1, 39, -1, 40, -1, 43,
1708 -1, -1, 40, -1, 38, -1, -1, 57, -1, 58,
1709 -1, 59, -1, 60, -1, 61, -1, 56, 4, -1,
1710 113, -1, 114, -1, 131, -1, 132, -1, -1, 172,
1711 171, -1, 130, -1, 133, -1, 171, -1, -1, 174,
1712 173, -1, -1, 49, 4, -1, -1, 137, 49, 4,
1713 -1, 30, 19, -1, -1, 177, -1, -1, 137, 180,
1714 179, -1, 177, -1, 49, 4, -1, 11, -1, 12,
1715 -1, 13, -1, 14, -1, 45, -1, 181, -1, 182,
1716 138, -1, 216, -1, 139, 4, -1, 182, 140, 186,
1717 141, 174, -1, 10, 140, 186, 141, 174, -1, 142,
1718 4, 143, 182, 144, -1, 145, 4, 143, 182, 146,
1719 -1, 147, 187, 148, -1, 147, 148, -1, 145, 147,
1720 187, 148, 146, -1, 145, 147, 148, 146, -1, 182,
1721 172, -1, 182, -1, 10, -1, 183, -1, 185, 137,
1722 183, -1, 185, -1, 185, 137, 35, -1, 35, -1,
1723 -1, 182, -1, 187, 137, 182, -1, 182, 142, 190,
1724 144, -1, 182, 142, 144, -1, 182, 149, 19, -1,
1725 182, 145, 190, 146, -1, 182, 147, 190, 148, -1,
1726 182, 147, 148, -1, 182, 145, 147, 190, 148, 146,
1727 -1, 182, 145, 147, 148, 146, -1, 182, 36, -1,
1728 182, 37, -1, 182, 216, -1, 182, 189, -1, 182,
1729 21, -1, 156, 3, -1, 156, 5, -1, 156, 4,
1730 -1, 156, 6, -1, 11, 22, -1, 11, 23, -1,
1731 157, 9, -1, 153, 140, 188, 34, 182, 141, -1,
1732 111, 140, 188, 227, 141, -1, 125, 140, 188, 137,
1733 188, 137, 188, 141, -1, 151, 140, 188, 137, 188,
1734 141, -1, 152, 140, 188, 137, 188, 141, -1, 84,
1735 154, 140, 188, 137, 188, 141, -1, 85, 155, 140,
1736 188, 137, 188, 141, -1, 127, 140, 188, 137, 188,
1737 141, -1, 128, 140, 188, 137, 188, 137, 188, 141,
1738 -1, 129, 140, 188, 137, 188, 137, 188, 141, -1,
1739 190, 137, 188, -1, 188, -1, 28, -1, 29, -1,
1740 33, -1, -1, 184, 216, -1, 117, 140, 193, 34,
1741 182, 141, -1, 195, -1, -1, 196, -1, 195, 196,
1742 -1, -1, 27, 197, 212, -1, -1, 26, 198, 213,
1743 -1, 54, 53, 202, -1, 160, 15, 182, -1, 160,
1744 15, 10, -1, -1, 162, 166, 192, 191, 188, 199,
1745 179, -1, -1, 162, 164, 166, 192, 191, 188, 200,
1746 179, -1, -1, 162, 165, 166, 192, 191, 182, 201,
1747 179, -1, 162, 166, 31, 169, 193, -1, 47, 203,
1748 -1, 50, 136, 204, -1, 19, -1, 48, 136, 19,
1749 -1, 62, 136, 19, -1, 142, 205, 144, -1, 205,
1750 137, 19, -1, 19, -1, -1, 206, 137, 182, 172,
1751 159, -1, 182, 172, 159, -1, 206, -1, 206, 137,
1752 35, -1, 35, -1, -1, 170, 184, 161, 140, 207,
1753 141, 174, 178, 175, -1, 24, -1, 147, -1, 168,
1754 166, 208, 209, -1, 25, -1, 148, -1, 219, 211,
1755 -1, 167, 166, 208, -1, -1, 55, -1, 3, -1,
1756 4, -1, 9, -1, 22, -1, 23, -1, 36, -1,
1757 37, -1, 21, -1, 145, 190, 146, -1, 189, -1,
1758 53, 214, 19, 137, 19, -1, 7, -1, 8, -1,
1759 158, -1, 161, -1, 216, -1, 215, -1, 182, 217,
1760 -1, 219, 220, -1, 210, 220, -1, 221, 160, 222,
1761 -1, 221, 224, -1, -1, 18, -1, 63, 218, -1,
1762 63, 10, -1, 64, 14, 217, -1, 64, 11, 217,
1763 137, 14, 217, 137, 14, 217, -1, 65, 156, 217,
1764 137, 14, 217, 142, 223, 144, -1, 65, 156, 217,
1765 137, 14, 217, 142, 144, -1, 66, 170, 184, 217,
1766 140, 226, 141, 174, 34, 14, 217, 67, 14, 217,
1767 -1, 67, -1, 68, -1, 223, 156, 215, 137, 14,
1768 217, -1, 156, 215, 137, 14, 217, -1, 160, 229,
1769 -1, 182, 142, 217, 137, 217, 144, -1, 225, 137,
1770 142, 217, 137, 217, 144, -1, 182, 217, 172, -1,
1771 226, 137, 182, 217, 172, -1, -1, -1, 227, 137,
1772 218, -1, 52, 51, -1, 51, -1, 151, 182, 217,
1773 137, 217, -1, 152, 182, 217, 137, 217, -1, 84,
1774 154, 182, 217, 137, 217, -1, 85, 155, 182, 217,
1775 137, 217, -1, 153, 218, 34, 182, -1, 125, 218,
1776 137, 218, 137, 218, -1, 126, 218, 137, 182, -1,
1777 127, 218, 137, 218, -1, 128, 218, 137, 218, 137,
1778 218, -1, 129, 218, 137, 218, 137, 218, -1, 124,
1779 225, -1, 228, 170, 184, 217, 140, 226, 141, 174,
1780 -1, 231, -1, 32, -1, -1, 106, 182, 176, -1,
1781 106, 182, 137, 11, 217, 176, -1, 107, 182, 176,
1782 -1, 107, 182, 137, 11, 217, 176, -1, 108, 218,
1783 -1, 230, 109, 182, 217, 176, -1, 230, 110, 218,
1784 137, 182, 217, 176, -1, 111, 182, 217, 227, -1
1787 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1788 static const yytype_uint16 yyrline[] =
1790 0, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110, 1110,
1791 1110, 1111, 1111, 1111, 1111, 1111, 1111, 1112, 1112, 1112,
1792 1112, 1112, 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1116,
1793 1116, 1117, 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1124,
1794 1124, 1125, 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129,
1795 1129, 1130, 1130, 1131, 1132, 1137, 1138, 1138, 1140, 1140,
1796 1141, 1141, 1145, 1149, 1154, 1154, 1156, 1157, 1162, 1168,
1797 1169, 1170, 1171, 1172, 1176, 1177, 1178, 1182, 1183, 1184,
1798 1188, 1189, 1190, 1194, 1195, 1196, 1197, 1198, 1202, 1203,
1799 1204, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1220, 1221,
1800 1222, 1223, 1226, 1227, 1232, 1233, 1234, 1237, 1238, 1245,
1801 1246, 1252, 1253, 1261, 1269, 1270, 1275, 1276, 1277, 1282,
1802 1295, 1295, 1295, 1295, 1298, 1302, 1306, 1313, 1318, 1326,
1803 1356, 1387, 1392, 1404, 1414, 1418, 1428, 1435, 1442, 1449,
1804 1454, 1459, 1466, 1467, 1474, 1481, 1489, 1495, 1507, 1535,
1805 1551, 1580, 1608, 1634, 1654, 1680, 1700, 1712, 1719, 1785,
1806 1795, 1805, 1811, 1821, 1827, 1837, 1842, 1847, 1855, 1867,
1807 1889, 1897, 1903, 1914, 1919, 1924, 1930, 1936, 1945, 1949,
1808 1957, 1957, 1960, 1960, 1963, 1974, 1995, 2000, 2008, 2009,
1809 2013, 2013, 2017, 2017, 2020, 2023, 2047, 2058, 2058, 2069,
1810 2068, 2078, 2077, 2088, 2103, 2106, 2112, 2125, 2129, 2134,
1811 2136, 2141, 2146, 2155, 2165, 2176, 2180, 2189, 2198, 2203,
1812 2325, 2325, 2327, 2336, 2336, 2338, 2343, 2355, 2359, 2364,
1813 2368, 2372, 2376, 2380, 2384, 2388, 2392, 2396, 2421, 2425,
1814 2439, 2443, 2447, 2451, 2457, 2457, 2463, 2472, 2476, 2485,
1815 2494, 2503, 2507, 2512, 2516, 2520, 2525, 2535, 2554, 2563,
1816 2643, 2647, 2654, 2665, 2678, 2688, 2699, 2709, 2718, 2727,
1817 2730, 2731, 2738, 2742, 2747, 2768, 2785, 2799, 2813, 2825,
1818 2833, 2840, 2846, 2852, 2858, 2873, 2958, 2963, 2967, 2974,
1819 2981, 2989, 2996, 3004, 3012, 3026, 3043
1823 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1824 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1825 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1826 static const char *const yytname[] =
1828 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1829 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1830 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1831 "STRINGCONSTANT", "ATSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1832 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1833 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1834 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1835 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1836 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1837 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1838 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1839 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1840 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1841 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1842 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1843 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1844 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1845 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1846 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1847 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET",
1848 "NOUNWIND", "DEFAULT", "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('",
1849 "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept",
1850 "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", "FPredicates",
1851 "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign",
1852 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1853 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1854 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1855 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign",
1856 "SectionString", "OptSection", "GlobalVarAttributes",
1857 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1858 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1859 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1860 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1861 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1862 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1863 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1864 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1865 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1866 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1867 "OptVolatile", "MemoryInst", 0
1872 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1874 static const yytype_uint16 yytoknum[] =
1876 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1877 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1878 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1879 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1880 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1881 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1882 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1883 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1884 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1885 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1886 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1887 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1888 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1889 385, 386, 387, 388, 389, 390, 61, 44, 42, 92,
1890 40, 41, 91, 120, 93, 60, 62, 123, 125, 99
1894 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1895 static const yytype_uint8 yyr1[] =
1897 0, 150, 151, 151, 151, 151, 151, 151, 151, 151,
1898 151, 152, 152, 152, 152, 152, 152, 153, 153, 153,
1899 153, 153, 153, 153, 153, 153, 153, 153, 153, 154,
1900 154, 154, 154, 154, 154, 154, 154, 154, 154, 155,
1901 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
1902 155, 155, 155, 155, 155, 156, 157, 157, 158, 158,
1903 159, 159, 160, 160, 161, 161, 162, 162, 163, 164,
1904 164, 164, 164, 164, 165, 165, 165, 166, 166, 166,
1905 167, 167, 167, 168, 168, 168, 168, 168, 169, 169,
1906 169, 170, 170, 170, 170, 170, 170, 170, 171, 171,
1907 171, 171, 172, 172, 173, 173, 173, 174, 174, 175,
1908 175, 176, 176, 177, 178, 178, 179, 179, 180, 180,
1909 181, 181, 181, 181, 182, 182, 182, 182, 182, 182,
1910 182, 182, 182, 182, 182, 182, 182, 183, 184, 184,
1911 185, 185, 186, 186, 186, 186, 187, 187, 188, 188,
1912 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
1913 188, 188, 188, 188, 188, 188, 188, 188, 189, 189,
1914 189, 189, 189, 189, 189, 189, 189, 189, 190, 190,
1915 191, 191, 192, 192, 193, 193, 194, 194, 195, 195,
1916 197, 196, 198, 196, 196, 196, 196, 199, 196, 200,
1917 196, 201, 196, 196, 196, 196, 202, 203, 203, 204,
1918 205, 205, 205, 206, 206, 207, 207, 207, 207, 208,
1919 209, 209, 210, 211, 211, 212, 213, 214, 214, 215,
1920 215, 215, 215, 215, 215, 215, 215, 215, 215, 215,
1921 216, 216, 216, 216, 217, 217, 218, 219, 219, 220,
1922 221, 221, 221, 222, 222, 222, 222, 222, 222, 222,
1923 222, 222, 223, 223, 224, 225, 225, 226, 226, 226,
1924 227, 227, 228, 228, 229, 229, 229, 229, 229, 229,
1925 229, 229, 229, 229, 229, 229, 229, 230, 230, 231,
1926 231, 231, 231, 231, 231, 231, 231
1929 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1930 static const yytype_uint8 yyr2[] =
1932 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1933 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1934 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1935 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1936 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1937 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1938 1, 0, 2, 0, 1, 1, 1, 0, 2, 1,
1939 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
1940 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,
1941 1, 0, 1, 1, 1, 1, 1, 2, 1, 1,
1942 1, 1, 0, 2, 1, 1, 1, 0, 2, 0,
1943 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1944 1, 1, 1, 1, 1, 1, 2, 1, 2, 5,
1945 5, 5, 5, 3, 2, 5, 4, 2, 1, 1,
1946 1, 3, 1, 3, 1, 0, 1, 3, 4, 3,
1947 3, 4, 4, 3, 6, 5, 2, 2, 2, 2,
1948 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1949 8, 6, 6, 7, 7, 6, 8, 8, 3, 1,
1950 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
1951 0, 3, 0, 3, 3, 3, 3, 0, 7, 0,
1952 8, 0, 8, 5, 2, 3, 1, 3, 3, 3,
1953 3, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1954 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1955 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1956 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
1957 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
1958 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1959 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1960 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1964 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1965 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1966 means the default is an error. */
1967 static const yytype_uint16 yydefact[] =
1969 67, 58, 64, 59, 65, 192, 190, 0, 0, 0,
1970 0, 0, 0, 77, 66, 0, 67, 188, 80, 83,
1971 0, 0, 204, 0, 0, 62, 0, 68, 69, 71,
1972 70, 72, 74, 73, 75, 76, 78, 79, 77, 77,
1973 183, 1, 189, 81, 82, 77, 193, 84, 85, 86,
1974 87, 77, 251, 191, 251, 0, 0, 212, 205, 206,
1975 194, 240, 241, 196, 120, 121, 122, 123, 124, 0,
1976 0, 0, 0, 242, 243, 125, 195, 127, 183, 183,
1977 88, 182, 0, 91, 91, 252, 248, 63, 223, 224,
1978 225, 247, 207, 208, 211, 0, 145, 128, 0, 0,
1979 0, 0, 134, 146, 0, 126, 145, 0, 0, 90,
1980 89, 0, 180, 181, 0, 0, 92, 93, 94, 95,
1981 96, 0, 226, 0, 288, 250, 0, 209, 144, 102,
1982 140, 142, 0, 0, 0, 0, 0, 0, 133, 0,
1983 0, 0, 139, 0, 138, 0, 203, 120, 121, 122,
1984 0, 0, 0, 197, 97, 0, 220, 221, 222, 287,
1985 273, 0, 0, 0, 0, 91, 260, 261, 2, 3,
1986 4, 5, 6, 7, 8, 9, 10, 14, 15, 16,
1987 11, 12, 13, 0, 0, 0, 0, 0, 0, 17,
1988 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1989 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1990 249, 91, 264, 0, 286, 210, 137, 0, 107, 0,
1991 0, 136, 0, 147, 107, 199, 201, 0, 184, 165,
1992 166, 161, 163, 162, 164, 167, 160, 156, 157, 0,
1993 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1994 0, 0, 0, 159, 158, 116, 0, 272, 254, 0,
1995 253, 0, 0, 55, 0, 0, 29, 30, 31, 32,
1996 33, 34, 35, 36, 37, 38, 0, 53, 54, 49,
1997 50, 51, 52, 39, 40, 41, 42, 43, 44, 45,
1998 46, 47, 48, 0, 111, 111, 293, 0, 0, 284,
1999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2000 0, 98, 99, 100, 101, 103, 143, 141, 130, 131,
2001 132, 135, 129, 116, 116, 0, 0, 0, 0, 0,
2002 0, 0, 0, 149, 179, 0, 0, 0, 153, 0,
2003 150, 0, 0, 0, 0, 198, 218, 229, 230, 231,
2004 236, 232, 233, 234, 235, 227, 0, 238, 245, 244,
2005 246, 0, 255, 0, 0, 0, 0, 0, 289, 0,
2006 291, 270, 0, 0, 0, 0, 0, 0, 0, 0,
2007 0, 0, 0, 0, 0, 104, 105, 106, 108, 200,
2008 202, 0, 0, 0, 270, 0, 0, 0, 0, 0,
2009 148, 134, 146, 0, 151, 152, 0, 0, 0, 0,
2010 0, 118, 116, 217, 102, 215, 0, 228, 0, 0,
2011 0, 0, 0, 0, 0, 0, 0, 0, 296, 0,
2012 0, 0, 280, 281, 0, 0, 0, 0, 278, 0,
2013 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 178, 155, 0, 0, 0, 0, 113, 119, 117, 61,
2015 0, 107, 0, 237, 0, 0, 269, 0, 0, 111,
2016 112, 111, 0, 0, 0, 0, 0, 0, 274, 275,
2017 269, 0, 294, 0, 185, 0, 0, 169, 0, 0,
2018 0, 0, 154, 0, 0, 0, 60, 214, 216, 102,
2019 114, 0, 0, 0, 0, 0, 276, 277, 290, 292,
2020 271, 0, 0, 279, 282, 283, 0, 111, 0, 0,
2021 0, 175, 0, 0, 171, 172, 168, 61, 115, 109,
2022 239, 0, 0, 102, 0, 107, 265, 0, 107, 295,
2023 173, 174, 0, 0, 0, 213, 0, 219, 0, 258,
2024 0, 0, 267, 0, 0, 266, 285, 170, 176, 177,
2025 110, 256, 0, 257, 0, 102, 0, 0, 0, 268,
2026 0, 0, 0, 0, 263, 0, 0, 262, 0, 259
2029 /* YYDEFGOTO[NTERM-NUM]. */
2030 static const yytype_int16 yydefgoto[] =
2032 -1, 250, 251, 252, 276, 293, 150, 151, 73, 497,
2033 11, 74, 13, 14, 38, 39, 40, 45, 51, 111,
2034 121, 315, 216, 388, 318, 547, 368, 411, 529, 345,
2035 412, 75, 152, 130, 145, 131, 132, 104, 334, 357,
2036 335, 114, 82, 146, 15, 16, 17, 19, 18, 255,
2037 323, 324, 60, 22, 58, 95, 415, 416, 122, 158,
2038 52, 90, 53, 46, 418, 358, 77, 360, 260, 54,
2039 86, 87, 210, 551, 125, 299, 505, 428, 211, 212,
2043 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2045 #define YYPACT_NINF -472
2046 static const yytype_int16 yypact[] =
2048 50, -472, -472, -472, -472, -472, -472, -20, -110, 93,
2049 -64, 160, 68, 14, -472, 185, 203, -472, 77, 199,
2050 76, 81, -472, 79, 205, -472, 1214, -472, -472, -472,
2051 -472, -472, -472, -472, -472, -472, -472, -472, 56, 56,
2052 137, -472, -472, -472, -472, 56, -472, -472, -472, -472,
2053 -472, 56, 210, -472, 2, 236, 246, 277, -472, -472,
2054 -472, -472, -472, 170, -472, -472, -472, -472, -472, 315,
2055 318, 6, 368, -472, -472, -472, 154, -472, 287, 287,
2056 255, -472, 207, 281, 281, -472, -472, 82, -472, -472,
2057 -472, -472, -472, -472, -472, -1, 1109, -472, 184, 188,
2058 685, 170, -472, 154, -49, -472, 1109, 207, 207, -472,
2059 -472, 777, -472, -472, 1230, 326, -472, -472, -472, -472,
2060 -472, 1269, -472, -7, 1471, -472, 324, -472, -472, 154,
2061 -472, 208, 206, 1312, 1312, 200, -43, 1312, -472, 213,
2062 1230, 1312, 170, 215, 154, 316, -472, 40, 339, 350,
2063 256, 352, 856, -472, -472, 86, -472, -472, -472, -472,
2064 -472, 311, 1372, 187, 356, 281, -472, -472, -472, -472,
2065 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
2066 -472, -472, -472, 394, 177, 1312, 1312, 1312, 1312, -472,
2067 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
2068 -472, 1312, 1312, 1312, 1312, 1312, 1312, 1312, 1312, 1312,
2069 -472, 281, -472, 122, -472, -472, -40, 1126, -472, 67,
2070 49, -472, 222, 154, -472, -472, 154, 777, -472, -472,
2071 -472, -472, -472, -472, -472, -472, -472, -472, -472, 394,
2072 177, 229, 232, 234, 237, 243, 1156, 1386, 898, 367,
2073 249, 251, 252, -472, -472, 257, 258, -472, 170, 606,
2074 -472, 733, 733, -472, 733, 1269, -472, -472, -472, -472,
2075 -472, -472, -472, -472, -472, -472, 1312, -472, -472, -472,
2076 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
2077 -472, -472, -472, 1312, -89, 108, -472, 606, 116, 259,
2078 260, 262, 263, 266, 267, 606, 606, 361, 1269, 1312,
2079 1312, -472, -472, -472, -472, -472, -472, -472, 41, -472,
2080 -472, -472, 41, 257, 257, 371, 268, 270, 1230, 1230,
2081 1230, 1230, 1230, -472, -472, 15, 937, -113, -472, -35,
2082 -472, 1230, 1230, 1230, 29, -472, 1170, -472, -472, -472,
2083 -472, -472, -472, -472, -472, 351, 1230, -472, -472, -472,
2084 -472, 274, -472, 275, 733, 606, 606, 12, -472, 19,
2085 -472, -472, 733, 265, 1312, 1312, 1312, 1312, 1312, 278,
2086 284, 1312, 733, 606, 285, -472, -472, -472, -472, -472,
2087 -472, 1312, 1230, 1230, -472, 286, 289, 290, 291, 1230,
2088 -472, 283, 856, -30, -472, -472, 296, 297, 403, 419,
2089 436, -472, 257, -472, 154, 305, 302, -472, 425, -8,
2090 431, 432, 308, 312, 317, 733, 449, 733, 321, 327,
2091 733, 328, 154, -472, 329, 330, 733, 733, 154, 323,
2092 332, 1312, 126, 333, 334, -57, 1230, 1230, 1230, 1230,
2093 -472, -472, 331, 1230, 1230, 1312, -472, -472, -472, 13,
2094 1200, -472, 335, -472, 733, 733, 1312, 733, 733, 332,
2095 -472, 332, 1312, 733, 336, 1312, 1312, 1312, -472, -472,
2096 1312, 426, -472, 606, -472, 1230, 1230, -472, 337, 349,
2097 355, 358, -472, 357, 359, 149, -472, -472, -472, 154,
2098 1, 457, 360, 354, 606, -2, -472, -472, -472, -472,
2099 -472, 362, 733, -472, -472, -472, 28, 332, 363, 364,
2100 1230, -472, 1230, 1230, -472, -472, -472, 13, -472, 450,
2101 -472, 487, -3, -472, 1312, -472, -472, 370, -472, -472,
2102 -472, -472, 376, 377, 378, -472, 498, -472, 733, -472,
2103 986, 3, -40, 606, 83, -472, 41, -472, -472, -472,
2104 -472, -472, 366, -472, 986, -472, 494, 497, 375, -40,
2105 733, 733, 506, 455, -472, 733, 510, -472, 733, -472
2108 /* YYPGOTO[NTERM-NUM]. */
2109 static const yytype_int16 yypgoto[] =
2111 -472, 401, 404, 405, 292, 294, -161, -472, 0, 8,
2112 443, 9, -472, -472, -472, -472, 44, -472, -472, -472,
2113 -147, -307, -409, -472, -220, -472, -283, 36, -472, -284,
2114 -472, -472, -25, 320, -114, -472, 433, 438, -29, -150,
2115 -226, 198, 238, 313, -472, -472, 525, -472, -472, -472,
2116 -472, -472, -472, -472, -472, -472, -472, -472, 458, -472,
2117 -472, -472, -472, -472, -472, -471, -139, 96, -168, -472,
2118 489, -472, -472, -472, -472, -472, 64, 151, -472, -472,
2122 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2123 positive, shift that token. If negative, reduce the rule which
2124 number is the opposite. If zero, do what YYDEFACT says.
2125 If YYTABLE_NINF, syntax error. */
2126 #define YYTABLE_NINF -188
2127 static const yytype_int16 yytable[] =
2129 10, 76, 253, 264, 322, 459, 228, 155, 263, 12,
2130 99, 387, 370, 254, 263, 387, 10, 156, 265, 296,
2131 85, 337, 339, 425, 399, 12, 23, 88, 20, 1,
2132 427, 409, 3, 404, 300, 301, 302, 303, 304, 389,
2133 390, 307, 21, -55, -55, -55, -55, 103, 367, 105,
2134 -187, 106, 28, 29, 30, 31, 32, 33, 34, 409,
2135 35, 426, 229, 230, 308, -63, 1, 2, 426, 3,
2136 4, 129, 25, 311, 312, 103, 5, 6, 410, 562,
2137 472, 129, 78, 79, 487, 153, 144, 10, 137, 83,
2138 527, 313, 314, 568, 137, 84, 144, 7, 1, 138,
2139 8, 3, 399, 2, 9, 222, 4, 399, 219, 220,
2140 403, 225, 223, 405, 311, 312, 226, 566, 452, 43,
2141 359, 44, 359, 359, 552, 359, 311, 312, 458, 399,
2142 419, 385, 313, 314, 386, 534, 126, 259, 463, 535,
2143 157, 549, 384, 127, 313, 314, 24, 563, 36, 37,
2144 89, 364, 399, 100, 311, 312, 569, 482, 359, 400,
2145 294, 295, 259, 297, 256, 534, 359, 359, 80, 538,
2146 81, 385, 313, 314, 386, 26, 298, 259, 259, 259,
2147 259, 259, 305, 306, 259, 41, 508, 105, 509, 106,
2148 36, 37, 129, 387, 382, 320, 311, 312, 261, 277,
2149 278, 262, 144, -186, 27, 105, 431, 106, 433, 434,
2150 435, 319, 55, 385, 313, 314, 386, 56, -63, 1,
2151 2, 57, 3, 4, 59, 359, 359, 359, 85, 5,
2152 6, 309, 310, 359, 539, 112, 113, 47, 48, 49,
2153 144, 500, 50, 359, 359, 369, 105, 387, 106, 387,
2154 7, 365, 253, 8, 105, 92, 106, 9, 372, 231,
2155 232, 233, 234, 254, 105, 93, 106, 484, 366, 279,
2156 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
2157 290, 291, 292, 144, 383, 259, 359, 105, 359, 106,
2158 526, 359, 105, 109, 106, 110, 94, 359, 359, 394,
2159 395, 396, 397, 398, 510, 140, 141, 513, 514, 515,
2160 96, 402, 406, 407, 408, 554, 107, 108, 556, 97,
2161 81, 414, 98, 61, 62, 359, 359, 133, 359, 359,
2162 154, 134, 1, 2, 359, 3, 4, 115, 116, 117,
2163 118, 119, 120, 215, 359, 217, 221, 218, -56, 259,
2164 432, 259, 259, 259, 224, 227, 438, 361, 362, -57,
2165 363, 235, 257, 443, 444, 359, 442, 263, 321, 328,
2166 450, 550, 329, 359, 330, 61, 62, 331, 101, 64,
2167 65, 66, 67, 332, 1, 2, 340, 3, 4, 341,
2168 564, 342, 343, 371, 344, 381, 373, 374, 346, 375,
2169 376, 379, 380, 377, 378, 391, 417, 430, 392, 359,
2170 393, 420, 421, 68, 359, 436, 483, 488, 489, 490,
2171 491, 437, 441, 446, 493, 494, 447, 448, 449, 451,
2172 495, 359, 359, 453, 454, 499, 359, 455, 456, 359,
2173 457, 504, 460, 461, 462, 464, 465, 259, 466, 467,
2174 259, 259, 259, 470, 468, 504, 518, 519, 472, 496,
2175 422, 423, 424, 480, 473, 475, 476, 477, 429, 481,
2176 485, 486, 501, 512, 520, 426, 530, 492, 439, 440,
2177 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
2178 521, 542, 522, 543, 544, 523, 532, 531, 524, 546,
2179 525, 548, 560, 567, 540, 541, 536, 69, 570, 553,
2180 70, 571, 572, 71, 555, 72, 102, 557, 558, 559,
2181 575, 469, 576, 471, 578, 207, 474, 496, 208, 209,
2182 124, 326, 478, 479, 327, 545, 528, 317, 136, 139,
2183 325, 42, 123, 91, 516, 445, 0, 0, 0, 0,
2184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2185 502, 503, 0, 506, 507, 0, 0, 0, 0, 511,
2186 0, 0, 0, 0, 0, 0, 0, 0, 0, 517,
2187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2189 533, 0, 0, 0, 0, 0, 0, 0, 537, 347,
2190 348, 0, 0, 61, 62, 349, 0, 0, 0, 0,
2191 0, 0, 1, 2, 0, 3, 4, 350, 351, 352,
2192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2193 0, 0, 353, 354, 561, 0, 0, 0, 0, 565,
2194 0, 0, 0, 0, 0, 0, 0, 0, 0, 355,
2195 0, 0, 0, 0, 0, 0, 573, 574, 0, 0,
2196 0, 577, 0, 0, 579, 168, 169, 170, 171, 172,
2197 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2198 239, 240, 61, 62, 0, 101, 64, 65, 66, 67,
2199 0, 1, 2, 0, 3, 4, 0, 0, 0, 0,
2200 0, 0, 0, 0, 0, 0, 0, 241, 189, 190,
2201 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2202 68, 242, 0, 243, 244, 245, 347, 348, 0, 0,
2203 61, 62, 349, 0, 105, 0, 106, 0, 0, 1,
2204 2, 356, 3, 4, 350, 351, 352, 0, 0, 0,
2205 0, 0, 0, 0, 0, 0, 0, 0, 0, 353,
2206 354, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2207 0, 0, 0, 0, 61, 62, 355, 142, 64, 65,
2208 66, 67, 0, 1, 2, 0, 3, 4, 0, 0,
2209 0, 0, 168, 169, 170, 171, 172, 173, 174, 175,
2210 176, 177, 178, 179, 180, 181, 182, 239, 240, 0,
2211 0, 0, 68, 0, 69, 0, 0, 70, 0, 0,
2212 71, 0, 72, 135, 0, 0, 0, 0, 0, 0,
2213 0, 0, 0, 0, 241, 189, 190, 191, 192, 193,
2214 194, 195, 196, 197, 198, 199, 200, 0, 242, 0,
2215 243, 244, 245, 61, 62, 0, 0, 0, 0, 0,
2216 0, 0, 1, 2, 0, 3, 4, 236, 356, 0,
2217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2218 0, 0, 237, 238, 143, 0, 0, 0, 0, 0,
2219 0, 0, 0, 0, 0, 61, 62, 0, 101, 147,
2220 148, 149, 67, 0, 1, 2, 69, 3, 4, 70,
2221 0, 0, 71, 0, 72, 168, 169, 170, 171, 172,
2222 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2223 239, 240, 0, 68, 61, 62, 0, 101, 147, 148,
2224 149, 67, 0, 1, 2, 0, 3, 4, 0, 0,
2225 0, 0, 0, 0, 0, 0, 0, 241, 189, 190,
2226 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2227 0, 242, 68, 243, 244, 245, 0, 0, 0, 347,
2228 348, 0, 0, 0, 105, 349, 106, 0, 246, 0,
2229 0, 247, 0, 248, 0, 249, 0, 350, 351, 352,
2230 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2231 0, 0, 353, 354, 0, 0, 0, 0, 0, 0,
2232 0, 0, 0, 0, 0, 0, 0, 69, 0, 355,
2233 70, 0, 0, 71, 0, 72, 338, 0, 0, 0,
2234 0, 0, 0, 0, 0, 168, 169, 170, 171, 172,
2235 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2236 239, 240, 0, 0, 0, 0, 69, 0, 0, 70,
2237 0, 0, 71, 0, 72, 401, 0, 0, 0, 0,
2238 0, 0, 0, 0, 0, 0, 0, 241, 189, 190,
2239 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2240 0, 242, 0, 243, 244, 245, 61, 62, 0, 101,
2241 64, 65, 66, 67, 0, 1, 2, 0, 3, 4,
2242 0, 356, 0, 61, 62, 0, 101, 64, 65, 66,
2243 67, 0, 1, 2, 128, 3, 4, 0, 0, 0,
2244 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
2245 0, 316, 0, 61, 62, 0, 101, 147, 148, 149,
2246 67, 68, 1, 2, 0, 3, 4, 61, 62, 0,
2247 101, 64, 65, 66, 67, 0, 1, 2, 0, 3,
2248 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2249 0, 68, 0, 0, 0, 413, 0, 61, 62, 0,
2250 101, 64, 65, 66, 67, 68, 1, 2, 0, 3,
2251 4, 61, 62, 0, 63, 64, 65, 66, 67, 0,
2252 1, 2, 0, 3, 4, 498, 0, 61, 62, 0,
2253 101, 147, 148, 149, 67, 68, 1, 2, 69, 3,
2254 4, 70, 0, 0, 71, 0, 72, 0, 0, 68,
2255 0, 0, 0, 0, 0, 69, 0, 0, 70, 0,
2256 0, 71, 0, 72, 0, 68, 61, 62, 0, 142,
2257 64, 65, 66, 67, 0, 1, 2, 0, 3, 4,
2258 0, 0, 0, 0, 0, 69, 0, 0, 70, 0,
2259 333, 71, 0, 72, 0, 0, 0, 0, 0, 69,
2260 0, 0, 70, 0, 68, 71, 0, 72, 0, 61,
2261 62, 0, 101, 64, 65, 66, 67, 0, 1, 2,
2262 0, 3, 4, 0, 0, 0, 0, 0, 0, 69,
2263 0, 0, 70, 0, 0, 71, 0, 72, 0, 0,
2264 0, 0, 0, 69, 0, 0, 70, 68, 0, 71,
2265 0, 72, 0, 0, 0, 0, 0, 0, 0, 69,
2266 0, 0, 70, 0, 0, 71, 0, 72, 0, 61,
2267 62, 0, 258, 64, 65, 66, 67, 0, 1, 2,
2268 0, 3, 4, 61, 62, 0, 101, 147, 148, 149,
2269 67, 0, 1, 2, 0, 3, 4, 0, 69, 0,
2270 0, 70, 0, 0, 71, 0, 72, 68, 0, 0,
2271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2272 0, 68, 0, 0, 0, 0, 0, 0, 0, 0,
2273 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2274 0, 69, 0, 0, 70, 0, 0, 71, 0, 72,
2275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2277 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2278 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2279 0, 0, 0, 159, 0, 0, 0, 0, 0, 0,
2280 0, 69, 0, 0, 70, 0, 0, 71, 0, 72,
2281 0, 0, 160, 161, 0, 69, 0, 0, 70, 0,
2282 0, 71, 0, 336, 162, 163, 164, 165, 166, 167,
2283 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2284 178, 179, 180, 181, 182, 183, 184, 0, 0, 0,
2285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2286 0, 0, 0, 0, 0, 0, 0, 185, 186, 187,
2287 0, 0, 188, 189, 190, 191, 192, 193, 194, 195,
2288 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2292 static const yytype_int16 yycheck[] =
2294 0, 26, 152, 164, 224, 414, 145, 121, 11, 0,
2295 4, 318, 295, 152, 11, 322, 16, 24, 165, 187,
2296 18, 247, 248, 11, 137, 16, 136, 25, 48, 16,
2297 11, 30, 19, 146, 202, 203, 204, 205, 206, 323,
2298 324, 209, 62, 3, 4, 5, 6, 72, 137, 138,
2299 0, 140, 38, 39, 40, 41, 42, 43, 44, 30,
2300 46, 49, 22, 23, 211, 15, 16, 17, 49, 19,
2301 20, 96, 136, 113, 114, 100, 26, 27, 49, 550,
2302 137, 106, 38, 39, 141, 114, 111, 87, 137, 45,
2303 499, 131, 132, 564, 137, 51, 121, 47, 16, 148,
2304 50, 19, 137, 17, 54, 148, 20, 137, 133, 134,
2305 336, 140, 137, 148, 113, 114, 141, 34, 148, 42,
2306 259, 44, 261, 262, 533, 264, 113, 114, 412, 137,
2307 356, 130, 131, 132, 133, 137, 137, 162, 146, 141,
2308 147, 144, 310, 144, 131, 132, 53, 144, 134, 135,
2309 148, 265, 137, 147, 113, 114, 565, 440, 297, 144,
2310 185, 186, 187, 188, 155, 137, 305, 306, 31, 141,
2311 33, 130, 131, 132, 133, 15, 201, 202, 203, 204,
2312 205, 206, 207, 208, 209, 0, 469, 138, 471, 140,
2313 134, 135, 217, 500, 308, 146, 113, 114, 11, 22,
2314 23, 14, 227, 0, 136, 138, 374, 140, 376, 377,
2315 378, 144, 136, 130, 131, 132, 133, 136, 15, 16,
2316 17, 142, 19, 20, 19, 364, 365, 366, 18, 26,
2317 27, 109, 110, 372, 517, 28, 29, 38, 39, 40,
2318 265, 461, 43, 382, 383, 137, 138, 554, 140, 556,
2319 47, 276, 402, 50, 138, 19, 140, 54, 142, 3,
2320 4, 5, 6, 402, 138, 19, 140, 141, 293, 92,
2321 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2322 103, 104, 105, 308, 309, 310, 425, 138, 427, 140,
2323 141, 430, 138, 38, 140, 40, 19, 436, 437, 328,
2324 329, 330, 331, 332, 472, 107, 108, 475, 476, 477,
2325 140, 336, 341, 342, 343, 535, 78, 79, 538, 4,
2326 33, 346, 4, 7, 8, 464, 465, 143, 467, 468,
2327 4, 143, 16, 17, 473, 19, 20, 56, 57, 58,
2328 59, 60, 61, 19, 483, 137, 146, 141, 9, 374,
2329 375, 376, 377, 378, 141, 140, 381, 261, 262, 9,
2330 264, 9, 51, 392, 393, 504, 391, 11, 146, 140,
2331 399, 532, 140, 512, 140, 7, 8, 140, 10, 11,
2332 12, 13, 14, 140, 16, 17, 19, 19, 20, 140,
2333 551, 140, 140, 297, 137, 34, 137, 137, 140, 137,
2334 137, 305, 306, 137, 137, 34, 55, 142, 140, 548,
2335 140, 137, 137, 45, 553, 137, 441, 446, 447, 448,
2336 449, 137, 137, 137, 453, 454, 137, 137, 137, 146,
2337 455, 570, 571, 137, 137, 460, 575, 34, 19, 578,
2338 4, 466, 137, 141, 19, 14, 14, 472, 140, 137,
2339 475, 476, 477, 4, 137, 480, 485, 486, 137, 459,
2340 364, 365, 366, 140, 137, 137, 137, 137, 372, 137,
2341 137, 137, 137, 137, 137, 49, 19, 146, 382, 383,
2342 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2343 141, 520, 137, 522, 523, 137, 142, 137, 141, 49,
2344 141, 14, 4, 137, 141, 141, 144, 139, 14, 534,
2345 142, 14, 137, 145, 144, 147, 148, 141, 141, 141,
2346 14, 425, 67, 427, 14, 124, 430, 527, 124, 124,
2347 87, 239, 436, 437, 240, 527, 500, 217, 100, 106,
2348 227, 16, 84, 54, 480, 394, -1, -1, -1, -1,
2349 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2350 464, 465, -1, 467, 468, -1, -1, -1, -1, 473,
2351 -1, -1, -1, -1, -1, -1, -1, -1, -1, 483,
2352 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2353 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2354 504, -1, -1, -1, -1, -1, -1, -1, 512, 3,
2355 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
2356 -1, -1, 16, 17, -1, 19, 20, 21, 22, 23,
2357 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2358 -1, -1, 36, 37, 548, -1, -1, -1, -1, 553,
2359 -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
2360 -1, -1, -1, -1, -1, -1, 570, 571, -1, -1,
2361 -1, 575, -1, -1, 578, 69, 70, 71, 72, 73,
2362 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2363 84, 85, 7, 8, -1, 10, 11, 12, 13, 14,
2364 -1, 16, 17, -1, 19, 20, -1, -1, -1, -1,
2365 -1, -1, -1, -1, -1, -1, -1, 111, 112, 113,
2366 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2367 45, 125, -1, 127, 128, 129, 3, 4, -1, -1,
2368 7, 8, 9, -1, 138, -1, 140, -1, -1, 16,
2369 17, 145, 19, 20, 21, 22, 23, -1, -1, -1,
2370 -1, -1, -1, -1, -1, -1, -1, -1, -1, 36,
2371 37, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2372 -1, -1, -1, -1, 7, 8, 53, 10, 11, 12,
2373 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2374 -1, -1, 69, 70, 71, 72, 73, 74, 75, 76,
2375 77, 78, 79, 80, 81, 82, 83, 84, 85, -1,
2376 -1, -1, 45, -1, 139, -1, -1, 142, -1, -1,
2377 145, -1, 147, 148, -1, -1, -1, -1, -1, -1,
2378 -1, -1, -1, -1, 111, 112, 113, 114, 115, 116,
2379 117, 118, 119, 120, 121, 122, 123, -1, 125, -1,
2380 127, 128, 129, 7, 8, -1, -1, -1, -1, -1,
2381 -1, -1, 16, 17, -1, 19, 20, 21, 145, -1,
2382 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2383 -1, -1, 36, 37, 117, -1, -1, -1, -1, -1,
2384 -1, -1, -1, -1, -1, 7, 8, -1, 10, 11,
2385 12, 13, 14, -1, 16, 17, 139, 19, 20, 142,
2386 -1, -1, 145, -1, 147, 69, 70, 71, 72, 73,
2387 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2388 84, 85, -1, 45, 7, 8, -1, 10, 11, 12,
2389 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2390 -1, -1, -1, -1, -1, -1, -1, 111, 112, 113,
2391 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2392 -1, 125, 45, 127, 128, 129, -1, -1, -1, 3,
2393 4, -1, -1, -1, 138, 9, 140, -1, 142, -1,
2394 -1, 145, -1, 147, -1, 149, -1, 21, 22, 23,
2395 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2396 -1, -1, 36, 37, -1, -1, -1, -1, -1, -1,
2397 -1, -1, -1, -1, -1, -1, -1, 139, -1, 53,
2398 142, -1, -1, 145, -1, 147, 148, -1, -1, -1,
2399 -1, -1, -1, -1, -1, 69, 70, 71, 72, 73,
2400 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2401 84, 85, -1, -1, -1, -1, 139, -1, -1, 142,
2402 -1, -1, 145, -1, 147, 148, -1, -1, -1, -1,
2403 -1, -1, -1, -1, -1, -1, -1, 111, 112, 113,
2404 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2405 -1, 125, -1, 127, 128, 129, 7, 8, -1, 10,
2406 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2407 -1, 145, -1, 7, 8, -1, 10, 11, 12, 13,
2408 14, -1, 16, 17, 35, 19, 20, -1, -1, -1,
2409 -1, -1, -1, -1, 45, -1, -1, -1, -1, -1,
2410 -1, 35, -1, 7, 8, -1, 10, 11, 12, 13,
2411 14, 45, 16, 17, -1, 19, 20, 7, 8, -1,
2412 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2413 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2414 -1, 45, -1, -1, -1, 35, -1, 7, 8, -1,
2415 10, 11, 12, 13, 14, 45, 16, 17, -1, 19,
2416 20, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2417 16, 17, -1, 19, 20, 35, -1, 7, 8, -1,
2418 10, 11, 12, 13, 14, 45, 16, 17, 139, 19,
2419 20, 142, -1, -1, 145, -1, 147, -1, -1, 45,
2420 -1, -1, -1, -1, -1, 139, -1, -1, 142, -1,
2421 -1, 145, -1, 147, -1, 45, 7, 8, -1, 10,
2422 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2423 -1, -1, -1, -1, -1, 139, -1, -1, 142, -1,
2424 144, 145, -1, 147, -1, -1, -1, -1, -1, 139,
2425 -1, -1, 142, -1, 45, 145, -1, 147, -1, 7,
2426 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2427 -1, 19, 20, -1, -1, -1, -1, -1, -1, 139,
2428 -1, -1, 142, -1, -1, 145, -1, 147, -1, -1,
2429 -1, -1, -1, 139, -1, -1, 142, 45, -1, 145,
2430 -1, 147, -1, -1, -1, -1, -1, -1, -1, 139,
2431 -1, -1, 142, -1, -1, 145, -1, 147, -1, 7,
2432 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2433 -1, 19, 20, 7, 8, -1, 10, 11, 12, 13,
2434 14, -1, 16, 17, -1, 19, 20, -1, 139, -1,
2435 -1, 142, -1, -1, 145, -1, 147, 45, -1, -1,
2436 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2437 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1,
2438 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2439 -1, 139, -1, -1, 142, -1, -1, 145, -1, 147,
2440 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2441 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2442 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2443 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2444 -1, -1, -1, 32, -1, -1, -1, -1, -1, -1,
2445 -1, 139, -1, -1, 142, -1, -1, 145, -1, 147,
2446 -1, -1, 51, 52, -1, 139, -1, -1, 142, -1,
2447 -1, 145, -1, 147, 63, 64, 65, 66, 67, 68,
2448 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2449 79, 80, 81, 82, 83, 84, 85, -1, -1, -1,
2450 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2451 -1, -1, -1, -1, -1, -1, -1, 106, 107, 108,
2452 -1, -1, 111, 112, 113, 114, 115, 116, 117, 118,
2453 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2457 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2458 symbol of state STATE-NUM. */
2459 static const yytype_uint8 yystos[] =
2461 0, 16, 17, 19, 20, 26, 27, 47, 50, 54,
2462 158, 160, 161, 162, 163, 194, 195, 196, 198, 197,
2463 48, 62, 203, 136, 53, 136, 15, 136, 38, 39,
2464 40, 41, 42, 43, 44, 46, 134, 135, 164, 165,
2465 166, 0, 196, 42, 44, 167, 213, 38, 39, 40,
2466 43, 168, 210, 212, 219, 136, 136, 142, 204, 19,
2467 202, 7, 8, 10, 11, 12, 13, 14, 45, 139,
2468 142, 145, 147, 158, 161, 181, 182, 216, 166, 166,
2469 31, 33, 192, 166, 166, 18, 220, 221, 25, 148,
2470 211, 220, 19, 19, 19, 205, 140, 4, 4, 4,
2471 147, 10, 148, 182, 187, 138, 140, 192, 192, 38,
2472 40, 169, 28, 29, 191, 56, 57, 58, 59, 60,
2473 61, 170, 208, 208, 160, 224, 137, 144, 35, 182,
2474 183, 185, 186, 143, 143, 148, 187, 137, 148, 186,
2475 191, 191, 10, 117, 182, 184, 193, 11, 12, 13,
2476 156, 157, 182, 188, 4, 184, 24, 147, 209, 32,
2477 51, 52, 63, 64, 65, 66, 67, 68, 69, 70,
2478 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2479 81, 82, 83, 84, 85, 106, 107, 108, 111, 112,
2480 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2481 123, 124, 125, 126, 127, 128, 129, 151, 152, 153,
2482 222, 228, 229, 230, 231, 19, 172, 137, 141, 182,
2483 182, 146, 148, 182, 141, 188, 182, 140, 216, 22,
2484 23, 3, 4, 5, 6, 9, 21, 36, 37, 84,
2485 85, 111, 125, 127, 128, 129, 142, 145, 147, 149,
2486 151, 152, 153, 189, 216, 199, 161, 51, 10, 182,
2487 218, 11, 14, 11, 156, 170, 86, 87, 88, 89,
2488 90, 91, 92, 93, 94, 95, 154, 22, 23, 92,
2489 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2490 103, 104, 105, 155, 182, 182, 218, 182, 182, 225,
2491 218, 218, 218, 218, 218, 182, 182, 218, 170, 109,
2492 110, 113, 114, 131, 132, 171, 35, 183, 174, 144,
2493 146, 146, 174, 200, 201, 193, 154, 155, 140, 140,
2494 140, 140, 140, 144, 188, 190, 147, 190, 148, 190,
2495 19, 140, 140, 140, 137, 179, 140, 3, 4, 9,
2496 21, 22, 23, 36, 37, 53, 145, 189, 215, 216,
2497 217, 217, 217, 217, 184, 182, 182, 137, 176, 137,
2498 176, 217, 142, 137, 137, 137, 137, 137, 137, 217,
2499 217, 34, 184, 182, 218, 130, 133, 171, 173, 179,
2500 179, 34, 140, 140, 188, 188, 188, 188, 188, 137,
2501 144, 148, 182, 190, 146, 148, 188, 188, 188, 30,
2502 49, 177, 180, 35, 182, 206, 207, 55, 214, 190,
2503 137, 137, 217, 217, 217, 11, 49, 11, 227, 217,
2504 142, 218, 182, 218, 218, 218, 137, 137, 182, 217,
2505 217, 137, 182, 188, 188, 227, 137, 137, 137, 137,
2506 188, 146, 148, 137, 137, 34, 19, 4, 179, 172,
2507 137, 141, 19, 146, 14, 14, 140, 137, 137, 217,
2508 4, 217, 137, 137, 217, 137, 137, 137, 217, 217,
2509 140, 137, 176, 182, 141, 137, 137, 141, 188, 188,
2510 188, 188, 146, 188, 188, 182, 158, 159, 35, 182,
2511 174, 137, 217, 217, 182, 226, 217, 217, 176, 176,
2512 218, 217, 137, 218, 218, 218, 226, 217, 188, 188,
2513 137, 141, 137, 137, 141, 141, 141, 172, 177, 178,
2514 19, 137, 142, 217, 137, 141, 144, 217, 141, 176,
2515 141, 141, 188, 188, 188, 159, 49, 175, 14, 144,
2516 156, 223, 172, 182, 174, 144, 174, 141, 141, 141,
2517 4, 217, 215, 144, 156, 217, 34, 137, 215, 172,
2518 14, 14, 137, 217, 217, 14, 67, 217, 14, 217
2521 #define yyerrok (yyerrstatus = 0)
2522 #define yyclearin (yychar = YYEMPTY)
2523 #define YYEMPTY (-2)
2526 #define YYACCEPT goto yyacceptlab
2527 #define YYABORT goto yyabortlab
2528 #define YYERROR goto yyerrorlab
2531 /* Like YYERROR except do call yyerror. This remains here temporarily
2532 to ease the transition to the new meaning of YYERROR, for GCC.
2533 Once GCC version 2 has supplanted version 1, this can go. */
2535 #define YYFAIL goto yyerrlab
2537 #define YYRECOVERING() (!!yyerrstatus)
2539 #define YYBACKUP(Token, Value) \
2541 if (yychar == YYEMPTY && yylen == 1) \
2545 yytoken = YYTRANSLATE (yychar); \
2551 yyerror (YY_("syntax error: cannot back up")); \
2558 #define YYERRCODE 256
2561 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2562 If N is 0, then set CURRENT to the empty location which ends
2563 the previous symbol: RHS[0] (always defined). */
2565 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2566 #ifndef YYLLOC_DEFAULT
2567 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2571 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2572 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2573 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2574 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2578 (Current).first_line = (Current).last_line = \
2579 YYRHSLOC (Rhs, 0).last_line; \
2580 (Current).first_column = (Current).last_column = \
2581 YYRHSLOC (Rhs, 0).last_column; \
2587 /* YY_LOCATION_PRINT -- Print the location on the stream.
2588 This macro was not mandated originally: define only if we know
2589 we won't break user code: when these are the locations we know. */
2591 #ifndef YY_LOCATION_PRINT
2592 # if YYLTYPE_IS_TRIVIAL
2593 # define YY_LOCATION_PRINT(File, Loc) \
2594 fprintf (File, "%d.%d-%d.%d", \
2595 (Loc).first_line, (Loc).first_column, \
2596 (Loc).last_line, (Loc).last_column)
2598 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2603 /* YYLEX -- calling `yylex' with the right arguments. */
2606 # define YYLEX yylex (YYLEX_PARAM)
2608 # define YYLEX yylex ()
2611 /* Enable debugging if requested. */
2615 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2616 # define YYFPRINTF fprintf
2619 # define YYDPRINTF(Args) \
2625 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2629 YYFPRINTF (stderr, "%s ", Title); \
2630 yy_symbol_print (stderr, \
2632 YYFPRINTF (stderr, "\n"); \
2637 /*--------------------------------.
2638 | Print this symbol on YYOUTPUT. |
2639 `--------------------------------*/
2642 #if (defined __STDC__ || defined __C99__FUNC__ \
2643 || defined __cplusplus || defined _MSC_VER)
2645 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2648 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2651 YYSTYPE const * const yyvaluep;
2657 if (yytype < YYNTOKENS)
2658 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2670 /*--------------------------------.
2671 | Print this symbol on YYOUTPUT. |
2672 `--------------------------------*/
2674 #if (defined __STDC__ || defined __C99__FUNC__ \
2675 || defined __cplusplus || defined _MSC_VER)
2677 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2680 yy_symbol_print (yyoutput, yytype, yyvaluep)
2683 YYSTYPE const * const yyvaluep;
2686 if (yytype < YYNTOKENS)
2687 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2689 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2691 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2692 YYFPRINTF (yyoutput, ")");
2695 /*------------------------------------------------------------------.
2696 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2698 `------------------------------------------------------------------*/
2700 #if (defined __STDC__ || defined __C99__FUNC__ \
2701 || defined __cplusplus || defined _MSC_VER)
2703 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2706 yy_stack_print (bottom, top)
2707 yytype_int16 *bottom;
2711 YYFPRINTF (stderr, "Stack now");
2712 for (; bottom <= top; ++bottom)
2713 YYFPRINTF (stderr, " %d", *bottom);
2714 YYFPRINTF (stderr, "\n");
2717 # define YY_STACK_PRINT(Bottom, Top) \
2720 yy_stack_print ((Bottom), (Top)); \
2724 /*------------------------------------------------.
2725 | Report that the YYRULE is going to be reduced. |
2726 `------------------------------------------------*/
2728 #if (defined __STDC__ || defined __C99__FUNC__ \
2729 || defined __cplusplus || defined _MSC_VER)
2731 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2734 yy_reduce_print (yyvsp, yyrule)
2739 int yynrhs = yyr2[yyrule];
2741 unsigned long int yylno = yyrline[yyrule];
2742 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2744 /* The symbols being reduced. */
2745 for (yyi = 0; yyi < yynrhs; yyi++)
2747 fprintf (stderr, " $%d = ", yyi + 1);
2748 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2749 &(yyvsp[(yyi + 1) - (yynrhs)])
2751 fprintf (stderr, "\n");
2755 # define YY_REDUCE_PRINT(Rule) \
2758 yy_reduce_print (yyvsp, Rule); \
2761 /* Nonzero means print parse trace. It is left uninitialized so that
2762 multiple parsers can coexist. */
2764 #else /* !YYDEBUG */
2765 # define YYDPRINTF(Args)
2766 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2767 # define YY_STACK_PRINT(Bottom, Top)
2768 # define YY_REDUCE_PRINT(Rule)
2769 #endif /* !YYDEBUG */
2772 /* YYINITDEPTH -- initial size of the parser's stacks. */
2774 # define YYINITDEPTH 200
2777 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2778 if the built-in stack extension method is used).
2780 Do not make this value too large; the results are undefined if
2781 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2782 evaluated with infinite-precision integer arithmetic. */
2785 # define YYMAXDEPTH 10000
2793 # if defined __GLIBC__ && defined _STRING_H
2794 # define yystrlen strlen
2796 /* Return the length of YYSTR. */
2797 #if (defined __STDC__ || defined __C99__FUNC__ \
2798 || defined __cplusplus || defined _MSC_VER)
2800 yystrlen (const char *yystr)
2808 for (yylen = 0; yystr[yylen]; yylen++)
2816 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2817 # define yystpcpy stpcpy
2819 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2821 #if (defined __STDC__ || defined __C99__FUNC__ \
2822 || defined __cplusplus || defined _MSC_VER)
2824 yystpcpy (char *yydest, const char *yysrc)
2827 yystpcpy (yydest, yysrc)
2833 const char *yys = yysrc;
2835 while ((*yyd++ = *yys++) != '\0')
2844 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2845 quotes and backslashes, so that it's suitable for yyerror. The
2846 heuristic is that double-quoting is unnecessary unless the string
2847 contains an apostrophe, a comma, or backslash (other than
2848 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2849 null, do not copy; instead, return the length of what the result
2852 yytnamerr (char *yyres, const char *yystr)
2857 char const *yyp = yystr;
2864 goto do_not_strip_quotes;
2868 goto do_not_strip_quotes;
2881 do_not_strip_quotes: ;
2885 return yystrlen (yystr);
2887 return yystpcpy (yyres, yystr) - yyres;
2891 /* Copy into YYRESULT an error message about the unexpected token
2892 YYCHAR while in state YYSTATE. Return the number of bytes copied,
2893 including the terminating null byte. If YYRESULT is null, do not
2894 copy anything; just return the number of bytes that would be
2895 copied. As a special case, return 0 if an ordinary "syntax error"
2896 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
2897 size calculation. */
2899 yysyntax_error (char *yyresult, int yystate, int yychar)
2901 int yyn = yypact[yystate];
2903 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
2907 int yytype = YYTRANSLATE (yychar);
2908 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2909 YYSIZE_T yysize = yysize0;
2911 int yysize_overflow = 0;
2912 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2913 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2917 /* This is so xgettext sees the translatable formats that are
2918 constructed on the fly. */
2919 YY_("syntax error, unexpected %s");
2920 YY_("syntax error, unexpected %s, expecting %s");
2921 YY_("syntax error, unexpected %s, expecting %s or %s");
2922 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2923 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2927 static char const yyunexpected[] = "syntax error, unexpected %s";
2928 static char const yyexpecting[] = ", expecting %s";
2929 static char const yyor[] = " or %s";
2930 char yyformat[sizeof yyunexpected
2931 + sizeof yyexpecting - 1
2932 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2933 * (sizeof yyor - 1))];
2934 char const *yyprefix = yyexpecting;
2936 /* Start YYX at -YYN if negative to avoid negative indexes in
2938 int yyxbegin = yyn < 0 ? -yyn : 0;
2940 /* Stay within bounds of both yycheck and yytname. */
2941 int yychecklim = YYLAST - yyn + 1;
2942 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2945 yyarg[0] = yytname[yytype];
2946 yyfmt = yystpcpy (yyformat, yyunexpected);
2948 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2949 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2951 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2955 yyformat[sizeof yyunexpected - 1] = '\0';
2958 yyarg[yycount++] = yytname[yyx];
2959 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2960 yysize_overflow |= (yysize1 < yysize);
2962 yyfmt = yystpcpy (yyfmt, yyprefix);
2966 yyf = YY_(yyformat);
2967 yysize1 = yysize + yystrlen (yyf);
2968 yysize_overflow |= (yysize1 < yysize);
2971 if (yysize_overflow)
2972 return YYSIZE_MAXIMUM;
2976 /* Avoid sprintf, as that infringes on the user's name space.
2977 Don't have undefined behavior even if the translation
2978 produced a string with the wrong number of "%s"s. */
2979 char *yyp = yyresult;
2981 while ((*yyp = *yyf) != '\0')
2983 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2985 yyp += yytnamerr (yyp, yyarg[yyi++]);
2998 #endif /* YYERROR_VERBOSE */
3001 /*-----------------------------------------------.
3002 | Release the memory associated to this symbol. |
3003 `-----------------------------------------------*/
3006 #if (defined __STDC__ || defined __C99__FUNC__ \
3007 || defined __cplusplus || defined _MSC_VER)
3009 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3012 yydestruct (yymsg, yytype, yyvaluep)
3022 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3033 /* Prevent warnings from -Wmissing-prototypes. */
3035 #ifdef YYPARSE_PARAM
3036 #if defined __STDC__ || defined __cplusplus
3037 int yyparse (void *YYPARSE_PARAM);
3041 #else /* ! YYPARSE_PARAM */
3042 #if defined __STDC__ || defined __cplusplus
3047 #endif /* ! YYPARSE_PARAM */
3051 /* The look-ahead symbol. */
3054 /* The semantic value of the look-ahead symbol. */
3057 /* Number of syntax errors so far. */
3066 #ifdef YYPARSE_PARAM
3067 #if (defined __STDC__ || defined __C99__FUNC__ \
3068 || defined __cplusplus || defined _MSC_VER)
3070 yyparse (void *YYPARSE_PARAM)
3073 yyparse (YYPARSE_PARAM)
3074 void *YYPARSE_PARAM;
3076 #else /* ! YYPARSE_PARAM */
3077 #if (defined __STDC__ || defined __C99__FUNC__ \
3078 || defined __cplusplus || defined _MSC_VER)
3092 /* Number of tokens to shift before error messages enabled. */
3094 /* Look-ahead token as an internal (translated) token number. */
3097 /* Buffer for error messages, and its allocated size. */
3099 char *yymsg = yymsgbuf;
3100 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3103 /* Three stacks and their tools:
3104 `yyss': related to states,
3105 `yyvs': related to semantic values,
3106 `yyls': related to locations.
3108 Refer to the stacks thru separate pointers, to allow yyoverflow
3109 to reallocate them elsewhere. */
3111 /* The state stack. */
3112 yytype_int16 yyssa[YYINITDEPTH];
3113 yytype_int16 *yyss = yyssa;
3114 yytype_int16 *yyssp;
3116 /* The semantic value stack. */
3117 YYSTYPE yyvsa[YYINITDEPTH];
3118 YYSTYPE *yyvs = yyvsa;
3123 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3125 YYSIZE_T yystacksize = YYINITDEPTH;
3127 /* The variables used to return semantic value and location from the
3132 /* The number of symbols on the RHS of the reduced rule.
3133 Keep to zero when no symbol should be popped. */
3136 YYDPRINTF ((stderr, "Starting parse\n"));
3141 yychar = YYEMPTY; /* Cause a token to be read. */
3143 /* Initialize stack pointers.
3144 Waste one element of value and location stack
3145 so that they stay on the same level as the state stack.
3146 The wasted elements are never initialized. */
3153 /*------------------------------------------------------------.
3154 | yynewstate -- Push a new state, which is found in yystate. |
3155 `------------------------------------------------------------*/
3157 /* In all cases, when you get here, the value and location stacks
3158 have just been pushed. So pushing a state here evens the stacks. */
3164 if (yyss + yystacksize - 1 <= yyssp)
3166 /* Get the current used size of the three stacks, in elements. */
3167 YYSIZE_T yysize = yyssp - yyss + 1;
3171 /* Give user a chance to reallocate the stack. Use copies of
3172 these so that the &'s don't force the real ones into
3174 YYSTYPE *yyvs1 = yyvs;
3175 yytype_int16 *yyss1 = yyss;
3178 /* Each stack pointer address is followed by the size of the
3179 data in use in that stack, in bytes. This used to be a
3180 conditional around just the two extra args, but that might
3181 be undefined if yyoverflow is a macro. */
3182 yyoverflow (YY_("memory exhausted"),
3183 &yyss1, yysize * sizeof (*yyssp),
3184 &yyvs1, yysize * sizeof (*yyvsp),
3191 #else /* no yyoverflow */
3192 # ifndef YYSTACK_RELOCATE
3193 goto yyexhaustedlab;
3195 /* Extend the stack our own way. */
3196 if (YYMAXDEPTH <= yystacksize)
3197 goto yyexhaustedlab;
3199 if (YYMAXDEPTH < yystacksize)
3200 yystacksize = YYMAXDEPTH;
3203 yytype_int16 *yyss1 = yyss;
3204 union yyalloc *yyptr =
3205 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3207 goto yyexhaustedlab;
3208 YYSTACK_RELOCATE (yyss);
3209 YYSTACK_RELOCATE (yyvs);
3211 # undef YYSTACK_RELOCATE
3213 YYSTACK_FREE (yyss1);
3216 #endif /* no yyoverflow */
3218 yyssp = yyss + yysize - 1;
3219 yyvsp = yyvs + yysize - 1;
3222 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3223 (unsigned long int) yystacksize));
3225 if (yyss + yystacksize - 1 <= yyssp)
3229 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3238 /* Do appropriate processing given the current state. Read a
3239 look-ahead token if we need one and don't already have one. */
3241 /* First try to decide what to do without reference to look-ahead token. */
3242 yyn = yypact[yystate];
3243 if (yyn == YYPACT_NINF)
3246 /* Not known => get a look-ahead token if don't already have one. */
3248 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3249 if (yychar == YYEMPTY)
3251 YYDPRINTF ((stderr, "Reading a token: "));
3255 if (yychar <= YYEOF)
3257 yychar = yytoken = YYEOF;
3258 YYDPRINTF ((stderr, "Now at end of input.\n"));
3262 yytoken = YYTRANSLATE (yychar);
3263 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3266 /* If the proper action on seeing token YYTOKEN is to reduce or to
3267 detect an error, take that action. */
3269 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3274 if (yyn == 0 || yyn == YYTABLE_NINF)
3283 /* Count tokens shifted since error; after three, turn off error
3288 /* Shift the look-ahead token. */
3289 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3291 /* Discard the shifted token unless it is eof. */
3292 if (yychar != YYEOF)
3301 /*-----------------------------------------------------------.
3302 | yydefault -- do the default action for the current state. |
3303 `-----------------------------------------------------------*/
3305 yyn = yydefact[yystate];
3311 /*-----------------------------.
3312 | yyreduce -- Do a reduction. |
3313 `-----------------------------*/
3315 /* yyn is the number of a rule to reduce with. */
3318 /* If YYLEN is nonzero, implement the default value of the action:
3321 Otherwise, the following line sets YYVAL to garbage.
3322 This behavior is undocumented and Bison
3323 users should not rely upon it. Assigning to YYVAL
3324 unconditionally makes the parser a bit smaller, and it avoids a
3325 GCC warning that YYVAL may be used uninitialized. */
3326 yyval = yyvsp[1-yylen];
3329 YY_REDUCE_PRINT (yyn);
3333 #line 1116 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3334 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3338 #line 1116 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3339 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3343 #line 1117 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3344 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3348 #line 1117 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3349 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3353 #line 1118 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3354 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3358 #line 1118 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3359 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3363 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3364 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3368 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3369 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3373 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3374 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3378 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3379 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3383 #line 1124 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3384 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3388 #line 1124 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3389 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3393 #line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3394 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3398 #line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3399 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3403 #line 1126 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3404 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3408 #line 1126 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3409 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3413 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3414 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3418 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3419 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3423 #line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3424 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3428 #line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3429 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3433 #line 1129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3434 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3438 #line 1129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3439 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3443 #line 1130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3444 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3448 #line 1130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3449 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3453 #line 1131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3454 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3458 #line 1132 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3459 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3463 #line 1141 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3464 { (yyval.StrVal) = 0; ;}
3468 #line 1145 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3470 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3476 #line 1149 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3484 #line 1157 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3492 #line 1162 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3494 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3500 #line 1168 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3501 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3505 #line 1169 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3506 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3510 #line 1170 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3511 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3515 #line 1171 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3516 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3520 #line 1172 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3521 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3525 #line 1176 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3526 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3530 #line 1177 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3531 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3535 #line 1178 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3536 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3540 #line 1182 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3541 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3545 #line 1183 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3546 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3550 #line 1184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3551 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3555 #line 1188 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3556 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3560 #line 1189 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3561 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3565 #line 1190 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3566 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3570 #line 1194 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3571 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3575 #line 1195 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3576 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3580 #line 1196 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3581 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3585 #line 1197 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3586 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3590 #line 1198 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3591 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3595 #line 1202 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3596 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3600 #line 1203 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3601 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3605 #line 1204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3606 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3610 #line 1207 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3611 { (yyval.UIntVal) = CallingConv::C; ;}
3615 #line 1208 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3616 { (yyval.UIntVal) = CallingConv::C; ;}
3620 #line 1209 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3621 { (yyval.UIntVal) = CallingConv::Fast; ;}
3625 #line 1210 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3626 { (yyval.UIntVal) = CallingConv::Cold; ;}
3630 #line 1211 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3631 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3635 #line 1212 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3636 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3640 #line 1213 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3642 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3643 GEN_ERROR("Calling conv too large");
3644 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3650 #line 1220 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3651 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3655 #line 1221 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3656 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3660 #line 1222 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3661 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3665 #line 1223 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3666 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3670 #line 1226 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3671 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3675 #line 1227 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3677 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3682 #line 1232 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3683 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3687 #line 1233 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3688 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3692 #line 1237 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3693 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3697 #line 1238 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3699 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3704 #line 1245 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3705 { (yyval.UIntVal) = 0; ;}
3709 #line 1246 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3711 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3712 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3713 GEN_ERROR("Alignment must be a power of two");
3719 #line 1252 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3720 { (yyval.UIntVal) = 0; ;}
3724 #line 1253 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3726 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3727 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3728 GEN_ERROR("Alignment must be a power of two");
3734 #line 1261 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3736 for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i)
3737 if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\')
3738 GEN_ERROR("Invalid character in section name");
3739 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3745 #line 1269 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3746 { (yyval.StrVal) = 0; ;}
3750 #line 1270 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3751 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3755 #line 1275 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3760 #line 1276 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3765 #line 1277 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3767 CurGV->setSection((yyvsp[(1) - (1)].StrVal));
3768 free((yyvsp[(1) - (1)].StrVal));
3774 #line 1282 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3776 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3777 GEN_ERROR("Alignment must be a power of two");
3778 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3784 #line 1298 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3786 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3792 #line 1302 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3794 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
3800 #line 1306 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3802 if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
3803 GEN_ERROR("Cannot form a pointer to a basic block");
3804 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
3805 delete (yyvsp[(1) - (2)].TypeVal);
3811 #line 1313 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3812 { // Named types are also simple types...
3813 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
3815 (yyval.TypeVal) = new PATypeHolder(tmp);
3820 #line 1318 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3821 { // Type UpReference
3822 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3823 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3824 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
3825 (yyval.TypeVal) = new PATypeHolder(OT);
3826 UR_OUT("New Upreference!\n");
3832 #line 1326 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3834 std::vector<const Type*> Params;
3835 ParamAttrsVector Attrs;
3836 if ((yyvsp[(5) - (5)].ParamAttrs) != ParamAttr::None) {
3837 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[(5) - (5)].ParamAttrs);
3841 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
3842 for (; I != E; ++I, ++index) {
3843 const Type *Ty = I->Ty->get();
3844 Params.push_back(Ty);
3845 if (Ty != Type::VoidTy)
3846 if (I->Attrs != ParamAttr::None) {
3847 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3851 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3852 if (isVarArg) Params.pop_back();
3854 ParamAttrsList *ActualAttrs = 0;
3856 ActualAttrs = ParamAttrsList::get(Attrs);
3857 FunctionType *FT = FunctionType::get(*(yyvsp[(1) - (5)].TypeVal), Params, isVarArg, ActualAttrs);
3858 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3859 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
3860 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3866 #line 1356 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3868 std::vector<const Type*> Params;
3869 ParamAttrsVector Attrs;
3870 if ((yyvsp[(5) - (5)].ParamAttrs) != ParamAttr::None) {
3871 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[(5) - (5)].ParamAttrs);
3874 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
3876 for ( ; I != E; ++I, ++index) {
3877 const Type* Ty = I->Ty->get();
3878 Params.push_back(Ty);
3879 if (Ty != Type::VoidTy)
3880 if (I->Attrs != ParamAttr::None) {
3881 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3885 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3886 if (isVarArg) Params.pop_back();
3888 ParamAttrsList *ActualAttrs = 0;
3890 ActualAttrs = ParamAttrsList::get(Attrs);
3892 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg, ActualAttrs);
3893 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3894 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3900 #line 1387 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3901 { // Sized array type?
3902 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
3903 delete (yyvsp[(4) - (5)].TypeVal);
3909 #line 1392 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3911 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
3912 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
3913 GEN_ERROR("Unsigned result not equal to signed result");
3914 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3915 GEN_ERROR("Element type of a VectorType must be primitive");
3916 if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val)))
3917 GEN_ERROR("Vector length should be a power of 2");
3918 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
3919 delete (yyvsp[(4) - (5)].TypeVal);
3925 #line 1404 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3926 { // Structure type?
3927 std::vector<const Type*> Elements;
3928 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
3929 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
3930 Elements.push_back(*I);
3932 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3933 delete (yyvsp[(2) - (3)].TypeList);
3939 #line 1414 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3940 { // Empty structure type?
3941 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3947 #line 1418 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3949 std::vector<const Type*> Elements;
3950 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
3951 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
3952 Elements.push_back(*I);
3954 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3955 delete (yyvsp[(3) - (5)].TypeList);
3961 #line 1428 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3962 { // Empty structure type?
3963 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3969 #line 1435 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3971 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
3972 (yyval.TypeWithAttrs).Attrs = (yyvsp[(2) - (2)].ParamAttrs);
3977 #line 1442 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3979 if (!UpRefs.empty())
3980 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
3981 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
3982 GEN_ERROR("LLVM functions cannot return aggregate types");
3983 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
3988 #line 1449 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3990 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3995 #line 1454 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3997 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3998 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4004 #line 1459 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4006 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4012 #line 1467 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4014 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4015 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4016 TWA.Ty = new PATypeHolder(Type::VoidTy);
4017 (yyval.TypeWithAttrsList)->push_back(TWA);
4023 #line 1474 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4025 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4026 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4027 TWA.Ty = new PATypeHolder(Type::VoidTy);
4028 (yyval.TypeWithAttrsList)->push_back(TWA);
4034 #line 1481 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4036 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4042 #line 1489 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4044 (yyval.TypeList) = new std::list<PATypeHolder>();
4045 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4046 delete (yyvsp[(1) - (1)].TypeVal);
4052 #line 1495 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4054 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4055 delete (yyvsp[(3) - (3)].TypeVal);
4061 #line 1507 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4062 { // Nonempty unsized arr
4063 if (!UpRefs.empty())
4064 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4065 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4067 GEN_ERROR("Cannot make array constant with type: '" +
4068 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4069 const Type *ETy = ATy->getElementType();
4070 int NumElements = ATy->getNumElements();
4072 // Verify that we have the correct size...
4073 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4074 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4075 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4076 itostr(NumElements) + "");
4078 // Verify all elements are correct type!
4079 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4080 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4081 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4082 ETy->getDescription() +"' as required!\nIt is of type '"+
4083 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4086 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4087 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4093 #line 1535 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4095 if (!UpRefs.empty())
4096 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4097 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4099 GEN_ERROR("Cannot make array constant with type: '" +
4100 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4102 int NumElements = ATy->getNumElements();
4103 if (NumElements != -1 && NumElements != 0)
4104 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4105 " arguments, but has size of " + itostr(NumElements) +"");
4106 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4107 delete (yyvsp[(1) - (3)].TypeVal);
4113 #line 1551 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4115 if (!UpRefs.empty())
4116 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4117 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4119 GEN_ERROR("Cannot make array constant with type: '" +
4120 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4122 int NumElements = ATy->getNumElements();
4123 const Type *ETy = ATy->getElementType();
4124 char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true);
4125 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal)))
4126 GEN_ERROR("Can't build string constant of size " +
4127 itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) +
4128 " when array has size " + itostr(NumElements) + "");
4129 std::vector<Constant*> Vals;
4130 if (ETy == Type::Int8Ty) {
4131 for (unsigned char *C = (unsigned char *)(yyvsp[(3) - (3)].StrVal);
4132 C != (unsigned char*)EndStr; ++C)
4133 Vals.push_back(ConstantInt::get(ETy, *C));
4135 free((yyvsp[(3) - (3)].StrVal));
4136 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4138 free((yyvsp[(3) - (3)].StrVal));
4139 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4140 delete (yyvsp[(1) - (3)].TypeVal);
4146 #line 1580 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4147 { // Nonempty unsized arr
4148 if (!UpRefs.empty())
4149 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4150 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4152 GEN_ERROR("Cannot make packed constant with type: '" +
4153 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4154 const Type *ETy = PTy->getElementType();
4155 int NumElements = PTy->getNumElements();
4157 // Verify that we have the correct size...
4158 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4159 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4160 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4161 itostr(NumElements) + "");
4163 // Verify all elements are correct type!
4164 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4165 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4166 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4167 ETy->getDescription() +"' as required!\nIt is of type '"+
4168 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4171 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4172 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4178 #line 1608 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4180 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4182 GEN_ERROR("Cannot make struct constant with type: '" +
4183 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4185 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4186 GEN_ERROR("Illegal number of initializers for structure type");
4188 // Check to ensure that constants are compatible with the type initializer!
4189 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4190 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4191 GEN_ERROR("Expected type '" +
4192 STy->getElementType(i)->getDescription() +
4193 "' for element #" + utostr(i) +
4194 " of structure initializer");
4196 // Check to ensure that Type is not packed
4197 if (STy->isPacked())
4198 GEN_ERROR("Unpacked Initializer to vector type '" +
4199 STy->getDescription() + "'");
4201 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4202 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4208 #line 1634 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4210 if (!UpRefs.empty())
4211 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4212 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4214 GEN_ERROR("Cannot make struct constant with type: '" +
4215 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4217 if (STy->getNumContainedTypes() != 0)
4218 GEN_ERROR("Illegal number of initializers for structure type");
4220 // Check to ensure that Type is not packed
4221 if (STy->isPacked())
4222 GEN_ERROR("Unpacked Initializer to vector type '" +
4223 STy->getDescription() + "'");
4225 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4226 delete (yyvsp[(1) - (3)].TypeVal);
4232 #line 1654 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4234 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4236 GEN_ERROR("Cannot make struct constant with type: '" +
4237 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4239 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4240 GEN_ERROR("Illegal number of initializers for structure type");
4242 // Check to ensure that constants are compatible with the type initializer!
4243 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4244 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4245 GEN_ERROR("Expected type '" +
4246 STy->getElementType(i)->getDescription() +
4247 "' for element #" + utostr(i) +
4248 " of structure initializer");
4250 // Check to ensure that Type is packed
4251 if (!STy->isPacked())
4252 GEN_ERROR("Vector initializer to non-vector type '" +
4253 STy->getDescription() + "'");
4255 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4256 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4262 #line 1680 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4264 if (!UpRefs.empty())
4265 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4266 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4268 GEN_ERROR("Cannot make struct constant with type: '" +
4269 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4271 if (STy->getNumContainedTypes() != 0)
4272 GEN_ERROR("Illegal number of initializers for structure type");
4274 // Check to ensure that Type is packed
4275 if (!STy->isPacked())
4276 GEN_ERROR("Vector initializer to non-vector type '" +
4277 STy->getDescription() + "'");
4279 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4280 delete (yyvsp[(1) - (5)].TypeVal);
4286 #line 1700 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4288 if (!UpRefs.empty())
4289 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4290 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4292 GEN_ERROR("Cannot make null pointer constant with type: '" +
4293 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4295 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4296 delete (yyvsp[(1) - (2)].TypeVal);
4302 #line 1712 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4304 if (!UpRefs.empty())
4305 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4306 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4307 delete (yyvsp[(1) - (2)].TypeVal);
4313 #line 1719 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4315 if (!UpRefs.empty())
4316 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4317 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4319 GEN_ERROR("Global const reference must be a pointer type");
4321 // ConstExprs can exist in the body of a function, thus creating
4322 // GlobalValues whenever they refer to a variable. Because we are in
4323 // the context of a function, getExistingVal will search the functions
4324 // symbol table instead of the module symbol table for the global symbol,
4325 // which throws things all off. To get around this, we just tell
4326 // getExistingVal that we are at global scope here.
4328 Function *SavedCurFn = CurFun.CurrentFunction;
4329 CurFun.CurrentFunction = 0;
4331 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4334 CurFun.CurrentFunction = SavedCurFn;
4336 // If this is an initializer for a constant pointer, which is referencing a
4337 // (currently) undefined variable, create a stub now that shall be replaced
4338 // in the future with the right type of variable.
4341 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4342 const PointerType *PT = cast<PointerType>(Ty);
4344 // First check to see if the forward references value is already created!
4345 PerModuleInfo::GlobalRefsType::iterator I =
4346 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4348 if (I != CurModule.GlobalRefs.end()) {
4349 V = I->second; // Placeholder already exists, use it...
4350 (yyvsp[(2) - (2)].ValIDVal).destroy();
4353 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4354 Name = (yyvsp[(2) - (2)].ValIDVal).Name;
4355 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4356 GEN_ERROR("Invalid reference to global");
4358 // Create the forward referenced global.
4360 if (const FunctionType *FTy =
4361 dyn_cast<FunctionType>(PT->getElementType())) {
4362 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4363 CurModule.CurrentModule);
4365 GV = new GlobalVariable(PT->getElementType(), false,
4366 GlobalValue::ExternalWeakLinkage, 0,
4367 Name, CurModule.CurrentModule);
4370 // Keep track of the fact that we have a forward ref to recycle it
4371 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4376 (yyval.ConstVal) = cast<GlobalValue>(V);
4377 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4383 #line 1785 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4385 if (!UpRefs.empty())
4386 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4387 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4388 GEN_ERROR("Mismatched types for constant expression: " +
4389 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4390 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4391 delete (yyvsp[(1) - (2)].TypeVal);
4397 #line 1795 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4399 if (!UpRefs.empty())
4400 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4401 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4402 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4403 GEN_ERROR("Cannot create a null initialized value of this type");
4404 (yyval.ConstVal) = Constant::getNullValue(Ty);
4405 delete (yyvsp[(1) - (2)].TypeVal);
4411 #line 1805 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4412 { // integral constants
4413 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4414 GEN_ERROR("Constant value doesn't fit in type");
4415 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4421 #line 1811 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4422 { // arbitrary precision integer constants
4423 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4424 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4425 GEN_ERROR("Constant value does not fit in type");
4427 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4428 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4429 delete (yyvsp[(2) - (2)].APIntVal);
4435 #line 1821 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4436 { // integral constants
4437 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4438 GEN_ERROR("Constant value doesn't fit in type");
4439 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4445 #line 1827 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4446 { // arbitrary precision integer constants
4447 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4448 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4449 GEN_ERROR("Constant value does not fit in type");
4451 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4452 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4453 delete (yyvsp[(2) - (2)].APIntVal);
4459 #line 1837 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4460 { // Boolean constants
4461 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4462 (yyval.ConstVal) = ConstantInt::getTrue();
4468 #line 1842 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4469 { // Boolean constants
4470 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4471 (yyval.ConstVal) = ConstantInt::getFalse();
4477 #line 1847 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4478 { // Float & Double constants
4479 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)))
4480 GEN_ERROR("Floating point constant invalid for type");
4481 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal));
4487 #line 1855 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4489 if (!UpRefs.empty())
4490 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4491 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4492 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4493 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4494 GEN_ERROR("invalid cast opcode for cast from '" +
4495 Val->getType()->getDescription() + "' to '" +
4496 DestTy->getDescription() + "'");
4497 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4498 delete (yyvsp[(5) - (6)].TypeVal);
4503 #line 1867 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4505 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4506 GEN_ERROR("GetElementPtr requires a pointer operand");
4509 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), &(*(yyvsp[(4) - (5)].ValueList))[0], (yyvsp[(4) - (5)].ValueList)->size(),
4512 GEN_ERROR("Index list invalid for constant getelementptr");
4514 SmallVector<Constant*, 8> IdxVec;
4515 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4516 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4517 IdxVec.push_back(C);
4519 GEN_ERROR("Indices to constant getelementptr must be constants");
4521 delete (yyvsp[(4) - (5)].ValueList);
4523 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4529 #line 1889 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4531 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4532 GEN_ERROR("Select condition must be of boolean type");
4533 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4534 GEN_ERROR("Select operand types must match");
4535 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4541 #line 1897 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4543 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4544 GEN_ERROR("Binary operator types must match");
4546 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4551 #line 1903 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4553 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4554 GEN_ERROR("Logical operator types must match");
4555 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4556 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4557 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4558 GEN_ERROR("Logical operator requires integral operands");
4560 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4566 #line 1914 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4568 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4569 GEN_ERROR("icmp operand types must match");
4570 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4575 #line 1919 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4577 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4578 GEN_ERROR("fcmp operand types must match");
4579 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4584 #line 1924 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4586 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4587 GEN_ERROR("Invalid extractelement operands");
4588 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4594 #line 1930 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4596 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4597 GEN_ERROR("Invalid insertelement operands");
4598 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4604 #line 1936 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4606 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4607 GEN_ERROR("Invalid shufflevector operands");
4608 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4614 #line 1945 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4616 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4622 #line 1949 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4624 (yyval.ConstVector) = new std::vector<Constant*>();
4625 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4631 #line 1957 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4632 { (yyval.BoolVal) = false; ;}
4636 #line 1957 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4637 { (yyval.BoolVal) = true; ;}
4641 #line 1960 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4642 { (yyval.BoolVal) = true; ;}
4646 #line 1960 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4647 { (yyval.BoolVal) = false; ;}
4651 #line 1963 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4653 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4654 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4655 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4657 GEN_ERROR("Aliases can be created only to global values");
4659 (yyval.ConstVal) = Aliasee;
4661 delete (yyvsp[(1) - (2)].TypeVal);
4666 #line 1974 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4668 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4669 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4670 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4671 GEN_ERROR("invalid cast opcode for cast from '" +
4672 Val->getType()->getDescription() + "' to '" +
4673 DestTy->getDescription() + "'");
4675 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4677 delete (yyvsp[(5) - (6)].TypeVal);
4682 #line 1995 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4684 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4685 CurModule.ModuleDone();
4691 #line 2000 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4693 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4694 CurModule.ModuleDone();
4700 #line 2013 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4701 { CurFun.isDeclare = false; ;}
4705 #line 2013 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4707 CurFun.FunctionDone();
4713 #line 2017 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4714 { CurFun.isDeclare = true; ;}
4718 #line 2017 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4725 #line 2020 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4732 #line 2023 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4734 if (!UpRefs.empty())
4735 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4736 // Eagerly resolve types. This is not an optimization, this is a
4737 // requirement that is due to the fact that we could have this:
4739 // %list = type { %list * }
4740 // %list = type { %list * } ; repeated type decl
4742 // If types are not resolved eagerly, then the two types will not be
4743 // determined to be the same type!
4745 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4747 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4749 // If this is a named type that is not a redefinition, add it to the slot
4751 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4754 delete (yyvsp[(3) - (3)].TypeVal);
4760 #line 2047 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4762 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4764 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4766 // If this is a named type that is not a redefinition, add it to the slot
4768 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4775 #line 2058 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4777 /* "Externally Visible" Linkage */
4778 if ((yyvsp[(5) - (5)].ConstVal) == 0)
4779 GEN_ERROR("Global value initializer is not a constant");
4780 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), GlobalValue::ExternalLinkage,
4781 (yyvsp[(2) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal), (yyvsp[(3) - (5)].BoolVal));
4787 #line 2065 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4794 #line 2069 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4796 if ((yyvsp[(6) - (6)].ConstVal) == 0)
4797 GEN_ERROR("Global value initializer is not a constant");
4798 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), (yyvsp[(6) - (6)].ConstVal)->getType(), (yyvsp[(6) - (6)].ConstVal), (yyvsp[(4) - (6)].BoolVal));
4804 #line 2074 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4811 #line 2078 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4813 if (!UpRefs.empty())
4814 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription());
4815 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), *(yyvsp[(6) - (6)].TypeVal), 0, (yyvsp[(4) - (6)].BoolVal));
4817 delete (yyvsp[(6) - (6)].TypeVal);
4822 #line 2084 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4830 #line 2088 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4832 std::string Name((yyvsp[(1) - (5)].StrVal));
4834 GEN_ERROR("Alias name cannot be empty");
4836 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
4838 GEN_ERROR(std::string("Invalid aliasee for alias: ") + (yyvsp[(1) - (5)].StrVal));
4840 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
4841 CurModule.CurrentModule);
4842 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
4843 InsertValue(GA, CurModule.Values);
4849 #line 2103 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4856 #line 2106 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4863 #line 2112 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4865 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4866 char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true);
4867 std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr);
4868 free((yyvsp[(1) - (1)].StrVal));
4870 if (AsmSoFar.empty())
4871 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4873 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4879 #line 2125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4881 CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal));
4882 free((yyvsp[(3) - (3)].StrVal));
4887 #line 2129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4889 CurModule.CurrentModule->setDataLayout((yyvsp[(3) - (3)].StrVal));
4890 free((yyvsp[(3) - (3)].StrVal));
4895 #line 2136 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4897 CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal));
4898 free((yyvsp[(3) - (3)].StrVal));
4904 #line 2141 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4906 CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal));
4907 free((yyvsp[(1) - (1)].StrVal));
4913 #line 2146 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4920 #line 2155 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4922 if (!UpRefs.empty())
4923 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
4924 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
4925 GEN_ERROR("void typed arguments are invalid");
4926 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
4927 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
4928 (yyvsp[(1) - (5)].ArgList)->push_back(E);
4934 #line 2165 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4936 if (!UpRefs.empty())
4937 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4938 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
4939 GEN_ERROR("void typed arguments are invalid");
4940 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
4941 (yyval.ArgList) = new ArgListType;
4942 (yyval.ArgList)->push_back(E);
4948 #line 2176 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4950 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
4956 #line 2180 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4958 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
4959 struct ArgListEntry E;
4960 E.Ty = new PATypeHolder(Type::VoidTy);
4962 E.Attrs = ParamAttr::None;
4963 (yyval.ArgList)->push_back(E);
4969 #line 2189 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4971 (yyval.ArgList) = new ArgListType;
4972 struct ArgListEntry E;
4973 E.Ty = new PATypeHolder(Type::VoidTy);
4975 E.Attrs = ParamAttr::None;
4976 (yyval.ArgList)->push_back(E);
4982 #line 2198 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4984 (yyval.ArgList) = 0;
4990 #line 2204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4992 UnEscapeLexed((yyvsp[(3) - (9)].StrVal));
4993 std::string FunctionName((yyvsp[(3) - (9)].StrVal));
4994 free((yyvsp[(3) - (9)].StrVal)); // Free strdup'd memory!
4996 // Check the function result for abstractness if this is a define. We should
4997 // have no abstract types at this point
4998 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (9)].TypeVal)))
4999 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (9)].TypeVal)->get()->getDescription());
5001 std::vector<const Type*> ParamTypeList;
5002 ParamAttrsVector Attrs;
5003 if ((yyvsp[(7) - (9)].ParamAttrs) != ParamAttr::None) {
5004 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(7) - (9)].ParamAttrs);
5005 Attrs.push_back(PAWI);
5007 if ((yyvsp[(5) - (9)].ArgList)) { // If there are arguments...
5009 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin(); I != (yyvsp[(5) - (9)].ArgList)->end(); ++I, ++index) {
5010 const Type* Ty = I->Ty->get();
5011 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5012 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5013 ParamTypeList.push_back(Ty);
5014 if (Ty != Type::VoidTy)
5015 if (I->Attrs != ParamAttr::None) {
5016 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5017 Attrs.push_back(PAWI);
5022 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5023 if (isVarArg) ParamTypeList.pop_back();
5025 ParamAttrsList *PAL = 0;
5027 PAL = ParamAttrsList::get(Attrs);
5029 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (9)].TypeVal), ParamTypeList, isVarArg, PAL);
5030 const PointerType *PFT = PointerType::get(FT);
5031 delete (yyvsp[(2) - (9)].TypeVal);
5034 if (!FunctionName.empty()) {
5035 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5037 ID = ValID::createGlobalID(CurModule.Values.size());
5041 // See if this function was forward referenced. If so, recycle the object.
5042 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5043 // Move the function to the end of the list, from whereever it was
5044 // previously inserted.
5045 Fn = cast<Function>(FWRef);
5046 CurModule.CurrentModule->getFunctionList().remove(Fn);
5047 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5048 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5049 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5050 if (Fn->getFunctionType() != FT) {
5051 // The existing function doesn't have the same type. This is an overload
5053 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5054 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5055 // Neither the existing or the current function is a declaration and they
5056 // have the same name and same type. Clearly this is a redefinition.
5057 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5058 } if (Fn->isDeclaration()) {
5059 // Make sure to strip off any argument names so we can't get conflicts.
5060 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5064 } else { // Not already defined?
5065 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5066 CurModule.CurrentModule);
5068 InsertValue(Fn, CurModule.Values);
5071 CurFun.FunctionStart(Fn);
5073 if (CurFun.isDeclare) {
5074 // If we have declaration, always overwrite linkage. This will allow us to
5075 // correctly handle cases, when pointer to function is passed as argument to
5076 // another function.
5077 Fn->setLinkage(CurFun.Linkage);
5078 Fn->setVisibility(CurFun.Visibility);
5080 Fn->setCallingConv((yyvsp[(1) - (9)].UIntVal));
5081 Fn->setAlignment((yyvsp[(9) - (9)].UIntVal));
5082 if ((yyvsp[(8) - (9)].StrVal)) {
5083 Fn->setSection((yyvsp[(8) - (9)].StrVal));
5084 free((yyvsp[(8) - (9)].StrVal));
5087 // Add all of the arguments we parsed to the function...
5088 if ((yyvsp[(5) - (9)].ArgList)) { // Is null if empty...
5089 if (isVarArg) { // Nuke the last entry
5090 assert((yyvsp[(5) - (9)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (9)].ArgList)->back().Name == 0 &&
5091 "Not a varargs marker!");
5092 delete (yyvsp[(5) - (9)].ArgList)->back().Ty;
5093 (yyvsp[(5) - (9)].ArgList)->pop_back(); // Delete the last entry
5095 Function::arg_iterator ArgIt = Fn->arg_begin();
5096 Function::arg_iterator ArgEnd = Fn->arg_end();
5098 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin();
5099 I != (yyvsp[(5) - (9)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5100 delete I->Ty; // Delete the typeholder...
5101 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5107 delete (yyvsp[(5) - (9)].ArgList); // We're now done with the argument list
5114 #line 2327 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5116 (yyval.FunctionVal) = CurFun.CurrentFunction;
5118 // Make sure that we keep track of the linkage type even if there was a
5119 // previous "declare".
5120 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5121 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5126 #line 2338 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5128 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5134 #line 2343 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5136 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5137 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5138 (yyval.FunctionVal) = CurFun.CurrentFunction;
5139 CurFun.FunctionDone();
5145 #line 2355 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5147 (yyval.BoolVal) = false;
5153 #line 2359 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5155 (yyval.BoolVal) = true;
5161 #line 2364 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5162 { // A reference to a direct constant
5163 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5169 #line 2368 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5171 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5177 #line 2372 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5178 { // Perhaps it's an FP constant?
5179 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5185 #line 2376 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5187 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5193 #line 2380 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5195 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5201 #line 2384 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5203 (yyval.ValIDVal) = ValID::createNull();
5209 #line 2388 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5211 (yyval.ValIDVal) = ValID::createUndef();
5217 #line 2392 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5218 { // A vector zero constant.
5219 (yyval.ValIDVal) = ValID::createZeroInit();
5225 #line 2396 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5226 { // Nonempty unsized packed vector
5227 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5228 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5230 VectorType* pt = VectorType::get(ETy, NumElements);
5231 PATypeHolder* PTy = new PATypeHolder(
5239 // Verify all elements are correct type!
5240 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5241 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5242 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5243 ETy->getDescription() +"' as required!\nIt is of type '" +
5244 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5247 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5248 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5254 #line 2421 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5256 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5262 #line 2425 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5264 char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true);
5265 std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End);
5266 End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true);
5267 std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End);
5268 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal));
5269 free((yyvsp[(3) - (5)].StrVal));
5270 free((yyvsp[(5) - (5)].StrVal));
5276 #line 2439 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5277 { // Is it an integer reference...?
5278 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5284 #line 2443 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5286 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5292 #line 2447 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5293 { // Is it a named reference...?
5294 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[(1) - (1)].StrVal));
5300 #line 2451 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5301 { // Is it a named reference...?
5302 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[(1) - (1)].StrVal));
5308 #line 2463 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5310 if (!UpRefs.empty())
5311 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5312 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5313 delete (yyvsp[(1) - (2)].TypeVal);
5319 #line 2472 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5321 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5327 #line 2476 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5328 { // Do not allow functions with 0 basic blocks
5329 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5335 #line 2485 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5337 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5339 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5340 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5341 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5347 #line 2494 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5349 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5350 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5351 if (CI2->getParent() == 0)
5352 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5353 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5354 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5360 #line 2503 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5361 { // Empty space between instruction lists
5362 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5368 #line 2507 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5369 { // Labelled (named) basic block
5370 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[(1) - (1)].StrVal)));
5376 #line 2512 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5377 { // Return with a result...
5378 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5384 #line 2516 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5385 { // Return with no result...
5386 (yyval.TermInstVal) = new ReturnInst();
5392 #line 2520 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5393 { // Unconditional Branch...
5394 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5396 (yyval.TermInstVal) = new BranchInst(tmpBB);
5401 #line 2525 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5403 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5404 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5406 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5408 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5410 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5415 #line 2535 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5417 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5419 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5421 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5422 (yyval.TermInstVal) = S;
5424 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5425 E = (yyvsp[(8) - (9)].JumpTable)->end();
5426 for (; I != E; ++I) {
5427 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5428 S->addCase(CI, I->second);
5430 GEN_ERROR("Switch case is constant, but not a simple integer");
5432 delete (yyvsp[(8) - (9)].JumpTable);
5438 #line 2554 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5440 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5442 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5444 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5445 (yyval.TermInstVal) = S;
5451 #line 2564 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5454 // Handle the short syntax
5455 const PointerType *PFTy = 0;
5456 const FunctionType *Ty = 0;
5457 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5458 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5459 // Pull out the types of all of the arguments...
5460 std::vector<const Type*> ParamTypes;
5461 ParamAttrsVector Attrs;
5462 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5463 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = 8;
5464 Attrs.push_back(PAWI);
5466 ValueRefList::iterator I = (yyvsp[(6) - (14)].ValueRefList)->begin(), E = (yyvsp[(6) - (14)].ValueRefList)->end();
5468 for (; I != E; ++I, ++index) {
5469 const Type *Ty = I->Val->getType();
5470 if (Ty == Type::VoidTy)
5471 GEN_ERROR("Short call syntax cannot be used with varargs");
5472 ParamTypes.push_back(Ty);
5473 if (I->Attrs != ParamAttr::None) {
5474 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5475 Attrs.push_back(PAWI);
5479 ParamAttrsList *PAL = 0;
5481 PAL = ParamAttrsList::get(Attrs);
5482 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false, PAL);
5483 PFTy = PointerType::get(Ty);
5486 delete (yyvsp[(3) - (14)].TypeVal);
5488 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5490 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5492 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5495 // Check the arguments
5497 if ((yyvsp[(6) - (14)].ValueRefList)->empty()) { // Has no arguments?
5498 // Make sure no arguments is a good thing!
5499 if (Ty->getNumParams() != 0)
5500 GEN_ERROR("No arguments passed to a function that "
5501 "expects arguments");
5502 } else { // Has arguments?
5503 // Loop through FunctionType's arguments and ensure they are specified
5505 FunctionType::param_iterator I = Ty->param_begin();
5506 FunctionType::param_iterator E = Ty->param_end();
5507 ValueRefList::iterator ArgI = (yyvsp[(6) - (14)].ValueRefList)->begin(), ArgE = (yyvsp[(6) - (14)].ValueRefList)->end();
5509 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5510 if (ArgI->Val->getType() != *I)
5511 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5512 (*I)->getDescription() + "'");
5513 Args.push_back(ArgI->Val);
5516 if (Ty->isVarArg()) {
5518 for (; ArgI != ArgE; ++ArgI)
5519 Args.push_back(ArgI->Val); // push the remaining varargs
5520 } else if (I != E || ArgI != ArgE)
5521 GEN_ERROR("Invalid number of parameters detected");
5524 // Create the InvokeInst
5525 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5526 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5527 (yyval.TermInstVal) = II;
5528 delete (yyvsp[(6) - (14)].ValueRefList);
5534 #line 2643 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5536 (yyval.TermInstVal) = new UnwindInst();
5542 #line 2647 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5544 (yyval.TermInstVal) = new UnreachableInst();
5550 #line 2654 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5552 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5553 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5556 GEN_ERROR("May only switch on a constant pool value");
5558 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5560 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5565 #line 2665 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5567 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5568 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5572 GEN_ERROR("May only switch on a constant pool value");
5574 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5576 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5581 #line 2678 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5583 // Is this definition named?? if so, assign the name...
5584 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5586 InsertValue((yyvsp[(2) - (2)].InstVal));
5587 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5593 #line 2688 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5594 { // Used for PHI nodes
5595 if (!UpRefs.empty())
5596 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5597 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5598 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5600 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5602 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5603 delete (yyvsp[(1) - (6)].TypeVal);
5608 #line 2699 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5610 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5611 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5613 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5615 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5620 #line 2709 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5622 if (!UpRefs.empty())
5623 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5624 // Used for call and invoke instructions
5625 (yyval.ValueRefList) = new ValueRefList();
5626 ValueRefListEntry E; E.Attrs = (yyvsp[(3) - (3)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (3)].TypeVal)->get(), (yyvsp[(2) - (3)].ValIDVal));
5627 (yyval.ValueRefList)->push_back(E);
5628 delete (yyvsp[(1) - (3)].TypeVal);
5633 #line 2718 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5635 if (!UpRefs.empty())
5636 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5637 (yyval.ValueRefList) = (yyvsp[(1) - (5)].ValueRefList);
5638 ValueRefListEntry E; E.Attrs = (yyvsp[(5) - (5)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (5)].TypeVal)->get(), (yyvsp[(4) - (5)].ValIDVal));
5639 (yyval.ValueRefList)->push_back(E);
5640 delete (yyvsp[(3) - (5)].TypeVal);
5646 #line 2727 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5647 { (yyval.ValueRefList) = new ValueRefList(); ;}
5651 #line 2730 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5652 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5656 #line 2731 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5658 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5659 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5665 #line 2738 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5667 (yyval.BoolVal) = true;
5673 #line 2742 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5675 (yyval.BoolVal) = false;
5681 #line 2747 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5683 if (!UpRefs.empty())
5684 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5685 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5686 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5688 "Arithmetic operator requires integer, FP, or packed operands");
5689 if (isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()) &&
5690 ((yyvsp[(1) - (5)].BinaryOpVal) == Instruction::URem ||
5691 (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::SRem ||
5692 (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::FRem))
5693 GEN_ERROR("Remainder not supported on vector types");
5694 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5696 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5698 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5699 if ((yyval.InstVal) == 0)
5700 GEN_ERROR("binary operator returned null");
5701 delete (yyvsp[(2) - (5)].TypeVal);
5706 #line 2768 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5708 if (!UpRefs.empty())
5709 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5710 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5711 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5712 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5713 GEN_ERROR("Logical operator requires integral operands");
5715 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5717 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5719 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5720 if ((yyval.InstVal) == 0)
5721 GEN_ERROR("binary operator returned null");
5722 delete (yyvsp[(2) - (5)].TypeVal);
5727 #line 2785 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5729 if (!UpRefs.empty())
5730 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5731 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5732 GEN_ERROR("Vector types not supported by icmp instruction");
5733 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5735 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5737 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
5738 if ((yyval.InstVal) == 0)
5739 GEN_ERROR("icmp operator returned null");
5740 delete (yyvsp[(3) - (6)].TypeVal);
5745 #line 2799 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5747 if (!UpRefs.empty())
5748 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5749 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5750 GEN_ERROR("Vector types not supported by fcmp instruction");
5751 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5753 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5755 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
5756 if ((yyval.InstVal) == 0)
5757 GEN_ERROR("fcmp operator returned null");
5758 delete (yyvsp[(3) - (6)].TypeVal);
5763 #line 2813 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5765 if (!UpRefs.empty())
5766 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5767 Value* Val = (yyvsp[(2) - (4)].ValueVal);
5768 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
5769 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
5770 GEN_ERROR("invalid cast opcode for cast from '" +
5771 Val->getType()->getDescription() + "' to '" +
5772 DestTy->getDescription() + "'");
5773 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
5774 delete (yyvsp[(4) - (4)].TypeVal);
5779 #line 2825 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5781 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
5782 GEN_ERROR("select condition must be boolean");
5783 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
5784 GEN_ERROR("select value types should match");
5785 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5791 #line 2833 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5793 if (!UpRefs.empty())
5794 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5795 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
5796 delete (yyvsp[(4) - (4)].TypeVal);
5802 #line 2840 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5804 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
5805 GEN_ERROR("Invalid extractelement operands");
5806 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
5812 #line 2846 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5814 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
5815 GEN_ERROR("Invalid insertelement operands");
5816 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5822 #line 2852 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5824 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
5825 GEN_ERROR("Invalid shufflevector operands");
5826 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5832 #line 2858 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5834 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
5835 if (!Ty->isFirstClassType())
5836 GEN_ERROR("PHI node operands must be of first class type");
5837 (yyval.InstVal) = new PHINode(Ty);
5838 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
5839 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
5840 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
5841 GEN_ERROR("All elements of a PHI node must be of the same type");
5842 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
5843 (yyvsp[(2) - (2)].PHIList)->pop_front();
5845 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
5851 #line 2874 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5854 // Handle the short syntax
5855 const PointerType *PFTy = 0;
5856 const FunctionType *Ty = 0;
5857 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
5858 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5859 // Pull out the types of all of the arguments...
5860 std::vector<const Type*> ParamTypes;
5861 ParamAttrsVector Attrs;
5862 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
5863 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
5864 Attrs.push_back(PAWI);
5867 ValueRefList::iterator I = (yyvsp[(6) - (8)].ValueRefList)->begin(), E = (yyvsp[(6) - (8)].ValueRefList)->end();
5868 for (; I != E; ++I, ++index) {
5869 const Type *Ty = I->Val->getType();
5870 if (Ty == Type::VoidTy)
5871 GEN_ERROR("Short call syntax cannot be used with varargs");
5872 ParamTypes.push_back(Ty);
5873 if (I->Attrs != ParamAttr::None) {
5874 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5875 Attrs.push_back(PAWI);
5879 ParamAttrsList *PAL = 0;
5881 PAL = ParamAttrsList::get(Attrs);
5883 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false, PAL);
5884 PFTy = PointerType::get(Ty);
5887 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
5890 // Check for call to invalid intrinsic to avoid crashing later.
5891 if (Function *theF = dyn_cast<Function>(V)) {
5892 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5893 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5894 !theF->getIntrinsicID(true))
5895 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5896 theF->getName() + "'");
5899 // Check the arguments
5901 if ((yyvsp[(6) - (8)].ValueRefList)->empty()) { // Has no arguments?
5902 // Make sure no arguments is a good thing!
5903 if (Ty->getNumParams() != 0)
5904 GEN_ERROR("No arguments passed to a function that "
5905 "expects arguments");
5906 } else { // Has arguments?
5907 // Loop through FunctionType's arguments and ensure they are specified
5910 FunctionType::param_iterator I = Ty->param_begin();
5911 FunctionType::param_iterator E = Ty->param_end();
5912 ValueRefList::iterator ArgI = (yyvsp[(6) - (8)].ValueRefList)->begin(), ArgE = (yyvsp[(6) - (8)].ValueRefList)->end();
5914 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5915 if (ArgI->Val->getType() != *I)
5916 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5917 (*I)->getDescription() + "'");
5918 Args.push_back(ArgI->Val);
5920 if (Ty->isVarArg()) {
5922 for (; ArgI != ArgE; ++ArgI)
5923 Args.push_back(ArgI->Val); // push the remaining varargs
5924 } else if (I != E || ArgI != ArgE)
5925 GEN_ERROR("Invalid number of parameters detected");
5927 // Create the call node
5928 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5929 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
5930 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
5931 (yyval.InstVal) = CI;
5932 delete (yyvsp[(6) - (8)].ValueRefList);
5933 delete (yyvsp[(3) - (8)].TypeVal);
5939 #line 2958 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5941 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
5947 #line 2963 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5949 (yyval.BoolVal) = true;
5955 #line 2967 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5957 (yyval.BoolVal) = false;
5963 #line 2974 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5965 if (!UpRefs.empty())
5966 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
5967 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
5968 delete (yyvsp[(2) - (3)].TypeVal);
5974 #line 2981 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5976 if (!UpRefs.empty())
5977 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
5978 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
5980 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
5981 delete (yyvsp[(2) - (6)].TypeVal);
5986 #line 2989 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5988 if (!UpRefs.empty())
5989 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
5990 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
5991 delete (yyvsp[(2) - (3)].TypeVal);
5997 #line 2996 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5999 if (!UpRefs.empty())
6000 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6001 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6003 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6004 delete (yyvsp[(2) - (6)].TypeVal);
6009 #line 3004 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6011 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6012 GEN_ERROR("Trying to free nonpointer type " +
6013 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6014 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6020 #line 3012 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6022 if (!UpRefs.empty())
6023 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6024 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6025 GEN_ERROR("Can't load from nonpointer type: " +
6026 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6027 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6028 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6029 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6030 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6032 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6033 delete (yyvsp[(3) - (5)].TypeVal);
6038 #line 3026 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6040 if (!UpRefs.empty())
6041 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6042 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6044 GEN_ERROR("Can't store to a nonpointer type: " +
6045 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6046 const Type *ElTy = PT->getElementType();
6047 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6048 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6049 "' into space of type '" + ElTy->getDescription() + "'");
6051 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6053 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6054 delete (yyvsp[(5) - (7)].TypeVal);
6059 #line 3043 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6061 if (!UpRefs.empty())
6062 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6063 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6064 GEN_ERROR("getelementptr insn requires pointer operand");
6066 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), &(*(yyvsp[(4) - (4)].ValueList))[0], (yyvsp[(4) - (4)].ValueList)->size(), true))
6067 GEN_ERROR("Invalid getelementptr indices for type '" +
6068 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6069 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6071 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[(4) - (4)].ValueList))[0], (yyvsp[(4) - (4)].ValueList)->size());
6072 delete (yyvsp[(2) - (4)].TypeVal);
6073 delete (yyvsp[(4) - (4)].ValueList);
6078 /* Line 1267 of yacc.c. */
6079 #line 6080 "llvmAsmParser.tab.c"
6082 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6086 YY_STACK_PRINT (yyss, yyssp);
6091 /* Now `shift' the result of the reduction. Determine what state
6092 that goes to, based on the state we popped back to and the rule
6093 number reduced by. */
6097 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6098 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6099 yystate = yytable[yystate];
6101 yystate = yydefgoto[yyn - YYNTOKENS];
6106 /*------------------------------------.
6107 | yyerrlab -- here on detecting error |
6108 `------------------------------------*/
6110 /* If not already recovering from an error, report this error. */
6114 #if ! YYERROR_VERBOSE
6115 yyerror (YY_("syntax error"));
6118 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6119 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6121 YYSIZE_T yyalloc = 2 * yysize;
6122 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6123 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6124 if (yymsg != yymsgbuf)
6125 YYSTACK_FREE (yymsg);
6126 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6128 yymsg_alloc = yyalloc;
6132 yymsg_alloc = sizeof yymsgbuf;
6136 if (0 < yysize && yysize <= yymsg_alloc)
6138 (void) yysyntax_error (yymsg, yystate, yychar);
6143 yyerror (YY_("syntax error"));
6145 goto yyexhaustedlab;
6153 if (yyerrstatus == 3)
6155 /* If just tried and failed to reuse look-ahead token after an
6156 error, discard it. */
6158 if (yychar <= YYEOF)
6160 /* Return failure if at end of input. */
6161 if (yychar == YYEOF)
6166 yydestruct ("Error: discarding",
6172 /* Else will try to reuse look-ahead token after shifting the error
6177 /*---------------------------------------------------.
6178 | yyerrorlab -- error raised explicitly by YYERROR. |
6179 `---------------------------------------------------*/
6182 /* Pacify compilers like GCC when the user code never invokes
6183 YYERROR and the label yyerrorlab therefore never appears in user
6185 if (/*CONSTCOND*/ 0)
6188 /* Do not reclaim the symbols of the rule which action triggered
6192 YY_STACK_PRINT (yyss, yyssp);
6197 /*-------------------------------------------------------------.
6198 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6199 `-------------------------------------------------------------*/
6201 yyerrstatus = 3; /* Each real token shifted decrements this. */
6205 yyn = yypact[yystate];
6206 if (yyn != YYPACT_NINF)
6209 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6217 /* Pop the current state because it cannot handle the error token. */
6222 yydestruct ("Error: popping",
6223 yystos[yystate], yyvsp);
6226 YY_STACK_PRINT (yyss, yyssp);
6235 /* Shift the error token. */
6236 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6242 /*-------------------------------------.
6243 | yyacceptlab -- YYACCEPT comes here. |
6244 `-------------------------------------*/
6249 /*-----------------------------------.
6250 | yyabortlab -- YYABORT comes here. |
6251 `-----------------------------------*/
6257 /*-------------------------------------------------.
6258 | yyexhaustedlab -- memory exhaustion comes here. |
6259 `-------------------------------------------------*/
6261 yyerror (YY_("memory exhausted"));
6267 if (yychar != YYEOF && yychar != YYEMPTY)
6268 yydestruct ("Cleanup: discarding lookahead",
6270 /* Do not reclaim the symbols of the rule which action triggered
6271 this YYABORT or YYACCEPT. */
6273 YY_STACK_PRINT (yyss, yyssp);
6274 while (yyssp != yyss)
6276 yydestruct ("Cleanup: popping",
6277 yystos[*yyssp], yyvsp);
6282 YYSTACK_FREE (yyss);
6285 if (yymsg != yymsgbuf)
6286 YYSTACK_FREE (yymsg);
6288 /* Make sure YYID is used. */
6289 return YYID (yyresult);
6293 #line 3060 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6296 // common code from the two 'RunVMAsmParser' functions
6297 static Module* RunParser(Module * M) {
6299 llvmAsmlineno = 1; // Reset the current line number...
6300 CurModule.CurrentModule = M;
6305 // Check to make sure the parser succeeded
6308 delete ParserResult;
6312 // Emit an error if there are any unresolved types left.
6313 if (!CurModule.LateResolveTypes.empty()) {
6314 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6315 if (DID.Type == ValID::LocalName) {
6316 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6318 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6321 delete ParserResult;
6325 // Emit an error if there are any unresolved values left.
6326 if (!CurModule.LateResolveValues.empty()) {
6327 Value *V = CurModule.LateResolveValues.back();
6328 std::map<Value*, std::pair<ValID, int> >::iterator I =
6329 CurModule.PlaceHolderInfo.find(V);
6331 if (I != CurModule.PlaceHolderInfo.end()) {
6332 ValID &DID = I->second.first;
6333 if (DID.Type == ValID::LocalName) {
6334 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6336 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6339 delete ParserResult;
6344 // Check to make sure that parsing produced a result
6348 // Reset ParserResult variable while saving its value for the result.
6349 Module *Result = ParserResult;
6355 void llvm::GenerateError(const std::string &message, int LineNo) {
6356 if (LineNo == -1) LineNo = llvmAsmlineno;
6357 // TODO: column number in exception
6359 TheParseError->setError(CurFilename, message, LineNo);
6363 int yyerror(const char *ErrorMsg) {
6365 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6366 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6367 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6368 if (yychar != YYEMPTY && yychar != 0)
6369 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6371 GenerateError(errMsg);