1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
86 ZEROINITIALIZER = 277,
123 X86_STDCALLCC_TOK = 314,
124 X86_FASTCALLCC_TOK = 315,
190 EXTRACTELEMENT = 381,
202 #define ESINT64VAL 258
203 #define EUINT64VAL 259
204 #define ESAPINTVAL 260
205 #define EUAPINTVAL 261
206 #define LOCALVAL_ID 262
207 #define GLOBALVAL_ID 263
216 #define GLOBALVAR 272
218 #define STRINGCONSTANT 274
219 #define ATSTRINGCONSTANT 275
220 #define IMPLEMENTATION 276
221 #define ZEROINITIALIZER 277
233 #define DOTDOTDOT 289
239 #define APPENDING 295
240 #define DLLIMPORT 296
241 #define DLLEXPORT 297
242 #define EXTERN_WEAK 298
253 #define SIDEEFFECT 309
256 #define FASTCC_TOK 312
257 #define COLDCC_TOK 313
258 #define X86_STDCALLCC_TOK 314
259 #define X86_FASTCALLCC_TOK 315
260 #define DATALAYOUT 316
266 #define UNREACHABLE 322
309 #define GETELEMENTPTR 365
325 #define EXTRACTELEMENT 381
326 #define INSERTELEMENT 382
327 #define SHUFFLEVECTOR 383
338 /* Copy the first part of user declarations. */
339 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
341 #include "ParserInternals.h"
342 #include "llvm/CallingConv.h"
343 #include "llvm/InlineAsm.h"
344 #include "llvm/Instructions.h"
345 #include "llvm/Module.h"
346 #include "llvm/ValueSymbolTable.h"
347 #include "llvm/Support/GetElementPtrTypeIterator.h"
348 #include "llvm/Support/CommandLine.h"
349 #include "llvm/ADT/SmallVector.h"
350 #include "llvm/ADT/STLExtras.h"
351 #include "llvm/Support/MathExtras.h"
352 #include "llvm/Support/Streams.h"
361 // The following is a gross hack. In order to rid the libAsmParser library of
362 // exceptions, we have to have a way of getting the yyparse function to go into
363 // an error situation. So, whenever we want an error to occur, the GenerateError
364 // function (see bottom of file) sets TriggerError. Then, at the end of each
365 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
366 // (a goto) to put YACC in error state. Furthermore, several calls to
367 // GenerateError are made from inside productions and they must simulate the
368 // previous exception behavior by exiting the production immediately. We have
369 // replaced these with the GEN_ERROR macro which calls GeneratError and then
370 // immediately invokes YYERROR. This would be so much cleaner if it was a
371 // recursive descent parser.
372 static bool TriggerError = false;
373 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
374 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
376 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
377 int yylex(); // declaration" of xxx warnings.
381 std::string CurFilename;
384 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
385 cl::Hidden, cl::init(false));
388 using namespace llvm;
390 static Module *ParserResult;
392 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
393 // relating to upreferences in the input stream.
395 //#define DEBUG_UPREFS 1
397 #define UR_OUT(X) cerr << X
402 #define YYERROR_VERBOSE 1
404 static GlobalVariable *CurGV;
407 // This contains info used when building the body of a function. It is
408 // destroyed when the function is completed.
410 typedef std::vector<Value *> ValueList; // Numbered defs
413 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
415 static struct PerModuleInfo {
416 Module *CurrentModule;
417 ValueList Values; // Module level numbered definitions
418 ValueList LateResolveValues;
419 std::vector<PATypeHolder> Types;
420 std::map<ValID, PATypeHolder> LateResolveTypes;
422 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
423 /// how they were referenced and on which line of the input they came from so
424 /// that we can resolve them later and print error messages as appropriate.
425 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
427 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
428 // references to global values. Global values may be referenced before they
429 // are defined, and if so, the temporary object that they represent is held
430 // here. This is used for forward references of GlobalValues.
432 typedef std::map<std::pair<const PointerType *,
433 ValID>, GlobalValue*> GlobalRefsType;
434 GlobalRefsType GlobalRefs;
437 // If we could not resolve some functions at function compilation time
438 // (calls to functions before they are defined), resolve them now... Types
439 // are resolved when the constant pool has been completely parsed.
441 ResolveDefinitions(LateResolveValues);
445 // Check to make sure that all global value forward references have been
448 if (!GlobalRefs.empty()) {
449 std::string UndefinedReferences = "Unresolved global references exist:\n";
451 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
453 UndefinedReferences += " " + I->first.first->getDescription() + " " +
454 I->first.second.getName() + "\n";
456 GenerateError(UndefinedReferences);
460 Values.clear(); // Clear out function local definitions
465 // GetForwardRefForGlobal - Check to see if there is a forward reference
466 // for this global. If so, remove it from the GlobalRefs map and return it.
467 // If not, just return null.
468 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
469 // Check to see if there is a forward reference to this global variable...
470 // if there is, eliminate it and patch the reference to use the new def'n.
471 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
472 GlobalValue *Ret = 0;
473 if (I != GlobalRefs.end()) {
480 bool TypeIsUnresolved(PATypeHolder* PATy) {
481 // If it isn't abstract, its resolved
482 const Type* Ty = PATy->get();
483 if (!Ty->isAbstract())
485 // Traverse the type looking for abstract types. If it isn't abstract then
486 // we don't need to traverse that leg of the type.
487 std::vector<const Type*> WorkList, SeenList;
488 WorkList.push_back(Ty);
489 while (!WorkList.empty()) {
490 const Type* Ty = WorkList.back();
491 SeenList.push_back(Ty);
493 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
494 // Check to see if this is an unresolved type
495 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
496 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
497 for ( ; I != E; ++I) {
498 if (I->second.get() == OpTy)
501 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
502 const Type* TheTy = SeqTy->getElementType();
503 if (TheTy->isAbstract() && TheTy != Ty) {
504 std::vector<const Type*>::iterator I = SeenList.begin(),
510 WorkList.push_back(TheTy);
512 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
513 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
514 const Type* TheTy = StrTy->getElementType(i);
515 if (TheTy->isAbstract() && TheTy != Ty) {
516 std::vector<const Type*>::iterator I = SeenList.begin(),
522 WorkList.push_back(TheTy);
533 static struct PerFunctionInfo {
534 Function *CurrentFunction; // Pointer to current function being created
536 ValueList Values; // Keep track of #'d definitions
538 ValueList LateResolveValues;
539 bool isDeclare; // Is this function a forward declararation?
540 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
541 GlobalValue::VisibilityTypes Visibility;
543 /// BBForwardRefs - When we see forward references to basic blocks, keep
544 /// track of them here.
545 std::map<ValID, BasicBlock*> BBForwardRefs;
547 inline PerFunctionInfo() {
550 Linkage = GlobalValue::ExternalLinkage;
551 Visibility = GlobalValue::DefaultVisibility;
554 inline void FunctionStart(Function *M) {
559 void FunctionDone() {
560 // Any forward referenced blocks left?
561 if (!BBForwardRefs.empty()) {
562 GenerateError("Undefined reference to label " +
563 BBForwardRefs.begin()->second->getName());
567 // Resolve all forward references now.
568 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
570 Values.clear(); // Clear out function local definitions
571 BBForwardRefs.clear();
574 Linkage = GlobalValue::ExternalLinkage;
575 Visibility = GlobalValue::DefaultVisibility;
577 } CurFun; // Info for the current function...
579 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
582 //===----------------------------------------------------------------------===//
583 // Code to handle definitions of all the types
584 //===----------------------------------------------------------------------===//
586 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
587 // Things that have names or are void typed don't get slot numbers
588 if (V->hasName() || (V->getType() == Type::VoidTy))
591 // In the case of function values, we have to allow for the forward reference
592 // of basic blocks, which are included in the numbering. Consequently, we keep
593 // track of the next insertion location with NextValNum. When a BB gets
594 // inserted, it could change the size of the CurFun.Values vector.
595 if (&ValueTab == &CurFun.Values) {
596 if (ValueTab.size() <= CurFun.NextValNum)
597 ValueTab.resize(CurFun.NextValNum+1);
598 ValueTab[CurFun.NextValNum++] = V;
601 // For all other lists, its okay to just tack it on the back of the vector.
602 ValueTab.push_back(V);
605 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
607 case ValID::LocalID: // Is it a numbered definition?
608 // Module constants occupy the lowest numbered slots...
609 if (D.Num < CurModule.Types.size())
610 return CurModule.Types[D.Num];
612 case ValID::LocalName: // Is it a named definition?
613 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
614 D.destroy(); // Free old strdup'd memory...
619 GenerateError("Internal parser error: Invalid symbol type reference");
623 // If we reached here, we referenced either a symbol that we don't know about
624 // or an id number that hasn't been read yet. We may be referencing something
625 // forward, so just create an entry to be resolved later and get to it...
627 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
630 if (inFunctionScope()) {
631 if (D.Type == ValID::LocalName) {
632 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
635 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
640 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
641 if (I != CurModule.LateResolveTypes.end())
644 Type *Typ = OpaqueType::get();
645 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
649 // getExistingVal - Look up the value specified by the provided type and
650 // the provided ValID. If the value exists and has already been defined, return
651 // it. Otherwise return null.
653 static Value *getExistingVal(const Type *Ty, const ValID &D) {
654 if (isa<FunctionType>(Ty)) {
655 GenerateError("Functions are not values and "
656 "must be referenced as pointers");
661 case ValID::LocalID: { // Is it a numbered definition?
662 // Check that the number is within bounds.
663 if (D.Num >= CurFun.Values.size())
665 Value *Result = CurFun.Values[D.Num];
666 if (Ty != Result->getType()) {
667 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
668 Result->getType()->getDescription() + "' does not match "
669 "expected type, '" + Ty->getDescription() + "'");
674 case ValID::GlobalID: { // Is it a numbered definition?
675 if (D.Num >= CurModule.Values.size())
677 Value *Result = CurModule.Values[D.Num];
678 if (Ty != Result->getType()) {
679 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
680 Result->getType()->getDescription() + "' does not match "
681 "expected type, '" + Ty->getDescription() + "'");
687 case ValID::LocalName: { // Is it a named definition?
688 if (!inFunctionScope())
690 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
691 Value *N = SymTab.lookup(D.Name);
694 if (N->getType() != Ty)
697 D.destroy(); // Free old strdup'd memory...
700 case ValID::GlobalName: { // Is it a named definition?
701 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
702 Value *N = SymTab.lookup(D.Name);
705 if (N->getType() != Ty)
708 D.destroy(); // Free old strdup'd memory...
712 // Check to make sure that "Ty" is an integral type, and that our
713 // value will fit into the specified type...
714 case ValID::ConstSIntVal: // Is it a constant pool reference??
715 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
716 GenerateError("Signed integral constant '" +
717 itostr(D.ConstPool64) + "' is invalid for type '" +
718 Ty->getDescription() + "'");
721 return ConstantInt::get(Ty, D.ConstPool64, true);
723 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
724 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
725 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
726 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
727 "' is invalid or out of range");
729 } else { // This is really a signed reference. Transmogrify.
730 return ConstantInt::get(Ty, D.ConstPool64, true);
733 return ConstantInt::get(Ty, D.UConstPool64);
736 case ValID::ConstFPVal: // Is it a floating point const pool reference?
737 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
738 GenerateError("FP constant invalid for type");
741 return ConstantFP::get(Ty, D.ConstPoolFP);
743 case ValID::ConstNullVal: // Is it a null value?
744 if (!isa<PointerType>(Ty)) {
745 GenerateError("Cannot create a a non pointer null");
748 return ConstantPointerNull::get(cast<PointerType>(Ty));
750 case ValID::ConstUndefVal: // Is it an undef value?
751 return UndefValue::get(Ty);
753 case ValID::ConstZeroVal: // Is it a zero value?
754 return Constant::getNullValue(Ty);
756 case ValID::ConstantVal: // Fully resolved constant?
757 if (D.ConstantValue->getType() != Ty) {
758 GenerateError("Constant expression type different from required type");
761 return D.ConstantValue;
763 case ValID::InlineAsmVal: { // Inline asm expression
764 const PointerType *PTy = dyn_cast<PointerType>(Ty);
765 const FunctionType *FTy =
766 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
767 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
768 GenerateError("Invalid type for asm constraint string");
771 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
772 D.IAD->HasSideEffects);
773 D.destroy(); // Free InlineAsmDescriptor.
777 assert(0 && "Unhandled case!");
781 assert(0 && "Unhandled case!");
785 // getVal - This function is identical to getExistingVal, except that if a
786 // value is not already defined, it "improvises" by creating a placeholder var
787 // that looks and acts just like the requested variable. When the value is
788 // defined later, all uses of the placeholder variable are replaced with the
791 static Value *getVal(const Type *Ty, const ValID &ID) {
792 if (Ty == Type::LabelTy) {
793 GenerateError("Cannot use a basic block here");
797 // See if the value has already been defined.
798 Value *V = getExistingVal(Ty, ID);
800 if (TriggerError) return 0;
802 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
803 GenerateError("Invalid use of a composite type");
807 // If we reached here, we referenced either a symbol that we don't know about
808 // or an id number that hasn't been read yet. We may be referencing something
809 // forward, so just create an entry to be resolved later and get to it...
811 V = new Argument(Ty);
813 // Remember where this forward reference came from. FIXME, shouldn't we try
814 // to recycle these things??
815 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
818 if (inFunctionScope())
819 InsertValue(V, CurFun.LateResolveValues);
821 InsertValue(V, CurModule.LateResolveValues);
825 /// defineBBVal - This is a definition of a new basic block with the specified
826 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
827 static BasicBlock *defineBBVal(const ValID &ID) {
828 assert(inFunctionScope() && "Can't get basic block at global scope!");
832 // First, see if this was forward referenced
834 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
835 if (BBI != CurFun.BBForwardRefs.end()) {
837 // The forward declaration could have been inserted anywhere in the
838 // function: insert it into the correct place now.
839 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
840 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
842 // We're about to erase the entry, save the key so we can clean it up.
843 ValID Tmp = BBI->first;
845 // Erase the forward ref from the map as its no longer "forward"
846 CurFun.BBForwardRefs.erase(ID);
848 // The key has been removed from the map but so we don't want to leave
849 // strdup'd memory around so destroy it too.
852 // If its a numbered definition, bump the number and set the BB value.
853 if (ID.Type == ValID::LocalID) {
854 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
862 // We haven't seen this BB before and its first mention is a definition.
863 // Just create it and return it.
864 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
865 BB = new BasicBlock(Name, CurFun.CurrentFunction);
866 if (ID.Type == ValID::LocalID) {
867 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
871 ID.destroy(); // Free strdup'd memory
875 /// getBBVal - get an existing BB value or create a forward reference for it.
877 static BasicBlock *getBBVal(const ValID &ID) {
878 assert(inFunctionScope() && "Can't get basic block at global scope!");
882 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
883 if (BBI != CurFun.BBForwardRefs.end()) {
885 } if (ID.Type == ValID::LocalName) {
886 std::string Name = ID.Name;
887 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
889 if (N->getType()->getTypeID() == Type::LabelTyID)
890 BB = cast<BasicBlock>(N);
892 GenerateError("Reference to label '" + Name + "' is actually of type '"+
893 N->getType()->getDescription() + "'");
894 } else if (ID.Type == ValID::LocalID) {
895 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
896 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
897 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
899 GenerateError("Reference to label '%" + utostr(ID.Num) +
900 "' is actually of type '"+
901 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
904 GenerateError("Illegal label reference " + ID.getName());
908 // If its already been defined, return it now.
910 ID.destroy(); // Free strdup'd memory.
914 // Otherwise, this block has not been seen before, create it.
916 if (ID.Type == ValID::LocalName)
918 BB = new BasicBlock(Name, CurFun.CurrentFunction);
920 // Insert it in the forward refs map.
921 CurFun.BBForwardRefs[ID] = BB;
927 //===----------------------------------------------------------------------===//
928 // Code to handle forward references in instructions
929 //===----------------------------------------------------------------------===//
931 // This code handles the late binding needed with statements that reference
932 // values not defined yet... for example, a forward branch, or the PHI node for
935 // This keeps a table (CurFun.LateResolveValues) of all such forward references
936 // and back patchs after we are done.
939 // ResolveDefinitions - If we could not resolve some defs at parsing
940 // time (forward branches, phi functions for loops, etc...) resolve the
944 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
945 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
946 while (!LateResolvers.empty()) {
947 Value *V = LateResolvers.back();
948 LateResolvers.pop_back();
950 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
951 CurModule.PlaceHolderInfo.find(V);
952 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
954 ValID &DID = PHI->second.first;
956 Value *TheRealValue = getExistingVal(V->getType(), DID);
960 V->replaceAllUsesWith(TheRealValue);
962 CurModule.PlaceHolderInfo.erase(PHI);
963 } else if (FutureLateResolvers) {
964 // Functions have their unresolved items forwarded to the module late
966 InsertValue(V, *FutureLateResolvers);
968 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
969 GenerateError("Reference to an invalid definition: '" +DID.getName()+
970 "' of type '" + V->getType()->getDescription() + "'",
974 GenerateError("Reference to an invalid definition: #" +
975 itostr(DID.Num) + " of type '" +
976 V->getType()->getDescription() + "'",
982 LateResolvers.clear();
985 // ResolveTypeTo - A brand new type was just declared. This means that (if
986 // name is not null) things referencing Name can be resolved. Otherwise, things
987 // refering to the number can be resolved. Do this now.
989 static void ResolveTypeTo(char *Name, const Type *ToTy) {
991 if (Name) D = ValID::createLocalName(Name);
992 else D = ValID::createLocalID(CurModule.Types.size());
994 std::map<ValID, PATypeHolder>::iterator I =
995 CurModule.LateResolveTypes.find(D);
996 if (I != CurModule.LateResolveTypes.end()) {
997 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
998 CurModule.LateResolveTypes.erase(I);
1002 // setValueName - Set the specified value to the name given. The name may be
1003 // null potentially, in which case this is a noop. The string passed in is
1004 // assumed to be a malloc'd string buffer, and is free'd by this function.
1006 static void setValueName(Value *V, char *NameStr) {
1007 if (!NameStr) return;
1008 std::string Name(NameStr); // Copy string
1009 free(NameStr); // Free old string
1011 if (V->getType() == Type::VoidTy) {
1012 GenerateError("Can't assign name '" + Name+"' to value with void type");
1016 assert(inFunctionScope() && "Must be in function scope!");
1017 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1018 if (ST.lookup(Name)) {
1019 GenerateError("Redefinition of value '" + Name + "' of type '" +
1020 V->getType()->getDescription() + "'");
1028 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1029 /// this is a declaration, otherwise it is a definition.
1030 static GlobalVariable *
1031 ParseGlobalVariable(char *NameStr,
1032 GlobalValue::LinkageTypes Linkage,
1033 GlobalValue::VisibilityTypes Visibility,
1034 bool isConstantGlobal, const Type *Ty,
1035 Constant *Initializer) {
1036 if (isa<FunctionType>(Ty)) {
1037 GenerateError("Cannot declare global vars of function type");
1041 const PointerType *PTy = PointerType::get(Ty);
1045 Name = NameStr; // Copy string
1046 free(NameStr); // Free old string
1049 // See if this global value was forward referenced. If so, recycle the
1052 if (!Name.empty()) {
1053 ID = ValID::createGlobalName((char*)Name.c_str());
1055 ID = ValID::createGlobalID(CurModule.Values.size());
1058 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1059 // Move the global to the end of the list, from whereever it was
1060 // previously inserted.
1061 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1062 CurModule.CurrentModule->getGlobalList().remove(GV);
1063 CurModule.CurrentModule->getGlobalList().push_back(GV);
1064 GV->setInitializer(Initializer);
1065 GV->setLinkage(Linkage);
1066 GV->setVisibility(Visibility);
1067 GV->setConstant(isConstantGlobal);
1068 InsertValue(GV, CurModule.Values);
1072 // If this global has a name
1073 if (!Name.empty()) {
1074 // if the global we're parsing has an initializer (is a definition) and
1075 // has external linkage.
1076 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1077 // If there is already a global with external linkage with this name
1078 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1079 // If we allow this GVar to get created, it will be renamed in the
1080 // symbol table because it conflicts with an existing GVar. We can't
1081 // allow redefinition of GVars whose linking indicates that their name
1082 // must stay the same. Issue the error.
1083 GenerateError("Redefinition of global variable named '" + Name +
1084 "' of type '" + Ty->getDescription() + "'");
1089 // Otherwise there is no existing GV to use, create one now.
1090 GlobalVariable *GV =
1091 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1092 CurModule.CurrentModule);
1093 GV->setVisibility(Visibility);
1094 InsertValue(GV, CurModule.Values);
1098 // setTypeName - Set the specified type to the name given. The name may be
1099 // null potentially, in which case this is a noop. The string passed in is
1100 // assumed to be a malloc'd string buffer, and is freed by this function.
1102 // This function returns true if the type has already been defined, but is
1103 // allowed to be redefined in the specified context. If the name is a new name
1104 // for the type plane, it is inserted and false is returned.
1105 static bool setTypeName(const Type *T, char *NameStr) {
1106 assert(!inFunctionScope() && "Can't give types function-local names!");
1107 if (NameStr == 0) return false;
1109 std::string Name(NameStr); // Copy string
1110 free(NameStr); // Free old string
1112 // We don't allow assigning names to void type
1113 if (T == Type::VoidTy) {
1114 GenerateError("Can't assign name '" + Name + "' to the void type");
1118 // Set the type name, checking for conflicts as we do so.
1119 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1121 if (AlreadyExists) { // Inserting a name that is already defined???
1122 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1123 assert(Existing && "Conflict but no matching type?!");
1125 // There is only one case where this is allowed: when we are refining an
1126 // opaque type. In this case, Existing will be an opaque type.
1127 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1128 // We ARE replacing an opaque type!
1129 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1133 // Otherwise, this is an attempt to redefine a type. That's okay if
1134 // the redefinition is identical to the original. This will be so if
1135 // Existing and T point to the same Type object. In this one case we
1136 // allow the equivalent redefinition.
1137 if (Existing == T) return true; // Yes, it's equal.
1139 // Any other kind of (non-equivalent) redefinition is an error.
1140 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1141 T->getDescription() + "'");
1147 //===----------------------------------------------------------------------===//
1148 // Code for handling upreferences in type names...
1151 // TypeContains - Returns true if Ty directly contains E in it.
1153 static bool TypeContains(const Type *Ty, const Type *E) {
1154 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1155 E) != Ty->subtype_end();
1159 struct UpRefRecord {
1160 // NestingLevel - The number of nesting levels that need to be popped before
1161 // this type is resolved.
1162 unsigned NestingLevel;
1164 // LastContainedTy - This is the type at the current binding level for the
1165 // type. Every time we reduce the nesting level, this gets updated.
1166 const Type *LastContainedTy;
1168 // UpRefTy - This is the actual opaque type that the upreference is
1169 // represented with.
1170 OpaqueType *UpRefTy;
1172 UpRefRecord(unsigned NL, OpaqueType *URTy)
1173 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1177 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1178 static std::vector<UpRefRecord> UpRefs;
1180 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1181 /// called. It loops through the UpRefs vector, which is a list of the
1182 /// currently active types. For each type, if the up reference is contained in
1183 /// the newly completed type, we decrement the level count. When the level
1184 /// count reaches zero, the upreferenced type is the type that is passed in:
1185 /// thus we can complete the cycle.
1187 static PATypeHolder HandleUpRefs(const Type *ty) {
1188 // If Ty isn't abstract, or if there are no up-references in it, then there is
1189 // nothing to resolve here.
1190 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1192 PATypeHolder Ty(ty);
1193 UR_OUT("Type '" << Ty->getDescription() <<
1194 "' newly formed. Resolving upreferences.\n" <<
1195 UpRefs.size() << " upreferences active!\n");
1197 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1198 // to zero), we resolve them all together before we resolve them to Ty. At
1199 // the end of the loop, if there is anything to resolve to Ty, it will be in
1201 OpaqueType *TypeToResolve = 0;
1203 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1204 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1205 << UpRefs[i].second->getDescription() << ") = "
1206 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1207 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1208 // Decrement level of upreference
1209 unsigned Level = --UpRefs[i].NestingLevel;
1210 UpRefs[i].LastContainedTy = Ty;
1211 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1212 if (Level == 0) { // Upreference should be resolved!
1213 if (!TypeToResolve) {
1214 TypeToResolve = UpRefs[i].UpRefTy;
1216 UR_OUT(" * Resolving upreference for "
1217 << UpRefs[i].second->getDescription() << "\n";
1218 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1219 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1220 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1221 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1223 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1224 --i; // Do not skip the next element...
1229 if (TypeToResolve) {
1230 UR_OUT(" * Resolving upreference for "
1231 << UpRefs[i].second->getDescription() << "\n";
1232 std::string OldName = TypeToResolve->getDescription());
1233 TypeToResolve->refineAbstractTypeTo(Ty);
1239 //===----------------------------------------------------------------------===//
1240 // RunVMAsmParser - Define an interface to this parser
1241 //===----------------------------------------------------------------------===//
1243 static Module* RunParser(Module * M);
1245 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1248 CurFilename = Filename;
1249 return RunParser(new Module(CurFilename));
1252 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1253 set_scan_string(AsmString);
1255 CurFilename = "from_memory";
1257 return RunParser(new Module (CurFilename));
1259 return RunParser(M);
1265 /* Enabling traces. */
1270 /* Enabling verbose error messages. */
1271 #ifdef YYERROR_VERBOSE
1272 # undef YYERROR_VERBOSE
1273 # define YYERROR_VERBOSE 1
1275 # define YYERROR_VERBOSE 0
1278 /* Enabling the token table. */
1279 #ifndef YYTOKEN_TABLE
1280 # define YYTOKEN_TABLE 0
1283 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1284 #line 939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1285 typedef union YYSTYPE {
1286 llvm::Module *ModuleVal;
1287 llvm::Function *FunctionVal;
1288 llvm::BasicBlock *BasicBlockVal;
1289 llvm::TerminatorInst *TermInstVal;
1290 llvm::Instruction *InstVal;
1291 llvm::Constant *ConstVal;
1293 const llvm::Type *PrimType;
1294 std::list<llvm::PATypeHolder> *TypeList;
1295 llvm::PATypeHolder *TypeVal;
1296 llvm::Value *ValueVal;
1297 std::vector<llvm::Value*> *ValueList;
1298 llvm::ArgListType *ArgList;
1299 llvm::TypeWithAttrs TypeWithAttrs;
1300 llvm::TypeWithAttrsList *TypeWithAttrsList;
1301 llvm::ValueRefList *ValueRefList;
1303 // Represent the RHS of PHI node
1304 std::list<std::pair<llvm::Value*,
1305 llvm::BasicBlock*> > *PHIList;
1306 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1307 std::vector<llvm::Constant*> *ConstVector;
1309 llvm::GlobalValue::LinkageTypes Linkage;
1310 llvm::GlobalValue::VisibilityTypes Visibility;
1311 llvm::FunctionType::ParameterAttributes ParamAttrs;
1312 llvm::APInt *APIntVal;
1320 char *StrVal; // This memory is strdup'd!
1321 llvm::ValID ValIDVal; // strdup'd memory maybe!
1323 llvm::Instruction::BinaryOps BinaryOpVal;
1324 llvm::Instruction::TermOps TermOpVal;
1325 llvm::Instruction::MemoryOps MemOpVal;
1326 llvm::Instruction::CastOps CastOpVal;
1327 llvm::Instruction::OtherOps OtherOpVal;
1328 llvm::ICmpInst::Predicate IPredicate;
1329 llvm::FCmpInst::Predicate FPredicate;
1331 /* Line 196 of yacc.c. */
1332 #line 1333 "llvmAsmParser.tab.c"
1333 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1334 # define YYSTYPE_IS_DECLARED 1
1335 # define YYSTYPE_IS_TRIVIAL 1
1340 /* Copy the second part of user declarations. */
1343 /* Line 219 of yacc.c. */
1344 #line 1345 "llvmAsmParser.tab.c"
1346 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1347 # define YYSIZE_T __SIZE_TYPE__
1349 #if ! defined (YYSIZE_T) && defined (size_t)
1350 # define YYSIZE_T size_t
1352 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1353 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1354 # define YYSIZE_T size_t
1356 #if ! defined (YYSIZE_T)
1357 # define YYSIZE_T unsigned int
1363 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1364 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1368 # define YY_(msgid) msgid
1372 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1374 /* The parser invokes alloca or malloc; define the necessary symbols. */
1376 # ifdef YYSTACK_USE_ALLOCA
1377 # if YYSTACK_USE_ALLOCA
1379 # define YYSTACK_ALLOC __builtin_alloca
1381 # define YYSTACK_ALLOC alloca
1382 # if defined (__STDC__) || defined (__cplusplus)
1383 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1384 # define YYINCLUDED_STDLIB_H
1390 # ifdef YYSTACK_ALLOC
1391 /* Pacify GCC's `empty if-body' warning. */
1392 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1393 # ifndef YYSTACK_ALLOC_MAXIMUM
1394 /* The OS might guarantee only one guard page at the bottom of the stack,
1395 and a page size can be as small as 4096 bytes. So we cannot safely
1396 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1397 to allow for a few compiler-allocated temporary stack slots. */
1398 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1401 # define YYSTACK_ALLOC YYMALLOC
1402 # define YYSTACK_FREE YYFREE
1403 # ifndef YYSTACK_ALLOC_MAXIMUM
1404 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1410 # define YYMALLOC malloc
1411 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1412 && (defined (__STDC__) || defined (__cplusplus)))
1413 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1417 # define YYFREE free
1418 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1419 && (defined (__STDC__) || defined (__cplusplus)))
1420 void free (void *); /* INFRINGES ON USER NAME SPACE */
1427 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1430 #if (! defined (yyoverflow) \
1431 && (! defined (__cplusplus) \
1432 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1434 /* A type that is properly aligned for any stack member. */
1441 /* The size of the maximum gap between one aligned stack and the next. */
1442 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1444 /* The size of an array large to enough to hold all stacks, each with
1446 # define YYSTACK_BYTES(N) \
1447 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1448 + YYSTACK_GAP_MAXIMUM)
1450 /* Copy COUNT objects from FROM to TO. The source and destination do
1453 # if defined (__GNUC__) && 1 < __GNUC__
1454 # define YYCOPY(To, From, Count) \
1455 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1457 # define YYCOPY(To, From, Count) \
1461 for (yyi = 0; yyi < (Count); yyi++) \
1462 (To)[yyi] = (From)[yyi]; \
1468 /* Relocate STACK from its old location to the new one. The
1469 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1470 elements in the stack, and YYPTR gives the new location of the
1471 stack. Advance YYPTR to a properly aligned location for the next
1473 # define YYSTACK_RELOCATE(Stack) \
1476 YYSIZE_T yynewbytes; \
1477 YYCOPY (&yyptr->Stack, Stack, yysize); \
1478 Stack = &yyptr->Stack; \
1479 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1480 yyptr += yynewbytes / sizeof (*yyptr); \
1486 #if defined (__STDC__) || defined (__cplusplus)
1487 typedef signed char yysigned_char;
1489 typedef short int yysigned_char;
1492 /* YYFINAL -- State number of the termination state. */
1494 /* YYLAST -- Last index in YYTABLE. */
1497 /* YYNTOKENS -- Number of terminals. */
1498 #define YYNTOKENS 149
1499 /* YYNNTS -- Number of nonterminals. */
1501 /* YYNRULES -- Number of rules. */
1502 #define YYNRULES 287
1503 /* YYNRULES -- Number of states. */
1504 #define YYNSTATES 560
1506 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1507 #define YYUNDEFTOK 2
1508 #define YYMAXUTOK 389
1510 #define YYTRANSLATE(YYX) \
1511 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1513 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1514 static const unsigned char yytranslate[] =
1516 0, 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 139, 140, 137, 2, 136, 2, 2, 2, 2, 2,
1521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1522 144, 135, 145, 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, 141, 138, 143, 2, 2, 2, 2, 2, 148,
1526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1528 142, 2, 2, 146, 2, 147, 2, 2, 2, 2,
1529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1541 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1542 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1543 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1544 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1545 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1546 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1547 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1548 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1549 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1550 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1551 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1552 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1553 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1554 125, 126, 127, 128, 129, 130, 131, 132, 133, 134
1558 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1560 static const unsigned short int yyprhs[] =
1562 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1563 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1564 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1565 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1566 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1567 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1568 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1569 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1570 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1571 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1572 195, 197, 199, 200, 203, 204, 207, 208, 212, 215,
1573 216, 218, 219, 223, 225, 228, 230, 232, 234, 236,
1574 238, 240, 243, 245, 248, 254, 260, 266, 272, 276,
1575 279, 285, 290, 293, 295, 297, 299, 303, 305, 309,
1576 311, 312, 314, 318, 323, 327, 331, 336, 341, 345,
1577 352, 358, 361, 364, 367, 370, 373, 376, 379, 382,
1578 385, 388, 391, 394, 401, 407, 416, 423, 430, 438,
1579 446, 453, 462, 471, 475, 477, 479, 481, 483, 484,
1580 486, 489, 490, 494, 495, 499, 503, 505, 509, 513,
1581 514, 521, 522, 530, 531, 539, 542, 546, 548, 552,
1582 556, 560, 564, 566, 567, 573, 577, 579, 583, 585,
1583 586, 596, 598, 600, 605, 607, 609, 612, 616, 617,
1584 619, 621, 623, 625, 627, 629, 631, 633, 635, 639,
1585 641, 647, 649, 651, 653, 655, 657, 659, 662, 665,
1586 668, 672, 675, 676, 678, 681, 684, 688, 698, 708,
1587 717, 732, 734, 736, 743, 749, 752, 759, 767, 771,
1588 777, 778, 779, 783, 786, 788, 794, 800, 807, 814,
1589 819, 826, 831, 836, 843, 850, 853, 862, 864, 866,
1590 867, 871, 878, 882, 889, 892, 897, 904
1593 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1594 static const short int yyrhs[] =
1596 189, 0, -1, 68, -1, 69, -1, 70, -1, 71,
1597 -1, 72, -1, 73, -1, 74, -1, 75, -1, 76,
1598 -1, 80, -1, 81, -1, 82, -1, 77, -1, 78,
1599 -1, 79, -1, 111, -1, 112, -1, 113, -1, 114,
1600 -1, 115, -1, 116, -1, 117, -1, 118, -1, 119,
1601 -1, 120, -1, 121, -1, 122, -1, 85, -1, 86,
1602 -1, 87, -1, 88, -1, 89, -1, 90, -1, 91,
1603 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1604 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1605 -1, 102, -1, 103, -1, 104, -1, 91, -1, 92,
1606 -1, 93, -1, 94, -1, 23, -1, 24, -1, 11,
1607 -1, 12, -1, 13, -1, 16, -1, 19, -1, 157,
1608 -1, -1, 157, 135, -1, -1, 17, -1, 20, -1,
1609 160, 135, -1, -1, 37, -1, 39, -1, 38, -1,
1610 40, -1, 42, -1, 41, -1, 43, -1, 45, -1,
1611 -1, 134, -1, -1, 41, -1, 43, -1, -1, 37,
1612 -1, 38, -1, 39, -1, 42, -1, -1, 56, -1,
1613 57, -1, 58, -1, 59, -1, 60, -1, 55, 4,
1614 -1, 112, -1, 113, -1, 130, -1, 131, -1, -1,
1615 169, 168, -1, 129, -1, 132, -1, 168, -1, -1,
1616 171, 170, -1, -1, 48, 4, -1, -1, 136, 48,
1617 4, -1, 31, 19, -1, -1, 174, -1, -1, 136,
1618 177, 176, -1, 174, -1, 48, 4, -1, 11, -1,
1619 12, -1, 13, -1, 14, -1, 44, -1, 178, -1,
1620 179, 137, -1, 211, -1, 138, 4, -1, 179, 139,
1621 183, 140, 171, -1, 10, 139, 183, 140, 171, -1,
1622 141, 4, 142, 179, 143, -1, 144, 4, 142, 179,
1623 145, -1, 146, 184, 147, -1, 146, 147, -1, 144,
1624 146, 184, 147, 145, -1, 144, 146, 147, 145, -1,
1625 179, 169, -1, 179, -1, 10, -1, 180, -1, 182,
1626 136, 180, -1, 182, -1, 182, 136, 34, -1, 34,
1627 -1, -1, 179, -1, 184, 136, 179, -1, 179, 141,
1628 187, 143, -1, 179, 141, 143, -1, 179, 148, 19,
1629 -1, 179, 144, 187, 145, -1, 179, 146, 187, 147,
1630 -1, 179, 146, 147, -1, 179, 144, 146, 187, 147,
1631 145, -1, 179, 144, 146, 147, 145, -1, 179, 35,
1632 -1, 179, 36, -1, 179, 211, -1, 179, 186, -1,
1633 179, 22, -1, 155, 3, -1, 155, 5, -1, 155,
1634 4, -1, 155, 6, -1, 11, 23, -1, 11, 24,
1635 -1, 156, 9, -1, 152, 139, 185, 33, 179, 140,
1636 -1, 110, 139, 185, 222, 140, -1, 124, 139, 185,
1637 136, 185, 136, 185, 140, -1, 150, 139, 185, 136,
1638 185, 140, -1, 151, 139, 185, 136, 185, 140, -1,
1639 83, 153, 139, 185, 136, 185, 140, -1, 84, 154,
1640 139, 185, 136, 185, 140, -1, 126, 139, 185, 136,
1641 185, 140, -1, 127, 139, 185, 136, 185, 136, 185,
1642 140, -1, 128, 139, 185, 136, 185, 136, 185, 140,
1643 -1, 187, 136, 185, -1, 185, -1, 29, -1, 30,
1644 -1, 190, -1, -1, 191, -1, 190, 191, -1, -1,
1645 28, 192, 207, -1, -1, 27, 193, 208, -1, 53,
1646 52, 197, -1, 21, -1, 159, 15, 179, -1, 159,
1647 15, 10, -1, -1, 161, 164, 188, 185, 194, 176,
1648 -1, -1, 161, 162, 164, 188, 185, 195, 176, -1,
1649 -1, 161, 163, 164, 188, 179, 196, 176, -1, 46,
1650 198, -1, 49, 135, 199, -1, 19, -1, 47, 135,
1651 19, -1, 61, 135, 19, -1, 141, 200, 143, -1,
1652 200, 136, 19, -1, 19, -1, -1, 201, 136, 179,
1653 169, 158, -1, 179, 169, 158, -1, 201, -1, 201,
1654 136, 34, -1, 34, -1, -1, 167, 181, 160, 139,
1655 202, 140, 171, 175, 172, -1, 25, -1, 146, -1,
1656 166, 164, 203, 204, -1, 26, -1, 147, -1, 214,
1657 206, -1, 165, 164, 203, -1, -1, 54, -1, 3,
1658 -1, 4, -1, 9, -1, 23, -1, 24, -1, 35,
1659 -1, 36, -1, 22, -1, 144, 187, 145, -1, 186,
1660 -1, 52, 209, 19, 136, 19, -1, 7, -1, 8,
1661 -1, 157, -1, 160, -1, 211, -1, 210, -1, 179,
1662 212, -1, 214, 215, -1, 205, 215, -1, 216, 159,
1663 217, -1, 216, 219, -1, -1, 18, -1, 62, 213,
1664 -1, 62, 10, -1, 63, 14, 212, -1, 63, 11,
1665 212, 136, 14, 212, 136, 14, 212, -1, 64, 155,
1666 212, 136, 14, 212, 141, 218, 143, -1, 64, 155,
1667 212, 136, 14, 212, 141, 143, -1, 65, 167, 181,
1668 212, 139, 221, 140, 171, 33, 14, 212, 66, 14,
1669 212, -1, 66, -1, 67, -1, 218, 155, 210, 136,
1670 14, 212, -1, 155, 210, 136, 14, 212, -1, 159,
1671 224, -1, 179, 141, 212, 136, 212, 143, -1, 220,
1672 136, 141, 212, 136, 212, 143, -1, 179, 212, 169,
1673 -1, 221, 136, 179, 212, 169, -1, -1, -1, 222,
1674 136, 213, -1, 51, 50, -1, 50, -1, 150, 179,
1675 212, 136, 212, -1, 151, 179, 212, 136, 212, -1,
1676 83, 153, 179, 212, 136, 212, -1, 84, 154, 179,
1677 212, 136, 212, -1, 152, 213, 33, 179, -1, 124,
1678 213, 136, 213, 136, 213, -1, 125, 213, 136, 179,
1679 -1, 126, 213, 136, 213, -1, 127, 213, 136, 213,
1680 136, 213, -1, 128, 213, 136, 213, 136, 213, -1,
1681 123, 220, -1, 223, 167, 181, 212, 139, 221, 140,
1682 171, -1, 226, -1, 32, -1, -1, 105, 179, 173,
1683 -1, 105, 179, 136, 11, 212, 173, -1, 106, 179,
1684 173, -1, 106, 179, 136, 11, 212, 173, -1, 107,
1685 213, -1, 225, 108, 179, 212, -1, 225, 109, 213,
1686 136, 179, 212, -1, 110, 179, 212, 222, -1
1689 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1690 static const unsigned short int yyrline[] =
1692 0, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
1693 1093, 1094, 1094, 1094, 1094, 1094, 1094, 1095, 1095, 1095,
1694 1095, 1095, 1095, 1096, 1096, 1096, 1096, 1096, 1096, 1099,
1695 1099, 1100, 1100, 1101, 1101, 1102, 1102, 1103, 1103, 1107,
1696 1107, 1108, 1108, 1109, 1109, 1110, 1110, 1111, 1111, 1112,
1697 1112, 1113, 1113, 1114, 1115, 1120, 1121, 1121, 1123, 1123,
1698 1124, 1124, 1128, 1132, 1137, 1137, 1139, 1143, 1149, 1150,
1699 1151, 1152, 1153, 1157, 1158, 1159, 1163, 1164, 1168, 1169,
1700 1170, 1174, 1175, 1176, 1177, 1178, 1181, 1182, 1183, 1184,
1701 1185, 1186, 1187, 1194, 1195, 1196, 1197, 1200, 1201, 1206,
1702 1207, 1208, 1211, 1212, 1219, 1220, 1226, 1227, 1235, 1243,
1703 1244, 1249, 1250, 1251, 1256, 1269, 1269, 1269, 1269, 1272,
1704 1276, 1280, 1287, 1292, 1300, 1319, 1338, 1343, 1355, 1365,
1705 1369, 1379, 1386, 1393, 1400, 1405, 1410, 1417, 1418, 1425,
1706 1432, 1440, 1446, 1458, 1486, 1502, 1531, 1559, 1584, 1603,
1707 1629, 1649, 1661, 1668, 1734, 1744, 1754, 1760, 1770, 1776,
1708 1786, 1791, 1796, 1804, 1816, 1838, 1846, 1852, 1863, 1868,
1709 1873, 1879, 1885, 1894, 1898, 1906, 1906, 1917, 1922, 1930,
1710 1931, 1935, 1935, 1939, 1939, 1942, 1945, 1957, 1981, 1992,
1711 1992, 2002, 2002, 2010, 2010, 2020, 2023, 2029, 2042, 2046,
1712 2051, 2053, 2058, 2063, 2072, 2082, 2093, 2097, 2106, 2115,
1713 2120, 2232, 2232, 2234, 2243, 2243, 2245, 2250, 2262, 2266,
1714 2271, 2275, 2279, 2283, 2287, 2291, 2295, 2299, 2303, 2328,
1715 2332, 2346, 2350, 2354, 2358, 2364, 2364, 2370, 2379, 2383,
1716 2392, 2401, 2410, 2414, 2419, 2423, 2427, 2432, 2442, 2461,
1717 2470, 2539, 2543, 2550, 2561, 2574, 2584, 2595, 2605, 2614,
1718 2623, 2626, 2627, 2634, 2638, 2643, 2664, 2681, 2695, 2709,
1719 2721, 2729, 2736, 2742, 2748, 2754, 2769, 2833, 2838, 2842,
1720 2849, 2856, 2864, 2871, 2879, 2887, 2901, 2918
1724 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1725 /* YYTNAME[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", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1732 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1733 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1734 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1735 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1736 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1737 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1738 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1739 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1740 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1741 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1742 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1743 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1744 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1745 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1746 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1747 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1748 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET",
1749 "NOUNWIND", "DEFAULT", "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('",
1750 "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept",
1751 "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", "FPredicates",
1752 "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign",
1753 "GlobalName", "OptGlobalAssign", "GVInternalLinkage",
1754 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1755 "FunctionDefineLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1756 "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString",
1757 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1758 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1759 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1760 "Module", "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5",
1761 "AsmBlock", "TargetDefinition", "LibrariesDefinition", "LibList",
1762 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1763 "END", "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1764 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1765 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1766 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1767 "OptVolatile", "MemoryInst", 0
1772 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1774 static const unsigned short int yytoknum[] =
1776 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1777 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1778 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1779 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1780 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1781 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1782 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1783 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1784 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1785 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1786 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1787 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1788 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1789 385, 386, 387, 388, 389, 61, 44, 42, 92, 40,
1790 41, 91, 120, 93, 60, 62, 123, 125, 99
1794 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1795 static const unsigned char yyr1[] =
1797 0, 149, 150, 150, 150, 150, 150, 150, 150, 150,
1798 150, 151, 151, 151, 151, 151, 151, 152, 152, 152,
1799 152, 152, 152, 152, 152, 152, 152, 152, 152, 153,
1800 153, 153, 153, 153, 153, 153, 153, 153, 153, 154,
1801 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
1802 154, 154, 154, 154, 154, 155, 156, 156, 157, 157,
1803 158, 158, 159, 159, 160, 160, 161, 161, 162, 162,
1804 162, 162, 162, 163, 163, 163, 164, 164, 165, 165,
1805 165, 166, 166, 166, 166, 166, 167, 167, 167, 167,
1806 167, 167, 167, 168, 168, 168, 168, 169, 169, 170,
1807 170, 170, 171, 171, 172, 172, 173, 173, 174, 175,
1808 175, 176, 176, 177, 177, 178, 178, 178, 178, 179,
1809 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
1810 179, 179, 180, 181, 181, 182, 182, 183, 183, 183,
1811 183, 184, 184, 185, 185, 185, 185, 185, 185, 185,
1812 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
1813 185, 185, 185, 186, 186, 186, 186, 186, 186, 186,
1814 186, 186, 186, 187, 187, 188, 188, 189, 189, 190,
1815 190, 192, 191, 193, 191, 191, 191, 191, 191, 194,
1816 191, 195, 191, 196, 191, 191, 191, 197, 198, 198,
1817 199, 200, 200, 200, 201, 201, 202, 202, 202, 202,
1818 203, 204, 204, 205, 206, 206, 207, 208, 209, 209,
1819 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1820 210, 211, 211, 211, 211, 212, 212, 213, 214, 214,
1821 215, 216, 216, 216, 217, 217, 217, 217, 217, 217,
1822 217, 217, 217, 218, 218, 219, 220, 220, 221, 221,
1823 221, 222, 222, 223, 223, 224, 224, 224, 224, 224,
1824 224, 224, 224, 224, 224, 224, 224, 224, 225, 225,
1825 226, 226, 226, 226, 226, 226, 226, 226
1828 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1829 static const unsigned char yyr2[] =
1831 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1832 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1833 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1834 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1835 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1836 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1837 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1838 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1839 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1840 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1841 1, 1, 0, 2, 0, 2, 0, 3, 2, 0,
1842 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1843 1, 2, 1, 2, 5, 5, 5, 5, 3, 2,
1844 5, 4, 2, 1, 1, 1, 3, 1, 3, 1,
1845 0, 1, 3, 4, 3, 3, 4, 4, 3, 6,
1846 5, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1847 2, 2, 2, 6, 5, 8, 6, 6, 7, 7,
1848 6, 8, 8, 3, 1, 1, 1, 1, 0, 1,
1849 2, 0, 3, 0, 3, 3, 1, 3, 3, 0,
1850 6, 0, 7, 0, 7, 2, 3, 1, 3, 3,
1851 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
1852 9, 1, 1, 4, 1, 1, 2, 3, 0, 1,
1853 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1854 5, 1, 1, 1, 1, 1, 1, 2, 2, 2,
1855 3, 2, 0, 1, 2, 2, 3, 9, 9, 8,
1856 14, 1, 1, 6, 5, 2, 6, 7, 3, 5,
1857 0, 0, 3, 2, 1, 5, 5, 6, 6, 4,
1858 6, 4, 4, 6, 6, 2, 8, 1, 1, 0,
1859 3, 6, 3, 6, 2, 4, 6, 4
1862 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1863 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1864 means the default is an error. */
1865 static const unsigned short int yydefact[] =
1867 67, 58, 64, 59, 65, 186, 183, 181, 0, 0,
1868 0, 0, 0, 0, 76, 0, 67, 179, 78, 81,
1869 0, 0, 195, 0, 0, 62, 0, 66, 68, 70,
1870 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
1871 1, 180, 79, 80, 76, 184, 82, 83, 84, 85,
1872 76, 242, 182, 242, 0, 0, 203, 196, 197, 185,
1873 231, 232, 188, 115, 116, 117, 118, 119, 0, 0,
1874 0, 0, 233, 234, 120, 187, 122, 0, 0, 175,
1875 176, 0, 86, 86, 243, 239, 63, 214, 215, 216,
1876 238, 198, 199, 202, 0, 140, 123, 0, 0, 0,
1877 0, 129, 141, 0, 121, 140, 0, 0, 115, 116,
1878 117, 0, 0, 0, 189, 0, 87, 88, 89, 90,
1879 91, 0, 217, 0, 279, 241, 0, 200, 139, 97,
1880 135, 137, 0, 0, 0, 0, 0, 0, 128, 0,
1881 191, 193, 160, 161, 156, 158, 157, 159, 162, 155,
1882 151, 152, 2, 3, 4, 5, 6, 7, 8, 9,
1883 10, 14, 15, 16, 11, 12, 13, 0, 0, 0,
1884 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1885 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
1886 0, 0, 0, 154, 153, 111, 92, 134, 133, 0,
1887 211, 212, 213, 278, 264, 0, 0, 0, 0, 86,
1888 251, 252, 0, 0, 0, 0, 0, 0, 0, 0,
1889 0, 0, 0, 0, 0, 0, 0, 240, 86, 255,
1890 0, 277, 201, 132, 0, 102, 0, 0, 131, 0,
1891 142, 102, 111, 111, 29, 30, 31, 32, 33, 34,
1892 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
1893 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1894 48, 0, 0, 0, 0, 0, 0, 144, 174, 0,
1895 0, 0, 148, 0, 145, 0, 0, 0, 0, 190,
1896 0, 263, 245, 0, 244, 0, 0, 55, 0, 0,
1897 0, 0, 106, 106, 284, 0, 0, 275, 0, 0,
1898 0, 0, 0, 0, 0, 0, 0, 0, 0, 93,
1899 94, 95, 96, 98, 138, 136, 125, 126, 127, 130,
1900 124, 192, 194, 0, 0, 261, 0, 0, 0, 0,
1901 0, 143, 129, 141, 0, 146, 147, 0, 0, 0,
1902 0, 0, 113, 111, 209, 220, 221, 222, 227, 223,
1903 224, 225, 226, 218, 0, 229, 236, 235, 237, 0,
1904 246, 0, 0, 0, 0, 0, 280, 0, 282, 261,
1905 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1906 0, 0, 0, 99, 100, 101, 103, 0, 0, 0,
1907 0, 0, 0, 0, 173, 150, 0, 0, 0, 0,
1908 108, 114, 112, 208, 97, 206, 0, 219, 0, 0,
1909 0, 0, 0, 0, 0, 0, 0, 0, 287, 0,
1910 0, 0, 271, 272, 0, 0, 0, 0, 269, 0,
1911 285, 0, 0, 0, 0, 164, 0, 0, 0, 0,
1912 149, 0, 0, 0, 61, 0, 102, 0, 228, 0,
1913 0, 260, 0, 0, 106, 107, 106, 0, 0, 0,
1914 0, 0, 265, 266, 260, 0, 0, 0, 262, 0,
1915 170, 0, 0, 166, 167, 163, 60, 205, 207, 97,
1916 109, 0, 0, 0, 0, 0, 267, 268, 0, 281,
1917 283, 0, 0, 270, 273, 274, 0, 286, 168, 169,
1918 0, 0, 0, 61, 110, 104, 230, 0, 0, 97,
1919 0, 102, 256, 0, 102, 165, 171, 172, 204, 0,
1920 210, 0, 249, 0, 0, 258, 0, 0, 257, 276,
1921 105, 247, 0, 248, 0, 97, 0, 0, 0, 259,
1922 0, 0, 0, 0, 254, 0, 0, 253, 0, 250
1925 /* YYDEFGOTO[NTERM-NUM]. */
1926 static const short int yydefgoto[] =
1928 -1, 190, 191, 192, 254, 271, 111, 112, 72, 487,
1929 12, 73, 14, 37, 38, 39, 44, 50, 121, 323,
1930 233, 396, 326, 530, 376, 352, 515, 289, 353, 74,
1931 113, 130, 199, 131, 132, 103, 278, 365, 279, 81,
1932 15, 16, 17, 19, 18, 195, 242, 243, 59, 22,
1933 57, 94, 415, 416, 122, 202, 51, 89, 52, 45,
1934 418, 366, 76, 368, 294, 53, 85, 86, 227, 534,
1935 125, 307, 495, 399, 228, 229, 230, 231
1938 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1940 #define YYPACT_NINF -472
1941 static const short int yypact[] =
1943 44, -472, -472, -472, -472, -472, -472, -472, -9, -93,
1944 25, -40, 89, 40, 303, 124, 406, -472, 137, 199,
1945 48, 73, -472, 72, 147, -472, 1101, -472, -472, -472,
1946 -472, -472, -472, -472, -472, -472, -472, 86, 86, 110,
1947 -472, -472, -472, -472, 86, -472, -472, -472, -472, -472,
1948 86, 215, -472, 9, 216, 228, 233, -472, -472, -472,
1949 -472, -472, 118, -472, -472, -472, -472, -472, 250, 254,
1950 4, 115, -472, -472, -472, 88, -472, 110, 110, -472,
1951 -472, 1115, 310, 310, -472, -472, 31, -472, -472, -472,
1952 -472, -472, -472, -472, -22, 955, -472, 135, 138, 141,
1953 118, -472, 88, -102, -472, 955, 1115, 1153, 52, 251,
1954 269, 239, 272, 739, -472, 280, -472, -472, -472, -472,
1955 -472, 1167, -472, -8, 1306, -472, 270, -472, -472, 88,
1956 -472, 154, 155, 1153, 1153, 156, -55, 1153, -472, 164,
1957 -472, 88, -472, -472, -472, -472, -472, -472, -472, -472,
1958 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
1959 -472, -472, -472, -472, -472, -472, -472, 289, 447, 166,
1960 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
1961 -472, -472, 168, 169, 170, 171, 995, 1206, 491, 292,
1962 174, 175, 176, -472, -472, 182, -472, 118, 88, 49,
1963 -472, -472, -472, -472, -472, 273, 1221, 122, 313, 310,
1964 -472, -472, 289, 447, 1153, 1153, 1153, 1153, 1153, 1153,
1965 1153, 1153, 1153, 1153, 1153, 1153, 1153, -472, 310, -472,
1966 38, -472, -472, -24, 1010, -472, 34, -26, -472, 180,
1967 88, -472, 182, 182, -472, -472, -472, -472, -472, -472,
1968 -472, -472, -472, -472, 187, -472, -472, -472, -472, -472,
1969 -472, -472, -472, -472, -472, -472, -472, -472, -472, -472,
1970 -472, 188, 1115, 1115, 1115, 1115, 1115, -472, -472, -6,
1971 909, -104, -472, -42, -472, 1115, 1115, 1115, -11, -472,
1972 195, -472, 118, 592, -472, 718, 718, -472, 718, 1167,
1973 1153, 1153, -21, 93, -472, 592, 35, 200, 203, 211,
1974 213, 214, 218, 592, 592, 302, 1167, 1153, 1153, -472,
1975 -472, -472, -472, -472, -472, -472, -29, -472, -472, -472,
1976 -29, -472, -472, 1115, 1115, -472, 219, 235, 255, 256,
1977 1115, -472, 207, 739, -37, -472, -472, 258, 261, 354,
1978 371, 395, -472, 182, 1050, -472, -472, -472, -472, -472,
1979 -472, -472, -472, 346, 1115, -472, -472, -472, -472, 266,
1980 -472, 267, 718, 592, 592, 19, -472, 20, -472, -472,
1981 718, 263, 1153, 1153, 1153, 1153, 1153, 271, 274, 1153,
1982 718, 592, 279, -472, -472, -472, -472, 281, 282, 29,
1983 1115, 1115, 1115, 1115, -472, -472, 284, 1115, 1115, 1153,
1984 -472, -472, -472, -472, 88, 288, 268, -472, 412, -96,
1985 418, 421, 299, 304, 305, 718, 435, 718, 306, 307,
1986 718, 311, 88, -472, 312, 314, 718, 718, 88, 317,
1987 -472, 1153, 1115, 1115, 1153, -472, 315, 318, 324, 325,
1988 -472, 323, 326, 157, 32, 1066, -472, 328, -472, 718,
1989 718, 1153, 718, 718, 329, -472, 329, 718, 331, 1153,
1990 1153, 1153, -472, -472, 1153, 592, 335, 338, -472, 1115,
1991 -472, 1115, 1115, -472, -472, -472, -472, -472, -472, 88,
1992 136, 434, 332, 341, 592, 71, -472, -472, 431, -472,
1993 -472, 340, 718, -472, -472, -472, 74, -472, -472, -472,
1994 345, 347, 348, 32, -472, 438, -472, 455, -2, -472,
1995 1153, -472, -472, 349, -472, -472, -472, -472, -472, 485,
1996 -472, 718, -472, 866, -1, -24, 592, 190, -472, -29,
1997 -472, -472, 357, -472, 866, -472, 480, 482, 361, -24,
1998 718, 718, 486, 440, -472, 718, 495, -472, 718, -472
2001 /* YYPGOTO[NTERM-NUM]. */
2002 static const short int yypgoto[] =
2004 -472, 388, 390, 391, 308, 309, -206, -472, 0, 3,
2005 432, 13, -472, -472, -472, 41, -472, -472, -195, -311,
2006 -402, -472, -238, -472, -296, 27, -472, -189, -472, -472,
2007 -25, 285, -273, -472, 416, 424, -70, -109, -182, 173,
2008 -472, -472, 508, -472, -472, -472, -472, -472, -472, -472,
2009 -472, -472, -472, -472, 443, -472, -472, -472, -472, -472,
2010 -472, -471, -74, 100, -198, -472, 475, -472, -472, -472,
2011 -472, -472, 55, 152, -472, -472, -472, -472
2014 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2015 positive, shift that token. If negative, reduce the rule which
2016 number is the opposite. If zero, do what YYDEFACT says.
2017 If YYTABLE_NINF, syntax error. */
2018 #define YYTABLE_NINF -179
2019 static const short int yytable[] =
2021 11, 75, 298, 330, 193, 281, 283, 378, 98, 297,
2022 297, 114, 454, 13, 299, 395, 11, 200, 304, 395,
2023 350, 308, 309, 310, 311, 312, 372, 84, 315, 13,
2024 425, 427, 340, 316, 137, 87, 140, 351, 20, 194,
2025 340, 345, 23, 390, -178, 138, 102, 1, 1, 458,
2026 3, 3, 21, 331, 332, -55, -55, -55, -55, -63,
2027 1, 2, 542, 3, 4, 5, 2, 426, 426, 4,
2028 129, 6, 7, 548, 102, 142, 143, 24, 77, 78,
2029 129, 137, 141, 319, 320, 82, 11, 513, 319, 320,
2030 8, 83, 239, 9, 340, 25, 198, 10, 344, 340,
2031 393, 321, 322, 394, 26, 346, 321, 322, 236, 237,
2032 406, 104, 240, 105, 126, 375, 104, 535, 105, 328,
2033 392, 127, 60, 61, 40, 100, 63, 64, 65, 66,
2034 340, 1, 2, 295, 3, 4, 296, 341, 201, 79,
2035 80, 532, 543, 549, 319, 320, 317, 318, 60, 61,
2036 99, 100, 63, 64, 65, 66, 88, 1, 2, 67,
2037 3, 4, 321, 322, 412, 444, 58, 350, 499, 445,
2038 500, 104, 104, 105, 105, 27, 380, 327, 42, 395,
2039 43, 293, 419, 54, 431, 67, 433, 434, 435, 302,
2040 303, 293, 305, 306, 293, 293, 293, 293, 293, 313,
2041 314, 293, 335, 336, 337, 338, 339, 520, 55, 129,
2042 520, 521, 290, 56, 524, 347, 348, 349, 490, 367,
2043 36, 367, 367, 546, 367, 104, 395, 105, 395, 377,
2044 104, 367, 105, 84, 193, 91, 46, 47, 48, 367,
2045 367, 49, 144, 145, 146, 147, 478, 92, 319, 320,
2046 106, 107, 93, 68, 96, 343, 69, 95, 97, 70,
2047 -56, 71, 101, 397, 398, 393, 321, 322, 394, 194,
2048 404, 503, 504, 505, 198, 373, 374, 133, -57, 68,
2049 134, 148, 69, 537, 196, 70, 539, 71, 135, 232,
2050 234, 198, 391, 293, 104, 235, 105, 485, 367, 367,
2051 367, 238, 319, 320, 241, 272, 367, 273, 274, 275,
2052 276, 284, 533, 285, 286, 287, 367, 367, 288, 393,
2053 321, 322, 394, 291, 297, 329, 333, 334, 544, 414,
2054 446, 447, 448, 449, 354, 389, 381, 451, 452, 382,
2055 28, 29, 30, 31, 32, 33, 34, 383, 35, 384,
2056 385, 367, 405, 367, 386, 400, 367, 293, 432, 293,
2057 293, 293, 367, 367, 438, 115, 116, 117, 118, 119,
2058 120, 401, 476, 477, 244, 245, 246, 247, 248, 249,
2059 250, 251, 252, 253, 453, 367, 367, 409, 367, 367,
2060 410, 402, 403, 367, 407, 369, 370, 408, 371, 411,
2061 417, 367, 420, 421, 430, 379, -177, 436, 456, 510,
2062 437, 511, 512, 387, 388, 441, 475, 442, 443, 293,
2063 367, -63, 1, 2, 455, 3, 4, 5, 367, 450,
2064 489, 457, 459, 6, 7, 460, 494, 36, 461, 465,
2065 462, 463, 444, 467, 293, 293, 293, 469, 470, 494,
2066 471, 479, 8, 516, 486, 9, 474, 367, 480, 10,
2067 481, 482, 367, 483, 491, 498, 484, 502, 517, 531,
2068 255, 256, 422, 423, 424, 508, 367, 367, 509, 426,
2069 429, 367, 518, 522, 367, 525, 529, 526, 527, 540,
2070 439, 440, 538, 547, 550, 536, 551, 552, 60, 61,
2071 555, 100, 108, 109, 110, 66, 556, 1, 2, 558,
2072 3, 4, 224, 486, 225, 226, 528, 514, 124, 325,
2073 300, 139, 301, 136, 41, 464, 123, 466, 90, 506,
2074 468, 428, 0, 0, 0, 67, 472, 473, 257, 258,
2075 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
2076 269, 270, 0, 0, 0, 0, 0, 0, 0, 492,
2077 493, 0, 496, 497, 0, 0, 0, 501, 0, 0,
2078 0, 0, 0, 0, 0, 507, 0, 0, 0, 0,
2079 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2080 0, 0, 0, 0, 519, 355, 356, 0, 0, 60,
2081 61, 357, 523, 0, 0, 0, 0, 0, 1, 2,
2082 0, 3, 4, 0, 358, 359, 360, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 0, 361, 362, 68,
2084 0, 541, 69, 0, 0, 70, 545, 71, 282, 0,
2085 0, 0, 0, 0, 363, 0, 0, 0, 0, 0,
2086 553, 554, 0, 0, 0, 557, 0, 0, 559, 0,
2087 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
2088 162, 163, 164, 165, 166, 167, 168, 0, 0, 0,
2089 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2091 0, 0, 169, 170, 171, 172, 173, 174, 175, 176,
2092 177, 178, 179, 180, 181, 0, 182, 0, 183, 184,
2093 185, 355, 356, 0, 0, 60, 61, 357, 0, 104,
2094 0, 105, 0, 0, 1, 2, 364, 3, 4, 0,
2095 358, 359, 360, 0, 0, 0, 60, 61, 0, 0,
2096 0, 0, 0, 361, 362, 1, 2, 0, 3, 4,
2097 0, 149, 0, 0, 0, 0, 0, 0, 0, 0,
2098 363, 0, 0, 0, 150, 151, 0, 0, 0, 0,
2099 0, 0, 0, 0, 0, 0, 152, 153, 154, 155,
2100 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2101 166, 167, 168, 0, 0, 0, 0, 152, 153, 154,
2102 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
2103 165, 166, 167, 168, 0, 0, 0, 0, 169, 170,
2104 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
2105 181, 0, 182, 0, 183, 184, 185, 0, 0, 169,
2106 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
2107 180, 181, 364, 182, 0, 183, 184, 185, 0, 355,
2108 356, 0, 0, 0, 0, 357, 104, 0, 105, 0,
2109 186, 0, 0, 187, 0, 188, 0, 189, 358, 359,
2110 360, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 0, 361, 362, 0, 0, 0, 0, 0, 0, 0,
2112 0, 0, 0, 0, 0, 0, 60, 61, 363, 100,
2113 108, 109, 110, 66, 0, 1, 2, 0, 3, 4,
2114 0, 0, 0, 0, 152, 153, 154, 155, 156, 157,
2115 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2116 168, 0, 0, 67, 0, 0, 0, 0, 0, 0,
2117 0, 0, 60, 61, 0, 100, 63, 64, 65, 66,
2118 0, 1, 2, 0, 3, 4, 169, 170, 171, 172,
2119 173, 174, 175, 176, 177, 178, 179, 180, 181, 128,
2120 182, 0, 183, 184, 185, 0, 0, 0, 0, 67,
2121 0, 0, 60, 61, 0, 100, 108, 109, 110, 66,
2122 364, 1, 2, 0, 3, 4, 0, 60, 61, 0,
2123 100, 63, 64, 65, 66, 0, 1, 2, 0, 3,
2124 4, 0, 0, 0, 0, 0, 0, 0, 0, 67,
2125 0, 0, 0, 0, 324, 0, 0, 68, 0, 0,
2126 69, 0, 0, 70, 67, 71, 342, 60, 61, 0,
2127 100, 63, 64, 65, 66, 0, 1, 2, 0, 3,
2128 4, 0, 0, 60, 61, 0, 100, 63, 64, 65,
2129 66, 0, 1, 2, 413, 3, 4, 0, 0, 0,
2130 0, 0, 0, 68, 67, 0, 69, 0, 0, 70,
2131 488, 71, 0, 0, 0, 0, 0, 0, 60, 61,
2132 67, 62, 63, 64, 65, 66, 0, 1, 2, 0,
2133 3, 4, 60, 61, 0, 100, 108, 109, 110, 66,
2134 0, 1, 2, 68, 3, 4, 69, 0, 277, 70,
2135 0, 71, 0, 0, 0, 67, 0, 0, 68, 0,
2136 0, 69, 0, 0, 70, 0, 71, 0, 0, 67,
2137 60, 61, 0, 100, 63, 64, 65, 66, 0, 1,
2138 2, 0, 3, 4, 60, 61, 0, 197, 63, 64,
2139 65, 66, 0, 1, 2, 0, 3, 4, 68, 0,
2140 0, 69, 0, 0, 70, 0, 71, 67, 0, 0,
2141 0, 0, 0, 0, 68, 0, 0, 69, 0, 0,
2142 70, 67, 71, 60, 61, 0, 100, 108, 109, 110,
2143 66, 0, 1, 2, 0, 3, 4, 0, 60, 61,
2144 0, 292, 63, 64, 65, 66, 0, 1, 2, 68,
2145 3, 4, 69, 0, 0, 70, 0, 71, 0, 0,
2146 67, 0, 0, 68, 0, 0, 69, 0, 0, 70,
2147 0, 71, 0, 0, 0, 67, 0, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2150 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2151 0, 0, 0, 0, 0, 68, 0, 0, 69, 0,
2152 0, 70, 0, 71, 0, 0, 0, 0, 0, 0,
2153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 0, 0, 0, 0, 0, 0, 0, 203, 0,
2155 0, 0, 0, 0, 68, 0, 0, 69, 0, 0,
2156 70, 0, 280, 0, 0, 0, 204, 205, 0, 68,
2157 0, 0, 69, 0, 0, 70, 0, 71, 206, 207,
2158 208, 209, 210, 211, 152, 153, 154, 155, 156, 157,
2159 158, 159, 160, 161, 162, 163, 164, 165, 166, 212,
2160 213, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2162 0, 214, 215, 216, 0, 0, 217, 170, 171, 172,
2163 173, 174, 175, 176, 177, 178, 179, 180, 181, 218,
2164 219, 220, 221, 222, 223
2167 static const short int yycheck[] =
2169 0, 26, 208, 241, 113, 187, 188, 303, 4, 11,
2170 11, 81, 414, 0, 209, 326, 16, 25, 216, 330,
2171 31, 219, 220, 221, 222, 223, 299, 18, 226, 16,
2172 11, 11, 136, 228, 136, 26, 106, 48, 47, 113,
2173 136, 145, 135, 316, 0, 147, 71, 16, 16, 145,
2174 19, 19, 61, 242, 243, 3, 4, 5, 6, 15,
2175 16, 17, 533, 19, 20, 21, 17, 48, 48, 20,
2176 95, 27, 28, 544, 99, 23, 24, 52, 37, 38,
2177 105, 136, 107, 112, 113, 44, 86, 489, 112, 113,
2178 46, 50, 147, 49, 136, 135, 121, 53, 280, 136,
2179 129, 130, 131, 132, 15, 147, 130, 131, 133, 134,
2180 147, 137, 137, 139, 136, 136, 137, 519, 139, 145,
2181 318, 143, 7, 8, 0, 10, 11, 12, 13, 14,
2182 136, 16, 17, 11, 19, 20, 14, 143, 146, 29,
2183 30, 143, 143, 545, 112, 113, 108, 109, 7, 8,
2184 146, 10, 11, 12, 13, 14, 147, 16, 17, 44,
2185 19, 20, 130, 131, 353, 136, 19, 31, 464, 140,
2186 466, 137, 137, 139, 139, 135, 141, 143, 41, 490,
2187 43, 206, 364, 135, 382, 44, 384, 385, 386, 214,
2188 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
2189 225, 226, 272, 273, 274, 275, 276, 136, 135, 234,
2190 136, 140, 199, 141, 140, 285, 286, 287, 456, 293,
2191 134, 295, 296, 33, 298, 137, 537, 139, 539, 136,
2192 137, 305, 139, 18, 343, 19, 37, 38, 39, 313,
2193 314, 42, 3, 4, 5, 6, 444, 19, 112, 113,
2194 77, 78, 19, 138, 4, 280, 141, 139, 4, 144,
2195 9, 146, 147, 333, 334, 129, 130, 131, 132, 343,
2196 340, 469, 470, 471, 299, 300, 301, 142, 9, 138,
2197 142, 9, 141, 521, 4, 144, 524, 146, 147, 19,
2198 136, 316, 317, 318, 137, 140, 139, 140, 372, 373,
2199 374, 145, 112, 113, 140, 139, 380, 139, 139, 139,
2200 139, 19, 518, 139, 139, 139, 390, 391, 136, 129,
2201 130, 131, 132, 50, 11, 145, 139, 139, 534, 354,
2202 400, 401, 402, 403, 139, 33, 136, 407, 408, 136,
2203 37, 38, 39, 40, 41, 42, 43, 136, 45, 136,
2204 136, 425, 145, 427, 136, 136, 430, 382, 383, 384,
2205 385, 386, 436, 437, 389, 55, 56, 57, 58, 59,
2206 60, 136, 442, 443, 85, 86, 87, 88, 89, 90,
2207 91, 92, 93, 94, 409, 459, 460, 33, 462, 463,
2208 19, 136, 136, 467, 136, 295, 296, 136, 298, 4,
2209 54, 475, 136, 136, 141, 305, 0, 136, 140, 479,
2210 136, 481, 482, 313, 314, 136, 441, 136, 136, 444,
2211 494, 15, 16, 17, 136, 19, 20, 21, 502, 145,
2212 455, 19, 14, 27, 28, 14, 461, 134, 139, 4,
2213 136, 136, 136, 136, 469, 470, 471, 136, 136, 474,
2214 136, 136, 46, 19, 454, 49, 139, 531, 140, 53,
2215 136, 136, 536, 140, 136, 136, 140, 136, 136, 14,
2216 23, 24, 372, 373, 374, 140, 550, 551, 140, 48,
2217 380, 555, 141, 143, 558, 140, 48, 140, 140, 4,
2218 390, 391, 143, 136, 14, 520, 14, 136, 7, 8,
2219 14, 10, 11, 12, 13, 14, 66, 16, 17, 14,
2220 19, 20, 124, 513, 124, 124, 513, 490, 86, 234,
2221 212, 105, 213, 99, 16, 425, 83, 427, 53, 474,
2222 430, 379, -1, -1, -1, 44, 436, 437, 91, 92,
2223 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2224 103, 104, -1, -1, -1, -1, -1, -1, -1, 459,
2225 460, -1, 462, 463, -1, -1, -1, 467, -1, -1,
2226 -1, -1, -1, -1, -1, 475, -1, -1, -1, -1,
2227 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2228 -1, -1, -1, -1, 494, 3, 4, -1, -1, 7,
2229 8, 9, 502, -1, -1, -1, -1, -1, 16, 17,
2230 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2231 -1, -1, -1, -1, -1, -1, -1, 35, 36, 138,
2232 -1, 531, 141, -1, -1, 144, 536, 146, 147, -1,
2233 -1, -1, -1, -1, 52, -1, -1, -1, -1, -1,
2234 550, 551, -1, -1, -1, 555, -1, -1, 558, -1,
2235 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2236 78, 79, 80, 81, 82, 83, 84, -1, -1, -1,
2237 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2239 -1, -1, 110, 111, 112, 113, 114, 115, 116, 117,
2240 118, 119, 120, 121, 122, -1, 124, -1, 126, 127,
2241 128, 3, 4, -1, -1, 7, 8, 9, -1, 137,
2242 -1, 139, -1, -1, 16, 17, 144, 19, 20, -1,
2243 22, 23, 24, -1, -1, -1, 7, 8, -1, -1,
2244 -1, -1, -1, 35, 36, 16, 17, -1, 19, 20,
2245 -1, 22, -1, -1, -1, -1, -1, -1, -1, -1,
2246 52, -1, -1, -1, 35, 36, -1, -1, -1, -1,
2247 -1, -1, -1, -1, -1, -1, 68, 69, 70, 71,
2248 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2249 82, 83, 84, -1, -1, -1, -1, 68, 69, 70,
2250 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2251 81, 82, 83, 84, -1, -1, -1, -1, 110, 111,
2252 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2253 122, -1, 124, -1, 126, 127, 128, -1, -1, 110,
2254 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2255 121, 122, 144, 124, -1, 126, 127, 128, -1, 3,
2256 4, -1, -1, -1, -1, 9, 137, -1, 139, -1,
2257 141, -1, -1, 144, -1, 146, -1, 148, 22, 23,
2258 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2259 -1, 35, 36, -1, -1, -1, -1, -1, -1, -1,
2260 -1, -1, -1, -1, -1, -1, 7, 8, 52, 10,
2261 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2262 -1, -1, -1, -1, 68, 69, 70, 71, 72, 73,
2263 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2264 84, -1, -1, 44, -1, -1, -1, -1, -1, -1,
2265 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2266 -1, 16, 17, -1, 19, 20, 110, 111, 112, 113,
2267 114, 115, 116, 117, 118, 119, 120, 121, 122, 34,
2268 124, -1, 126, 127, 128, -1, -1, -1, -1, 44,
2269 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2270 144, 16, 17, -1, 19, 20, -1, 7, 8, -1,
2271 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2272 20, -1, -1, -1, -1, -1, -1, -1, -1, 44,
2273 -1, -1, -1, -1, 34, -1, -1, 138, -1, -1,
2274 141, -1, -1, 144, 44, 146, 147, 7, 8, -1,
2275 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2276 20, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2277 14, -1, 16, 17, 34, 19, 20, -1, -1, -1,
2278 -1, -1, -1, 138, 44, -1, 141, -1, -1, 144,
2279 34, 146, -1, -1, -1, -1, -1, -1, 7, 8,
2280 44, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2281 19, 20, 7, 8, -1, 10, 11, 12, 13, 14,
2282 -1, 16, 17, 138, 19, 20, 141, -1, 143, 144,
2283 -1, 146, -1, -1, -1, 44, -1, -1, 138, -1,
2284 -1, 141, -1, -1, 144, -1, 146, -1, -1, 44,
2285 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2286 17, -1, 19, 20, 7, 8, -1, 10, 11, 12,
2287 13, 14, -1, 16, 17, -1, 19, 20, 138, -1,
2288 -1, 141, -1, -1, 144, -1, 146, 44, -1, -1,
2289 -1, -1, -1, -1, 138, -1, -1, 141, -1, -1,
2290 144, 44, 146, 7, 8, -1, 10, 11, 12, 13,
2291 14, -1, 16, 17, -1, 19, 20, -1, 7, 8,
2292 -1, 10, 11, 12, 13, 14, -1, 16, 17, 138,
2293 19, 20, 141, -1, -1, 144, -1, 146, -1, -1,
2294 44, -1, -1, 138, -1, -1, 141, -1, -1, 144,
2295 -1, 146, -1, -1, -1, 44, -1, -1, -1, -1,
2296 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2298 -1, 138, -1, -1, 141, -1, -1, 144, -1, 146,
2299 -1, -1, -1, -1, -1, 138, -1, -1, 141, -1,
2300 -1, 144, -1, 146, -1, -1, -1, -1, -1, -1,
2301 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2302 -1, -1, -1, -1, -1, -1, -1, -1, 32, -1,
2303 -1, -1, -1, -1, 138, -1, -1, 141, -1, -1,
2304 144, -1, 146, -1, -1, -1, 50, 51, -1, 138,
2305 -1, -1, 141, -1, -1, 144, -1, 146, 62, 63,
2306 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
2307 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2308 84, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2309 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2310 -1, 105, 106, 107, -1, -1, 110, 111, 112, 113,
2311 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2312 124, 125, 126, 127, 128
2315 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2316 symbol of state STATE-NUM. */
2317 static const unsigned char yystos[] =
2319 0, 16, 17, 19, 20, 21, 27, 28, 46, 49,
2320 53, 157, 159, 160, 161, 189, 190, 191, 193, 192,
2321 47, 61, 198, 135, 52, 135, 15, 135, 37, 38,
2322 39, 40, 41, 42, 43, 45, 134, 162, 163, 164,
2323 0, 191, 41, 43, 165, 208, 37, 38, 39, 42,
2324 166, 205, 207, 214, 135, 135, 141, 199, 19, 197,
2325 7, 8, 10, 11, 12, 13, 14, 44, 138, 141,
2326 144, 146, 157, 160, 178, 179, 211, 164, 164, 29,
2327 30, 188, 164, 164, 18, 215, 216, 26, 147, 206,
2328 215, 19, 19, 19, 200, 139, 4, 4, 4, 146,
2329 10, 147, 179, 184, 137, 139, 188, 188, 11, 12,
2330 13, 155, 156, 179, 185, 55, 56, 57, 58, 59,
2331 60, 167, 203, 203, 159, 219, 136, 143, 34, 179,
2332 180, 182, 183, 142, 142, 147, 184, 136, 147, 183,
2333 185, 179, 23, 24, 3, 4, 5, 6, 9, 22,
2334 35, 36, 68, 69, 70, 71, 72, 73, 74, 75,
2335 76, 77, 78, 79, 80, 81, 82, 83, 84, 110,
2336 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2337 121, 122, 124, 126, 127, 128, 141, 144, 146, 148,
2338 150, 151, 152, 186, 211, 194, 4, 10, 179, 181,
2339 25, 146, 204, 32, 50, 51, 62, 63, 64, 65,
2340 66, 67, 83, 84, 105, 106, 107, 110, 123, 124,
2341 125, 126, 127, 128, 150, 151, 152, 217, 223, 224,
2342 225, 226, 19, 169, 136, 140, 179, 179, 145, 147,
2343 179, 140, 195, 196, 85, 86, 87, 88, 89, 90,
2344 91, 92, 93, 94, 153, 23, 24, 91, 92, 93,
2345 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2346 104, 154, 139, 139, 139, 139, 139, 143, 185, 187,
2347 146, 187, 147, 187, 19, 139, 139, 139, 136, 176,
2348 160, 50, 10, 179, 213, 11, 14, 11, 155, 167,
2349 153, 154, 179, 179, 213, 179, 179, 220, 213, 213,
2350 213, 213, 213, 179, 179, 213, 167, 108, 109, 112,
2351 113, 130, 131, 168, 34, 180, 171, 143, 145, 145,
2352 171, 176, 176, 139, 139, 185, 185, 185, 185, 185,
2353 136, 143, 147, 179, 187, 145, 147, 185, 185, 185,
2354 31, 48, 174, 177, 139, 3, 4, 9, 22, 23,
2355 24, 35, 36, 52, 144, 186, 210, 211, 212, 212,
2356 212, 212, 181, 179, 179, 136, 173, 136, 173, 212,
2357 141, 136, 136, 136, 136, 136, 136, 212, 212, 33,
2358 181, 179, 213, 129, 132, 168, 170, 185, 185, 222,
2359 136, 136, 136, 136, 185, 145, 147, 136, 136, 33,
2360 19, 4, 176, 34, 179, 201, 202, 54, 209, 187,
2361 136, 136, 212, 212, 212, 11, 48, 11, 222, 212,
2362 141, 213, 179, 213, 213, 213, 136, 136, 179, 212,
2363 212, 136, 136, 136, 136, 140, 185, 185, 185, 185,
2364 145, 185, 185, 179, 169, 136, 140, 19, 145, 14,
2365 14, 139, 136, 136, 212, 4, 212, 136, 212, 136,
2366 136, 136, 212, 212, 139, 179, 185, 185, 213, 136,
2367 140, 136, 136, 140, 140, 140, 157, 158, 34, 179,
2368 171, 136, 212, 212, 179, 221, 212, 212, 136, 173,
2369 173, 212, 136, 213, 213, 213, 221, 212, 140, 140,
2370 185, 185, 185, 169, 174, 175, 19, 136, 141, 212,
2371 136, 140, 143, 212, 140, 140, 140, 140, 158, 48,
2372 172, 14, 143, 155, 218, 169, 179, 171, 143, 171,
2373 4, 212, 210, 143, 155, 212, 33, 136, 210, 169,
2374 14, 14, 136, 212, 212, 14, 66, 212, 14, 212
2377 #define yyerrok (yyerrstatus = 0)
2378 #define yyclearin (yychar = YYEMPTY)
2379 #define YYEMPTY (-2)
2382 #define YYACCEPT goto yyacceptlab
2383 #define YYABORT goto yyabortlab
2384 #define YYERROR goto yyerrorlab
2387 /* Like YYERROR except do call yyerror. This remains here temporarily
2388 to ease the transition to the new meaning of YYERROR, for GCC.
2389 Once GCC version 2 has supplanted version 1, this can go. */
2391 #define YYFAIL goto yyerrlab
2393 #define YYRECOVERING() (!!yyerrstatus)
2395 #define YYBACKUP(Token, Value) \
2397 if (yychar == YYEMPTY && yylen == 1) \
2401 yytoken = YYTRANSLATE (yychar); \
2407 yyerror (YY_("syntax error: cannot back up")); \
2414 #define YYERRCODE 256
2417 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2418 If N is 0, then set CURRENT to the empty location which ends
2419 the previous symbol: RHS[0] (always defined). */
2421 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2422 #ifndef YYLLOC_DEFAULT
2423 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2427 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2428 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2429 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2430 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2434 (Current).first_line = (Current).last_line = \
2435 YYRHSLOC (Rhs, 0).last_line; \
2436 (Current).first_column = (Current).last_column = \
2437 YYRHSLOC (Rhs, 0).last_column; \
2443 /* YY_LOCATION_PRINT -- Print the location on the stream.
2444 This macro was not mandated originally: define only if we know
2445 we won't break user code: when these are the locations we know. */
2447 #ifndef YY_LOCATION_PRINT
2448 # if YYLTYPE_IS_TRIVIAL
2449 # define YY_LOCATION_PRINT(File, Loc) \
2450 fprintf (File, "%d.%d-%d.%d", \
2451 (Loc).first_line, (Loc).first_column, \
2452 (Loc).last_line, (Loc).last_column)
2454 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2459 /* YYLEX -- calling `yylex' with the right arguments. */
2462 # define YYLEX yylex (YYLEX_PARAM)
2464 # define YYLEX yylex ()
2467 /* Enable debugging if requested. */
2471 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2472 # define YYFPRINTF fprintf
2475 # define YYDPRINTF(Args) \
2481 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2485 YYFPRINTF (stderr, "%s ", Title); \
2486 yysymprint (stderr, \
2488 YYFPRINTF (stderr, "\n"); \
2492 /*------------------------------------------------------------------.
2493 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2495 `------------------------------------------------------------------*/
2497 #if defined (__STDC__) || defined (__cplusplus)
2499 yy_stack_print (short int *bottom, short int *top)
2502 yy_stack_print (bottom, top)
2507 YYFPRINTF (stderr, "Stack now");
2508 for (/* Nothing. */; bottom <= top; ++bottom)
2509 YYFPRINTF (stderr, " %d", *bottom);
2510 YYFPRINTF (stderr, "\n");
2513 # define YY_STACK_PRINT(Bottom, Top) \
2516 yy_stack_print ((Bottom), (Top)); \
2520 /*------------------------------------------------.
2521 | Report that the YYRULE is going to be reduced. |
2522 `------------------------------------------------*/
2524 #if defined (__STDC__) || defined (__cplusplus)
2526 yy_reduce_print (int yyrule)
2529 yy_reduce_print (yyrule)
2534 unsigned long int yylno = yyrline[yyrule];
2535 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2537 /* Print the symbols being reduced, and their result. */
2538 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2539 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2540 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2543 # define YY_REDUCE_PRINT(Rule) \
2546 yy_reduce_print (Rule); \
2549 /* Nonzero means print parse trace. It is left uninitialized so that
2550 multiple parsers can coexist. */
2552 #else /* !YYDEBUG */
2553 # define YYDPRINTF(Args)
2554 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2555 # define YY_STACK_PRINT(Bottom, Top)
2556 # define YY_REDUCE_PRINT(Rule)
2557 #endif /* !YYDEBUG */
2560 /* YYINITDEPTH -- initial size of the parser's stacks. */
2562 # define YYINITDEPTH 200
2565 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2566 if the built-in stack extension method is used).
2568 Do not make this value too large; the results are undefined if
2569 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2570 evaluated with infinite-precision integer arithmetic. */
2573 # define YYMAXDEPTH 10000
2581 # if defined (__GLIBC__) && defined (_STRING_H)
2582 # define yystrlen strlen
2584 /* Return the length of YYSTR. */
2586 # if defined (__STDC__) || defined (__cplusplus)
2587 yystrlen (const char *yystr)
2593 const char *yys = yystr;
2595 while (*yys++ != '\0')
2598 return yys - yystr - 1;
2604 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2605 # define yystpcpy stpcpy
2607 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2610 # if defined (__STDC__) || defined (__cplusplus)
2611 yystpcpy (char *yydest, const char *yysrc)
2613 yystpcpy (yydest, yysrc)
2619 const char *yys = yysrc;
2621 while ((*yyd++ = *yys++) != '\0')
2630 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2631 quotes and backslashes, so that it's suitable for yyerror. The
2632 heuristic is that double-quoting is unnecessary unless the string
2633 contains an apostrophe, a comma, or backslash (other than
2634 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2635 null, do not copy; instead, return the length of what the result
2638 yytnamerr (char *yyres, const char *yystr)
2643 char const *yyp = yystr;
2650 goto do_not_strip_quotes;
2654 goto do_not_strip_quotes;
2667 do_not_strip_quotes: ;
2671 return yystrlen (yystr);
2673 return yystpcpy (yyres, yystr) - yyres;
2677 #endif /* YYERROR_VERBOSE */
2682 /*--------------------------------.
2683 | Print this symbol on YYOUTPUT. |
2684 `--------------------------------*/
2686 #if defined (__STDC__) || defined (__cplusplus)
2688 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2691 yysymprint (yyoutput, yytype, yyvaluep)
2697 /* Pacify ``unused variable'' warnings. */
2700 if (yytype < YYNTOKENS)
2701 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2703 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2707 if (yytype < YYNTOKENS)
2708 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2715 YYFPRINTF (yyoutput, ")");
2718 #endif /* ! YYDEBUG */
2719 /*-----------------------------------------------.
2720 | Release the memory associated to this symbol. |
2721 `-----------------------------------------------*/
2723 #if defined (__STDC__) || defined (__cplusplus)
2725 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2728 yydestruct (yymsg, yytype, yyvaluep)
2734 /* Pacify ``unused variable'' warnings. */
2739 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2750 /* Prevent warnings from -Wmissing-prototypes. */
2752 #ifdef YYPARSE_PARAM
2753 # if defined (__STDC__) || defined (__cplusplus)
2754 int yyparse (void *YYPARSE_PARAM);
2758 #else /* ! YYPARSE_PARAM */
2759 #if defined (__STDC__) || defined (__cplusplus)
2764 #endif /* ! YYPARSE_PARAM */
2768 /* The look-ahead symbol. */
2771 /* The semantic value of the look-ahead symbol. */
2774 /* Number of syntax errors so far. */
2783 #ifdef YYPARSE_PARAM
2784 # if defined (__STDC__) || defined (__cplusplus)
2785 int yyparse (void *YYPARSE_PARAM)
2787 int yyparse (YYPARSE_PARAM)
2788 void *YYPARSE_PARAM;
2790 #else /* ! YYPARSE_PARAM */
2791 #if defined (__STDC__) || defined (__cplusplus)
2805 /* Number of tokens to shift before error messages enabled. */
2807 /* Look-ahead token as an internal (translated) token number. */
2810 /* Three stacks and their tools:
2811 `yyss': related to states,
2812 `yyvs': related to semantic values,
2813 `yyls': related to locations.
2815 Refer to the stacks thru separate pointers, to allow yyoverflow
2816 to reallocate them elsewhere. */
2818 /* The state stack. */
2819 short int yyssa[YYINITDEPTH];
2820 short int *yyss = yyssa;
2823 /* The semantic value stack. */
2824 YYSTYPE yyvsa[YYINITDEPTH];
2825 YYSTYPE *yyvs = yyvsa;
2830 #define YYPOPSTACK (yyvsp--, yyssp--)
2832 YYSIZE_T yystacksize = YYINITDEPTH;
2834 /* The variables used to return semantic value and location from the
2839 /* When reducing, the number of symbols on the RHS of the reduced
2843 YYDPRINTF ((stderr, "Starting parse\n"));
2848 yychar = YYEMPTY; /* Cause a token to be read. */
2850 /* Initialize stack pointers.
2851 Waste one element of value and location stack
2852 so that they stay on the same level as the state stack.
2853 The wasted elements are never initialized. */
2860 /*------------------------------------------------------------.
2861 | yynewstate -- Push a new state, which is found in yystate. |
2862 `------------------------------------------------------------*/
2864 /* In all cases, when you get here, the value and location stacks
2865 have just been pushed. so pushing a state here evens the stacks.
2872 if (yyss + yystacksize - 1 <= yyssp)
2874 /* Get the current used size of the three stacks, in elements. */
2875 YYSIZE_T yysize = yyssp - yyss + 1;
2879 /* Give user a chance to reallocate the stack. Use copies of
2880 these so that the &'s don't force the real ones into
2882 YYSTYPE *yyvs1 = yyvs;
2883 short int *yyss1 = yyss;
2886 /* Each stack pointer address is followed by the size of the
2887 data in use in that stack, in bytes. This used to be a
2888 conditional around just the two extra args, but that might
2889 be undefined if yyoverflow is a macro. */
2890 yyoverflow (YY_("memory exhausted"),
2891 &yyss1, yysize * sizeof (*yyssp),
2892 &yyvs1, yysize * sizeof (*yyvsp),
2899 #else /* no yyoverflow */
2900 # ifndef YYSTACK_RELOCATE
2901 goto yyexhaustedlab;
2903 /* Extend the stack our own way. */
2904 if (YYMAXDEPTH <= yystacksize)
2905 goto yyexhaustedlab;
2907 if (YYMAXDEPTH < yystacksize)
2908 yystacksize = YYMAXDEPTH;
2911 short int *yyss1 = yyss;
2912 union yyalloc *yyptr =
2913 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2915 goto yyexhaustedlab;
2916 YYSTACK_RELOCATE (yyss);
2917 YYSTACK_RELOCATE (yyvs);
2919 # undef YYSTACK_RELOCATE
2921 YYSTACK_FREE (yyss1);
2924 #endif /* no yyoverflow */
2926 yyssp = yyss + yysize - 1;
2927 yyvsp = yyvs + yysize - 1;
2930 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2931 (unsigned long int) yystacksize));
2933 if (yyss + yystacksize - 1 <= yyssp)
2937 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2946 /* Do appropriate processing given the current state. */
2947 /* Read a look-ahead token if we need one and don't already have one. */
2950 /* First try to decide what to do without reference to look-ahead token. */
2952 yyn = yypact[yystate];
2953 if (yyn == YYPACT_NINF)
2956 /* Not known => get a look-ahead token if don't already have one. */
2958 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2959 if (yychar == YYEMPTY)
2961 YYDPRINTF ((stderr, "Reading a token: "));
2965 if (yychar <= YYEOF)
2967 yychar = yytoken = YYEOF;
2968 YYDPRINTF ((stderr, "Now at end of input.\n"));
2972 yytoken = YYTRANSLATE (yychar);
2973 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2976 /* If the proper action on seeing token YYTOKEN is to reduce or to
2977 detect an error, take that action. */
2979 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2984 if (yyn == 0 || yyn == YYTABLE_NINF)
2993 /* Shift the look-ahead token. */
2994 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2996 /* Discard the token being shifted unless it is eof. */
2997 if (yychar != YYEOF)
3003 /* Count tokens shifted since error; after three, turn off error
3012 /*-----------------------------------------------------------.
3013 | yydefault -- do the default action for the current state. |
3014 `-----------------------------------------------------------*/
3016 yyn = yydefact[yystate];
3022 /*-----------------------------.
3023 | yyreduce -- Do a reduction. |
3024 `-----------------------------*/
3026 /* yyn is the number of a rule to reduce with. */
3029 /* If YYLEN is nonzero, implement the default value of the action:
3032 Otherwise, the following line sets YYVAL to garbage.
3033 This behavior is undocumented and Bison
3034 users should not rely upon it. Assigning to YYVAL
3035 unconditionally makes the parser a bit smaller, and it avoids a
3036 GCC warning that YYVAL may be used uninitialized. */
3037 yyval = yyvsp[1-yylen];
3040 YY_REDUCE_PRINT (yyn);
3044 #line 1099 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3045 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3049 #line 1099 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3050 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3054 #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3055 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3059 #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3060 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3064 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3065 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3069 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3070 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3074 #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3075 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3079 #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3080 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3084 #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3085 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3089 #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3090 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3094 #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3095 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3099 #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3100 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3104 #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3105 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3109 #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3110 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3114 #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3115 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3119 #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3120 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3124 #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3125 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3129 #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3130 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3134 #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3135 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3139 #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3140 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3144 #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3145 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3149 #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3150 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3154 #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3155 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3159 #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3160 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3164 #line 1114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3165 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3169 #line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3170 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3174 #line 1124 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3175 { (yyval.StrVal) = 0; ;}
3179 #line 1128 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3181 (yyval.StrVal) = (yyvsp[-1].StrVal);
3187 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3195 #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3197 (yyval.StrVal) = (yyvsp[-1].StrVal);
3203 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3211 #line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3212 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3216 #line 1150 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3217 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3221 #line 1151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3222 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3226 #line 1152 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3227 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3231 #line 1153 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3232 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3236 #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3237 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3241 #line 1158 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3242 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3246 #line 1159 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3247 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3251 #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3252 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3256 #line 1164 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3257 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3261 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3262 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3266 #line 1169 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3267 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3271 #line 1170 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3272 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3276 #line 1174 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3277 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3281 #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3282 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3286 #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3287 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3291 #line 1177 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3292 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3296 #line 1178 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3297 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3301 #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3302 { (yyval.UIntVal) = CallingConv::C; ;}
3306 #line 1182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3307 { (yyval.UIntVal) = CallingConv::C; ;}
3311 #line 1183 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3312 { (yyval.UIntVal) = CallingConv::Fast; ;}
3316 #line 1184 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3317 { (yyval.UIntVal) = CallingConv::Cold; ;}
3321 #line 1185 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3322 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3326 #line 1186 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3327 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3331 #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3333 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3334 GEN_ERROR("Calling conv too large");
3335 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3341 #line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3342 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3346 #line 1195 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3347 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3351 #line 1196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3352 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
3356 #line 1197 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3357 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
3361 #line 1200 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3362 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3366 #line 1201 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3368 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3373 #line 1206 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3374 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3378 #line 1207 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3379 { (yyval.ParamAttrs) = FunctionType::NoUnwindAttribute; ;}
3383 #line 1211 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3384 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3388 #line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3390 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3395 #line 1219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3396 { (yyval.UIntVal) = 0; ;}
3400 #line 1220 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3402 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3403 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3404 GEN_ERROR("Alignment must be a power of two");
3410 #line 1226 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3411 { (yyval.UIntVal) = 0; ;}
3415 #line 1227 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3417 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3418 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3419 GEN_ERROR("Alignment must be a power of two");
3425 #line 1235 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3427 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3428 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3429 GEN_ERROR("Invalid character in section name");
3430 (yyval.StrVal) = (yyvsp[0].StrVal);
3436 #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3437 { (yyval.StrVal) = 0; ;}
3441 #line 1244 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3442 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3446 #line 1249 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3451 #line 1250 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3456 #line 1251 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3458 CurGV->setSection((yyvsp[0].StrVal));
3459 free((yyvsp[0].StrVal));
3465 #line 1256 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3467 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3468 GEN_ERROR("Alignment must be a power of two");
3469 CurGV->setAlignment((yyvsp[0].UInt64Val));
3475 #line 1272 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3477 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3483 #line 1276 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3485 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3491 #line 1280 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3493 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3494 GEN_ERROR("Cannot form a pointer to a basic block");
3495 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3496 delete (yyvsp[-1].TypeVal);
3502 #line 1287 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3503 { // Named types are also simple types...
3504 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3506 (yyval.TypeVal) = new PATypeHolder(tmp);
3511 #line 1292 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3512 { // Type UpReference
3513 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3514 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3515 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3516 (yyval.TypeVal) = new PATypeHolder(OT);
3517 UR_OUT("New Upreference!\n");
3523 #line 1300 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3525 std::vector<const Type*> Params;
3526 std::vector<FunctionType::ParameterAttributes> Attrs;
3527 Attrs.push_back((yyvsp[0].ParamAttrs));
3528 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3529 const Type *Ty = I->Ty->get();
3530 Params.push_back(Ty);
3531 if (Ty != Type::VoidTy)
3532 Attrs.push_back(I->Attrs);
3534 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3535 if (isVarArg) Params.pop_back();
3537 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3538 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3539 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3540 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3546 #line 1319 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3548 std::vector<const Type*> Params;
3549 std::vector<FunctionType::ParameterAttributes> Attrs;
3550 Attrs.push_back((yyvsp[0].ParamAttrs));
3551 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3552 const Type* Ty = I->Ty->get();
3553 Params.push_back(Ty);
3554 if (Ty != Type::VoidTy)
3555 Attrs.push_back(I->Attrs);
3557 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3558 if (isVarArg) Params.pop_back();
3560 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3561 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3562 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3568 #line 1338 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3569 { // Sized array type?
3570 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3571 delete (yyvsp[-1].TypeVal);
3577 #line 1343 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3579 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3580 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3581 GEN_ERROR("Unsigned result not equal to signed result");
3582 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3583 GEN_ERROR("Element type of a VectorType must be primitive");
3584 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3585 GEN_ERROR("Vector length should be a power of 2");
3586 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3587 delete (yyvsp[-1].TypeVal);
3593 #line 1355 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3594 { // Structure type?
3595 std::vector<const Type*> Elements;
3596 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3597 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3598 Elements.push_back(*I);
3600 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3601 delete (yyvsp[-1].TypeList);
3607 #line 1365 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3608 { // Empty structure type?
3609 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3615 #line 1369 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3617 std::vector<const Type*> Elements;
3618 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3619 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3620 Elements.push_back(*I);
3622 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3623 delete (yyvsp[-2].TypeList);
3629 #line 1379 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3630 { // Empty structure type?
3631 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3637 #line 1386 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3639 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3640 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3645 #line 1393 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3647 if (!UpRefs.empty())
3648 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3649 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3650 GEN_ERROR("LLVM functions cannot return aggregate types");
3651 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3656 #line 1400 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3658 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3663 #line 1405 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3665 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3666 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3672 #line 1410 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3674 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3680 #line 1418 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3682 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3683 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3684 TWA.Ty = new PATypeHolder(Type::VoidTy);
3685 (yyval.TypeWithAttrsList)->push_back(TWA);
3691 #line 1425 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3693 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3694 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3695 TWA.Ty = new PATypeHolder(Type::VoidTy);
3696 (yyval.TypeWithAttrsList)->push_back(TWA);
3702 #line 1432 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3704 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3710 #line 1440 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3712 (yyval.TypeList) = new std::list<PATypeHolder>();
3713 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal));
3714 delete (yyvsp[0].TypeVal);
3720 #line 1446 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3722 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal));
3723 delete (yyvsp[0].TypeVal);
3729 #line 1458 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3730 { // Nonempty unsized arr
3731 if (!UpRefs.empty())
3732 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3733 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3735 GEN_ERROR("Cannot make array constant with type: '" +
3736 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3737 const Type *ETy = ATy->getElementType();
3738 int NumElements = ATy->getNumElements();
3740 // Verify that we have the correct size...
3741 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3742 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3743 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3744 itostr(NumElements) + "");
3746 // Verify all elements are correct type!
3747 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3748 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3749 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3750 ETy->getDescription() +"' as required!\nIt is of type '"+
3751 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3754 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3755 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3761 #line 1486 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3763 if (!UpRefs.empty())
3764 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3765 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3767 GEN_ERROR("Cannot make array constant with type: '" +
3768 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3770 int NumElements = ATy->getNumElements();
3771 if (NumElements != -1 && NumElements != 0)
3772 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3773 " arguments, but has size of " + itostr(NumElements) +"");
3774 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3775 delete (yyvsp[-2].TypeVal);
3781 #line 1502 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3783 if (!UpRefs.empty())
3784 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3785 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3787 GEN_ERROR("Cannot make array constant with type: '" +
3788 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3790 int NumElements = ATy->getNumElements();
3791 const Type *ETy = ATy->getElementType();
3792 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3793 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3794 GEN_ERROR("Can't build string constant of size " +
3795 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3796 " when array has size " + itostr(NumElements) + "");
3797 std::vector<Constant*> Vals;
3798 if (ETy == Type::Int8Ty) {
3799 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3800 C != (unsigned char*)EndStr; ++C)
3801 Vals.push_back(ConstantInt::get(ETy, *C));
3803 free((yyvsp[0].StrVal));
3804 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3806 free((yyvsp[0].StrVal));
3807 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3808 delete (yyvsp[-2].TypeVal);
3814 #line 1531 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3815 { // Nonempty unsized arr
3816 if (!UpRefs.empty())
3817 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3818 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3820 GEN_ERROR("Cannot make packed constant with type: '" +
3821 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3822 const Type *ETy = PTy->getElementType();
3823 int NumElements = PTy->getNumElements();
3825 // Verify that we have the correct size...
3826 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3827 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3828 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3829 itostr(NumElements) + "");
3831 // Verify all elements are correct type!
3832 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3833 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3834 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3835 ETy->getDescription() +"' as required!\nIt is of type '"+
3836 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3839 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3840 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3846 #line 1559 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3848 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3850 GEN_ERROR("Cannot make struct constant with type: '" +
3851 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3853 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3854 GEN_ERROR("Illegal number of initializers for structure type");
3856 // Check to ensure that constants are compatible with the type initializer!
3857 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3858 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3859 GEN_ERROR("Expected type '" +
3860 STy->getElementType(i)->getDescription() +
3861 "' for element #" + utostr(i) +
3862 " of structure initializer");
3864 // Check to ensure that Type is not packed
3865 if (STy->isPacked())
3866 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3868 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3869 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3875 #line 1584 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3877 if (!UpRefs.empty())
3878 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3879 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3881 GEN_ERROR("Cannot make struct constant with type: '" +
3882 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3884 if (STy->getNumContainedTypes() != 0)
3885 GEN_ERROR("Illegal number of initializers for structure type");
3887 // Check to ensure that Type is not packed
3888 if (STy->isPacked())
3889 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3891 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3892 delete (yyvsp[-2].TypeVal);
3898 #line 1603 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3900 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3902 GEN_ERROR("Cannot make struct constant with type: '" +
3903 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3905 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3906 GEN_ERROR("Illegal number of initializers for structure type");
3908 // Check to ensure that constants are compatible with the type initializer!
3909 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3910 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3911 GEN_ERROR("Expected type '" +
3912 STy->getElementType(i)->getDescription() +
3913 "' for element #" + utostr(i) +
3914 " of structure initializer");
3916 // Check to ensure that Type is packed
3917 if (!STy->isPacked())
3918 GEN_ERROR("Vector initializer to non-vector type '" +
3919 STy->getDescription() + "'");
3921 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3922 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3928 #line 1629 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3930 if (!UpRefs.empty())
3931 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3932 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3934 GEN_ERROR("Cannot make struct constant with type: '" +
3935 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3937 if (STy->getNumContainedTypes() != 0)
3938 GEN_ERROR("Illegal number of initializers for structure type");
3940 // Check to ensure that Type is packed
3941 if (!STy->isPacked())
3942 GEN_ERROR("Vector initializer to non-vector type '" +
3943 STy->getDescription() + "'");
3945 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3946 delete (yyvsp[-4].TypeVal);
3952 #line 1649 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3954 if (!UpRefs.empty())
3955 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3956 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3958 GEN_ERROR("Cannot make null pointer constant with type: '" +
3959 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3961 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3962 delete (yyvsp[-1].TypeVal);
3968 #line 1661 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3970 if (!UpRefs.empty())
3971 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3972 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3973 delete (yyvsp[-1].TypeVal);
3979 #line 1668 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3981 if (!UpRefs.empty())
3982 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3983 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3985 GEN_ERROR("Global const reference must be a pointer type");
3987 // ConstExprs can exist in the body of a function, thus creating
3988 // GlobalValues whenever they refer to a variable. Because we are in
3989 // the context of a function, getExistingVal will search the functions
3990 // symbol table instead of the module symbol table for the global symbol,
3991 // which throws things all off. To get around this, we just tell
3992 // getExistingVal that we are at global scope here.
3994 Function *SavedCurFn = CurFun.CurrentFunction;
3995 CurFun.CurrentFunction = 0;
3997 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
4000 CurFun.CurrentFunction = SavedCurFn;
4002 // If this is an initializer for a constant pointer, which is referencing a
4003 // (currently) undefined variable, create a stub now that shall be replaced
4004 // in the future with the right type of variable.
4007 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4008 const PointerType *PT = cast<PointerType>(Ty);
4010 // First check to see if the forward references value is already created!
4011 PerModuleInfo::GlobalRefsType::iterator I =
4012 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
4014 if (I != CurModule.GlobalRefs.end()) {
4015 V = I->second; // Placeholder already exists, use it...
4016 (yyvsp[0].ValIDVal).destroy();
4019 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4020 Name = (yyvsp[0].ValIDVal).Name;
4021 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4022 GEN_ERROR("Invalid reference to global");
4024 // Create the forward referenced global.
4026 if (const FunctionType *FTy =
4027 dyn_cast<FunctionType>(PT->getElementType())) {
4028 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
4029 CurModule.CurrentModule);
4031 GV = new GlobalVariable(PT->getElementType(), false,
4032 GlobalValue::ExternalLinkage, 0,
4033 Name, CurModule.CurrentModule);
4036 // Keep track of the fact that we have a forward ref to recycle it
4037 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4042 (yyval.ConstVal) = cast<GlobalValue>(V);
4043 delete (yyvsp[-1].TypeVal); // Free the type handle
4049 #line 1734 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4051 if (!UpRefs.empty())
4052 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4053 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4054 GEN_ERROR("Mismatched types for constant expression: " +
4055 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4056 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4057 delete (yyvsp[-1].TypeVal);
4063 #line 1744 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4065 if (!UpRefs.empty())
4066 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4067 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4068 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4069 GEN_ERROR("Cannot create a null initialized value of this type");
4070 (yyval.ConstVal) = Constant::getNullValue(Ty);
4071 delete (yyvsp[-1].TypeVal);
4077 #line 1754 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4078 { // integral constants
4079 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4080 GEN_ERROR("Constant value doesn't fit in type");
4081 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4087 #line 1760 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4088 { // arbitrary precision integer constants
4089 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4090 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4091 GEN_ERROR("Constant value does not fit in type");
4093 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4094 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4095 delete (yyvsp[0].APIntVal);
4101 #line 1770 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4102 { // integral constants
4103 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4104 GEN_ERROR("Constant value doesn't fit in type");
4105 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4111 #line 1776 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4112 { // arbitrary precision integer constants
4113 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4114 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4115 GEN_ERROR("Constant value does not fit in type");
4117 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4118 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4119 delete (yyvsp[0].APIntVal);
4125 #line 1786 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4126 { // Boolean constants
4127 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4128 (yyval.ConstVal) = ConstantInt::getTrue();
4134 #line 1791 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4135 { // Boolean constants
4136 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4137 (yyval.ConstVal) = ConstantInt::getFalse();
4143 #line 1796 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4144 { // Float & Double constants
4145 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4146 GEN_ERROR("Floating point constant invalid for type");
4147 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4153 #line 1804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4155 if (!UpRefs.empty())
4156 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4157 Constant *Val = (yyvsp[-3].ConstVal);
4158 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4159 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4160 GEN_ERROR("invalid cast opcode for cast from '" +
4161 Val->getType()->getDescription() + "' to '" +
4162 DestTy->getDescription() + "'");
4163 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4164 delete (yyvsp[-1].TypeVal);
4169 #line 1816 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4171 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4172 GEN_ERROR("GetElementPtr requires a pointer operand");
4175 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4178 GEN_ERROR("Index list invalid for constant getelementptr");
4180 SmallVector<Constant*, 8> IdxVec;
4181 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4182 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4183 IdxVec.push_back(C);
4185 GEN_ERROR("Indices to constant getelementptr must be constants");
4187 delete (yyvsp[-1].ValueList);
4189 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4195 #line 1838 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4197 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4198 GEN_ERROR("Select condition must be of boolean type");
4199 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4200 GEN_ERROR("Select operand types must match");
4201 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4207 #line 1846 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4209 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4210 GEN_ERROR("Binary operator types must match");
4212 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4217 #line 1852 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4219 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4220 GEN_ERROR("Logical operator types must match");
4221 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4222 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4223 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4224 GEN_ERROR("Logical operator requires integral operands");
4226 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4232 #line 1863 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4234 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4235 GEN_ERROR("icmp operand types must match");
4236 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4241 #line 1868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4243 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4244 GEN_ERROR("fcmp operand types must match");
4245 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4250 #line 1873 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4252 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4253 GEN_ERROR("Invalid extractelement operands");
4254 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4260 #line 1879 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4262 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4263 GEN_ERROR("Invalid insertelement operands");
4264 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4270 #line 1885 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4272 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4273 GEN_ERROR("Invalid shufflevector operands");
4274 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4280 #line 1894 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4282 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4288 #line 1898 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4290 (yyval.ConstVector) = new std::vector<Constant*>();
4291 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4297 #line 1906 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4298 { (yyval.BoolVal) = false; ;}
4302 #line 1906 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4303 { (yyval.BoolVal) = true; ;}
4307 #line 1917 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4309 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4310 CurModule.ModuleDone();
4316 #line 1922 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4318 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4319 CurModule.ModuleDone();
4325 #line 1935 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4326 { CurFun.isDeclare = false; ;}
4330 #line 1935 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4332 CurFun.FunctionDone();
4338 #line 1939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4339 { CurFun.isDeclare = true; ;}
4343 #line 1939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4350 #line 1942 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4357 #line 1945 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4359 // Emit an error if there are any unresolved types left.
4360 if (!CurModule.LateResolveTypes.empty()) {
4361 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4362 if (DID.Type == ValID::LocalName) {
4363 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4365 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4373 #line 1957 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4375 if (!UpRefs.empty())
4376 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4377 // Eagerly resolve types. This is not an optimization, this is a
4378 // requirement that is due to the fact that we could have this:
4380 // %list = type { %list * }
4381 // %list = type { %list * } ; repeated type decl
4383 // If types are not resolved eagerly, then the two types will not be
4384 // determined to be the same type!
4386 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4388 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4390 // If this is a named type that is not a redefinition, add it to the slot
4392 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4395 delete (yyvsp[0].TypeVal);
4401 #line 1981 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4403 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4405 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4407 // If this is a named type that is not a redefinition, add it to the slot
4409 CurModule.Types.push_back((yyvsp[0].PrimType));
4416 #line 1992 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4418 /* "Externally Visible" Linkage */
4419 if ((yyvsp[0].ConstVal) == 0)
4420 GEN_ERROR("Global value initializer is not a constant");
4421 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4422 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4428 #line 1999 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4435 #line 2002 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4437 if ((yyvsp[0].ConstVal) == 0)
4438 GEN_ERROR("Global value initializer is not a constant");
4439 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4445 #line 2007 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4452 #line 2010 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4454 if (!UpRefs.empty())
4455 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4456 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4458 delete (yyvsp[0].TypeVal);
4463 #line 2016 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4471 #line 2020 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4478 #line 2023 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4485 #line 2029 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4487 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4488 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4489 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4490 free((yyvsp[0].StrVal));
4492 if (AsmSoFar.empty())
4493 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4495 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4501 #line 2042 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4503 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4504 free((yyvsp[0].StrVal));
4509 #line 2046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4511 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4512 free((yyvsp[0].StrVal));
4517 #line 2053 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4519 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4520 free((yyvsp[0].StrVal));
4526 #line 2058 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4528 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4529 free((yyvsp[0].StrVal));
4535 #line 2063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4542 #line 2072 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4544 if (!UpRefs.empty())
4545 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4546 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4547 GEN_ERROR("void typed arguments are invalid");
4548 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4549 (yyval.ArgList) = (yyvsp[-4].ArgList);
4550 (yyvsp[-4].ArgList)->push_back(E);
4556 #line 2082 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4558 if (!UpRefs.empty())
4559 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4560 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4561 GEN_ERROR("void typed arguments are invalid");
4562 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4563 (yyval.ArgList) = new ArgListType;
4564 (yyval.ArgList)->push_back(E);
4570 #line 2093 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4572 (yyval.ArgList) = (yyvsp[0].ArgList);
4578 #line 2097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4580 (yyval.ArgList) = (yyvsp[-2].ArgList);
4581 struct ArgListEntry E;
4582 E.Ty = new PATypeHolder(Type::VoidTy);
4584 E.Attrs = FunctionType::NoAttributeSet;
4585 (yyval.ArgList)->push_back(E);
4591 #line 2106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4593 (yyval.ArgList) = new ArgListType;
4594 struct ArgListEntry E;
4595 E.Ty = new PATypeHolder(Type::VoidTy);
4597 E.Attrs = FunctionType::NoAttributeSet;
4598 (yyval.ArgList)->push_back(E);
4604 #line 2115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4606 (yyval.ArgList) = 0;
4612 #line 2121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4614 UnEscapeLexed((yyvsp[-6].StrVal));
4615 std::string FunctionName((yyvsp[-6].StrVal));
4616 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4618 // Check the function result for abstractness if this is a define. We should
4619 // have no abstract types at this point
4620 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4621 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4623 std::vector<const Type*> ParamTypeList;
4624 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4625 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4626 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4627 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4628 const Type* Ty = I->Ty->get();
4629 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4630 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4631 ParamTypeList.push_back(Ty);
4632 if (Ty != Type::VoidTy)
4633 ParamAttrs.push_back(I->Attrs);
4637 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4638 if (isVarArg) ParamTypeList.pop_back();
4640 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4642 const PointerType *PFT = PointerType::get(FT);
4643 delete (yyvsp[-7].TypeVal);
4646 if (!FunctionName.empty()) {
4647 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4649 ID = ValID::createGlobalID(CurModule.Values.size());
4653 // See if this function was forward referenced. If so, recycle the object.
4654 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4655 // Move the function to the end of the list, from whereever it was
4656 // previously inserted.
4657 Fn = cast<Function>(FWRef);
4658 CurModule.CurrentModule->getFunctionList().remove(Fn);
4659 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4660 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4661 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4662 if (Fn->getFunctionType() != FT ) {
4663 // The existing function doesn't have the same type. This is an overload
4665 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4666 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4667 // Neither the existing or the current function is a declaration and they
4668 // have the same name and same type. Clearly this is a redefinition.
4669 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4670 } if (Fn->isDeclaration()) {
4671 // Make sure to strip off any argument names so we can't get conflicts.
4672 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4676 } else { // Not already defined?
4677 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4678 CurModule.CurrentModule);
4680 InsertValue(Fn, CurModule.Values);
4683 CurFun.FunctionStart(Fn);
4685 if (CurFun.isDeclare) {
4686 // If we have declaration, always overwrite linkage. This will allow us to
4687 // correctly handle cases, when pointer to function is passed as argument to
4688 // another function.
4689 Fn->setLinkage(CurFun.Linkage);
4690 Fn->setVisibility(CurFun.Visibility);
4692 Fn->setCallingConv((yyvsp[-8].UIntVal));
4693 Fn->setAlignment((yyvsp[0].UIntVal));
4694 if ((yyvsp[-1].StrVal)) {
4695 Fn->setSection((yyvsp[-1].StrVal));
4696 free((yyvsp[-1].StrVal));
4699 // Add all of the arguments we parsed to the function...
4700 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4701 if (isVarArg) { // Nuke the last entry
4702 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4703 "Not a varargs marker!");
4704 delete (yyvsp[-4].ArgList)->back().Ty;
4705 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4707 Function::arg_iterator ArgIt = Fn->arg_begin();
4708 Function::arg_iterator ArgEnd = Fn->arg_end();
4710 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4711 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4712 delete I->Ty; // Delete the typeholder...
4713 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4719 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4726 #line 2234 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4728 (yyval.FunctionVal) = CurFun.CurrentFunction;
4730 // Make sure that we keep track of the linkage type even if there was a
4731 // previous "declare".
4732 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4733 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4738 #line 2245 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4740 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4746 #line 2250 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4748 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4749 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4750 (yyval.FunctionVal) = CurFun.CurrentFunction;
4751 CurFun.FunctionDone();
4757 #line 2262 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4759 (yyval.BoolVal) = false;
4765 #line 2266 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4767 (yyval.BoolVal) = true;
4773 #line 2271 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4774 { // A reference to a direct constant
4775 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4781 #line 2275 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4783 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4789 #line 2279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4790 { // Perhaps it's an FP constant?
4791 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4797 #line 2283 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4799 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4805 #line 2287 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4807 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4813 #line 2291 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4815 (yyval.ValIDVal) = ValID::createNull();
4821 #line 2295 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4823 (yyval.ValIDVal) = ValID::createUndef();
4829 #line 2299 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4830 { // A vector zero constant.
4831 (yyval.ValIDVal) = ValID::createZeroInit();
4837 #line 2303 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4838 { // Nonempty unsized packed vector
4839 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4840 int NumElements = (yyvsp[-1].ConstVector)->size();
4842 VectorType* pt = VectorType::get(ETy, NumElements);
4843 PATypeHolder* PTy = new PATypeHolder(
4851 // Verify all elements are correct type!
4852 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4853 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4854 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4855 ETy->getDescription() +"' as required!\nIt is of type '" +
4856 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4859 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
4860 delete PTy; delete (yyvsp[-1].ConstVector);
4866 #line 2328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4868 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4874 #line 2332 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4876 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4877 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4878 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4879 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4880 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4881 free((yyvsp[-2].StrVal));
4882 free((yyvsp[0].StrVal));
4888 #line 2346 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4889 { // Is it an integer reference...?
4890 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4896 #line 2350 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4898 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4904 #line 2354 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4905 { // Is it a named reference...?
4906 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4912 #line 2358 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4913 { // Is it a named reference...?
4914 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4920 #line 2370 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4922 if (!UpRefs.empty())
4923 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4924 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4925 delete (yyvsp[-1].TypeVal);
4931 #line 2379 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4933 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4939 #line 2383 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4940 { // Do not allow functions with 0 basic blocks
4941 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4947 #line 2392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4949 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4951 InsertValue((yyvsp[0].TermInstVal));
4952 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4953 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4959 #line 2401 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4961 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4962 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4963 if (CI2->getParent() == 0)
4964 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4965 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4966 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4972 #line 2410 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4973 { // Empty space between instruction lists
4974 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4980 #line 2414 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4981 { // Labelled (named) basic block
4982 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal)));
4988 #line 2419 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4989 { // Return with a result...
4990 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4996 #line 2423 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4997 { // Return with no result...
4998 (yyval.TermInstVal) = new ReturnInst();
5004 #line 2427 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5005 { // Unconditional Branch...
5006 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5008 (yyval.TermInstVal) = new BranchInst(tmpBB);
5013 #line 2432 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5015 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
5016 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
5018 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5020 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5022 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5027 #line 2442 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5029 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5031 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5033 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5034 (yyval.TermInstVal) = S;
5036 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5037 E = (yyvsp[-1].JumpTable)->end();
5038 for (; I != E; ++I) {
5039 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5040 S->addCase(CI, I->second);
5042 GEN_ERROR("Switch case is constant, but not a simple integer");
5044 delete (yyvsp[-1].JumpTable);
5050 #line 2461 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5052 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5054 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5056 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5057 (yyval.TermInstVal) = S;
5063 #line 2471 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5066 // Handle the short syntax
5067 const PointerType *PFTy = 0;
5068 const FunctionType *Ty = 0;
5069 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5070 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5071 // Pull out the types of all of the arguments...
5072 std::vector<const Type*> ParamTypes;
5073 FunctionType::ParamAttrsList ParamAttrs;
5074 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5075 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
5076 const Type *Ty = I->Val->getType();
5077 if (Ty == Type::VoidTy)
5078 GEN_ERROR("Short call syntax cannot be used with varargs");
5079 ParamTypes.push_back(Ty);
5080 ParamAttrs.push_back(I->Attrs);
5083 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5084 PFTy = PointerType::get(Ty);
5087 delete (yyvsp[-11].TypeVal);
5089 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5091 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5093 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5096 // Check the arguments
5098 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5099 // Make sure no arguments is a good thing!
5100 if (Ty->getNumParams() != 0)
5101 GEN_ERROR("No arguments passed to a function that "
5102 "expects arguments");
5103 } else { // Has arguments?
5104 // Loop through FunctionType's arguments and ensure they are specified
5106 FunctionType::param_iterator I = Ty->param_begin();
5107 FunctionType::param_iterator E = Ty->param_end();
5108 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5110 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5111 if (ArgI->Val->getType() != *I)
5112 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5113 (*I)->getDescription() + "'");
5114 Args.push_back(ArgI->Val);
5117 if (Ty->isVarArg()) {
5119 for (; ArgI != ArgE; ++ArgI)
5120 Args.push_back(ArgI->Val); // push the remaining varargs
5121 } else if (I != E || ArgI != ArgE)
5122 GEN_ERROR("Invalid number of parameters detected");
5125 // Create the InvokeInst
5126 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5127 II->setCallingConv((yyvsp[-12].UIntVal));
5128 (yyval.TermInstVal) = II;
5129 delete (yyvsp[-8].ValueRefList);
5135 #line 2539 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5137 (yyval.TermInstVal) = new UnwindInst();
5143 #line 2543 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5145 (yyval.TermInstVal) = new UnreachableInst();
5151 #line 2550 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5153 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5154 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5157 GEN_ERROR("May only switch on a constant pool value");
5159 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5161 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5166 #line 2561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5168 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5169 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5173 GEN_ERROR("May only switch on a constant pool value");
5175 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5177 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5182 #line 2574 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5184 // Is this definition named?? if so, assign the name...
5185 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5187 InsertValue((yyvsp[0].InstVal));
5188 (yyval.InstVal) = (yyvsp[0].InstVal);
5194 #line 2584 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5195 { // Used for PHI nodes
5196 if (!UpRefs.empty())
5197 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5198 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5199 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5201 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5203 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5204 delete (yyvsp[-5].TypeVal);
5209 #line 2595 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5211 (yyval.PHIList) = (yyvsp[-6].PHIList);
5212 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5214 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5216 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5221 #line 2605 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5223 if (!UpRefs.empty())
5224 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5225 // Used for call and invoke instructions
5226 (yyval.ValueRefList) = new ValueRefList();
5227 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5228 (yyval.ValueRefList)->push_back(E);
5229 delete (yyvsp[-2].TypeVal);
5234 #line 2614 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5236 if (!UpRefs.empty())
5237 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5238 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5239 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5240 (yyval.ValueRefList)->push_back(E);
5241 delete (yyvsp[-2].TypeVal);
5247 #line 2623 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5248 { (yyval.ValueRefList) = new ValueRefList(); ;}
5252 #line 2626 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5253 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5257 #line 2627 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5259 (yyval.ValueList) = (yyvsp[-2].ValueList);
5260 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5266 #line 2634 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5268 (yyval.BoolVal) = true;
5274 #line 2638 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5276 (yyval.BoolVal) = false;
5282 #line 2643 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5284 if (!UpRefs.empty())
5285 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5286 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5287 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5289 "Arithmetic operator requires integer, FP, or packed operands");
5290 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5291 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5292 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5293 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5294 GEN_ERROR("Remainder not supported on vector types");
5295 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5297 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5299 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5300 if ((yyval.InstVal) == 0)
5301 GEN_ERROR("binary operator returned null");
5302 delete (yyvsp[-3].TypeVal);
5307 #line 2664 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5309 if (!UpRefs.empty())
5310 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5311 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5312 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5313 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5314 GEN_ERROR("Logical operator requires integral operands");
5316 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5318 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5320 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5321 if ((yyval.InstVal) == 0)
5322 GEN_ERROR("binary operator returned null");
5323 delete (yyvsp[-3].TypeVal);
5328 #line 2681 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5330 if (!UpRefs.empty())
5331 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5332 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5333 GEN_ERROR("Vector types not supported by icmp instruction");
5334 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5336 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5338 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5339 if ((yyval.InstVal) == 0)
5340 GEN_ERROR("icmp operator returned null");
5341 delete (yyvsp[-3].TypeVal);
5346 #line 2695 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5348 if (!UpRefs.empty())
5349 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5350 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5351 GEN_ERROR("Vector types not supported by fcmp instruction");
5352 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5354 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5356 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5357 if ((yyval.InstVal) == 0)
5358 GEN_ERROR("fcmp operator returned null");
5359 delete (yyvsp[-3].TypeVal);
5364 #line 2709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5366 if (!UpRefs.empty())
5367 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5368 Value* Val = (yyvsp[-2].ValueVal);
5369 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5370 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5371 GEN_ERROR("invalid cast opcode for cast from '" +
5372 Val->getType()->getDescription() + "' to '" +
5373 DestTy->getDescription() + "'");
5374 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5375 delete (yyvsp[0].TypeVal);
5380 #line 2721 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5382 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5383 GEN_ERROR("select condition must be boolean");
5384 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5385 GEN_ERROR("select value types should match");
5386 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5392 #line 2729 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5394 if (!UpRefs.empty())
5395 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5396 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5397 delete (yyvsp[0].TypeVal);
5403 #line 2736 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5405 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5406 GEN_ERROR("Invalid extractelement operands");
5407 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5413 #line 2742 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5415 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5416 GEN_ERROR("Invalid insertelement operands");
5417 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5423 #line 2748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5425 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5426 GEN_ERROR("Invalid shufflevector operands");
5427 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5433 #line 2754 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5435 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5436 if (!Ty->isFirstClassType())
5437 GEN_ERROR("PHI node operands must be of first class type");
5438 (yyval.InstVal) = new PHINode(Ty);
5439 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5440 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5441 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5442 GEN_ERROR("All elements of a PHI node must be of the same type");
5443 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5444 (yyvsp[0].PHIList)->pop_front();
5446 delete (yyvsp[0].PHIList); // Free the list...
5452 #line 2770 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5455 // Handle the short syntax
5456 const PointerType *PFTy = 0;
5457 const FunctionType *Ty = 0;
5458 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5459 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5460 // Pull out the types of all of the arguments...
5461 std::vector<const Type*> ParamTypes;
5462 FunctionType::ParamAttrsList ParamAttrs;
5463 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5464 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5465 const Type *Ty = I->Val->getType();
5466 if (Ty == Type::VoidTy)
5467 GEN_ERROR("Short call syntax cannot be used with varargs");
5468 ParamTypes.push_back(Ty);
5469 ParamAttrs.push_back(I->Attrs);
5472 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5473 PFTy = PointerType::get(Ty);
5476 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5479 // Check the arguments
5481 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5482 // Make sure no arguments is a good thing!
5483 if (Ty->getNumParams() != 0)
5484 GEN_ERROR("No arguments passed to a function that "
5485 "expects arguments");
5486 } else { // Has arguments?
5487 // Loop through FunctionType's arguments and ensure they are specified
5490 FunctionType::param_iterator I = Ty->param_begin();
5491 FunctionType::param_iterator E = Ty->param_end();
5492 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5494 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5495 if (ArgI->Val->getType() != *I)
5496 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5497 (*I)->getDescription() + "'");
5498 Args.push_back(ArgI->Val);
5500 if (Ty->isVarArg()) {
5502 for (; ArgI != ArgE; ++ArgI)
5503 Args.push_back(ArgI->Val); // push the remaining varargs
5504 } else if (I != E || ArgI != ArgE)
5505 GEN_ERROR("Invalid number of parameters detected");
5507 // Create the call node
5508 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5509 CI->setTailCall((yyvsp[-7].BoolVal));
5510 CI->setCallingConv((yyvsp[-6].UIntVal));
5511 (yyval.InstVal) = CI;
5512 delete (yyvsp[-2].ValueRefList);
5513 delete (yyvsp[-5].TypeVal);
5519 #line 2833 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5521 (yyval.InstVal) = (yyvsp[0].InstVal);
5527 #line 2838 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5529 (yyval.BoolVal) = true;
5535 #line 2842 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5537 (yyval.BoolVal) = false;
5543 #line 2849 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5545 if (!UpRefs.empty())
5546 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5547 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5548 delete (yyvsp[-1].TypeVal);
5554 #line 2856 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5556 if (!UpRefs.empty())
5557 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5558 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5560 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5561 delete (yyvsp[-4].TypeVal);
5566 #line 2864 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5568 if (!UpRefs.empty())
5569 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5570 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5571 delete (yyvsp[-1].TypeVal);
5577 #line 2871 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5579 if (!UpRefs.empty())
5580 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5581 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5583 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5584 delete (yyvsp[-4].TypeVal);
5589 #line 2879 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5591 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5592 GEN_ERROR("Trying to free nonpointer type " +
5593 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5594 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5600 #line 2887 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5602 if (!UpRefs.empty())
5603 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5604 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5605 GEN_ERROR("Can't load from nonpointer type: " +
5606 (*(yyvsp[-1].TypeVal))->getDescription());
5607 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5608 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5609 (*(yyvsp[-1].TypeVal))->getDescription());
5610 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5612 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5613 delete (yyvsp[-1].TypeVal);
5618 #line 2901 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5620 if (!UpRefs.empty())
5621 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5622 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5624 GEN_ERROR("Can't store to a nonpointer type: " +
5625 (*(yyvsp[-1].TypeVal))->getDescription());
5626 const Type *ElTy = PT->getElementType();
5627 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5628 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5629 "' into space of type '" + ElTy->getDescription() + "'");
5631 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5633 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5634 delete (yyvsp[-1].TypeVal);
5639 #line 2918 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5641 if (!UpRefs.empty())
5642 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5643 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5644 GEN_ERROR("getelementptr insn requires pointer operand");
5646 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5647 GEN_ERROR("Invalid getelementptr indices for type '" +
5648 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5649 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5651 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5652 delete (yyvsp[-2].TypeVal);
5653 delete (yyvsp[0].ValueList);
5661 /* Line 1126 of yacc.c. */
5662 #line 5663 "llvmAsmParser.tab.c"
5668 YY_STACK_PRINT (yyss, yyssp);
5673 /* Now `shift' the result of the reduction. Determine what state
5674 that goes to, based on the state we popped back to and the rule
5675 number reduced by. */
5679 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5680 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5681 yystate = yytable[yystate];
5683 yystate = yydefgoto[yyn - YYNTOKENS];
5688 /*------------------------------------.
5689 | yyerrlab -- here on detecting error |
5690 `------------------------------------*/
5692 /* If not already recovering from an error, report this error. */
5697 yyn = yypact[yystate];
5699 if (YYPACT_NINF < yyn && yyn < YYLAST)
5701 int yytype = YYTRANSLATE (yychar);
5702 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5703 YYSIZE_T yysize = yysize0;
5705 int yysize_overflow = 0;
5707 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5708 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5712 /* This is so xgettext sees the translatable formats that are
5713 constructed on the fly. */
5714 YY_("syntax error, unexpected %s");
5715 YY_("syntax error, unexpected %s, expecting %s");
5716 YY_("syntax error, unexpected %s, expecting %s or %s");
5717 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5718 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5722 static char const yyunexpected[] = "syntax error, unexpected %s";
5723 static char const yyexpecting[] = ", expecting %s";
5724 static char const yyor[] = " or %s";
5725 char yyformat[sizeof yyunexpected
5726 + sizeof yyexpecting - 1
5727 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5728 * (sizeof yyor - 1))];
5729 char const *yyprefix = yyexpecting;
5731 /* Start YYX at -YYN if negative to avoid negative indexes in
5733 int yyxbegin = yyn < 0 ? -yyn : 0;
5735 /* Stay within bounds of both yycheck and yytname. */
5736 int yychecklim = YYLAST - yyn;
5737 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5740 yyarg[0] = yytname[yytype];
5741 yyfmt = yystpcpy (yyformat, yyunexpected);
5743 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5744 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5746 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5750 yyformat[sizeof yyunexpected - 1] = '\0';
5753 yyarg[yycount++] = yytname[yyx];
5754 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5755 yysize_overflow |= yysize1 < yysize;
5757 yyfmt = yystpcpy (yyfmt, yyprefix);
5761 yyf = YY_(yyformat);
5762 yysize1 = yysize + yystrlen (yyf);
5763 yysize_overflow |= yysize1 < yysize;
5766 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5767 yymsg = (char *) YYSTACK_ALLOC (yysize);
5770 /* Avoid sprintf, as that infringes on the user's name space.
5771 Don't have undefined behavior even if the translation
5772 produced a string with the wrong number of "%s"s. */
5775 while ((*yyp = *yyf))
5777 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5779 yyp += yytnamerr (yyp, yyarg[yyi++]);
5789 YYSTACK_FREE (yymsg);
5793 yyerror (YY_("syntax error"));
5794 goto yyexhaustedlab;
5798 #endif /* YYERROR_VERBOSE */
5799 yyerror (YY_("syntax error"));
5804 if (yyerrstatus == 3)
5806 /* If just tried and failed to reuse look-ahead token after an
5807 error, discard it. */
5809 if (yychar <= YYEOF)
5811 /* Return failure if at end of input. */
5812 if (yychar == YYEOF)
5817 yydestruct ("Error: discarding", yytoken, &yylval);
5822 /* Else will try to reuse look-ahead token after shifting the error
5827 /*---------------------------------------------------.
5828 | yyerrorlab -- error raised explicitly by YYERROR. |
5829 `---------------------------------------------------*/
5832 /* Pacify compilers like GCC when the user code never invokes
5833 YYERROR and the label yyerrorlab therefore never appears in user
5844 /*-------------------------------------------------------------.
5845 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5846 `-------------------------------------------------------------*/
5848 yyerrstatus = 3; /* Each real token shifted decrements this. */
5852 yyn = yypact[yystate];
5853 if (yyn != YYPACT_NINF)
5856 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5864 /* Pop the current state because it cannot handle the error token. */
5869 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5872 YY_STACK_PRINT (yyss, yyssp);
5881 /* Shift the error token. */
5882 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5888 /*-------------------------------------.
5889 | yyacceptlab -- YYACCEPT comes here. |
5890 `-------------------------------------*/
5895 /*-----------------------------------.
5896 | yyabortlab -- YYABORT comes here. |
5897 `-----------------------------------*/
5903 /*-------------------------------------------------.
5904 | yyexhaustedlab -- memory exhaustion comes here. |
5905 `-------------------------------------------------*/
5907 yyerror (YY_("memory exhausted"));
5913 if (yychar != YYEOF && yychar != YYEMPTY)
5914 yydestruct ("Cleanup: discarding lookahead",
5916 while (yyssp != yyss)
5918 yydestruct ("Cleanup: popping",
5919 yystos[*yyssp], yyvsp);
5924 YYSTACK_FREE (yyss);
5930 #line 2935 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5933 // common code from the two 'RunVMAsmParser' functions
5934 static Module* RunParser(Module * M) {
5936 llvmAsmlineno = 1; // Reset the current line number...
5937 CurModule.CurrentModule = M;
5942 // Check to make sure the parser succeeded
5945 delete ParserResult;
5949 // Check to make sure that parsing produced a result
5953 // Reset ParserResult variable while saving its value for the result.
5954 Module *Result = ParserResult;
5960 void llvm::GenerateError(const std::string &message, int LineNo) {
5961 if (LineNo == -1) LineNo = llvmAsmlineno;
5962 // TODO: column number in exception
5964 TheParseError->setError(CurFilename, message, LineNo);
5968 int yyerror(const char *ErrorMsg) {
5970 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5971 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5972 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5973 if (yychar != YYEMPTY && yychar != 0)
5974 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5976 GenerateError(errMsg);