1 /* A Bison parser, made from /usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y, by GNU bison 1.75. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
45 /* If NAME_PREFIX is specified substitute the variables and functions
47 #define yyparse llvmAsmparse
48 #define yylex llvmAsmlex
49 #define yyerror llvmAsmerror
50 #define yylval llvmAsmlval
51 #define yychar llvmAsmchar
52 #define yydebug llvmAsmdebug
53 #define yynerrs llvmAsmnerrs
59 /* Put the tokens into the symbol table, so that GDB and other debuggers
79 ATSTRINGCONSTANT = 275,
80 ZEROINITIALIZER = 276,
119 X86_STDCALLCC_TOK = 315,
120 X86_FASTCALLCC_TOK = 316,
186 EXTRACTELEMENT = 382,
197 #define ESINT64VAL 258
198 #define EUINT64VAL 259
199 #define ESAPINTVAL 260
200 #define EUAPINTVAL 261
201 #define LOCALVAL_ID 262
202 #define GLOBALVAL_ID 263
211 #define GLOBALVAR 272
213 #define STRINGCONSTANT 274
214 #define ATSTRINGCONSTANT 275
215 #define ZEROINITIALIZER 276
227 #define THREAD_LOCAL 288
229 #define DOTDOTDOT 290
235 #define APPENDING 296
236 #define DLLIMPORT 297
237 #define DLLEXPORT 298
238 #define EXTERN_WEAK 299
249 #define SIDEEFFECT 310
252 #define FASTCC_TOK 313
253 #define COLDCC_TOK 314
254 #define X86_STDCALLCC_TOK 315
255 #define X86_FASTCALLCC_TOK 316
256 #define DATALAYOUT 317
262 #define UNREACHABLE 323
305 #define GETELEMENTPTR 366
321 #define EXTRACTELEMENT 382
322 #define INSERTELEMENT 383
323 #define SHUFFLEVECTOR 384
334 /* Copy the first part of user declarations. */
335 #line 14 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
337 #include "ParserInternals.h"
338 #include "llvm/CallingConv.h"
339 #include "llvm/InlineAsm.h"
340 #include "llvm/Instructions.h"
341 #include "llvm/Module.h"
342 #include "llvm/ValueSymbolTable.h"
343 #include "llvm/Support/GetElementPtrTypeIterator.h"
344 #include "llvm/Support/CommandLine.h"
345 #include "llvm/ADT/SmallVector.h"
346 #include "llvm/ADT/STLExtras.h"
347 #include "llvm/Support/MathExtras.h"
348 #include "llvm/Support/Streams.h"
357 // The following is a gross hack. In order to rid the libAsmParser library of
358 // exceptions, we have to have a way of getting the yyparse function to go into
359 // an error situation. So, whenever we want an error to occur, the GenerateError
360 // function (see bottom of file) sets TriggerError. Then, at the end of each
361 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
362 // (a goto) to put YACC in error state. Furthermore, several calls to
363 // GenerateError are made from inside productions and they must simulate the
364 // previous exception behavior by exiting the production immediately. We have
365 // replaced these with the GEN_ERROR macro which calls GeneratError and then
366 // immediately invokes YYERROR. This would be so much cleaner if it was a
367 // recursive descent parser.
368 static bool TriggerError = false;
369 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
370 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
372 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
373 int yylex(); // declaration" of xxx warnings.
377 std::string CurFilename;
380 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
381 cl::Hidden, cl::init(false));
384 using namespace llvm;
386 static Module *ParserResult;
388 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
389 // relating to upreferences in the input stream.
391 //#define DEBUG_UPREFS 1
393 #define UR_OUT(X) cerr << X
398 #define YYERROR_VERBOSE 1
400 static GlobalVariable *CurGV;
403 // This contains info used when building the body of a function. It is
404 // destroyed when the function is completed.
406 typedef std::vector<Value *> ValueList; // Numbered defs
409 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
411 static struct PerModuleInfo {
412 Module *CurrentModule;
413 ValueList Values; // Module level numbered definitions
414 ValueList LateResolveValues;
415 std::vector<PATypeHolder> Types;
416 std::map<ValID, PATypeHolder> LateResolveTypes;
418 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
419 /// how they were referenced and on which line of the input they came from so
420 /// that we can resolve them later and print error messages as appropriate.
421 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
423 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
424 // references to global values. Global values may be referenced before they
425 // are defined, and if so, the temporary object that they represent is held
426 // here. This is used for forward references of GlobalValues.
428 typedef std::map<std::pair<const PointerType *,
429 ValID>, GlobalValue*> GlobalRefsType;
430 GlobalRefsType GlobalRefs;
433 // If we could not resolve some functions at function compilation time
434 // (calls to functions before they are defined), resolve them now... Types
435 // are resolved when the constant pool has been completely parsed.
437 ResolveDefinitions(LateResolveValues);
441 // Check to make sure that all global value forward references have been
444 if (!GlobalRefs.empty()) {
445 std::string UndefinedReferences = "Unresolved global references exist:\n";
447 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
449 UndefinedReferences += " " + I->first.first->getDescription() + " " +
450 I->first.second.getName() + "\n";
452 GenerateError(UndefinedReferences);
456 Values.clear(); // Clear out function local definitions
461 // GetForwardRefForGlobal - Check to see if there is a forward reference
462 // for this global. If so, remove it from the GlobalRefs map and return it.
463 // If not, just return null.
464 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
465 // Check to see if there is a forward reference to this global variable...
466 // if there is, eliminate it and patch the reference to use the new def'n.
467 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
468 GlobalValue *Ret = 0;
469 if (I != GlobalRefs.end()) {
476 bool TypeIsUnresolved(PATypeHolder* PATy) {
477 // If it isn't abstract, its resolved
478 const Type* Ty = PATy->get();
479 if (!Ty->isAbstract())
481 // Traverse the type looking for abstract types. If it isn't abstract then
482 // we don't need to traverse that leg of the type.
483 std::vector<const Type*> WorkList, SeenList;
484 WorkList.push_back(Ty);
485 while (!WorkList.empty()) {
486 const Type* Ty = WorkList.back();
487 SeenList.push_back(Ty);
489 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
490 // Check to see if this is an unresolved type
491 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
492 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
493 for ( ; I != E; ++I) {
494 if (I->second.get() == OpTy)
497 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
498 const Type* TheTy = SeqTy->getElementType();
499 if (TheTy->isAbstract() && TheTy != Ty) {
500 std::vector<const Type*>::iterator I = SeenList.begin(),
506 WorkList.push_back(TheTy);
508 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
509 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
510 const Type* TheTy = StrTy->getElementType(i);
511 if (TheTy->isAbstract() && TheTy != Ty) {
512 std::vector<const Type*>::iterator I = SeenList.begin(),
518 WorkList.push_back(TheTy);
527 static struct PerFunctionInfo {
528 Function *CurrentFunction; // Pointer to current function being created
530 ValueList Values; // Keep track of #'d definitions
532 ValueList LateResolveValues;
533 bool isDeclare; // Is this function a forward declararation?
534 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
535 GlobalValue::VisibilityTypes Visibility;
537 /// BBForwardRefs - When we see forward references to basic blocks, keep
538 /// track of them here.
539 std::map<ValID, BasicBlock*> BBForwardRefs;
541 inline PerFunctionInfo() {
544 Linkage = GlobalValue::ExternalLinkage;
545 Visibility = GlobalValue::DefaultVisibility;
548 inline void FunctionStart(Function *M) {
553 void FunctionDone() {
554 // Any forward referenced blocks left?
555 if (!BBForwardRefs.empty()) {
556 GenerateError("Undefined reference to label " +
557 BBForwardRefs.begin()->second->getName());
561 // Resolve all forward references now.
562 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
564 Values.clear(); // Clear out function local definitions
565 BBForwardRefs.clear();
568 Linkage = GlobalValue::ExternalLinkage;
569 Visibility = GlobalValue::DefaultVisibility;
571 } CurFun; // Info for the current function...
573 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
576 //===----------------------------------------------------------------------===//
577 // Code to handle definitions of all the types
578 //===----------------------------------------------------------------------===//
580 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
581 // Things that have names or are void typed don't get slot numbers
582 if (V->hasName() || (V->getType() == Type::VoidTy))
585 // In the case of function values, we have to allow for the forward reference
586 // of basic blocks, which are included in the numbering. Consequently, we keep
587 // track of the next insertion location with NextValNum. When a BB gets
588 // inserted, it could change the size of the CurFun.Values vector.
589 if (&ValueTab == &CurFun.Values) {
590 if (ValueTab.size() <= CurFun.NextValNum)
591 ValueTab.resize(CurFun.NextValNum+1);
592 ValueTab[CurFun.NextValNum++] = V;
595 // For all other lists, its okay to just tack it on the back of the vector.
596 ValueTab.push_back(V);
599 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
601 case ValID::LocalID: // Is it a numbered definition?
602 // Module constants occupy the lowest numbered slots...
603 if (D.Num < CurModule.Types.size())
604 return CurModule.Types[D.Num];
606 case ValID::LocalName: // Is it a named definition?
607 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
608 D.destroy(); // Free old strdup'd memory...
613 GenerateError("Internal parser error: Invalid symbol type reference");
617 // If we reached here, we referenced either a symbol that we don't know about
618 // or an id number that hasn't been read yet. We may be referencing something
619 // forward, so just create an entry to be resolved later and get to it...
621 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
624 if (inFunctionScope()) {
625 if (D.Type == ValID::LocalName) {
626 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
629 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
634 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
635 if (I != CurModule.LateResolveTypes.end())
638 Type *Typ = OpaqueType::get();
639 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
643 // getExistingVal - Look up the value specified by the provided type and
644 // the provided ValID. If the value exists and has already been defined, return
645 // it. Otherwise return null.
647 static Value *getExistingVal(const Type *Ty, const ValID &D) {
648 if (isa<FunctionType>(Ty)) {
649 GenerateError("Functions are not values and "
650 "must be referenced as pointers");
655 case ValID::LocalID: { // Is it a numbered definition?
656 // Check that the number is within bounds.
657 if (D.Num >= CurFun.Values.size())
659 Value *Result = CurFun.Values[D.Num];
660 if (Ty != Result->getType()) {
661 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
662 Result->getType()->getDescription() + "' does not match "
663 "expected type, '" + Ty->getDescription() + "'");
668 case ValID::GlobalID: { // Is it a numbered definition?
669 if (D.Num >= CurModule.Values.size())
671 Value *Result = CurModule.Values[D.Num];
672 if (Ty != Result->getType()) {
673 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
674 Result->getType()->getDescription() + "' does not match "
675 "expected type, '" + Ty->getDescription() + "'");
681 case ValID::LocalName: { // Is it a named definition?
682 if (!inFunctionScope())
684 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
685 Value *N = SymTab.lookup(D.Name);
688 if (N->getType() != Ty)
691 D.destroy(); // Free old strdup'd memory...
694 case ValID::GlobalName: { // Is it a named definition?
695 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
696 Value *N = SymTab.lookup(D.Name);
699 if (N->getType() != Ty)
702 D.destroy(); // Free old strdup'd memory...
706 // Check to make sure that "Ty" is an integral type, and that our
707 // value will fit into the specified type...
708 case ValID::ConstSIntVal: // Is it a constant pool reference??
709 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
710 GenerateError("Signed integral constant '" +
711 itostr(D.ConstPool64) + "' is invalid for type '" +
712 Ty->getDescription() + "'");
715 return ConstantInt::get(Ty, D.ConstPool64, true);
717 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
718 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
719 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
720 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
721 "' is invalid or out of range");
723 } else { // This is really a signed reference. Transmogrify.
724 return ConstantInt::get(Ty, D.ConstPool64, true);
727 return ConstantInt::get(Ty, D.UConstPool64);
730 case ValID::ConstFPVal: // Is it a floating point const pool reference?
731 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
732 GenerateError("FP constant invalid for type");
735 return ConstantFP::get(Ty, D.ConstPoolFP);
737 case ValID::ConstNullVal: // Is it a null value?
738 if (!isa<PointerType>(Ty)) {
739 GenerateError("Cannot create a a non pointer null");
742 return ConstantPointerNull::get(cast<PointerType>(Ty));
744 case ValID::ConstUndefVal: // Is it an undef value?
745 return UndefValue::get(Ty);
747 case ValID::ConstZeroVal: // Is it a zero value?
748 return Constant::getNullValue(Ty);
750 case ValID::ConstantVal: // Fully resolved constant?
751 if (D.ConstantValue->getType() != Ty) {
752 GenerateError("Constant expression type different from required type");
755 return D.ConstantValue;
757 case ValID::InlineAsmVal: { // Inline asm expression
758 const PointerType *PTy = dyn_cast<PointerType>(Ty);
759 const FunctionType *FTy =
760 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
761 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
762 GenerateError("Invalid type for asm constraint string");
765 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
766 D.IAD->HasSideEffects);
767 D.destroy(); // Free InlineAsmDescriptor.
771 assert(0 && "Unhandled case!");
775 assert(0 && "Unhandled case!");
779 // getVal - This function is identical to getExistingVal, except that if a
780 // value is not already defined, it "improvises" by creating a placeholder var
781 // that looks and acts just like the requested variable. When the value is
782 // defined later, all uses of the placeholder variable are replaced with the
785 static Value *getVal(const Type *Ty, const ValID &ID) {
786 if (Ty == Type::LabelTy) {
787 GenerateError("Cannot use a basic block here");
791 // See if the value has already been defined.
792 Value *V = getExistingVal(Ty, ID);
794 if (TriggerError) return 0;
796 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
797 GenerateError("Invalid use of a composite type");
801 // If we reached here, we referenced either a symbol that we don't know about
802 // or an id number that hasn't been read yet. We may be referencing something
803 // forward, so just create an entry to be resolved later and get to it...
806 case ValID::GlobalName:
807 case ValID::GlobalID: {
808 const PointerType *PTy = dyn_cast<PointerType>(Ty);
810 GenerateError("Invalid type for reference to global" );
813 const Type* ElTy = PTy->getElementType();
814 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
815 V = new Function(FTy, GlobalValue::ExternalLinkage);
817 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
821 V = new Argument(Ty);
824 // Remember where this forward reference came from. FIXME, shouldn't we try
825 // to recycle these things??
826 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
829 if (inFunctionScope())
830 InsertValue(V, CurFun.LateResolveValues);
832 InsertValue(V, CurModule.LateResolveValues);
836 /// defineBBVal - This is a definition of a new basic block with the specified
837 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
838 static BasicBlock *defineBBVal(const ValID &ID) {
839 assert(inFunctionScope() && "Can't get basic block at global scope!");
843 // First, see if this was forward referenced
845 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
846 if (BBI != CurFun.BBForwardRefs.end()) {
848 // The forward declaration could have been inserted anywhere in the
849 // function: insert it into the correct place now.
850 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
851 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
853 // We're about to erase the entry, save the key so we can clean it up.
854 ValID Tmp = BBI->first;
856 // Erase the forward ref from the map as its no longer "forward"
857 CurFun.BBForwardRefs.erase(ID);
859 // The key has been removed from the map but so we don't want to leave
860 // strdup'd memory around so destroy it too.
863 // If its a numbered definition, bump the number and set the BB value.
864 if (ID.Type == ValID::LocalID) {
865 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
873 // We haven't seen this BB before and its first mention is a definition.
874 // Just create it and return it.
875 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
876 BB = new BasicBlock(Name, CurFun.CurrentFunction);
877 if (ID.Type == ValID::LocalID) {
878 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
882 ID.destroy(); // Free strdup'd memory
886 /// getBBVal - get an existing BB value or create a forward reference for it.
888 static BasicBlock *getBBVal(const ValID &ID) {
889 assert(inFunctionScope() && "Can't get basic block at global scope!");
893 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
894 if (BBI != CurFun.BBForwardRefs.end()) {
896 } if (ID.Type == ValID::LocalName) {
897 std::string Name = ID.Name;
898 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
900 if (N->getType()->getTypeID() == Type::LabelTyID)
901 BB = cast<BasicBlock>(N);
903 GenerateError("Reference to label '" + Name + "' is actually of type '"+
904 N->getType()->getDescription() + "'");
905 } else if (ID.Type == ValID::LocalID) {
906 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
907 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
908 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
910 GenerateError("Reference to label '%" + utostr(ID.Num) +
911 "' is actually of type '"+
912 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
915 GenerateError("Illegal label reference " + ID.getName());
919 // If its already been defined, return it now.
921 ID.destroy(); // Free strdup'd memory.
925 // Otherwise, this block has not been seen before, create it.
927 if (ID.Type == ValID::LocalName)
929 BB = new BasicBlock(Name, CurFun.CurrentFunction);
931 // Insert it in the forward refs map.
932 CurFun.BBForwardRefs[ID] = BB;
938 //===----------------------------------------------------------------------===//
939 // Code to handle forward references in instructions
940 //===----------------------------------------------------------------------===//
942 // This code handles the late binding needed with statements that reference
943 // values not defined yet... for example, a forward branch, or the PHI node for
946 // This keeps a table (CurFun.LateResolveValues) of all such forward references
947 // and back patchs after we are done.
950 // ResolveDefinitions - If we could not resolve some defs at parsing
951 // time (forward branches, phi functions for loops, etc...) resolve the
955 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
956 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
957 while (!LateResolvers.empty()) {
958 Value *V = LateResolvers.back();
959 LateResolvers.pop_back();
961 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
962 CurModule.PlaceHolderInfo.find(V);
963 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
965 ValID &DID = PHI->second.first;
967 Value *TheRealValue = getExistingVal(V->getType(), DID);
971 V->replaceAllUsesWith(TheRealValue);
973 CurModule.PlaceHolderInfo.erase(PHI);
974 } else if (FutureLateResolvers) {
975 // Functions have their unresolved items forwarded to the module late
977 InsertValue(V, *FutureLateResolvers);
979 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
980 GenerateError("Reference to an invalid definition: '" +DID.getName()+
981 "' of type '" + V->getType()->getDescription() + "'",
985 GenerateError("Reference to an invalid definition: #" +
986 itostr(DID.Num) + " of type '" +
987 V->getType()->getDescription() + "'",
993 LateResolvers.clear();
996 // ResolveTypeTo - A brand new type was just declared. This means that (if
997 // name is not null) things referencing Name can be resolved. Otherwise, things
998 // refering to the number can be resolved. Do this now.
1000 static void ResolveTypeTo(char *Name, const Type *ToTy) {
1002 if (Name) D = ValID::createLocalName(Name);
1003 else D = ValID::createLocalID(CurModule.Types.size());
1005 std::map<ValID, PATypeHolder>::iterator I =
1006 CurModule.LateResolveTypes.find(D);
1007 if (I != CurModule.LateResolveTypes.end()) {
1008 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1009 CurModule.LateResolveTypes.erase(I);
1013 // setValueName - Set the specified value to the name given. The name may be
1014 // null potentially, in which case this is a noop. The string passed in is
1015 // assumed to be a malloc'd string buffer, and is free'd by this function.
1017 static void setValueName(Value *V, char *NameStr) {
1018 if (!NameStr) return;
1019 std::string Name(NameStr); // Copy string
1020 free(NameStr); // Free old string
1022 if (V->getType() == Type::VoidTy) {
1023 GenerateError("Can't assign name '" + Name+"' to value with void type");
1027 assert(inFunctionScope() && "Must be in function scope!");
1028 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1029 if (ST.lookup(Name)) {
1030 GenerateError("Redefinition of value '" + Name + "' of type '" +
1031 V->getType()->getDescription() + "'");
1039 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1040 /// this is a declaration, otherwise it is a definition.
1041 static GlobalVariable *
1042 ParseGlobalVariable(char *NameStr,
1043 GlobalValue::LinkageTypes Linkage,
1044 GlobalValue::VisibilityTypes Visibility,
1045 bool isConstantGlobal, const Type *Ty,
1046 Constant *Initializer, bool IsThreadLocal) {
1047 if (isa<FunctionType>(Ty)) {
1048 GenerateError("Cannot declare global vars of function type");
1052 const PointerType *PTy = PointerType::get(Ty);
1056 Name = NameStr; // Copy string
1057 free(NameStr); // Free old string
1060 // See if this global value was forward referenced. If so, recycle the
1063 if (!Name.empty()) {
1064 ID = ValID::createGlobalName((char*)Name.c_str());
1066 ID = ValID::createGlobalID(CurModule.Values.size());
1069 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1070 // Move the global to the end of the list, from whereever it was
1071 // previously inserted.
1072 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1073 CurModule.CurrentModule->getGlobalList().remove(GV);
1074 CurModule.CurrentModule->getGlobalList().push_back(GV);
1075 GV->setInitializer(Initializer);
1076 GV->setLinkage(Linkage);
1077 GV->setVisibility(Visibility);
1078 GV->setConstant(isConstantGlobal);
1079 GV->setThreadLocal(IsThreadLocal);
1080 InsertValue(GV, CurModule.Values);
1084 // If this global has a name
1085 if (!Name.empty()) {
1086 // if the global we're parsing has an initializer (is a definition) and
1087 // has external linkage.
1088 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1089 // If there is already a global with external linkage with this name
1090 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1091 // If we allow this GVar to get created, it will be renamed in the
1092 // symbol table because it conflicts with an existing GVar. We can't
1093 // allow redefinition of GVars whose linking indicates that their name
1094 // must stay the same. Issue the error.
1095 GenerateError("Redefinition of global variable named '" + Name +
1096 "' of type '" + Ty->getDescription() + "'");
1101 // Otherwise there is no existing GV to use, create one now.
1102 GlobalVariable *GV =
1103 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1104 CurModule.CurrentModule, IsThreadLocal);
1105 GV->setVisibility(Visibility);
1106 InsertValue(GV, CurModule.Values);
1110 // setTypeName - Set the specified type to the name given. The name may be
1111 // null potentially, in which case this is a noop. The string passed in is
1112 // assumed to be a malloc'd string buffer, and is freed by this function.
1114 // This function returns true if the type has already been defined, but is
1115 // allowed to be redefined in the specified context. If the name is a new name
1116 // for the type plane, it is inserted and false is returned.
1117 static bool setTypeName(const Type *T, char *NameStr) {
1118 assert(!inFunctionScope() && "Can't give types function-local names!");
1119 if (NameStr == 0) return false;
1121 std::string Name(NameStr); // Copy string
1122 free(NameStr); // Free old string
1124 // We don't allow assigning names to void type
1125 if (T == Type::VoidTy) {
1126 GenerateError("Can't assign name '" + Name + "' to the void type");
1130 // Set the type name, checking for conflicts as we do so.
1131 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1133 if (AlreadyExists) { // Inserting a name that is already defined???
1134 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1135 assert(Existing && "Conflict but no matching type?!");
1137 // There is only one case where this is allowed: when we are refining an
1138 // opaque type. In this case, Existing will be an opaque type.
1139 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1140 // We ARE replacing an opaque type!
1141 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1145 // Otherwise, this is an attempt to redefine a type. That's okay if
1146 // the redefinition is identical to the original. This will be so if
1147 // Existing and T point to the same Type object. In this one case we
1148 // allow the equivalent redefinition.
1149 if (Existing == T) return true; // Yes, it's equal.
1151 // Any other kind of (non-equivalent) redefinition is an error.
1152 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1153 T->getDescription() + "'");
1159 //===----------------------------------------------------------------------===//
1160 // Code for handling upreferences in type names...
1163 // TypeContains - Returns true if Ty directly contains E in it.
1165 static bool TypeContains(const Type *Ty, const Type *E) {
1166 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1167 E) != Ty->subtype_end();
1171 struct UpRefRecord {
1172 // NestingLevel - The number of nesting levels that need to be popped before
1173 // this type is resolved.
1174 unsigned NestingLevel;
1176 // LastContainedTy - This is the type at the current binding level for the
1177 // type. Every time we reduce the nesting level, this gets updated.
1178 const Type *LastContainedTy;
1180 // UpRefTy - This is the actual opaque type that the upreference is
1181 // represented with.
1182 OpaqueType *UpRefTy;
1184 UpRefRecord(unsigned NL, OpaqueType *URTy)
1185 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1189 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1190 static std::vector<UpRefRecord> UpRefs;
1192 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1193 /// called. It loops through the UpRefs vector, which is a list of the
1194 /// currently active types. For each type, if the up reference is contained in
1195 /// the newly completed type, we decrement the level count. When the level
1196 /// count reaches zero, the upreferenced type is the type that is passed in:
1197 /// thus we can complete the cycle.
1199 static PATypeHolder HandleUpRefs(const Type *ty) {
1200 // If Ty isn't abstract, or if there are no up-references in it, then there is
1201 // nothing to resolve here.
1202 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1204 PATypeHolder Ty(ty);
1205 UR_OUT("Type '" << Ty->getDescription() <<
1206 "' newly formed. Resolving upreferences.\n" <<
1207 UpRefs.size() << " upreferences active!\n");
1209 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1210 // to zero), we resolve them all together before we resolve them to Ty. At
1211 // the end of the loop, if there is anything to resolve to Ty, it will be in
1213 OpaqueType *TypeToResolve = 0;
1215 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1216 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1217 << UpRefs[i].second->getDescription() << ") = "
1218 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1219 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1220 // Decrement level of upreference
1221 unsigned Level = --UpRefs[i].NestingLevel;
1222 UpRefs[i].LastContainedTy = Ty;
1223 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1224 if (Level == 0) { // Upreference should be resolved!
1225 if (!TypeToResolve) {
1226 TypeToResolve = UpRefs[i].UpRefTy;
1228 UR_OUT(" * Resolving upreference for "
1229 << UpRefs[i].second->getDescription() << "\n";
1230 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1231 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1232 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1233 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1235 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1236 --i; // Do not skip the next element...
1241 if (TypeToResolve) {
1242 UR_OUT(" * Resolving upreference for "
1243 << UpRefs[i].second->getDescription() << "\n";
1244 std::string OldName = TypeToResolve->getDescription());
1245 TypeToResolve->refineAbstractTypeTo(Ty);
1251 //===----------------------------------------------------------------------===//
1252 // RunVMAsmParser - Define an interface to this parser
1253 //===----------------------------------------------------------------------===//
1255 static Module* RunParser(Module * M);
1257 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1260 CurFilename = Filename;
1261 return RunParser(new Module(CurFilename));
1264 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1265 set_scan_string(AsmString);
1267 CurFilename = "from_memory";
1269 return RunParser(new Module (CurFilename));
1271 return RunParser(M);
1277 /* Enabling traces. */
1282 /* Enabling verbose error messages. */
1283 #ifdef YYERROR_VERBOSE
1284 # undef YYERROR_VERBOSE
1285 # define YYERROR_VERBOSE 1
1287 # define YYERROR_VERBOSE 0
1291 #line 955 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
1293 llvm::Module *ModuleVal;
1294 llvm::Function *FunctionVal;
1295 llvm::BasicBlock *BasicBlockVal;
1296 llvm::TerminatorInst *TermInstVal;
1297 llvm::Instruction *InstVal;
1298 llvm::Constant *ConstVal;
1300 const llvm::Type *PrimType;
1301 std::list<llvm::PATypeHolder> *TypeList;
1302 llvm::PATypeHolder *TypeVal;
1303 llvm::Value *ValueVal;
1304 std::vector<llvm::Value*> *ValueList;
1305 llvm::ArgListType *ArgList;
1306 llvm::TypeWithAttrs TypeWithAttrs;
1307 llvm::TypeWithAttrsList *TypeWithAttrsList;
1308 llvm::ValueRefList *ValueRefList;
1310 // Represent the RHS of PHI node
1311 std::list<std::pair<llvm::Value*,
1312 llvm::BasicBlock*> > *PHIList;
1313 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1314 std::vector<llvm::Constant*> *ConstVector;
1316 llvm::GlobalValue::LinkageTypes Linkage;
1317 llvm::GlobalValue::VisibilityTypes Visibility;
1318 uint16_t ParamAttrs;
1319 llvm::APInt *APIntVal;
1327 char *StrVal; // This memory is strdup'd!
1328 llvm::ValID ValIDVal; // strdup'd memory maybe!
1330 llvm::Instruction::BinaryOps BinaryOpVal;
1331 llvm::Instruction::TermOps TermOpVal;
1332 llvm::Instruction::MemoryOps MemOpVal;
1333 llvm::Instruction::CastOps CastOpVal;
1334 llvm::Instruction::OtherOps OtherOpVal;
1335 llvm::ICmpInst::Predicate IPredicate;
1336 llvm::FCmpInst::Predicate FPredicate;
1338 /* Line 188 of /usr/local/share/bison/yacc.c. */
1339 #line 1340 "llvmAsmParser.tab.c"
1340 # define YYSTYPE yystype
1341 # define YYSTYPE_IS_TRIVIAL 1
1345 typedef struct yyltype
1352 # define YYLTYPE yyltype
1353 # define YYLTYPE_IS_TRIVIAL 1
1356 /* Copy the second part of user declarations. */
1359 /* Line 213 of /usr/local/share/bison/yacc.c. */
1360 #line 1361 "llvmAsmParser.tab.c"
1362 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1364 /* The parser invokes alloca or malloc; define the necessary symbols. */
1366 # if YYSTACK_USE_ALLOCA
1367 # define YYSTACK_ALLOC alloca
1369 # ifndef YYSTACK_USE_ALLOCA
1370 # if defined (alloca) || defined (_ALLOCA_H)
1371 # define YYSTACK_ALLOC alloca
1374 # define YYSTACK_ALLOC __builtin_alloca
1380 # ifdef YYSTACK_ALLOC
1381 /* Pacify GCC's `empty if-body' warning. */
1382 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1384 # if defined (__STDC__) || defined (__cplusplus)
1385 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1386 # define YYSIZE_T size_t
1388 # define YYSTACK_ALLOC malloc
1389 # define YYSTACK_FREE free
1391 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1394 #if (! defined (yyoverflow) \
1395 && (! defined (__cplusplus) \
1396 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1398 /* A type that is properly aligned for any stack member. */
1405 /* The size of the maximum gap between one aligned stack and the next. */
1406 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
1408 /* The size of an array large to enough to hold all stacks, each with
1410 # define YYSTACK_BYTES(N) \
1411 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
1414 /* Copy COUNT objects from FROM to TO. The source and destination do
1418 # define YYCOPY(To, From, Count) \
1419 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1421 # define YYCOPY(To, From, Count) \
1424 register YYSIZE_T yyi; \
1425 for (yyi = 0; yyi < (Count); yyi++) \
1426 (To)[yyi] = (From)[yyi]; \
1432 /* Relocate STACK from its old location to the new one. The
1433 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1434 elements in the stack, and YYPTR gives the new location of the
1435 stack. Advance YYPTR to a properly aligned location for the next
1437 # define YYSTACK_RELOCATE(Stack) \
1440 YYSIZE_T yynewbytes; \
1441 YYCOPY (&yyptr->Stack, Stack, yysize); \
1442 Stack = &yyptr->Stack; \
1443 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
1444 yyptr += yynewbytes / sizeof (*yyptr); \
1450 #if defined (__STDC__) || defined (__cplusplus)
1451 typedef signed char yysigned_char;
1453 typedef short yysigned_char;
1456 /* YYFINAL -- State number of the termination state. */
1460 /* YYNTOKENS -- Number of terminals. */
1461 #define YYNTOKENS 150
1462 /* YYNNTS -- Number of nonterminals. */
1464 /* YYNRULES -- Number of rules. */
1465 #define YYNRULES 296
1466 /* YYNRULES -- Number of states. */
1467 #define YYNSTATES 580
1469 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1470 #define YYUNDEFTOK 2
1471 #define YYMAXUTOK 390
1473 #define YYTRANSLATE(X) \
1474 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
1476 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1477 static const unsigned char yytranslate[] =
1479 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1483 140, 141, 138, 2, 137, 2, 2, 2, 2, 2,
1484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1485 145, 136, 146, 2, 2, 2, 2, 2, 2, 2,
1486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1488 2, 142, 139, 144, 2, 2, 2, 2, 2, 149,
1489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 143, 2, 2, 147, 2, 148, 2, 2, 2, 2,
1492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1504 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1505 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1506 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1507 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1508 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1509 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1510 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1511 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1512 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1513 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1514 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1515 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1516 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1517 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1522 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1524 static const unsigned short yyprhs[] =
1526 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1527 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1528 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1529 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1530 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1531 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1532 119, 121, 122, 125, 126, 128, 130, 132, 133, 136,
1533 138, 140, 142, 144, 146, 148, 150, 152, 153, 155,
1534 157, 158, 160, 162, 163, 165, 167, 169, 171, 172,
1535 174, 176, 177, 179, 181, 183, 185, 187, 190, 192,
1536 194, 196, 198, 199, 202, 204, 206, 208, 209, 212,
1537 213, 216, 217, 221, 224, 225, 227, 228, 232, 234,
1538 237, 239, 241, 243, 245, 247, 249, 252, 254, 257,
1539 263, 269, 275, 281, 285, 288, 294, 299, 302, 304,
1540 306, 308, 312, 314, 318, 320, 321, 323, 327, 332,
1541 336, 340, 345, 350, 354, 361, 367, 370, 373, 376,
1542 379, 382, 385, 388, 391, 394, 397, 400, 403, 410,
1543 416, 425, 432, 439, 447, 455, 462, 471, 480, 484,
1544 486, 488, 490, 492, 493, 496, 503, 505, 506, 508,
1545 511, 512, 516, 517, 521, 525, 529, 533, 534, 542,
1546 543, 552, 553, 562, 568, 571, 575, 577, 581, 585,
1547 589, 593, 595, 596, 602, 606, 608, 612, 614, 615,
1548 625, 627, 629, 634, 636, 638, 641, 645, 646, 648,
1549 650, 652, 654, 656, 658, 660, 662, 664, 668, 670,
1550 676, 678, 680, 682, 684, 686, 688, 691, 694, 697,
1551 701, 704, 705, 707, 710, 713, 717, 727, 737, 746,
1552 761, 763, 765, 772, 778, 781, 788, 796, 800, 806,
1553 807, 808, 812, 815, 817, 823, 829, 836, 843, 848,
1554 855, 860, 865, 872, 879, 882, 891, 893, 895, 896,
1555 900, 907, 911, 918, 921, 927, 935
1558 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1559 static const short yyrhs[] =
1561 194, 0, -1, 69, -1, 70, -1, 71, -1, 72,
1562 -1, 73, -1, 74, -1, 75, -1, 76, -1, 77,
1563 -1, 81, -1, 82, -1, 83, -1, 78, -1, 79,
1564 -1, 80, -1, 112, -1, 113, -1, 114, -1, 115,
1565 -1, 116, -1, 117, -1, 118, -1, 119, -1, 120,
1566 -1, 121, -1, 122, -1, 123, -1, 86, -1, 87,
1567 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1568 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1569 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1570 -1, 103, -1, 104, -1, 105, -1, 92, -1, 93,
1571 -1, 94, -1, 95, -1, 22, -1, 23, -1, 11,
1572 -1, 12, -1, 13, -1, 16, -1, 19, -1, 158,
1573 -1, -1, 158, 136, -1, -1, 17, -1, 20, -1,
1574 163, -1, -1, 161, 136, -1, 38, -1, 40, -1,
1575 39, -1, 41, -1, 43, -1, 42, -1, 44, -1,
1576 46, -1, -1, 134, -1, 135, -1, -1, 42, -1,
1577 44, -1, -1, 38, -1, 39, -1, 40, -1, 43,
1578 -1, -1, 40, -1, 38, -1, -1, 57, -1, 58,
1579 -1, 59, -1, 60, -1, 61, -1, 56, 4, -1,
1580 113, -1, 114, -1, 131, -1, 132, -1, -1, 172,
1581 171, -1, 130, -1, 133, -1, 171, -1, -1, 174,
1582 173, -1, -1, 49, 4, -1, -1, 137, 49, 4,
1583 -1, 30, 19, -1, -1, 177, -1, -1, 137, 180,
1584 179, -1, 177, -1, 49, 4, -1, 11, -1, 12,
1585 -1, 13, -1, 14, -1, 45, -1, 181, -1, 182,
1586 138, -1, 216, -1, 139, 4, -1, 182, 140, 186,
1587 141, 174, -1, 10, 140, 186, 141, 174, -1, 142,
1588 4, 143, 182, 144, -1, 145, 4, 143, 182, 146,
1589 -1, 147, 187, 148, -1, 147, 148, -1, 145, 147,
1590 187, 148, 146, -1, 145, 147, 148, 146, -1, 182,
1591 172, -1, 182, -1, 10, -1, 183, -1, 185, 137,
1592 183, -1, 185, -1, 185, 137, 35, -1, 35, -1,
1593 -1, 182, -1, 187, 137, 182, -1, 182, 142, 190,
1594 144, -1, 182, 142, 144, -1, 182, 149, 19, -1,
1595 182, 145, 190, 146, -1, 182, 147, 190, 148, -1,
1596 182, 147, 148, -1, 182, 145, 147, 190, 148, 146,
1597 -1, 182, 145, 147, 148, 146, -1, 182, 36, -1,
1598 182, 37, -1, 182, 216, -1, 182, 189, -1, 182,
1599 21, -1, 156, 3, -1, 156, 5, -1, 156, 4,
1600 -1, 156, 6, -1, 11, 22, -1, 11, 23, -1,
1601 157, 9, -1, 153, 140, 188, 34, 182, 141, -1,
1602 111, 140, 188, 227, 141, -1, 125, 140, 188, 137,
1603 188, 137, 188, 141, -1, 151, 140, 188, 137, 188,
1604 141, -1, 152, 140, 188, 137, 188, 141, -1, 84,
1605 154, 140, 188, 137, 188, 141, -1, 85, 155, 140,
1606 188, 137, 188, 141, -1, 127, 140, 188, 137, 188,
1607 141, -1, 128, 140, 188, 137, 188, 137, 188, 141,
1608 -1, 129, 140, 188, 137, 188, 137, 188, 141, -1,
1609 190, 137, 188, -1, 188, -1, 28, -1, 29, -1,
1610 33, -1, -1, 184, 216, -1, 117, 140, 193, 34,
1611 182, 141, -1, 195, -1, -1, 196, -1, 195, 196,
1612 -1, -1, 27, 197, 212, -1, -1, 26, 198, 213,
1613 -1, 54, 53, 202, -1, 160, 15, 182, -1, 160,
1614 15, 10, -1, -1, 162, 166, 192, 191, 188, 199,
1615 179, -1, -1, 162, 164, 166, 192, 191, 188, 200,
1616 179, -1, -1, 162, 165, 166, 192, 191, 182, 201,
1617 179, -1, 162, 166, 31, 169, 193, -1, 47, 203,
1618 -1, 50, 136, 204, -1, 19, -1, 48, 136, 19,
1619 -1, 62, 136, 19, -1, 142, 205, 144, -1, 205,
1620 137, 19, -1, 19, -1, -1, 206, 137, 182, 172,
1621 159, -1, 182, 172, 159, -1, 206, -1, 206, 137,
1622 35, -1, 35, -1, -1, 170, 184, 161, 140, 207,
1623 141, 174, 178, 175, -1, 24, -1, 147, -1, 168,
1624 166, 208, 209, -1, 25, -1, 148, -1, 219, 211,
1625 -1, 167, 166, 208, -1, -1, 55, -1, 3, -1,
1626 4, -1, 9, -1, 22, -1, 23, -1, 36, -1,
1627 37, -1, 21, -1, 145, 190, 146, -1, 189, -1,
1628 53, 214, 19, 137, 19, -1, 7, -1, 8, -1,
1629 158, -1, 161, -1, 216, -1, 215, -1, 182, 217,
1630 -1, 219, 220, -1, 210, 220, -1, 221, 160, 222,
1631 -1, 221, 224, -1, -1, 18, -1, 63, 218, -1,
1632 63, 10, -1, 64, 14, 217, -1, 64, 11, 217,
1633 137, 14, 217, 137, 14, 217, -1, 65, 156, 217,
1634 137, 14, 217, 142, 223, 144, -1, 65, 156, 217,
1635 137, 14, 217, 142, 144, -1, 66, 170, 184, 217,
1636 140, 226, 141, 174, 34, 14, 217, 67, 14, 217,
1637 -1, 67, -1, 68, -1, 223, 156, 215, 137, 14,
1638 217, -1, 156, 215, 137, 14, 217, -1, 160, 229,
1639 -1, 182, 142, 217, 137, 217, 144, -1, 225, 137,
1640 142, 217, 137, 217, 144, -1, 182, 217, 172, -1,
1641 226, 137, 182, 217, 172, -1, -1, -1, 227, 137,
1642 218, -1, 52, 51, -1, 51, -1, 151, 182, 217,
1643 137, 217, -1, 152, 182, 217, 137, 217, -1, 84,
1644 154, 182, 217, 137, 217, -1, 85, 155, 182, 217,
1645 137, 217, -1, 153, 218, 34, 182, -1, 125, 218,
1646 137, 218, 137, 218, -1, 126, 218, 137, 182, -1,
1647 127, 218, 137, 218, -1, 128, 218, 137, 218, 137,
1648 218, -1, 129, 218, 137, 218, 137, 218, -1, 124,
1649 225, -1, 228, 170, 184, 217, 140, 226, 141, 174,
1650 -1, 231, -1, 32, -1, -1, 106, 182, 176, -1,
1651 106, 182, 137, 11, 217, 176, -1, 107, 182, 176,
1652 -1, 107, 182, 137, 11, 217, 176, -1, 108, 218,
1653 -1, 230, 109, 182, 217, 176, -1, 230, 110, 218,
1654 137, 182, 217, 176, -1, 111, 182, 217, 227, -1
1657 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1658 static const unsigned short yyrline[] =
1660 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1661 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1662 1113, 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1117,
1663 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1664 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1665 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1141, 1141,
1666 1142, 1142, 1146, 1150, 1155, 1155, 1157, 1158, 1163, 1169,
1667 1170, 1171, 1172, 1173, 1177, 1178, 1179, 1183, 1184, 1185,
1668 1189, 1190, 1191, 1195, 1196, 1197, 1198, 1199, 1203, 1204,
1669 1205, 1208, 1208, 1209, 1210, 1211, 1212, 1213, 1221, 1222,
1670 1223, 1224, 1227, 1228, 1233, 1234, 1235, 1238, 1239, 1246,
1671 1246, 1253, 1253, 1262, 1270, 1270, 1276, 1276, 1278, 1283,
1672 1296, 1296, 1296, 1296, 1299, 1303, 1307, 1314, 1319, 1327,
1673 1357, 1388, 1393, 1405, 1415, 1419, 1429, 1436, 1443, 1450,
1674 1455, 1460, 1467, 1468, 1475, 1482, 1490, 1496, 1508, 1536,
1675 1552, 1581, 1609, 1635, 1655, 1681, 1701, 1713, 1720, 1786,
1676 1796, 1806, 1812, 1822, 1828, 1838, 1843, 1848, 1856, 1868,
1677 1890, 1898, 1904, 1915, 1920, 1925, 1931, 1937, 1946, 1950,
1678 1958, 1958, 1961, 1961, 1964, 1975, 1996, 2001, 2009, 2010,
1679 2014, 2014, 2018, 2018, 2021, 2024, 2048, 2059, 2059, 2070,
1680 2069, 2079, 2078, 2089, 2104, 2107, 2113, 2126, 2130, 2135,
1681 2137, 2142, 2147, 2156, 2166, 2177, 2181, 2190, 2199, 2204,
1682 2326, 2326, 2328, 2337, 2337, 2339, 2344, 2356, 2360, 2365,
1683 2369, 2373, 2377, 2381, 2385, 2389, 2393, 2397, 2422, 2426,
1684 2440, 2444, 2448, 2452, 2458, 2458, 2464, 2473, 2477, 2486,
1685 2495, 2504, 2508, 2513, 2517, 2521, 2526, 2536, 2555, 2564,
1686 2644, 2648, 2655, 2666, 2679, 2689, 2700, 2710, 2719, 2728,
1687 2731, 2732, 2739, 2743, 2748, 2769, 2786, 2800, 2814, 2826,
1688 2834, 2841, 2847, 2853, 2859, 2874, 2959, 2964, 2968, 2975,
1689 2982, 2990, 2997, 3005, 3013, 3027, 3044
1693 #if YYDEBUG || YYERROR_VERBOSE
1694 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1695 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1696 static const char *const yytname[] =
1698 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1699 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1700 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1701 "STRINGCONSTANT", "ATSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1702 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1703 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1704 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1705 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1706 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1707 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1708 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1709 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1710 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1711 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1712 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1713 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1714 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1715 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1716 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1717 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET",
1718 "NOUNWIND", "DEFAULT", "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('",
1719 "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1720 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1721 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1722 "OptLocalAssign", "GlobalName", "OptGlobalAssign", "GlobalAssign",
1723 "GVInternalLinkage", "GVExternalLinkage", "GVVisibilityStyle",
1724 "FunctionDeclareLinkage", "FunctionDefineLinkage", "AliasLinkage",
1725 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1726 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1727 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1728 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1729 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1730 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2",
1731 "@3", "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1732 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1733 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1734 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1735 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1736 "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList",
1737 "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0
1742 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1744 static const unsigned short yytoknum[] =
1746 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1747 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1748 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1749 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1750 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1751 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1752 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1753 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1754 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1755 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1756 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1757 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1758 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1759 385, 386, 387, 388, 389, 390, 61, 44, 42, 92,
1760 40, 41, 91, 120, 93, 60, 62, 123, 125, 99
1764 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1765 static const unsigned char yyr1[] =
1767 0, 150, 151, 151, 151, 151, 151, 151, 151, 151,
1768 151, 152, 152, 152, 152, 152, 152, 153, 153, 153,
1769 153, 153, 153, 153, 153, 153, 153, 153, 153, 154,
1770 154, 154, 154, 154, 154, 154, 154, 154, 154, 155,
1771 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
1772 155, 155, 155, 155, 155, 156, 157, 157, 158, 158,
1773 159, 159, 160, 160, 161, 161, 162, 162, 163, 164,
1774 164, 164, 164, 164, 165, 165, 165, 166, 166, 166,
1775 167, 167, 167, 168, 168, 168, 168, 168, 169, 169,
1776 169, 170, 170, 170, 170, 170, 170, 170, 171, 171,
1777 171, 171, 172, 172, 173, 173, 173, 174, 174, 175,
1778 175, 176, 176, 177, 178, 178, 179, 179, 180, 180,
1779 181, 181, 181, 181, 182, 182, 182, 182, 182, 182,
1780 182, 182, 182, 182, 182, 182, 182, 183, 184, 184,
1781 185, 185, 186, 186, 186, 186, 187, 187, 188, 188,
1782 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
1783 188, 188, 188, 188, 188, 188, 188, 188, 189, 189,
1784 189, 189, 189, 189, 189, 189, 189, 189, 190, 190,
1785 191, 191, 192, 192, 193, 193, 194, 194, 195, 195,
1786 197, 196, 198, 196, 196, 196, 196, 199, 196, 200,
1787 196, 201, 196, 196, 196, 196, 202, 203, 203, 204,
1788 205, 205, 205, 206, 206, 207, 207, 207, 207, 208,
1789 209, 209, 210, 211, 211, 212, 213, 214, 214, 215,
1790 215, 215, 215, 215, 215, 215, 215, 215, 215, 215,
1791 216, 216, 216, 216, 217, 217, 218, 219, 219, 220,
1792 221, 221, 221, 222, 222, 222, 222, 222, 222, 222,
1793 222, 222, 223, 223, 224, 225, 225, 226, 226, 226,
1794 227, 227, 228, 228, 229, 229, 229, 229, 229, 229,
1795 229, 229, 229, 229, 229, 229, 229, 230, 230, 231,
1796 231, 231, 231, 231, 231, 231, 231
1799 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1800 static const unsigned char yyr2[] =
1802 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1803 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1804 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1805 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1806 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1807 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1808 1, 0, 2, 0, 1, 1, 1, 0, 2, 1,
1809 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
1810 0, 1, 1, 0, 1, 1, 1, 1, 0, 1,
1811 1, 0, 1, 1, 1, 1, 1, 2, 1, 1,
1812 1, 1, 0, 2, 1, 1, 1, 0, 2, 0,
1813 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1814 1, 1, 1, 1, 1, 1, 2, 1, 2, 5,
1815 5, 5, 5, 3, 2, 5, 4, 2, 1, 1,
1816 1, 3, 1, 3, 1, 0, 1, 3, 4, 3,
1817 3, 4, 4, 3, 6, 5, 2, 2, 2, 2,
1818 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1819 8, 6, 6, 7, 7, 6, 8, 8, 3, 1,
1820 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
1821 0, 3, 0, 3, 3, 3, 3, 0, 7, 0,
1822 8, 0, 8, 5, 2, 3, 1, 3, 3, 3,
1823 3, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1824 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1825 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1826 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
1827 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
1828 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1829 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1830 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1834 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1835 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1836 means the default is an error. */
1837 static const unsigned short yydefact[] =
1839 67, 58, 64, 59, 65, 192, 190, 0, 0, 0,
1840 0, 0, 0, 77, 66, 0, 67, 188, 80, 83,
1841 0, 0, 204, 0, 0, 62, 0, 68, 69, 71,
1842 70, 72, 74, 73, 75, 76, 78, 79, 77, 77,
1843 183, 1, 189, 81, 82, 77, 193, 84, 85, 86,
1844 87, 77, 251, 191, 251, 0, 0, 212, 205, 206,
1845 194, 240, 241, 196, 120, 121, 122, 123, 124, 0,
1846 0, 0, 0, 242, 243, 125, 195, 127, 183, 183,
1847 88, 182, 0, 91, 91, 252, 248, 63, 223, 224,
1848 225, 247, 207, 208, 211, 0, 145, 128, 0, 0,
1849 0, 0, 134, 146, 0, 126, 145, 0, 0, 90,
1850 89, 0, 180, 181, 0, 0, 92, 93, 94, 95,
1851 96, 0, 226, 0, 288, 250, 0, 209, 144, 102,
1852 140, 142, 0, 0, 0, 0, 0, 0, 133, 0,
1853 0, 0, 139, 0, 138, 0, 203, 120, 121, 122,
1854 0, 0, 0, 197, 97, 0, 220, 221, 222, 287,
1855 273, 0, 0, 0, 0, 91, 260, 261, 2, 3,
1856 4, 5, 6, 7, 8, 9, 10, 14, 15, 16,
1857 11, 12, 13, 0, 0, 0, 0, 0, 0, 17,
1858 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1859 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1860 249, 91, 264, 0, 286, 210, 137, 0, 107, 0,
1861 0, 136, 0, 147, 107, 199, 201, 0, 184, 165,
1862 166, 161, 163, 162, 164, 167, 160, 156, 157, 0,
1863 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1864 0, 0, 0, 159, 158, 116, 0, 272, 254, 0,
1865 253, 0, 0, 55, 0, 0, 29, 30, 31, 32,
1866 33, 34, 35, 36, 37, 38, 0, 53, 54, 49,
1867 50, 51, 52, 39, 40, 41, 42, 43, 44, 45,
1868 46, 47, 48, 0, 111, 111, 293, 0, 0, 284,
1869 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1870 0, 98, 99, 100, 101, 103, 143, 141, 130, 131,
1871 132, 135, 129, 116, 116, 0, 0, 0, 0, 0,
1872 0, 0, 0, 149, 179, 0, 0, 0, 153, 0,
1873 150, 0, 0, 0, 0, 198, 218, 229, 230, 231,
1874 236, 232, 233, 234, 235, 227, 0, 238, 245, 244,
1875 246, 0, 255, 0, 0, 0, 0, 0, 289, 0,
1876 291, 270, 0, 0, 0, 0, 0, 0, 0, 0,
1877 0, 0, 0, 0, 0, 104, 105, 106, 108, 200,
1878 202, 0, 0, 0, 270, 0, 0, 0, 0, 0,
1879 148, 134, 146, 0, 151, 152, 0, 0, 0, 0,
1880 0, 118, 116, 217, 102, 215, 0, 228, 0, 0,
1881 0, 0, 0, 0, 0, 0, 0, 0, 296, 0,
1882 0, 0, 280, 281, 0, 0, 0, 0, 278, 0,
1883 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1884 178, 155, 0, 0, 0, 0, 113, 119, 117, 61,
1885 0, 107, 0, 237, 0, 0, 269, 0, 0, 111,
1886 112, 111, 0, 0, 0, 0, 0, 0, 274, 275,
1887 269, 0, 294, 0, 185, 0, 0, 169, 0, 0,
1888 0, 0, 154, 0, 0, 0, 60, 214, 216, 102,
1889 114, 0, 0, 0, 0, 0, 276, 277, 290, 292,
1890 271, 0, 0, 279, 282, 283, 0, 111, 0, 0,
1891 0, 175, 0, 0, 171, 172, 168, 61, 115, 109,
1892 239, 0, 0, 102, 0, 107, 265, 0, 107, 295,
1893 173, 174, 0, 0, 0, 213, 0, 219, 0, 258,
1894 0, 0, 267, 0, 0, 266, 285, 170, 176, 177,
1895 110, 256, 0, 257, 0, 102, 0, 0, 0, 268,
1896 0, 0, 0, 0, 263, 0, 0, 262, 0, 259
1899 /* YYDEFGOTO[NTERM-NUM]. */
1900 static const short yydefgoto[] =
1902 -1, 250, 251, 252, 276, 293, 150, 151, 73, 497,
1903 11, 74, 13, 14, 38, 39, 40, 45, 51, 111,
1904 121, 315, 216, 388, 318, 547, 368, 411, 529, 345,
1905 412, 75, 152, 130, 145, 131, 132, 104, 334, 357,
1906 335, 114, 82, 146, 15, 16, 17, 19, 18, 255,
1907 323, 324, 60, 22, 58, 95, 415, 416, 122, 158,
1908 52, 90, 53, 46, 418, 358, 77, 360, 260, 54,
1909 86, 87, 210, 551, 125, 299, 505, 428, 211, 212,
1913 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1915 #define YYPACT_NINF -472
1916 static const short yypact[] =
1918 50, -472, -472, -472, -472, -472, -472, -20, -110, 93,
1919 -64, 160, 68, 14, -472, 185, 203, -472, 77, 199,
1920 76, 81, -472, 79, 205, -472, 1214, -472, -472, -472,
1921 -472, -472, -472, -472, -472, -472, -472, -472, 56, 56,
1922 137, -472, -472, -472, -472, 56, -472, -472, -472, -472,
1923 -472, 56, 210, -472, 2, 236, 246, 277, -472, -472,
1924 -472, -472, -472, 170, -472, -472, -472, -472, -472, 315,
1925 318, 6, 368, -472, -472, -472, 154, -472, 287, 287,
1926 255, -472, 207, 281, 281, -472, -472, 82, -472, -472,
1927 -472, -472, -472, -472, -472, -1, 1109, -472, 184, 188,
1928 685, 170, -472, 154, -49, -472, 1109, 207, 207, -472,
1929 -472, 777, -472, -472, 1230, 326, -472, -472, -472, -472,
1930 -472, 1269, -472, -7, 1471, -472, 324, -472, -472, 154,
1931 -472, 208, 206, 1312, 1312, 200, -43, 1312, -472, 213,
1932 1230, 1312, 170, 215, 154, 316, -472, 40, 339, 350,
1933 256, 352, 856, -472, -472, 86, -472, -472, -472, -472,
1934 -472, 311, 1372, 187, 356, 281, -472, -472, -472, -472,
1935 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
1936 -472, -472, -472, 394, 177, 1312, 1312, 1312, 1312, -472,
1937 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
1938 -472, 1312, 1312, 1312, 1312, 1312, 1312, 1312, 1312, 1312,
1939 -472, 281, -472, 122, -472, -472, -40, 1126, -472, 67,
1940 49, -472, 222, 154, -472, -472, 154, 777, -472, -472,
1941 -472, -472, -472, -472, -472, -472, -472, -472, -472, 394,
1942 177, 229, 232, 234, 237, 243, 1156, 1386, 898, 367,
1943 249, 251, 252, -472, -472, 257, 258, -472, 170, 606,
1944 -472, 733, 733, -472, 733, 1269, -472, -472, -472, -472,
1945 -472, -472, -472, -472, -472, -472, 1312, -472, -472, -472,
1946 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
1947 -472, -472, -472, 1312, -89, 108, -472, 606, 116, 259,
1948 260, 262, 263, 266, 267, 606, 606, 361, 1269, 1312,
1949 1312, -472, -472, -472, -472, -472, -472, -472, 41, -472,
1950 -472, -472, 41, 257, 257, 371, 268, 270, 1230, 1230,
1951 1230, 1230, 1230, -472, -472, 15, 937, -113, -472, -35,
1952 -472, 1230, 1230, 1230, 29, -472, 1170, -472, -472, -472,
1953 -472, -472, -472, -472, -472, 351, 1230, -472, -472, -472,
1954 -472, 274, -472, 275, 733, 606, 606, 12, -472, 19,
1955 -472, -472, 733, 265, 1312, 1312, 1312, 1312, 1312, 278,
1956 284, 1312, 733, 606, 285, -472, -472, -472, -472, -472,
1957 -472, 1312, 1230, 1230, -472, 286, 289, 290, 291, 1230,
1958 -472, 283, 856, -30, -472, -472, 296, 297, 403, 419,
1959 436, -472, 257, -472, 154, 305, 302, -472, 425, -8,
1960 431, 432, 308, 312, 317, 733, 449, 733, 321, 327,
1961 733, 328, 154, -472, 329, 330, 733, 733, 154, 323,
1962 332, 1312, 126, 333, 334, -57, 1230, 1230, 1230, 1230,
1963 -472, -472, 331, 1230, 1230, 1312, -472, -472, -472, 13,
1964 1200, -472, 335, -472, 733, 733, 1312, 733, 733, 332,
1965 -472, 332, 1312, 733, 336, 1312, 1312, 1312, -472, -472,
1966 1312, 426, -472, 606, -472, 1230, 1230, -472, 337, 349,
1967 355, 358, -472, 357, 359, 149, -472, -472, -472, 154,
1968 1, 457, 360, 354, 606, -2, -472, -472, -472, -472,
1969 -472, 362, 733, -472, -472, -472, 28, 332, 363, 364,
1970 1230, -472, 1230, 1230, -472, -472, -472, 13, -472, 450,
1971 -472, 487, -3, -472, 1312, -472, -472, 370, -472, -472,
1972 -472, -472, 376, 377, 378, -472, 498, -472, 733, -472,
1973 986, 3, -40, 606, 83, -472, 41, -472, -472, -472,
1974 -472, -472, 366, -472, 986, -472, 494, 497, 375, -40,
1975 733, 733, 506, 455, -472, 733, 510, -472, 733, -472
1978 /* YYPGOTO[NTERM-NUM]. */
1979 static const short yypgoto[] =
1981 -472, 401, 404, 405, 292, 294, -161, -472, 0, 8,
1982 443, 9, -472, -472, -472, -472, 44, -472, -472, -472,
1983 -147, -307, -409, -472, -220, -472, -283, 36, -472, -284,
1984 -472, -472, -25, 320, -114, -472, 433, 438, -29, -150,
1985 -226, 198, 238, 313, -472, -472, 525, -472, -472, -472,
1986 -472, -472, -472, -472, -472, -472, -472, -472, 458, -472,
1987 -472, -472, -472, -472, -472, -471, -139, 96, -168, -472,
1988 489, -472, -472, -472, -472, -472, 64, 151, -472, -472,
1992 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1993 positive, shift that token. If negative, reduce the rule which
1994 number is the opposite. If zero, do what YYDEFACT says.
1995 If YYTABLE_NINF, parse error. */
1996 #define YYTABLE_NINF -188
1997 static const short yytable[] =
1999 10, 76, 253, 264, 322, 459, 228, 155, 263, 12,
2000 99, 387, 370, 254, 263, 387, 10, 156, 265, 296,
2001 85, 337, 339, 425, 399, 12, 23, 88, 20, 1,
2002 427, 409, 3, 404, 300, 301, 302, 303, 304, 389,
2003 390, 307, 21, -55, -55, -55, -55, 103, 367, 105,
2004 -187, 106, 28, 29, 30, 31, 32, 33, 34, 409,
2005 35, 426, 229, 230, 308, -63, 1, 2, 426, 3,
2006 4, 129, 25, 311, 312, 103, 5, 6, 410, 562,
2007 472, 129, 78, 79, 487, 153, 144, 10, 137, 83,
2008 527, 313, 314, 568, 137, 84, 144, 7, 1, 138,
2009 8, 3, 399, 2, 9, 222, 4, 399, 219, 220,
2010 403, 225, 223, 405, 311, 312, 226, 566, 452, 43,
2011 359, 44, 359, 359, 552, 359, 311, 312, 458, 399,
2012 419, 385, 313, 314, 386, 534, 126, 259, 463, 535,
2013 157, 549, 384, 127, 313, 314, 24, 563, 36, 37,
2014 89, 364, 399, 100, 311, 312, 569, 482, 359, 400,
2015 294, 295, 259, 297, 256, 534, 359, 359, 80, 538,
2016 81, 385, 313, 314, 386, 26, 298, 259, 259, 259,
2017 259, 259, 305, 306, 259, 41, 508, 105, 509, 106,
2018 36, 37, 129, 387, 382, 320, 311, 312, 261, 277,
2019 278, 262, 144, -186, 27, 105, 431, 106, 433, 434,
2020 435, 319, 55, 385, 313, 314, 386, 56, -63, 1,
2021 2, 57, 3, 4, 59, 359, 359, 359, 85, 5,
2022 6, 309, 310, 359, 539, 112, 113, 47, 48, 49,
2023 144, 500, 50, 359, 359, 369, 105, 387, 106, 387,
2024 7, 365, 253, 8, 105, 92, 106, 9, 372, 231,
2025 232, 233, 234, 254, 105, 93, 106, 484, 366, 279,
2026 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
2027 290, 291, 292, 144, 383, 259, 359, 105, 359, 106,
2028 526, 359, 105, 109, 106, 110, 94, 359, 359, 394,
2029 395, 396, 397, 398, 510, 140, 141, 513, 514, 515,
2030 96, 402, 406, 407, 408, 554, 107, 108, 556, 97,
2031 81, 414, 98, 61, 62, 359, 359, 133, 359, 359,
2032 154, 134, 1, 2, 359, 3, 4, 115, 116, 117,
2033 118, 119, 120, 215, 359, 217, 221, 218, -56, 259,
2034 432, 259, 259, 259, 224, 227, 438, 361, 362, -57,
2035 363, 235, 257, 443, 444, 359, 442, 263, 321, 328,
2036 450, 550, 329, 359, 330, 61, 62, 331, 101, 64,
2037 65, 66, 67, 332, 1, 2, 340, 3, 4, 341,
2038 564, 342, 343, 371, 344, 381, 373, 374, 346, 375,
2039 376, 379, 380, 377, 378, 391, 417, 430, 392, 359,
2040 393, 420, 421, 68, 359, 436, 483, 488, 489, 490,
2041 491, 437, 441, 446, 493, 494, 447, 448, 449, 451,
2042 495, 359, 359, 453, 454, 499, 359, 455, 456, 359,
2043 457, 504, 460, 461, 462, 464, 465, 259, 466, 467,
2044 259, 259, 259, 470, 468, 504, 518, 519, 472, 496,
2045 422, 423, 424, 480, 473, 475, 476, 477, 429, 481,
2046 485, 486, 501, 512, 520, 426, 530, 492, 439, 440,
2047 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
2048 521, 542, 522, 543, 544, 523, 532, 531, 524, 546,
2049 525, 548, 560, 567, 540, 541, 536, 69, 570, 553,
2050 70, 571, 572, 71, 555, 72, 102, 557, 558, 559,
2051 575, 469, 576, 471, 578, 207, 474, 496, 208, 209,
2052 124, 326, 478, 479, 327, 545, 528, 317, 136, 139,
2053 325, 42, 123, 91, 516, 445, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2055 502, 503, 0, 506, 507, 0, 0, 0, 0, 511,
2056 0, 0, 0, 0, 0, 0, 0, 0, 0, 517,
2057 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2058 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2059 533, 0, 0, 0, 0, 0, 0, 0, 537, 347,
2060 348, 0, 0, 61, 62, 349, 0, 0, 0, 0,
2061 0, 0, 1, 2, 0, 3, 4, 350, 351, 352,
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2063 0, 0, 353, 354, 561, 0, 0, 0, 0, 565,
2064 0, 0, 0, 0, 0, 0, 0, 0, 0, 355,
2065 0, 0, 0, 0, 0, 0, 573, 574, 0, 0,
2066 0, 577, 0, 0, 579, 168, 169, 170, 171, 172,
2067 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2068 239, 240, 61, 62, 0, 101, 64, 65, 66, 67,
2069 0, 1, 2, 0, 3, 4, 0, 0, 0, 0,
2070 0, 0, 0, 0, 0, 0, 0, 241, 189, 190,
2071 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2072 68, 242, 0, 243, 244, 245, 347, 348, 0, 0,
2073 61, 62, 349, 0, 105, 0, 106, 0, 0, 1,
2074 2, 356, 3, 4, 350, 351, 352, 0, 0, 0,
2075 0, 0, 0, 0, 0, 0, 0, 0, 0, 353,
2076 354, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2077 0, 0, 0, 0, 61, 62, 355, 142, 64, 65,
2078 66, 67, 0, 1, 2, 0, 3, 4, 0, 0,
2079 0, 0, 168, 169, 170, 171, 172, 173, 174, 175,
2080 176, 177, 178, 179, 180, 181, 182, 239, 240, 0,
2081 0, 0, 68, 0, 69, 0, 0, 70, 0, 0,
2082 71, 0, 72, 135, 0, 0, 0, 0, 0, 0,
2083 0, 0, 0, 0, 241, 189, 190, 191, 192, 193,
2084 194, 195, 196, 197, 198, 199, 200, 0, 242, 0,
2085 243, 244, 245, 61, 62, 0, 0, 0, 0, 0,
2086 0, 0, 1, 2, 0, 3, 4, 236, 356, 0,
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2088 0, 0, 237, 238, 143, 0, 0, 0, 0, 0,
2089 0, 0, 0, 0, 0, 61, 62, 0, 101, 147,
2090 148, 149, 67, 0, 1, 2, 69, 3, 4, 70,
2091 0, 0, 71, 0, 72, 168, 169, 170, 171, 172,
2092 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2093 239, 240, 0, 68, 61, 62, 0, 101, 147, 148,
2094 149, 67, 0, 1, 2, 0, 3, 4, 0, 0,
2095 0, 0, 0, 0, 0, 0, 0, 241, 189, 190,
2096 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2097 0, 242, 68, 243, 244, 245, 0, 0, 0, 347,
2098 348, 0, 0, 0, 105, 349, 106, 0, 246, 0,
2099 0, 247, 0, 248, 0, 249, 0, 350, 351, 352,
2100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2101 0, 0, 353, 354, 0, 0, 0, 0, 0, 0,
2102 0, 0, 0, 0, 0, 0, 0, 69, 0, 355,
2103 70, 0, 0, 71, 0, 72, 338, 0, 0, 0,
2104 0, 0, 0, 0, 0, 168, 169, 170, 171, 172,
2105 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2106 239, 240, 0, 0, 0, 0, 69, 0, 0, 70,
2107 0, 0, 71, 0, 72, 401, 0, 0, 0, 0,
2108 0, 0, 0, 0, 0, 0, 0, 241, 189, 190,
2109 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2110 0, 242, 0, 243, 244, 245, 61, 62, 0, 101,
2111 64, 65, 66, 67, 0, 1, 2, 0, 3, 4,
2112 0, 356, 0, 61, 62, 0, 101, 64, 65, 66,
2113 67, 0, 1, 2, 128, 3, 4, 0, 0, 0,
2114 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
2115 0, 316, 0, 61, 62, 0, 101, 147, 148, 149,
2116 67, 68, 1, 2, 0, 3, 4, 61, 62, 0,
2117 101, 64, 65, 66, 67, 0, 1, 2, 0, 3,
2118 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 68, 0, 0, 0, 413, 0, 61, 62, 0,
2120 101, 64, 65, 66, 67, 68, 1, 2, 0, 3,
2121 4, 61, 62, 0, 63, 64, 65, 66, 67, 0,
2122 1, 2, 0, 3, 4, 498, 0, 61, 62, 0,
2123 101, 147, 148, 149, 67, 68, 1, 2, 69, 3,
2124 4, 70, 0, 0, 71, 0, 72, 0, 0, 68,
2125 0, 0, 0, 0, 0, 69, 0, 0, 70, 0,
2126 0, 71, 0, 72, 0, 68, 61, 62, 0, 142,
2127 64, 65, 66, 67, 0, 1, 2, 0, 3, 4,
2128 0, 0, 0, 0, 0, 69, 0, 0, 70, 0,
2129 333, 71, 0, 72, 0, 0, 0, 0, 0, 69,
2130 0, 0, 70, 0, 68, 71, 0, 72, 0, 61,
2131 62, 0, 101, 64, 65, 66, 67, 0, 1, 2,
2132 0, 3, 4, 0, 0, 0, 0, 0, 0, 69,
2133 0, 0, 70, 0, 0, 71, 0, 72, 0, 0,
2134 0, 0, 0, 69, 0, 0, 70, 68, 0, 71,
2135 0, 72, 0, 0, 0, 0, 0, 0, 0, 69,
2136 0, 0, 70, 0, 0, 71, 0, 72, 0, 61,
2137 62, 0, 258, 64, 65, 66, 67, 0, 1, 2,
2138 0, 3, 4, 61, 62, 0, 101, 147, 148, 149,
2139 67, 0, 1, 2, 0, 3, 4, 0, 69, 0,
2140 0, 70, 0, 0, 71, 0, 72, 68, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 0, 68, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 0, 69, 0, 0, 70, 0, 0, 71, 0, 72,
2145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 0, 0, 0, 159, 0, 0, 0, 0, 0, 0,
2150 0, 69, 0, 0, 70, 0, 0, 71, 0, 72,
2151 0, 0, 160, 161, 0, 69, 0, 0, 70, 0,
2152 0, 71, 0, 336, 162, 163, 164, 165, 166, 167,
2153 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2154 178, 179, 180, 181, 182, 183, 184, 0, 0, 0,
2155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2156 0, 0, 0, 0, 0, 0, 0, 185, 186, 187,
2157 0, 0, 188, 189, 190, 191, 192, 193, 194, 195,
2158 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2162 static const short yycheck[] =
2164 0, 26, 152, 164, 224, 414, 145, 121, 11, 0,
2165 4, 318, 295, 152, 11, 322, 16, 24, 165, 187,
2166 18, 247, 248, 11, 137, 16, 136, 25, 48, 16,
2167 11, 30, 19, 146, 202, 203, 204, 205, 206, 323,
2168 324, 209, 62, 3, 4, 5, 6, 72, 137, 138,
2169 0, 140, 38, 39, 40, 41, 42, 43, 44, 30,
2170 46, 49, 22, 23, 211, 15, 16, 17, 49, 19,
2171 20, 96, 136, 113, 114, 100, 26, 27, 49, 550,
2172 137, 106, 38, 39, 141, 114, 111, 87, 137, 45,
2173 499, 131, 132, 564, 137, 51, 121, 47, 16, 148,
2174 50, 19, 137, 17, 54, 148, 20, 137, 133, 134,
2175 336, 140, 137, 148, 113, 114, 141, 34, 148, 42,
2176 259, 44, 261, 262, 533, 264, 113, 114, 412, 137,
2177 356, 130, 131, 132, 133, 137, 137, 162, 146, 141,
2178 147, 144, 310, 144, 131, 132, 53, 144, 134, 135,
2179 148, 265, 137, 147, 113, 114, 565, 440, 297, 144,
2180 185, 186, 187, 188, 155, 137, 305, 306, 31, 141,
2181 33, 130, 131, 132, 133, 15, 201, 202, 203, 204,
2182 205, 206, 207, 208, 209, 0, 469, 138, 471, 140,
2183 134, 135, 217, 500, 308, 146, 113, 114, 11, 22,
2184 23, 14, 227, 0, 136, 138, 374, 140, 376, 377,
2185 378, 144, 136, 130, 131, 132, 133, 136, 15, 16,
2186 17, 142, 19, 20, 19, 364, 365, 366, 18, 26,
2187 27, 109, 110, 372, 517, 28, 29, 38, 39, 40,
2188 265, 461, 43, 382, 383, 137, 138, 554, 140, 556,
2189 47, 276, 402, 50, 138, 19, 140, 54, 142, 3,
2190 4, 5, 6, 402, 138, 19, 140, 141, 293, 92,
2191 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2192 103, 104, 105, 308, 309, 310, 425, 138, 427, 140,
2193 141, 430, 138, 38, 140, 40, 19, 436, 437, 328,
2194 329, 330, 331, 332, 472, 107, 108, 475, 476, 477,
2195 140, 336, 341, 342, 343, 535, 78, 79, 538, 4,
2196 33, 346, 4, 7, 8, 464, 465, 143, 467, 468,
2197 4, 143, 16, 17, 473, 19, 20, 56, 57, 58,
2198 59, 60, 61, 19, 483, 137, 146, 141, 9, 374,
2199 375, 376, 377, 378, 141, 140, 381, 261, 262, 9,
2200 264, 9, 51, 392, 393, 504, 391, 11, 146, 140,
2201 399, 532, 140, 512, 140, 7, 8, 140, 10, 11,
2202 12, 13, 14, 140, 16, 17, 19, 19, 20, 140,
2203 551, 140, 140, 297, 137, 34, 137, 137, 140, 137,
2204 137, 305, 306, 137, 137, 34, 55, 142, 140, 548,
2205 140, 137, 137, 45, 553, 137, 441, 446, 447, 448,
2206 449, 137, 137, 137, 453, 454, 137, 137, 137, 146,
2207 455, 570, 571, 137, 137, 460, 575, 34, 19, 578,
2208 4, 466, 137, 141, 19, 14, 14, 472, 140, 137,
2209 475, 476, 477, 4, 137, 480, 485, 486, 137, 459,
2210 364, 365, 366, 140, 137, 137, 137, 137, 372, 137,
2211 137, 137, 137, 137, 137, 49, 19, 146, 382, 383,
2212 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2213 141, 520, 137, 522, 523, 137, 142, 137, 141, 49,
2214 141, 14, 4, 137, 141, 141, 144, 139, 14, 534,
2215 142, 14, 137, 145, 144, 147, 148, 141, 141, 141,
2216 14, 425, 67, 427, 14, 124, 430, 527, 124, 124,
2217 87, 239, 436, 437, 240, 527, 500, 217, 100, 106,
2218 227, 16, 84, 54, 480, 394, -1, -1, -1, -1,
2219 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2220 464, 465, -1, 467, 468, -1, -1, -1, -1, 473,
2221 -1, -1, -1, -1, -1, -1, -1, -1, -1, 483,
2222 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2223 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2224 504, -1, -1, -1, -1, -1, -1, -1, 512, 3,
2225 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
2226 -1, -1, 16, 17, -1, 19, 20, 21, 22, 23,
2227 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2228 -1, -1, 36, 37, 548, -1, -1, -1, -1, 553,
2229 -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
2230 -1, -1, -1, -1, -1, -1, 570, 571, -1, -1,
2231 -1, 575, -1, -1, 578, 69, 70, 71, 72, 73,
2232 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2233 84, 85, 7, 8, -1, 10, 11, 12, 13, 14,
2234 -1, 16, 17, -1, 19, 20, -1, -1, -1, -1,
2235 -1, -1, -1, -1, -1, -1, -1, 111, 112, 113,
2236 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2237 45, 125, -1, 127, 128, 129, 3, 4, -1, -1,
2238 7, 8, 9, -1, 138, -1, 140, -1, -1, 16,
2239 17, 145, 19, 20, 21, 22, 23, -1, -1, -1,
2240 -1, -1, -1, -1, -1, -1, -1, -1, -1, 36,
2241 37, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2242 -1, -1, -1, -1, 7, 8, 53, 10, 11, 12,
2243 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2244 -1, -1, 69, 70, 71, 72, 73, 74, 75, 76,
2245 77, 78, 79, 80, 81, 82, 83, 84, 85, -1,
2246 -1, -1, 45, -1, 139, -1, -1, 142, -1, -1,
2247 145, -1, 147, 148, -1, -1, -1, -1, -1, -1,
2248 -1, -1, -1, -1, 111, 112, 113, 114, 115, 116,
2249 117, 118, 119, 120, 121, 122, 123, -1, 125, -1,
2250 127, 128, 129, 7, 8, -1, -1, -1, -1, -1,
2251 -1, -1, 16, 17, -1, 19, 20, 21, 145, -1,
2252 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2253 -1, -1, 36, 37, 117, -1, -1, -1, -1, -1,
2254 -1, -1, -1, -1, -1, 7, 8, -1, 10, 11,
2255 12, 13, 14, -1, 16, 17, 139, 19, 20, 142,
2256 -1, -1, 145, -1, 147, 69, 70, 71, 72, 73,
2257 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2258 84, 85, -1, 45, 7, 8, -1, 10, 11, 12,
2259 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2260 -1, -1, -1, -1, -1, -1, -1, 111, 112, 113,
2261 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2262 -1, 125, 45, 127, 128, 129, -1, -1, -1, 3,
2263 4, -1, -1, -1, 138, 9, 140, -1, 142, -1,
2264 -1, 145, -1, 147, -1, 149, -1, 21, 22, 23,
2265 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2266 -1, -1, 36, 37, -1, -1, -1, -1, -1, -1,
2267 -1, -1, -1, -1, -1, -1, -1, 139, -1, 53,
2268 142, -1, -1, 145, -1, 147, 148, -1, -1, -1,
2269 -1, -1, -1, -1, -1, 69, 70, 71, 72, 73,
2270 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2271 84, 85, -1, -1, -1, -1, 139, -1, -1, 142,
2272 -1, -1, 145, -1, 147, 148, -1, -1, -1, -1,
2273 -1, -1, -1, -1, -1, -1, -1, 111, 112, 113,
2274 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2275 -1, 125, -1, 127, 128, 129, 7, 8, -1, 10,
2276 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2277 -1, 145, -1, 7, 8, -1, 10, 11, 12, 13,
2278 14, -1, 16, 17, 35, 19, 20, -1, -1, -1,
2279 -1, -1, -1, -1, 45, -1, -1, -1, -1, -1,
2280 -1, 35, -1, 7, 8, -1, 10, 11, 12, 13,
2281 14, 45, 16, 17, -1, 19, 20, 7, 8, -1,
2282 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2283 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2284 -1, 45, -1, -1, -1, 35, -1, 7, 8, -1,
2285 10, 11, 12, 13, 14, 45, 16, 17, -1, 19,
2286 20, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2287 16, 17, -1, 19, 20, 35, -1, 7, 8, -1,
2288 10, 11, 12, 13, 14, 45, 16, 17, 139, 19,
2289 20, 142, -1, -1, 145, -1, 147, -1, -1, 45,
2290 -1, -1, -1, -1, -1, 139, -1, -1, 142, -1,
2291 -1, 145, -1, 147, -1, 45, 7, 8, -1, 10,
2292 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2293 -1, -1, -1, -1, -1, 139, -1, -1, 142, -1,
2294 144, 145, -1, 147, -1, -1, -1, -1, -1, 139,
2295 -1, -1, 142, -1, 45, 145, -1, 147, -1, 7,
2296 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2297 -1, 19, 20, -1, -1, -1, -1, -1, -1, 139,
2298 -1, -1, 142, -1, -1, 145, -1, 147, -1, -1,
2299 -1, -1, -1, 139, -1, -1, 142, 45, -1, 145,
2300 -1, 147, -1, -1, -1, -1, -1, -1, -1, 139,
2301 -1, -1, 142, -1, -1, 145, -1, 147, -1, 7,
2302 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2303 -1, 19, 20, 7, 8, -1, 10, 11, 12, 13,
2304 14, -1, 16, 17, -1, 19, 20, -1, 139, -1,
2305 -1, 142, -1, -1, 145, -1, 147, 45, -1, -1,
2306 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2307 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1,
2308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2309 -1, 139, -1, -1, 142, -1, -1, 145, -1, 147,
2310 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2311 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2313 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2314 -1, -1, -1, 32, -1, -1, -1, -1, -1, -1,
2315 -1, 139, -1, -1, 142, -1, -1, 145, -1, 147,
2316 -1, -1, 51, 52, -1, 139, -1, -1, 142, -1,
2317 -1, 145, -1, 147, 63, 64, 65, 66, 67, 68,
2318 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2319 79, 80, 81, 82, 83, 84, 85, -1, -1, -1,
2320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2321 -1, -1, -1, -1, -1, -1, -1, 106, 107, 108,
2322 -1, -1, 111, 112, 113, 114, 115, 116, 117, 118,
2323 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2327 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2328 symbol of state STATE-NUM. */
2329 static const unsigned char yystos[] =
2331 0, 16, 17, 19, 20, 26, 27, 47, 50, 54,
2332 158, 160, 161, 162, 163, 194, 195, 196, 198, 197,
2333 48, 62, 203, 136, 53, 136, 15, 136, 38, 39,
2334 40, 41, 42, 43, 44, 46, 134, 135, 164, 165,
2335 166, 0, 196, 42, 44, 167, 213, 38, 39, 40,
2336 43, 168, 210, 212, 219, 136, 136, 142, 204, 19,
2337 202, 7, 8, 10, 11, 12, 13, 14, 45, 139,
2338 142, 145, 147, 158, 161, 181, 182, 216, 166, 166,
2339 31, 33, 192, 166, 166, 18, 220, 221, 25, 148,
2340 211, 220, 19, 19, 19, 205, 140, 4, 4, 4,
2341 147, 10, 148, 182, 187, 138, 140, 192, 192, 38,
2342 40, 169, 28, 29, 191, 56, 57, 58, 59, 60,
2343 61, 170, 208, 208, 160, 224, 137, 144, 35, 182,
2344 183, 185, 186, 143, 143, 148, 187, 137, 148, 186,
2345 191, 191, 10, 117, 182, 184, 193, 11, 12, 13,
2346 156, 157, 182, 188, 4, 184, 24, 147, 209, 32,
2347 51, 52, 63, 64, 65, 66, 67, 68, 69, 70,
2348 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2349 81, 82, 83, 84, 85, 106, 107, 108, 111, 112,
2350 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2351 123, 124, 125, 126, 127, 128, 129, 151, 152, 153,
2352 222, 228, 229, 230, 231, 19, 172, 137, 141, 182,
2353 182, 146, 148, 182, 141, 188, 182, 140, 216, 22,
2354 23, 3, 4, 5, 6, 9, 21, 36, 37, 84,
2355 85, 111, 125, 127, 128, 129, 142, 145, 147, 149,
2356 151, 152, 153, 189, 216, 199, 161, 51, 10, 182,
2357 218, 11, 14, 11, 156, 170, 86, 87, 88, 89,
2358 90, 91, 92, 93, 94, 95, 154, 22, 23, 92,
2359 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2360 103, 104, 105, 155, 182, 182, 218, 182, 182, 225,
2361 218, 218, 218, 218, 218, 182, 182, 218, 170, 109,
2362 110, 113, 114, 131, 132, 171, 35, 183, 174, 144,
2363 146, 146, 174, 200, 201, 193, 154, 155, 140, 140,
2364 140, 140, 140, 144, 188, 190, 147, 190, 148, 190,
2365 19, 140, 140, 140, 137, 179, 140, 3, 4, 9,
2366 21, 22, 23, 36, 37, 53, 145, 189, 215, 216,
2367 217, 217, 217, 217, 184, 182, 182, 137, 176, 137,
2368 176, 217, 142, 137, 137, 137, 137, 137, 137, 217,
2369 217, 34, 184, 182, 218, 130, 133, 171, 173, 179,
2370 179, 34, 140, 140, 188, 188, 188, 188, 188, 137,
2371 144, 148, 182, 190, 146, 148, 188, 188, 188, 30,
2372 49, 177, 180, 35, 182, 206, 207, 55, 214, 190,
2373 137, 137, 217, 217, 217, 11, 49, 11, 227, 217,
2374 142, 218, 182, 218, 218, 218, 137, 137, 182, 217,
2375 217, 137, 182, 188, 188, 227, 137, 137, 137, 137,
2376 188, 146, 148, 137, 137, 34, 19, 4, 179, 172,
2377 137, 141, 19, 146, 14, 14, 140, 137, 137, 217,
2378 4, 217, 137, 137, 217, 137, 137, 137, 217, 217,
2379 140, 137, 176, 182, 141, 137, 137, 141, 188, 188,
2380 188, 188, 146, 188, 188, 182, 158, 159, 35, 182,
2381 174, 137, 217, 217, 182, 226, 217, 217, 176, 176,
2382 218, 217, 137, 218, 218, 218, 226, 217, 188, 188,
2383 137, 141, 137, 137, 141, 141, 141, 172, 177, 178,
2384 19, 137, 142, 217, 137, 141, 144, 217, 141, 176,
2385 141, 141, 188, 188, 188, 159, 49, 175, 14, 144,
2386 156, 223, 172, 182, 174, 144, 174, 141, 141, 141,
2387 4, 217, 215, 144, 156, 217, 34, 137, 215, 172,
2388 14, 14, 137, 217, 217, 14, 67, 217, 14, 217
2391 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2392 # define YYSIZE_T __SIZE_TYPE__
2394 #if ! defined (YYSIZE_T) && defined (size_t)
2395 # define YYSIZE_T size_t
2397 #if ! defined (YYSIZE_T)
2398 # if defined (__STDC__) || defined (__cplusplus)
2399 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2400 # define YYSIZE_T size_t
2403 #if ! defined (YYSIZE_T)
2404 # define YYSIZE_T unsigned int
2407 #define yyerrok (yyerrstatus = 0)
2408 #define yyclearin (yychar = YYEMPTY)
2412 #define YYACCEPT goto yyacceptlab
2413 #define YYABORT goto yyabortlab
2414 #define YYERROR goto yyerrlab1
2416 /* Like YYERROR except do call yyerror. This remains here temporarily
2417 to ease the transition to the new meaning of YYERROR, for GCC.
2418 Once GCC version 2 has supplanted version 1, this can go. */
2420 #define YYFAIL goto yyerrlab
2422 #define YYRECOVERING() (!!yyerrstatus)
2424 #define YYBACKUP(Token, Value) \
2426 if (yychar == YYEMPTY && yylen == 1) \
2430 yychar1 = YYTRANSLATE (yychar); \
2436 yyerror ("syntax error: cannot back up"); \
2442 #define YYERRCODE 256
2444 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
2447 #ifndef YYLLOC_DEFAULT
2448 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2449 Current.first_line = Rhs[1].first_line; \
2450 Current.first_column = Rhs[1].first_column; \
2451 Current.last_line = Rhs[N].last_line; \
2452 Current.last_column = Rhs[N].last_column;
2455 /* YYLEX -- calling `yylex' with the right arguments. */
2457 #define YYLEX yylex ()
2459 /* Enable debugging if requested. */
2463 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2464 # define YYFPRINTF fprintf
2467 # define YYDPRINTF(Args) \
2472 # define YYDSYMPRINT(Args) \
2477 /* Nonzero means print parse trace. It is left uninitialized so that
2478 multiple parsers can coexist. */
2480 #else /* !YYDEBUG */
2481 # define YYDPRINTF(Args)
2482 # define YYDSYMPRINT(Args)
2483 #endif /* !YYDEBUG */
2485 /* YYINITDEPTH -- initial size of the parser's stacks. */
2487 # define YYINITDEPTH 200
2490 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2491 if the built-in stack extension method is used).
2493 Do not make this value too large; the results are undefined if
2494 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
2495 evaluated with infinite-precision integer arithmetic. */
2502 # define YYMAXDEPTH 10000
2510 # if defined (__GLIBC__) && defined (_STRING_H)
2511 # define yystrlen strlen
2513 /* Return the length of YYSTR. */
2515 # if defined (__STDC__) || defined (__cplusplus)
2516 yystrlen (const char *yystr)
2522 register const char *yys = yystr;
2524 while (*yys++ != '\0')
2527 return yys - yystr - 1;
2533 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2534 # define yystpcpy stpcpy
2536 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2539 # if defined (__STDC__) || defined (__cplusplus)
2540 yystpcpy (char *yydest, const char *yysrc)
2542 yystpcpy (yydest, yysrc)
2547 register char *yyd = yydest;
2548 register const char *yys = yysrc;
2550 while ((*yyd++ = *yys++) != '\0')
2558 #endif /* !YYERROR_VERBOSE */
2563 /*-----------------------------.
2564 | Print this symbol on YYOUT. |
2565 `-----------------------------*/
2568 #if defined (__STDC__) || defined (__cplusplus)
2569 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
2571 yysymprint (yyout, yytype, yyvalue)
2577 /* Pacify ``unused variable'' warnings. */
2580 if (yytype < YYNTOKENS)
2582 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
2584 YYPRINT (yyout, yytoknum[yytype], yyvalue);
2588 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
2595 YYFPRINTF (yyout, ")");
2597 #endif /* YYDEBUG. */
2600 /*-----------------------------------------------.
2601 | Release the memory associated to this symbol. |
2602 `-----------------------------------------------*/
2605 #if defined (__STDC__) || defined (__cplusplus)
2606 yydestruct (int yytype, YYSTYPE yyvalue)
2608 yydestruct (yytype, yyvalue)
2613 /* Pacify ``unused variable'' warnings. */
2625 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2626 into yyparse. The argument should have type void *.
2627 It should actually point to an object.
2628 Grammar actions can access the variable by casting it
2629 to the proper pointer type. */
2631 #ifdef YYPARSE_PARAM
2632 # if defined (__STDC__) || defined (__cplusplus)
2633 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2634 # define YYPARSE_PARAM_DECL
2636 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
2637 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2639 #else /* !YYPARSE_PARAM */
2640 # define YYPARSE_PARAM_ARG
2641 # define YYPARSE_PARAM_DECL
2642 #endif /* !YYPARSE_PARAM */
2644 /* Prevent warning if -Wstrict-prototypes. */
2646 # ifdef YYPARSE_PARAM
2647 int yyparse (void *);
2654 /* The lookahead symbol. */
2657 /* The semantic value of the lookahead symbol. */
2660 /* Number of parse errors so far. */
2665 yyparse (YYPARSE_PARAM_ARG)
2669 register int yystate;
2672 /* Number of tokens to shift before error messages enabled. */
2674 /* Lookahead token as an internal (translated) token number. */
2677 /* Three stacks and their tools:
2678 `yyss': related to states,
2679 `yyvs': related to semantic values,
2680 `yyls': related to locations.
2682 Refer to the stacks thru separate pointers, to allow yyoverflow
2683 to reallocate them elsewhere. */
2685 /* The state stack. */
2686 short yyssa[YYINITDEPTH];
2687 short *yyss = yyssa;
2688 register short *yyssp;
2690 /* The semantic value stack. */
2691 YYSTYPE yyvsa[YYINITDEPTH];
2692 YYSTYPE *yyvs = yyvsa;
2693 register YYSTYPE *yyvsp;
2697 #define YYPOPSTACK (yyvsp--, yyssp--)
2699 YYSIZE_T yystacksize = YYINITDEPTH;
2701 /* The variables used to return semantic value and location from the
2706 /* When reducing, the number of symbols on the RHS of the reduced
2710 YYDPRINTF ((stderr, "Starting parse\n"));
2715 yychar = YYEMPTY; /* Cause a token to be read. */
2717 /* Initialize stack pointers.
2718 Waste one element of value and location stack
2719 so that they stay on the same level as the state stack.
2720 The wasted elements are never initialized. */
2727 /*------------------------------------------------------------.
2728 | yynewstate -- Push a new state, which is found in yystate. |
2729 `------------------------------------------------------------*/
2731 /* In all cases, when you get here, the value and location stacks
2732 have just been pushed. so pushing a state here evens the stacks.
2739 if (yyssp >= yyss + yystacksize - 1)
2741 /* Get the current used size of the three stacks, in elements. */
2742 YYSIZE_T yysize = yyssp - yyss + 1;
2746 /* Give user a chance to reallocate the stack. Use copies of
2747 these so that the &'s don't force the real ones into
2749 YYSTYPE *yyvs1 = yyvs;
2750 short *yyss1 = yyss;
2753 /* Each stack pointer address is followed by the size of the
2754 data in use in that stack, in bytes. This used to be a
2755 conditional around just the two extra args, but that might
2756 be undefined if yyoverflow is a macro. */
2757 yyoverflow ("parser stack overflow",
2758 &yyss1, yysize * sizeof (*yyssp),
2759 &yyvs1, yysize * sizeof (*yyvsp),
2766 #else /* no yyoverflow */
2767 # ifndef YYSTACK_RELOCATE
2770 /* Extend the stack our own way. */
2771 if (yystacksize >= YYMAXDEPTH)
2774 if (yystacksize > YYMAXDEPTH)
2775 yystacksize = YYMAXDEPTH;
2778 short *yyss1 = yyss;
2779 union yyalloc *yyptr =
2780 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2783 YYSTACK_RELOCATE (yyss);
2784 YYSTACK_RELOCATE (yyvs);
2786 # undef YYSTACK_RELOCATE
2788 YYSTACK_FREE (yyss1);
2791 #endif /* no yyoverflow */
2793 yyssp = yyss + yysize - 1;
2794 yyvsp = yyvs + yysize - 1;
2797 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2798 (unsigned long int) yystacksize));
2800 if (yyssp >= yyss + yystacksize - 1)
2804 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2813 /* Do appropriate processing given the current state. */
2814 /* Read a lookahead token if we need one and don't already have one. */
2817 /* First try to decide what to do without reference to lookahead token. */
2819 yyn = yypact[yystate];
2820 if (yyn == YYPACT_NINF)
2823 /* Not known => get a lookahead token if don't already have one. */
2825 /* yychar is either YYEMPTY or YYEOF
2826 or a valid token in external form. */
2828 if (yychar == YYEMPTY)
2830 YYDPRINTF ((stderr, "Reading a token: "));
2834 /* Convert token to internal form (in yychar1) for indexing tables with. */
2836 if (yychar <= 0) /* This means end of input. */
2839 yychar = YYEOF; /* Don't call YYLEX any more. */
2841 YYDPRINTF ((stderr, "Now at end of input.\n"));
2845 yychar1 = YYTRANSLATE (yychar);
2847 /* We have to keep this `#if YYDEBUG', since we use variables
2848 which are defined only if `YYDEBUG' is set. */
2849 YYDPRINTF ((stderr, "Next token is "));
2850 YYDSYMPRINT ((stderr, yychar1, yylval));
2851 YYDPRINTF ((stderr, "\n"));
2854 /* If the proper action on seeing token YYCHAR1 is to reduce or to
2855 detect an error, take that action. */
2857 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
2862 if (yyn == 0 || yyn == YYTABLE_NINF)
2871 /* Shift the lookahead token. */
2872 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
2873 yychar, yytname[yychar1]));
2875 /* Discard the token being shifted unless it is eof. */
2876 if (yychar != YYEOF)
2882 /* Count tokens shifted since error; after three, turn off error
2891 /*-----------------------------------------------------------.
2892 | yydefault -- do the default action for the current state. |
2893 `-----------------------------------------------------------*/
2895 yyn = yydefact[yystate];
2901 /*-----------------------------.
2902 | yyreduce -- Do a reduction. |
2903 `-----------------------------*/
2905 /* yyn is the number of a rule to reduce with. */
2908 /* If YYLEN is nonzero, implement the default value of the action:
2911 Otherwise, the following line sets YYVAL to garbage.
2912 This behavior is undocumented and Bison
2913 users should not rely upon it. Assigning to YYVAL
2914 unconditionally makes the parser a bit smaller, and it avoids a
2915 GCC warning that YYVAL may be used uninitialized. */
2916 yyval = yyvsp[1-yylen];
2921 /* We have to keep this `#if YYDEBUG', since we use variables which
2922 are defined only if `YYDEBUG' is set. */
2927 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
2928 yyn - 1, yyrline[yyn]);
2930 /* Print the symbols being reduced, and their result. */
2931 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
2932 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2933 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2939 #line 1117 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2940 { yyval.IPredicate = ICmpInst::ICMP_EQ; }
2944 #line 1117 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2945 { yyval.IPredicate = ICmpInst::ICMP_NE; }
2949 #line 1118 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2950 { yyval.IPredicate = ICmpInst::ICMP_SLT; }
2954 #line 1118 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2955 { yyval.IPredicate = ICmpInst::ICMP_SGT; }
2959 #line 1119 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2960 { yyval.IPredicate = ICmpInst::ICMP_SLE; }
2964 #line 1119 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2965 { yyval.IPredicate = ICmpInst::ICMP_SGE; }
2969 #line 1120 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2970 { yyval.IPredicate = ICmpInst::ICMP_ULT; }
2974 #line 1120 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2975 { yyval.IPredicate = ICmpInst::ICMP_UGT; }
2979 #line 1121 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2980 { yyval.IPredicate = ICmpInst::ICMP_ULE; }
2984 #line 1121 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2985 { yyval.IPredicate = ICmpInst::ICMP_UGE; }
2989 #line 1125 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2990 { yyval.FPredicate = FCmpInst::FCMP_OEQ; }
2994 #line 1125 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
2995 { yyval.FPredicate = FCmpInst::FCMP_ONE; }
2999 #line 1126 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3000 { yyval.FPredicate = FCmpInst::FCMP_OLT; }
3004 #line 1126 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3005 { yyval.FPredicate = FCmpInst::FCMP_OGT; }
3009 #line 1127 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3010 { yyval.FPredicate = FCmpInst::FCMP_OLE; }
3014 #line 1127 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3015 { yyval.FPredicate = FCmpInst::FCMP_OGE; }
3019 #line 1128 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3020 { yyval.FPredicate = FCmpInst::FCMP_ORD; }
3024 #line 1128 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3025 { yyval.FPredicate = FCmpInst::FCMP_UNO; }
3029 #line 1129 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3030 { yyval.FPredicate = FCmpInst::FCMP_UEQ; }
3034 #line 1129 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3035 { yyval.FPredicate = FCmpInst::FCMP_UNE; }
3039 #line 1130 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3040 { yyval.FPredicate = FCmpInst::FCMP_ULT; }
3044 #line 1130 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3045 { yyval.FPredicate = FCmpInst::FCMP_UGT; }
3049 #line 1131 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3050 { yyval.FPredicate = FCmpInst::FCMP_ULE; }
3054 #line 1131 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3055 { yyval.FPredicate = FCmpInst::FCMP_UGE; }
3059 #line 1132 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3060 { yyval.FPredicate = FCmpInst::FCMP_TRUE; }
3064 #line 1133 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3065 { yyval.FPredicate = FCmpInst::FCMP_FALSE; }
3069 #line 1142 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3070 { yyval.StrVal = 0; }
3074 #line 1146 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3076 yyval.StrVal = yyvsp[-1].StrVal;
3082 #line 1150 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3090 #line 1158 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3098 #line 1163 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3100 yyval.StrVal = yyvsp[-1].StrVal;
3106 #line 1169 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3107 { yyval.Linkage = GlobalValue::InternalLinkage; }
3111 #line 1170 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3112 { yyval.Linkage = GlobalValue::WeakLinkage; }
3116 #line 1171 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3117 { yyval.Linkage = GlobalValue::LinkOnceLinkage; }
3121 #line 1172 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3122 { yyval.Linkage = GlobalValue::AppendingLinkage; }
3126 #line 1173 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3127 { yyval.Linkage = GlobalValue::DLLExportLinkage; }
3131 #line 1177 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3132 { yyval.Linkage = GlobalValue::DLLImportLinkage; }
3136 #line 1178 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3137 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; }
3141 #line 1179 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3142 { yyval.Linkage = GlobalValue::ExternalLinkage; }
3146 #line 1183 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3147 { yyval.Visibility = GlobalValue::DefaultVisibility; }
3151 #line 1184 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3152 { yyval.Visibility = GlobalValue::DefaultVisibility; }
3156 #line 1185 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3157 { yyval.Visibility = GlobalValue::HiddenVisibility; }
3161 #line 1189 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3162 { yyval.Linkage = GlobalValue::ExternalLinkage; }
3166 #line 1190 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3167 { yyval.Linkage = GlobalValue::DLLImportLinkage; }
3171 #line 1191 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3172 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; }
3176 #line 1195 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3177 { yyval.Linkage = GlobalValue::ExternalLinkage; }
3181 #line 1196 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3182 { yyval.Linkage = GlobalValue::InternalLinkage; }
3186 #line 1197 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3187 { yyval.Linkage = GlobalValue::LinkOnceLinkage; }
3191 #line 1198 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3192 { yyval.Linkage = GlobalValue::WeakLinkage; }
3196 #line 1199 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3197 { yyval.Linkage = GlobalValue::DLLExportLinkage; }
3201 #line 1203 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3202 { yyval.Linkage = GlobalValue::ExternalLinkage; }
3206 #line 1204 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3207 { yyval.Linkage = GlobalValue::WeakLinkage; }
3211 #line 1205 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3212 { yyval.Linkage = GlobalValue::InternalLinkage; }
3216 #line 1208 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3217 { yyval.UIntVal = CallingConv::C; }
3221 #line 1209 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3222 { yyval.UIntVal = CallingConv::C; }
3226 #line 1210 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3227 { yyval.UIntVal = CallingConv::Fast; }
3231 #line 1211 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3232 { yyval.UIntVal = CallingConv::Cold; }
3236 #line 1212 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3237 { yyval.UIntVal = CallingConv::X86_StdCall; }
3241 #line 1213 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3242 { yyval.UIntVal = CallingConv::X86_FastCall; }
3246 #line 1214 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3248 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
3249 GEN_ERROR("Calling conv too large");
3250 yyval.UIntVal = yyvsp[0].UInt64Val;
3256 #line 1221 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3257 { yyval.ParamAttrs = ParamAttr::ZExt; }
3261 #line 1222 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3262 { yyval.ParamAttrs = ParamAttr::SExt; }
3266 #line 1223 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3267 { yyval.ParamAttrs = ParamAttr::InReg; }
3271 #line 1224 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3272 { yyval.ParamAttrs = ParamAttr::StructRet; }
3276 #line 1227 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3277 { yyval.ParamAttrs = ParamAttr::None; }
3281 #line 1228 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3283 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
3288 #line 1233 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3289 { yyval.ParamAttrs = ParamAttr::NoReturn; }
3293 #line 1234 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3294 { yyval.ParamAttrs = ParamAttr::NoUnwind; }
3298 #line 1238 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3299 { yyval.ParamAttrs = ParamAttr::None; }
3303 #line 1239 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3305 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
3310 #line 1246 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3311 { yyval.UIntVal = 0; }
3315 #line 1247 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3317 yyval.UIntVal = yyvsp[0].UInt64Val;
3318 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
3319 GEN_ERROR("Alignment must be a power of two");
3325 #line 1253 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3326 { yyval.UIntVal = 0; }
3330 #line 1254 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3332 yyval.UIntVal = yyvsp[0].UInt64Val;
3333 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
3334 GEN_ERROR("Alignment must be a power of two");
3340 #line 1262 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3342 for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i)
3343 if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\')
3344 GEN_ERROR("Invalid character in section name");
3345 yyval.StrVal = yyvsp[0].StrVal;
3351 #line 1270 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3352 { yyval.StrVal = 0; }
3356 #line 1271 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3357 { yyval.StrVal = yyvsp[0].StrVal; }
3361 #line 1276 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3366 #line 1277 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3371 #line 1278 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3373 CurGV->setSection(yyvsp[0].StrVal);
3374 free(yyvsp[0].StrVal);
3380 #line 1283 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3382 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
3383 GEN_ERROR("Alignment must be a power of two");
3384 CurGV->setAlignment(yyvsp[0].UInt64Val);
3390 #line 1299 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3392 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
3398 #line 1303 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3400 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
3406 #line 1307 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3408 if (*yyvsp[-1].TypeVal == Type::LabelTy)
3409 GEN_ERROR("Cannot form a pointer to a basic block");
3410 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
3411 delete yyvsp[-1].TypeVal;
3417 #line 1314 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3418 { // Named types are also simple types...
3419 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
3421 yyval.TypeVal = new PATypeHolder(tmp);
3426 #line 1319 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3427 { // Type UpReference
3428 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
3429 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3430 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3431 yyval.TypeVal = new PATypeHolder(OT);
3432 UR_OUT("New Upreference!\n");
3438 #line 1327 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3440 std::vector<const Type*> Params;
3441 ParamAttrsVector Attrs;
3442 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3443 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3447 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3448 for (; I != E; ++I, ++index) {
3449 const Type *Ty = I->Ty->get();
3450 Params.push_back(Ty);
3451 if (Ty != Type::VoidTy)
3452 if (I->Attrs != ParamAttr::None) {
3453 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3457 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3458 if (isVarArg) Params.pop_back();
3460 ParamAttrsList *ActualAttrs = 0;
3462 ActualAttrs = ParamAttrsList::get(Attrs);
3463 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3464 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3465 delete yyvsp[-4].TypeVal; // Delete the return type handle
3466 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3472 #line 1357 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3474 std::vector<const Type*> Params;
3475 ParamAttrsVector Attrs;
3476 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3477 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3480 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3482 for ( ; I != E; ++I, ++index) {
3483 const Type* Ty = I->Ty->get();
3484 Params.push_back(Ty);
3485 if (Ty != Type::VoidTy)
3486 if (I->Attrs != ParamAttr::None) {
3487 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3491 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3492 if (isVarArg) Params.pop_back();
3494 ParamAttrsList *ActualAttrs = 0;
3496 ActualAttrs = ParamAttrsList::get(Attrs);
3498 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3499 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3500 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3506 #line 1388 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3507 { // Sized array type?
3508 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3509 delete yyvsp[-1].TypeVal;
3515 #line 1393 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3517 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3518 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3519 GEN_ERROR("Unsigned result not equal to signed result");
3520 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3521 GEN_ERROR("Element type of a VectorType must be primitive");
3522 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3523 GEN_ERROR("Vector length should be a power of 2");
3524 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3525 delete yyvsp[-1].TypeVal;
3531 #line 1405 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3532 { // Structure type?
3533 std::vector<const Type*> Elements;
3534 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3535 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3536 Elements.push_back(*I);
3538 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3539 delete yyvsp[-1].TypeList;
3545 #line 1415 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3546 { // Empty structure type?
3547 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3553 #line 1419 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3555 std::vector<const Type*> Elements;
3556 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3557 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3558 Elements.push_back(*I);
3560 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3561 delete yyvsp[-2].TypeList;
3567 #line 1429 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3568 { // Empty structure type?
3569 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3575 #line 1436 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3577 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3578 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3583 #line 1443 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3585 if (!UpRefs.empty())
3586 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3587 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3588 GEN_ERROR("LLVM functions cannot return aggregate types");
3589 yyval.TypeVal = yyvsp[0].TypeVal;
3594 #line 1450 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3596 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3601 #line 1455 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3603 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3604 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3610 #line 1460 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3612 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3618 #line 1468 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3620 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3621 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3622 TWA.Ty = new PATypeHolder(Type::VoidTy);
3623 yyval.TypeWithAttrsList->push_back(TWA);
3629 #line 1475 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3631 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3632 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3633 TWA.Ty = new PATypeHolder(Type::VoidTy);
3634 yyval.TypeWithAttrsList->push_back(TWA);
3640 #line 1482 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3642 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3648 #line 1490 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3650 yyval.TypeList = new std::list<PATypeHolder>();
3651 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3652 delete yyvsp[0].TypeVal;
3658 #line 1496 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3660 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3661 delete yyvsp[0].TypeVal;
3667 #line 1508 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3668 { // Nonempty unsized arr
3669 if (!UpRefs.empty())
3670 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3671 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3673 GEN_ERROR("Cannot make array constant with type: '" +
3674 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3675 const Type *ETy = ATy->getElementType();
3676 int NumElements = ATy->getNumElements();
3678 // Verify that we have the correct size...
3679 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3680 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3681 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3682 itostr(NumElements) + "");
3684 // Verify all elements are correct type!
3685 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3686 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3687 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3688 ETy->getDescription() +"' as required!\nIt is of type '"+
3689 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3692 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3693 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3699 #line 1536 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3701 if (!UpRefs.empty())
3702 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3703 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3705 GEN_ERROR("Cannot make array constant with type: '" +
3706 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3708 int NumElements = ATy->getNumElements();
3709 if (NumElements != -1 && NumElements != 0)
3710 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3711 " arguments, but has size of " + itostr(NumElements) +"");
3712 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3713 delete yyvsp[-2].TypeVal;
3719 #line 1552 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3721 if (!UpRefs.empty())
3722 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3723 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3725 GEN_ERROR("Cannot make array constant with type: '" +
3726 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3728 int NumElements = ATy->getNumElements();
3729 const Type *ETy = ATy->getElementType();
3730 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
3731 if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
3732 GEN_ERROR("Can't build string constant of size " +
3733 itostr((int)(EndStr-yyvsp[0].StrVal)) +
3734 " when array has size " + itostr(NumElements) + "");
3735 std::vector<Constant*> Vals;
3736 if (ETy == Type::Int8Ty) {
3737 for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal;
3738 C != (unsigned char*)EndStr; ++C)
3739 Vals.push_back(ConstantInt::get(ETy, *C));
3741 free(yyvsp[0].StrVal);
3742 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3744 free(yyvsp[0].StrVal);
3745 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3746 delete yyvsp[-2].TypeVal;
3752 #line 1581 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3753 { // Nonempty unsized arr
3754 if (!UpRefs.empty())
3755 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3756 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3758 GEN_ERROR("Cannot make packed constant with type: '" +
3759 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3760 const Type *ETy = PTy->getElementType();
3761 int NumElements = PTy->getNumElements();
3763 // Verify that we have the correct size...
3764 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3765 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3766 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3767 itostr(NumElements) + "");
3769 // Verify all elements are correct type!
3770 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3771 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3772 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3773 ETy->getDescription() +"' as required!\nIt is of type '"+
3774 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3777 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3778 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3784 #line 1609 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3786 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3788 GEN_ERROR("Cannot make struct constant with type: '" +
3789 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3791 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3792 GEN_ERROR("Illegal number of initializers for structure type");
3794 // Check to ensure that constants are compatible with the type initializer!
3795 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3796 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3797 GEN_ERROR("Expected type '" +
3798 STy->getElementType(i)->getDescription() +
3799 "' for element #" + utostr(i) +
3800 " of structure initializer");
3802 // Check to ensure that Type is not packed
3803 if (STy->isPacked())
3804 GEN_ERROR("Unpacked Initializer to vector type '" +
3805 STy->getDescription() + "'");
3807 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3808 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3814 #line 1635 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3816 if (!UpRefs.empty())
3817 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3818 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3820 GEN_ERROR("Cannot make struct constant with type: '" +
3821 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3823 if (STy->getNumContainedTypes() != 0)
3824 GEN_ERROR("Illegal number of initializers for structure type");
3826 // Check to ensure that Type is not packed
3827 if (STy->isPacked())
3828 GEN_ERROR("Unpacked Initializer to vector type '" +
3829 STy->getDescription() + "'");
3831 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3832 delete yyvsp[-2].TypeVal;
3838 #line 1655 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3840 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3842 GEN_ERROR("Cannot make struct constant with type: '" +
3843 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3845 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3846 GEN_ERROR("Illegal number of initializers for structure type");
3848 // Check to ensure that constants are compatible with the type initializer!
3849 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3850 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3851 GEN_ERROR("Expected type '" +
3852 STy->getElementType(i)->getDescription() +
3853 "' for element #" + utostr(i) +
3854 " of structure initializer");
3856 // Check to ensure that Type is packed
3857 if (!STy->isPacked())
3858 GEN_ERROR("Vector initializer to non-vector type '" +
3859 STy->getDescription() + "'");
3861 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3862 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3868 #line 1681 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3870 if (!UpRefs.empty())
3871 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3872 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3874 GEN_ERROR("Cannot make struct constant with type: '" +
3875 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3877 if (STy->getNumContainedTypes() != 0)
3878 GEN_ERROR("Illegal number of initializers for structure type");
3880 // Check to ensure that Type is packed
3881 if (!STy->isPacked())
3882 GEN_ERROR("Vector initializer to non-vector type '" +
3883 STy->getDescription() + "'");
3885 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3886 delete yyvsp[-4].TypeVal;
3892 #line 1701 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3894 if (!UpRefs.empty())
3895 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3896 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3898 GEN_ERROR("Cannot make null pointer constant with type: '" +
3899 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3901 yyval.ConstVal = ConstantPointerNull::get(PTy);
3902 delete yyvsp[-1].TypeVal;
3908 #line 1713 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3910 if (!UpRefs.empty())
3911 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3912 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3913 delete yyvsp[-1].TypeVal;
3919 #line 1720 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3921 if (!UpRefs.empty())
3922 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3923 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3925 GEN_ERROR("Global const reference must be a pointer type");
3927 // ConstExprs can exist in the body of a function, thus creating
3928 // GlobalValues whenever they refer to a variable. Because we are in
3929 // the context of a function, getExistingVal will search the functions
3930 // symbol table instead of the module symbol table for the global symbol,
3931 // which throws things all off. To get around this, we just tell
3932 // getExistingVal that we are at global scope here.
3934 Function *SavedCurFn = CurFun.CurrentFunction;
3935 CurFun.CurrentFunction = 0;
3937 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3940 CurFun.CurrentFunction = SavedCurFn;
3942 // If this is an initializer for a constant pointer, which is referencing a
3943 // (currently) undefined variable, create a stub now that shall be replaced
3944 // in the future with the right type of variable.
3947 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3948 const PointerType *PT = cast<PointerType>(Ty);
3950 // First check to see if the forward references value is already created!
3951 PerModuleInfo::GlobalRefsType::iterator I =
3952 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3954 if (I != CurModule.GlobalRefs.end()) {
3955 V = I->second; // Placeholder already exists, use it...
3956 yyvsp[0].ValIDVal.destroy();
3959 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3960 Name = yyvsp[0].ValIDVal.Name;
3961 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3962 GEN_ERROR("Invalid reference to global");
3964 // Create the forward referenced global.
3966 if (const FunctionType *FTy =
3967 dyn_cast<FunctionType>(PT->getElementType())) {
3968 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3969 CurModule.CurrentModule);
3971 GV = new GlobalVariable(PT->getElementType(), false,
3972 GlobalValue::ExternalWeakLinkage, 0,
3973 Name, CurModule.CurrentModule);
3976 // Keep track of the fact that we have a forward ref to recycle it
3977 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3982 yyval.ConstVal = cast<GlobalValue>(V);
3983 delete yyvsp[-1].TypeVal; // Free the type handle
3989 #line 1786 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
3991 if (!UpRefs.empty())
3992 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3993 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3994 GEN_ERROR("Mismatched types for constant expression: " +
3995 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3996 yyval.ConstVal = yyvsp[0].ConstVal;
3997 delete yyvsp[-1].TypeVal;
4003 #line 1796 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4005 if (!UpRefs.empty())
4006 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4007 const Type *Ty = yyvsp[-1].TypeVal->get();
4008 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4009 GEN_ERROR("Cannot create a null initialized value of this type");
4010 yyval.ConstVal = Constant::getNullValue(Ty);
4011 delete yyvsp[-1].TypeVal;
4017 #line 1806 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4018 { // integral constants
4019 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
4020 GEN_ERROR("Constant value doesn't fit in type");
4021 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
4027 #line 1812 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4028 { // arbitrary precision integer constants
4029 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
4030 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
4031 GEN_ERROR("Constant value does not fit in type");
4033 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
4034 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
4035 delete yyvsp[0].APIntVal;
4041 #line 1822 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4042 { // integral constants
4043 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
4044 GEN_ERROR("Constant value doesn't fit in type");
4045 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
4051 #line 1828 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4052 { // arbitrary precision integer constants
4053 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
4054 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
4055 GEN_ERROR("Constant value does not fit in type");
4057 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
4058 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
4059 delete yyvsp[0].APIntVal;
4065 #line 1838 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4066 { // Boolean constants
4067 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
4068 yyval.ConstVal = ConstantInt::getTrue();
4074 #line 1843 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4075 { // Boolean constants
4076 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
4077 yyval.ConstVal = ConstantInt::getFalse();
4083 #line 1848 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4084 { // Float & Double constants
4085 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
4086 GEN_ERROR("Floating point constant invalid for type");
4087 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
4093 #line 1856 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4095 if (!UpRefs.empty())
4096 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4097 Constant *Val = yyvsp[-3].ConstVal;
4098 const Type *DestTy = yyvsp[-1].TypeVal->get();
4099 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
4100 GEN_ERROR("invalid cast opcode for cast from '" +
4101 Val->getType()->getDescription() + "' to '" +
4102 DestTy->getDescription() + "'");
4103 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
4104 delete yyvsp[-1].TypeVal;
4109 #line 1868 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4111 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
4112 GEN_ERROR("GetElementPtr requires a pointer operand");
4115 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), &(*yyvsp[-1].ValueList)[0], yyvsp[-1].ValueList->size(),
4118 GEN_ERROR("Index list invalid for constant getelementptr");
4120 SmallVector<Constant*, 8> IdxVec;
4121 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
4122 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
4123 IdxVec.push_back(C);
4125 GEN_ERROR("Indices to constant getelementptr must be constants");
4127 delete yyvsp[-1].ValueList;
4129 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
4135 #line 1890 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4137 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
4138 GEN_ERROR("Select condition must be of boolean type");
4139 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4140 GEN_ERROR("Select operand types must match");
4141 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4147 #line 1898 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4149 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4150 GEN_ERROR("Binary operator types must match");
4152 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4157 #line 1904 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4159 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4160 GEN_ERROR("Logical operator types must match");
4161 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
4162 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
4163 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
4164 GEN_ERROR("Logical operator requires integral operands");
4166 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4172 #line 1915 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4174 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4175 GEN_ERROR("icmp operand types must match");
4176 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4181 #line 1920 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4183 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4184 GEN_ERROR("fcmp operand types must match");
4185 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4190 #line 1925 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4192 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4193 GEN_ERROR("Invalid extractelement operands");
4194 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4200 #line 1931 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4202 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4203 GEN_ERROR("Invalid insertelement operands");
4204 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4210 #line 1937 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4212 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4213 GEN_ERROR("Invalid shufflevector operands");
4214 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4220 #line 1946 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4222 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
4228 #line 1950 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4230 yyval.ConstVector = new std::vector<Constant*>();
4231 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
4237 #line 1958 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4238 { yyval.BoolVal = false; }
4242 #line 1958 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4243 { yyval.BoolVal = true; }
4247 #line 1961 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4248 { yyval.BoolVal = true; }
4252 #line 1961 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4253 { yyval.BoolVal = false; }
4257 #line 1964 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4259 const Type* VTy = yyvsp[-1].TypeVal->get();
4260 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
4261 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4263 GEN_ERROR("Aliases can be created only to global values");
4265 yyval.ConstVal = Aliasee;
4267 delete yyvsp[-1].TypeVal;
4272 #line 1975 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4274 Constant *Val = yyvsp[-3].ConstVal;
4275 const Type *DestTy = yyvsp[-1].TypeVal->get();
4276 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
4277 GEN_ERROR("invalid cast opcode for cast from '" +
4278 Val->getType()->getDescription() + "' to '" +
4279 DestTy->getDescription() + "'");
4281 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
4283 delete yyvsp[-1].TypeVal;
4288 #line 1996 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4290 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
4291 CurModule.ModuleDone();
4297 #line 2001 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4299 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
4300 CurModule.ModuleDone();
4306 #line 2014 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4307 { CurFun.isDeclare = false; }
4311 #line 2014 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4313 CurFun.FunctionDone();
4319 #line 2018 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4320 { CurFun.isDeclare = true; }
4324 #line 2018 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4331 #line 2021 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4338 #line 2024 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4340 if (!UpRefs.empty())
4341 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4342 // Eagerly resolve types. This is not an optimization, this is a
4343 // requirement that is due to the fact that we could have this:
4345 // %list = type { %list * }
4346 // %list = type { %list * } ; repeated type decl
4348 // If types are not resolved eagerly, then the two types will not be
4349 // determined to be the same type!
4351 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
4353 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
4355 // If this is a named type that is not a redefinition, add it to the slot
4357 CurModule.Types.push_back(*yyvsp[0].TypeVal);
4360 delete yyvsp[0].TypeVal;
4366 #line 2048 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4368 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
4370 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
4372 // If this is a named type that is not a redefinition, add it to the slot
4374 CurModule.Types.push_back(yyvsp[0].PrimType);
4381 #line 2059 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4383 /* "Externally Visible" Linkage */
4384 if (yyvsp[0].ConstVal == 0)
4385 GEN_ERROR("Global value initializer is not a constant");
4386 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
4387 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
4393 #line 2066 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4400 #line 2070 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4402 if (yyvsp[0].ConstVal == 0)
4403 GEN_ERROR("Global value initializer is not a constant");
4404 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
4410 #line 2075 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4417 #line 2079 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4419 if (!UpRefs.empty())
4420 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4421 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
4423 delete yyvsp[0].TypeVal;
4428 #line 2085 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4436 #line 2089 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4438 std::string Name(yyvsp[-4].StrVal);
4440 GEN_ERROR("Alias name cannot be empty");
4442 Constant* Aliasee = yyvsp[0].ConstVal;
4444 GEN_ERROR(std::string("Invalid aliasee for alias: ") + yyvsp[-4].StrVal);
4446 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
4447 CurModule.CurrentModule);
4448 GA->setVisibility(yyvsp[-3].Visibility);
4449 InsertValue(GA, CurModule.Values);
4455 #line 2104 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4462 #line 2107 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4469 #line 2113 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4471 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4472 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
4473 std::string NewAsm(yyvsp[0].StrVal, EndStr);
4474 free(yyvsp[0].StrVal);
4476 if (AsmSoFar.empty())
4477 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4479 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4485 #line 2126 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4487 CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
4488 free(yyvsp[0].StrVal);
4493 #line 2130 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4495 CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal);
4496 free(yyvsp[0].StrVal);
4501 #line 2137 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4503 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
4504 free(yyvsp[0].StrVal);
4510 #line 2142 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4512 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
4513 free(yyvsp[0].StrVal);
4519 #line 2147 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4526 #line 2156 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4528 if (!UpRefs.empty())
4529 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4530 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4531 GEN_ERROR("void typed arguments are invalid");
4532 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4533 yyval.ArgList = yyvsp[-4].ArgList;
4534 yyvsp[-4].ArgList->push_back(E);
4540 #line 2166 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4542 if (!UpRefs.empty())
4543 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4544 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4545 GEN_ERROR("void typed arguments are invalid");
4546 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4547 yyval.ArgList = new ArgListType;
4548 yyval.ArgList->push_back(E);
4554 #line 2177 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4556 yyval.ArgList = yyvsp[0].ArgList;
4562 #line 2181 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4564 yyval.ArgList = yyvsp[-2].ArgList;
4565 struct ArgListEntry E;
4566 E.Ty = new PATypeHolder(Type::VoidTy);
4568 E.Attrs = ParamAttr::None;
4569 yyval.ArgList->push_back(E);
4575 #line 2190 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4577 yyval.ArgList = new ArgListType;
4578 struct ArgListEntry E;
4579 E.Ty = new PATypeHolder(Type::VoidTy);
4581 E.Attrs = ParamAttr::None;
4582 yyval.ArgList->push_back(E);
4588 #line 2199 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4596 #line 2205 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4598 UnEscapeLexed(yyvsp[-6].StrVal);
4599 std::string FunctionName(yyvsp[-6].StrVal);
4600 free(yyvsp[-6].StrVal); // Free strdup'd memory!
4602 // Check the function result for abstractness if this is a define. We should
4603 // have no abstract types at this point
4604 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4605 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4607 std::vector<const Type*> ParamTypeList;
4608 ParamAttrsVector Attrs;
4609 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4610 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4611 Attrs.push_back(PAWI);
4613 if (yyvsp[-4].ArgList) { // If there are arguments...
4615 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4616 const Type* Ty = I->Ty->get();
4617 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4618 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4619 ParamTypeList.push_back(Ty);
4620 if (Ty != Type::VoidTy)
4621 if (I->Attrs != ParamAttr::None) {
4622 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4623 Attrs.push_back(PAWI);
4628 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4629 if (isVarArg) ParamTypeList.pop_back();
4631 ParamAttrsList *PAL = 0;
4633 PAL = ParamAttrsList::get(Attrs);
4635 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4636 const PointerType *PFT = PointerType::get(FT);
4637 delete yyvsp[-7].TypeVal;
4640 if (!FunctionName.empty()) {
4641 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4643 ID = ValID::createGlobalID(CurModule.Values.size());
4647 // See if this function was forward referenced. If so, recycle the object.
4648 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4649 // Move the function to the end of the list, from whereever it was
4650 // previously inserted.
4651 Fn = cast<Function>(FWRef);
4652 CurModule.CurrentModule->getFunctionList().remove(Fn);
4653 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4654 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4655 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4656 if (Fn->getFunctionType() != FT) {
4657 // The existing function doesn't have the same type. This is an overload
4659 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4660 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4661 // Neither the existing or the current function is a declaration and they
4662 // have the same name and same type. Clearly this is a redefinition.
4663 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4664 } if (Fn->isDeclaration()) {
4665 // Make sure to strip off any argument names so we can't get conflicts.
4666 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4670 } else { // Not already defined?
4671 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4672 CurModule.CurrentModule);
4674 InsertValue(Fn, CurModule.Values);
4677 CurFun.FunctionStart(Fn);
4679 if (CurFun.isDeclare) {
4680 // If we have declaration, always overwrite linkage. This will allow us to
4681 // correctly handle cases, when pointer to function is passed as argument to
4682 // another function.
4683 Fn->setLinkage(CurFun.Linkage);
4684 Fn->setVisibility(CurFun.Visibility);
4686 Fn->setCallingConv(yyvsp[-8].UIntVal);
4687 Fn->setAlignment(yyvsp[0].UIntVal);
4688 if (yyvsp[-1].StrVal) {
4689 Fn->setSection(yyvsp[-1].StrVal);
4690 free(yyvsp[-1].StrVal);
4693 // Add all of the arguments we parsed to the function...
4694 if (yyvsp[-4].ArgList) { // Is null if empty...
4695 if (isVarArg) { // Nuke the last entry
4696 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4697 "Not a varargs marker!");
4698 delete yyvsp[-4].ArgList->back().Ty;
4699 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4701 Function::arg_iterator ArgIt = Fn->arg_begin();
4702 Function::arg_iterator ArgEnd = Fn->arg_end();
4704 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4705 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4706 delete I->Ty; // Delete the typeholder...
4707 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4713 delete yyvsp[-4].ArgList; // We're now done with the argument list
4720 #line 2328 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4722 yyval.FunctionVal = CurFun.CurrentFunction;
4724 // Make sure that we keep track of the linkage type even if there was a
4725 // previous "declare".
4726 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4727 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4732 #line 2339 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4734 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4740 #line 2344 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4742 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4743 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4744 yyval.FunctionVal = CurFun.CurrentFunction;
4745 CurFun.FunctionDone();
4751 #line 2356 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4753 yyval.BoolVal = false;
4759 #line 2360 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4761 yyval.BoolVal = true;
4767 #line 2365 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4768 { // A reference to a direct constant
4769 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4775 #line 2369 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4777 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4783 #line 2373 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4784 { // Perhaps it's an FP constant?
4785 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4791 #line 2377 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4793 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4799 #line 2381 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4801 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4807 #line 2385 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4809 yyval.ValIDVal = ValID::createNull();
4815 #line 2389 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4817 yyval.ValIDVal = ValID::createUndef();
4823 #line 2393 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4824 { // A vector zero constant.
4825 yyval.ValIDVal = ValID::createZeroInit();
4831 #line 2397 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4832 { // Nonempty unsized packed vector
4833 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4834 int NumElements = yyvsp[-1].ConstVector->size();
4836 VectorType* pt = VectorType::get(ETy, NumElements);
4837 PATypeHolder* PTy = new PATypeHolder(
4845 // Verify all elements are correct type!
4846 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4847 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4848 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4849 ETy->getDescription() +"' as required!\nIt is of type '" +
4850 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4853 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4854 delete PTy; delete yyvsp[-1].ConstVector;
4860 #line 2422 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4862 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4868 #line 2426 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4870 char *End = UnEscapeLexed(yyvsp[-2].StrVal, true);
4871 std::string AsmStr = std::string(yyvsp[-2].StrVal, End);
4872 End = UnEscapeLexed(yyvsp[0].StrVal, true);
4873 std::string Constraints = std::string(yyvsp[0].StrVal, End);
4874 yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal);
4875 free(yyvsp[-2].StrVal);
4876 free(yyvsp[0].StrVal);
4882 #line 2440 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4883 { // Is it an integer reference...?
4884 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4890 #line 2444 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4892 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4898 #line 2448 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4899 { // Is it a named reference...?
4900 yyval.ValIDVal = ValID::createLocalName(yyvsp[0].StrVal);
4906 #line 2452 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4907 { // Is it a named reference...?
4908 yyval.ValIDVal = ValID::createGlobalName(yyvsp[0].StrVal);
4914 #line 2464 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4916 if (!UpRefs.empty())
4917 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4918 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4919 delete yyvsp[-1].TypeVal;
4925 #line 2473 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4927 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4933 #line 2477 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4934 { // Do not allow functions with 0 basic blocks
4935 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4941 #line 2486 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4943 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4945 InsertValue(yyvsp[0].TermInstVal);
4946 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4947 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4953 #line 2495 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4955 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4956 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4957 if (CI2->getParent() == 0)
4958 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4959 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4960 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4966 #line 2504 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4967 { // Empty space between instruction lists
4968 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4974 #line 2508 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4975 { // Labelled (named) basic block
4976 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(yyvsp[0].StrVal));
4982 #line 2513 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4983 { // Return with a result...
4984 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4990 #line 2517 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4991 { // Return with no result...
4992 yyval.TermInstVal = new ReturnInst();
4998 #line 2521 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
4999 { // Unconditional Branch...
5000 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5002 yyval.TermInstVal = new BranchInst(tmpBB);
5007 #line 2526 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5009 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
5010 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
5012 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
5014 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
5016 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5021 #line 2536 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5023 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
5025 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
5027 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
5028 yyval.TermInstVal = S;
5030 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
5031 E = yyvsp[-1].JumpTable->end();
5032 for (; I != E; ++I) {
5033 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5034 S->addCase(CI, I->second);
5036 GEN_ERROR("Switch case is constant, but not a simple integer");
5038 delete yyvsp[-1].JumpTable;
5044 #line 2555 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5046 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
5048 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
5050 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5051 yyval.TermInstVal = S;
5057 #line 2565 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5060 // Handle the short syntax
5061 const PointerType *PFTy = 0;
5062 const FunctionType *Ty = 0;
5063 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
5064 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5065 // Pull out the types of all of the arguments...
5066 std::vector<const Type*> ParamTypes;
5067 ParamAttrsVector Attrs;
5068 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
5069 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = 8;
5070 Attrs.push_back(PAWI);
5072 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
5074 for (; I != E; ++I, ++index) {
5075 const Type *Ty = I->Val->getType();
5076 if (Ty == Type::VoidTy)
5077 GEN_ERROR("Short call syntax cannot be used with varargs");
5078 ParamTypes.push_back(Ty);
5079 if (I->Attrs != ParamAttr::None) {
5080 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5081 Attrs.push_back(PAWI);
5085 ParamAttrsList *PAL = 0;
5087 PAL = ParamAttrsList::get(Attrs);
5088 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
5089 PFTy = PointerType::get(Ty);
5092 delete yyvsp[-11].TypeVal;
5094 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
5096 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
5098 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
5101 // Check the arguments
5103 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
5104 // Make sure no arguments is a good thing!
5105 if (Ty->getNumParams() != 0)
5106 GEN_ERROR("No arguments passed to a function that "
5107 "expects arguments");
5108 } else { // Has arguments?
5109 // Loop through FunctionType's arguments and ensure they are specified
5111 FunctionType::param_iterator I = Ty->param_begin();
5112 FunctionType::param_iterator E = Ty->param_end();
5113 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
5115 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5116 if (ArgI->Val->getType() != *I)
5117 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5118 (*I)->getDescription() + "'");
5119 Args.push_back(ArgI->Val);
5122 if (Ty->isVarArg()) {
5124 for (; ArgI != ArgE; ++ArgI)
5125 Args.push_back(ArgI->Val); // push the remaining varargs
5126 } else if (I != E || ArgI != ArgE)
5127 GEN_ERROR("Invalid number of parameters detected");
5130 // Create the InvokeInst
5131 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5132 II->setCallingConv(yyvsp[-12].UIntVal);
5133 yyval.TermInstVal = II;
5134 delete yyvsp[-8].ValueRefList;
5140 #line 2644 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5142 yyval.TermInstVal = new UnwindInst();
5148 #line 2648 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5150 yyval.TermInstVal = new UnreachableInst();
5156 #line 2655 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5158 yyval.JumpTable = yyvsp[-5].JumpTable;
5159 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
5162 GEN_ERROR("May only switch on a constant pool value");
5164 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5166 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
5171 #line 2666 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5173 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
5174 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
5178 GEN_ERROR("May only switch on a constant pool value");
5180 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5182 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
5187 #line 2679 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5189 // Is this definition named?? if so, assign the name...
5190 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
5192 InsertValue(yyvsp[0].InstVal);
5193 yyval.InstVal = yyvsp[0].InstVal;
5199 #line 2689 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5200 { // Used for PHI nodes
5201 if (!UpRefs.empty())
5202 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
5203 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
5204 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
5206 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
5208 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
5209 delete yyvsp[-5].TypeVal;
5214 #line 2700 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5216 yyval.PHIList = yyvsp[-6].PHIList;
5217 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
5219 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
5221 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
5226 #line 2710 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5228 if (!UpRefs.empty())
5229 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5230 // Used for call and invoke instructions
5231 yyval.ValueRefList = new ValueRefList();
5232 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
5233 yyval.ValueRefList->push_back(E);
5234 delete yyvsp[-2].TypeVal;
5239 #line 2719 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5241 if (!UpRefs.empty())
5242 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5243 yyval.ValueRefList = yyvsp[-4].ValueRefList;
5244 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
5245 yyval.ValueRefList->push_back(E);
5246 delete yyvsp[-2].TypeVal;
5252 #line 2728 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5253 { yyval.ValueRefList = new ValueRefList(); }
5257 #line 2731 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5258 { yyval.ValueList = new std::vector<Value*>(); }
5262 #line 2732 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5264 yyval.ValueList = yyvsp[-2].ValueList;
5265 yyval.ValueList->push_back(yyvsp[0].ValueVal);
5271 #line 2739 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5273 yyval.BoolVal = true;
5279 #line 2743 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5281 yyval.BoolVal = false;
5287 #line 2748 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5289 if (!UpRefs.empty())
5290 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5291 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
5292 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5294 "Arithmetic operator requires integer, FP, or packed operands");
5295 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
5296 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
5297 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
5298 yyvsp[-4].BinaryOpVal == Instruction::FRem))
5299 GEN_ERROR("Remainder not supported on vector types");
5300 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5302 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5304 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
5305 if (yyval.InstVal == 0)
5306 GEN_ERROR("binary operator returned null");
5307 delete yyvsp[-3].TypeVal;
5312 #line 2769 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5314 if (!UpRefs.empty())
5315 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5316 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
5317 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
5318 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
5319 GEN_ERROR("Logical operator requires integral operands");
5321 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5323 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5325 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
5326 if (yyval.InstVal == 0)
5327 GEN_ERROR("binary operator returned null");
5328 delete yyvsp[-3].TypeVal;
5333 #line 2786 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5335 if (!UpRefs.empty())
5336 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5337 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5338 GEN_ERROR("Vector types not supported by icmp instruction");
5339 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5341 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5343 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
5344 if (yyval.InstVal == 0)
5345 GEN_ERROR("icmp operator returned null");
5346 delete yyvsp[-3].TypeVal;
5351 #line 2800 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5353 if (!UpRefs.empty())
5354 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5355 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5356 GEN_ERROR("Vector types not supported by fcmp instruction");
5357 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5359 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5361 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
5362 if (yyval.InstVal == 0)
5363 GEN_ERROR("fcmp operator returned null");
5364 delete yyvsp[-3].TypeVal;
5369 #line 2814 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5371 if (!UpRefs.empty())
5372 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
5373 Value* Val = yyvsp[-2].ValueVal;
5374 const Type* DestTy = yyvsp[0].TypeVal->get();
5375 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
5376 GEN_ERROR("invalid cast opcode for cast from '" +
5377 Val->getType()->getDescription() + "' to '" +
5378 DestTy->getDescription() + "'");
5379 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
5380 delete yyvsp[0].TypeVal;
5385 #line 2826 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5387 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
5388 GEN_ERROR("select condition must be boolean");
5389 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
5390 GEN_ERROR("select value types should match");
5391 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5397 #line 2834 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5399 if (!UpRefs.empty())
5400 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
5401 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
5402 delete yyvsp[0].TypeVal;
5408 #line 2841 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5410 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5411 GEN_ERROR("Invalid extractelement operands");
5412 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5418 #line 2847 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5420 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5421 GEN_ERROR("Invalid insertelement operands");
5422 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5428 #line 2853 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5430 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5431 GEN_ERROR("Invalid shufflevector operands");
5432 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5438 #line 2859 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5440 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
5441 if (!Ty->isFirstClassType())
5442 GEN_ERROR("PHI node operands must be of first class type");
5443 yyval.InstVal = new PHINode(Ty);
5444 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
5445 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
5446 if (yyvsp[0].PHIList->front().first->getType() != Ty)
5447 GEN_ERROR("All elements of a PHI node must be of the same type");
5448 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
5449 yyvsp[0].PHIList->pop_front();
5451 delete yyvsp[0].PHIList; // Free the list...
5457 #line 2875 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5460 // Handle the short syntax
5461 const PointerType *PFTy = 0;
5462 const FunctionType *Ty = 0;
5463 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
5464 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5465 // Pull out the types of all of the arguments...
5466 std::vector<const Type*> ParamTypes;
5467 ParamAttrsVector Attrs;
5468 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
5469 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
5470 Attrs.push_back(PAWI);
5473 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
5474 for (; I != E; ++I, ++index) {
5475 const Type *Ty = I->Val->getType();
5476 if (Ty == Type::VoidTy)
5477 GEN_ERROR("Short call syntax cannot be used with varargs");
5478 ParamTypes.push_back(Ty);
5479 if (I->Attrs != ParamAttr::None) {
5480 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5481 Attrs.push_back(PAWI);
5485 ParamAttrsList *PAL = 0;
5487 PAL = ParamAttrsList::get(Attrs);
5489 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
5490 PFTy = PointerType::get(Ty);
5493 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
5496 // Check for call to invalid intrinsic to avoid crashing later.
5497 if (Function *theF = dyn_cast<Function>(V)) {
5498 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5499 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5500 !theF->getIntrinsicID(true))
5501 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5502 theF->getName() + "'");
5505 // Check the arguments
5507 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
5508 // Make sure no arguments is a good thing!
5509 if (Ty->getNumParams() != 0)
5510 GEN_ERROR("No arguments passed to a function that "
5511 "expects arguments");
5512 } else { // Has arguments?
5513 // Loop through FunctionType's arguments and ensure they are specified
5516 FunctionType::param_iterator I = Ty->param_begin();
5517 FunctionType::param_iterator E = Ty->param_end();
5518 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
5520 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5521 if (ArgI->Val->getType() != *I)
5522 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5523 (*I)->getDescription() + "'");
5524 Args.push_back(ArgI->Val);
5526 if (Ty->isVarArg()) {
5528 for (; ArgI != ArgE; ++ArgI)
5529 Args.push_back(ArgI->Val); // push the remaining varargs
5530 } else if (I != E || ArgI != ArgE)
5531 GEN_ERROR("Invalid number of parameters detected");
5533 // Create the call node
5534 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5535 CI->setTailCall(yyvsp[-7].BoolVal);
5536 CI->setCallingConv(yyvsp[-6].UIntVal);
5538 delete yyvsp[-2].ValueRefList;
5539 delete yyvsp[-5].TypeVal;
5545 #line 2959 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5547 yyval.InstVal = yyvsp[0].InstVal;
5553 #line 2964 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5555 yyval.BoolVal = true;
5561 #line 2968 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5563 yyval.BoolVal = false;
5569 #line 2975 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5571 if (!UpRefs.empty())
5572 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5573 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5574 delete yyvsp[-1].TypeVal;
5580 #line 2982 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5582 if (!UpRefs.empty())
5583 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5584 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5586 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5587 delete yyvsp[-4].TypeVal;
5592 #line 2990 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5594 if (!UpRefs.empty())
5595 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5596 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5597 delete yyvsp[-1].TypeVal;
5603 #line 2997 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5605 if (!UpRefs.empty())
5606 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5607 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5609 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5610 delete yyvsp[-4].TypeVal;
5615 #line 3005 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5617 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5618 GEN_ERROR("Trying to free nonpointer type " +
5619 yyvsp[0].ValueVal->getType()->getDescription() + "");
5620 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5626 #line 3013 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5628 if (!UpRefs.empty())
5629 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5630 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5631 GEN_ERROR("Can't load from nonpointer type: " +
5632 (*yyvsp[-2].TypeVal)->getDescription());
5633 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5634 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5635 (*yyvsp[-2].TypeVal)->getDescription());
5636 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5638 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5639 delete yyvsp[-2].TypeVal;
5644 #line 3027 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5646 if (!UpRefs.empty())
5647 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5648 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5650 GEN_ERROR("Can't store to a nonpointer type: " +
5651 (*yyvsp[-2].TypeVal)->getDescription());
5652 const Type *ElTy = PT->getElementType();
5653 if (ElTy != yyvsp[-4].ValueVal->getType())
5654 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5655 "' into space of type '" + ElTy->getDescription() + "'");
5657 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5659 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5660 delete yyvsp[-2].TypeVal;
5665 #line 3044 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5667 if (!UpRefs.empty())
5668 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5669 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5670 GEN_ERROR("getelementptr insn requires pointer operand");
5672 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size(), true))
5673 GEN_ERROR("Invalid getelementptr indices for type '" +
5674 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5675 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5677 yyval.InstVal = new GetElementPtrInst(tmpVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size());
5678 delete yyvsp[-2].TypeVal;
5679 delete yyvsp[0].ValueList;
5686 /* Line 1016 of /usr/local/share/bison/yacc.c. */
5687 #line 5688 "llvmAsmParser.tab.c"
5696 short *yyssp1 = yyss - 1;
5697 YYFPRINTF (stderr, "state stack now");
5698 while (yyssp1 != yyssp)
5699 YYFPRINTF (stderr, " %d", *++yyssp1);
5700 YYFPRINTF (stderr, "\n");
5707 /* Now `shift' the result of the reduction. Determine what state
5708 that goes to, based on the state we popped back to and the rule
5709 number reduced by. */
5713 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5714 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5715 yystate = yytable[yystate];
5717 yystate = yydefgoto[yyn - YYNTOKENS];
5722 /*------------------------------------.
5723 | yyerrlab -- here on detecting error |
5724 `------------------------------------*/
5726 /* If not already recovering from an error, report this error. */
5731 yyn = yypact[yystate];
5733 if (YYPACT_NINF < yyn && yyn < YYLAST)
5735 YYSIZE_T yysize = 0;
5736 int yytype = YYTRANSLATE (yychar);
5741 /* Start YYX at -YYN if negative to avoid negative indexes in
5743 for (yyx = yyn < 0 ? -yyn : 0;
5744 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
5745 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5746 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
5747 yysize += yystrlen ("parse error, unexpected ") + 1;
5748 yysize += yystrlen (yytname[yytype]);
5749 yymsg = (char *) YYSTACK_ALLOC (yysize);
5752 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
5753 yyp = yystpcpy (yyp, yytname[yytype]);
5758 for (yyx = yyn < 0 ? -yyn : 0;
5759 yyx < (int) (sizeof (yytname) / sizeof (char *));
5761 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5763 const char *yyq = ! yycount ? ", expecting " : " or ";
5764 yyp = yystpcpy (yyp, yyq);
5765 yyp = yystpcpy (yyp, yytname[yyx]);
5770 YYSTACK_FREE (yymsg);
5773 yyerror ("parse error; also virtual memory exhausted");
5776 #endif /* YYERROR_VERBOSE */
5777 yyerror ("parse error");
5782 /*----------------------------------------------------.
5783 | yyerrlab1 -- error raised explicitly by an action. |
5784 `----------------------------------------------------*/
5786 if (yyerrstatus == 3)
5788 /* If just tried and failed to reuse lookahead token after an
5789 error, discard it. */
5791 /* Return failure if at end of input. */
5792 if (yychar == YYEOF)
5794 /* Pop the error token. */
5796 /* Pop the rest of the stack. */
5797 while (yyssp > yyss)
5799 YYDPRINTF ((stderr, "Error: popping "));
5800 YYDSYMPRINT ((stderr,
5803 YYDPRINTF ((stderr, "\n"));
5804 yydestruct (yystos[*yyssp], *yyvsp);
5810 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
5811 yychar, yytname[yychar1]));
5812 yydestruct (yychar1, yylval);
5816 /* Else will try to reuse lookahead token after shifting the error
5819 yyerrstatus = 3; /* Each real token shifted decrements this. */
5823 yyn = yypact[yystate];
5824 if (yyn != YYPACT_NINF)
5827 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5835 /* Pop the current state because it cannot handle the error token. */
5839 YYDPRINTF ((stderr, "Error: popping "));
5840 YYDSYMPRINT ((stderr,
5841 yystos[*yyssp], *yyvsp));
5842 YYDPRINTF ((stderr, "\n"));
5844 yydestruct (yystos[yystate], *yyvsp);
5852 short *yyssp1 = yyss - 1;
5853 YYFPRINTF (stderr, "Error: state stack now");
5854 while (yyssp1 != yyssp)
5855 YYFPRINTF (stderr, " %d", *++yyssp1);
5856 YYFPRINTF (stderr, "\n");
5864 YYDPRINTF ((stderr, "Shifting error token, "));
5873 /*-------------------------------------.
5874 | yyacceptlab -- YYACCEPT comes here. |
5875 `-------------------------------------*/
5880 /*-----------------------------------.
5881 | yyabortlab -- YYABORT comes here. |
5882 `-----------------------------------*/
5888 /*----------------------------------------------.
5889 | yyoverflowlab -- parser overflow comes here. |
5890 `----------------------------------------------*/
5892 yyerror ("parser stack overflow");
5900 YYSTACK_FREE (yyss);
5906 #line 3061 "/usr/home/jeffc/llvm/lib/AsmParser/llvmAsmParser.y"
5909 // common code from the two 'RunVMAsmParser' functions
5910 static Module* RunParser(Module * M) {
5912 llvmAsmlineno = 1; // Reset the current line number...
5913 CurModule.CurrentModule = M;
5918 // Check to make sure the parser succeeded
5921 delete ParserResult;
5925 // Emit an error if there are any unresolved types left.
5926 if (!CurModule.LateResolveTypes.empty()) {
5927 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5928 if (DID.Type == ValID::LocalName) {
5929 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5931 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5934 delete ParserResult;
5938 // Emit an error if there are any unresolved values left.
5939 if (!CurModule.LateResolveValues.empty()) {
5940 Value *V = CurModule.LateResolveValues.back();
5941 std::map<Value*, std::pair<ValID, int> >::iterator I =
5942 CurModule.PlaceHolderInfo.find(V);
5944 if (I != CurModule.PlaceHolderInfo.end()) {
5945 ValID &DID = I->second.first;
5946 if (DID.Type == ValID::LocalName) {
5947 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5949 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5952 delete ParserResult;
5957 // Check to make sure that parsing produced a result
5961 // Reset ParserResult variable while saving its value for the result.
5962 Module *Result = ParserResult;
5968 void llvm::GenerateError(const std::string &message, int LineNo) {
5969 if (LineNo == -1) LineNo = llvmAsmlineno;
5970 // TODO: column number in exception
5972 TheParseError->setError(CurFilename, message, LineNo);
5976 int yyerror(const char *ErrorMsg) {
5978 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5979 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5980 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5981 if (yychar != YYEMPTY && yychar != 0)
5982 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5984 GenerateError(errMsg);