1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse llvmAsmparse
51 #define yylex llvmAsmlex
52 #define yyerror llvmAsmerror
53 #define yylval llvmAsmlval
54 #define yychar llvmAsmchar
55 #define yydebug llvmAsmdebug
56 #define yynerrs llvmAsmnerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
85 ATSTRINGCONSTANT = 278,
86 PCTSTRINGCONSTANT = 279,
87 ZEROINITIALIZER = 280,
126 X86_STDCALLCC_TOK = 319,
127 X86_FASTCALLCC_TOK = 320,
193 EXTRACTELEMENT = 386,
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
223 #define PPC_FP128 271
227 #define GLOBALVAR 275
229 #define STRINGCONSTANT 277
230 #define ATSTRINGCONSTANT 278
231 #define PCTSTRINGCONSTANT 279
232 #define ZEROINITIALIZER 280
244 #define THREAD_LOCAL 292
246 #define DOTDOTDOT 294
252 #define APPENDING 300
253 #define DLLIMPORT 301
254 #define DLLEXPORT 302
255 #define EXTERN_WEAK 303
266 #define SIDEEFFECT 314
269 #define FASTCC_TOK 317
270 #define COLDCC_TOK 318
271 #define X86_STDCALLCC_TOK 319
272 #define X86_FASTCALLCC_TOK 320
273 #define DATALAYOUT 321
279 #define UNREACHABLE 327
322 #define GETELEMENTPTR 370
338 #define EXTRACTELEMENT 386
339 #define INSERTELEMENT 387
340 #define SHUFFLEVECTOR 388
352 #define PROTECTED 400
357 /* Copy the first part of user declarations. */
358 #line 14 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
360 #include "ParserInternals.h"
361 #include "llvm/CallingConv.h"
362 #include "llvm/InlineAsm.h"
363 #include "llvm/Instructions.h"
364 #include "llvm/Module.h"
365 #include "llvm/ValueSymbolTable.h"
366 #include "llvm/AutoUpgrade.h"
367 #include "llvm/Support/GetElementPtrTypeIterator.h"
368 #include "llvm/Support/CommandLine.h"
369 #include "llvm/ADT/SmallVector.h"
370 #include "llvm/ADT/STLExtras.h"
371 #include "llvm/Support/MathExtras.h"
372 #include "llvm/Support/Streams.h"
381 // The following is a gross hack. In order to rid the libAsmParser library of
382 // exceptions, we have to have a way of getting the yyparse function to go into
383 // an error situation. So, whenever we want an error to occur, the GenerateError
384 // function (see bottom of file) sets TriggerError. Then, at the end of each
385 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
386 // (a goto) to put YACC in error state. Furthermore, several calls to
387 // GenerateError are made from inside productions and they must simulate the
388 // previous exception behavior by exiting the production immediately. We have
389 // replaced these with the GEN_ERROR macro which calls GeneratError and then
390 // immediately invokes YYERROR. This would be so much cleaner if it was a
391 // recursive descent parser.
392 static bool TriggerError = false;
393 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
394 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
396 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
397 int yylex(); // declaration" of xxx warnings.
401 std::string CurFilename;
404 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
405 cl::Hidden, cl::init(false));
408 using namespace llvm;
410 static Module *ParserResult;
412 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
413 // relating to upreferences in the input stream.
415 //#define DEBUG_UPREFS 1
417 #define UR_OUT(X) cerr << X
422 #define YYERROR_VERBOSE 1
424 static GlobalVariable *CurGV;
427 // This contains info used when building the body of a function. It is
428 // destroyed when the function is completed.
430 typedef std::vector<Value *> ValueList; // Numbered defs
433 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
435 static struct PerModuleInfo {
436 Module *CurrentModule;
437 ValueList Values; // Module level numbered definitions
438 ValueList LateResolveValues;
439 std::vector<PATypeHolder> Types;
440 std::map<ValID, PATypeHolder> LateResolveTypes;
442 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
443 /// how they were referenced and on which line of the input they came from so
444 /// that we can resolve them later and print error messages as appropriate.
445 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
447 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
448 // references to global values. Global values may be referenced before they
449 // are defined, and if so, the temporary object that they represent is held
450 // here. This is used for forward references of GlobalValues.
452 typedef std::map<std::pair<const PointerType *,
453 ValID>, GlobalValue*> GlobalRefsType;
454 GlobalRefsType GlobalRefs;
457 // If we could not resolve some functions at function compilation time
458 // (calls to functions before they are defined), resolve them now... Types
459 // are resolved when the constant pool has been completely parsed.
461 ResolveDefinitions(LateResolveValues);
465 // Check to make sure that all global value forward references have been
468 if (!GlobalRefs.empty()) {
469 std::string UndefinedReferences = "Unresolved global references exist:\n";
471 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
473 UndefinedReferences += " " + I->first.first->getDescription() + " " +
474 I->first.second.getName() + "\n";
476 GenerateError(UndefinedReferences);
480 // Look for intrinsic functions and CallInst that need to be upgraded
481 for (Module::iterator FI = CurrentModule->begin(),
482 FE = CurrentModule->end(); FI != FE; )
483 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
485 Values.clear(); // Clear out function local definitions
490 // GetForwardRefForGlobal - Check to see if there is a forward reference
491 // for this global. If so, remove it from the GlobalRefs map and return it.
492 // If not, just return null.
493 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
494 // Check to see if there is a forward reference to this global variable...
495 // if there is, eliminate it and patch the reference to use the new def'n.
496 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
497 GlobalValue *Ret = 0;
498 if (I != GlobalRefs.end()) {
505 bool TypeIsUnresolved(PATypeHolder* PATy) {
506 // If it isn't abstract, its resolved
507 const Type* Ty = PATy->get();
508 if (!Ty->isAbstract())
510 // Traverse the type looking for abstract types. If it isn't abstract then
511 // we don't need to traverse that leg of the type.
512 std::vector<const Type*> WorkList, SeenList;
513 WorkList.push_back(Ty);
514 while (!WorkList.empty()) {
515 const Type* Ty = WorkList.back();
516 SeenList.push_back(Ty);
518 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
519 // Check to see if this is an unresolved type
520 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
521 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
522 for ( ; I != E; ++I) {
523 if (I->second.get() == OpTy)
526 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
527 const Type* TheTy = SeqTy->getElementType();
528 if (TheTy->isAbstract() && TheTy != Ty) {
529 std::vector<const Type*>::iterator I = SeenList.begin(),
535 WorkList.push_back(TheTy);
537 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
538 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
539 const Type* TheTy = StrTy->getElementType(i);
540 if (TheTy->isAbstract() && TheTy != Ty) {
541 std::vector<const Type*>::iterator I = SeenList.begin(),
547 WorkList.push_back(TheTy);
556 static struct PerFunctionInfo {
557 Function *CurrentFunction; // Pointer to current function being created
559 ValueList Values; // Keep track of #'d definitions
561 ValueList LateResolveValues;
562 bool isDeclare; // Is this function a forward declararation?
563 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
564 GlobalValue::VisibilityTypes Visibility;
566 /// BBForwardRefs - When we see forward references to basic blocks, keep
567 /// track of them here.
568 std::map<ValID, BasicBlock*> BBForwardRefs;
570 inline PerFunctionInfo() {
573 Linkage = GlobalValue::ExternalLinkage;
574 Visibility = GlobalValue::DefaultVisibility;
577 inline void FunctionStart(Function *M) {
582 void FunctionDone() {
583 // Any forward referenced blocks left?
584 if (!BBForwardRefs.empty()) {
585 GenerateError("Undefined reference to label " +
586 BBForwardRefs.begin()->second->getName());
590 // Resolve all forward references now.
591 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
593 Values.clear(); // Clear out function local definitions
594 BBForwardRefs.clear();
597 Linkage = GlobalValue::ExternalLinkage;
598 Visibility = GlobalValue::DefaultVisibility;
600 } CurFun; // Info for the current function...
602 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
605 //===----------------------------------------------------------------------===//
606 // Code to handle definitions of all the types
607 //===----------------------------------------------------------------------===//
609 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
610 // Things that have names or are void typed don't get slot numbers
611 if (V->hasName() || (V->getType() == Type::VoidTy))
614 // In the case of function values, we have to allow for the forward reference
615 // of basic blocks, which are included in the numbering. Consequently, we keep
616 // track of the next insertion location with NextValNum. When a BB gets
617 // inserted, it could change the size of the CurFun.Values vector.
618 if (&ValueTab == &CurFun.Values) {
619 if (ValueTab.size() <= CurFun.NextValNum)
620 ValueTab.resize(CurFun.NextValNum+1);
621 ValueTab[CurFun.NextValNum++] = V;
624 // For all other lists, its okay to just tack it on the back of the vector.
625 ValueTab.push_back(V);
628 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
630 case ValID::LocalID: // Is it a numbered definition?
631 // Module constants occupy the lowest numbered slots...
632 if (D.Num < CurModule.Types.size())
633 return CurModule.Types[D.Num];
635 case ValID::LocalName: // Is it a named definition?
636 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
637 D.destroy(); // Free old strdup'd memory...
642 GenerateError("Internal parser error: Invalid symbol type reference");
646 // If we reached here, we referenced either a symbol that we don't know about
647 // or an id number that hasn't been read yet. We may be referencing something
648 // forward, so just create an entry to be resolved later and get to it...
650 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
653 if (inFunctionScope()) {
654 if (D.Type == ValID::LocalName) {
655 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
658 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
663 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
664 if (I != CurModule.LateResolveTypes.end())
667 Type *Typ = OpaqueType::get();
668 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
672 // getExistingVal - Look up the value specified by the provided type and
673 // the provided ValID. If the value exists and has already been defined, return
674 // it. Otherwise return null.
676 static Value *getExistingVal(const Type *Ty, const ValID &D) {
677 if (isa<FunctionType>(Ty)) {
678 GenerateError("Functions are not values and "
679 "must be referenced as pointers");
684 case ValID::LocalID: { // Is it a numbered definition?
685 // Check that the number is within bounds.
686 if (D.Num >= CurFun.Values.size())
688 Value *Result = CurFun.Values[D.Num];
689 if (Ty != Result->getType()) {
690 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
691 Result->getType()->getDescription() + "' does not match "
692 "expected type, '" + Ty->getDescription() + "'");
697 case ValID::GlobalID: { // Is it a numbered definition?
698 if (D.Num >= CurModule.Values.size())
700 Value *Result = CurModule.Values[D.Num];
701 if (Ty != Result->getType()) {
702 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
703 Result->getType()->getDescription() + "' does not match "
704 "expected type, '" + Ty->getDescription() + "'");
710 case ValID::LocalName: { // Is it a named definition?
711 if (!inFunctionScope())
713 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
714 Value *N = SymTab.lookup(D.getName());
717 if (N->getType() != Ty)
720 D.destroy(); // Free old strdup'd memory...
723 case ValID::GlobalName: { // Is it a named definition?
724 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
725 Value *N = SymTab.lookup(D.getName());
728 if (N->getType() != Ty)
731 D.destroy(); // Free old strdup'd memory...
735 // Check to make sure that "Ty" is an integral type, and that our
736 // value will fit into the specified type...
737 case ValID::ConstSIntVal: // Is it a constant pool reference??
738 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
739 GenerateError("Signed integral constant '" +
740 itostr(D.ConstPool64) + "' is invalid for type '" +
741 Ty->getDescription() + "'");
744 return ConstantInt::get(Ty, D.ConstPool64, true);
746 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
747 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
748 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
749 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
750 "' is invalid or out of range");
752 } else { // This is really a signed reference. Transmogrify.
753 return ConstantInt::get(Ty, D.ConstPool64, true);
756 return ConstantInt::get(Ty, D.UConstPool64);
759 case ValID::ConstFPVal: // Is it a floating point const pool reference?
760 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
761 GenerateError("FP constant invalid for type");
764 return ConstantFP::get(Ty, D.ConstPoolFP);
766 case ValID::ConstNullVal: // Is it a null value?
767 if (!isa<PointerType>(Ty)) {
768 GenerateError("Cannot create a a non pointer null");
771 return ConstantPointerNull::get(cast<PointerType>(Ty));
773 case ValID::ConstUndefVal: // Is it an undef value?
774 return UndefValue::get(Ty);
776 case ValID::ConstZeroVal: // Is it a zero value?
777 return Constant::getNullValue(Ty);
779 case ValID::ConstantVal: // Fully resolved constant?
780 if (D.ConstantValue->getType() != Ty) {
781 GenerateError("Constant expression type different from required type");
784 return D.ConstantValue;
786 case ValID::InlineAsmVal: { // Inline asm expression
787 const PointerType *PTy = dyn_cast<PointerType>(Ty);
788 const FunctionType *FTy =
789 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
790 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
791 GenerateError("Invalid type for asm constraint string");
794 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
795 D.IAD->HasSideEffects);
796 D.destroy(); // Free InlineAsmDescriptor.
800 assert(0 && "Unhandled case!");
804 assert(0 && "Unhandled case!");
808 // getVal - This function is identical to getExistingVal, except that if a
809 // value is not already defined, it "improvises" by creating a placeholder var
810 // that looks and acts just like the requested variable. When the value is
811 // defined later, all uses of the placeholder variable are replaced with the
814 static Value *getVal(const Type *Ty, const ValID &ID) {
815 if (Ty == Type::LabelTy) {
816 GenerateError("Cannot use a basic block here");
820 // See if the value has already been defined.
821 Value *V = getExistingVal(Ty, ID);
823 if (TriggerError) return 0;
825 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
826 GenerateError("Invalid use of a composite type");
830 // If we reached here, we referenced either a symbol that we don't know about
831 // or an id number that hasn't been read yet. We may be referencing something
832 // forward, so just create an entry to be resolved later and get to it...
835 case ValID::GlobalName:
836 case ValID::GlobalID: {
837 const PointerType *PTy = dyn_cast<PointerType>(Ty);
839 GenerateError("Invalid type for reference to global" );
842 const Type* ElTy = PTy->getElementType();
843 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
844 V = new Function(FTy, GlobalValue::ExternalLinkage);
846 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
850 V = new Argument(Ty);
853 // Remember where this forward reference came from. FIXME, shouldn't we try
854 // to recycle these things??
855 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
858 if (inFunctionScope())
859 InsertValue(V, CurFun.LateResolveValues);
861 InsertValue(V, CurModule.LateResolveValues);
865 /// defineBBVal - This is a definition of a new basic block with the specified
866 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
867 static BasicBlock *defineBBVal(const ValID &ID) {
868 assert(inFunctionScope() && "Can't get basic block at global scope!");
872 // First, see if this was forward referenced
874 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
875 if (BBI != CurFun.BBForwardRefs.end()) {
877 // The forward declaration could have been inserted anywhere in the
878 // function: insert it into the correct place now.
879 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
880 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
882 // We're about to erase the entry, save the key so we can clean it up.
883 ValID Tmp = BBI->first;
885 // Erase the forward ref from the map as its no longer "forward"
886 CurFun.BBForwardRefs.erase(ID);
888 // The key has been removed from the map but so we don't want to leave
889 // strdup'd memory around so destroy it too.
892 // If its a numbered definition, bump the number and set the BB value.
893 if (ID.Type == ValID::LocalID) {
894 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
902 // We haven't seen this BB before and its first mention is a definition.
903 // Just create it and return it.
904 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
905 BB = new BasicBlock(Name, CurFun.CurrentFunction);
906 if (ID.Type == ValID::LocalID) {
907 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
911 ID.destroy(); // Free strdup'd memory
915 /// getBBVal - get an existing BB value or create a forward reference for it.
917 static BasicBlock *getBBVal(const ValID &ID) {
918 assert(inFunctionScope() && "Can't get basic block at global scope!");
922 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
923 if (BBI != CurFun.BBForwardRefs.end()) {
925 } if (ID.Type == ValID::LocalName) {
926 std::string Name = ID.getName();
927 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
929 if (N->getType()->getTypeID() == Type::LabelTyID)
930 BB = cast<BasicBlock>(N);
932 GenerateError("Reference to label '" + Name + "' is actually of type '"+
933 N->getType()->getDescription() + "'");
934 } else if (ID.Type == ValID::LocalID) {
935 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
936 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
937 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
939 GenerateError("Reference to label '%" + utostr(ID.Num) +
940 "' is actually of type '"+
941 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
944 GenerateError("Illegal label reference " + ID.getName());
948 // If its already been defined, return it now.
950 ID.destroy(); // Free strdup'd memory.
954 // Otherwise, this block has not been seen before, create it.
956 if (ID.Type == ValID::LocalName)
958 BB = new BasicBlock(Name, CurFun.CurrentFunction);
960 // Insert it in the forward refs map.
961 CurFun.BBForwardRefs[ID] = BB;
967 //===----------------------------------------------------------------------===//
968 // Code to handle forward references in instructions
969 //===----------------------------------------------------------------------===//
971 // This code handles the late binding needed with statements that reference
972 // values not defined yet... for example, a forward branch, or the PHI node for
975 // This keeps a table (CurFun.LateResolveValues) of all such forward references
976 // and back patchs after we are done.
979 // ResolveDefinitions - If we could not resolve some defs at parsing
980 // time (forward branches, phi functions for loops, etc...) resolve the
984 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
985 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
986 while (!LateResolvers.empty()) {
987 Value *V = LateResolvers.back();
988 LateResolvers.pop_back();
990 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
991 CurModule.PlaceHolderInfo.find(V);
992 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
994 ValID &DID = PHI->second.first;
996 Value *TheRealValue = getExistingVal(V->getType(), DID);
1000 V->replaceAllUsesWith(TheRealValue);
1002 CurModule.PlaceHolderInfo.erase(PHI);
1003 } else if (FutureLateResolvers) {
1004 // Functions have their unresolved items forwarded to the module late
1006 InsertValue(V, *FutureLateResolvers);
1008 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1009 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1010 "' of type '" + V->getType()->getDescription() + "'",
1011 PHI->second.second);
1014 GenerateError("Reference to an invalid definition: #" +
1015 itostr(DID.Num) + " of type '" +
1016 V->getType()->getDescription() + "'",
1017 PHI->second.second);
1022 LateResolvers.clear();
1025 // ResolveTypeTo - A brand new type was just declared. This means that (if
1026 // name is not null) things referencing Name can be resolved. Otherwise, things
1027 // refering to the number can be resolved. Do this now.
1029 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1032 D = ValID::createLocalName(*Name);
1034 D = ValID::createLocalID(CurModule.Types.size());
1036 std::map<ValID, PATypeHolder>::iterator I =
1037 CurModule.LateResolveTypes.find(D);
1038 if (I != CurModule.LateResolveTypes.end()) {
1039 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1040 CurModule.LateResolveTypes.erase(I);
1044 // setValueName - Set the specified value to the name given. The name may be
1045 // null potentially, in which case this is a noop. The string passed in is
1046 // assumed to be a malloc'd string buffer, and is free'd by this function.
1048 static void setValueName(Value *V, std::string *NameStr) {
1049 if (!NameStr) return;
1050 std::string Name(*NameStr); // Copy string
1051 delete NameStr; // Free old string
1053 if (V->getType() == Type::VoidTy) {
1054 GenerateError("Can't assign name '" + Name+"' to value with void type");
1058 assert(inFunctionScope() && "Must be in function scope!");
1059 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1060 if (ST.lookup(Name)) {
1061 GenerateError("Redefinition of value '" + Name + "' of type '" +
1062 V->getType()->getDescription() + "'");
1070 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1071 /// this is a declaration, otherwise it is a definition.
1072 static GlobalVariable *
1073 ParseGlobalVariable(std::string *NameStr,
1074 GlobalValue::LinkageTypes Linkage,
1075 GlobalValue::VisibilityTypes Visibility,
1076 bool isConstantGlobal, const Type *Ty,
1077 Constant *Initializer, bool IsThreadLocal) {
1078 if (isa<FunctionType>(Ty)) {
1079 GenerateError("Cannot declare global vars of function type");
1083 const PointerType *PTy = PointerType::get(Ty);
1087 Name = *NameStr; // Copy string
1088 delete NameStr; // Free old string
1091 // See if this global value was forward referenced. If so, recycle the
1094 if (!Name.empty()) {
1095 ID = ValID::createGlobalName(Name);
1097 ID = ValID::createGlobalID(CurModule.Values.size());
1100 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1101 // Move the global to the end of the list, from whereever it was
1102 // previously inserted.
1103 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1104 CurModule.CurrentModule->getGlobalList().remove(GV);
1105 CurModule.CurrentModule->getGlobalList().push_back(GV);
1106 GV->setInitializer(Initializer);
1107 GV->setLinkage(Linkage);
1108 GV->setVisibility(Visibility);
1109 GV->setConstant(isConstantGlobal);
1110 GV->setThreadLocal(IsThreadLocal);
1111 InsertValue(GV, CurModule.Values);
1115 // If this global has a name
1116 if (!Name.empty()) {
1117 // if the global we're parsing has an initializer (is a definition) and
1118 // has external linkage.
1119 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1120 // If there is already a global with external linkage with this name
1121 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1122 // If we allow this GVar to get created, it will be renamed in the
1123 // symbol table because it conflicts with an existing GVar. We can't
1124 // allow redefinition of GVars whose linking indicates that their name
1125 // must stay the same. Issue the error.
1126 GenerateError("Redefinition of global variable named '" + Name +
1127 "' of type '" + Ty->getDescription() + "'");
1132 // Otherwise there is no existing GV to use, create one now.
1133 GlobalVariable *GV =
1134 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1135 CurModule.CurrentModule, IsThreadLocal);
1136 GV->setVisibility(Visibility);
1137 InsertValue(GV, CurModule.Values);
1141 // setTypeName - Set the specified type to the name given. The name may be
1142 // null potentially, in which case this is a noop. The string passed in is
1143 // assumed to be a malloc'd string buffer, and is freed by this function.
1145 // This function returns true if the type has already been defined, but is
1146 // allowed to be redefined in the specified context. If the name is a new name
1147 // for the type plane, it is inserted and false is returned.
1148 static bool setTypeName(const Type *T, std::string *NameStr) {
1149 assert(!inFunctionScope() && "Can't give types function-local names!");
1150 if (NameStr == 0) return false;
1152 std::string Name(*NameStr); // Copy string
1153 delete NameStr; // Free old string
1155 // We don't allow assigning names to void type
1156 if (T == Type::VoidTy) {
1157 GenerateError("Can't assign name '" + Name + "' to the void type");
1161 // Set the type name, checking for conflicts as we do so.
1162 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1164 if (AlreadyExists) { // Inserting a name that is already defined???
1165 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1166 assert(Existing && "Conflict but no matching type?!");
1168 // There is only one case where this is allowed: when we are refining an
1169 // opaque type. In this case, Existing will be an opaque type.
1170 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1171 // We ARE replacing an opaque type!
1172 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1176 // Otherwise, this is an attempt to redefine a type. That's okay if
1177 // the redefinition is identical to the original. This will be so if
1178 // Existing and T point to the same Type object. In this one case we
1179 // allow the equivalent redefinition.
1180 if (Existing == T) return true; // Yes, it's equal.
1182 // Any other kind of (non-equivalent) redefinition is an error.
1183 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1184 T->getDescription() + "'");
1190 //===----------------------------------------------------------------------===//
1191 // Code for handling upreferences in type names...
1194 // TypeContains - Returns true if Ty directly contains E in it.
1196 static bool TypeContains(const Type *Ty, const Type *E) {
1197 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1198 E) != Ty->subtype_end();
1202 struct UpRefRecord {
1203 // NestingLevel - The number of nesting levels that need to be popped before
1204 // this type is resolved.
1205 unsigned NestingLevel;
1207 // LastContainedTy - This is the type at the current binding level for the
1208 // type. Every time we reduce the nesting level, this gets updated.
1209 const Type *LastContainedTy;
1211 // UpRefTy - This is the actual opaque type that the upreference is
1212 // represented with.
1213 OpaqueType *UpRefTy;
1215 UpRefRecord(unsigned NL, OpaqueType *URTy)
1216 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1220 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1221 static std::vector<UpRefRecord> UpRefs;
1223 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1224 /// called. It loops through the UpRefs vector, which is a list of the
1225 /// currently active types. For each type, if the up reference is contained in
1226 /// the newly completed type, we decrement the level count. When the level
1227 /// count reaches zero, the upreferenced type is the type that is passed in:
1228 /// thus we can complete the cycle.
1230 static PATypeHolder HandleUpRefs(const Type *ty) {
1231 // If Ty isn't abstract, or if there are no up-references in it, then there is
1232 // nothing to resolve here.
1233 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1235 PATypeHolder Ty(ty);
1236 UR_OUT("Type '" << Ty->getDescription() <<
1237 "' newly formed. Resolving upreferences.\n" <<
1238 UpRefs.size() << " upreferences active!\n");
1240 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1241 // to zero), we resolve them all together before we resolve them to Ty. At
1242 // the end of the loop, if there is anything to resolve to Ty, it will be in
1244 OpaqueType *TypeToResolve = 0;
1246 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1247 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1248 << UpRefs[i].second->getDescription() << ") = "
1249 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1250 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1251 // Decrement level of upreference
1252 unsigned Level = --UpRefs[i].NestingLevel;
1253 UpRefs[i].LastContainedTy = Ty;
1254 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1255 if (Level == 0) { // Upreference should be resolved!
1256 if (!TypeToResolve) {
1257 TypeToResolve = UpRefs[i].UpRefTy;
1259 UR_OUT(" * Resolving upreference for "
1260 << UpRefs[i].second->getDescription() << "\n";
1261 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1262 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1263 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1264 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1266 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1267 --i; // Do not skip the next element...
1272 if (TypeToResolve) {
1273 UR_OUT(" * Resolving upreference for "
1274 << UpRefs[i].second->getDescription() << "\n";
1275 std::string OldName = TypeToResolve->getDescription());
1276 TypeToResolve->refineAbstractTypeTo(Ty);
1282 //===----------------------------------------------------------------------===//
1283 // RunVMAsmParser - Define an interface to this parser
1284 //===----------------------------------------------------------------------===//
1286 static Module* RunParser(Module * M);
1288 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1291 CurFilename = Filename;
1292 return RunParser(new Module(CurFilename));
1295 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1296 set_scan_string(AsmString);
1298 CurFilename = "from_memory";
1300 return RunParser(new Module (CurFilename));
1302 return RunParser(M);
1308 /* Enabling traces. */
1313 /* Enabling verbose error messages. */
1314 #ifdef YYERROR_VERBOSE
1315 # undef YYERROR_VERBOSE
1316 # define YYERROR_VERBOSE 1
1318 # define YYERROR_VERBOSE 0
1321 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1322 #line 963 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
1323 typedef union YYSTYPE {
1324 llvm::Module *ModuleVal;
1325 llvm::Function *FunctionVal;
1326 llvm::BasicBlock *BasicBlockVal;
1327 llvm::TerminatorInst *TermInstVal;
1328 llvm::Instruction *InstVal;
1329 llvm::Constant *ConstVal;
1331 const llvm::Type *PrimType;
1332 std::list<llvm::PATypeHolder> *TypeList;
1333 llvm::PATypeHolder *TypeVal;
1334 llvm::Value *ValueVal;
1335 std::vector<llvm::Value*> *ValueList;
1336 llvm::ArgListType *ArgList;
1337 llvm::TypeWithAttrs TypeWithAttrs;
1338 llvm::TypeWithAttrsList *TypeWithAttrsList;
1339 llvm::ValueRefList *ValueRefList;
1341 // Represent the RHS of PHI node
1342 std::list<std::pair<llvm::Value*,
1343 llvm::BasicBlock*> > *PHIList;
1344 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1345 std::vector<llvm::Constant*> *ConstVector;
1347 llvm::GlobalValue::LinkageTypes Linkage;
1348 llvm::GlobalValue::VisibilityTypes Visibility;
1349 uint16_t ParamAttrs;
1350 llvm::APInt *APIntVal;
1358 std::string *StrVal; // This memory must be deleted
1359 llvm::ValID ValIDVal;
1361 llvm::Instruction::BinaryOps BinaryOpVal;
1362 llvm::Instruction::TermOps TermOpVal;
1363 llvm::Instruction::MemoryOps MemOpVal;
1364 llvm::Instruction::CastOps CastOpVal;
1365 llvm::Instruction::OtherOps OtherOpVal;
1366 llvm::ICmpInst::Predicate IPredicate;
1367 llvm::FCmpInst::Predicate FPredicate;
1369 /* Line 191 of yacc.c. */
1370 #line 1371 "llvmAsmParser.tab.c"
1371 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1372 # define YYSTYPE_IS_DECLARED 1
1373 # define YYSTYPE_IS_TRIVIAL 1
1378 /* Copy the second part of user declarations. */
1381 /* Line 214 of yacc.c. */
1382 #line 1383 "llvmAsmParser.tab.c"
1384 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1386 /* The parser invokes alloca or malloc; define the necessary symbols. */
1388 # ifdef YYSTACK_USE_ALLOCA
1389 # if YYSTACK_USE_ALLOCA
1390 # define YYSTACK_ALLOC alloca
1393 # if defined (alloca) || defined (_ALLOCA_H)
1394 # define YYSTACK_ALLOC alloca
1397 # define YYSTACK_ALLOC __builtin_alloca
1402 # ifdef YYSTACK_ALLOC
1403 /* Pacify GCC's `empty if-body' warning. */
1404 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1406 # if defined (__STDC__) || defined (__cplusplus)
1407 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1408 # define YYSIZE_T size_t
1410 # define YYSTACK_ALLOC malloc
1411 # define YYSTACK_FREE free
1413 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1416 #if (! defined (yyoverflow) \
1417 && (! defined (__cplusplus) \
1418 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1420 /* A type that is properly aligned for any stack member. */
1427 /* The size of the maximum gap between one aligned stack and the next. */
1428 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1430 /* The size of an array large to enough to hold all stacks, each with
1432 # define YYSTACK_BYTES(N) \
1433 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
1434 + YYSTACK_GAP_MAXIMUM)
1436 /* Copy COUNT objects from FROM to TO. The source and destination do
1439 # if defined (__GNUC__) && 1 < __GNUC__
1440 # define YYCOPY(To, From, Count) \
1441 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1443 # define YYCOPY(To, From, Count) \
1446 register YYSIZE_T yyi; \
1447 for (yyi = 0; yyi < (Count); yyi++) \
1448 (To)[yyi] = (From)[yyi]; \
1454 /* Relocate STACK from its old location to the new one. The
1455 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1456 elements in the stack, and YYPTR gives the new location of the
1457 stack. Advance YYPTR to a properly aligned location for the next
1459 # define YYSTACK_RELOCATE(Stack) \
1462 YYSIZE_T yynewbytes; \
1463 YYCOPY (&yyptr->Stack, Stack, yysize); \
1464 Stack = &yyptr->Stack; \
1465 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1466 yyptr += yynewbytes / sizeof (*yyptr); \
1472 #if defined (__STDC__) || defined (__cplusplus)
1473 typedef signed char yysigned_char;
1475 typedef short yysigned_char;
1478 /* YYFINAL -- State number of the termination state. */
1480 /* YYLAST -- Last index in YYTABLE. */
1483 /* YYNTOKENS -- Number of terminals. */
1484 #define YYNTOKENS 160
1485 /* YYNNTS -- Number of nonterminals. */
1487 /* YYNRULES -- Number of rules. */
1488 #define YYNRULES 310
1489 /* YYNRULES -- Number of states. */
1490 #define YYNSTATES 594
1492 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1493 #define YYUNDEFTOK 2
1494 #define YYMAXUTOK 400
1496 #define YYTRANSLATE(YYX) \
1497 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1499 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1500 static const unsigned char yytranslate[] =
1502 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1506 150, 151, 148, 2, 147, 2, 2, 2, 2, 2,
1507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1508 155, 146, 156, 2, 2, 2, 2, 2, 2, 2,
1509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1511 2, 152, 149, 154, 2, 2, 2, 2, 2, 159,
1512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1514 153, 2, 2, 157, 2, 158, 2, 2, 2, 2,
1515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1527 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1528 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1529 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1530 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1531 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1532 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1533 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1534 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1535 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1536 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1537 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1538 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1539 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1540 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1541 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1546 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1548 static const unsigned short yyprhs[] =
1550 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1551 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1552 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1553 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1554 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1555 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1556 119, 121, 123, 125, 127, 129, 130, 133, 134, 136,
1557 138, 140, 141, 144, 146, 148, 150, 152, 154, 156,
1558 158, 160, 161, 163, 165, 167, 168, 170, 172, 173,
1559 175, 177, 179, 181, 182, 184, 186, 187, 189, 191,
1560 193, 195, 197, 200, 202, 204, 206, 208, 210, 212,
1561 214, 216, 218, 219, 222, 224, 226, 228, 230, 231,
1562 234, 235, 238, 239, 243, 246, 247, 249, 250, 254,
1563 256, 259, 261, 263, 265, 267, 269, 271, 273, 275,
1564 277, 280, 282, 285, 291, 297, 303, 309, 313, 316,
1565 322, 327, 330, 332, 334, 336, 340, 342, 346, 348,
1566 349, 351, 355, 360, 364, 368, 373, 378, 382, 389,
1567 395, 398, 401, 404, 407, 410, 413, 416, 419, 422,
1568 425, 428, 431, 438, 444, 453, 460, 467, 475, 483,
1569 490, 499, 508, 512, 514, 516, 518, 520, 521, 524,
1570 531, 533, 534, 536, 539, 540, 544, 545, 549, 553,
1571 557, 561, 562, 570, 571, 580, 581, 590, 596, 599,
1572 603, 605, 609, 613, 617, 621, 623, 624, 630, 634,
1573 636, 640, 642, 643, 653, 655, 657, 662, 664, 666,
1574 669, 673, 674, 676, 678, 680, 682, 684, 686, 688,
1575 690, 692, 696, 698, 704, 706, 708, 710, 712, 714,
1576 716, 719, 722, 725, 729, 732, 733, 735, 738, 741,
1577 745, 755, 765, 774, 789, 791, 793, 800, 806, 809,
1578 816, 824, 828, 834, 835, 836, 840, 843, 845, 851,
1579 857, 864, 871, 876, 883, 888, 893, 900, 907, 910,
1580 919, 921, 923, 924, 928, 935, 939, 946, 949, 955,
1584 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1585 static const short yyrhs[] =
1587 204, 0, -1, 73, -1, 74, -1, 75, -1, 76,
1588 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81,
1589 -1, 85, -1, 86, -1, 87, -1, 82, -1, 83,
1590 -1, 84, -1, 116, -1, 117, -1, 118, -1, 119,
1591 -1, 120, -1, 121, -1, 122, -1, 123, -1, 124,
1592 -1, 125, -1, 126, -1, 127, -1, 90, -1, 91,
1593 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1594 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1595 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1596 -1, 107, -1, 108, -1, 109, -1, 96, -1, 97,
1597 -1, 98, -1, 99, -1, 26, -1, 27, -1, 11,
1598 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1599 -1, 19, -1, 22, -1, 24, -1, 168, -1, -1,
1600 168, 146, -1, -1, 20, -1, 23, -1, 173, -1,
1601 -1, 171, 146, -1, 42, -1, 44, -1, 43, -1,
1602 45, -1, 47, -1, 46, -1, 48, -1, 50, -1,
1603 -1, 143, -1, 144, -1, 145, -1, -1, 46, -1,
1604 48, -1, -1, 42, -1, 43, -1, 44, -1, 47,
1605 -1, -1, 44, -1, 42, -1, -1, 61, -1, 62,
1606 -1, 63, -1, 64, -1, 65, -1, 60, 4, -1,
1607 135, -1, 117, -1, 134, -1, 118, -1, 137, -1,
1608 138, -1, 140, -1, 141, -1, 142, -1, -1, 182,
1609 181, -1, 136, -1, 139, -1, 135, -1, 134, -1,
1610 -1, 184, 183, -1, -1, 53, 4, -1, -1, 147,
1611 53, 4, -1, 34, 22, -1, -1, 187, -1, -1,
1612 147, 190, 189, -1, 187, -1, 53, 4, -1, 11,
1613 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1614 -1, 17, -1, 49, -1, 191, -1, 192, 148, -1,
1615 226, -1, 149, 4, -1, 192, 150, 196, 151, 184,
1616 -1, 10, 150, 196, 151, 184, -1, 152, 4, 153,
1617 192, 154, -1, 155, 4, 153, 192, 156, -1, 157,
1618 197, 158, -1, 157, 158, -1, 155, 157, 197, 158,
1619 156, -1, 155, 157, 158, 156, -1, 192, 182, -1,
1620 192, -1, 10, -1, 193, -1, 195, 147, 193, -1,
1621 195, -1, 195, 147, 39, -1, 39, -1, -1, 192,
1622 -1, 197, 147, 192, -1, 192, 152, 200, 154, -1,
1623 192, 152, 154, -1, 192, 159, 22, -1, 192, 155,
1624 200, 156, -1, 192, 157, 200, 158, -1, 192, 157,
1625 158, -1, 192, 155, 157, 200, 158, 156, -1, 192,
1626 155, 157, 158, 156, -1, 192, 40, -1, 192, 41,
1627 -1, 192, 226, -1, 192, 199, -1, 192, 25, -1,
1628 166, 3, -1, 166, 5, -1, 166, 4, -1, 166,
1629 6, -1, 11, 26, -1, 11, 27, -1, 167, 9,
1630 -1, 163, 150, 198, 38, 192, 151, -1, 115, 150,
1631 198, 237, 151, -1, 129, 150, 198, 147, 198, 147,
1632 198, 151, -1, 161, 150, 198, 147, 198, 151, -1,
1633 162, 150, 198, 147, 198, 151, -1, 88, 164, 150,
1634 198, 147, 198, 151, -1, 89, 165, 150, 198, 147,
1635 198, 151, -1, 131, 150, 198, 147, 198, 151, -1,
1636 132, 150, 198, 147, 198, 147, 198, 151, -1, 133,
1637 150, 198, 147, 198, 147, 198, 151, -1, 200, 147,
1638 198, -1, 198, -1, 32, -1, 33, -1, 37, -1,
1639 -1, 194, 226, -1, 121, 150, 203, 38, 192, 151,
1640 -1, 205, -1, -1, 206, -1, 205, 206, -1, -1,
1641 31, 207, 222, -1, -1, 30, 208, 223, -1, 58,
1642 57, 212, -1, 170, 18, 192, -1, 170, 18, 10,
1643 -1, -1, 172, 176, 202, 201, 198, 209, 189, -1,
1644 -1, 172, 174, 176, 202, 201, 198, 210, 189, -1,
1645 -1, 172, 175, 176, 202, 201, 192, 211, 189, -1,
1646 172, 176, 35, 179, 203, -1, 51, 213, -1, 54,
1647 146, 214, -1, 22, -1, 52, 146, 22, -1, 66,
1648 146, 22, -1, 152, 215, 154, -1, 215, 147, 22,
1649 -1, 22, -1, -1, 216, 147, 192, 182, 169, -1,
1650 192, 182, 169, -1, 216, -1, 216, 147, 39, -1,
1651 39, -1, -1, 180, 194, 171, 150, 217, 151, 184,
1652 188, 185, -1, 28, -1, 157, -1, 178, 176, 218,
1653 219, -1, 29, -1, 158, -1, 229, 221, -1, 177,
1654 176, 218, -1, -1, 59, -1, 3, -1, 4, -1,
1655 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1656 25, -1, 155, 200, 156, -1, 199, -1, 57, 224,
1657 22, 147, 22, -1, 7, -1, 8, -1, 168, -1,
1658 171, -1, 226, -1, 225, -1, 192, 227, -1, 229,
1659 230, -1, 220, 230, -1, 231, 170, 232, -1, 231,
1660 234, -1, -1, 21, -1, 67, 228, -1, 67, 10,
1661 -1, 68, 17, 227, -1, 68, 11, 227, 147, 17,
1662 227, 147, 17, 227, -1, 69, 166, 227, 147, 17,
1663 227, 152, 233, 154, -1, 69, 166, 227, 147, 17,
1664 227, 152, 154, -1, 70, 180, 194, 227, 150, 236,
1665 151, 184, 38, 17, 227, 71, 17, 227, -1, 71,
1666 -1, 72, -1, 233, 166, 225, 147, 17, 227, -1,
1667 166, 225, 147, 17, 227, -1, 170, 239, -1, 192,
1668 152, 227, 147, 227, 154, -1, 235, 147, 152, 227,
1669 147, 227, 154, -1, 192, 227, 182, -1, 236, 147,
1670 192, 227, 182, -1, -1, -1, 237, 147, 228, -1,
1671 56, 55, -1, 55, -1, 161, 192, 227, 147, 227,
1672 -1, 162, 192, 227, 147, 227, -1, 88, 164, 192,
1673 227, 147, 227, -1, 89, 165, 192, 227, 147, 227,
1674 -1, 163, 228, 38, 192, -1, 129, 228, 147, 228,
1675 147, 228, -1, 130, 228, 147, 192, -1, 131, 228,
1676 147, 228, -1, 132, 228, 147, 228, 147, 228, -1,
1677 133, 228, 147, 228, 147, 228, -1, 128, 235, -1,
1678 238, 180, 194, 227, 150, 236, 151, 184, -1, 241,
1679 -1, 36, -1, -1, 110, 192, 186, -1, 110, 192,
1680 147, 11, 227, 186, -1, 111, 192, 186, -1, 111,
1681 192, 147, 11, 227, 186, -1, 112, 228, -1, 240,
1682 113, 192, 227, 186, -1, 240, 114, 228, 147, 192,
1683 227, 186, -1, 115, 192, 227, 237, -1
1686 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1687 static const unsigned short yyrline[] =
1689 0, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122,
1690 1122, 1123, 1123, 1123, 1123, 1123, 1123, 1124, 1124, 1124,
1691 1124, 1124, 1124, 1125, 1125, 1125, 1125, 1125, 1125, 1128,
1692 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132, 1132, 1136,
1693 1136, 1137, 1137, 1138, 1138, 1139, 1139, 1140, 1140, 1141,
1694 1141, 1142, 1142, 1143, 1144, 1149, 1150, 1150, 1150, 1150,
1695 1150, 1152, 1152, 1152, 1153, 1153, 1157, 1161, 1166, 1166,
1696 1168, 1169, 1174, 1180, 1181, 1182, 1183, 1184, 1188, 1189,
1697 1190, 1194, 1195, 1196, 1197, 1201, 1202, 1203, 1207, 1208,
1698 1209, 1210, 1211, 1215, 1216, 1217, 1220, 1221, 1222, 1223,
1699 1224, 1225, 1226, 1233, 1234, 1235, 1236, 1237, 1238, 1239,
1700 1240, 1241, 1244, 1245, 1250, 1251, 1252, 1253, 1256, 1257,
1701 1264, 1265, 1271, 1272, 1280, 1288, 1289, 1294, 1295, 1296,
1702 1301, 1314, 1314, 1314, 1314, 1314, 1314, 1314, 1317, 1321,
1703 1325, 1332, 1337, 1345, 1375, 1406, 1411, 1423, 1433, 1437,
1704 1447, 1454, 1461, 1468, 1473, 1478, 1485, 1486, 1493, 1500,
1705 1508, 1514, 1526, 1554, 1570, 1597, 1625, 1651, 1671, 1697,
1706 1717, 1729, 1736, 1802, 1812, 1822, 1828, 1838, 1844, 1854,
1707 1859, 1864, 1872, 1884, 1906, 1914, 1920, 1931, 1936, 1941,
1708 1947, 1953, 1962, 1966, 1974, 1974, 1977, 1977, 1980, 1992,
1709 2013, 2018, 2026, 2027, 2031, 2031, 2035, 2035, 2038, 2041,
1710 2065, 2076, 2076, 2087, 2086, 2096, 2095, 2106, 2125, 2128,
1711 2134, 2144, 2148, 2153, 2155, 2160, 2165, 2174, 2184, 2195,
1712 2199, 2208, 2217, 2222, 2343, 2343, 2345, 2354, 2354, 2356,
1713 2361, 2373, 2377, 2382, 2386, 2390, 2394, 2398, 2402, 2406,
1714 2410, 2414, 2439, 2443, 2453, 2457, 2461, 2466, 2473, 2473,
1715 2479, 2488, 2492, 2501, 2510, 2519, 2523, 2530, 2534, 2538,
1716 2543, 2553, 2572, 2581, 2661, 2665, 2672, 2683, 2696, 2706,
1717 2717, 2727, 2736, 2745, 2748, 2749, 2756, 2760, 2765, 2786,
1718 2803, 2817, 2831, 2843, 2851, 2858, 2864, 2870, 2876, 2891,
1719 2976, 2981, 2985, 2992, 2999, 3007, 3014, 3022, 3030, 3044,
1724 #if YYDEBUG || YYERROR_VERBOSE
1725 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1726 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1727 static const char *const yytname[] =
1729 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1730 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1731 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1732 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1733 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1734 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1735 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1736 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1737 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1738 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1739 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1740 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1741 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1742 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1743 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1744 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1745 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1746 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1747 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1748 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1749 "INSERTELEMENT", "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN",
1750 "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "DEFAULT",
1751 "HIDDEN", "PROTECTED", "'='", "','", "'*'", "'\\\\'", "'('", "')'",
1752 "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept",
1753 "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", "FPredicates",
1754 "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign",
1755 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1756 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1757 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1758 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign",
1759 "SectionString", "OptSection", "GlobalVarAttributes",
1760 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1761 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1762 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1763 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1764 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1765 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1766 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1767 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1768 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1769 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1770 "OptVolatile", "MemoryInst", 0
1775 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1777 static const unsigned short yytoknum[] =
1779 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1780 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1781 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1782 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1783 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1784 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1785 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1786 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1787 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1788 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1789 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1790 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1791 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1792 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1793 395, 396, 397, 398, 399, 400, 61, 44, 42, 92,
1794 40, 41, 91, 120, 93, 60, 62, 123, 125, 99
1798 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1799 static const unsigned char yyr1[] =
1801 0, 160, 161, 161, 161, 161, 161, 161, 161, 161,
1802 161, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1803 163, 163, 163, 163, 163, 163, 163, 163, 163, 164,
1804 164, 164, 164, 164, 164, 164, 164, 164, 164, 165,
1805 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
1806 165, 165, 165, 165, 165, 166, 167, 167, 167, 167,
1807 167, 168, 168, 168, 169, 169, 170, 170, 171, 171,
1808 172, 172, 173, 174, 174, 174, 174, 174, 175, 175,
1809 175, 176, 176, 176, 176, 177, 177, 177, 178, 178,
1810 178, 178, 178, 179, 179, 179, 180, 180, 180, 180,
1811 180, 180, 180, 181, 181, 181, 181, 181, 181, 181,
1812 181, 181, 182, 182, 183, 183, 183, 183, 184, 184,
1813 185, 185, 186, 186, 187, 188, 188, 189, 189, 190,
1814 190, 191, 191, 191, 191, 191, 191, 191, 192, 192,
1815 192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
1816 192, 193, 194, 194, 195, 195, 196, 196, 196, 196,
1817 197, 197, 198, 198, 198, 198, 198, 198, 198, 198,
1818 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1819 198, 198, 199, 199, 199, 199, 199, 199, 199, 199,
1820 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1821 204, 204, 205, 205, 207, 206, 208, 206, 206, 206,
1822 206, 209, 206, 210, 206, 211, 206, 206, 206, 206,
1823 212, 213, 213, 214, 215, 215, 215, 216, 216, 217,
1824 217, 217, 217, 218, 219, 219, 220, 221, 221, 222,
1825 223, 224, 224, 225, 225, 225, 225, 225, 225, 225,
1826 225, 225, 225, 225, 226, 226, 226, 226, 227, 227,
1827 228, 229, 229, 230, 231, 231, 231, 232, 232, 232,
1828 232, 232, 232, 232, 232, 232, 233, 233, 234, 235,
1829 235, 236, 236, 236, 237, 237, 238, 238, 239, 239,
1830 239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
1831 239, 240, 240, 241, 241, 241, 241, 241, 241, 241,
1835 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1836 static const unsigned char yyr2[] =
1838 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1839 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1840 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1841 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1842 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1843 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1844 1, 1, 1, 1, 1, 0, 2, 0, 1, 1,
1845 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1846 1, 0, 1, 1, 1, 0, 1, 1, 0, 1,
1847 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1848 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1849 1, 1, 0, 2, 1, 1, 1, 1, 0, 2,
1850 0, 2, 0, 3, 2, 0, 1, 0, 3, 1,
1851 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1852 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1853 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1854 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1855 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1856 2, 2, 6, 5, 8, 6, 6, 7, 7, 6,
1857 8, 8, 3, 1, 1, 1, 1, 0, 2, 6,
1858 1, 0, 1, 2, 0, 3, 0, 3, 3, 3,
1859 3, 0, 7, 0, 8, 0, 8, 5, 2, 3,
1860 1, 3, 3, 3, 3, 1, 0, 5, 3, 1,
1861 3, 1, 0, 9, 1, 1, 4, 1, 1, 2,
1862 3, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1863 1, 3, 1, 5, 1, 1, 1, 1, 1, 1,
1864 2, 2, 2, 3, 2, 0, 1, 2, 2, 3,
1865 9, 9, 8, 14, 1, 1, 6, 5, 2, 6,
1866 7, 3, 5, 0, 0, 3, 2, 1, 5, 5,
1867 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
1868 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
1872 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1873 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1874 means the default is an error. */
1875 static const unsigned short yydefact[] =
1877 71, 61, 68, 62, 69, 63, 206, 204, 0, 0,
1878 0, 0, 0, 0, 81, 70, 0, 71, 202, 85,
1879 88, 0, 0, 218, 0, 0, 66, 0, 72, 73,
1880 75, 74, 76, 78, 77, 79, 80, 82, 83, 84,
1881 81, 81, 197, 1, 203, 86, 87, 81, 207, 89,
1882 90, 91, 92, 81, 265, 205, 265, 0, 0, 226,
1883 219, 220, 208, 254, 255, 210, 131, 132, 133, 136,
1884 135, 134, 137, 138, 0, 0, 0, 0, 256, 257,
1885 139, 209, 141, 197, 197, 93, 196, 0, 96, 96,
1886 266, 262, 67, 237, 238, 239, 261, 221, 222, 225,
1887 0, 159, 142, 0, 0, 0, 0, 148, 160, 0,
1888 140, 159, 0, 0, 95, 94, 0, 194, 195, 0,
1889 0, 97, 98, 99, 100, 101, 0, 240, 0, 302,
1890 264, 0, 223, 158, 112, 154, 156, 0, 0, 0,
1891 0, 0, 0, 147, 0, 0, 0, 153, 0, 152,
1892 0, 217, 131, 132, 133, 136, 135, 134, 0, 0,
1893 0, 211, 102, 0, 234, 235, 236, 301, 287, 0,
1894 0, 0, 0, 96, 274, 275, 2, 3, 4, 5,
1895 6, 7, 8, 9, 10, 14, 15, 16, 11, 12,
1896 13, 0, 0, 0, 0, 0, 0, 17, 18, 19,
1897 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
1898 0, 0, 0, 0, 0, 0, 0, 0, 263, 96,
1899 278, 0, 300, 224, 151, 0, 118, 0, 0, 150,
1900 0, 161, 118, 213, 215, 0, 198, 179, 180, 175,
1901 177, 176, 178, 181, 174, 170, 171, 0, 0, 0,
1902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1903 0, 173, 172, 127, 0, 286, 268, 0, 267, 0,
1904 0, 55, 0, 0, 29, 30, 31, 32, 33, 34,
1905 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
1906 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1907 48, 0, 122, 122, 307, 0, 0, 298, 0, 0,
1908 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
1909 106, 105, 103, 107, 108, 109, 110, 111, 113, 157,
1910 155, 144, 145, 146, 149, 143, 127, 127, 0, 0,
1911 0, 0, 0, 0, 0, 0, 163, 193, 0, 0,
1912 0, 167, 0, 164, 0, 0, 0, 0, 212, 232,
1913 243, 244, 245, 250, 246, 247, 248, 249, 241, 0,
1914 252, 259, 258, 260, 0, 269, 0, 0, 0, 0,
1915 0, 303, 0, 305, 284, 0, 0, 0, 0, 0,
1916 0, 0, 0, 0, 0, 0, 0, 0, 117, 116,
1917 114, 115, 119, 214, 216, 0, 0, 0, 284, 0,
1918 0, 0, 0, 0, 162, 148, 160, 0, 165, 166,
1919 0, 0, 0, 0, 0, 129, 127, 231, 112, 229,
1920 0, 242, 0, 0, 0, 0, 0, 0, 0, 0,
1921 0, 0, 310, 0, 0, 0, 294, 295, 0, 0,
1922 0, 0, 292, 0, 122, 0, 0, 0, 0, 0,
1923 0, 0, 0, 0, 192, 169, 0, 0, 0, 0,
1924 124, 130, 128, 65, 0, 118, 0, 251, 0, 0,
1925 283, 0, 0, 122, 123, 122, 0, 0, 0, 0,
1926 0, 0, 288, 289, 283, 0, 308, 0, 199, 0,
1927 0, 183, 0, 0, 0, 0, 168, 0, 0, 0,
1928 64, 228, 230, 112, 125, 0, 0, 0, 0, 0,
1929 290, 291, 304, 306, 285, 0, 0, 293, 296, 297,
1930 0, 122, 0, 0, 0, 189, 0, 0, 185, 186,
1931 182, 65, 126, 120, 253, 0, 0, 112, 0, 118,
1932 279, 0, 118, 309, 187, 188, 0, 0, 0, 227,
1933 0, 233, 0, 272, 0, 0, 281, 0, 0, 280,
1934 299, 184, 190, 191, 121, 270, 0, 271, 0, 112,
1935 0, 0, 0, 282, 0, 0, 0, 0, 277, 0,
1939 /* YYDEFGOTO[NTERM-NUM]. */
1940 static const short yydefgoto[] =
1942 -1, 258, 259, 260, 284, 301, 158, 159, 78, 511,
1943 12, 79, 14, 15, 40, 41, 42, 47, 53, 116,
1944 126, 328, 224, 402, 331, 561, 381, 425, 543, 358,
1945 426, 80, 160, 135, 150, 136, 137, 109, 347, 370,
1946 348, 119, 87, 151, 16, 17, 18, 20, 19, 263,
1947 336, 337, 62, 23, 60, 100, 429, 430, 127, 166,
1948 54, 95, 55, 48, 432, 371, 82, 373, 268, 56,
1949 91, 92, 218, 565, 130, 307, 519, 442, 219, 220,
1953 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1955 #define YYPACT_NINF -529
1956 static const short yypact[] =
1958 40, -529, -529, -529, -529, -529, -529, -529, -17, -107,
1959 12, -64, 78, -40, 183, -529, 150, 370, -529, 147,
1960 115, -5, 26, -529, 14, 132, -529, 1319, -529, -529,
1961 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1962 -90, -90, 173, -529, -529, -529, -529, -90, -529, -529,
1963 -529, -529, -529, -90, 154, -529, -7, 179, 197, 214,
1964 -529, -529, -529, -529, -529, 96, -529, -529, -529, -529,
1965 -529, -529, -529, -529, 253, 258, 3, 791, -529, -529,
1966 -529, 145, -529, 228, 228, 287, -529, 191, 189, 189,
1967 -529, -529, 109, -529, -529, -529, -529, -529, -529, -529,
1968 -66, 1052, -529, 125, 135, 835, 96, -529, 145, -110,
1969 -529, 1052, 191, 191, -529, -529, 1092, -529, -529, 1359,
1970 285, -529, -529, -529, -529, -529, 1377, -529, -12, 1525,
1971 -529, 272, -529, -529, 145, -529, 153, 152, 1430, 1430,
1972 168, -106, 1430, -529, 157, 1359, 1430, 96, 159, 145,
1973 102, -529, 39, 321, 323, 325, 326, 327, 266, 328,
1974 750, -529, -529, 141, -529, -529, -529, -529, -529, 288,
1975 1470, 94, 329, 189, -529, -529, -529, -529, -529, -529,
1976 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1977 -529, 222, 625, 1430, 1430, 1430, 1430, -529, -529, -529,
1978 -529, -529, -529, -529, -529, -529, -529, -529, -529, 1430,
1979 1430, 1430, 1430, 1430, 1430, 1430, 1430, 1430, -529, 189,
1980 -529, 128, -529, -529, 126, 1110, -529, -53, -72, -529,
1981 188, 145, -529, -529, 145, 1092, -529, -529, -529, -529,
1982 -529, -529, -529, -529, -529, -529, -529, 222, 625, 195,
1983 196, 200, 201, 202, 1204, 1528, 1012, 331, 204, 206,
1984 208, -529, -529, 212, 210, -529, 96, 486, -529, 623,
1985 623, -529, 623, 1377, -529, -529, -529, -529, -529, -529,
1986 -529, -529, -529, -529, 1430, -529, -529, -529, -529, -529,
1987 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1988 -529, 1430, -1, 32, -529, 486, 52, 219, 220, 224,
1989 227, 230, 233, 486, 486, 343, 1377, 1430, 1430, -529,
1990 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1991 -529, 77, -529, -529, -529, 77, 212, 212, 344, 234,
1992 235, 1359, 1359, 1359, 1359, 1359, -529, -529, -61, 1031,
1993 -100, -529, -101, -529, 1359, 1359, 1359, -19, -529, 1261,
1994 -529, -529, -529, -529, -529, -529, -529, -529, 310, 1359,
1995 -529, -529, -529, -529, 236, -529, 240, 623, 486, 486,
1996 20, -529, 21, -529, -529, 623, 239, 1430, 1430, 1430,
1997 1430, 1430, 249, 250, 1430, 623, 486, 251, -529, -529,
1998 -529, -529, -529, -529, -529, 1430, 1359, 1359, -529, 252,
1999 259, 260, 264, 1359, -529, 256, 750, -75, -529, -529,
2000 267, 268, 375, 396, 415, -529, 212, -529, 145, 273,
2001 274, -529, 401, -79, 409, 413, 281, 286, 289, 623,
2002 428, 623, 290, 291, 623, 292, 145, -529, 293, 299,
2003 623, 623, 145, 284, 300, 1430, 84, 303, 304, -44,
2004 1359, 1359, 1359, 1359, -529, -529, 279, 1359, 1359, 1430,
2005 -529, -529, -529, 80, 1279, -529, 306, -529, 623, 623,
2006 1430, 623, 623, 300, -529, 300, 1430, 623, 308, 1430,
2007 1430, 1430, -529, -529, 1430, 403, -529, 486, -529, 1359,
2008 1359, -529, 311, 315, 312, 314, -529, 316, 318, 129,
2009 -529, -529, -529, 145, 4, 435, 324, 320, 486, -33,
2010 -529, -529, -529, -529, -529, 330, 623, -529, -529, -529,
2011 -32, 300, 319, 332, 1359, -529, 1359, 1359, -529, -529,
2012 -529, 80, -529, 421, -529, 445, -2, -529, 1430, -529,
2013 -529, 333, -529, -529, -529, -529, 334, 335, 340, -529,
2014 471, -529, 623, -529, 885, 2, 126, 486, 42, -529,
2015 77, -529, -529, -529, -529, -529, 345, -529, 885, -529,
2016 460, 479, 350, 126, 623, 623, 483, 430, -529, 623,
2017 485, -529, 623, -529
2020 /* YYPGOTO[NTERM-NUM]. */
2021 static const short yypgoto[] =
2023 -529, 374, 378, 385, 257, 269, -170, -529, 0, -25,
2024 423, 8, -529, -529, -529, -529, 95, -529, -529, -529,
2025 -152, -529, -424, -529, -227, -529, -291, 5, -529, -318,
2026 -529, -529, -26, 295, -120, -529, 407, 416, -58, -157,
2027 -232, 161, 198, 294, -529, -529, 506, -529, -529, -529,
2028 -529, -529, -529, -529, -529, -529, -529, -529, 436, -529,
2029 -529, -529, -529, -529, -529, -528, -140, 103, -184, -529,
2030 468, -529, -529, -529, -529, -529, 34, 122, -529, -529,
2034 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2035 positive, shift that token. If negative, reduce the rule which
2036 number is the opposite. If zero, do what YYDEFACT says.
2037 If YYTABLE_NINF, syntax error. */
2038 #define YYTABLE_NINF -202
2039 static const short yytable[] =
2041 11, 81, 272, 261, 473, 335, 163, 104, 13, 271,
2042 236, 304, 383, 271, 90, 423, 164, 11, 403, 404,
2043 262, 273, 93, 350, 352, 13, 308, 309, 310, 311,
2044 312, 439, 441, 315, 424, 21, 576, 142, 423, 24,
2045 -201, 142, -55, -55, -55, -55, 413, 413, 143, 22,
2046 582, 108, 230, 37, 38, 39, 418, 419, -67, 1,
2047 2, 161, 3, 4, 5, 237, 238, 316, 413, 25,
2048 6, 7, 413, 440, 440, 134, 110, 477, 111, 108,
2049 580, 131, 26, 466, 333, 134, 413, 233, 132, 541,
2050 149, 8, 11, 414, 9, 110, 27, 111, 10, 1,
2051 149, 332, 3, 486, 5, 269, 28, 501, 472, 63,
2052 64, 270, 227, 228, 548, 548, 231, 417, 549, 552,
2053 234, 1, 2, 566, 3, 4, 5, 372, 1, 372,
2054 372, 3, 372, 5, 397, 83, 84, 433, 398, 399,
2055 400, 57, 88, 401, 267, 165, 380, 110, 89, 111,
2056 43, 94, 563, 377, 61, 583, 577, 49, 50, 51,
2057 105, 2, 52, 496, 4, 372, 59, 302, 303, 267,
2058 305, 264, 58, 372, 372, 90, 398, 399, 400, 382,
2059 110, 401, 111, 306, 267, 267, 267, 267, 267, 313,
2060 314, 267, 522, 45, 523, 46, 395, 319, 320, 134,
2061 110, 97, 111, 445, 385, 447, 448, 449, 85, 149,
2062 86, 398, 399, 400, 321, 322, 401, 323, 324, 98,
2063 325, 326, 327, 117, 118, 29, 30, 31, 32, 33,
2064 34, 35, 110, 36, 111, 498, 99, 372, 372, 372,
2065 553, 317, 318, 319, 320, 372, 101, 149, 514, 120,
2066 121, 122, 123, 124, 125, 372, 372, 102, 378, 261,
2067 321, 322, 103, 323, 324, 86, 325, 326, 327, 239,
2068 240, 241, 242, 145, 146, 379, 262, 110, 138, 111,
2069 540, 112, 113, 408, 409, 410, 411, 412, 139, 162,
2070 149, 396, 267, 110, 223, 111, 420, 421, 422, 372,
2071 225, 372, 524, 226, 372, 527, 528, 529, 232, 235,
2072 372, 372, 274, 275, 276, 277, 278, 279, 280, 281,
2073 282, 283, 568, 416, 229, 570, 37, 38, 39, 114,
2074 -56, 115, -57, 428, -60, -59, -58, 243, 372, 372,
2075 271, 372, 372, 265, 334, 341, 342, 372, 457, 458,
2076 343, 344, 345, 353, 354, 464, 355, 372, 356, 357,
2077 359, 267, 446, 267, 267, 267, 386, 387, 452, 431,
2078 -200, 388, 374, 375, 389, 376, 564, 390, 372, 456,
2079 391, 394, 405, 434, 406, 407, 372, 435, -67, 1,
2080 2, 444, 3, 4, 5, 578, 450, 451, 455, 460,
2081 6, 7, 502, 503, 504, 505, 461, 462, 384, 507,
2082 508, 463, 465, 469, 467, 468, 392, 393, 470, 471,
2083 474, 8, 372, 476, 9, 475, 478, 372, 10, 497,
2084 479, 480, 484, 481, 494, 506, 482, 486, 487, 489,
2085 490, 532, 533, 509, 372, 372, 491, 495, 513, 372,
2086 499, 500, 372, 515, 518, 526, 440, 544, 534, 536,
2087 267, 537, 562, 267, 267, 267, 535, 538, 518, 539,
2088 554, 545, 546, 510, 560, 574, 556, 584, 557, 558,
2089 436, 437, 438, 555, 550, 571, 572, 569, 443, 360,
2090 361, 573, 581, 63, 64, 362, 585, 586, 453, 454,
2091 589, 590, 592, 215, 339, 1, 2, 216, 3, 4,
2092 5, 363, 364, 365, 217, 129, 559, 340, 144, 542,
2093 330, 141, 567, 44, 96, 128, 366, 367, 530, 338,
2094 459, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2095 0, 510, 483, 368, 485, 0, 0, 488, 0, 0,
2096 0, 0, 0, 492, 493, 0, 0, 0, 0, 176,
2097 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2098 187, 188, 189, 190, 247, 248, 0, 0, 0, 0,
2099 0, 516, 517, 0, 520, 521, 0, 0, 0, 0,
2100 525, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2101 531, 249, 197, 198, 199, 200, 201, 202, 203, 204,
2102 205, 206, 207, 208, 0, 250, 0, 251, 252, 253,
2103 0, 547, 0, 0, 0, 0, 360, 361, 0, 551,
2104 63, 64, 362, 0, 110, 0, 111, 0, 0, 0,
2105 0, 369, 1, 2, 0, 3, 4, 5, 363, 364,
2106 365, 285, 286, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 0, 366, 367, 575, 0, 0, 0, 0,
2108 579, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2109 368, 0, 0, 0, 0, 0, 0, 587, 588, 0,
2110 0, 0, 591, 0, 0, 593, 176, 177, 178, 179,
2111 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2112 190, 247, 248, 0, 0, 0, 0, 0, 0, 0,
2113 0, 287, 288, 289, 290, 291, 292, 293, 294, 295,
2114 296, 297, 298, 299, 300, 0, 0, 0, 249, 197,
2115 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2116 208, 0, 250, 0, 251, 252, 253, 63, 64, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2118 2, 0, 3, 4, 5, 244, 0, 0, 369, 0,
2119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2120 245, 246, 0, 0, 0, 0, 0, 0, 63, 64,
2121 0, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2122 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2123 0, 0, 0, 176, 177, 178, 179, 180, 181, 182,
2124 183, 184, 185, 186, 187, 188, 189, 190, 247, 248,
2125 73, 0, 63, 64, 0, 106, 66, 67, 68, 69,
2126 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2127 0, 0, 0, 0, 0, 249, 197, 198, 199, 200,
2128 201, 202, 203, 204, 205, 206, 207, 208, 0, 250,
2129 0, 251, 252, 253, 73, 0, 0, 0, 360, 361,
2130 0, 0, 0, 0, 362, 0, 0, 0, 110, 0,
2131 111, 0, 254, 0, 0, 255, 0, 256, 0, 257,
2132 363, 364, 365, 0, 0, 0, 0, 0, 0, 0,
2133 0, 0, 0, 0, 0, 366, 367, 0, 0, 0,
2134 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2135 74, 0, 368, 75, 0, 0, 76, 0, 77, 107,
2136 0, 0, 0, 0, 0, 0, 0, 0, 176, 177,
2137 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2138 188, 189, 190, 247, 248, 0, 0, 0, 0, 0,
2139 0, 0, 0, 0, 74, 0, 0, 75, 0, 0,
2140 76, 0, 77, 140, 0, 0, 0, 0, 0, 0,
2141 249, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2142 206, 207, 208, 0, 250, 0, 251, 252, 253, 63,
2143 64, 0, 106, 152, 153, 154, 155, 156, 157, 72,
2144 0, 1, 2, 0, 3, 4, 5, 0, 63, 64,
2145 369, 106, 152, 153, 154, 155, 156, 157, 72, 0,
2146 1, 2, 0, 3, 4, 5, 0, 0, 0, 63,
2147 64, 73, 106, 66, 67, 68, 69, 70, 71, 72,
2148 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2149 73, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2150 0, 133, 0, 0, 0, 0, 0, 0, 0, 63,
2151 64, 73, 147, 66, 67, 68, 69, 70, 71, 72,
2152 0, 1, 2, 0, 3, 4, 5, 63, 64, 0,
2153 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2154 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2155 0, 73, 0, 0, 0, 0, 0, 0, 0, 329,
2156 0, 0, 0, 0, 0, 0, 0, 0, 0, 73,
2157 0, 74, 0, 0, 75, 0, 0, 76, 0, 77,
2158 351, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2159 74, 0, 0, 75, 0, 0, 76, 0, 77, 415,
2160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2161 0, 74, 0, 0, 75, 0, 0, 76, 0, 77,
2162 0, 63, 64, 148, 106, 152, 153, 154, 155, 156,
2163 157, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2165 0, 74, 0, 0, 75, 0, 0, 76, 0, 77,
2166 0, 0, 0, 73, 0, 0, 0, 0, 0, 74,
2167 0, 0, 75, 0, 0, 76, 0, 77, 63, 64,
2168 0, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2169 1, 2, 0, 3, 4, 5, 63, 64, 0, 106,
2170 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2171 427, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2172 73, 0, 0, 0, 0, 0, 0, 0, 512, 0,
2173 0, 0, 0, 0, 0, 0, 63, 64, 73, 65,
2174 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2175 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2176 0, 0, 0, 74, 0, 0, 75, 0, 346, 76,
2177 0, 77, 0, 0, 0, 0, 63, 64, 73, 106,
2178 152, 153, 154, 155, 156, 157, 72, 0, 1, 2,
2179 0, 3, 4, 5, 63, 64, 0, 147, 66, 67,
2180 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2181 4, 5, 0, 0, 0, 0, 0, 0, 73, 0,
2182 74, 0, 0, 75, 0, 0, 76, 0, 77, 0,
2183 0, 0, 0, 0, 0, 0, 73, 0, 74, 0,
2184 0, 75, 0, 0, 76, 0, 77, 63, 64, 0,
2185 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2186 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2187 0, 0, 0, 0, 0, 0, 0, 0, 74, 0,
2188 0, 75, 0, 0, 76, 0, 77, 63, 64, 73,
2189 266, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2190 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2191 0, 0, 0, 0, 0, 0, 0, 0, 74, 0,
2192 0, 75, 0, 0, 76, 0, 77, 0, 0, 73,
2193 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2194 0, 0, 76, 0, 77, 63, 64, 0, 106, 152,
2195 153, 154, 155, 156, 157, 72, 0, 1, 2, 0,
2196 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2197 0, 167, 0, 0, 0, 0, 0, 0, 0, 0,
2198 0, 0, 0, 0, 0, 0, 0, 73, 0, 74,
2199 168, 169, 75, 0, 0, 76, 0, 77, 0, 0,
2200 0, 0, 170, 171, 172, 173, 174, 175, 176, 177,
2201 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2202 188, 189, 190, 191, 192, 0, 0, 0, 0, 74,
2203 0, 0, 75, 0, 0, 76, 0, 77, 0, 0,
2204 0, 0, 0, 0, 0, 193, 194, 195, 0, 0,
2205 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2206 206, 207, 208, 209, 210, 211, 212, 213, 214, 0,
2207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2208 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2209 75, 0, 0, 76, 0, 349
2212 static const short yycheck[] =
2214 0, 27, 172, 160, 428, 232, 126, 4, 0, 11,
2215 150, 195, 303, 11, 21, 34, 28, 17, 336, 337,
2216 160, 173, 29, 255, 256, 17, 210, 211, 212, 213,
2217 214, 11, 11, 217, 53, 52, 564, 147, 34, 146,
2218 0, 147, 3, 4, 5, 6, 147, 147, 158, 66,
2219 578, 77, 158, 143, 144, 145, 156, 158, 18, 19,
2220 20, 119, 22, 23, 24, 26, 27, 219, 147, 57,
2221 30, 31, 147, 53, 53, 101, 148, 156, 150, 105,
2222 38, 147, 146, 158, 156, 111, 147, 145, 154, 513,
2223 116, 51, 92, 154, 54, 148, 18, 150, 58, 19,
2224 126, 154, 22, 147, 24, 11, 146, 151, 426, 7,
2225 8, 17, 138, 139, 147, 147, 142, 349, 151, 151,
2226 146, 19, 20, 547, 22, 23, 24, 267, 19, 269,
2227 270, 22, 272, 24, 318, 40, 41, 369, 134, 135,
2228 136, 146, 47, 139, 170, 157, 147, 148, 53, 150,
2229 0, 158, 154, 273, 22, 579, 154, 42, 43, 44,
2230 157, 20, 47, 454, 23, 305, 152, 193, 194, 195,
2231 196, 163, 146, 313, 314, 21, 134, 135, 136, 147,
2232 148, 139, 150, 209, 210, 211, 212, 213, 214, 215,
2233 216, 217, 483, 46, 485, 48, 316, 117, 118, 225,
2234 148, 22, 150, 387, 152, 389, 390, 391, 35, 235,
2235 37, 134, 135, 136, 134, 135, 139, 137, 138, 22,
2236 140, 141, 142, 32, 33, 42, 43, 44, 45, 46,
2237 47, 48, 148, 50, 150, 151, 22, 377, 378, 379,
2238 531, 113, 114, 117, 118, 385, 150, 273, 475, 60,
2239 61, 62, 63, 64, 65, 395, 396, 4, 284, 416,
2240 134, 135, 4, 137, 138, 37, 140, 141, 142, 3,
2241 4, 5, 6, 112, 113, 301, 416, 148, 153, 150,
2242 151, 83, 84, 341, 342, 343, 344, 345, 153, 4,
2243 316, 317, 318, 148, 22, 150, 354, 355, 356, 439,
2244 147, 441, 486, 151, 444, 489, 490, 491, 151, 150,
2245 450, 451, 90, 91, 92, 93, 94, 95, 96, 97,
2246 98, 99, 549, 349, 156, 552, 143, 144, 145, 42,
2247 9, 44, 9, 359, 9, 9, 9, 9, 478, 479,
2248 11, 481, 482, 55, 156, 150, 150, 487, 406, 407,
2249 150, 150, 150, 22, 150, 413, 150, 497, 150, 147,
2250 150, 387, 388, 389, 390, 391, 147, 147, 394, 59,
2251 0, 147, 269, 270, 147, 272, 546, 147, 518, 405,
2252 147, 38, 38, 147, 150, 150, 526, 147, 18, 19,
2253 20, 152, 22, 23, 24, 565, 147, 147, 147, 147,
2254 30, 31, 460, 461, 462, 463, 147, 147, 305, 467,
2255 468, 147, 156, 38, 147, 147, 313, 314, 22, 4,
2256 147, 51, 562, 22, 54, 151, 17, 567, 58, 455,
2257 17, 150, 4, 147, 150, 156, 147, 147, 147, 147,
2258 147, 499, 500, 469, 584, 585, 147, 147, 474, 589,
2259 147, 147, 592, 147, 480, 147, 53, 22, 147, 147,
2260 486, 147, 17, 489, 490, 491, 151, 151, 494, 151,
2261 151, 147, 152, 473, 53, 4, 534, 17, 536, 537,
2262 377, 378, 379, 151, 154, 151, 151, 154, 385, 3,
2263 4, 151, 147, 7, 8, 9, 17, 147, 395, 396,
2264 17, 71, 17, 129, 247, 19, 20, 129, 22, 23,
2265 24, 25, 26, 27, 129, 92, 541, 248, 111, 514,
2266 225, 105, 548, 17, 56, 89, 40, 41, 494, 235,
2267 408, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2268 -1, 541, 439, 57, 441, -1, -1, 444, -1, -1,
2269 -1, -1, -1, 450, 451, -1, -1, -1, -1, 73,
2270 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2271 84, 85, 86, 87, 88, 89, -1, -1, -1, -1,
2272 -1, 478, 479, -1, 481, 482, -1, -1, -1, -1,
2273 487, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2274 497, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2275 124, 125, 126, 127, -1, 129, -1, 131, 132, 133,
2276 -1, 518, -1, -1, -1, -1, 3, 4, -1, 526,
2277 7, 8, 9, -1, 148, -1, 150, -1, -1, -1,
2278 -1, 155, 19, 20, -1, 22, 23, 24, 25, 26,
2279 27, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2280 -1, -1, -1, 40, 41, 562, -1, -1, -1, -1,
2281 567, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2282 57, -1, -1, -1, -1, -1, -1, 584, 585, -1,
2283 -1, -1, 589, -1, -1, 592, 73, 74, 75, 76,
2284 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2285 87, 88, 89, -1, -1, -1, -1, -1, -1, -1,
2286 -1, 96, 97, 98, 99, 100, 101, 102, 103, 104,
2287 105, 106, 107, 108, 109, -1, -1, -1, 115, 116,
2288 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2289 127, -1, 129, -1, 131, 132, 133, 7, 8, -1,
2290 -1, -1, -1, -1, -1, -1, -1, -1, -1, 19,
2291 20, -1, 22, 23, 24, 25, -1, -1, 155, -1,
2292 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2293 40, 41, -1, -1, -1, -1, -1, -1, 7, 8,
2294 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2295 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2296 -1, -1, -1, 73, 74, 75, 76, 77, 78, 79,
2297 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2298 49, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2299 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2300 -1, -1, -1, -1, -1, 115, 116, 117, 118, 119,
2301 120, 121, 122, 123, 124, 125, 126, 127, -1, 129,
2302 -1, 131, 132, 133, 49, -1, -1, -1, 3, 4,
2303 -1, -1, -1, -1, 9, -1, -1, -1, 148, -1,
2304 150, -1, 152, -1, -1, 155, -1, 157, -1, 159,
2305 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2306 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2308 149, -1, 57, 152, -1, -1, 155, -1, 157, 158,
2309 -1, -1, -1, -1, -1, -1, -1, -1, 73, 74,
2310 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2311 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
2312 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
2313 155, -1, 157, 158, -1, -1, -1, -1, -1, -1,
2314 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2315 125, 126, 127, -1, 129, -1, 131, 132, 133, 7,
2316 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2317 -1, 19, 20, -1, 22, 23, 24, -1, 7, 8,
2318 155, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2319 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2320 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2321 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2322 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2323 -1, 39, -1, -1, -1, -1, -1, -1, -1, 7,
2324 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2325 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2326 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2327 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2328 -1, 49, -1, -1, -1, -1, -1, -1, -1, 39,
2329 -1, -1, -1, -1, -1, -1, -1, -1, -1, 49,
2330 -1, 149, -1, -1, 152, -1, -1, 155, -1, 157,
2331 158, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2332 149, -1, -1, 152, -1, -1, 155, -1, 157, 158,
2333 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2334 -1, 149, -1, -1, 152, -1, -1, 155, -1, 157,
2335 -1, 7, 8, 121, 10, 11, 12, 13, 14, 15,
2336 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2337 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2338 -1, 149, -1, -1, 152, -1, -1, 155, -1, 157,
2339 -1, -1, -1, 49, -1, -1, -1, -1, -1, 149,
2340 -1, -1, 152, -1, -1, 155, -1, 157, 7, 8,
2341 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2342 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2343 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2344 39, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2345 49, -1, -1, -1, -1, -1, -1, -1, 39, -1,
2346 -1, -1, -1, -1, -1, -1, 7, 8, 49, 10,
2347 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2348 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2349 -1, -1, -1, 149, -1, -1, 152, -1, 154, 155,
2350 -1, 157, -1, -1, -1, -1, 7, 8, 49, 10,
2351 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2352 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2353 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2354 23, 24, -1, -1, -1, -1, -1, -1, 49, -1,
2355 149, -1, -1, 152, -1, -1, 155, -1, 157, -1,
2356 -1, -1, -1, -1, -1, -1, 49, -1, 149, -1,
2357 -1, 152, -1, -1, 155, -1, 157, 7, 8, -1,
2358 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2359 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2360 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
2361 -1, 152, -1, -1, 155, -1, 157, 7, 8, 49,
2362 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2363 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2364 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
2365 -1, 152, -1, -1, 155, -1, 157, -1, -1, 49,
2366 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
2367 -1, -1, 155, -1, 157, 7, 8, -1, 10, 11,
2368 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2369 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2370 -1, 36, -1, -1, -1, -1, -1, -1, -1, -1,
2371 -1, -1, -1, -1, -1, -1, -1, 49, -1, 149,
2372 55, 56, 152, -1, -1, 155, -1, 157, -1, -1,
2373 -1, -1, 67, 68, 69, 70, 71, 72, 73, 74,
2374 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2375 85, 86, 87, 88, 89, -1, -1, -1, -1, 149,
2376 -1, -1, 152, -1, -1, 155, -1, 157, -1, -1,
2377 -1, -1, -1, -1, -1, 110, 111, 112, -1, -1,
2378 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2379 125, 126, 127, 128, 129, 130, 131, 132, 133, -1,
2380 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2381 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
2382 152, -1, -1, 155, -1, 157
2385 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2386 symbol of state STATE-NUM. */
2387 static const unsigned char yystos[] =
2389 0, 19, 20, 22, 23, 24, 30, 31, 51, 54,
2390 58, 168, 170, 171, 172, 173, 204, 205, 206, 208,
2391 207, 52, 66, 213, 146, 57, 146, 18, 146, 42,
2392 43, 44, 45, 46, 47, 48, 50, 143, 144, 145,
2393 174, 175, 176, 0, 206, 46, 48, 177, 223, 42,
2394 43, 44, 47, 178, 220, 222, 229, 146, 146, 152,
2395 214, 22, 212, 7, 8, 10, 11, 12, 13, 14,
2396 15, 16, 17, 49, 149, 152, 155, 157, 168, 171,
2397 191, 192, 226, 176, 176, 35, 37, 202, 176, 176,
2398 21, 230, 231, 29, 158, 221, 230, 22, 22, 22,
2399 215, 150, 4, 4, 4, 157, 10, 158, 192, 197,
2400 148, 150, 202, 202, 42, 44, 179, 32, 33, 201,
2401 60, 61, 62, 63, 64, 65, 180, 218, 218, 170,
2402 234, 147, 154, 39, 192, 193, 195, 196, 153, 153,
2403 158, 197, 147, 158, 196, 201, 201, 10, 121, 192,
2404 194, 203, 11, 12, 13, 14, 15, 16, 166, 167,
2405 192, 198, 4, 194, 28, 157, 219, 36, 55, 56,
2406 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2407 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2408 87, 88, 89, 110, 111, 112, 115, 116, 117, 118,
2409 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2410 129, 130, 131, 132, 133, 161, 162, 163, 232, 238,
2411 239, 240, 241, 22, 182, 147, 151, 192, 192, 156,
2412 158, 192, 151, 198, 192, 150, 226, 26, 27, 3,
2413 4, 5, 6, 9, 25, 40, 41, 88, 89, 115,
2414 129, 131, 132, 133, 152, 155, 157, 159, 161, 162,
2415 163, 199, 226, 209, 171, 55, 10, 192, 228, 11,
2416 17, 11, 166, 180, 90, 91, 92, 93, 94, 95,
2417 96, 97, 98, 99, 164, 26, 27, 96, 97, 98,
2418 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2419 109, 165, 192, 192, 228, 192, 192, 235, 228, 228,
2420 228, 228, 228, 192, 192, 228, 180, 113, 114, 117,
2421 118, 134, 135, 137, 138, 140, 141, 142, 181, 39,
2422 193, 184, 154, 156, 156, 184, 210, 211, 203, 164,
2423 165, 150, 150, 150, 150, 150, 154, 198, 200, 157,
2424 200, 158, 200, 22, 150, 150, 150, 147, 189, 150,
2425 3, 4, 9, 25, 26, 27, 40, 41, 57, 155,
2426 199, 225, 226, 227, 227, 227, 227, 194, 192, 192,
2427 147, 186, 147, 186, 227, 152, 147, 147, 147, 147,
2428 147, 147, 227, 227, 38, 194, 192, 228, 134, 135,
2429 136, 139, 183, 189, 189, 38, 150, 150, 198, 198,
2430 198, 198, 198, 147, 154, 158, 192, 200, 156, 158,
2431 198, 198, 198, 34, 53, 187, 190, 39, 192, 216,
2432 217, 59, 224, 200, 147, 147, 227, 227, 227, 11,
2433 53, 11, 237, 227, 152, 228, 192, 228, 228, 228,
2434 147, 147, 192, 227, 227, 147, 192, 198, 198, 237,
2435 147, 147, 147, 147, 198, 156, 158, 147, 147, 38,
2436 22, 4, 189, 182, 147, 151, 22, 156, 17, 17,
2437 150, 147, 147, 227, 4, 227, 147, 147, 227, 147,
2438 147, 147, 227, 227, 150, 147, 186, 192, 151, 147,
2439 147, 151, 198, 198, 198, 198, 156, 198, 198, 192,
2440 168, 169, 39, 192, 184, 147, 227, 227, 192, 236,
2441 227, 227, 186, 186, 228, 227, 147, 228, 228, 228,
2442 236, 227, 198, 198, 147, 151, 147, 147, 151, 151,
2443 151, 182, 187, 188, 22, 147, 152, 227, 147, 151,
2444 154, 227, 151, 186, 151, 151, 198, 198, 198, 169,
2445 53, 185, 17, 154, 166, 233, 182, 192, 184, 154,
2446 184, 151, 151, 151, 4, 227, 225, 154, 166, 227,
2447 38, 147, 225, 182, 17, 17, 147, 227, 227, 17,
2451 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2452 # define YYSIZE_T __SIZE_TYPE__
2454 #if ! defined (YYSIZE_T) && defined (size_t)
2455 # define YYSIZE_T size_t
2457 #if ! defined (YYSIZE_T)
2458 # if defined (__STDC__) || defined (__cplusplus)
2459 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2460 # define YYSIZE_T size_t
2463 #if ! defined (YYSIZE_T)
2464 # define YYSIZE_T unsigned int
2467 #define yyerrok (yyerrstatus = 0)
2468 #define yyclearin (yychar = YYEMPTY)
2469 #define YYEMPTY (-2)
2472 #define YYACCEPT goto yyacceptlab
2473 #define YYABORT goto yyabortlab
2474 #define YYERROR goto yyerrorlab
2477 /* Like YYERROR except do call yyerror. This remains here temporarily
2478 to ease the transition to the new meaning of YYERROR, for GCC.
2479 Once GCC version 2 has supplanted version 1, this can go. */
2481 #define YYFAIL goto yyerrlab
2483 #define YYRECOVERING() (!!yyerrstatus)
2485 #define YYBACKUP(Token, Value) \
2487 if (yychar == YYEMPTY && yylen == 1) \
2491 yytoken = YYTRANSLATE (yychar); \
2497 yyerror ("syntax error: cannot back up");\
2503 #define YYERRCODE 256
2505 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
2508 #ifndef YYLLOC_DEFAULT
2509 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2510 ((Current).first_line = (Rhs)[1].first_line, \
2511 (Current).first_column = (Rhs)[1].first_column, \
2512 (Current).last_line = (Rhs)[N].last_line, \
2513 (Current).last_column = (Rhs)[N].last_column)
2516 /* YYLEX -- calling `yylex' with the right arguments. */
2519 # define YYLEX yylex (YYLEX_PARAM)
2521 # define YYLEX yylex ()
2524 /* Enable debugging if requested. */
2528 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2529 # define YYFPRINTF fprintf
2532 # define YYDPRINTF(Args) \
2538 # define YYDSYMPRINT(Args) \
2544 # define YYDSYMPRINTF(Title, Token, Value, Location) \
2548 YYFPRINTF (stderr, "%s ", Title); \
2549 yysymprint (stderr, \
2551 YYFPRINTF (stderr, "\n"); \
2555 /*------------------------------------------------------------------.
2556 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2558 `------------------------------------------------------------------*/
2560 #if defined (__STDC__) || defined (__cplusplus)
2562 yy_stack_print (short *bottom, short *top)
2565 yy_stack_print (bottom, top)
2570 YYFPRINTF (stderr, "Stack now");
2571 for (/* Nothing. */; bottom <= top; ++bottom)
2572 YYFPRINTF (stderr, " %d", *bottom);
2573 YYFPRINTF (stderr, "\n");
2576 # define YY_STACK_PRINT(Bottom, Top) \
2579 yy_stack_print ((Bottom), (Top)); \
2583 /*------------------------------------------------.
2584 | Report that the YYRULE is going to be reduced. |
2585 `------------------------------------------------*/
2587 #if defined (__STDC__) || defined (__cplusplus)
2589 yy_reduce_print (int yyrule)
2592 yy_reduce_print (yyrule)
2597 unsigned int yylno = yyrline[yyrule];
2598 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
2600 /* Print the symbols being reduced, and their result. */
2601 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2602 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
2603 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
2606 # define YY_REDUCE_PRINT(Rule) \
2609 yy_reduce_print (Rule); \
2612 /* Nonzero means print parse trace. It is left uninitialized so that
2613 multiple parsers can coexist. */
2615 #else /* !YYDEBUG */
2616 # define YYDPRINTF(Args)
2617 # define YYDSYMPRINT(Args)
2618 # define YYDSYMPRINTF(Title, Token, Value, Location)
2619 # define YY_STACK_PRINT(Bottom, Top)
2620 # define YY_REDUCE_PRINT(Rule)
2621 #endif /* !YYDEBUG */
2624 /* YYINITDEPTH -- initial size of the parser's stacks. */
2626 # define YYINITDEPTH 200
2629 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2630 if the built-in stack extension method is used).
2632 Do not make this value too large; the results are undefined if
2633 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
2634 evaluated with infinite-precision integer arithmetic. */
2636 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
2641 # define YYMAXDEPTH 10000
2649 # if defined (__GLIBC__) && defined (_STRING_H)
2650 # define yystrlen strlen
2652 /* Return the length of YYSTR. */
2654 # if defined (__STDC__) || defined (__cplusplus)
2655 yystrlen (const char *yystr)
2661 register const char *yys = yystr;
2663 while (*yys++ != '\0')
2666 return yys - yystr - 1;
2672 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2673 # define yystpcpy stpcpy
2675 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2678 # if defined (__STDC__) || defined (__cplusplus)
2679 yystpcpy (char *yydest, const char *yysrc)
2681 yystpcpy (yydest, yysrc)
2686 register char *yyd = yydest;
2687 register const char *yys = yysrc;
2689 while ((*yyd++ = *yys++) != '\0')
2697 #endif /* !YYERROR_VERBOSE */
2702 /*--------------------------------.
2703 | Print this symbol on YYOUTPUT. |
2704 `--------------------------------*/
2706 #if defined (__STDC__) || defined (__cplusplus)
2708 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2711 yysymprint (yyoutput, yytype, yyvaluep)
2717 /* Pacify ``unused variable'' warnings. */
2720 if (yytype < YYNTOKENS)
2722 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2724 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2728 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2735 YYFPRINTF (yyoutput, ")");
2738 #endif /* ! YYDEBUG */
2739 /*-----------------------------------------------.
2740 | Release the memory associated to this symbol. |
2741 `-----------------------------------------------*/
2743 #if defined (__STDC__) || defined (__cplusplus)
2745 yydestruct (int yytype, YYSTYPE *yyvaluep)
2748 yydestruct (yytype, yyvaluep)
2753 /* Pacify ``unused variable'' warnings. */
2765 /* Prevent warnings from -Wmissing-prototypes. */
2767 #ifdef YYPARSE_PARAM
2768 # if defined (__STDC__) || defined (__cplusplus)
2769 int yyparse (void *YYPARSE_PARAM);
2773 #else /* ! YYPARSE_PARAM */
2774 #if defined (__STDC__) || defined (__cplusplus)
2779 #endif /* ! YYPARSE_PARAM */
2783 /* The lookahead symbol. */
2786 /* The semantic value of the lookahead symbol. */
2789 /* Number of syntax errors so far. */
2798 #ifdef YYPARSE_PARAM
2799 # if defined (__STDC__) || defined (__cplusplus)
2800 int yyparse (void *YYPARSE_PARAM)
2802 int yyparse (YYPARSE_PARAM)
2803 void *YYPARSE_PARAM;
2805 #else /* ! YYPARSE_PARAM */
2806 #if defined (__STDC__) || defined (__cplusplus)
2817 register int yystate;
2820 /* Number of tokens to shift before error messages enabled. */
2822 /* Lookahead token as an internal (translated) token number. */
2825 /* Three stacks and their tools:
2826 `yyss': related to states,
2827 `yyvs': related to semantic values,
2828 `yyls': related to locations.
2830 Refer to the stacks thru separate pointers, to allow yyoverflow
2831 to reallocate them elsewhere. */
2833 /* The state stack. */
2834 short yyssa[YYINITDEPTH];
2835 short *yyss = yyssa;
2836 register short *yyssp;
2838 /* The semantic value stack. */
2839 YYSTYPE yyvsa[YYINITDEPTH];
2840 YYSTYPE *yyvs = yyvsa;
2841 register YYSTYPE *yyvsp;
2845 #define YYPOPSTACK (yyvsp--, yyssp--)
2847 YYSIZE_T yystacksize = YYINITDEPTH;
2849 /* The variables used to return semantic value and location from the
2854 /* When reducing, the number of symbols on the RHS of the reduced
2858 YYDPRINTF ((stderr, "Starting parse\n"));
2863 yychar = YYEMPTY; /* Cause a token to be read. */
2865 /* Initialize stack pointers.
2866 Waste one element of value and location stack
2867 so that they stay on the same level as the state stack.
2868 The wasted elements are never initialized. */
2875 /*------------------------------------------------------------.
2876 | yynewstate -- Push a new state, which is found in yystate. |
2877 `------------------------------------------------------------*/
2879 /* In all cases, when you get here, the value and location stacks
2880 have just been pushed. so pushing a state here evens the stacks.
2887 if (yyss + yystacksize - 1 <= yyssp)
2889 /* Get the current used size of the three stacks, in elements. */
2890 YYSIZE_T yysize = yyssp - yyss + 1;
2894 /* Give user a chance to reallocate the stack. Use copies of
2895 these so that the &'s don't force the real ones into
2897 YYSTYPE *yyvs1 = yyvs;
2898 short *yyss1 = yyss;
2901 /* Each stack pointer address is followed by the size of the
2902 data in use in that stack, in bytes. This used to be a
2903 conditional around just the two extra args, but that might
2904 be undefined if yyoverflow is a macro. */
2905 yyoverflow ("parser stack overflow",
2906 &yyss1, yysize * sizeof (*yyssp),
2907 &yyvs1, yysize * sizeof (*yyvsp),
2914 #else /* no yyoverflow */
2915 # ifndef YYSTACK_RELOCATE
2918 /* Extend the stack our own way. */
2919 if (YYMAXDEPTH <= yystacksize)
2922 if (YYMAXDEPTH < yystacksize)
2923 yystacksize = YYMAXDEPTH;
2926 short *yyss1 = yyss;
2927 union yyalloc *yyptr =
2928 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2931 YYSTACK_RELOCATE (yyss);
2932 YYSTACK_RELOCATE (yyvs);
2934 # undef YYSTACK_RELOCATE
2936 YYSTACK_FREE (yyss1);
2939 #endif /* no yyoverflow */
2941 yyssp = yyss + yysize - 1;
2942 yyvsp = yyvs + yysize - 1;
2945 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2946 (unsigned long int) yystacksize));
2948 if (yyss + yystacksize - 1 <= yyssp)
2952 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2961 /* Do appropriate processing given the current state. */
2962 /* Read a lookahead token if we need one and don't already have one. */
2965 /* First try to decide what to do without reference to lookahead token. */
2967 yyn = yypact[yystate];
2968 if (yyn == YYPACT_NINF)
2971 /* Not known => get a lookahead token if don't already have one. */
2973 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2974 if (yychar == YYEMPTY)
2976 YYDPRINTF ((stderr, "Reading a token: "));
2980 if (yychar <= YYEOF)
2982 yychar = yytoken = YYEOF;
2983 YYDPRINTF ((stderr, "Now at end of input.\n"));
2987 yytoken = YYTRANSLATE (yychar);
2988 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
2991 /* If the proper action on seeing token YYTOKEN is to reduce or to
2992 detect an error, take that action. */
2994 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2999 if (yyn == 0 || yyn == YYTABLE_NINF)
3008 /* Shift the lookahead token. */
3009 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
3011 /* Discard the token being shifted unless it is eof. */
3012 if (yychar != YYEOF)
3018 /* Count tokens shifted since error; after three, turn off error
3027 /*-----------------------------------------------------------.
3028 | yydefault -- do the default action for the current state. |
3029 `-----------------------------------------------------------*/
3031 yyn = yydefact[yystate];
3037 /*-----------------------------.
3038 | yyreduce -- Do a reduction. |
3039 `-----------------------------*/
3041 /* yyn is the number of a rule to reduce with. */
3044 /* If YYLEN is nonzero, implement the default value of the action:
3047 Otherwise, the following line sets YYVAL to garbage.
3048 This behavior is undocumented and Bison
3049 users should not rely upon it. Assigning to YYVAL
3050 unconditionally makes the parser a bit smaller, and it avoids a
3051 GCC warning that YYVAL may be used uninitialized. */
3052 yyval = yyvsp[1-yylen];
3055 YY_REDUCE_PRINT (yyn);
3059 #line 1128 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3060 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;}
3064 #line 1128 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3065 { yyval.IPredicate = ICmpInst::ICMP_NE; ;}
3069 #line 1129 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3070 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;}
3074 #line 1129 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3075 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;}
3079 #line 1130 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3080 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;}
3084 #line 1130 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3085 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;}
3089 #line 1131 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3090 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;}
3094 #line 1131 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3095 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;}
3099 #line 1132 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3100 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;}
3104 #line 1132 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3105 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;}
3109 #line 1136 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3110 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;}
3114 #line 1136 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3115 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;}
3119 #line 1137 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3120 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;}
3124 #line 1137 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3125 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;}
3129 #line 1138 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3130 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;}
3134 #line 1138 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3135 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;}
3139 #line 1139 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3140 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;}
3144 #line 1139 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3145 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;}
3149 #line 1140 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3150 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;}
3154 #line 1140 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3155 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;}
3159 #line 1141 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3160 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;}
3164 #line 1141 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3165 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;}
3169 #line 1142 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3170 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;}
3174 #line 1142 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3175 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;}
3179 #line 1143 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3180 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;}
3184 #line 1144 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3185 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;}
3189 #line 1153 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3190 { yyval.StrVal = 0; ;}
3194 #line 1157 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3196 yyval.StrVal = yyvsp[-1].StrVal;
3202 #line 1161 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3210 #line 1169 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3218 #line 1174 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3220 yyval.StrVal = yyvsp[-1].StrVal;
3226 #line 1180 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3227 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
3231 #line 1181 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3232 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
3236 #line 1182 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3237 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
3241 #line 1183 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3242 { yyval.Linkage = GlobalValue::AppendingLinkage; ;}
3246 #line 1184 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3247 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
3251 #line 1188 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3252 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
3256 #line 1189 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3257 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
3261 #line 1190 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3262 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3266 #line 1194 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3267 { yyval.Visibility = GlobalValue::DefaultVisibility; ;}
3271 #line 1195 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3272 { yyval.Visibility = GlobalValue::DefaultVisibility; ;}
3276 #line 1196 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3277 { yyval.Visibility = GlobalValue::HiddenVisibility; ;}
3281 #line 1197 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3282 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;}
3286 #line 1201 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3287 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3291 #line 1202 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3292 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
3296 #line 1203 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3297 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
3301 #line 1207 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3302 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3306 #line 1208 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3307 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
3311 #line 1209 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3312 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
3316 #line 1210 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3317 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
3321 #line 1211 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3322 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
3326 #line 1215 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3327 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3331 #line 1216 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3332 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
3336 #line 1217 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3337 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
3341 #line 1220 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3342 { yyval.UIntVal = CallingConv::C; ;}
3346 #line 1221 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3347 { yyval.UIntVal = CallingConv::C; ;}
3351 #line 1222 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3352 { yyval.UIntVal = CallingConv::Fast; ;}
3356 #line 1223 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3357 { yyval.UIntVal = CallingConv::Cold; ;}
3361 #line 1224 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3362 { yyval.UIntVal = CallingConv::X86_StdCall; ;}
3366 #line 1225 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3367 { yyval.UIntVal = CallingConv::X86_FastCall; ;}
3371 #line 1226 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3373 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
3374 GEN_ERROR("Calling conv too large");
3375 yyval.UIntVal = yyvsp[0].UInt64Val;
3381 #line 1233 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3382 { yyval.ParamAttrs = ParamAttr::ZExt; ;}
3386 #line 1234 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3387 { yyval.ParamAttrs = ParamAttr::ZExt; ;}
3391 #line 1235 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3392 { yyval.ParamAttrs = ParamAttr::SExt; ;}
3396 #line 1236 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3397 { yyval.ParamAttrs = ParamAttr::SExt; ;}
3401 #line 1237 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3402 { yyval.ParamAttrs = ParamAttr::InReg; ;}
3406 #line 1238 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3407 { yyval.ParamAttrs = ParamAttr::StructRet; ;}
3411 #line 1239 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3412 { yyval.ParamAttrs = ParamAttr::NoAlias; ;}
3416 #line 1240 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3417 { yyval.ParamAttrs = ParamAttr::ByVal; ;}
3421 #line 1241 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3422 { yyval.ParamAttrs = ParamAttr::Nest; ;}
3426 #line 1244 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3427 { yyval.ParamAttrs = ParamAttr::None; ;}
3431 #line 1245 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3433 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
3438 #line 1250 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3439 { yyval.ParamAttrs = ParamAttr::NoReturn; ;}
3443 #line 1251 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3444 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;}
3448 #line 1252 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3449 { yyval.ParamAttrs = ParamAttr::ZExt; ;}
3453 #line 1253 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3454 { yyval.ParamAttrs = ParamAttr::SExt; ;}
3458 #line 1256 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3459 { yyval.ParamAttrs = ParamAttr::None; ;}
3463 #line 1257 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3465 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
3470 #line 1264 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3471 { yyval.UIntVal = 0; ;}
3475 #line 1265 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3477 yyval.UIntVal = yyvsp[0].UInt64Val;
3478 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
3479 GEN_ERROR("Alignment must be a power of two");
3485 #line 1271 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3486 { yyval.UIntVal = 0; ;}
3490 #line 1272 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3492 yyval.UIntVal = yyvsp[0].UInt64Val;
3493 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
3494 GEN_ERROR("Alignment must be a power of two");
3500 #line 1280 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3502 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
3503 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
3504 GEN_ERROR("Invalid character in section name");
3505 yyval.StrVal = yyvsp[0].StrVal;
3511 #line 1288 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3512 { yyval.StrVal = 0; ;}
3516 #line 1289 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3517 { yyval.StrVal = yyvsp[0].StrVal; ;}
3521 #line 1294 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3526 #line 1295 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3531 #line 1296 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3533 CurGV->setSection(*yyvsp[0].StrVal);
3534 delete yyvsp[0].StrVal;
3540 #line 1301 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3542 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
3543 GEN_ERROR("Alignment must be a power of two");
3544 CurGV->setAlignment(yyvsp[0].UInt64Val);
3550 #line 1317 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3552 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
3558 #line 1321 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3560 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
3566 #line 1325 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3568 if (*yyvsp[-1].TypeVal == Type::LabelTy)
3569 GEN_ERROR("Cannot form a pointer to a basic block");
3570 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
3571 delete yyvsp[-1].TypeVal;
3577 #line 1332 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3578 { // Named types are also simple types...
3579 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
3581 yyval.TypeVal = new PATypeHolder(tmp);
3586 #line 1337 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3587 { // Type UpReference
3588 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
3589 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3590 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3591 yyval.TypeVal = new PATypeHolder(OT);
3592 UR_OUT("New Upreference!\n");
3598 #line 1345 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3600 std::vector<const Type*> Params;
3601 ParamAttrsVector Attrs;
3602 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3603 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3607 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3608 for (; I != E; ++I, ++index) {
3609 const Type *Ty = I->Ty->get();
3610 Params.push_back(Ty);
3611 if (Ty != Type::VoidTy)
3612 if (I->Attrs != ParamAttr::None) {
3613 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3617 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3618 if (isVarArg) Params.pop_back();
3620 ParamAttrsList *ActualAttrs = 0;
3622 ActualAttrs = ParamAttrsList::get(Attrs);
3623 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3624 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3625 delete yyvsp[-4].TypeVal; // Delete the return type handle
3626 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3632 #line 1375 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3634 std::vector<const Type*> Params;
3635 ParamAttrsVector Attrs;
3636 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3637 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3640 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3642 for ( ; I != E; ++I, ++index) {
3643 const Type* Ty = I->Ty->get();
3644 Params.push_back(Ty);
3645 if (Ty != Type::VoidTy)
3646 if (I->Attrs != ParamAttr::None) {
3647 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3651 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3652 if (isVarArg) Params.pop_back();
3654 ParamAttrsList *ActualAttrs = 0;
3656 ActualAttrs = ParamAttrsList::get(Attrs);
3658 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3659 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3660 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3666 #line 1406 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3667 { // Sized array type?
3668 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3669 delete yyvsp[-1].TypeVal;
3675 #line 1411 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3677 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3678 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3679 GEN_ERROR("Unsigned result not equal to signed result");
3680 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3681 GEN_ERROR("Element type of a VectorType must be primitive");
3682 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3683 GEN_ERROR("Vector length should be a power of 2");
3684 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3685 delete yyvsp[-1].TypeVal;
3691 #line 1423 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3692 { // Structure type?
3693 std::vector<const Type*> Elements;
3694 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3695 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3696 Elements.push_back(*I);
3698 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3699 delete yyvsp[-1].TypeList;
3705 #line 1433 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3706 { // Empty structure type?
3707 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3713 #line 1437 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3715 std::vector<const Type*> Elements;
3716 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3717 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3718 Elements.push_back(*I);
3720 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3721 delete yyvsp[-2].TypeList;
3727 #line 1447 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3728 { // Empty structure type?
3729 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3735 #line 1454 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3737 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3738 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3743 #line 1461 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3745 if (!UpRefs.empty())
3746 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3747 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3748 GEN_ERROR("LLVM functions cannot return aggregate types");
3749 yyval.TypeVal = yyvsp[0].TypeVal;
3754 #line 1468 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3756 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3761 #line 1473 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3763 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3764 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3770 #line 1478 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3772 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3778 #line 1486 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3780 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3781 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3782 TWA.Ty = new PATypeHolder(Type::VoidTy);
3783 yyval.TypeWithAttrsList->push_back(TWA);
3789 #line 1493 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3791 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3792 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3793 TWA.Ty = new PATypeHolder(Type::VoidTy);
3794 yyval.TypeWithAttrsList->push_back(TWA);
3800 #line 1500 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3802 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3808 #line 1508 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3810 yyval.TypeList = new std::list<PATypeHolder>();
3811 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3812 delete yyvsp[0].TypeVal;
3818 #line 1514 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3820 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3821 delete yyvsp[0].TypeVal;
3827 #line 1526 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3828 { // Nonempty unsized arr
3829 if (!UpRefs.empty())
3830 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3831 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3833 GEN_ERROR("Cannot make array constant with type: '" +
3834 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3835 const Type *ETy = ATy->getElementType();
3836 int NumElements = ATy->getNumElements();
3838 // Verify that we have the correct size...
3839 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3840 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3841 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3842 itostr(NumElements) + "");
3844 // Verify all elements are correct type!
3845 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3846 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3847 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3848 ETy->getDescription() +"' as required!\nIt is of type '"+
3849 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3852 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3853 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3859 #line 1554 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3861 if (!UpRefs.empty())
3862 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3863 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3865 GEN_ERROR("Cannot make array constant with type: '" +
3866 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3868 int NumElements = ATy->getNumElements();
3869 if (NumElements != -1 && NumElements != 0)
3870 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3871 " arguments, but has size of " + itostr(NumElements) +"");
3872 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3873 delete yyvsp[-2].TypeVal;
3879 #line 1570 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3881 if (!UpRefs.empty())
3882 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3883 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3885 GEN_ERROR("Cannot make array constant with type: '" +
3886 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3888 int NumElements = ATy->getNumElements();
3889 const Type *ETy = ATy->getElementType();
3890 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3891 GEN_ERROR("Can't build string constant of size " +
3892 itostr((int)(yyvsp[0].StrVal->length())) +
3893 " when array has size " + itostr(NumElements) + "");
3894 std::vector<Constant*> Vals;
3895 if (ETy == Type::Int8Ty) {
3896 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3897 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3899 delete yyvsp[0].StrVal;
3900 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3902 delete yyvsp[0].StrVal;
3903 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3904 delete yyvsp[-2].TypeVal;
3910 #line 1597 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3911 { // Nonempty unsized arr
3912 if (!UpRefs.empty())
3913 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3914 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3916 GEN_ERROR("Cannot make packed constant with type: '" +
3917 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3918 const Type *ETy = PTy->getElementType();
3919 int NumElements = PTy->getNumElements();
3921 // Verify that we have the correct size...
3922 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3923 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3924 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3925 itostr(NumElements) + "");
3927 // Verify all elements are correct type!
3928 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3929 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3930 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3931 ETy->getDescription() +"' as required!\nIt is of type '"+
3932 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3935 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3936 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3942 #line 1625 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3944 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3946 GEN_ERROR("Cannot make struct constant with type: '" +
3947 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3949 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3950 GEN_ERROR("Illegal number of initializers for structure type");
3952 // Check to ensure that constants are compatible with the type initializer!
3953 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3954 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3955 GEN_ERROR("Expected type '" +
3956 STy->getElementType(i)->getDescription() +
3957 "' for element #" + utostr(i) +
3958 " of structure initializer");
3960 // Check to ensure that Type is not packed
3961 if (STy->isPacked())
3962 GEN_ERROR("Unpacked Initializer to vector type '" +
3963 STy->getDescription() + "'");
3965 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3966 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3972 #line 1651 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3974 if (!UpRefs.empty())
3975 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3976 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3978 GEN_ERROR("Cannot make struct constant with type: '" +
3979 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3981 if (STy->getNumContainedTypes() != 0)
3982 GEN_ERROR("Illegal number of initializers for structure type");
3984 // Check to ensure that Type is not packed
3985 if (STy->isPacked())
3986 GEN_ERROR("Unpacked Initializer to vector type '" +
3987 STy->getDescription() + "'");
3989 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3990 delete yyvsp[-2].TypeVal;
3996 #line 1671 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3998 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
4000 GEN_ERROR("Cannot make struct constant with type: '" +
4001 (*yyvsp[-5].TypeVal)->getDescription() + "'");
4003 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
4004 GEN_ERROR("Illegal number of initializers for structure type");
4006 // Check to ensure that constants are compatible with the type initializer!
4007 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
4008 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
4009 GEN_ERROR("Expected type '" +
4010 STy->getElementType(i)->getDescription() +
4011 "' for element #" + utostr(i) +
4012 " of structure initializer");
4014 // Check to ensure that Type is packed
4015 if (!STy->isPacked())
4016 GEN_ERROR("Vector initializer to non-vector type '" +
4017 STy->getDescription() + "'");
4019 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
4020 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
4026 #line 1697 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4028 if (!UpRefs.empty())
4029 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4030 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
4032 GEN_ERROR("Cannot make struct constant with type: '" +
4033 (*yyvsp[-4].TypeVal)->getDescription() + "'");
4035 if (STy->getNumContainedTypes() != 0)
4036 GEN_ERROR("Illegal number of initializers for structure type");
4038 // Check to ensure that Type is packed
4039 if (!STy->isPacked())
4040 GEN_ERROR("Vector initializer to non-vector type '" +
4041 STy->getDescription() + "'");
4043 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
4044 delete yyvsp[-4].TypeVal;
4050 #line 1717 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4052 if (!UpRefs.empty())
4053 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4054 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
4056 GEN_ERROR("Cannot make null pointer constant with type: '" +
4057 (*yyvsp[-1].TypeVal)->getDescription() + "'");
4059 yyval.ConstVal = ConstantPointerNull::get(PTy);
4060 delete yyvsp[-1].TypeVal;
4066 #line 1729 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4068 if (!UpRefs.empty())
4069 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4070 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
4071 delete yyvsp[-1].TypeVal;
4077 #line 1736 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4079 if (!UpRefs.empty())
4080 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4081 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
4083 GEN_ERROR("Global const reference must be a pointer type");
4085 // ConstExprs can exist in the body of a function, thus creating
4086 // GlobalValues whenever they refer to a variable. Because we are in
4087 // the context of a function, getExistingVal will search the functions
4088 // symbol table instead of the module symbol table for the global symbol,
4089 // which throws things all off. To get around this, we just tell
4090 // getExistingVal that we are at global scope here.
4092 Function *SavedCurFn = CurFun.CurrentFunction;
4093 CurFun.CurrentFunction = 0;
4095 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
4098 CurFun.CurrentFunction = SavedCurFn;
4100 // If this is an initializer for a constant pointer, which is referencing a
4101 // (currently) undefined variable, create a stub now that shall be replaced
4102 // in the future with the right type of variable.
4105 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4106 const PointerType *PT = cast<PointerType>(Ty);
4108 // First check to see if the forward references value is already created!
4109 PerModuleInfo::GlobalRefsType::iterator I =
4110 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
4112 if (I != CurModule.GlobalRefs.end()) {
4113 V = I->second; // Placeholder already exists, use it...
4114 yyvsp[0].ValIDVal.destroy();
4117 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
4118 Name = yyvsp[0].ValIDVal.getName();
4119 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
4120 GEN_ERROR("Invalid reference to global");
4122 // Create the forward referenced global.
4124 if (const FunctionType *FTy =
4125 dyn_cast<FunctionType>(PT->getElementType())) {
4126 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4127 CurModule.CurrentModule);
4129 GV = new GlobalVariable(PT->getElementType(), false,
4130 GlobalValue::ExternalWeakLinkage, 0,
4131 Name, CurModule.CurrentModule);
4134 // Keep track of the fact that we have a forward ref to recycle it
4135 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
4140 yyval.ConstVal = cast<GlobalValue>(V);
4141 delete yyvsp[-1].TypeVal; // Free the type handle
4147 #line 1802 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4149 if (!UpRefs.empty())
4150 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4151 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
4152 GEN_ERROR("Mismatched types for constant expression: " +
4153 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
4154 yyval.ConstVal = yyvsp[0].ConstVal;
4155 delete yyvsp[-1].TypeVal;
4161 #line 1812 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4163 if (!UpRefs.empty())
4164 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4165 const Type *Ty = yyvsp[-1].TypeVal->get();
4166 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4167 GEN_ERROR("Cannot create a null initialized value of this type");
4168 yyval.ConstVal = Constant::getNullValue(Ty);
4169 delete yyvsp[-1].TypeVal;
4175 #line 1822 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4176 { // integral constants
4177 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
4178 GEN_ERROR("Constant value doesn't fit in type");
4179 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
4185 #line 1828 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4186 { // arbitrary precision integer constants
4187 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
4188 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
4189 GEN_ERROR("Constant value does not fit in type");
4191 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
4192 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
4193 delete yyvsp[0].APIntVal;
4199 #line 1838 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4200 { // integral constants
4201 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
4202 GEN_ERROR("Constant value doesn't fit in type");
4203 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
4209 #line 1844 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4210 { // arbitrary precision integer constants
4211 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
4212 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
4213 GEN_ERROR("Constant value does not fit in type");
4215 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
4216 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
4217 delete yyvsp[0].APIntVal;
4223 #line 1854 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4224 { // Boolean constants
4225 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
4226 yyval.ConstVal = ConstantInt::getTrue();
4232 #line 1859 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4233 { // Boolean constants
4234 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
4235 yyval.ConstVal = ConstantInt::getFalse();
4241 #line 1864 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4242 { // Float & Double constants
4243 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
4244 GEN_ERROR("Floating point constant invalid for type");
4245 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
4251 #line 1872 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4253 if (!UpRefs.empty())
4254 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4255 Constant *Val = yyvsp[-3].ConstVal;
4256 const Type *DestTy = yyvsp[-1].TypeVal->get();
4257 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
4258 GEN_ERROR("invalid cast opcode for cast from '" +
4259 Val->getType()->getDescription() + "' to '" +
4260 DestTy->getDescription() + "'");
4261 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
4262 delete yyvsp[-1].TypeVal;
4267 #line 1884 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4269 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
4270 GEN_ERROR("GetElementPtr requires a pointer operand");
4273 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
4276 GEN_ERROR("Index list invalid for constant getelementptr");
4278 SmallVector<Constant*, 8> IdxVec;
4279 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
4280 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
4281 IdxVec.push_back(C);
4283 GEN_ERROR("Indices to constant getelementptr must be constants");
4285 delete yyvsp[-1].ValueList;
4287 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
4293 #line 1906 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4295 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
4296 GEN_ERROR("Select condition must be of boolean type");
4297 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4298 GEN_ERROR("Select operand types must match");
4299 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4305 #line 1914 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4307 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4308 GEN_ERROR("Binary operator types must match");
4310 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4315 #line 1920 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4317 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4318 GEN_ERROR("Logical operator types must match");
4319 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
4320 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
4321 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
4322 GEN_ERROR("Logical operator requires integral operands");
4324 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4330 #line 1931 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4332 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4333 GEN_ERROR("icmp operand types must match");
4334 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4339 #line 1936 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4341 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4342 GEN_ERROR("fcmp operand types must match");
4343 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4348 #line 1941 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4350 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4351 GEN_ERROR("Invalid extractelement operands");
4352 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4358 #line 1947 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4360 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4361 GEN_ERROR("Invalid insertelement operands");
4362 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4368 #line 1953 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4370 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4371 GEN_ERROR("Invalid shufflevector operands");
4372 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4378 #line 1962 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4380 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
4386 #line 1966 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4388 yyval.ConstVector = new std::vector<Constant*>();
4389 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
4395 #line 1974 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4396 { yyval.BoolVal = false; ;}
4400 #line 1974 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4401 { yyval.BoolVal = true; ;}
4405 #line 1977 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4406 { yyval.BoolVal = true; ;}
4410 #line 1977 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4411 { yyval.BoolVal = false; ;}
4415 #line 1980 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4417 const Type* VTy = yyvsp[-1].TypeVal->get();
4418 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
4420 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4422 GEN_ERROR("Aliases can be created only to global values");
4424 yyval.ConstVal = Aliasee;
4426 delete yyvsp[-1].TypeVal;
4431 #line 1992 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4433 Constant *Val = yyvsp[-3].ConstVal;
4434 const Type *DestTy = yyvsp[-1].TypeVal->get();
4435 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
4436 GEN_ERROR("invalid cast opcode for cast from '" +
4437 Val->getType()->getDescription() + "' to '" +
4438 DestTy->getDescription() + "'");
4440 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
4442 delete yyvsp[-1].TypeVal;
4447 #line 2013 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4449 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
4450 CurModule.ModuleDone();
4456 #line 2018 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4458 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
4459 CurModule.ModuleDone();
4465 #line 2031 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4466 { CurFun.isDeclare = false; ;}
4470 #line 2031 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4472 CurFun.FunctionDone();
4478 #line 2035 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4479 { CurFun.isDeclare = true; ;}
4483 #line 2035 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4490 #line 2038 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4497 #line 2041 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4499 if (!UpRefs.empty())
4500 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4501 // Eagerly resolve types. This is not an optimization, this is a
4502 // requirement that is due to the fact that we could have this:
4504 // %list = type { %list * }
4505 // %list = type { %list * } ; repeated type decl
4507 // If types are not resolved eagerly, then the two types will not be
4508 // determined to be the same type!
4510 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
4512 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
4514 // If this is a named type that is not a redefinition, add it to the slot
4516 CurModule.Types.push_back(*yyvsp[0].TypeVal);
4519 delete yyvsp[0].TypeVal;
4525 #line 2065 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4527 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
4529 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
4531 // If this is a named type that is not a redefinition, add it to the slot
4533 CurModule.Types.push_back(yyvsp[0].PrimType);
4540 #line 2076 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4542 /* "Externally Visible" Linkage */
4543 if (yyvsp[0].ConstVal == 0)
4544 GEN_ERROR("Global value initializer is not a constant");
4545 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
4546 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
4552 #line 2083 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4559 #line 2087 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4561 if (yyvsp[0].ConstVal == 0)
4562 GEN_ERROR("Global value initializer is not a constant");
4563 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
4569 #line 2092 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4576 #line 2096 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4578 if (!UpRefs.empty())
4579 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4580 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
4582 delete yyvsp[0].TypeVal;
4587 #line 2102 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4595 #line 2106 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4598 if (yyvsp[-4].StrVal) {
4599 Name = *yyvsp[-4].StrVal;
4600 delete yyvsp[-4].StrVal;
4603 GEN_ERROR("Alias name cannot be empty");
4605 Constant* Aliasee = yyvsp[0].ConstVal;
4607 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4609 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
4610 CurModule.CurrentModule);
4611 GA->setVisibility(yyvsp[-3].Visibility);
4612 InsertValue(GA, CurModule.Values);
4618 #line 2125 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4625 #line 2128 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4632 #line 2134 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4634 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4635 if (AsmSoFar.empty())
4636 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
4638 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
4639 delete yyvsp[0].StrVal;
4645 #line 2144 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4647 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
4648 delete yyvsp[0].StrVal;
4653 #line 2148 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4655 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
4656 delete yyvsp[0].StrVal;
4661 #line 2155 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4663 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4664 delete yyvsp[0].StrVal;
4670 #line 2160 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4672 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4673 delete yyvsp[0].StrVal;
4679 #line 2165 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4686 #line 2174 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4688 if (!UpRefs.empty())
4689 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4690 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4691 GEN_ERROR("void typed arguments are invalid");
4692 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4693 yyval.ArgList = yyvsp[-4].ArgList;
4694 yyvsp[-4].ArgList->push_back(E);
4700 #line 2184 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4702 if (!UpRefs.empty())
4703 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4704 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4705 GEN_ERROR("void typed arguments are invalid");
4706 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4707 yyval.ArgList = new ArgListType;
4708 yyval.ArgList->push_back(E);
4714 #line 2195 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4716 yyval.ArgList = yyvsp[0].ArgList;
4722 #line 2199 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4724 yyval.ArgList = yyvsp[-2].ArgList;
4725 struct ArgListEntry E;
4726 E.Ty = new PATypeHolder(Type::VoidTy);
4728 E.Attrs = ParamAttr::None;
4729 yyval.ArgList->push_back(E);
4735 #line 2208 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4737 yyval.ArgList = new ArgListType;
4738 struct ArgListEntry E;
4739 E.Ty = new PATypeHolder(Type::VoidTy);
4741 E.Attrs = ParamAttr::None;
4742 yyval.ArgList->push_back(E);
4748 #line 2217 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4756 #line 2223 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4758 std::string FunctionName(*yyvsp[-6].StrVal);
4759 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4761 // Check the function result for abstractness if this is a define. We should
4762 // have no abstract types at this point
4763 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4764 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4766 std::vector<const Type*> ParamTypeList;
4767 ParamAttrsVector Attrs;
4768 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4769 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4770 Attrs.push_back(PAWI);
4772 if (yyvsp[-4].ArgList) { // If there are arguments...
4774 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4775 const Type* Ty = I->Ty->get();
4776 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4777 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4778 ParamTypeList.push_back(Ty);
4779 if (Ty != Type::VoidTy)
4780 if (I->Attrs != ParamAttr::None) {
4781 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4782 Attrs.push_back(PAWI);
4787 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4788 if (isVarArg) ParamTypeList.pop_back();
4790 ParamAttrsList *PAL = 0;
4792 PAL = ParamAttrsList::get(Attrs);
4794 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4795 const PointerType *PFT = PointerType::get(FT);
4796 delete yyvsp[-7].TypeVal;
4799 if (!FunctionName.empty()) {
4800 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4802 ID = ValID::createGlobalID(CurModule.Values.size());
4806 // See if this function was forward referenced. If so, recycle the object.
4807 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4808 // Move the function to the end of the list, from whereever it was
4809 // previously inserted.
4810 Fn = cast<Function>(FWRef);
4811 CurModule.CurrentModule->getFunctionList().remove(Fn);
4812 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4813 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4814 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4815 if (Fn->getFunctionType() != FT) {
4816 // The existing function doesn't have the same type. This is an overload
4818 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4819 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4820 // Neither the existing or the current function is a declaration and they
4821 // have the same name and same type. Clearly this is a redefinition.
4822 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4823 } if (Fn->isDeclaration()) {
4824 // Make sure to strip off any argument names so we can't get conflicts.
4825 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4829 } else { // Not already defined?
4830 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4831 CurModule.CurrentModule);
4833 InsertValue(Fn, CurModule.Values);
4836 CurFun.FunctionStart(Fn);
4838 if (CurFun.isDeclare) {
4839 // If we have declaration, always overwrite linkage. This will allow us to
4840 // correctly handle cases, when pointer to function is passed as argument to
4841 // another function.
4842 Fn->setLinkage(CurFun.Linkage);
4843 Fn->setVisibility(CurFun.Visibility);
4845 Fn->setCallingConv(yyvsp[-8].UIntVal);
4846 Fn->setAlignment(yyvsp[0].UIntVal);
4847 if (yyvsp[-1].StrVal) {
4848 Fn->setSection(*yyvsp[-1].StrVal);
4849 delete yyvsp[-1].StrVal;
4852 // Add all of the arguments we parsed to the function...
4853 if (yyvsp[-4].ArgList) { // Is null if empty...
4854 if (isVarArg) { // Nuke the last entry
4855 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4856 "Not a varargs marker!");
4857 delete yyvsp[-4].ArgList->back().Ty;
4858 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4860 Function::arg_iterator ArgIt = Fn->arg_begin();
4861 Function::arg_iterator ArgEnd = Fn->arg_end();
4863 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4864 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4865 delete I->Ty; // Delete the typeholder...
4866 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4872 delete yyvsp[-4].ArgList; // We're now done with the argument list
4879 #line 2345 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4881 yyval.FunctionVal = CurFun.CurrentFunction;
4883 // Make sure that we keep track of the linkage type even if there was a
4884 // previous "declare".
4885 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4886 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4891 #line 2356 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4893 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4899 #line 2361 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4901 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4902 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4903 yyval.FunctionVal = CurFun.CurrentFunction;
4904 CurFun.FunctionDone();
4910 #line 2373 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4912 yyval.BoolVal = false;
4918 #line 2377 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4920 yyval.BoolVal = true;
4926 #line 2382 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4927 { // A reference to a direct constant
4928 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4934 #line 2386 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4936 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4942 #line 2390 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4943 { // Perhaps it's an FP constant?
4944 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4950 #line 2394 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4952 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4958 #line 2398 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4960 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4966 #line 2402 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4968 yyval.ValIDVal = ValID::createNull();
4974 #line 2406 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4976 yyval.ValIDVal = ValID::createUndef();
4982 #line 2410 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4983 { // A vector zero constant.
4984 yyval.ValIDVal = ValID::createZeroInit();
4990 #line 2414 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4991 { // Nonempty unsized packed vector
4992 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4993 int NumElements = yyvsp[-1].ConstVector->size();
4995 VectorType* pt = VectorType::get(ETy, NumElements);
4996 PATypeHolder* PTy = new PATypeHolder(
5004 // Verify all elements are correct type!
5005 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
5006 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
5007 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5008 ETy->getDescription() +"' as required!\nIt is of type '" +
5009 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
5012 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
5013 delete PTy; delete yyvsp[-1].ConstVector;
5019 #line 2439 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5021 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
5027 #line 2443 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5029 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
5030 delete yyvsp[-2].StrVal;
5031 delete yyvsp[0].StrVal;
5037 #line 2453 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5038 { // Is it an integer reference...?
5039 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
5045 #line 2457 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5047 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
5053 #line 2461 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5054 { // Is it a named reference...?
5055 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
5056 delete yyvsp[0].StrVal;
5062 #line 2466 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5063 { // Is it a named reference...?
5064 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
5065 delete yyvsp[0].StrVal;
5071 #line 2479 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5073 if (!UpRefs.empty())
5074 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5075 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
5076 delete yyvsp[-1].TypeVal;
5082 #line 2488 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5084 yyval.FunctionVal = yyvsp[-1].FunctionVal;
5090 #line 2492 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5091 { // Do not allow functions with 0 basic blocks
5092 yyval.FunctionVal = yyvsp[-1].FunctionVal;
5098 #line 2501 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5100 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
5102 InsertValue(yyvsp[0].TermInstVal);
5103 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
5104 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
5110 #line 2510 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5112 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
5113 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5114 if (CI2->getParent() == 0)
5115 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
5116 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
5117 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
5123 #line 2519 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5124 { // Empty space between instruction lists
5125 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5131 #line 2523 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5132 { // Labelled (named) basic block
5133 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
5134 delete yyvsp[0].StrVal;
5141 #line 2530 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5142 { // Return with a result...
5143 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
5149 #line 2534 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5150 { // Return with no result...
5151 yyval.TermInstVal = new ReturnInst();
5157 #line 2538 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5158 { // Unconditional Branch...
5159 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5161 yyval.TermInstVal = new BranchInst(tmpBB);
5166 #line 2543 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5168 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
5169 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
5171 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
5173 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
5175 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5180 #line 2553 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5182 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
5184 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
5186 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
5187 yyval.TermInstVal = S;
5189 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
5190 E = yyvsp[-1].JumpTable->end();
5191 for (; I != E; ++I) {
5192 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5193 S->addCase(CI, I->second);
5195 GEN_ERROR("Switch case is constant, but not a simple integer");
5197 delete yyvsp[-1].JumpTable;
5203 #line 2572 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5205 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
5207 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
5209 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5210 yyval.TermInstVal = S;
5216 #line 2582 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5219 // Handle the short syntax
5220 const PointerType *PFTy = 0;
5221 const FunctionType *Ty = 0;
5222 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
5223 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5224 // Pull out the types of all of the arguments...
5225 std::vector<const Type*> ParamTypes;
5226 ParamAttrsVector Attrs;
5227 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
5228 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
5229 Attrs.push_back(PAWI);
5231 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
5233 for (; I != E; ++I, ++index) {
5234 const Type *Ty = I->Val->getType();
5235 if (Ty == Type::VoidTy)
5236 GEN_ERROR("Short call syntax cannot be used with varargs");
5237 ParamTypes.push_back(Ty);
5238 if (I->Attrs != ParamAttr::None) {
5239 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5240 Attrs.push_back(PAWI);
5244 ParamAttrsList *PAL = 0;
5246 PAL = ParamAttrsList::get(Attrs);
5247 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
5248 PFTy = PointerType::get(Ty);
5251 delete yyvsp[-11].TypeVal;
5253 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
5255 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
5257 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
5260 // Check the arguments
5262 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
5263 // Make sure no arguments is a good thing!
5264 if (Ty->getNumParams() != 0)
5265 GEN_ERROR("No arguments passed to a function that "
5266 "expects arguments");
5267 } else { // Has arguments?
5268 // Loop through FunctionType's arguments and ensure they are specified
5270 FunctionType::param_iterator I = Ty->param_begin();
5271 FunctionType::param_iterator E = Ty->param_end();
5272 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
5274 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5275 if (ArgI->Val->getType() != *I)
5276 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5277 (*I)->getDescription() + "'");
5278 Args.push_back(ArgI->Val);
5281 if (Ty->isVarArg()) {
5283 for (; ArgI != ArgE; ++ArgI)
5284 Args.push_back(ArgI->Val); // push the remaining varargs
5285 } else if (I != E || ArgI != ArgE)
5286 GEN_ERROR("Invalid number of parameters detected");
5289 // Create the InvokeInst
5290 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5291 II->setCallingConv(yyvsp[-12].UIntVal);
5292 yyval.TermInstVal = II;
5293 delete yyvsp[-8].ValueRefList;
5299 #line 2661 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5301 yyval.TermInstVal = new UnwindInst();
5307 #line 2665 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5309 yyval.TermInstVal = new UnreachableInst();
5315 #line 2672 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5317 yyval.JumpTable = yyvsp[-5].JumpTable;
5318 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
5321 GEN_ERROR("May only switch on a constant pool value");
5323 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5325 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
5330 #line 2683 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5332 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
5333 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
5337 GEN_ERROR("May only switch on a constant pool value");
5339 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5341 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
5346 #line 2696 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5348 // Is this definition named?? if so, assign the name...
5349 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
5351 InsertValue(yyvsp[0].InstVal);
5352 yyval.InstVal = yyvsp[0].InstVal;
5358 #line 2706 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5359 { // Used for PHI nodes
5360 if (!UpRefs.empty())
5361 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
5362 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
5363 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
5365 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
5367 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
5368 delete yyvsp[-5].TypeVal;
5373 #line 2717 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5375 yyval.PHIList = yyvsp[-6].PHIList;
5376 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
5378 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
5380 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
5385 #line 2727 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5387 if (!UpRefs.empty())
5388 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5389 // Used for call and invoke instructions
5390 yyval.ValueRefList = new ValueRefList();
5391 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
5392 yyval.ValueRefList->push_back(E);
5393 delete yyvsp[-2].TypeVal;
5398 #line 2736 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5400 if (!UpRefs.empty())
5401 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5402 yyval.ValueRefList = yyvsp[-4].ValueRefList;
5403 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
5404 yyval.ValueRefList->push_back(E);
5405 delete yyvsp[-2].TypeVal;
5411 #line 2745 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5412 { yyval.ValueRefList = new ValueRefList(); ;}
5416 #line 2748 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5417 { yyval.ValueList = new std::vector<Value*>(); ;}
5421 #line 2749 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5423 yyval.ValueList = yyvsp[-2].ValueList;
5424 yyval.ValueList->push_back(yyvsp[0].ValueVal);
5430 #line 2756 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5432 yyval.BoolVal = true;
5438 #line 2760 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5440 yyval.BoolVal = false;
5446 #line 2765 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5448 if (!UpRefs.empty())
5449 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5450 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
5451 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5453 "Arithmetic operator requires integer, FP, or packed operands");
5454 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
5455 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
5456 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
5457 yyvsp[-4].BinaryOpVal == Instruction::FRem))
5458 GEN_ERROR("Remainder not supported on vector types");
5459 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5461 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5463 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
5464 if (yyval.InstVal == 0)
5465 GEN_ERROR("binary operator returned null");
5466 delete yyvsp[-3].TypeVal;
5471 #line 2786 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5473 if (!UpRefs.empty())
5474 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5475 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
5476 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
5477 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
5478 GEN_ERROR("Logical operator requires integral operands");
5480 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5482 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5484 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
5485 if (yyval.InstVal == 0)
5486 GEN_ERROR("binary operator returned null");
5487 delete yyvsp[-3].TypeVal;
5492 #line 2803 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5494 if (!UpRefs.empty())
5495 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5496 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5497 GEN_ERROR("Vector types not supported by icmp instruction");
5498 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5500 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5502 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
5503 if (yyval.InstVal == 0)
5504 GEN_ERROR("icmp operator returned null");
5505 delete yyvsp[-3].TypeVal;
5510 #line 2817 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5512 if (!UpRefs.empty())
5513 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5514 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5515 GEN_ERROR("Vector types not supported by fcmp instruction");
5516 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5518 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5520 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
5521 if (yyval.InstVal == 0)
5522 GEN_ERROR("fcmp operator returned null");
5523 delete yyvsp[-3].TypeVal;
5528 #line 2831 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5530 if (!UpRefs.empty())
5531 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
5532 Value* Val = yyvsp[-2].ValueVal;
5533 const Type* DestTy = yyvsp[0].TypeVal->get();
5534 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
5535 GEN_ERROR("invalid cast opcode for cast from '" +
5536 Val->getType()->getDescription() + "' to '" +
5537 DestTy->getDescription() + "'");
5538 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
5539 delete yyvsp[0].TypeVal;
5544 #line 2843 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5546 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
5547 GEN_ERROR("select condition must be boolean");
5548 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
5549 GEN_ERROR("select value types should match");
5550 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5556 #line 2851 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5558 if (!UpRefs.empty())
5559 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
5560 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
5561 delete yyvsp[0].TypeVal;
5567 #line 2858 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5569 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5570 GEN_ERROR("Invalid extractelement operands");
5571 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5577 #line 2864 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5579 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5580 GEN_ERROR("Invalid insertelement operands");
5581 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5587 #line 2870 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5589 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5590 GEN_ERROR("Invalid shufflevector operands");
5591 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5597 #line 2876 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5599 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
5600 if (!Ty->isFirstClassType())
5601 GEN_ERROR("PHI node operands must be of first class type");
5602 yyval.InstVal = new PHINode(Ty);
5603 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
5604 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
5605 if (yyvsp[0].PHIList->front().first->getType() != Ty)
5606 GEN_ERROR("All elements of a PHI node must be of the same type");
5607 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
5608 yyvsp[0].PHIList->pop_front();
5610 delete yyvsp[0].PHIList; // Free the list...
5616 #line 2892 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5619 // Handle the short syntax
5620 const PointerType *PFTy = 0;
5621 const FunctionType *Ty = 0;
5622 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
5623 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5624 // Pull out the types of all of the arguments...
5625 std::vector<const Type*> ParamTypes;
5626 ParamAttrsVector Attrs;
5627 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
5628 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
5629 Attrs.push_back(PAWI);
5632 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
5633 for (; I != E; ++I, ++index) {
5634 const Type *Ty = I->Val->getType();
5635 if (Ty == Type::VoidTy)
5636 GEN_ERROR("Short call syntax cannot be used with varargs");
5637 ParamTypes.push_back(Ty);
5638 if (I->Attrs != ParamAttr::None) {
5639 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5640 Attrs.push_back(PAWI);
5644 ParamAttrsList *PAL = 0;
5646 PAL = ParamAttrsList::get(Attrs);
5648 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
5649 PFTy = PointerType::get(Ty);
5652 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
5655 // Check for call to invalid intrinsic to avoid crashing later.
5656 if (Function *theF = dyn_cast<Function>(V)) {
5657 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5658 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5659 !theF->getIntrinsicID(true))
5660 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5661 theF->getName() + "'");
5664 // Check the arguments
5666 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
5667 // Make sure no arguments is a good thing!
5668 if (Ty->getNumParams() != 0)
5669 GEN_ERROR("No arguments passed to a function that "
5670 "expects arguments");
5671 } else { // Has arguments?
5672 // Loop through FunctionType's arguments and ensure they are specified
5675 FunctionType::param_iterator I = Ty->param_begin();
5676 FunctionType::param_iterator E = Ty->param_end();
5677 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
5679 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5680 if (ArgI->Val->getType() != *I)
5681 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5682 (*I)->getDescription() + "'");
5683 Args.push_back(ArgI->Val);
5685 if (Ty->isVarArg()) {
5687 for (; ArgI != ArgE; ++ArgI)
5688 Args.push_back(ArgI->Val); // push the remaining varargs
5689 } else if (I != E || ArgI != ArgE)
5690 GEN_ERROR("Invalid number of parameters detected");
5692 // Create the call node
5693 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
5694 CI->setTailCall(yyvsp[-7].BoolVal);
5695 CI->setCallingConv(yyvsp[-6].UIntVal);
5697 delete yyvsp[-2].ValueRefList;
5698 delete yyvsp[-5].TypeVal;
5704 #line 2976 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5706 yyval.InstVal = yyvsp[0].InstVal;
5712 #line 2981 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5714 yyval.BoolVal = true;
5720 #line 2985 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5722 yyval.BoolVal = false;
5728 #line 2992 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5730 if (!UpRefs.empty())
5731 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5732 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5733 delete yyvsp[-1].TypeVal;
5739 #line 2999 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5741 if (!UpRefs.empty())
5742 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5743 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5745 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5746 delete yyvsp[-4].TypeVal;
5751 #line 3007 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5753 if (!UpRefs.empty())
5754 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5755 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5756 delete yyvsp[-1].TypeVal;
5762 #line 3014 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5764 if (!UpRefs.empty())
5765 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5766 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5768 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5769 delete yyvsp[-4].TypeVal;
5774 #line 3022 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5776 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5777 GEN_ERROR("Trying to free nonpointer type " +
5778 yyvsp[0].ValueVal->getType()->getDescription() + "");
5779 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5785 #line 3030 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5787 if (!UpRefs.empty())
5788 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5789 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5790 GEN_ERROR("Can't load from nonpointer type: " +
5791 (*yyvsp[-2].TypeVal)->getDescription());
5792 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5793 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5794 (*yyvsp[-2].TypeVal)->getDescription());
5795 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5797 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5798 delete yyvsp[-2].TypeVal;
5803 #line 3044 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5805 if (!UpRefs.empty())
5806 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5807 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5809 GEN_ERROR("Can't store to a nonpointer type: " +
5810 (*yyvsp[-2].TypeVal)->getDescription());
5811 const Type *ElTy = PT->getElementType();
5812 if (ElTy != yyvsp[-4].ValueVal->getType())
5813 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5814 "' into space of type '" + ElTy->getDescription() + "'");
5816 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5818 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5819 delete yyvsp[-2].TypeVal;
5824 #line 3061 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5826 if (!UpRefs.empty())
5827 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5828 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5829 GEN_ERROR("getelementptr insn requires pointer operand");
5831 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
5832 GEN_ERROR("Invalid getelementptr indices for type '" +
5833 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5834 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5836 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
5837 delete yyvsp[-2].TypeVal;
5838 delete yyvsp[0].ValueList;
5845 /* Line 993 of yacc.c. */
5846 #line 5847 "llvmAsmParser.tab.c"
5852 YY_STACK_PRINT (yyss, yyssp);
5857 /* Now `shift' the result of the reduction. Determine what state
5858 that goes to, based on the state we popped back to and the rule
5859 number reduced by. */
5863 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5864 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5865 yystate = yytable[yystate];
5867 yystate = yydefgoto[yyn - YYNTOKENS];
5872 /*------------------------------------.
5873 | yyerrlab -- here on detecting error |
5874 `------------------------------------*/
5876 /* If not already recovering from an error, report this error. */
5881 yyn = yypact[yystate];
5883 if (YYPACT_NINF < yyn && yyn < YYLAST)
5885 YYSIZE_T yysize = 0;
5886 int yytype = YYTRANSLATE (yychar);
5887 const char* yyprefix;
5891 /* Start YYX at -YYN if negative to avoid negative indexes in
5893 int yyxbegin = yyn < 0 ? -yyn : 0;
5895 /* Stay within bounds of both yycheck and yytname. */
5896 int yychecklim = YYLAST - yyn;
5897 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5900 yyprefix = ", expecting ";
5901 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5902 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5904 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
5912 yysize += (sizeof ("syntax error, unexpected ")
5913 + yystrlen (yytname[yytype]));
5914 yymsg = (char *) YYSTACK_ALLOC (yysize);
5917 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
5918 yyp = yystpcpy (yyp, yytname[yytype]);
5922 yyprefix = ", expecting ";
5923 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5924 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5926 yyp = yystpcpy (yyp, yyprefix);
5927 yyp = yystpcpy (yyp, yytname[yyx]);
5932 YYSTACK_FREE (yymsg);
5935 yyerror ("syntax error; also virtual memory exhausted");
5938 #endif /* YYERROR_VERBOSE */
5939 yyerror ("syntax error");
5944 if (yyerrstatus == 3)
5946 /* If just tried and failed to reuse lookahead token after an
5947 error, discard it. */
5949 if (yychar <= YYEOF)
5951 /* If at end of input, pop the error token,
5952 then the rest of the stack, then return failure. */
5953 if (yychar == YYEOF)
5959 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
5960 yydestruct (yystos[*yyssp], yyvsp);
5965 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
5966 yydestruct (yytoken, &yylval);
5972 /* Else will try to reuse lookahead token after shifting the error
5977 /*---------------------------------------------------.
5978 | yyerrorlab -- error raised explicitly by YYERROR. |
5979 `---------------------------------------------------*/
5983 /* Pacify GCC when the user code never invokes YYERROR and the label
5984 yyerrorlab therefore never appears in user code. */
5995 /*-------------------------------------------------------------.
5996 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5997 `-------------------------------------------------------------*/
5999 yyerrstatus = 3; /* Each real token shifted decrements this. */
6003 yyn = yypact[yystate];
6004 if (yyn != YYPACT_NINF)
6007 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6015 /* Pop the current state because it cannot handle the error token. */
6019 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
6020 yydestruct (yystos[yystate], yyvsp);
6023 YY_STACK_PRINT (yyss, yyssp);
6029 YYDPRINTF ((stderr, "Shifting error token, "));
6038 /*-------------------------------------.
6039 | yyacceptlab -- YYACCEPT comes here. |
6040 `-------------------------------------*/
6045 /*-----------------------------------.
6046 | yyabortlab -- YYABORT comes here. |
6047 `-----------------------------------*/
6053 /*----------------------------------------------.
6054 | yyoverflowlab -- parser overflow comes here. |
6055 `----------------------------------------------*/
6057 yyerror ("parser stack overflow");
6065 YYSTACK_FREE (yyss);
6071 #line 3078 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
6074 // common code from the two 'RunVMAsmParser' functions
6075 static Module* RunParser(Module * M) {
6077 llvmAsmlineno = 1; // Reset the current line number...
6078 CurModule.CurrentModule = M;
6083 // Check to make sure the parser succeeded
6086 delete ParserResult;
6090 // Emit an error if there are any unresolved types left.
6091 if (!CurModule.LateResolveTypes.empty()) {
6092 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6093 if (DID.Type == ValID::LocalName) {
6094 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6096 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6099 delete ParserResult;
6103 // Emit an error if there are any unresolved values left.
6104 if (!CurModule.LateResolveValues.empty()) {
6105 Value *V = CurModule.LateResolveValues.back();
6106 std::map<Value*, std::pair<ValID, int> >::iterator I =
6107 CurModule.PlaceHolderInfo.find(V);
6109 if (I != CurModule.PlaceHolderInfo.end()) {
6110 ValID &DID = I->second.first;
6111 if (DID.Type == ValID::LocalName) {
6112 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6114 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6117 delete ParserResult;
6122 // Check to make sure that parsing produced a result
6126 // Reset ParserResult variable while saving its value for the result.
6127 Module *Result = ParserResult;
6133 void llvm::GenerateError(const std::string &message, int LineNo) {
6134 if (LineNo == -1) LineNo = llvmAsmlineno;
6135 // TODO: column number in exception
6137 TheParseError->setError(CurFilename, message, LineNo);
6141 int yyerror(const char *ErrorMsg) {
6143 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6144 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6145 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6146 if (yychar != YYEMPTY && yychar != 0)
6147 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6149 GenerateError(errMsg);