1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, 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. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
85 PCTSTRINGCONSTANT = 276,
86 ZEROINITIALIZER = 277,
125 X86_STDCALLCC_TOK = 316,
126 X86_FASTCALLCC_TOK = 317,
192 EXTRACTELEMENT = 383,
210 #define ESINT64VAL 258
211 #define EUINT64VAL 259
212 #define ESAPINTVAL 260
213 #define EUAPINTVAL 261
214 #define LOCALVAL_ID 262
215 #define GLOBALVAL_ID 263
224 #define GLOBALVAR 272
226 #define STRINGCONSTANT 274
227 #define ATSTRINGCONSTANT 275
228 #define PCTSTRINGCONSTANT 276
229 #define ZEROINITIALIZER 277
241 #define THREAD_LOCAL 289
243 #define DOTDOTDOT 291
249 #define APPENDING 297
250 #define DLLIMPORT 298
251 #define DLLEXPORT 299
252 #define EXTERN_WEAK 300
263 #define SIDEEFFECT 311
266 #define FASTCC_TOK 314
267 #define COLDCC_TOK 315
268 #define X86_STDCALLCC_TOK 316
269 #define X86_FASTCALLCC_TOK 317
270 #define DATALAYOUT 318
276 #define UNREACHABLE 324
319 #define GETELEMENTPTR 367
335 #define EXTRACTELEMENT 383
336 #define INSERTELEMENT 384
337 #define SHUFFLEVECTOR 385
349 #define PROTECTED 397
354 /* Copy the first part of user declarations. */
355 #line 14 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
357 #include "ParserInternals.h"
358 #include "llvm/CallingConv.h"
359 #include "llvm/InlineAsm.h"
360 #include "llvm/Instructions.h"
361 #include "llvm/Module.h"
362 #include "llvm/ValueSymbolTable.h"
363 #include "llvm/Support/GetElementPtrTypeIterator.h"
364 #include "llvm/Support/CommandLine.h"
365 #include "llvm/ADT/SmallVector.h"
366 #include "llvm/ADT/STLExtras.h"
367 #include "llvm/Support/MathExtras.h"
368 #include "llvm/Support/Streams.h"
377 // The following is a gross hack. In order to rid the libAsmParser library of
378 // exceptions, we have to have a way of getting the yyparse function to go into
379 // an error situation. So, whenever we want an error to occur, the GenerateError
380 // function (see bottom of file) sets TriggerError. Then, at the end of each
381 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
382 // (a goto) to put YACC in error state. Furthermore, several calls to
383 // GenerateError are made from inside productions and they must simulate the
384 // previous exception behavior by exiting the production immediately. We have
385 // replaced these with the GEN_ERROR macro which calls GeneratError and then
386 // immediately invokes YYERROR. This would be so much cleaner if it was a
387 // recursive descent parser.
388 static bool TriggerError = false;
389 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
390 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
392 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
393 int yylex(); // declaration" of xxx warnings.
397 std::string CurFilename;
400 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
401 cl::Hidden, cl::init(false));
404 using namespace llvm;
406 static Module *ParserResult;
408 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
409 // relating to upreferences in the input stream.
411 //#define DEBUG_UPREFS 1
413 #define UR_OUT(X) cerr << X
418 #define YYERROR_VERBOSE 1
420 static GlobalVariable *CurGV;
423 // This contains info used when building the body of a function. It is
424 // destroyed when the function is completed.
426 typedef std::vector<Value *> ValueList; // Numbered defs
429 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
431 static struct PerModuleInfo {
432 Module *CurrentModule;
433 ValueList Values; // Module level numbered definitions
434 ValueList LateResolveValues;
435 std::vector<PATypeHolder> Types;
436 std::map<ValID, PATypeHolder> LateResolveTypes;
438 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
439 /// how they were referenced and on which line of the input they came from so
440 /// that we can resolve them later and print error messages as appropriate.
441 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
443 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
444 // references to global values. Global values may be referenced before they
445 // are defined, and if so, the temporary object that they represent is held
446 // here. This is used for forward references of GlobalValues.
448 typedef std::map<std::pair<const PointerType *,
449 ValID>, GlobalValue*> GlobalRefsType;
450 GlobalRefsType GlobalRefs;
453 // If we could not resolve some functions at function compilation time
454 // (calls to functions before they are defined), resolve them now... Types
455 // are resolved when the constant pool has been completely parsed.
457 ResolveDefinitions(LateResolveValues);
461 // Check to make sure that all global value forward references have been
464 if (!GlobalRefs.empty()) {
465 std::string UndefinedReferences = "Unresolved global references exist:\n";
467 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
469 UndefinedReferences += " " + I->first.first->getDescription() + " " +
470 I->first.second.getName() + "\n";
472 GenerateError(UndefinedReferences);
476 Values.clear(); // Clear out function local definitions
481 // GetForwardRefForGlobal - Check to see if there is a forward reference
482 // for this global. If so, remove it from the GlobalRefs map and return it.
483 // If not, just return null.
484 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
485 // Check to see if there is a forward reference to this global variable...
486 // if there is, eliminate it and patch the reference to use the new def'n.
487 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
488 GlobalValue *Ret = 0;
489 if (I != GlobalRefs.end()) {
496 bool TypeIsUnresolved(PATypeHolder* PATy) {
497 // If it isn't abstract, its resolved
498 const Type* Ty = PATy->get();
499 if (!Ty->isAbstract())
501 // Traverse the type looking for abstract types. If it isn't abstract then
502 // we don't need to traverse that leg of the type.
503 std::vector<const Type*> WorkList, SeenList;
504 WorkList.push_back(Ty);
505 while (!WorkList.empty()) {
506 const Type* Ty = WorkList.back();
507 SeenList.push_back(Ty);
509 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
510 // Check to see if this is an unresolved type
511 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
512 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
513 for ( ; I != E; ++I) {
514 if (I->second.get() == OpTy)
517 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
518 const Type* TheTy = SeqTy->getElementType();
519 if (TheTy->isAbstract() && TheTy != Ty) {
520 std::vector<const Type*>::iterator I = SeenList.begin(),
526 WorkList.push_back(TheTy);
528 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
529 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
530 const Type* TheTy = StrTy->getElementType(i);
531 if (TheTy->isAbstract() && TheTy != Ty) {
532 std::vector<const Type*>::iterator I = SeenList.begin(),
538 WorkList.push_back(TheTy);
547 static struct PerFunctionInfo {
548 Function *CurrentFunction; // Pointer to current function being created
550 ValueList Values; // Keep track of #'d definitions
552 ValueList LateResolveValues;
553 bool isDeclare; // Is this function a forward declararation?
554 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
555 GlobalValue::VisibilityTypes Visibility;
557 /// BBForwardRefs - When we see forward references to basic blocks, keep
558 /// track of them here.
559 std::map<ValID, BasicBlock*> BBForwardRefs;
561 inline PerFunctionInfo() {
564 Linkage = GlobalValue::ExternalLinkage;
565 Visibility = GlobalValue::DefaultVisibility;
568 inline void FunctionStart(Function *M) {
573 void FunctionDone() {
574 // Any forward referenced blocks left?
575 if (!BBForwardRefs.empty()) {
576 GenerateError("Undefined reference to label " +
577 BBForwardRefs.begin()->second->getName());
581 // Resolve all forward references now.
582 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
584 Values.clear(); // Clear out function local definitions
585 BBForwardRefs.clear();
588 Linkage = GlobalValue::ExternalLinkage;
589 Visibility = GlobalValue::DefaultVisibility;
591 } CurFun; // Info for the current function...
593 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
596 //===----------------------------------------------------------------------===//
597 // Code to handle definitions of all the types
598 //===----------------------------------------------------------------------===//
600 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
601 // Things that have names or are void typed don't get slot numbers
602 if (V->hasName() || (V->getType() == Type::VoidTy))
605 // In the case of function values, we have to allow for the forward reference
606 // of basic blocks, which are included in the numbering. Consequently, we keep
607 // track of the next insertion location with NextValNum. When a BB gets
608 // inserted, it could change the size of the CurFun.Values vector.
609 if (&ValueTab == &CurFun.Values) {
610 if (ValueTab.size() <= CurFun.NextValNum)
611 ValueTab.resize(CurFun.NextValNum+1);
612 ValueTab[CurFun.NextValNum++] = V;
615 // For all other lists, its okay to just tack it on the back of the vector.
616 ValueTab.push_back(V);
619 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
621 case ValID::LocalID: // Is it a numbered definition?
622 // Module constants occupy the lowest numbered slots...
623 if (D.Num < CurModule.Types.size())
624 return CurModule.Types[D.Num];
626 case ValID::LocalName: // Is it a named definition?
627 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
628 D.destroy(); // Free old strdup'd memory...
633 GenerateError("Internal parser error: Invalid symbol type reference");
637 // If we reached here, we referenced either a symbol that we don't know about
638 // or an id number that hasn't been read yet. We may be referencing something
639 // forward, so just create an entry to be resolved later and get to it...
641 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
644 if (inFunctionScope()) {
645 if (D.Type == ValID::LocalName) {
646 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
649 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
654 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
655 if (I != CurModule.LateResolveTypes.end())
658 Type *Typ = OpaqueType::get();
659 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
663 // getExistingVal - Look up the value specified by the provided type and
664 // the provided ValID. If the value exists and has already been defined, return
665 // it. Otherwise return null.
667 static Value *getExistingVal(const Type *Ty, const ValID &D) {
668 if (isa<FunctionType>(Ty)) {
669 GenerateError("Functions are not values and "
670 "must be referenced as pointers");
675 case ValID::LocalID: { // Is it a numbered definition?
676 // Check that the number is within bounds.
677 if (D.Num >= CurFun.Values.size())
679 Value *Result = CurFun.Values[D.Num];
680 if (Ty != Result->getType()) {
681 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
682 Result->getType()->getDescription() + "' does not match "
683 "expected type, '" + Ty->getDescription() + "'");
688 case ValID::GlobalID: { // Is it a numbered definition?
689 if (D.Num >= CurModule.Values.size())
691 Value *Result = CurModule.Values[D.Num];
692 if (Ty != Result->getType()) {
693 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
694 Result->getType()->getDescription() + "' does not match "
695 "expected type, '" + Ty->getDescription() + "'");
701 case ValID::LocalName: { // Is it a named definition?
702 if (!inFunctionScope())
704 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
705 Value *N = SymTab.lookup(D.getName());
708 if (N->getType() != Ty)
711 D.destroy(); // Free old strdup'd memory...
714 case ValID::GlobalName: { // Is it a named definition?
715 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
716 Value *N = SymTab.lookup(D.getName());
719 if (N->getType() != Ty)
722 D.destroy(); // Free old strdup'd memory...
726 // Check to make sure that "Ty" is an integral type, and that our
727 // value will fit into the specified type...
728 case ValID::ConstSIntVal: // Is it a constant pool reference??
729 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
730 GenerateError("Signed integral constant '" +
731 itostr(D.ConstPool64) + "' is invalid for type '" +
732 Ty->getDescription() + "'");
735 return ConstantInt::get(Ty, D.ConstPool64, true);
737 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
738 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
739 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
740 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
741 "' is invalid or out of range");
743 } else { // This is really a signed reference. Transmogrify.
744 return ConstantInt::get(Ty, D.ConstPool64, true);
747 return ConstantInt::get(Ty, D.UConstPool64);
750 case ValID::ConstFPVal: // Is it a floating point const pool reference?
751 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
752 GenerateError("FP constant invalid for type");
755 return ConstantFP::get(Ty, D.ConstPoolFP);
757 case ValID::ConstNullVal: // Is it a null value?
758 if (!isa<PointerType>(Ty)) {
759 GenerateError("Cannot create a a non pointer null");
762 return ConstantPointerNull::get(cast<PointerType>(Ty));
764 case ValID::ConstUndefVal: // Is it an undef value?
765 return UndefValue::get(Ty);
767 case ValID::ConstZeroVal: // Is it a zero value?
768 return Constant::getNullValue(Ty);
770 case ValID::ConstantVal: // Fully resolved constant?
771 if (D.ConstantValue->getType() != Ty) {
772 GenerateError("Constant expression type different from required type");
775 return D.ConstantValue;
777 case ValID::InlineAsmVal: { // Inline asm expression
778 const PointerType *PTy = dyn_cast<PointerType>(Ty);
779 const FunctionType *FTy =
780 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
781 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
782 GenerateError("Invalid type for asm constraint string");
785 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
786 D.IAD->HasSideEffects);
787 D.destroy(); // Free InlineAsmDescriptor.
791 assert(0 && "Unhandled case!");
795 assert(0 && "Unhandled case!");
799 // getVal - This function is identical to getExistingVal, except that if a
800 // value is not already defined, it "improvises" by creating a placeholder var
801 // that looks and acts just like the requested variable. When the value is
802 // defined later, all uses of the placeholder variable are replaced with the
805 static Value *getVal(const Type *Ty, const ValID &ID) {
806 if (Ty == Type::LabelTy) {
807 GenerateError("Cannot use a basic block here");
811 // See if the value has already been defined.
812 Value *V = getExistingVal(Ty, ID);
814 if (TriggerError) return 0;
816 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
817 GenerateError("Invalid use of a composite type");
821 // If we reached here, we referenced either a symbol that we don't know about
822 // or an id number that hasn't been read yet. We may be referencing something
823 // forward, so just create an entry to be resolved later and get to it...
826 case ValID::GlobalName:
827 case ValID::GlobalID: {
828 const PointerType *PTy = dyn_cast<PointerType>(Ty);
830 GenerateError("Invalid type for reference to global" );
833 const Type* ElTy = PTy->getElementType();
834 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
835 V = new Function(FTy, GlobalValue::ExternalLinkage);
837 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
841 V = new Argument(Ty);
844 // Remember where this forward reference came from. FIXME, shouldn't we try
845 // to recycle these things??
846 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
849 if (inFunctionScope())
850 InsertValue(V, CurFun.LateResolveValues);
852 InsertValue(V, CurModule.LateResolveValues);
856 /// defineBBVal - This is a definition of a new basic block with the specified
857 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
858 static BasicBlock *defineBBVal(const ValID &ID) {
859 assert(inFunctionScope() && "Can't get basic block at global scope!");
863 // First, see if this was forward referenced
865 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
866 if (BBI != CurFun.BBForwardRefs.end()) {
868 // The forward declaration could have been inserted anywhere in the
869 // function: insert it into the correct place now.
870 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
871 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
873 // We're about to erase the entry, save the key so we can clean it up.
874 ValID Tmp = BBI->first;
876 // Erase the forward ref from the map as its no longer "forward"
877 CurFun.BBForwardRefs.erase(ID);
879 // The key has been removed from the map but so we don't want to leave
880 // strdup'd memory around so destroy it too.
883 // If its a numbered definition, bump the number and set the BB value.
884 if (ID.Type == ValID::LocalID) {
885 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
893 // We haven't seen this BB before and its first mention is a definition.
894 // Just create it and return it.
895 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
896 BB = new BasicBlock(Name, CurFun.CurrentFunction);
897 if (ID.Type == ValID::LocalID) {
898 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
902 ID.destroy(); // Free strdup'd memory
906 /// getBBVal - get an existing BB value or create a forward reference for it.
908 static BasicBlock *getBBVal(const ValID &ID) {
909 assert(inFunctionScope() && "Can't get basic block at global scope!");
913 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
914 if (BBI != CurFun.BBForwardRefs.end()) {
916 } if (ID.Type == ValID::LocalName) {
917 std::string Name = ID.getName();
918 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
920 if (N->getType()->getTypeID() == Type::LabelTyID)
921 BB = cast<BasicBlock>(N);
923 GenerateError("Reference to label '" + Name + "' is actually of type '"+
924 N->getType()->getDescription() + "'");
925 } else if (ID.Type == ValID::LocalID) {
926 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
927 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
928 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
930 GenerateError("Reference to label '%" + utostr(ID.Num) +
931 "' is actually of type '"+
932 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
935 GenerateError("Illegal label reference " + ID.getName());
939 // If its already been defined, return it now.
941 ID.destroy(); // Free strdup'd memory.
945 // Otherwise, this block has not been seen before, create it.
947 if (ID.Type == ValID::LocalName)
949 BB = new BasicBlock(Name, CurFun.CurrentFunction);
951 // Insert it in the forward refs map.
952 CurFun.BBForwardRefs[ID] = BB;
958 //===----------------------------------------------------------------------===//
959 // Code to handle forward references in instructions
960 //===----------------------------------------------------------------------===//
962 // This code handles the late binding needed with statements that reference
963 // values not defined yet... for example, a forward branch, or the PHI node for
966 // This keeps a table (CurFun.LateResolveValues) of all such forward references
967 // and back patchs after we are done.
970 // ResolveDefinitions - If we could not resolve some defs at parsing
971 // time (forward branches, phi functions for loops, etc...) resolve the
975 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
976 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
977 while (!LateResolvers.empty()) {
978 Value *V = LateResolvers.back();
979 LateResolvers.pop_back();
981 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
982 CurModule.PlaceHolderInfo.find(V);
983 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
985 ValID &DID = PHI->second.first;
987 Value *TheRealValue = getExistingVal(V->getType(), DID);
991 V->replaceAllUsesWith(TheRealValue);
993 CurModule.PlaceHolderInfo.erase(PHI);
994 } else if (FutureLateResolvers) {
995 // Functions have their unresolved items forwarded to the module late
997 InsertValue(V, *FutureLateResolvers);
999 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1000 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1001 "' of type '" + V->getType()->getDescription() + "'",
1002 PHI->second.second);
1005 GenerateError("Reference to an invalid definition: #" +
1006 itostr(DID.Num) + " of type '" +
1007 V->getType()->getDescription() + "'",
1008 PHI->second.second);
1013 LateResolvers.clear();
1016 // ResolveTypeTo - A brand new type was just declared. This means that (if
1017 // name is not null) things referencing Name can be resolved. Otherwise, things
1018 // refering to the number can be resolved. Do this now.
1020 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1023 D = ValID::createLocalName(*Name);
1025 D = ValID::createLocalID(CurModule.Types.size());
1027 std::map<ValID, PATypeHolder>::iterator I =
1028 CurModule.LateResolveTypes.find(D);
1029 if (I != CurModule.LateResolveTypes.end()) {
1030 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1031 CurModule.LateResolveTypes.erase(I);
1035 // setValueName - Set the specified value to the name given. The name may be
1036 // null potentially, in which case this is a noop. The string passed in is
1037 // assumed to be a malloc'd string buffer, and is free'd by this function.
1039 static void setValueName(Value *V, std::string *NameStr) {
1040 if (!NameStr) return;
1041 std::string Name(*NameStr); // Copy string
1042 delete NameStr; // Free old string
1044 if (V->getType() == Type::VoidTy) {
1045 GenerateError("Can't assign name '" + Name+"' to value with void type");
1049 assert(inFunctionScope() && "Must be in function scope!");
1050 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1051 if (ST.lookup(Name)) {
1052 GenerateError("Redefinition of value '" + Name + "' of type '" +
1053 V->getType()->getDescription() + "'");
1061 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1062 /// this is a declaration, otherwise it is a definition.
1063 static GlobalVariable *
1064 ParseGlobalVariable(std::string *NameStr,
1065 GlobalValue::LinkageTypes Linkage,
1066 GlobalValue::VisibilityTypes Visibility,
1067 bool isConstantGlobal, const Type *Ty,
1068 Constant *Initializer, bool IsThreadLocal) {
1069 if (isa<FunctionType>(Ty)) {
1070 GenerateError("Cannot declare global vars of function type");
1074 const PointerType *PTy = PointerType::get(Ty);
1078 Name = *NameStr; // Copy string
1079 delete NameStr; // Free old string
1082 // See if this global value was forward referenced. If so, recycle the
1085 if (!Name.empty()) {
1086 ID = ValID::createGlobalName(Name);
1088 ID = ValID::createGlobalID(CurModule.Values.size());
1091 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1092 // Move the global to the end of the list, from whereever it was
1093 // previously inserted.
1094 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1095 CurModule.CurrentModule->getGlobalList().remove(GV);
1096 CurModule.CurrentModule->getGlobalList().push_back(GV);
1097 GV->setInitializer(Initializer);
1098 GV->setLinkage(Linkage);
1099 GV->setVisibility(Visibility);
1100 GV->setConstant(isConstantGlobal);
1101 GV->setThreadLocal(IsThreadLocal);
1102 InsertValue(GV, CurModule.Values);
1106 // If this global has a name
1107 if (!Name.empty()) {
1108 // if the global we're parsing has an initializer (is a definition) and
1109 // has external linkage.
1110 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1111 // If there is already a global with external linkage with this name
1112 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1113 // If we allow this GVar to get created, it will be renamed in the
1114 // symbol table because it conflicts with an existing GVar. We can't
1115 // allow redefinition of GVars whose linking indicates that their name
1116 // must stay the same. Issue the error.
1117 GenerateError("Redefinition of global variable named '" + Name +
1118 "' of type '" + Ty->getDescription() + "'");
1123 // Otherwise there is no existing GV to use, create one now.
1124 GlobalVariable *GV =
1125 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1126 CurModule.CurrentModule, IsThreadLocal);
1127 GV->setVisibility(Visibility);
1128 InsertValue(GV, CurModule.Values);
1132 // setTypeName - Set the specified type to the name given. The name may be
1133 // null potentially, in which case this is a noop. The string passed in is
1134 // assumed to be a malloc'd string buffer, and is freed by this function.
1136 // This function returns true if the type has already been defined, but is
1137 // allowed to be redefined in the specified context. If the name is a new name
1138 // for the type plane, it is inserted and false is returned.
1139 static bool setTypeName(const Type *T, std::string *NameStr) {
1140 assert(!inFunctionScope() && "Can't give types function-local names!");
1141 if (NameStr == 0) return false;
1143 std::string Name(*NameStr); // Copy string
1144 delete NameStr; // Free old string
1146 // We don't allow assigning names to void type
1147 if (T == Type::VoidTy) {
1148 GenerateError("Can't assign name '" + Name + "' to the void type");
1152 // Set the type name, checking for conflicts as we do so.
1153 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1155 if (AlreadyExists) { // Inserting a name that is already defined???
1156 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1157 assert(Existing && "Conflict but no matching type?!");
1159 // There is only one case where this is allowed: when we are refining an
1160 // opaque type. In this case, Existing will be an opaque type.
1161 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1162 // We ARE replacing an opaque type!
1163 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1167 // Otherwise, this is an attempt to redefine a type. That's okay if
1168 // the redefinition is identical to the original. This will be so if
1169 // Existing and T point to the same Type object. In this one case we
1170 // allow the equivalent redefinition.
1171 if (Existing == T) return true; // Yes, it's equal.
1173 // Any other kind of (non-equivalent) redefinition is an error.
1174 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1175 T->getDescription() + "'");
1181 //===----------------------------------------------------------------------===//
1182 // Code for handling upreferences in type names...
1185 // TypeContains - Returns true if Ty directly contains E in it.
1187 static bool TypeContains(const Type *Ty, const Type *E) {
1188 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1189 E) != Ty->subtype_end();
1193 struct UpRefRecord {
1194 // NestingLevel - The number of nesting levels that need to be popped before
1195 // this type is resolved.
1196 unsigned NestingLevel;
1198 // LastContainedTy - This is the type at the current binding level for the
1199 // type. Every time we reduce the nesting level, this gets updated.
1200 const Type *LastContainedTy;
1202 // UpRefTy - This is the actual opaque type that the upreference is
1203 // represented with.
1204 OpaqueType *UpRefTy;
1206 UpRefRecord(unsigned NL, OpaqueType *URTy)
1207 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1211 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1212 static std::vector<UpRefRecord> UpRefs;
1214 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1215 /// called. It loops through the UpRefs vector, which is a list of the
1216 /// currently active types. For each type, if the up reference is contained in
1217 /// the newly completed type, we decrement the level count. When the level
1218 /// count reaches zero, the upreferenced type is the type that is passed in:
1219 /// thus we can complete the cycle.
1221 static PATypeHolder HandleUpRefs(const Type *ty) {
1222 // If Ty isn't abstract, or if there are no up-references in it, then there is
1223 // nothing to resolve here.
1224 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1226 PATypeHolder Ty(ty);
1227 UR_OUT("Type '" << Ty->getDescription() <<
1228 "' newly formed. Resolving upreferences.\n" <<
1229 UpRefs.size() << " upreferences active!\n");
1231 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1232 // to zero), we resolve them all together before we resolve them to Ty. At
1233 // the end of the loop, if there is anything to resolve to Ty, it will be in
1235 OpaqueType *TypeToResolve = 0;
1237 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1238 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1239 << UpRefs[i].second->getDescription() << ") = "
1240 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1241 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1242 // Decrement level of upreference
1243 unsigned Level = --UpRefs[i].NestingLevel;
1244 UpRefs[i].LastContainedTy = Ty;
1245 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1246 if (Level == 0) { // Upreference should be resolved!
1247 if (!TypeToResolve) {
1248 TypeToResolve = UpRefs[i].UpRefTy;
1250 UR_OUT(" * Resolving upreference for "
1251 << UpRefs[i].second->getDescription() << "\n";
1252 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1253 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1254 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1255 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1257 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1258 --i; // Do not skip the next element...
1263 if (TypeToResolve) {
1264 UR_OUT(" * Resolving upreference for "
1265 << UpRefs[i].second->getDescription() << "\n";
1266 std::string OldName = TypeToResolve->getDescription());
1267 TypeToResolve->refineAbstractTypeTo(Ty);
1273 //===----------------------------------------------------------------------===//
1274 // RunVMAsmParser - Define an interface to this parser
1275 //===----------------------------------------------------------------------===//
1277 static Module* RunParser(Module * M);
1279 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1282 CurFilename = Filename;
1283 return RunParser(new Module(CurFilename));
1286 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1287 set_scan_string(AsmString);
1289 CurFilename = "from_memory";
1291 return RunParser(new Module (CurFilename));
1293 return RunParser(M);
1299 /* Enabling traces. */
1304 /* Enabling verbose error messages. */
1305 #ifdef YYERROR_VERBOSE
1306 # undef YYERROR_VERBOSE
1307 # define YYERROR_VERBOSE 1
1309 # define YYERROR_VERBOSE 0
1312 /* Enabling the token table. */
1313 #ifndef YYTOKEN_TABLE
1314 # define YYTOKEN_TABLE 0
1317 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1318 #line 957 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
1319 typedef union YYSTYPE {
1320 llvm::Module *ModuleVal;
1321 llvm::Function *FunctionVal;
1322 llvm::BasicBlock *BasicBlockVal;
1323 llvm::TerminatorInst *TermInstVal;
1324 llvm::Instruction *InstVal;
1325 llvm::Constant *ConstVal;
1327 const llvm::Type *PrimType;
1328 std::list<llvm::PATypeHolder> *TypeList;
1329 llvm::PATypeHolder *TypeVal;
1330 llvm::Value *ValueVal;
1331 std::vector<llvm::Value*> *ValueList;
1332 llvm::ArgListType *ArgList;
1333 llvm::TypeWithAttrs TypeWithAttrs;
1334 llvm::TypeWithAttrsList *TypeWithAttrsList;
1335 llvm::ValueRefList *ValueRefList;
1337 // Represent the RHS of PHI node
1338 std::list<std::pair<llvm::Value*,
1339 llvm::BasicBlock*> > *PHIList;
1340 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1341 std::vector<llvm::Constant*> *ConstVector;
1343 llvm::GlobalValue::LinkageTypes Linkage;
1344 llvm::GlobalValue::VisibilityTypes Visibility;
1345 uint16_t ParamAttrs;
1346 llvm::APInt *APIntVal;
1354 std::string *StrVal; // This memory must be deleted
1355 llvm::ValID ValIDVal;
1357 llvm::Instruction::BinaryOps BinaryOpVal;
1358 llvm::Instruction::TermOps TermOpVal;
1359 llvm::Instruction::MemoryOps MemOpVal;
1360 llvm::Instruction::CastOps CastOpVal;
1361 llvm::Instruction::OtherOps OtherOpVal;
1362 llvm::ICmpInst::Predicate IPredicate;
1363 llvm::FCmpInst::Predicate FPredicate;
1365 /* Line 196 of yacc.c. */
1366 #line 1367 "llvmAsmParser.tab.c"
1367 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1368 # define YYSTYPE_IS_DECLARED 1
1369 # define YYSTYPE_IS_TRIVIAL 1
1374 /* Copy the second part of user declarations. */
1377 /* Line 219 of yacc.c. */
1378 #line 1379 "llvmAsmParser.tab.c"
1380 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1381 # define YYSIZE_T __SIZE_TYPE__
1383 #if ! defined (YYSIZE_T) && defined (size_t)
1384 # define YYSIZE_T size_t
1386 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1387 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1388 # define YYSIZE_T size_t
1390 #if ! defined (YYSIZE_T)
1391 # define YYSIZE_T unsigned int
1397 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1398 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1402 # define YY_(msgid) msgid
1406 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1408 /* The parser invokes alloca or malloc; define the necessary symbols. */
1410 # ifdef YYSTACK_USE_ALLOCA
1411 # if YYSTACK_USE_ALLOCA
1413 # define YYSTACK_ALLOC __builtin_alloca
1415 # define YYSTACK_ALLOC alloca
1416 # if defined (__STDC__) || defined (__cplusplus)
1417 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1418 # define YYINCLUDED_STDLIB_H
1424 # ifdef YYSTACK_ALLOC
1425 /* Pacify GCC's `empty if-body' warning. */
1426 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1427 # ifndef YYSTACK_ALLOC_MAXIMUM
1428 /* The OS might guarantee only one guard page at the bottom of the stack,
1429 and a page size can be as small as 4096 bytes. So we cannot safely
1430 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1431 to allow for a few compiler-allocated temporary stack slots. */
1432 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1435 # define YYSTACK_ALLOC YYMALLOC
1436 # define YYSTACK_FREE YYFREE
1437 # ifndef YYSTACK_ALLOC_MAXIMUM
1438 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1444 # define YYMALLOC malloc
1445 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1446 && (defined (__STDC__) || defined (__cplusplus)))
1447 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1451 # define YYFREE free
1452 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1453 && (defined (__STDC__) || defined (__cplusplus)))
1454 void free (void *); /* INFRINGES ON USER NAME SPACE */
1461 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1464 #if (! defined (yyoverflow) \
1465 && (! defined (__cplusplus) \
1466 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1468 /* A type that is properly aligned for any stack member. */
1475 /* The size of the maximum gap between one aligned stack and the next. */
1476 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1478 /* The size of an array large to enough to hold all stacks, each with
1480 # define YYSTACK_BYTES(N) \
1481 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1482 + YYSTACK_GAP_MAXIMUM)
1484 /* Copy COUNT objects from FROM to TO. The source and destination do
1487 # if defined (__GNUC__) && 1 < __GNUC__
1488 # define YYCOPY(To, From, Count) \
1489 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1491 # define YYCOPY(To, From, Count) \
1495 for (yyi = 0; yyi < (Count); yyi++) \
1496 (To)[yyi] = (From)[yyi]; \
1502 /* Relocate STACK from its old location to the new one. The
1503 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1504 elements in the stack, and YYPTR gives the new location of the
1505 stack. Advance YYPTR to a properly aligned location for the next
1507 # define YYSTACK_RELOCATE(Stack) \
1510 YYSIZE_T yynewbytes; \
1511 YYCOPY (&yyptr->Stack, Stack, yysize); \
1512 Stack = &yyptr->Stack; \
1513 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1514 yyptr += yynewbytes / sizeof (*yyptr); \
1520 #if defined (__STDC__) || defined (__cplusplus)
1521 typedef signed char yysigned_char;
1523 typedef short int yysigned_char;
1526 /* YYFINAL -- State number of the termination state. */
1528 /* YYLAST -- Last index in YYTABLE. */
1531 /* YYNTOKENS -- Number of terminals. */
1532 #define YYNTOKENS 157
1533 /* YYNNTS -- Number of nonterminals. */
1535 /* YYNRULES -- Number of rules. */
1536 #define YYNRULES 304
1537 /* YYNRULES -- Number of states. */
1538 #define YYNSTATES 588
1540 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1541 #define YYUNDEFTOK 2
1542 #define YYMAXUTOK 397
1544 #define YYTRANSLATE(YYX) \
1545 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1547 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1548 static const unsigned char yytranslate[] =
1550 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1554 147, 148, 145, 2, 144, 2, 2, 2, 2, 2,
1555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1556 152, 143, 153, 2, 2, 2, 2, 2, 2, 2,
1557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1559 2, 149, 146, 151, 2, 2, 2, 2, 2, 156,
1560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1562 150, 2, 2, 154, 2, 155, 2, 2, 2, 2,
1563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1575 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1576 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1577 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1578 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1579 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1580 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1581 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1582 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1583 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1584 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1585 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1586 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1587 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1588 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1589 135, 136, 137, 138, 139, 140, 141, 142
1593 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1595 static const unsigned short int yyprhs[] =
1597 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1598 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1599 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1600 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1601 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1602 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1603 119, 121, 123, 124, 127, 128, 130, 132, 134, 135,
1604 138, 140, 142, 144, 146, 148, 150, 152, 154, 155,
1605 157, 159, 161, 162, 164, 166, 167, 169, 171, 173,
1606 175, 176, 178, 180, 181, 183, 185, 187, 189, 191,
1607 194, 196, 198, 200, 202, 204, 206, 208, 210, 212,
1608 213, 216, 218, 220, 222, 224, 225, 228, 229, 232,
1609 233, 237, 240, 241, 243, 244, 248, 250, 253, 255,
1610 257, 259, 261, 263, 265, 268, 270, 273, 279, 285,
1611 291, 297, 301, 304, 310, 315, 318, 320, 322, 324,
1612 328, 330, 334, 336, 337, 339, 343, 348, 352, 356,
1613 361, 366, 370, 377, 383, 386, 389, 392, 395, 398,
1614 401, 404, 407, 410, 413, 416, 419, 426, 432, 441,
1615 448, 455, 463, 471, 478, 487, 496, 500, 502, 504,
1616 506, 508, 509, 512, 519, 521, 522, 524, 527, 528,
1617 532, 533, 537, 541, 545, 549, 550, 558, 559, 568,
1618 569, 578, 584, 587, 591, 593, 597, 601, 605, 609,
1619 611, 612, 618, 622, 624, 628, 630, 631, 641, 643,
1620 645, 650, 652, 654, 657, 661, 662, 664, 666, 668,
1621 670, 672, 674, 676, 678, 680, 684, 686, 692, 694,
1622 696, 698, 700, 702, 704, 707, 710, 713, 717, 720,
1623 721, 723, 726, 729, 733, 743, 753, 762, 777, 779,
1624 781, 788, 794, 797, 804, 812, 816, 822, 823, 824,
1625 828, 831, 833, 839, 845, 852, 859, 864, 871, 876,
1626 881, 888, 895, 898, 907, 909, 911, 912, 916, 923,
1627 927, 934, 937, 943, 951
1630 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1631 static const short int yyrhs[] =
1633 201, 0, -1, 70, -1, 71, -1, 72, -1, 73,
1634 -1, 74, -1, 75, -1, 76, -1, 77, -1, 78,
1635 -1, 82, -1, 83, -1, 84, -1, 79, -1, 80,
1636 -1, 81, -1, 113, -1, 114, -1, 115, -1, 116,
1637 -1, 117, -1, 118, -1, 119, -1, 120, -1, 121,
1638 -1, 122, -1, 123, -1, 124, -1, 87, -1, 88,
1639 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1640 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1641 -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
1642 -1, 104, -1, 105, -1, 106, -1, 93, -1, 94,
1643 -1, 95, -1, 96, -1, 23, -1, 24, -1, 11,
1644 -1, 12, -1, 13, -1, 16, -1, 19, -1, 21,
1645 -1, 165, -1, -1, 165, 143, -1, -1, 17, -1,
1646 20, -1, 170, -1, -1, 168, 143, -1, 39, -1,
1647 41, -1, 40, -1, 42, -1, 44, -1, 43, -1,
1648 45, -1, 47, -1, -1, 140, -1, 141, -1, 142,
1649 -1, -1, 43, -1, 45, -1, -1, 39, -1, 40,
1650 -1, 41, -1, 44, -1, -1, 41, -1, 39, -1,
1651 -1, 58, -1, 59, -1, 60, -1, 61, -1, 62,
1652 -1, 57, 4, -1, 132, -1, 114, -1, 131, -1,
1653 115, -1, 134, -1, 135, -1, 137, -1, 138, -1,
1654 139, -1, -1, 179, 178, -1, 133, -1, 136, -1,
1655 132, -1, 131, -1, -1, 181, 180, -1, -1, 50,
1656 4, -1, -1, 144, 50, 4, -1, 31, 19, -1,
1657 -1, 184, -1, -1, 144, 187, 186, -1, 184, -1,
1658 50, 4, -1, 11, -1, 12, -1, 13, -1, 14,
1659 -1, 46, -1, 188, -1, 189, 145, -1, 223, -1,
1660 146, 4, -1, 189, 147, 193, 148, 181, -1, 10,
1661 147, 193, 148, 181, -1, 149, 4, 150, 189, 151,
1662 -1, 152, 4, 150, 189, 153, -1, 154, 194, 155,
1663 -1, 154, 155, -1, 152, 154, 194, 155, 153, -1,
1664 152, 154, 155, 153, -1, 189, 179, -1, 189, -1,
1665 10, -1, 190, -1, 192, 144, 190, -1, 192, -1,
1666 192, 144, 36, -1, 36, -1, -1, 189, -1, 194,
1667 144, 189, -1, 189, 149, 197, 151, -1, 189, 149,
1668 151, -1, 189, 156, 19, -1, 189, 152, 197, 153,
1669 -1, 189, 154, 197, 155, -1, 189, 154, 155, -1,
1670 189, 152, 154, 197, 155, 153, -1, 189, 152, 154,
1671 155, 153, -1, 189, 37, -1, 189, 38, -1, 189,
1672 223, -1, 189, 196, -1, 189, 22, -1, 163, 3,
1673 -1, 163, 5, -1, 163, 4, -1, 163, 6, -1,
1674 11, 23, -1, 11, 24, -1, 164, 9, -1, 160,
1675 147, 195, 35, 189, 148, -1, 112, 147, 195, 234,
1676 148, -1, 126, 147, 195, 144, 195, 144, 195, 148,
1677 -1, 158, 147, 195, 144, 195, 148, -1, 159, 147,
1678 195, 144, 195, 148, -1, 85, 161, 147, 195, 144,
1679 195, 148, -1, 86, 162, 147, 195, 144, 195, 148,
1680 -1, 128, 147, 195, 144, 195, 148, -1, 129, 147,
1681 195, 144, 195, 144, 195, 148, -1, 130, 147, 195,
1682 144, 195, 144, 195, 148, -1, 197, 144, 195, -1,
1683 195, -1, 29, -1, 30, -1, 34, -1, -1, 191,
1684 223, -1, 118, 147, 200, 35, 189, 148, -1, 202,
1685 -1, -1, 203, -1, 202, 203, -1, -1, 28, 204,
1686 219, -1, -1, 27, 205, 220, -1, 55, 54, 209,
1687 -1, 167, 15, 189, -1, 167, 15, 10, -1, -1,
1688 169, 173, 199, 198, 195, 206, 186, -1, -1, 169,
1689 171, 173, 199, 198, 195, 207, 186, -1, -1, 169,
1690 172, 173, 199, 198, 189, 208, 186, -1, 169, 173,
1691 32, 176, 200, -1, 48, 210, -1, 51, 143, 211,
1692 -1, 19, -1, 49, 143, 19, -1, 63, 143, 19,
1693 -1, 149, 212, 151, -1, 212, 144, 19, -1, 19,
1694 -1, -1, 213, 144, 189, 179, 166, -1, 189, 179,
1695 166, -1, 213, -1, 213, 144, 36, -1, 36, -1,
1696 -1, 177, 191, 168, 147, 214, 148, 181, 185, 182,
1697 -1, 25, -1, 154, -1, 175, 173, 215, 216, -1,
1698 26, -1, 155, -1, 226, 218, -1, 174, 173, 215,
1699 -1, -1, 56, -1, 3, -1, 4, -1, 9, -1,
1700 23, -1, 24, -1, 37, -1, 38, -1, 22, -1,
1701 152, 197, 153, -1, 196, -1, 54, 221, 19, 144,
1702 19, -1, 7, -1, 8, -1, 165, -1, 168, -1,
1703 223, -1, 222, -1, 189, 224, -1, 226, 227, -1,
1704 217, 227, -1, 228, 167, 229, -1, 228, 231, -1,
1705 -1, 18, -1, 64, 225, -1, 64, 10, -1, 65,
1706 14, 224, -1, 65, 11, 224, 144, 14, 224, 144,
1707 14, 224, -1, 66, 163, 224, 144, 14, 224, 149,
1708 230, 151, -1, 66, 163, 224, 144, 14, 224, 149,
1709 151, -1, 67, 177, 191, 224, 147, 233, 148, 181,
1710 35, 14, 224, 68, 14, 224, -1, 68, -1, 69,
1711 -1, 230, 163, 222, 144, 14, 224, -1, 163, 222,
1712 144, 14, 224, -1, 167, 236, -1, 189, 149, 224,
1713 144, 224, 151, -1, 232, 144, 149, 224, 144, 224,
1714 151, -1, 189, 224, 179, -1, 233, 144, 189, 224,
1715 179, -1, -1, -1, 234, 144, 225, -1, 53, 52,
1716 -1, 52, -1, 158, 189, 224, 144, 224, -1, 159,
1717 189, 224, 144, 224, -1, 85, 161, 189, 224, 144,
1718 224, -1, 86, 162, 189, 224, 144, 224, -1, 160,
1719 225, 35, 189, -1, 126, 225, 144, 225, 144, 225,
1720 -1, 127, 225, 144, 189, -1, 128, 225, 144, 225,
1721 -1, 129, 225, 144, 225, 144, 225, -1, 130, 225,
1722 144, 225, 144, 225, -1, 125, 232, -1, 235, 177,
1723 191, 224, 147, 233, 148, 181, -1, 238, -1, 33,
1724 -1, -1, 107, 189, 183, -1, 107, 189, 144, 11,
1725 224, 183, -1, 108, 189, 183, -1, 108, 189, 144,
1726 11, 224, 183, -1, 109, 225, -1, 237, 110, 189,
1727 224, 183, -1, 237, 111, 225, 144, 189, 224, 183,
1728 -1, 112, 189, 224, 234, -1
1731 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1732 static const unsigned short int yyrline[] =
1734 0, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
1735 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118, 1118,
1736 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1122,
1737 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1130,
1738 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135,
1739 1135, 1136, 1136, 1137, 1138, 1143, 1144, 1144, 1146, 1146,
1740 1146, 1147, 1147, 1151, 1155, 1160, 1160, 1162, 1163, 1168,
1741 1174, 1175, 1176, 1177, 1178, 1182, 1183, 1184, 1188, 1189,
1742 1190, 1191, 1195, 1196, 1197, 1201, 1202, 1203, 1204, 1205,
1743 1209, 1210, 1211, 1214, 1215, 1216, 1217, 1218, 1219, 1220,
1744 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1238,
1745 1239, 1244, 1245, 1246, 1247, 1250, 1251, 1258, 1259, 1265,
1746 1266, 1274, 1282, 1283, 1288, 1289, 1290, 1295, 1308, 1308,
1747 1308, 1308, 1311, 1315, 1319, 1326, 1331, 1339, 1369, 1400,
1748 1405, 1417, 1427, 1431, 1441, 1448, 1455, 1462, 1467, 1472,
1749 1479, 1480, 1487, 1494, 1502, 1508, 1520, 1548, 1564, 1591,
1750 1619, 1645, 1665, 1691, 1711, 1723, 1730, 1796, 1806, 1816,
1751 1822, 1832, 1838, 1848, 1853, 1858, 1866, 1878, 1900, 1908,
1752 1914, 1925, 1930, 1935, 1941, 1947, 1956, 1960, 1968, 1968,
1753 1971, 1971, 1974, 1985, 2006, 2011, 2019, 2020, 2024, 2024,
1754 2028, 2028, 2031, 2034, 2058, 2069, 2069, 2080, 2079, 2089,
1755 2088, 2099, 2118, 2121, 2127, 2137, 2141, 2146, 2148, 2153,
1756 2158, 2167, 2177, 2188, 2192, 2201, 2210, 2215, 2336, 2336,
1757 2338, 2347, 2347, 2349, 2354, 2366, 2370, 2375, 2379, 2383,
1758 2387, 2391, 2395, 2399, 2403, 2407, 2432, 2436, 2446, 2450,
1759 2454, 2459, 2466, 2466, 2472, 2481, 2485, 2494, 2503, 2512,
1760 2516, 2523, 2527, 2531, 2536, 2546, 2565, 2574, 2654, 2658,
1761 2665, 2676, 2689, 2699, 2710, 2720, 2729, 2738, 2741, 2742,
1762 2749, 2753, 2758, 2779, 2796, 2810, 2824, 2836, 2844, 2851,
1763 2857, 2863, 2869, 2884, 2969, 2974, 2978, 2985, 2992, 3000,
1764 3007, 3015, 3023, 3037, 3054
1768 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1769 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1770 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1771 static const char *const yytname[] =
1773 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1774 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1775 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1776 "STRINGCONSTANT", "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT",
1777 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1778 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "ALIAS",
1779 "VOLATILE", "THREAD_LOCAL", "TO", "DOTDOTDOT", "NULL_TOK", "UNDEF",
1780 "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT",
1781 "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE", "ALIGN",
1782 "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK",
1783 "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1784 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1785 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1786 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1787 "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT",
1788 "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO",
1789 "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1790 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1791 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1792 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1793 "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1794 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "DEFAULT", "HIDDEN", "PROTECTED",
1795 "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'",
1796 "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps",
1797 "CastOps", "IPredicates", "FPredicates", "IntType", "FPType",
1798 "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1799 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1800 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1801 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1802 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign",
1803 "SectionString", "OptSection", "GlobalVarAttributes",
1804 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1805 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1806 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1807 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1808 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1809 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1810 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1811 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1812 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1813 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1814 "OptVolatile", "MemoryInst", 0
1819 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1821 static const unsigned short int yytoknum[] =
1823 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1824 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1825 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1826 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1827 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1828 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1829 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1830 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1831 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1832 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1833 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1834 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1835 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1836 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1837 395, 396, 397, 61, 44, 42, 92, 40, 41, 91,
1838 120, 93, 60, 62, 123, 125, 99
1842 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1843 static const unsigned char yyr1[] =
1845 0, 157, 158, 158, 158, 158, 158, 158, 158, 158,
1846 158, 159, 159, 159, 159, 159, 159, 160, 160, 160,
1847 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1848 161, 161, 161, 161, 161, 161, 161, 161, 161, 162,
1849 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
1850 162, 162, 162, 162, 162, 163, 164, 164, 165, 165,
1851 165, 166, 166, 167, 167, 168, 168, 169, 169, 170,
1852 171, 171, 171, 171, 171, 172, 172, 172, 173, 173,
1853 173, 173, 174, 174, 174, 175, 175, 175, 175, 175,
1854 176, 176, 176, 177, 177, 177, 177, 177, 177, 177,
1855 178, 178, 178, 178, 178, 178, 178, 178, 178, 179,
1856 179, 180, 180, 180, 180, 181, 181, 182, 182, 183,
1857 183, 184, 185, 185, 186, 186, 187, 187, 188, 188,
1858 188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
1859 189, 189, 189, 189, 189, 190, 191, 191, 192, 192,
1860 193, 193, 193, 193, 194, 194, 195, 195, 195, 195,
1861 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1862 195, 195, 195, 195, 195, 195, 196, 196, 196, 196,
1863 196, 196, 196, 196, 196, 196, 197, 197, 198, 198,
1864 199, 199, 200, 200, 201, 201, 202, 202, 204, 203,
1865 205, 203, 203, 203, 203, 206, 203, 207, 203, 208,
1866 203, 203, 203, 203, 209, 210, 210, 211, 212, 212,
1867 212, 213, 213, 214, 214, 214, 214, 215, 216, 216,
1868 217, 218, 218, 219, 220, 221, 221, 222, 222, 222,
1869 222, 222, 222, 222, 222, 222, 222, 222, 223, 223,
1870 223, 223, 224, 224, 225, 226, 226, 227, 228, 228,
1871 228, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1872 230, 230, 231, 232, 232, 233, 233, 233, 234, 234,
1873 235, 235, 236, 236, 236, 236, 236, 236, 236, 236,
1874 236, 236, 236, 236, 236, 237, 237, 238, 238, 238,
1875 238, 238, 238, 238, 238
1878 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1879 static const unsigned char yyr2[] =
1881 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1882 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1883 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1884 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1885 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1886 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1887 1, 1, 0, 2, 0, 1, 1, 1, 0, 2,
1888 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
1889 1, 1, 0, 1, 1, 0, 1, 1, 1, 1,
1890 0, 1, 1, 0, 1, 1, 1, 1, 1, 2,
1891 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1892 2, 1, 1, 1, 1, 0, 2, 0, 2, 0,
1893 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1894 1, 1, 1, 1, 2, 1, 2, 5, 5, 5,
1895 5, 3, 2, 5, 4, 2, 1, 1, 1, 3,
1896 1, 3, 1, 0, 1, 3, 4, 3, 3, 4,
1897 4, 3, 6, 5, 2, 2, 2, 2, 2, 2,
1898 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1899 6, 7, 7, 6, 8, 8, 3, 1, 1, 1,
1900 1, 0, 2, 6, 1, 0, 1, 2, 0, 3,
1901 0, 3, 3, 3, 3, 0, 7, 0, 8, 0,
1902 8, 5, 2, 3, 1, 3, 3, 3, 3, 1,
1903 0, 5, 3, 1, 3, 1, 0, 9, 1, 1,
1904 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1905 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1906 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1907 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1908 6, 5, 2, 6, 7, 3, 5, 0, 0, 3,
1909 2, 1, 5, 5, 6, 6, 4, 6, 4, 4,
1910 6, 6, 2, 8, 1, 1, 0, 3, 6, 3,
1914 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1915 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1916 means the default is an error. */
1917 static const unsigned short int yydefact[] =
1919 68, 58, 65, 59, 66, 60, 200, 198, 0, 0,
1920 0, 0, 0, 0, 78, 67, 0, 68, 196, 82,
1921 85, 0, 0, 212, 0, 0, 63, 0, 69, 70,
1922 72, 71, 73, 75, 74, 76, 77, 79, 80, 81,
1923 78, 78, 191, 1, 197, 83, 84, 78, 201, 86,
1924 87, 88, 89, 78, 259, 199, 259, 0, 0, 220,
1925 213, 214, 202, 248, 249, 204, 128, 129, 130, 131,
1926 132, 0, 0, 0, 0, 250, 251, 133, 203, 135,
1927 191, 191, 90, 190, 0, 93, 93, 260, 256, 64,
1928 231, 232, 233, 255, 215, 216, 219, 0, 153, 136,
1929 0, 0, 0, 0, 142, 154, 0, 134, 153, 0,
1930 0, 92, 91, 0, 188, 189, 0, 0, 94, 95,
1931 96, 97, 98, 0, 234, 0, 296, 258, 0, 217,
1932 152, 109, 148, 150, 0, 0, 0, 0, 0, 0,
1933 141, 0, 0, 0, 147, 0, 146, 0, 211, 128,
1934 129, 130, 0, 0, 0, 205, 99, 0, 228, 229,
1935 230, 295, 281, 0, 0, 0, 0, 93, 268, 269,
1936 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
1937 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
1938 0, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1939 26, 27, 28, 0, 0, 0, 0, 0, 0, 0,
1940 0, 0, 257, 93, 272, 0, 294, 218, 145, 0,
1941 115, 0, 0, 144, 0, 155, 115, 207, 209, 0,
1942 192, 173, 174, 169, 171, 170, 172, 175, 168, 164,
1943 165, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1944 0, 0, 0, 0, 0, 167, 166, 124, 0, 280,
1945 262, 0, 261, 0, 0, 55, 0, 0, 29, 30,
1946 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
1947 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
1948 44, 45, 46, 47, 48, 0, 119, 119, 301, 0,
1949 0, 292, 0, 0, 0, 0, 0, 0, 0, 0,
1950 0, 0, 0, 101, 103, 102, 100, 104, 105, 106,
1951 107, 108, 110, 151, 149, 138, 139, 140, 143, 137,
1952 124, 124, 0, 0, 0, 0, 0, 0, 0, 0,
1953 157, 187, 0, 0, 0, 161, 0, 158, 0, 0,
1954 0, 0, 206, 226, 237, 238, 239, 244, 240, 241,
1955 242, 243, 235, 0, 246, 253, 252, 254, 0, 263,
1956 0, 0, 0, 0, 0, 297, 0, 299, 278, 0,
1957 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1958 0, 0, 114, 113, 111, 112, 116, 208, 210, 0,
1959 0, 0, 278, 0, 0, 0, 0, 0, 156, 142,
1960 154, 0, 159, 160, 0, 0, 0, 0, 0, 126,
1961 124, 225, 109, 223, 0, 236, 0, 0, 0, 0,
1962 0, 0, 0, 0, 0, 0, 304, 0, 0, 0,
1963 288, 289, 0, 0, 0, 0, 286, 0, 119, 0,
1964 0, 0, 0, 0, 0, 0, 0, 0, 186, 163,
1965 0, 0, 0, 0, 121, 127, 125, 62, 0, 115,
1966 0, 245, 0, 0, 277, 0, 0, 119, 120, 119,
1967 0, 0, 0, 0, 0, 0, 282, 283, 277, 0,
1968 302, 0, 193, 0, 0, 177, 0, 0, 0, 0,
1969 162, 0, 0, 0, 61, 222, 224, 109, 122, 0,
1970 0, 0, 0, 0, 284, 285, 298, 300, 279, 0,
1971 0, 287, 290, 291, 0, 119, 0, 0, 0, 183,
1972 0, 0, 179, 180, 176, 62, 123, 117, 247, 0,
1973 0, 109, 0, 115, 273, 0, 115, 303, 181, 182,
1974 0, 0, 0, 221, 0, 227, 0, 266, 0, 0,
1975 275, 0, 0, 274, 293, 178, 184, 185, 118, 264,
1976 0, 265, 0, 109, 0, 0, 0, 276, 0, 0,
1977 0, 0, 271, 0, 0, 270, 0, 267
1980 /* YYDEFGOTO[NTERM-NUM]. */
1981 static const short int yydefgoto[] =
1983 -1, 252, 253, 254, 278, 295, 152, 153, 75, 505,
1984 12, 76, 14, 15, 40, 41, 42, 47, 53, 113,
1985 123, 322, 218, 396, 325, 555, 375, 419, 537, 352,
1986 420, 77, 154, 132, 147, 133, 134, 106, 341, 364,
1987 342, 116, 84, 148, 16, 17, 18, 20, 19, 257,
1988 330, 331, 62, 23, 60, 97, 423, 424, 124, 160,
1989 54, 92, 55, 48, 426, 365, 79, 367, 262, 56,
1990 88, 89, 212, 559, 127, 301, 513, 436, 213, 214,
1994 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1996 #define YYPACT_NINF -522
1997 static const short int yypact[] =
1999 40, -522, -522, -522, -522, -522, -522, -522, -24, -105,
2000 -4, -80, 60, -32, 461, -522, 134, 1386, -522, 153,
2001 150, 1, 15, -522, 16, 130, -522, 1208, -522, -522,
2002 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
2003 126, 126, 239, -522, -522, -522, -522, 126, -522, -522,
2004 -522, -522, -522, 126, 158, -522, -7, 168, 183, 194,
2005 -522, -522, -522, -522, -522, 45, -522, -522, -522, -522,
2006 -522, 212, 226, 6, 198, -522, -522, -522, 127, -522,
2007 204, 204, 248, -522, 218, 113, 113, -522, -522, 135,
2008 -522, -522, -522, -522, -522, -522, -522, -44, 1006, -522,
2009 101, 107, 371, 45, -522, 127, -103, -522, 1006, 218,
2010 218, -522, -522, 1043, -522, -522, 1223, 259, -522, -522,
2011 -522, -522, -522, 1274, -522, -13, 1423, -522, 269, -522,
2012 -522, 127, -522, 162, 146, 1305, 1305, 144, -101, 1305,
2013 -522, 159, 1223, 1305, 45, 161, 127, 85, -522, 41,
2014 301, 302, 250, 304, 782, -522, -522, 79, -522, -522,
2015 -522, -522, -522, 263, 1320, 193, 305, 113, -522, -522,
2016 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
2017 -522, -522, -522, -522, -522, 133, 456, 1305, 1305, 1305,
2018 1305, -522, -522, -522, -522, -522, -522, -522, -522, -522,
2019 -522, -522, -522, 1305, 1305, 1305, 1305, 1305, 1305, 1305,
2020 1305, 1305, -522, 113, -522, 165, -522, -522, 519, 1060,
2021 -522, -18, -33, -522, 166, 127, -522, -522, 127, 1043,
2022 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
2023 -522, 133, 456, 171, 174, 175, 177, 178, 1111, 1371,
2024 579, 307, 181, 182, 184, -522, -522, 186, 187, -522,
2025 45, 623, -522, 757, 757, -522, 757, 1274, -522, -522,
2026 -522, -522, -522, -522, -522, -522, -522, -522, 1305, -522,
2027 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
2028 -522, -522, -522, -522, -522, 1305, 98, 114, -522, 623,
2029 -64, 195, 196, 201, 202, 210, 216, 623, 623, 303,
2030 1274, 1305, 1305, -522, -522, -522, -522, -522, -522, -522,
2031 -522, -522, -522, -522, -522, 104, -522, -522, -522, 104,
2032 186, 186, 313, 190, 214, 1223, 1223, 1223, 1223, 1223,
2033 -522, -522, -36, 962, -111, -522, -78, -522, 1223, 1223,
2034 1223, 3, -522, 1126, -522, -522, -522, -522, -522, -522,
2035 -522, -522, 308, 1223, -522, -522, -522, -522, 219, -522,
2036 221, 757, 623, 623, 20, -522, 21, -522, -522, 757,
2037 225, 1305, 1305, 1305, 1305, 1305, 224, 227, 1305, 757,
2038 623, 231, -522, -522, -522, -522, -522, -522, -522, 1305,
2039 1223, 1223, -522, 233, 242, 245, 249, 1223, -522, 217,
2040 782, -65, -522, -522, 256, 257, 359, 386, 402, -522,
2041 186, -522, 127, 265, 264, -522, 394, -75, 400, 401,
2042 271, 275, 276, 757, 418, 757, 282, 285, 757, 289,
2043 127, -522, 290, 296, 757, 757, 127, 294, 300, 1305,
2044 -29, 306, 309, -50, 1223, 1223, 1223, 1223, -522, -522,
2045 292, 1223, 1223, 1305, -522, -522, -522, 293, 1157, -522,
2046 311, -522, 757, 757, 1305, 757, 757, 300, -522, 300,
2047 1305, 757, 312, 1305, 1305, 1305, -522, -522, 1305, 397,
2048 -522, 623, -522, 1223, 1223, -522, 316, 315, 317, 320,
2049 -522, 318, 321, 117, -522, -522, -522, 127, -1, 430,
2050 324, 322, 623, -8, -522, -522, -522, -522, -522, 314,
2051 757, -522, -522, -522, -5, 300, 329, 330, 1223, -522,
2052 1223, 1223, -522, -522, -522, 293, -522, 431, -522, 437,
2053 2, -522, 1305, -522, -522, 332, -522, -522, -522, -522,
2054 336, 337, 338, -522, 448, -522, 757, -522, 917, 4,
2055 519, 623, 14, -522, 104, -522, -522, -522, -522, -522,
2056 343, -522, 917, -522, 474, 475, 346, 519, 757, 757,
2057 477, 426, -522, 757, 481, -522, 757, -522
2060 /* YYPGOTO[NTERM-NUM]. */
2061 static const short int yypgoto[] =
2063 -522, 370, 372, 373, 266, 255, -164, -522, 0, -25,
2064 420, 9, -522, -522, -522, -522, 33, -522, -522, -522,
2065 -151, -522, -404, -522, -223, -522, -291, 5, -522, -295,
2066 -522, -522, -26, 295, -115, -522, 403, 410, -58, -150,
2067 -221, 173, 222, 286, -522, -522, 501, -522, -522, -522,
2068 -522, -522, -522, -522, -522, -522, -522, -522, 433, -522,
2069 -522, -522, -522, -522, -522, -521, -140, 103, -184, -522,
2070 465, -522, -522, -522, -522, -522, 34, 122, -522, -522,
2074 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2075 positive, shift that token. If negative, reduce the rule which
2076 number is the opposite. If zero, do what YYDEFACT says.
2077 If YYTABLE_NINF, syntax error. */
2078 #define YYTABLE_NINF -196
2079 static const short int yytable[] =
2081 11, 78, 266, 329, 255, 298, 377, 230, 157, 13,
2082 101, 87, 158, 265, 256, 265, 267, 11, 467, 90,
2083 302, 303, 304, 305, 306, 21, 13, 309, 344, 346,
2084 417, 433, 435, 407, 417, 397, 398, 570, 24, 22,
2085 -195, 139, 412, 139, -55, -55, -55, -55, 105, 574,
2086 25, 576, 140, 418, 224, -64, 1, 2, 155, 3,
2087 4, 5, 310, 26, 231, 232, 407, 6, 7, 407,
2088 434, 434, 131, 80, 81, 27, 105, 413, 471, 407,
2089 85, 107, 131, 108, 227, 379, 86, 146, 8, 11,
2090 460, 9, 63, 64, 480, 10, 2, 146, 495, 4,
2091 128, 1, 2, 535, 3, 4, 5, 129, 407, 221,
2092 222, 28, 107, 225, 108, 408, 107, 228, 108, 492,
2093 327, 366, 411, 366, 366, 466, 366, 107, 391, 108,
2094 392, 393, 394, 326, 43, 395, 542, 560, 261, 542,
2095 543, 159, 427, 546, 57, 392, 393, 394, 91, 61,
2096 395, 1, 371, 557, 3, 571, 5, 490, 58, 366,
2097 102, 296, 297, 261, 299, 59, 258, 366, 366, 577,
2098 117, 118, 119, 120, 121, 122, 87, 300, 261, 261,
2099 261, 261, 261, 307, 308, 261, 516, 94, 517, 49,
2100 50, 51, 98, 131, 52, 389, 45, 439, 46, 441,
2101 442, 443, 95, 146, 263, 63, 64, 264, 103, 66,
2102 67, 68, 69, 96, 1, 2, 99, 3, 4, 5,
2103 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
2104 100, 366, 366, 366, 547, 392, 393, 394, 83, 366,
2105 395, 146, 374, 107, 70, 108, 508, 114, 115, 366,
2106 366, 135, 372, 233, 234, 235, 236, 136, 376, 107,
2107 255, 108, 107, 156, 108, 534, 37, 38, 39, 373,
2108 256, 82, 107, 83, 108, 311, 312, 402, 403, 404,
2109 405, 406, 142, 143, 146, 390, 261, 111, 217, 112,
2110 414, 415, 416, 366, 220, 366, 518, 223, 366, 521,
2111 522, 523, 109, 110, 366, 366, 219, 226, 229, 1,
2112 -56, -57, 3, 237, 5, 259, 265, 410, 335, 328,
2113 562, 336, 337, 564, 338, 339, 347, 422, 348, 349,
2114 351, 350, 366, 366, 353, 366, 366, 400, 388, 380,
2115 381, 366, 451, 452, 71, 382, 383, 72, 399, 458,
2116 73, 366, 74, 104, 384, 261, 440, 261, 261, 261,
2117 385, 401, 446, 428, 425, 429, 368, 369, 444, 370,
2118 459, 445, 366, 450, 438, 449, 558, 454, 63, 64,
2119 366, 103, 66, 67, 68, 69, 455, 1, 2, 456,
2120 3, 4, 5, 457, 463, 572, 496, 497, 498, 499,
2121 461, 462, 378, 501, 502, 464, 465, 313, 314, 468,
2122 386, 387, 469, 470, 472, 473, 366, 70, 474, 475,
2123 476, 366, 478, 491, 315, 316, 480, 317, 318, 481,
2124 319, 320, 321, 483, 484, 526, 527, 503, 366, 366,
2125 485, 488, 507, 366, 489, 500, 366, 434, 512, 538,
2126 493, 556, 568, 494, 261, 509, 520, 261, 261, 261,
2127 528, 530, 512, 529, 531, 544, 532, 504, 539, 533,
2128 550, 540, 551, 552, 430, 431, 432, 548, 549, 279,
2129 280, 554, 437, 563, 565, 566, 567, 575, 578, 579,
2130 580, 583, 447, 448, 584, 586, 209, 334, 210, 211,
2131 29, 30, 31, 32, 33, 34, 35, 333, 36, 126,
2132 553, 141, 138, 536, 324, 332, 561, 71, 44, 125,
2133 72, 93, 524, 73, 453, 74, 137, 0, 0, 0,
2134 0, 0, 0, 0, 0, 504, 477, 0, 479, 0,
2135 0, 482, 0, 0, 0, 0, 0, 486, 487, 281,
2136 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
2137 292, 293, 294, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 0, 0, 0, 510, 511, 0, 514, 515,
2139 0, 0, 0, 0, 519, 0, 63, 64, 0, 103,
2140 149, 150, 151, 69, 525, 1, 2, 0, 3, 4,
2141 5, 37, 38, 39, 0, 0, 0, 0, 0, 0,
2142 0, 0, 0, 0, 0, 541, 0, 0, 0, 0,
2143 0, 0, 0, 545, 0, 70, 354, 355, 0, 0,
2144 63, 64, 356, 313, 314, 0, 0, 0, 0, 1,
2145 2, 0, 3, 4, 5, 357, 358, 359, 0, 0,
2146 315, 316, 0, 317, 318, 0, 319, 320, 321, 569,
2147 360, 361, 0, 0, 573, 0, 0, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 362, 0, 0,
2149 0, 581, 582, 0, 0, 0, 585, 0, 0, 587,
2150 0, 0, 0, 170, 171, 172, 173, 174, 175, 176,
2151 177, 178, 179, 180, 181, 182, 183, 184, 241, 242,
2152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2153 0, 0, 0, 0, 0, 71, 0, 0, 72, 0,
2154 0, 73, 0, 74, 345, 243, 191, 192, 193, 194,
2155 195, 196, 197, 198, 199, 200, 201, 202, 0, 244,
2156 0, 245, 246, 247, 0, 0, 0, 0, 0, 0,
2157 354, 355, 0, 0, 63, 64, 356, 0, 107, 0,
2158 108, 0, 0, 1, 2, 363, 3, 4, 5, 357,
2159 358, 359, 0, 0, 0, 0, 0, 0, 0, 63,
2160 64, 0, 0, 0, 360, 361, 0, 0, 1, 2,
2161 0, 3, 4, 5, 238, 0, 0, 0, 0, 0,
2162 0, 362, 0, 0, 0, 0, 0, 0, 0, 239,
2163 240, 0, 0, 0, 0, 0, 0, 170, 171, 172,
2164 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2165 183, 184, 241, 242, 0, 0, 0, 0, 0, 0,
2166 0, 0, 170, 171, 172, 173, 174, 175, 176, 177,
2167 178, 179, 180, 181, 182, 183, 184, 241, 242, 243,
2168 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2169 201, 202, 0, 244, 0, 245, 246, 247, 0, 0,
2170 0, 0, 0, 0, 243, 191, 192, 193, 194, 195,
2171 196, 197, 198, 199, 200, 201, 202, 0, 244, 363,
2172 245, 246, 247, 0, 0, 0, 0, 0, 0, 0,
2173 354, 355, 0, 0, 0, 0, 356, 107, 0, 108,
2174 0, 248, 0, 0, 249, 0, 250, 0, 251, 357,
2175 358, 359, 0, 0, 0, 0, 0, 0, 0, 0,
2176 0, 0, 0, 0, 360, 361, 0, 0, 0, 0,
2177 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
2178 64, 362, 103, 149, 150, 151, 69, 0, 1, 2,
2179 0, 3, 4, 5, 0, 0, 0, 170, 171, 172,
2180 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2181 183, 184, 241, 242, 0, 0, 0, 0, 70, 0,
2182 0, 0, 0, 63, 64, 0, 103, 66, 67, 68,
2183 69, 0, 1, 2, 0, 3, 4, 5, 0, 243,
2184 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2185 201, 202, 130, 244, 0, 245, 246, 247, 0, 0,
2186 63, 64, 70, 144, 66, 67, 68, 69, 0, 1,
2187 2, 0, 3, 4, 5, 0, 0, 63, 64, 363,
2188 103, 66, 67, 68, 69, 0, 1, 2, 0, 3,
2189 4, 5, 0, 0, 0, 0, 0, 0, 0, 70,
2190 0, 0, 0, 0, 0, 0, 323, 0, 0, 0,
2191 0, 0, 0, 0, 0, 0, 70, 0, 71, 0,
2192 0, 72, 0, 0, 73, 0, 74, 409, 63, 64,
2193 0, 103, 149, 150, 151, 69, 0, 1, 2, 0,
2194 3, 4, 5, 63, 64, 0, 103, 66, 67, 68,
2195 69, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2196 0, 0, 71, 0, 0, 72, 0, 70, 73, 0,
2197 74, 145, 421, 0, 63, 64, 0, 103, 66, 67,
2198 68, 69, 70, 1, 2, 0, 3, 4, 5, 0,
2199 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
2200 0, 0, 72, 506, 0, 73, 0, 74, 0, 0,
2201 0, 0, 0, 70, 0, 0, 71, 0, 0, 72,
2202 0, 0, 73, 0, 74, 63, 64, 0, 65, 66,
2203 67, 68, 69, 0, 1, 2, 0, 3, 4, 5,
2204 63, 64, 0, 103, 149, 150, 151, 69, 0, 1,
2205 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2206 0, 0, 0, 0, 70, 0, 0, 71, 0, 0,
2207 72, 0, 340, 73, 0, 74, 0, 0, 0, 70,
2208 0, 0, 71, 0, 0, 72, 0, 0, 73, 0,
2209 74, 63, 64, 0, 144, 66, 67, 68, 69, 0,
2210 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2211 0, 0, 0, 71, 0, 0, 72, 0, 0, 73,
2212 0, 74, 63, 64, 0, 103, 66, 67, 68, 69,
2213 70, 1, 2, 0, 3, 4, 5, 63, 64, 0,
2214 260, 66, 67, 68, 69, 0, 1, 2, 0, 3,
2215 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2216 0, 70, 0, 0, 71, 0, 0, 72, 0, 0,
2217 73, 0, 74, 0, 0, 0, 70, 0, 0, 71,
2218 0, 0, 72, 0, 0, 73, 0, 74, 63, 64,
2219 0, 103, 149, 150, 151, 69, -194, 1, 2, 0,
2220 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2221 0, -64, 1, 2, 0, 3, 4, 5, 0, 0,
2222 0, 0, 0, 6, 7, 0, 0, 70, 0, 0,
2223 71, 0, 0, 72, 0, 0, 73, 0, 74, 0,
2224 0, 0, 0, 0, 8, 0, 0, 9, 0, 0,
2225 0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
2226 0, 71, 0, 0, 72, 0, 161, 73, 0, 74,
2227 0, 0, 0, 0, 0, 0, 71, 0, 0, 72,
2228 0, 0, 73, 0, 74, 162, 163, 0, 0, 0,
2229 0, 0, 0, 0, 0, 0, 0, 164, 165, 166,
2230 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2231 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2232 0, 0, 0, 0, 0, 0, 0, 71, 0, 0,
2233 72, 0, 0, 73, 0, 343, 0, 0, 0, 0,
2234 187, 188, 189, 0, 0, 190, 191, 192, 193, 194,
2235 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
2239 static const short int yycheck[] =
2241 0, 27, 166, 226, 154, 189, 297, 147, 123, 0,
2242 4, 18, 25, 11, 154, 11, 167, 17, 422, 26,
2243 204, 205, 206, 207, 208, 49, 17, 211, 249, 250,
2244 31, 11, 11, 144, 31, 330, 331, 558, 143, 63,
2245 0, 144, 153, 144, 3, 4, 5, 6, 74, 35,
2246 54, 572, 155, 50, 155, 15, 16, 17, 116, 19,
2247 20, 21, 213, 143, 23, 24, 144, 27, 28, 144,
2248 50, 50, 98, 40, 41, 15, 102, 155, 153, 144,
2249 47, 145, 108, 147, 142, 149, 53, 113, 48, 89,
2250 155, 51, 7, 8, 144, 55, 17, 123, 148, 20,
2251 144, 16, 17, 507, 19, 20, 21, 151, 144, 135,
2252 136, 143, 145, 139, 147, 151, 145, 143, 147, 148,
2253 153, 261, 343, 263, 264, 420, 266, 145, 312, 147,
2254 131, 132, 133, 151, 0, 136, 144, 541, 164, 144,
2255 148, 154, 363, 148, 143, 131, 132, 133, 155, 19,
2256 136, 16, 267, 151, 19, 151, 21, 448, 143, 299,
2257 154, 187, 188, 189, 190, 149, 157, 307, 308, 573,
2258 57, 58, 59, 60, 61, 62, 18, 203, 204, 205,
2259 206, 207, 208, 209, 210, 211, 477, 19, 479, 39,
2260 40, 41, 147, 219, 44, 310, 43, 381, 45, 383,
2261 384, 385, 19, 229, 11, 7, 8, 14, 10, 11,
2262 12, 13, 14, 19, 16, 17, 4, 19, 20, 21,
2263 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2264 4, 371, 372, 373, 525, 131, 132, 133, 34, 379,
2265 136, 267, 144, 145, 46, 147, 469, 29, 30, 389,
2266 390, 150, 278, 3, 4, 5, 6, 150, 144, 145,
2267 410, 147, 145, 4, 147, 148, 140, 141, 142, 295,
2268 410, 32, 145, 34, 147, 110, 111, 335, 336, 337,
2269 338, 339, 109, 110, 310, 311, 312, 39, 19, 41,
2270 348, 349, 350, 433, 148, 435, 480, 153, 438, 483,
2271 484, 485, 80, 81, 444, 445, 144, 148, 147, 16,
2272 9, 9, 19, 9, 21, 52, 11, 343, 147, 153,
2273 543, 147, 147, 546, 147, 147, 19, 353, 147, 147,
2274 144, 147, 472, 473, 147, 475, 476, 147, 35, 144,
2275 144, 481, 400, 401, 146, 144, 144, 149, 35, 407,
2276 152, 491, 154, 155, 144, 381, 382, 383, 384, 385,
2277 144, 147, 388, 144, 56, 144, 263, 264, 144, 266,
2278 153, 144, 512, 399, 149, 144, 540, 144, 7, 8,
2279 520, 10, 11, 12, 13, 14, 144, 16, 17, 144,
2280 19, 20, 21, 144, 35, 559, 454, 455, 456, 457,
2281 144, 144, 299, 461, 462, 19, 4, 114, 115, 144,
2282 307, 308, 148, 19, 14, 14, 556, 46, 147, 144,
2283 144, 561, 4, 449, 131, 132, 144, 134, 135, 144,
2284 137, 138, 139, 144, 144, 493, 494, 463, 578, 579,
2285 144, 147, 468, 583, 144, 153, 586, 50, 474, 19,
2286 144, 14, 4, 144, 480, 144, 144, 483, 484, 485,
2287 144, 144, 488, 148, 144, 151, 148, 467, 144, 148,
2288 528, 149, 530, 531, 371, 372, 373, 148, 148, 23,
2289 24, 50, 379, 151, 148, 148, 148, 144, 14, 14,
2290 144, 14, 389, 390, 68, 14, 126, 242, 126, 126,
2291 39, 40, 41, 42, 43, 44, 45, 241, 47, 89,
2292 535, 108, 102, 508, 219, 229, 542, 146, 17, 86,
2293 149, 56, 488, 152, 402, 154, 155, -1, -1, -1,
2294 -1, -1, -1, -1, -1, 535, 433, -1, 435, -1,
2295 -1, 438, -1, -1, -1, -1, -1, 444, 445, 93,
2296 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2297 104, 105, 106, -1, -1, -1, -1, -1, -1, -1,
2298 -1, -1, -1, -1, -1, 472, 473, -1, 475, 476,
2299 -1, -1, -1, -1, 481, -1, 7, 8, -1, 10,
2300 11, 12, 13, 14, 491, 16, 17, -1, 19, 20,
2301 21, 140, 141, 142, -1, -1, -1, -1, -1, -1,
2302 -1, -1, -1, -1, -1, 512, -1, -1, -1, -1,
2303 -1, -1, -1, 520, -1, 46, 3, 4, -1, -1,
2304 7, 8, 9, 114, 115, -1, -1, -1, -1, 16,
2305 17, -1, 19, 20, 21, 22, 23, 24, -1, -1,
2306 131, 132, -1, 134, 135, -1, 137, 138, 139, 556,
2307 37, 38, -1, -1, 561, -1, -1, -1, -1, -1,
2308 -1, -1, -1, -1, -1, -1, -1, 54, -1, -1,
2309 -1, 578, 579, -1, -1, -1, 583, -1, -1, 586,
2310 -1, -1, -1, 70, 71, 72, 73, 74, 75, 76,
2311 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2312 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2313 -1, -1, -1, -1, -1, 146, -1, -1, 149, -1,
2314 -1, 152, -1, 154, 155, 112, 113, 114, 115, 116,
2315 117, 118, 119, 120, 121, 122, 123, 124, -1, 126,
2316 -1, 128, 129, 130, -1, -1, -1, -1, -1, -1,
2317 3, 4, -1, -1, 7, 8, 9, -1, 145, -1,
2318 147, -1, -1, 16, 17, 152, 19, 20, 21, 22,
2319 23, 24, -1, -1, -1, -1, -1, -1, -1, 7,
2320 8, -1, -1, -1, 37, 38, -1, -1, 16, 17,
2321 -1, 19, 20, 21, 22, -1, -1, -1, -1, -1,
2322 -1, 54, -1, -1, -1, -1, -1, -1, -1, 37,
2323 38, -1, -1, -1, -1, -1, -1, 70, 71, 72,
2324 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2325 83, 84, 85, 86, -1, -1, -1, -1, -1, -1,
2326 -1, -1, 70, 71, 72, 73, 74, 75, 76, 77,
2327 78, 79, 80, 81, 82, 83, 84, 85, 86, 112,
2328 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2329 123, 124, -1, 126, -1, 128, 129, 130, -1, -1,
2330 -1, -1, -1, -1, 112, 113, 114, 115, 116, 117,
2331 118, 119, 120, 121, 122, 123, 124, -1, 126, 152,
2332 128, 129, 130, -1, -1, -1, -1, -1, -1, -1,
2333 3, 4, -1, -1, -1, -1, 9, 145, -1, 147,
2334 -1, 149, -1, -1, 152, -1, 154, -1, 156, 22,
2335 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2336 -1, -1, -1, -1, 37, 38, -1, -1, -1, -1,
2337 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2338 8, 54, 10, 11, 12, 13, 14, -1, 16, 17,
2339 -1, 19, 20, 21, -1, -1, -1, 70, 71, 72,
2340 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2341 83, 84, 85, 86, -1, -1, -1, -1, 46, -1,
2342 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2343 14, -1, 16, 17, -1, 19, 20, 21, -1, 112,
2344 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2345 123, 124, 36, 126, -1, 128, 129, 130, -1, -1,
2346 7, 8, 46, 10, 11, 12, 13, 14, -1, 16,
2347 17, -1, 19, 20, 21, -1, -1, 7, 8, 152,
2348 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2349 20, 21, -1, -1, -1, -1, -1, -1, -1, 46,
2350 -1, -1, -1, -1, -1, -1, 36, -1, -1, -1,
2351 -1, -1, -1, -1, -1, -1, 46, -1, 146, -1,
2352 -1, 149, -1, -1, 152, -1, 154, 155, 7, 8,
2353 -1, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2354 19, 20, 21, 7, 8, -1, 10, 11, 12, 13,
2355 14, -1, 16, 17, -1, 19, 20, 21, -1, -1,
2356 -1, -1, 146, -1, -1, 149, -1, 46, 152, -1,
2357 154, 118, 36, -1, 7, 8, -1, 10, 11, 12,
2358 13, 14, 46, 16, 17, -1, 19, 20, 21, -1,
2359 -1, -1, -1, -1, -1, -1, -1, -1, -1, 146,
2360 -1, -1, 149, 36, -1, 152, -1, 154, -1, -1,
2361 -1, -1, -1, 46, -1, -1, 146, -1, -1, 149,
2362 -1, -1, 152, -1, 154, 7, 8, -1, 10, 11,
2363 12, 13, 14, -1, 16, 17, -1, 19, 20, 21,
2364 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2365 17, -1, 19, 20, 21, -1, -1, -1, -1, -1,
2366 -1, -1, -1, -1, 46, -1, -1, 146, -1, -1,
2367 149, -1, 151, 152, -1, 154, -1, -1, -1, 46,
2368 -1, -1, 146, -1, -1, 149, -1, -1, 152, -1,
2369 154, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2370 16, 17, -1, 19, 20, 21, -1, -1, -1, -1,
2371 -1, -1, -1, 146, -1, -1, 149, -1, -1, 152,
2372 -1, 154, 7, 8, -1, 10, 11, 12, 13, 14,
2373 46, 16, 17, -1, 19, 20, 21, 7, 8, -1,
2374 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2375 20, 21, -1, -1, -1, -1, -1, -1, -1, -1,
2376 -1, 46, -1, -1, 146, -1, -1, 149, -1, -1,
2377 152, -1, 154, -1, -1, -1, 46, -1, -1, 146,
2378 -1, -1, 149, -1, -1, 152, -1, 154, 7, 8,
2379 -1, 10, 11, 12, 13, 14, 0, 16, 17, -1,
2380 19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
2381 -1, 15, 16, 17, -1, 19, 20, 21, -1, -1,
2382 -1, -1, -1, 27, 28, -1, -1, 46, -1, -1,
2383 146, -1, -1, 149, -1, -1, 152, -1, 154, -1,
2384 -1, -1, -1, -1, 48, -1, -1, 51, -1, -1,
2385 -1, 55, -1, -1, -1, -1, -1, -1, -1, -1,
2386 -1, 146, -1, -1, 149, -1, 33, 152, -1, 154,
2387 -1, -1, -1, -1, -1, -1, 146, -1, -1, 149,
2388 -1, -1, 152, -1, 154, 52, 53, -1, -1, -1,
2389 -1, -1, -1, -1, -1, -1, -1, 64, 65, 66,
2390 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2391 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2392 -1, -1, -1, -1, -1, -1, -1, 146, -1, -1,
2393 149, -1, -1, 152, -1, 154, -1, -1, -1, -1,
2394 107, 108, 109, -1, -1, 112, 113, 114, 115, 116,
2395 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2399 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2400 symbol of state STATE-NUM. */
2401 static const unsigned char yystos[] =
2403 0, 16, 17, 19, 20, 21, 27, 28, 48, 51,
2404 55, 165, 167, 168, 169, 170, 201, 202, 203, 205,
2405 204, 49, 63, 210, 143, 54, 143, 15, 143, 39,
2406 40, 41, 42, 43, 44, 45, 47, 140, 141, 142,
2407 171, 172, 173, 0, 203, 43, 45, 174, 220, 39,
2408 40, 41, 44, 175, 217, 219, 226, 143, 143, 149,
2409 211, 19, 209, 7, 8, 10, 11, 12, 13, 14,
2410 46, 146, 149, 152, 154, 165, 168, 188, 189, 223,
2411 173, 173, 32, 34, 199, 173, 173, 18, 227, 228,
2412 26, 155, 218, 227, 19, 19, 19, 212, 147, 4,
2413 4, 4, 154, 10, 155, 189, 194, 145, 147, 199,
2414 199, 39, 41, 176, 29, 30, 198, 57, 58, 59,
2415 60, 61, 62, 177, 215, 215, 167, 231, 144, 151,
2416 36, 189, 190, 192, 193, 150, 150, 155, 194, 144,
2417 155, 193, 198, 198, 10, 118, 189, 191, 200, 11,
2418 12, 13, 163, 164, 189, 195, 4, 191, 25, 154,
2419 216, 33, 52, 53, 64, 65, 66, 67, 68, 69,
2420 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2421 80, 81, 82, 83, 84, 85, 86, 107, 108, 109,
2422 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2423 122, 123, 124, 125, 126, 127, 128, 129, 130, 158,
2424 159, 160, 229, 235, 236, 237, 238, 19, 179, 144,
2425 148, 189, 189, 153, 155, 189, 148, 195, 189, 147,
2426 223, 23, 24, 3, 4, 5, 6, 9, 22, 37,
2427 38, 85, 86, 112, 126, 128, 129, 130, 149, 152,
2428 154, 156, 158, 159, 160, 196, 223, 206, 168, 52,
2429 10, 189, 225, 11, 14, 11, 163, 177, 87, 88,
2430 89, 90, 91, 92, 93, 94, 95, 96, 161, 23,
2431 24, 93, 94, 95, 96, 97, 98, 99, 100, 101,
2432 102, 103, 104, 105, 106, 162, 189, 189, 225, 189,
2433 189, 232, 225, 225, 225, 225, 225, 189, 189, 225,
2434 177, 110, 111, 114, 115, 131, 132, 134, 135, 137,
2435 138, 139, 178, 36, 190, 181, 151, 153, 153, 181,
2436 207, 208, 200, 161, 162, 147, 147, 147, 147, 147,
2437 151, 195, 197, 154, 197, 155, 197, 19, 147, 147,
2438 147, 144, 186, 147, 3, 4, 9, 22, 23, 24,
2439 37, 38, 54, 152, 196, 222, 223, 224, 224, 224,
2440 224, 191, 189, 189, 144, 183, 144, 183, 224, 149,
2441 144, 144, 144, 144, 144, 144, 224, 224, 35, 191,
2442 189, 225, 131, 132, 133, 136, 180, 186, 186, 35,
2443 147, 147, 195, 195, 195, 195, 195, 144, 151, 155,
2444 189, 197, 153, 155, 195, 195, 195, 31, 50, 184,
2445 187, 36, 189, 213, 214, 56, 221, 197, 144, 144,
2446 224, 224, 224, 11, 50, 11, 234, 224, 149, 225,
2447 189, 225, 225, 225, 144, 144, 189, 224, 224, 144,
2448 189, 195, 195, 234, 144, 144, 144, 144, 195, 153,
2449 155, 144, 144, 35, 19, 4, 186, 179, 144, 148,
2450 19, 153, 14, 14, 147, 144, 144, 224, 4, 224,
2451 144, 144, 224, 144, 144, 144, 224, 224, 147, 144,
2452 183, 189, 148, 144, 144, 148, 195, 195, 195, 195,
2453 153, 195, 195, 189, 165, 166, 36, 189, 181, 144,
2454 224, 224, 189, 233, 224, 224, 183, 183, 225, 224,
2455 144, 225, 225, 225, 233, 224, 195, 195, 144, 148,
2456 144, 144, 148, 148, 148, 179, 184, 185, 19, 144,
2457 149, 224, 144, 148, 151, 224, 148, 183, 148, 148,
2458 195, 195, 195, 166, 50, 182, 14, 151, 163, 230,
2459 179, 189, 181, 151, 181, 148, 148, 148, 4, 224,
2460 222, 151, 163, 224, 35, 144, 222, 179, 14, 14,
2461 144, 224, 224, 14, 68, 224, 14, 224
2464 #define yyerrok (yyerrstatus = 0)
2465 #define yyclearin (yychar = YYEMPTY)
2466 #define YYEMPTY (-2)
2469 #define YYACCEPT goto yyacceptlab
2470 #define YYABORT goto yyabortlab
2471 #define YYERROR goto yyerrorlab
2474 /* Like YYERROR except do call yyerror. This remains here temporarily
2475 to ease the transition to the new meaning of YYERROR, for GCC.
2476 Once GCC version 2 has supplanted version 1, this can go. */
2478 #define YYFAIL goto yyerrlab
2480 #define YYRECOVERING() (!!yyerrstatus)
2482 #define YYBACKUP(Token, Value) \
2484 if (yychar == YYEMPTY && yylen == 1) \
2488 yytoken = YYTRANSLATE (yychar); \
2494 yyerror (YY_("syntax error: cannot back up")); \
2501 #define YYERRCODE 256
2504 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2505 If N is 0, then set CURRENT to the empty location which ends
2506 the previous symbol: RHS[0] (always defined). */
2508 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2509 #ifndef YYLLOC_DEFAULT
2510 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2514 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2515 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2516 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2517 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2521 (Current).first_line = (Current).last_line = \
2522 YYRHSLOC (Rhs, 0).last_line; \
2523 (Current).first_column = (Current).last_column = \
2524 YYRHSLOC (Rhs, 0).last_column; \
2530 /* YY_LOCATION_PRINT -- Print the location on the stream.
2531 This macro was not mandated originally: define only if we know
2532 we won't break user code: when these are the locations we know. */
2534 #ifndef YY_LOCATION_PRINT
2535 # if YYLTYPE_IS_TRIVIAL
2536 # define YY_LOCATION_PRINT(File, Loc) \
2537 fprintf (File, "%d.%d-%d.%d", \
2538 (Loc).first_line, (Loc).first_column, \
2539 (Loc).last_line, (Loc).last_column)
2541 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2546 /* YYLEX -- calling `yylex' with the right arguments. */
2549 # define YYLEX yylex (YYLEX_PARAM)
2551 # define YYLEX yylex ()
2554 /* Enable debugging if requested. */
2558 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2559 # define YYFPRINTF fprintf
2562 # define YYDPRINTF(Args) \
2568 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2572 YYFPRINTF (stderr, "%s ", Title); \
2573 yysymprint (stderr, \
2575 YYFPRINTF (stderr, "\n"); \
2579 /*------------------------------------------------------------------.
2580 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2582 `------------------------------------------------------------------*/
2584 #if defined (__STDC__) || defined (__cplusplus)
2586 yy_stack_print (short int *bottom, short int *top)
2589 yy_stack_print (bottom, top)
2594 YYFPRINTF (stderr, "Stack now");
2595 for (/* Nothing. */; bottom <= top; ++bottom)
2596 YYFPRINTF (stderr, " %d", *bottom);
2597 YYFPRINTF (stderr, "\n");
2600 # define YY_STACK_PRINT(Bottom, Top) \
2603 yy_stack_print ((Bottom), (Top)); \
2607 /*------------------------------------------------.
2608 | Report that the YYRULE is going to be reduced. |
2609 `------------------------------------------------*/
2611 #if defined (__STDC__) || defined (__cplusplus)
2613 yy_reduce_print (int yyrule)
2616 yy_reduce_print (yyrule)
2621 unsigned long int yylno = yyrline[yyrule];
2622 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2624 /* Print the symbols being reduced, and their result. */
2625 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2626 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2627 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2630 # define YY_REDUCE_PRINT(Rule) \
2633 yy_reduce_print (Rule); \
2636 /* Nonzero means print parse trace. It is left uninitialized so that
2637 multiple parsers can coexist. */
2639 #else /* !YYDEBUG */
2640 # define YYDPRINTF(Args)
2641 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2642 # define YY_STACK_PRINT(Bottom, Top)
2643 # define YY_REDUCE_PRINT(Rule)
2644 #endif /* !YYDEBUG */
2647 /* YYINITDEPTH -- initial size of the parser's stacks. */
2649 # define YYINITDEPTH 200
2652 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2653 if the built-in stack extension method is used).
2655 Do not make this value too large; the results are undefined if
2656 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2657 evaluated with infinite-precision integer arithmetic. */
2660 # define YYMAXDEPTH 10000
2668 # if defined (__GLIBC__) && defined (_STRING_H)
2669 # define yystrlen strlen
2671 /* Return the length of YYSTR. */
2673 # if defined (__STDC__) || defined (__cplusplus)
2674 yystrlen (const char *yystr)
2680 const char *yys = yystr;
2682 while (*yys++ != '\0')
2685 return yys - yystr - 1;
2691 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2692 # define yystpcpy stpcpy
2694 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2697 # if defined (__STDC__) || defined (__cplusplus)
2698 yystpcpy (char *yydest, const char *yysrc)
2700 yystpcpy (yydest, yysrc)
2706 const char *yys = yysrc;
2708 while ((*yyd++ = *yys++) != '\0')
2717 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2718 quotes and backslashes, so that it's suitable for yyerror. The
2719 heuristic is that double-quoting is unnecessary unless the string
2720 contains an apostrophe, a comma, or backslash (other than
2721 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2722 null, do not copy; instead, return the length of what the result
2725 yytnamerr (char *yyres, const char *yystr)
2730 char const *yyp = yystr;
2737 goto do_not_strip_quotes;
2741 goto do_not_strip_quotes;
2754 do_not_strip_quotes: ;
2758 return yystrlen (yystr);
2760 return yystpcpy (yyres, yystr) - yyres;
2764 #endif /* YYERROR_VERBOSE */
2769 /*--------------------------------.
2770 | Print this symbol on YYOUTPUT. |
2771 `--------------------------------*/
2773 #if defined (__STDC__) || defined (__cplusplus)
2775 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2778 yysymprint (yyoutput, yytype, yyvaluep)
2784 /* Pacify ``unused variable'' warnings. */
2787 if (yytype < YYNTOKENS)
2788 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2790 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2794 if (yytype < YYNTOKENS)
2795 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2802 YYFPRINTF (yyoutput, ")");
2805 #endif /* ! YYDEBUG */
2806 /*-----------------------------------------------.
2807 | Release the memory associated to this symbol. |
2808 `-----------------------------------------------*/
2810 #if defined (__STDC__) || defined (__cplusplus)
2812 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2815 yydestruct (yymsg, yytype, yyvaluep)
2821 /* Pacify ``unused variable'' warnings. */
2826 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2837 /* Prevent warnings from -Wmissing-prototypes. */
2839 #ifdef YYPARSE_PARAM
2840 # if defined (__STDC__) || defined (__cplusplus)
2841 int yyparse (void *YYPARSE_PARAM);
2845 #else /* ! YYPARSE_PARAM */
2846 #if defined (__STDC__) || defined (__cplusplus)
2851 #endif /* ! YYPARSE_PARAM */
2855 /* The look-ahead symbol. */
2858 /* The semantic value of the look-ahead symbol. */
2861 /* Number of syntax errors so far. */
2870 #ifdef YYPARSE_PARAM
2871 # if defined (__STDC__) || defined (__cplusplus)
2872 int yyparse (void *YYPARSE_PARAM)
2874 int yyparse (YYPARSE_PARAM)
2875 void *YYPARSE_PARAM;
2877 #else /* ! YYPARSE_PARAM */
2878 #if defined (__STDC__) || defined (__cplusplus)
2892 /* Number of tokens to shift before error messages enabled. */
2894 /* Look-ahead token as an internal (translated) token number. */
2897 /* Three stacks and their tools:
2898 `yyss': related to states,
2899 `yyvs': related to semantic values,
2900 `yyls': related to locations.
2902 Refer to the stacks thru separate pointers, to allow yyoverflow
2903 to reallocate them elsewhere. */
2905 /* The state stack. */
2906 short int yyssa[YYINITDEPTH];
2907 short int *yyss = yyssa;
2910 /* The semantic value stack. */
2911 YYSTYPE yyvsa[YYINITDEPTH];
2912 YYSTYPE *yyvs = yyvsa;
2917 #define YYPOPSTACK (yyvsp--, yyssp--)
2919 YYSIZE_T yystacksize = YYINITDEPTH;
2921 /* The variables used to return semantic value and location from the
2926 /* When reducing, the number of symbols on the RHS of the reduced
2930 YYDPRINTF ((stderr, "Starting parse\n"));
2935 yychar = YYEMPTY; /* Cause a token to be read. */
2937 /* Initialize stack pointers.
2938 Waste one element of value and location stack
2939 so that they stay on the same level as the state stack.
2940 The wasted elements are never initialized. */
2947 /*------------------------------------------------------------.
2948 | yynewstate -- Push a new state, which is found in yystate. |
2949 `------------------------------------------------------------*/
2951 /* In all cases, when you get here, the value and location stacks
2952 have just been pushed. so pushing a state here evens the stacks.
2959 if (yyss + yystacksize - 1 <= yyssp)
2961 /* Get the current used size of the three stacks, in elements. */
2962 YYSIZE_T yysize = yyssp - yyss + 1;
2966 /* Give user a chance to reallocate the stack. Use copies of
2967 these so that the &'s don't force the real ones into
2969 YYSTYPE *yyvs1 = yyvs;
2970 short int *yyss1 = yyss;
2973 /* Each stack pointer address is followed by the size of the
2974 data in use in that stack, in bytes. This used to be a
2975 conditional around just the two extra args, but that might
2976 be undefined if yyoverflow is a macro. */
2977 yyoverflow (YY_("memory exhausted"),
2978 &yyss1, yysize * sizeof (*yyssp),
2979 &yyvs1, yysize * sizeof (*yyvsp),
2986 #else /* no yyoverflow */
2987 # ifndef YYSTACK_RELOCATE
2988 goto yyexhaustedlab;
2990 /* Extend the stack our own way. */
2991 if (YYMAXDEPTH <= yystacksize)
2992 goto yyexhaustedlab;
2994 if (YYMAXDEPTH < yystacksize)
2995 yystacksize = YYMAXDEPTH;
2998 short int *yyss1 = yyss;
2999 union yyalloc *yyptr =
3000 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3002 goto yyexhaustedlab;
3003 YYSTACK_RELOCATE (yyss);
3004 YYSTACK_RELOCATE (yyvs);
3006 # undef YYSTACK_RELOCATE
3008 YYSTACK_FREE (yyss1);
3011 #endif /* no yyoverflow */
3013 yyssp = yyss + yysize - 1;
3014 yyvsp = yyvs + yysize - 1;
3017 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3018 (unsigned long int) yystacksize));
3020 if (yyss + yystacksize - 1 <= yyssp)
3024 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3033 /* Do appropriate processing given the current state. */
3034 /* Read a look-ahead token if we need one and don't already have one. */
3037 /* First try to decide what to do without reference to look-ahead token. */
3039 yyn = yypact[yystate];
3040 if (yyn == YYPACT_NINF)
3043 /* Not known => get a look-ahead token if don't already have one. */
3045 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3046 if (yychar == YYEMPTY)
3048 YYDPRINTF ((stderr, "Reading a token: "));
3052 if (yychar <= YYEOF)
3054 yychar = yytoken = YYEOF;
3055 YYDPRINTF ((stderr, "Now at end of input.\n"));
3059 yytoken = YYTRANSLATE (yychar);
3060 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3063 /* If the proper action on seeing token YYTOKEN is to reduce or to
3064 detect an error, take that action. */
3066 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3071 if (yyn == 0 || yyn == YYTABLE_NINF)
3080 /* Shift the look-ahead token. */
3081 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3083 /* Discard the token being shifted unless it is eof. */
3084 if (yychar != YYEOF)
3090 /* Count tokens shifted since error; after three, turn off error
3099 /*-----------------------------------------------------------.
3100 | yydefault -- do the default action for the current state. |
3101 `-----------------------------------------------------------*/
3103 yyn = yydefact[yystate];
3109 /*-----------------------------.
3110 | yyreduce -- Do a reduction. |
3111 `-----------------------------*/
3113 /* yyn is the number of a rule to reduce with. */
3116 /* If YYLEN is nonzero, implement the default value of the action:
3119 Otherwise, the following line sets YYVAL to garbage.
3120 This behavior is undocumented and Bison
3121 users should not rely upon it. Assigning to YYVAL
3122 unconditionally makes the parser a bit smaller, and it avoids a
3123 GCC warning that YYVAL may be used uninitialized. */
3124 yyval = yyvsp[1-yylen];
3127 YY_REDUCE_PRINT (yyn);
3131 #line 1122 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3132 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3136 #line 1122 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3137 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3141 #line 1123 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3142 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3146 #line 1123 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3147 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3151 #line 1124 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3152 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3156 #line 1124 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3157 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3161 #line 1125 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3162 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3166 #line 1125 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3167 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3171 #line 1126 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3172 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3176 #line 1126 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3177 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3181 #line 1130 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3182 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3186 #line 1130 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3187 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3191 #line 1131 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3192 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3196 #line 1131 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3197 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3201 #line 1132 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3202 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3206 #line 1132 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3207 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3211 #line 1133 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3212 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3216 #line 1133 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3217 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3221 #line 1134 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3222 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3226 #line 1134 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3227 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3231 #line 1135 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3232 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3236 #line 1135 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3237 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3241 #line 1136 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3242 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3246 #line 1136 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3247 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3251 #line 1137 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3252 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3256 #line 1138 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3257 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3261 #line 1147 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3262 { (yyval.StrVal) = 0; ;}
3266 #line 1151 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3268 (yyval.StrVal) = (yyvsp[-1].StrVal);
3274 #line 1155 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3282 #line 1163 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3290 #line 1168 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3292 (yyval.StrVal) = (yyvsp[-1].StrVal);
3298 #line 1174 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3299 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3303 #line 1175 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3304 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3308 #line 1176 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3309 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3313 #line 1177 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3314 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3318 #line 1178 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3319 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3323 #line 1182 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3324 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3328 #line 1183 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3329 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3333 #line 1184 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3334 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3338 #line 1188 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3339 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3343 #line 1189 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3344 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3348 #line 1190 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3349 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3353 #line 1191 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3354 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3358 #line 1195 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3359 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3363 #line 1196 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3364 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3368 #line 1197 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3369 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3373 #line 1201 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3374 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3378 #line 1202 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3379 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3383 #line 1203 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3384 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3388 #line 1204 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3389 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3393 #line 1205 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3394 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3398 #line 1209 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3399 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3403 #line 1210 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3404 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3408 #line 1211 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3409 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3413 #line 1214 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3414 { (yyval.UIntVal) = CallingConv::C; ;}
3418 #line 1215 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3419 { (yyval.UIntVal) = CallingConv::C; ;}
3423 #line 1216 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3424 { (yyval.UIntVal) = CallingConv::Fast; ;}
3428 #line 1217 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3429 { (yyval.UIntVal) = CallingConv::Cold; ;}
3433 #line 1218 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3434 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3438 #line 1219 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3439 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3443 #line 1220 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3445 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3446 GEN_ERROR("Calling conv too large");
3447 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3453 #line 1227 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3454 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3458 #line 1228 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3459 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3463 #line 1229 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3464 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3468 #line 1230 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3469 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3473 #line 1231 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3474 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3478 #line 1232 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3479 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3483 #line 1233 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3484 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3488 #line 1234 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3489 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3493 #line 1235 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3494 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3498 #line 1238 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3499 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3503 #line 1239 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3505 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3510 #line 1244 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3511 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3515 #line 1245 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3516 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3520 #line 1246 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3521 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3525 #line 1247 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3526 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3530 #line 1250 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3531 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3535 #line 1251 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3537 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3542 #line 1258 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3543 { (yyval.UIntVal) = 0; ;}
3547 #line 1259 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3549 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3550 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3551 GEN_ERROR("Alignment must be a power of two");
3557 #line 1265 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3558 { (yyval.UIntVal) = 0; ;}
3562 #line 1266 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3564 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3565 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3566 GEN_ERROR("Alignment must be a power of two");
3572 #line 1274 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3574 for (unsigned i = 0, e = (yyvsp[0].StrVal)->length(); i != e; ++i)
3575 if ((*(yyvsp[0].StrVal))[i] == '"' || (*(yyvsp[0].StrVal))[i] == '\\')
3576 GEN_ERROR("Invalid character in section name");
3577 (yyval.StrVal) = (yyvsp[0].StrVal);
3583 #line 1282 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3584 { (yyval.StrVal) = 0; ;}
3588 #line 1283 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3589 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3593 #line 1288 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3598 #line 1289 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3603 #line 1290 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3605 CurGV->setSection(*(yyvsp[0].StrVal));
3606 delete (yyvsp[0].StrVal);
3612 #line 1295 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3614 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3615 GEN_ERROR("Alignment must be a power of two");
3616 CurGV->setAlignment((yyvsp[0].UInt64Val));
3622 #line 1311 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3624 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3630 #line 1315 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3632 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3638 #line 1319 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3640 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3641 GEN_ERROR("Cannot form a pointer to a basic block");
3642 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3643 delete (yyvsp[-1].TypeVal);
3649 #line 1326 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3650 { // Named types are also simple types...
3651 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3653 (yyval.TypeVal) = new PATypeHolder(tmp);
3658 #line 1331 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3659 { // Type UpReference
3660 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3661 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3662 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3663 (yyval.TypeVal) = new PATypeHolder(OT);
3664 UR_OUT("New Upreference!\n");
3670 #line 1339 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3672 std::vector<const Type*> Params;
3673 ParamAttrsVector Attrs;
3674 if ((yyvsp[0].ParamAttrs) != ParamAttr::None) {
3675 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs);
3679 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3680 for (; I != E; ++I, ++index) {
3681 const Type *Ty = I->Ty->get();
3682 Params.push_back(Ty);
3683 if (Ty != Type::VoidTy)
3684 if (I->Attrs != ParamAttr::None) {
3685 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3689 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3690 if (isVarArg) Params.pop_back();
3692 ParamAttrsList *ActualAttrs = 0;
3694 ActualAttrs = ParamAttrsList::get(Attrs);
3695 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, ActualAttrs);
3696 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3697 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3698 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3704 #line 1369 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3706 std::vector<const Type*> Params;
3707 ParamAttrsVector Attrs;
3708 if ((yyvsp[0].ParamAttrs) != ParamAttr::None) {
3709 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs);
3712 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3714 for ( ; I != E; ++I, ++index) {
3715 const Type* Ty = I->Ty->get();
3716 Params.push_back(Ty);
3717 if (Ty != Type::VoidTy)
3718 if (I->Attrs != ParamAttr::None) {
3719 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3723 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3724 if (isVarArg) Params.pop_back();
3726 ParamAttrsList *ActualAttrs = 0;
3728 ActualAttrs = ParamAttrsList::get(Attrs);
3730 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, ActualAttrs);
3731 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3732 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3738 #line 1400 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3739 { // Sized array type?
3740 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3741 delete (yyvsp[-1].TypeVal);
3747 #line 1405 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3749 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3750 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3751 GEN_ERROR("Unsigned result not equal to signed result");
3752 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3753 GEN_ERROR("Element type of a VectorType must be primitive");
3754 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3755 GEN_ERROR("Vector length should be a power of 2");
3756 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3757 delete (yyvsp[-1].TypeVal);
3763 #line 1417 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3764 { // Structure type?
3765 std::vector<const Type*> Elements;
3766 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3767 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3768 Elements.push_back(*I);
3770 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3771 delete (yyvsp[-1].TypeList);
3777 #line 1427 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3778 { // Empty structure type?
3779 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3785 #line 1431 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3787 std::vector<const Type*> Elements;
3788 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3789 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3790 Elements.push_back(*I);
3792 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3793 delete (yyvsp[-2].TypeList);
3799 #line 1441 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3800 { // Empty structure type?
3801 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3807 #line 1448 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3809 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3810 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3815 #line 1455 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3817 if (!UpRefs.empty())
3818 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3819 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3820 GEN_ERROR("LLVM functions cannot return aggregate types");
3821 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3826 #line 1462 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3828 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3833 #line 1467 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3835 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3836 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3842 #line 1472 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3844 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3850 #line 1480 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3852 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3853 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3854 TWA.Ty = new PATypeHolder(Type::VoidTy);
3855 (yyval.TypeWithAttrsList)->push_back(TWA);
3861 #line 1487 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3863 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3864 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3865 TWA.Ty = new PATypeHolder(Type::VoidTy);
3866 (yyval.TypeWithAttrsList)->push_back(TWA);
3872 #line 1494 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3874 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3880 #line 1502 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3882 (yyval.TypeList) = new std::list<PATypeHolder>();
3883 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal));
3884 delete (yyvsp[0].TypeVal);
3890 #line 1508 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3892 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal));
3893 delete (yyvsp[0].TypeVal);
3899 #line 1520 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3900 { // Nonempty unsized arr
3901 if (!UpRefs.empty())
3902 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3903 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3905 GEN_ERROR("Cannot make array constant with type: '" +
3906 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3907 const Type *ETy = ATy->getElementType();
3908 int NumElements = ATy->getNumElements();
3910 // Verify that we have the correct size...
3911 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3912 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3913 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3914 itostr(NumElements) + "");
3916 // Verify all elements are correct type!
3917 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3918 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3919 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3920 ETy->getDescription() +"' as required!\nIt is of type '"+
3921 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3924 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3925 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3931 #line 1548 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3933 if (!UpRefs.empty())
3934 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3935 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3937 GEN_ERROR("Cannot make array constant with type: '" +
3938 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3940 int NumElements = ATy->getNumElements();
3941 if (NumElements != -1 && NumElements != 0)
3942 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3943 " arguments, but has size of " + itostr(NumElements) +"");
3944 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3945 delete (yyvsp[-2].TypeVal);
3951 #line 1564 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3953 if (!UpRefs.empty())
3954 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3955 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3957 GEN_ERROR("Cannot make array constant with type: '" +
3958 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3960 int NumElements = ATy->getNumElements();
3961 const Type *ETy = ATy->getElementType();
3962 if (NumElements != -1 && NumElements != int((yyvsp[0].StrVal)->length()))
3963 GEN_ERROR("Can't build string constant of size " +
3964 itostr((int)((yyvsp[0].StrVal)->length())) +
3965 " when array has size " + itostr(NumElements) + "");
3966 std::vector<Constant*> Vals;
3967 if (ETy == Type::Int8Ty) {
3968 for (unsigned i = 0; i < (yyvsp[0].StrVal)->length(); ++i)
3969 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[0].StrVal))[i]));
3971 delete (yyvsp[0].StrVal);
3972 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3974 delete (yyvsp[0].StrVal);
3975 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3976 delete (yyvsp[-2].TypeVal);
3982 #line 1591 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
3983 { // Nonempty unsized arr
3984 if (!UpRefs.empty())
3985 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3986 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3988 GEN_ERROR("Cannot make packed constant with type: '" +
3989 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3990 const Type *ETy = PTy->getElementType();
3991 int NumElements = PTy->getNumElements();
3993 // Verify that we have the correct size...
3994 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3995 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3996 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3997 itostr(NumElements) + "");
3999 // Verify all elements are correct type!
4000 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4001 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4002 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4003 ETy->getDescription() +"' as required!\nIt is of type '"+
4004 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4007 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
4008 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
4014 #line 1619 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4016 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
4018 GEN_ERROR("Cannot make struct constant with type: '" +
4019 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
4021 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
4022 GEN_ERROR("Illegal number of initializers for structure type");
4024 // Check to ensure that constants are compatible with the type initializer!
4025 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
4026 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
4027 GEN_ERROR("Expected type '" +
4028 STy->getElementType(i)->getDescription() +
4029 "' for element #" + utostr(i) +
4030 " of structure initializer");
4032 // Check to ensure that Type is not packed
4033 if (STy->isPacked())
4034 GEN_ERROR("Unpacked Initializer to vector type '" +
4035 STy->getDescription() + "'");
4037 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
4038 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
4044 #line 1645 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4046 if (!UpRefs.empty())
4047 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4048 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
4050 GEN_ERROR("Cannot make struct constant with type: '" +
4051 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
4053 if (STy->getNumContainedTypes() != 0)
4054 GEN_ERROR("Illegal number of initializers for structure type");
4056 // Check to ensure that Type is not packed
4057 if (STy->isPacked())
4058 GEN_ERROR("Unpacked Initializer to vector type '" +
4059 STy->getDescription() + "'");
4061 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4062 delete (yyvsp[-2].TypeVal);
4068 #line 1665 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4070 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
4072 GEN_ERROR("Cannot make struct constant with type: '" +
4073 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
4075 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
4076 GEN_ERROR("Illegal number of initializers for structure type");
4078 // Check to ensure that constants are compatible with the type initializer!
4079 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
4080 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
4081 GEN_ERROR("Expected type '" +
4082 STy->getElementType(i)->getDescription() +
4083 "' for element #" + utostr(i) +
4084 " of structure initializer");
4086 // Check to ensure that Type is packed
4087 if (!STy->isPacked())
4088 GEN_ERROR("Vector initializer to non-vector type '" +
4089 STy->getDescription() + "'");
4091 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
4092 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
4098 #line 1691 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4100 if (!UpRefs.empty())
4101 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
4102 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
4104 GEN_ERROR("Cannot make struct constant with type: '" +
4105 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
4107 if (STy->getNumContainedTypes() != 0)
4108 GEN_ERROR("Illegal number of initializers for structure type");
4110 // Check to ensure that Type is packed
4111 if (!STy->isPacked())
4112 GEN_ERROR("Vector initializer to non-vector type '" +
4113 STy->getDescription() + "'");
4115 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4116 delete (yyvsp[-4].TypeVal);
4122 #line 1711 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4124 if (!UpRefs.empty())
4125 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4126 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
4128 GEN_ERROR("Cannot make null pointer constant with type: '" +
4129 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
4131 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4132 delete (yyvsp[-1].TypeVal);
4138 #line 1723 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4140 if (!UpRefs.empty())
4141 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4142 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
4143 delete (yyvsp[-1].TypeVal);
4149 #line 1730 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4151 if (!UpRefs.empty())
4152 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4153 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
4155 GEN_ERROR("Global const reference must be a pointer type");
4157 // ConstExprs can exist in the body of a function, thus creating
4158 // GlobalValues whenever they refer to a variable. Because we are in
4159 // the context of a function, getExistingVal will search the functions
4160 // symbol table instead of the module symbol table for the global symbol,
4161 // which throws things all off. To get around this, we just tell
4162 // getExistingVal that we are at global scope here.
4164 Function *SavedCurFn = CurFun.CurrentFunction;
4165 CurFun.CurrentFunction = 0;
4167 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
4170 CurFun.CurrentFunction = SavedCurFn;
4172 // If this is an initializer for a constant pointer, which is referencing a
4173 // (currently) undefined variable, create a stub now that shall be replaced
4174 // in the future with the right type of variable.
4177 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4178 const PointerType *PT = cast<PointerType>(Ty);
4180 // First check to see if the forward references value is already created!
4181 PerModuleInfo::GlobalRefsType::iterator I =
4182 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
4184 if (I != CurModule.GlobalRefs.end()) {
4185 V = I->second; // Placeholder already exists, use it...
4186 (yyvsp[0].ValIDVal).destroy();
4189 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4190 Name = (yyvsp[0].ValIDVal).getName();
4191 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4192 GEN_ERROR("Invalid reference to global");
4194 // Create the forward referenced global.
4196 if (const FunctionType *FTy =
4197 dyn_cast<FunctionType>(PT->getElementType())) {
4198 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4199 CurModule.CurrentModule);
4201 GV = new GlobalVariable(PT->getElementType(), false,
4202 GlobalValue::ExternalWeakLinkage, 0,
4203 Name, CurModule.CurrentModule);
4206 // Keep track of the fact that we have a forward ref to recycle it
4207 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4212 (yyval.ConstVal) = cast<GlobalValue>(V);
4213 delete (yyvsp[-1].TypeVal); // Free the type handle
4219 #line 1796 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4221 if (!UpRefs.empty())
4222 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4223 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4224 GEN_ERROR("Mismatched types for constant expression: " +
4225 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4226 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4227 delete (yyvsp[-1].TypeVal);
4233 #line 1806 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4235 if (!UpRefs.empty())
4236 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4237 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4238 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4239 GEN_ERROR("Cannot create a null initialized value of this type");
4240 (yyval.ConstVal) = Constant::getNullValue(Ty);
4241 delete (yyvsp[-1].TypeVal);
4247 #line 1816 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4248 { // integral constants
4249 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4250 GEN_ERROR("Constant value doesn't fit in type");
4251 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4257 #line 1822 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4258 { // arbitrary precision integer constants
4259 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4260 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4261 GEN_ERROR("Constant value does not fit in type");
4263 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4264 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4265 delete (yyvsp[0].APIntVal);
4271 #line 1832 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4272 { // integral constants
4273 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4274 GEN_ERROR("Constant value doesn't fit in type");
4275 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4281 #line 1838 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4282 { // arbitrary precision integer constants
4283 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4284 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4285 GEN_ERROR("Constant value does not fit in type");
4287 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4288 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4289 delete (yyvsp[0].APIntVal);
4295 #line 1848 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4296 { // Boolean constants
4297 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4298 (yyval.ConstVal) = ConstantInt::getTrue();
4304 #line 1853 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4305 { // Boolean constants
4306 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4307 (yyval.ConstVal) = ConstantInt::getFalse();
4313 #line 1858 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4314 { // Float & Double constants
4315 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4316 GEN_ERROR("Floating point constant invalid for type");
4317 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4323 #line 1866 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4325 if (!UpRefs.empty())
4326 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4327 Constant *Val = (yyvsp[-3].ConstVal);
4328 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4329 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4330 GEN_ERROR("invalid cast opcode for cast from '" +
4331 Val->getType()->getDescription() + "' to '" +
4332 DestTy->getDescription() + "'");
4333 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4334 delete (yyvsp[-1].TypeVal);
4339 #line 1878 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4341 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4342 GEN_ERROR("GetElementPtr requires a pointer operand");
4345 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4348 GEN_ERROR("Index list invalid for constant getelementptr");
4350 SmallVector<Constant*, 8> IdxVec;
4351 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4352 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4353 IdxVec.push_back(C);
4355 GEN_ERROR("Indices to constant getelementptr must be constants");
4357 delete (yyvsp[-1].ValueList);
4359 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4365 #line 1900 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4367 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4368 GEN_ERROR("Select condition must be of boolean type");
4369 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4370 GEN_ERROR("Select operand types must match");
4371 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4377 #line 1908 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4379 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4380 GEN_ERROR("Binary operator types must match");
4382 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4387 #line 1914 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4389 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4390 GEN_ERROR("Logical operator types must match");
4391 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4392 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4393 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4394 GEN_ERROR("Logical operator requires integral operands");
4396 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4402 #line 1925 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4404 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4405 GEN_ERROR("icmp operand types must match");
4406 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4411 #line 1930 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4413 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4414 GEN_ERROR("fcmp operand types must match");
4415 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4420 #line 1935 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4422 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4423 GEN_ERROR("Invalid extractelement operands");
4424 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4430 #line 1941 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4432 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4433 GEN_ERROR("Invalid insertelement operands");
4434 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4440 #line 1947 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4442 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4443 GEN_ERROR("Invalid shufflevector operands");
4444 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4450 #line 1956 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4452 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4458 #line 1960 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4460 (yyval.ConstVector) = new std::vector<Constant*>();
4461 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4467 #line 1968 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4468 { (yyval.BoolVal) = false; ;}
4472 #line 1968 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4473 { (yyval.BoolVal) = true; ;}
4477 #line 1971 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4478 { (yyval.BoolVal) = true; ;}
4482 #line 1971 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4483 { (yyval.BoolVal) = false; ;}
4487 #line 1974 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4489 const Type* VTy = (yyvsp[-1].TypeVal)->get();
4490 Value *V = getVal(VTy, (yyvsp[0].ValIDVal));
4491 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4493 GEN_ERROR("Aliases can be created only to global values");
4495 (yyval.ConstVal) = Aliasee;
4497 delete (yyvsp[-1].TypeVal);
4502 #line 1985 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4504 Constant *Val = (yyvsp[-3].ConstVal);
4505 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4506 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4507 GEN_ERROR("invalid cast opcode for cast from '" +
4508 Val->getType()->getDescription() + "' to '" +
4509 DestTy->getDescription() + "'");
4511 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4513 delete (yyvsp[-1].TypeVal);
4518 #line 2006 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4520 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4521 CurModule.ModuleDone();
4527 #line 2011 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4529 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4530 CurModule.ModuleDone();
4536 #line 2024 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4537 { CurFun.isDeclare = false; ;}
4541 #line 2024 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4543 CurFun.FunctionDone();
4549 #line 2028 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4550 { CurFun.isDeclare = true; ;}
4554 #line 2028 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4561 #line 2031 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4568 #line 2034 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4570 if (!UpRefs.empty())
4571 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4572 // Eagerly resolve types. This is not an optimization, this is a
4573 // requirement that is due to the fact that we could have this:
4575 // %list = type { %list * }
4576 // %list = type { %list * } ; repeated type decl
4578 // If types are not resolved eagerly, then the two types will not be
4579 // determined to be the same type!
4581 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4583 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4585 // If this is a named type that is not a redefinition, add it to the slot
4587 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4590 delete (yyvsp[0].TypeVal);
4596 #line 2058 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4598 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4600 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4602 // If this is a named type that is not a redefinition, add it to the slot
4604 CurModule.Types.push_back((yyvsp[0].PrimType));
4611 #line 2069 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4613 /* "Externally Visible" Linkage */
4614 if ((yyvsp[0].ConstVal) == 0)
4615 GEN_ERROR("Global value initializer is not a constant");
4616 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), GlobalValue::ExternalLinkage,
4617 (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal));
4623 #line 2076 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4630 #line 2080 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4632 if ((yyvsp[0].ConstVal) == 0)
4633 GEN_ERROR("Global value initializer is not a constant");
4634 CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal));
4640 #line 2085 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4647 #line 2089 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4649 if (!UpRefs.empty())
4650 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4651 CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0, (yyvsp[-2].BoolVal));
4653 delete (yyvsp[0].TypeVal);
4658 #line 2095 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4666 #line 2099 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4669 if ((yyvsp[-4].StrVal)) {
4670 Name = *(yyvsp[-4].StrVal);
4671 delete (yyvsp[-4].StrVal);
4674 GEN_ERROR("Alias name cannot be empty");
4676 Constant* Aliasee = (yyvsp[0].ConstVal);
4678 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4680 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[-1].Linkage), Name, Aliasee,
4681 CurModule.CurrentModule);
4682 GA->setVisibility((yyvsp[-3].Visibility));
4683 InsertValue(GA, CurModule.Values);
4689 #line 2118 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4696 #line 2121 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4703 #line 2127 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4705 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4706 if (AsmSoFar.empty())
4707 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[0].StrVal));
4709 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[0].StrVal));
4710 delete (yyvsp[0].StrVal);
4716 #line 2137 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4718 CurModule.CurrentModule->setTargetTriple(*(yyvsp[0].StrVal));
4719 delete (yyvsp[0].StrVal);
4724 #line 2141 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4726 CurModule.CurrentModule->setDataLayout(*(yyvsp[0].StrVal));
4727 delete (yyvsp[0].StrVal);
4732 #line 2148 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4734 CurModule.CurrentModule->addLibrary(*(yyvsp[0].StrVal));
4735 delete (yyvsp[0].StrVal);
4741 #line 2153 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4743 CurModule.CurrentModule->addLibrary(*(yyvsp[0].StrVal));
4744 delete (yyvsp[0].StrVal);
4750 #line 2158 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4757 #line 2167 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4759 if (!UpRefs.empty())
4760 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4761 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4762 GEN_ERROR("void typed arguments are invalid");
4763 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4764 (yyval.ArgList) = (yyvsp[-4].ArgList);
4765 (yyvsp[-4].ArgList)->push_back(E);
4771 #line 2177 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4773 if (!UpRefs.empty())
4774 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4775 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4776 GEN_ERROR("void typed arguments are invalid");
4777 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4778 (yyval.ArgList) = new ArgListType;
4779 (yyval.ArgList)->push_back(E);
4785 #line 2188 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4787 (yyval.ArgList) = (yyvsp[0].ArgList);
4793 #line 2192 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4795 (yyval.ArgList) = (yyvsp[-2].ArgList);
4796 struct ArgListEntry E;
4797 E.Ty = new PATypeHolder(Type::VoidTy);
4799 E.Attrs = ParamAttr::None;
4800 (yyval.ArgList)->push_back(E);
4806 #line 2201 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4808 (yyval.ArgList) = new ArgListType;
4809 struct ArgListEntry E;
4810 E.Ty = new PATypeHolder(Type::VoidTy);
4812 E.Attrs = ParamAttr::None;
4813 (yyval.ArgList)->push_back(E);
4819 #line 2210 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4821 (yyval.ArgList) = 0;
4827 #line 2216 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4829 std::string FunctionName(*(yyvsp[-6].StrVal));
4830 delete (yyvsp[-6].StrVal); // Free strdup'd memory!
4832 // Check the function result for abstractness if this is a define. We should
4833 // have no abstract types at this point
4834 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4835 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4837 std::vector<const Type*> ParamTypeList;
4838 ParamAttrsVector Attrs;
4839 if ((yyvsp[-2].ParamAttrs) != ParamAttr::None) {
4840 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-2].ParamAttrs);
4841 Attrs.push_back(PAWI);
4843 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4845 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++index) {
4846 const Type* Ty = I->Ty->get();
4847 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4848 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4849 ParamTypeList.push_back(Ty);
4850 if (Ty != Type::VoidTy)
4851 if (I->Attrs != ParamAttr::None) {
4852 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4853 Attrs.push_back(PAWI);
4858 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4859 if (isVarArg) ParamTypeList.pop_back();
4861 ParamAttrsList *PAL = 0;
4863 PAL = ParamAttrsList::get(Attrs);
4865 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, PAL);
4866 const PointerType *PFT = PointerType::get(FT);
4867 delete (yyvsp[-7].TypeVal);
4870 if (!FunctionName.empty()) {
4871 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4873 ID = ValID::createGlobalID(CurModule.Values.size());
4877 // See if this function was forward referenced. If so, recycle the object.
4878 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4879 // Move the function to the end of the list, from whereever it was
4880 // previously inserted.
4881 Fn = cast<Function>(FWRef);
4882 CurModule.CurrentModule->getFunctionList().remove(Fn);
4883 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4884 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4885 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4886 if (Fn->getFunctionType() != FT) {
4887 // The existing function doesn't have the same type. This is an overload
4889 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4890 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4891 // Neither the existing or the current function is a declaration and they
4892 // have the same name and same type. Clearly this is a redefinition.
4893 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4894 } if (Fn->isDeclaration()) {
4895 // Make sure to strip off any argument names so we can't get conflicts.
4896 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4900 } else { // Not already defined?
4901 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4902 CurModule.CurrentModule);
4904 InsertValue(Fn, CurModule.Values);
4907 CurFun.FunctionStart(Fn);
4909 if (CurFun.isDeclare) {
4910 // If we have declaration, always overwrite linkage. This will allow us to
4911 // correctly handle cases, when pointer to function is passed as argument to
4912 // another function.
4913 Fn->setLinkage(CurFun.Linkage);
4914 Fn->setVisibility(CurFun.Visibility);
4916 Fn->setCallingConv((yyvsp[-8].UIntVal));
4917 Fn->setAlignment((yyvsp[0].UIntVal));
4918 if ((yyvsp[-1].StrVal)) {
4919 Fn->setSection(*(yyvsp[-1].StrVal));
4920 delete (yyvsp[-1].StrVal);
4923 // Add all of the arguments we parsed to the function...
4924 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4925 if (isVarArg) { // Nuke the last entry
4926 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4927 "Not a varargs marker!");
4928 delete (yyvsp[-4].ArgList)->back().Ty;
4929 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4931 Function::arg_iterator ArgIt = Fn->arg_begin();
4932 Function::arg_iterator ArgEnd = Fn->arg_end();
4934 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4935 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4936 delete I->Ty; // Delete the typeholder...
4937 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4943 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4950 #line 2338 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4952 (yyval.FunctionVal) = CurFun.CurrentFunction;
4954 // Make sure that we keep track of the linkage type even if there was a
4955 // previous "declare".
4956 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4957 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4962 #line 2349 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4964 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4970 #line 2354 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4972 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4973 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4974 (yyval.FunctionVal) = CurFun.CurrentFunction;
4975 CurFun.FunctionDone();
4981 #line 2366 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4983 (yyval.BoolVal) = false;
4989 #line 2370 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4991 (yyval.BoolVal) = true;
4997 #line 2375 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
4998 { // A reference to a direct constant
4999 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
5005 #line 2379 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5007 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
5013 #line 2383 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5014 { // Perhaps it's an FP constant?
5015 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
5021 #line 2387 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5023 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5029 #line 2391 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5031 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5037 #line 2395 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5039 (yyval.ValIDVal) = ValID::createNull();
5045 #line 2399 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5047 (yyval.ValIDVal) = ValID::createUndef();
5053 #line 2403 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5054 { // A vector zero constant.
5055 (yyval.ValIDVal) = ValID::createZeroInit();
5061 #line 2407 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5062 { // Nonempty unsized packed vector
5063 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
5064 int NumElements = (yyvsp[-1].ConstVector)->size();
5066 VectorType* pt = VectorType::get(ETy, NumElements);
5067 PATypeHolder* PTy = new PATypeHolder(
5075 // Verify all elements are correct type!
5076 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
5077 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
5078 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5079 ETy->getDescription() +"' as required!\nIt is of type '" +
5080 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
5083 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
5084 delete PTy; delete (yyvsp[-1].ConstVector);
5090 #line 2432 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5092 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
5098 #line 2436 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5100 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[-2].StrVal), *(yyvsp[0].StrVal), (yyvsp[-3].BoolVal));
5101 delete (yyvsp[-2].StrVal);
5102 delete (yyvsp[0].StrVal);
5108 #line 2446 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5109 { // Is it an integer reference...?
5110 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
5116 #line 2450 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5118 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
5124 #line 2454 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5125 { // Is it a named reference...?
5126 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[0].StrVal));
5127 delete (yyvsp[0].StrVal);
5133 #line 2459 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5134 { // Is it a named reference...?
5135 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[0].StrVal));
5136 delete (yyvsp[0].StrVal);
5142 #line 2472 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5144 if (!UpRefs.empty())
5145 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5146 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5147 delete (yyvsp[-1].TypeVal);
5153 #line 2481 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5155 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
5161 #line 2485 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5162 { // Do not allow functions with 0 basic blocks
5163 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
5169 #line 2494 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5171 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
5173 InsertValue((yyvsp[0].TermInstVal));
5174 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
5175 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
5181 #line 2503 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5183 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
5184 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5185 if (CI2->getParent() == 0)
5186 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
5187 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
5188 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
5194 #line 2512 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5195 { // Empty space between instruction lists
5196 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5202 #line 2516 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5203 { // Labelled (named) basic block
5204 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[0].StrVal)));
5205 delete (yyvsp[0].StrVal);
5212 #line 2523 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5213 { // Return with a result...
5214 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
5220 #line 2527 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5221 { // Return with no result...
5222 (yyval.TermInstVal) = new ReturnInst();
5228 #line 2531 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5229 { // Unconditional Branch...
5230 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5232 (yyval.TermInstVal) = new BranchInst(tmpBB);
5237 #line 2536 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5239 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
5240 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
5242 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5244 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5246 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5251 #line 2546 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5253 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5255 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5257 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5258 (yyval.TermInstVal) = S;
5260 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5261 E = (yyvsp[-1].JumpTable)->end();
5262 for (; I != E; ++I) {
5263 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5264 S->addCase(CI, I->second);
5266 GEN_ERROR("Switch case is constant, but not a simple integer");
5268 delete (yyvsp[-1].JumpTable);
5274 #line 2565 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5276 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5278 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5280 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5281 (yyval.TermInstVal) = S;
5287 #line 2575 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5290 // Handle the short syntax
5291 const PointerType *PFTy = 0;
5292 const FunctionType *Ty = 0;
5293 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5294 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5295 // Pull out the types of all of the arguments...
5296 std::vector<const Type*> ParamTypes;
5297 ParamAttrsVector Attrs;
5298 if ((yyvsp[-6].ParamAttrs) != ParamAttr::None) {
5299 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-6].ParamAttrs);
5300 Attrs.push_back(PAWI);
5302 ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end();
5304 for (; I != E; ++I, ++index) {
5305 const Type *Ty = I->Val->getType();
5306 if (Ty == Type::VoidTy)
5307 GEN_ERROR("Short call syntax cannot be used with varargs");
5308 ParamTypes.push_back(Ty);
5309 if (I->Attrs != ParamAttr::None) {
5310 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5311 Attrs.push_back(PAWI);
5315 ParamAttrsList *PAL = 0;
5317 PAL = ParamAttrsList::get(Attrs);
5318 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, PAL);
5319 PFTy = PointerType::get(Ty);
5322 delete (yyvsp[-11].TypeVal);
5324 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5326 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5328 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5331 // Check the arguments
5333 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5334 // Make sure no arguments is a good thing!
5335 if (Ty->getNumParams() != 0)
5336 GEN_ERROR("No arguments passed to a function that "
5337 "expects arguments");
5338 } else { // Has arguments?
5339 // Loop through FunctionType's arguments and ensure they are specified
5341 FunctionType::param_iterator I = Ty->param_begin();
5342 FunctionType::param_iterator E = Ty->param_end();
5343 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5345 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5346 if (ArgI->Val->getType() != *I)
5347 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5348 (*I)->getDescription() + "'");
5349 Args.push_back(ArgI->Val);
5352 if (Ty->isVarArg()) {
5354 for (; ArgI != ArgE; ++ArgI)
5355 Args.push_back(ArgI->Val); // push the remaining varargs
5356 } else if (I != E || ArgI != ArgE)
5357 GEN_ERROR("Invalid number of parameters detected");
5360 // Create the InvokeInst
5361 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5362 II->setCallingConv((yyvsp[-12].UIntVal));
5363 (yyval.TermInstVal) = II;
5364 delete (yyvsp[-8].ValueRefList);
5370 #line 2654 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5372 (yyval.TermInstVal) = new UnwindInst();
5378 #line 2658 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5380 (yyval.TermInstVal) = new UnreachableInst();
5386 #line 2665 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5388 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5389 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5392 GEN_ERROR("May only switch on a constant pool value");
5394 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5396 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5401 #line 2676 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5403 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5404 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5408 GEN_ERROR("May only switch on a constant pool value");
5410 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5412 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5417 #line 2689 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5419 // Is this definition named?? if so, assign the name...
5420 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5422 InsertValue((yyvsp[0].InstVal));
5423 (yyval.InstVal) = (yyvsp[0].InstVal);
5429 #line 2699 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5430 { // Used for PHI nodes
5431 if (!UpRefs.empty())
5432 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5433 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5434 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5436 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5438 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5439 delete (yyvsp[-5].TypeVal);
5444 #line 2710 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5446 (yyval.PHIList) = (yyvsp[-6].PHIList);
5447 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5449 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5451 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5456 #line 2720 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5458 if (!UpRefs.empty())
5459 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5460 // Used for call and invoke instructions
5461 (yyval.ValueRefList) = new ValueRefList();
5462 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5463 (yyval.ValueRefList)->push_back(E);
5464 delete (yyvsp[-2].TypeVal);
5469 #line 2729 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5471 if (!UpRefs.empty())
5472 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5473 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5474 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5475 (yyval.ValueRefList)->push_back(E);
5476 delete (yyvsp[-2].TypeVal);
5482 #line 2738 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5483 { (yyval.ValueRefList) = new ValueRefList(); ;}
5487 #line 2741 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5488 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5492 #line 2742 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5494 (yyval.ValueList) = (yyvsp[-2].ValueList);
5495 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5501 #line 2749 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5503 (yyval.BoolVal) = true;
5509 #line 2753 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5511 (yyval.BoolVal) = false;
5517 #line 2758 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5519 if (!UpRefs.empty())
5520 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5521 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5522 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5524 "Arithmetic operator requires integer, FP, or packed operands");
5525 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5526 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5527 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5528 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5529 GEN_ERROR("Remainder not supported on vector types");
5530 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5532 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5534 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5535 if ((yyval.InstVal) == 0)
5536 GEN_ERROR("binary operator returned null");
5537 delete (yyvsp[-3].TypeVal);
5542 #line 2779 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5544 if (!UpRefs.empty())
5545 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5546 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5547 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5548 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5549 GEN_ERROR("Logical operator requires integral operands");
5551 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5553 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5555 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5556 if ((yyval.InstVal) == 0)
5557 GEN_ERROR("binary operator returned null");
5558 delete (yyvsp[-3].TypeVal);
5563 #line 2796 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5565 if (!UpRefs.empty())
5566 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5567 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5568 GEN_ERROR("Vector types not supported by icmp instruction");
5569 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5571 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5573 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5574 if ((yyval.InstVal) == 0)
5575 GEN_ERROR("icmp operator returned null");
5576 delete (yyvsp[-3].TypeVal);
5581 #line 2810 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5583 if (!UpRefs.empty())
5584 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5585 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5586 GEN_ERROR("Vector types not supported by fcmp instruction");
5587 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5589 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5591 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5592 if ((yyval.InstVal) == 0)
5593 GEN_ERROR("fcmp operator returned null");
5594 delete (yyvsp[-3].TypeVal);
5599 #line 2824 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5601 if (!UpRefs.empty())
5602 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5603 Value* Val = (yyvsp[-2].ValueVal);
5604 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5605 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5606 GEN_ERROR("invalid cast opcode for cast from '" +
5607 Val->getType()->getDescription() + "' to '" +
5608 DestTy->getDescription() + "'");
5609 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5610 delete (yyvsp[0].TypeVal);
5615 #line 2836 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5617 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5618 GEN_ERROR("select condition must be boolean");
5619 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5620 GEN_ERROR("select value types should match");
5621 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5627 #line 2844 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5629 if (!UpRefs.empty())
5630 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5631 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5632 delete (yyvsp[0].TypeVal);
5638 #line 2851 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5640 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5641 GEN_ERROR("Invalid extractelement operands");
5642 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5648 #line 2857 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5650 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5651 GEN_ERROR("Invalid insertelement operands");
5652 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5658 #line 2863 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5660 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5661 GEN_ERROR("Invalid shufflevector operands");
5662 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5668 #line 2869 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5670 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5671 if (!Ty->isFirstClassType())
5672 GEN_ERROR("PHI node operands must be of first class type");
5673 (yyval.InstVal) = new PHINode(Ty);
5674 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5675 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5676 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5677 GEN_ERROR("All elements of a PHI node must be of the same type");
5678 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5679 (yyvsp[0].PHIList)->pop_front();
5681 delete (yyvsp[0].PHIList); // Free the list...
5687 #line 2885 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5690 // Handle the short syntax
5691 const PointerType *PFTy = 0;
5692 const FunctionType *Ty = 0;
5693 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5694 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5695 // Pull out the types of all of the arguments...
5696 std::vector<const Type*> ParamTypes;
5697 ParamAttrsVector Attrs;
5698 if ((yyvsp[0].ParamAttrs) != ParamAttr::None) {
5699 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[0].ParamAttrs);
5700 Attrs.push_back(PAWI);
5703 ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end();
5704 for (; I != E; ++I, ++index) {
5705 const Type *Ty = I->Val->getType();
5706 if (Ty == Type::VoidTy)
5707 GEN_ERROR("Short call syntax cannot be used with varargs");
5708 ParamTypes.push_back(Ty);
5709 if (I->Attrs != ParamAttr::None) {
5710 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5711 Attrs.push_back(PAWI);
5715 ParamAttrsList *PAL = 0;
5717 PAL = ParamAttrsList::get(Attrs);
5719 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, PAL);
5720 PFTy = PointerType::get(Ty);
5723 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5726 // Check for call to invalid intrinsic to avoid crashing later.
5727 if (Function *theF = dyn_cast<Function>(V)) {
5728 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5729 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5730 !theF->getIntrinsicID(true))
5731 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5732 theF->getName() + "'");
5735 // Check the arguments
5737 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5738 // Make sure no arguments is a good thing!
5739 if (Ty->getNumParams() != 0)
5740 GEN_ERROR("No arguments passed to a function that "
5741 "expects arguments");
5742 } else { // Has arguments?
5743 // Loop through FunctionType's arguments and ensure they are specified
5746 FunctionType::param_iterator I = Ty->param_begin();
5747 FunctionType::param_iterator E = Ty->param_end();
5748 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5750 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5751 if (ArgI->Val->getType() != *I)
5752 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5753 (*I)->getDescription() + "'");
5754 Args.push_back(ArgI->Val);
5756 if (Ty->isVarArg()) {
5758 for (; ArgI != ArgE; ++ArgI)
5759 Args.push_back(ArgI->Val); // push the remaining varargs
5760 } else if (I != E || ArgI != ArgE)
5761 GEN_ERROR("Invalid number of parameters detected");
5763 // Create the call node
5764 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5765 CI->setTailCall((yyvsp[-7].BoolVal));
5766 CI->setCallingConv((yyvsp[-6].UIntVal));
5767 (yyval.InstVal) = CI;
5768 delete (yyvsp[-2].ValueRefList);
5769 delete (yyvsp[-5].TypeVal);
5775 #line 2969 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5777 (yyval.InstVal) = (yyvsp[0].InstVal);
5783 #line 2974 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5785 (yyval.BoolVal) = true;
5791 #line 2978 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5793 (yyval.BoolVal) = false;
5799 #line 2985 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5801 if (!UpRefs.empty())
5802 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5803 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5804 delete (yyvsp[-1].TypeVal);
5810 #line 2992 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5812 if (!UpRefs.empty())
5813 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5814 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5816 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5817 delete (yyvsp[-4].TypeVal);
5822 #line 3000 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5824 if (!UpRefs.empty())
5825 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5826 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5827 delete (yyvsp[-1].TypeVal);
5833 #line 3007 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5835 if (!UpRefs.empty())
5836 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5837 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5839 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5840 delete (yyvsp[-4].TypeVal);
5845 #line 3015 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5847 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5848 GEN_ERROR("Trying to free nonpointer type " +
5849 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5850 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5856 #line 3023 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5858 if (!UpRefs.empty())
5859 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5860 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5861 GEN_ERROR("Can't load from nonpointer type: " +
5862 (*(yyvsp[-2].TypeVal))->getDescription());
5863 if (!cast<PointerType>((yyvsp[-2].TypeVal)->get())->getElementType()->isFirstClassType())
5864 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5865 (*(yyvsp[-2].TypeVal))->getDescription());
5866 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5868 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-4].BoolVal), (yyvsp[0].UIntVal));
5869 delete (yyvsp[-2].TypeVal);
5874 #line 3037 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5876 if (!UpRefs.empty())
5877 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5878 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-2].TypeVal)->get());
5880 GEN_ERROR("Can't store to a nonpointer type: " +
5881 (*(yyvsp[-2].TypeVal))->getDescription());
5882 const Type *ElTy = PT->getElementType();
5883 if (ElTy != (yyvsp[-4].ValueVal)->getType())
5884 GEN_ERROR("Can't store '" + (yyvsp[-4].ValueVal)->getType()->getDescription() +
5885 "' into space of type '" + ElTy->getDescription() + "'");
5887 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5889 (yyval.InstVal) = new StoreInst((yyvsp[-4].ValueVal), tmpVal, (yyvsp[-6].BoolVal), (yyvsp[0].UIntVal));
5890 delete (yyvsp[-2].TypeVal);
5895 #line 3054 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
5897 if (!UpRefs.empty())
5898 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5899 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5900 GEN_ERROR("getelementptr insn requires pointer operand");
5902 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5903 GEN_ERROR("Invalid getelementptr indices for type '" +
5904 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5905 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5907 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5908 delete (yyvsp[-2].TypeVal);
5909 delete (yyvsp[0].ValueList);
5917 /* Line 1126 of yacc.c. */
5918 #line 5919 "llvmAsmParser.tab.c"
5924 YY_STACK_PRINT (yyss, yyssp);
5929 /* Now `shift' the result of the reduction. Determine what state
5930 that goes to, based on the state we popped back to and the rule
5931 number reduced by. */
5935 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5936 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5937 yystate = yytable[yystate];
5939 yystate = yydefgoto[yyn - YYNTOKENS];
5944 /*------------------------------------.
5945 | yyerrlab -- here on detecting error |
5946 `------------------------------------*/
5948 /* If not already recovering from an error, report this error. */
5953 yyn = yypact[yystate];
5955 if (YYPACT_NINF < yyn && yyn < YYLAST)
5957 int yytype = YYTRANSLATE (yychar);
5958 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5959 YYSIZE_T yysize = yysize0;
5961 int yysize_overflow = 0;
5963 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5964 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5968 /* This is so xgettext sees the translatable formats that are
5969 constructed on the fly. */
5970 YY_("syntax error, unexpected %s");
5971 YY_("syntax error, unexpected %s, expecting %s");
5972 YY_("syntax error, unexpected %s, expecting %s or %s");
5973 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5974 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5978 static char const yyunexpected[] = "syntax error, unexpected %s";
5979 static char const yyexpecting[] = ", expecting %s";
5980 static char const yyor[] = " or %s";
5981 char yyformat[sizeof yyunexpected
5982 + sizeof yyexpecting - 1
5983 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5984 * (sizeof yyor - 1))];
5985 char const *yyprefix = yyexpecting;
5987 /* Start YYX at -YYN if negative to avoid negative indexes in
5989 int yyxbegin = yyn < 0 ? -yyn : 0;
5991 /* Stay within bounds of both yycheck and yytname. */
5992 int yychecklim = YYLAST - yyn;
5993 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5996 yyarg[0] = yytname[yytype];
5997 yyfmt = yystpcpy (yyformat, yyunexpected);
5999 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
6000 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
6002 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
6006 yyformat[sizeof yyunexpected - 1] = '\0';
6009 yyarg[yycount++] = yytname[yyx];
6010 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
6011 yysize_overflow |= yysize1 < yysize;
6013 yyfmt = yystpcpy (yyfmt, yyprefix);
6017 yyf = YY_(yyformat);
6018 yysize1 = yysize + yystrlen (yyf);
6019 yysize_overflow |= yysize1 < yysize;
6022 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
6023 yymsg = (char *) YYSTACK_ALLOC (yysize);
6026 /* Avoid sprintf, as that infringes on the user's name space.
6027 Don't have undefined behavior even if the translation
6028 produced a string with the wrong number of "%s"s. */
6031 while ((*yyp = *yyf))
6033 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
6035 yyp += yytnamerr (yyp, yyarg[yyi++]);
6045 YYSTACK_FREE (yymsg);
6049 yyerror (YY_("syntax error"));
6050 goto yyexhaustedlab;
6054 #endif /* YYERROR_VERBOSE */
6055 yyerror (YY_("syntax error"));
6060 if (yyerrstatus == 3)
6062 /* If just tried and failed to reuse look-ahead token after an
6063 error, discard it. */
6065 if (yychar <= YYEOF)
6067 /* Return failure if at end of input. */
6068 if (yychar == YYEOF)
6073 yydestruct ("Error: discarding", yytoken, &yylval);
6078 /* Else will try to reuse look-ahead token after shifting the error
6083 /*---------------------------------------------------.
6084 | yyerrorlab -- error raised explicitly by YYERROR. |
6085 `---------------------------------------------------*/
6088 /* Pacify compilers like GCC when the user code never invokes
6089 YYERROR and the label yyerrorlab therefore never appears in user
6100 /*-------------------------------------------------------------.
6101 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6102 `-------------------------------------------------------------*/
6104 yyerrstatus = 3; /* Each real token shifted decrements this. */
6108 yyn = yypact[yystate];
6109 if (yyn != YYPACT_NINF)
6112 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6120 /* Pop the current state because it cannot handle the error token. */
6125 yydestruct ("Error: popping", yystos[yystate], yyvsp);
6128 YY_STACK_PRINT (yyss, yyssp);
6137 /* Shift the error token. */
6138 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6144 /*-------------------------------------.
6145 | yyacceptlab -- YYACCEPT comes here. |
6146 `-------------------------------------*/
6151 /*-----------------------------------.
6152 | yyabortlab -- YYABORT comes here. |
6153 `-----------------------------------*/
6159 /*-------------------------------------------------.
6160 | yyexhaustedlab -- memory exhaustion comes here. |
6161 `-------------------------------------------------*/
6163 yyerror (YY_("memory exhausted"));
6169 if (yychar != YYEOF && yychar != YYEMPTY)
6170 yydestruct ("Cleanup: discarding lookahead",
6172 while (yyssp != yyss)
6174 yydestruct ("Cleanup: popping",
6175 yystos[*yyssp], yyvsp);
6180 YYSTACK_FREE (yyss);
6186 #line 3071 "/proj/llvm/head/llvm/lib/AsmParser/llvmAsmParser.y"
6189 // common code from the two 'RunVMAsmParser' functions
6190 static Module* RunParser(Module * M) {
6192 llvmAsmlineno = 1; // Reset the current line number...
6193 CurModule.CurrentModule = M;
6198 // Check to make sure the parser succeeded
6201 delete ParserResult;
6205 // Emit an error if there are any unresolved types left.
6206 if (!CurModule.LateResolveTypes.empty()) {
6207 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6208 if (DID.Type == ValID::LocalName) {
6209 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6211 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6214 delete ParserResult;
6218 // Emit an error if there are any unresolved values left.
6219 if (!CurModule.LateResolveValues.empty()) {
6220 Value *V = CurModule.LateResolveValues.back();
6221 std::map<Value*, std::pair<ValID, int> >::iterator I =
6222 CurModule.PlaceHolderInfo.find(V);
6224 if (I != CurModule.PlaceHolderInfo.end()) {
6225 ValID &DID = I->second.first;
6226 if (DID.Type == ValID::LocalName) {
6227 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6229 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6232 delete ParserResult;
6237 // Check to make sure that parsing produced a result
6241 // Reset ParserResult variable while saving its value for the result.
6242 Module *Result = ParserResult;
6248 void llvm::GenerateError(const std::string &message, int LineNo) {
6249 if (LineNo == -1) LineNo = llvmAsmlineno;
6250 // TODO: column number in exception
6252 TheParseError->setError(CurFilename, message, LineNo);
6256 int yyerror(const char *ErrorMsg) {
6258 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6259 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6260 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6261 if (yychar != YYEMPTY && yychar != 0)
6262 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6264 GenerateError(errMsg);