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
86 ZEROINITIALIZER = 277,
129 X86_STDCALLCC_TOK = 320,
130 X86_FASTCALLCC_TOK = 321,
196 EXTRACTELEMENT = 387,
202 #define ESINT64VAL 258
203 #define EUINT64VAL 259
219 #define STRINGCONSTANT 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
249 #define POINTERSIZE 305
258 #define SIDEEFFECT 314
261 #define CSRETCC_TOK 317
262 #define FASTCC_TOK 318
263 #define COLDCC_TOK 319
264 #define X86_STDCALLCC_TOK 320
265 #define X86_FASTCALLCC_TOK 321
266 #define DATALAYOUT 322
272 #define UNREACHABLE 328
312 #define GETELEMENTPTR 368
331 #define EXTRACTELEMENT 387
332 #define INSERTELEMENT 388
333 #define SHUFFLEVECTOR 389
338 /* Copy the first part of user declarations. */
339 #line 14 "/proj/llvm/llvm-3/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/SymbolTable.h"
347 #include "llvm/Support/GetElementPtrTypeIterator.h"
348 #include "llvm/Support/CommandLine.h"
349 #include "llvm/ADT/STLExtras.h"
350 #include "llvm/Support/MathExtras.h"
351 #include "llvm/Support/Streams.h"
359 // The following is a gross hack. In order to rid the libAsmParser library of
360 // exceptions, we have to have a way of getting the yyparse function to go into
361 // an error situation. So, whenever we want an error to occur, the GenerateError
362 // function (see bottom of file) sets TriggerError. Then, at the end of each
363 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
364 // (a goto) to put YACC in error state. Furthermore, several calls to
365 // GenerateError are made from inside productions and they must simulate the
366 // previous exception behavior by exiting the production immediately. We have
367 // replaced these with the GEN_ERROR macro which calls GeneratError and then
368 // immediately invokes YYERROR. This would be so much cleaner if it was a
369 // recursive descent parser.
370 static bool TriggerError = false;
371 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
372 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
374 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
375 int yylex(); // declaration" of xxx warnings.
379 std::string CurFilename;
382 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
383 cl::Hidden, cl::init(false));
386 using namespace llvm;
388 static Module *ParserResult;
390 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
391 // relating to upreferences in the input stream.
393 //#define DEBUG_UPREFS 1
395 #define UR_OUT(X) cerr << X
400 #define YYERROR_VERBOSE 1
402 static GlobalVariable *CurGV;
405 // This contains info used when building the body of a function. It is
406 // destroyed when the function is completed.
408 typedef std::vector<Value *> ValueList; // Numbered defs
411 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
412 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
414 static struct PerModuleInfo {
415 Module *CurrentModule;
416 std::map<const Type *, ValueList> Values; // Module level numbered definitions
417 std::map<const Type *,ValueList> LateResolveValues;
418 std::vector<PATypeHolder> Types;
419 std::map<ValID, PATypeHolder> LateResolveTypes;
421 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
422 /// how they were referenced and on which line of the input they came from so
423 /// that we can resolve them later and print error messages as appropriate.
424 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
426 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
427 // references to global values. Global values may be referenced before they
428 // are defined, and if so, the temporary object that they represent is held
429 // here. This is used for forward references of GlobalValues.
431 typedef std::map<std::pair<const PointerType *,
432 ValID>, GlobalValue*> GlobalRefsType;
433 GlobalRefsType GlobalRefs;
436 // If we could not resolve some functions at function compilation time
437 // (calls to functions before they are defined), resolve them now... Types
438 // are resolved when the constant pool has been completely parsed.
440 ResolveDefinitions(LateResolveValues);
444 // Check to make sure that all global value forward references have been
447 if (!GlobalRefs.empty()) {
448 std::string UndefinedReferences = "Unresolved global references exist:\n";
450 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
452 UndefinedReferences += " " + I->first.first->getDescription() + " " +
453 I->first.second.getName() + "\n";
455 GenerateError(UndefinedReferences);
459 Values.clear(); // Clear out function local definitions
464 // GetForwardRefForGlobal - Check to see if there is a forward reference
465 // for this global. If so, remove it from the GlobalRefs map and return it.
466 // If not, just return null.
467 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
468 // Check to see if there is a forward reference to this global variable...
469 // if there is, eliminate it and patch the reference to use the new def'n.
470 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
471 GlobalValue *Ret = 0;
472 if (I != GlobalRefs.end()) {
479 bool TypeIsUnresolved(PATypeHolder* PATy) {
480 // If it isn't abstract, its resolved
481 const Type* Ty = PATy->get();
482 if (!Ty->isAbstract())
484 // Traverse the type looking for abstract types. If it isn't abstract then
485 // we don't need to traverse that leg of the type.
486 std::vector<const Type*> WorkList, SeenList;
487 WorkList.push_back(Ty);
488 while (!WorkList.empty()) {
489 const Type* Ty = WorkList.back();
490 SeenList.push_back(Ty);
492 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
493 // Check to see if this is an unresolved type
494 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
495 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
496 for ( ; I != E; ++I) {
497 if (I->second.get() == OpTy)
500 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
501 const Type* TheTy = SeqTy->getElementType();
502 if (TheTy->isAbstract() && TheTy != Ty) {
503 std::vector<const Type*>::iterator I = SeenList.begin(),
509 WorkList.push_back(TheTy);
511 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
512 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
513 const Type* TheTy = StrTy->getElementType(i);
514 if (TheTy->isAbstract() && TheTy != Ty) {
515 std::vector<const Type*>::iterator I = SeenList.begin(),
521 WorkList.push_back(TheTy);
532 static struct PerFunctionInfo {
533 Function *CurrentFunction; // Pointer to current function being created
535 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
536 std::map<const Type*, ValueList> LateResolveValues;
537 bool isDeclare; // Is this function a forward declararation?
538 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
540 /// BBForwardRefs - When we see forward references to basic blocks, keep
541 /// track of them here.
542 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
543 std::vector<BasicBlock*> NumberedBlocks;
546 inline PerFunctionInfo() {
549 Linkage = GlobalValue::ExternalLinkage;
552 inline void FunctionStart(Function *M) {
557 void FunctionDone() {
558 NumberedBlocks.clear();
560 // Any forward referenced blocks left?
561 if (!BBForwardRefs.empty()) {
562 GenerateError("Undefined reference to label " +
563 BBForwardRefs.begin()->first->getName());
567 // Resolve all forward references now.
568 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
570 Values.clear(); // Clear out function local definitions
573 Linkage = GlobalValue::ExternalLinkage;
575 } CurFun; // Info for the current function...
577 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
580 //===----------------------------------------------------------------------===//
581 // Code to handle definitions of all the types
582 //===----------------------------------------------------------------------===//
584 static int InsertValue(Value *V,
585 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
586 if (V->hasName()) return -1; // Is this a numbered definition?
588 // Yes, insert the value into the value table...
589 ValueList &List = ValueTab[V->getType()];
591 return List.size()-1;
594 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
596 case ValID::NumberVal: // Is it a numbered definition?
597 // Module constants occupy the lowest numbered slots...
598 if ((unsigned)D.Num < CurModule.Types.size())
599 return CurModule.Types[(unsigned)D.Num];
601 case ValID::NameVal: // Is it a named definition?
602 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
603 D.destroy(); // Free old strdup'd memory...
608 GenerateError("Internal parser error: Invalid symbol type reference!");
612 // If we reached here, we referenced either a symbol that we don't know about
613 // or an id number that hasn't been read yet. We may be referencing something
614 // forward, so just create an entry to be resolved later and get to it...
616 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
619 if (inFunctionScope()) {
620 if (D.Type == ValID::NameVal) {
621 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
624 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
629 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
630 if (I != CurModule.LateResolveTypes.end())
633 Type *Typ = OpaqueType::get();
634 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
638 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
639 SymbolTable &SymTab =
640 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
641 CurModule.CurrentModule->getSymbolTable();
642 return SymTab.lookup(Ty, Name);
645 // getValNonImprovising - Look up the value specified by the provided type and
646 // the provided ValID. If the value exists and has already been defined, return
647 // it. Otherwise return null.
649 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
650 if (isa<FunctionType>(Ty)) {
651 GenerateError("Functions are not values and "
652 "must be referenced as pointers");
657 case ValID::NumberVal: { // Is it a numbered definition?
658 unsigned Num = (unsigned)D.Num;
660 // Module constants occupy the lowest numbered slots...
661 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
662 if (VI != CurModule.Values.end()) {
663 if (Num < VI->second.size())
664 return VI->second[Num];
665 Num -= VI->second.size();
668 // Make sure that our type is within bounds
669 VI = CurFun.Values.find(Ty);
670 if (VI == CurFun.Values.end()) return 0;
672 // Check that the number is within bounds...
673 if (VI->second.size() <= Num) return 0;
675 return VI->second[Num];
678 case ValID::NameVal: { // Is it a named definition?
679 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
680 if (N == 0) return 0;
682 D.destroy(); // Free old strdup'd memory...
686 // Check to make sure that "Ty" is an integral type, and that our
687 // value will fit into the specified type...
688 case ValID::ConstSIntVal: // Is it a constant pool reference??
689 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
690 GenerateError("Signed integral constant '" +
691 itostr(D.ConstPool64) + "' is invalid for type '" +
692 Ty->getDescription() + "'!");
695 return ConstantInt::get(Ty, D.ConstPool64);
697 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
698 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
699 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
700 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
701 "' is invalid or out of range!");
703 } else { // This is really a signed reference. Transmogrify.
704 return ConstantInt::get(Ty, D.ConstPool64);
707 return ConstantInt::get(Ty, D.UConstPool64);
710 case ValID::ConstFPVal: // Is it a floating point const pool reference?
711 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
712 GenerateError("FP constant invalid for type!!");
715 return ConstantFP::get(Ty, D.ConstPoolFP);
717 case ValID::ConstNullVal: // Is it a null value?
718 if (!isa<PointerType>(Ty)) {
719 GenerateError("Cannot create a a non pointer null!");
722 return ConstantPointerNull::get(cast<PointerType>(Ty));
724 case ValID::ConstUndefVal: // Is it an undef value?
725 return UndefValue::get(Ty);
727 case ValID::ConstZeroVal: // Is it a zero value?
728 return Constant::getNullValue(Ty);
730 case ValID::ConstantVal: // Fully resolved constant?
731 if (D.ConstantValue->getType() != Ty) {
732 GenerateError("Constant expression type different from required type!");
735 return D.ConstantValue;
737 case ValID::InlineAsmVal: { // Inline asm expression
738 const PointerType *PTy = dyn_cast<PointerType>(Ty);
739 const FunctionType *FTy =
740 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
741 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
742 GenerateError("Invalid type for asm constraint string!");
745 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
746 D.IAD->HasSideEffects);
747 D.destroy(); // Free InlineAsmDescriptor.
751 assert(0 && "Unhandled case!");
755 assert(0 && "Unhandled case!");
759 // getVal - This function is identical to getValNonImprovising, except that if a
760 // value is not already defined, it "improvises" by creating a placeholder var
761 // that looks and acts just like the requested variable. When the value is
762 // defined later, all uses of the placeholder variable are replaced with the
765 static Value *getVal(const Type *Ty, const ValID &ID) {
766 if (Ty == Type::LabelTy) {
767 GenerateError("Cannot use a basic block here");
771 // See if the value has already been defined.
772 Value *V = getValNonImprovising(Ty, ID);
774 if (TriggerError) return 0;
776 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
777 GenerateError("Invalid use of a composite type!");
781 // If we reached here, we referenced either a symbol that we don't know about
782 // or an id number that hasn't been read yet. We may be referencing something
783 // forward, so just create an entry to be resolved later and get to it...
785 V = new Argument(Ty);
787 // Remember where this forward reference came from. FIXME, shouldn't we try
788 // to recycle these things??
789 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
792 if (inFunctionScope())
793 InsertValue(V, CurFun.LateResolveValues);
795 InsertValue(V, CurModule.LateResolveValues);
799 /// getBBVal - This is used for two purposes:
800 /// * If isDefinition is true, a new basic block with the specified ID is being
802 /// * If isDefinition is true, this is a reference to a basic block, which may
803 /// or may not be a forward reference.
805 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
806 assert(inFunctionScope() && "Can't get basic block at global scope!");
812 GenerateError("Illegal label reference " + ID.getName());
814 case ValID::NumberVal: // Is it a numbered definition?
815 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
816 CurFun.NumberedBlocks.resize(ID.Num+1);
817 BB = CurFun.NumberedBlocks[ID.Num];
819 case ValID::NameVal: // Is it a named definition?
821 if (Value *N = CurFun.CurrentFunction->
822 getSymbolTable().lookup(Type::LabelTy, Name))
823 BB = cast<BasicBlock>(N);
827 // See if the block has already been defined.
829 // If this is the definition of the block, make sure the existing value was
830 // just a forward reference. If it was a forward reference, there will be
831 // an entry for it in the PlaceHolderInfo map.
832 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
833 // The existing value was a definition, not a forward reference.
834 GenerateError("Redefinition of label " + ID.getName());
838 ID.destroy(); // Free strdup'd memory.
842 // Otherwise this block has not been seen before.
843 BB = new BasicBlock("", CurFun.CurrentFunction);
844 if (ID.Type == ValID::NameVal) {
845 BB->setName(ID.Name);
847 CurFun.NumberedBlocks[ID.Num] = BB;
850 // If this is not a definition, keep track of it so we can use it as a forward
853 // Remember where this forward reference came from.
854 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
856 // The forward declaration could have been inserted anywhere in the
857 // function: insert it into the correct place now.
858 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
859 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
866 //===----------------------------------------------------------------------===//
867 // Code to handle forward references in instructions
868 //===----------------------------------------------------------------------===//
870 // This code handles the late binding needed with statements that reference
871 // values not defined yet... for example, a forward branch, or the PHI node for
874 // This keeps a table (CurFun.LateResolveValues) of all such forward references
875 // and back patchs after we are done.
878 // ResolveDefinitions - If we could not resolve some defs at parsing
879 // time (forward branches, phi functions for loops, etc...) resolve the
883 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
884 std::map<const Type*,ValueList> *FutureLateResolvers) {
885 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
886 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
887 E = LateResolvers.end(); LRI != E; ++LRI) {
888 ValueList &List = LRI->second;
889 while (!List.empty()) {
890 Value *V = List.back();
893 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
894 CurModule.PlaceHolderInfo.find(V);
895 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
897 ValID &DID = PHI->second.first;
899 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
903 V->replaceAllUsesWith(TheRealValue);
905 CurModule.PlaceHolderInfo.erase(PHI);
906 } else if (FutureLateResolvers) {
907 // Functions have their unresolved items forwarded to the module late
909 InsertValue(V, *FutureLateResolvers);
911 if (DID.Type == ValID::NameVal) {
912 GenerateError("Reference to an invalid definition: '" +DID.getName()+
913 "' of type '" + V->getType()->getDescription() + "'",
917 GenerateError("Reference to an invalid definition: #" +
918 itostr(DID.Num) + " of type '" +
919 V->getType()->getDescription() + "'",
927 LateResolvers.clear();
930 // ResolveTypeTo - A brand new type was just declared. This means that (if
931 // name is not null) things referencing Name can be resolved. Otherwise, things
932 // refering to the number can be resolved. Do this now.
934 static void ResolveTypeTo(char *Name, const Type *ToTy) {
936 if (Name) D = ValID::create(Name);
937 else D = ValID::create((int)CurModule.Types.size());
939 std::map<ValID, PATypeHolder>::iterator I =
940 CurModule.LateResolveTypes.find(D);
941 if (I != CurModule.LateResolveTypes.end()) {
942 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
943 CurModule.LateResolveTypes.erase(I);
947 // setValueName - Set the specified value to the name given. The name may be
948 // null potentially, in which case this is a noop. The string passed in is
949 // assumed to be a malloc'd string buffer, and is free'd by this function.
951 static void setValueName(Value *V, char *NameStr) {
953 std::string Name(NameStr); // Copy string
954 free(NameStr); // Free old string
956 if (V->getType() == Type::VoidTy) {
957 GenerateError("Can't assign name '" + Name+"' to value with void type!");
961 assert(inFunctionScope() && "Must be in function scope!");
962 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
963 if (ST.lookup(V->getType(), Name)) {
964 GenerateError("Redefinition of value named '" + Name + "' in the '" +
965 V->getType()->getDescription() + "' type plane!");
974 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
975 /// this is a declaration, otherwise it is a definition.
976 static GlobalVariable *
977 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
978 bool isConstantGlobal, const Type *Ty,
979 Constant *Initializer) {
980 if (isa<FunctionType>(Ty)) {
981 GenerateError("Cannot declare global vars of function type!");
985 const PointerType *PTy = PointerType::get(Ty);
989 Name = NameStr; // Copy string
990 free(NameStr); // Free old string
993 // See if this global value was forward referenced. If so, recycle the
997 ID = ValID::create((char*)Name.c_str());
999 ID = ValID::create((int)CurModule.Values[PTy].size());
1002 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1003 // Move the global to the end of the list, from whereever it was
1004 // previously inserted.
1005 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1006 CurModule.CurrentModule->getGlobalList().remove(GV);
1007 CurModule.CurrentModule->getGlobalList().push_back(GV);
1008 GV->setInitializer(Initializer);
1009 GV->setLinkage(Linkage);
1010 GV->setConstant(isConstantGlobal);
1011 InsertValue(GV, CurModule.Values);
1015 // If this global has a name, check to see if there is already a definition
1016 // of this global in the module. If so, merge as appropriate. Note that
1017 // this is really just a hack around problems in the CFE. :(
1018 if (!Name.empty()) {
1019 // We are a simple redefinition of a value, check to see if it is defined
1020 // the same as the old one.
1021 if (GlobalVariable *EGV =
1022 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
1023 // We are allowed to redefine a global variable in two circumstances:
1024 // 1. If at least one of the globals is uninitialized or
1025 // 2. If both initializers have the same value.
1027 if (!EGV->hasInitializer() || !Initializer ||
1028 EGV->getInitializer() == Initializer) {
1030 // Make sure the existing global version gets the initializer! Make
1031 // sure that it also gets marked const if the new version is.
1032 if (Initializer && !EGV->hasInitializer())
1033 EGV->setInitializer(Initializer);
1034 if (isConstantGlobal)
1035 EGV->setConstant(true);
1036 EGV->setLinkage(Linkage);
1040 GenerateError("Redefinition of global variable named '" + Name +
1041 "' in the '" + Ty->getDescription() + "' type plane!");
1046 // Otherwise there is no existing GV to use, create one now.
1047 GlobalVariable *GV =
1048 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1049 CurModule.CurrentModule);
1050 InsertValue(GV, CurModule.Values);
1054 // setTypeName - Set the specified type to the name given. The name may be
1055 // null potentially, in which case this is a noop. The string passed in is
1056 // assumed to be a malloc'd string buffer, and is freed by this function.
1058 // This function returns true if the type has already been defined, but is
1059 // allowed to be redefined in the specified context. If the name is a new name
1060 // for the type plane, it is inserted and false is returned.
1061 static bool setTypeName(const Type *T, char *NameStr) {
1062 assert(!inFunctionScope() && "Can't give types function-local names!");
1063 if (NameStr == 0) return false;
1065 std::string Name(NameStr); // Copy string
1066 free(NameStr); // Free old string
1068 // We don't allow assigning names to void type
1069 if (T == Type::VoidTy) {
1070 GenerateError("Can't assign name '" + Name + "' to the void type!");
1074 // Set the type name, checking for conflicts as we do so.
1075 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1077 if (AlreadyExists) { // Inserting a name that is already defined???
1078 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1079 assert(Existing && "Conflict but no matching type?");
1081 // There is only one case where this is allowed: when we are refining an
1082 // opaque type. In this case, Existing will be an opaque type.
1083 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1084 // We ARE replacing an opaque type!
1085 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1089 // Otherwise, this is an attempt to redefine a type. That's okay if
1090 // the redefinition is identical to the original. This will be so if
1091 // Existing and T point to the same Type object. In this one case we
1092 // allow the equivalent redefinition.
1093 if (Existing == T) return true; // Yes, it's equal.
1095 // Any other kind of (non-equivalent) redefinition is an error.
1096 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1097 T->getDescription() + "' type plane!");
1103 //===----------------------------------------------------------------------===//
1104 // Code for handling upreferences in type names...
1107 // TypeContains - Returns true if Ty directly contains E in it.
1109 static bool TypeContains(const Type *Ty, const Type *E) {
1110 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1111 E) != Ty->subtype_end();
1115 struct UpRefRecord {
1116 // NestingLevel - The number of nesting levels that need to be popped before
1117 // this type is resolved.
1118 unsigned NestingLevel;
1120 // LastContainedTy - This is the type at the current binding level for the
1121 // type. Every time we reduce the nesting level, this gets updated.
1122 const Type *LastContainedTy;
1124 // UpRefTy - This is the actual opaque type that the upreference is
1125 // represented with.
1126 OpaqueType *UpRefTy;
1128 UpRefRecord(unsigned NL, OpaqueType *URTy)
1129 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1133 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1134 static std::vector<UpRefRecord> UpRefs;
1136 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1137 /// called. It loops through the UpRefs vector, which is a list of the
1138 /// currently active types. For each type, if the up reference is contained in
1139 /// the newly completed type, we decrement the level count. When the level
1140 /// count reaches zero, the upreferenced type is the type that is passed in:
1141 /// thus we can complete the cycle.
1143 static PATypeHolder HandleUpRefs(const Type *ty) {
1144 // If Ty isn't abstract, or if there are no up-references in it, then there is
1145 // nothing to resolve here.
1146 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1148 PATypeHolder Ty(ty);
1149 UR_OUT("Type '" << Ty->getDescription() <<
1150 "' newly formed. Resolving upreferences.\n" <<
1151 UpRefs.size() << " upreferences active!\n");
1153 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1154 // to zero), we resolve them all together before we resolve them to Ty. At
1155 // the end of the loop, if there is anything to resolve to Ty, it will be in
1157 OpaqueType *TypeToResolve = 0;
1159 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1160 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1161 << UpRefs[i].second->getDescription() << ") = "
1162 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1163 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1164 // Decrement level of upreference
1165 unsigned Level = --UpRefs[i].NestingLevel;
1166 UpRefs[i].LastContainedTy = Ty;
1167 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1168 if (Level == 0) { // Upreference should be resolved!
1169 if (!TypeToResolve) {
1170 TypeToResolve = UpRefs[i].UpRefTy;
1172 UR_OUT(" * Resolving upreference for "
1173 << UpRefs[i].second->getDescription() << "\n";
1174 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1175 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1176 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1177 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1179 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1180 --i; // Do not skip the next element...
1185 if (TypeToResolve) {
1186 UR_OUT(" * Resolving upreference for "
1187 << UpRefs[i].second->getDescription() << "\n";
1188 std::string OldName = TypeToResolve->getDescription());
1189 TypeToResolve->refineAbstractTypeTo(Ty);
1195 //===----------------------------------------------------------------------===//
1196 // RunVMAsmParser - Define an interface to this parser
1197 //===----------------------------------------------------------------------===//
1199 static Module* RunParser(Module * M);
1201 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1204 CurFilename = Filename;
1205 return RunParser(new Module(CurFilename));
1208 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1209 set_scan_string(AsmString);
1211 CurFilename = "from_memory";
1213 return RunParser(new Module (CurFilename));
1215 return RunParser(M);
1221 /* Enabling traces. */
1226 /* Enabling verbose error messages. */
1227 #ifdef YYERROR_VERBOSE
1228 # undef YYERROR_VERBOSE
1229 # define YYERROR_VERBOSE 1
1231 # define YYERROR_VERBOSE 0
1234 /* Enabling the token table. */
1235 #ifndef YYTOKEN_TABLE
1236 # define YYTOKEN_TABLE 0
1239 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1240 #line 895 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
1241 typedef union YYSTYPE {
1242 llvm::Module *ModuleVal;
1243 llvm::Function *FunctionVal;
1244 llvm::BasicBlock *BasicBlockVal;
1245 llvm::TerminatorInst *TermInstVal;
1246 llvm::Instruction *InstVal;
1247 llvm::Constant *ConstVal;
1249 const llvm::Type *PrimType;
1250 std::list<llvm::PATypeHolder> *TypeList;
1251 llvm::PATypeHolder *TypeVal;
1252 llvm::Value *ValueVal;
1253 std::vector<llvm::Value*> *ValueList;
1254 llvm::ArgListType *ArgList;
1255 llvm::TypeWithAttrs TypeWithAttrs;
1256 llvm::TypeWithAttrsList *TypeWithAttrsList;
1257 llvm::ValueRefList *ValueRefList;
1259 // Represent the RHS of PHI node
1260 std::list<std::pair<llvm::Value*,
1261 llvm::BasicBlock*> > *PHIList;
1262 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1263 std::vector<llvm::Constant*> *ConstVector;
1265 llvm::GlobalValue::LinkageTypes Linkage;
1266 llvm::FunctionType::ParameterAttributes ParamAttrs;
1274 char *StrVal; // This memory is strdup'd!
1275 llvm::ValID ValIDVal; // strdup'd memory maybe!
1277 llvm::Instruction::BinaryOps BinaryOpVal;
1278 llvm::Instruction::TermOps TermOpVal;
1279 llvm::Instruction::MemoryOps MemOpVal;
1280 llvm::Instruction::CastOps CastOpVal;
1281 llvm::Instruction::OtherOps OtherOpVal;
1282 llvm::Module::Endianness Endianness;
1283 llvm::ICmpInst::Predicate IPredicate;
1284 llvm::FCmpInst::Predicate FPredicate;
1286 /* Line 196 of yacc.c. */
1287 #line 1288 "llvmAsmParser.tab.c"
1288 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1289 # define YYSTYPE_IS_DECLARED 1
1290 # define YYSTYPE_IS_TRIVIAL 1
1295 /* Copy the second part of user declarations. */
1298 /* Line 219 of yacc.c. */
1299 #line 1300 "llvmAsmParser.tab.c"
1301 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1302 # define YYSIZE_T __SIZE_TYPE__
1304 #if ! defined (YYSIZE_T) && defined (size_t)
1305 # define YYSIZE_T size_t
1307 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1308 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1309 # define YYSIZE_T size_t
1311 #if ! defined (YYSIZE_T)
1312 # define YYSIZE_T unsigned int
1318 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1319 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1323 # define YY_(msgid) msgid
1327 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1329 /* The parser invokes alloca or malloc; define the necessary symbols. */
1331 # ifdef YYSTACK_USE_ALLOCA
1332 # if YYSTACK_USE_ALLOCA
1334 # define YYSTACK_ALLOC __builtin_alloca
1336 # define YYSTACK_ALLOC alloca
1337 # if defined (__STDC__) || defined (__cplusplus)
1338 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1339 # define YYINCLUDED_STDLIB_H
1345 # ifdef YYSTACK_ALLOC
1346 /* Pacify GCC's `empty if-body' warning. */
1347 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1348 # ifndef YYSTACK_ALLOC_MAXIMUM
1349 /* The OS might guarantee only one guard page at the bottom of the stack,
1350 and a page size can be as small as 4096 bytes. So we cannot safely
1351 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1352 to allow for a few compiler-allocated temporary stack slots. */
1353 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1356 # define YYSTACK_ALLOC YYMALLOC
1357 # define YYSTACK_FREE YYFREE
1358 # ifndef YYSTACK_ALLOC_MAXIMUM
1359 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1365 # define YYMALLOC malloc
1366 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1367 && (defined (__STDC__) || defined (__cplusplus)))
1368 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1372 # define YYFREE free
1373 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1374 && (defined (__STDC__) || defined (__cplusplus)))
1375 void free (void *); /* INFRINGES ON USER NAME SPACE */
1382 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1385 #if (! defined (yyoverflow) \
1386 && (! defined (__cplusplus) \
1387 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1389 /* A type that is properly aligned for any stack member. */
1396 /* The size of the maximum gap between one aligned stack and the next. */
1397 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1399 /* The size of an array large to enough to hold all stacks, each with
1401 # define YYSTACK_BYTES(N) \
1402 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1403 + YYSTACK_GAP_MAXIMUM)
1405 /* Copy COUNT objects from FROM to TO. The source and destination do
1408 # if defined (__GNUC__) && 1 < __GNUC__
1409 # define YYCOPY(To, From, Count) \
1410 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1412 # define YYCOPY(To, From, Count) \
1416 for (yyi = 0; yyi < (Count); yyi++) \
1417 (To)[yyi] = (From)[yyi]; \
1423 /* Relocate STACK from its old location to the new one. The
1424 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1425 elements in the stack, and YYPTR gives the new location of the
1426 stack. Advance YYPTR to a properly aligned location for the next
1428 # define YYSTACK_RELOCATE(Stack) \
1431 YYSIZE_T yynewbytes; \
1432 YYCOPY (&yyptr->Stack, Stack, yysize); \
1433 Stack = &yyptr->Stack; \
1434 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1435 yyptr += yynewbytes / sizeof (*yyptr); \
1441 #if defined (__STDC__) || defined (__cplusplus)
1442 typedef signed char yysigned_char;
1444 typedef short int yysigned_char;
1447 /* YYFINAL -- State number of the termination state. */
1449 /* YYLAST -- Last index in YYTABLE. */
1452 /* YYNTOKENS -- Number of terminals. */
1453 #define YYNTOKENS 150
1454 /* YYNNTS -- Number of nonterminals. */
1456 /* YYNRULES -- Number of rules. */
1457 #define YYNRULES 288
1458 /* YYNRULES -- Number of states. */
1459 #define YYNSTATES 572
1461 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1462 #define YYUNDEFTOK 2
1463 #define YYMAXUTOK 389
1465 #define YYTRANSLATE(YYX) \
1466 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1468 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1469 static const unsigned char yytranslate[] =
1471 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1475 138, 139, 140, 2, 136, 2, 2, 2, 2, 2,
1476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1477 145, 135, 146, 2, 137, 2, 2, 2, 2, 2,
1478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1480 2, 142, 141, 144, 2, 2, 2, 2, 2, 149,
1481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1483 143, 2, 2, 147, 2, 148, 2, 2, 2, 2,
1484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1496 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1497 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1498 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1499 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1500 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1501 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1502 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1503 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1504 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1505 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1506 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1507 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1508 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1509 125, 126, 127, 128, 129, 130, 131, 132, 133, 134
1513 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1515 static const unsigned short int yyprhs[] =
1517 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1518 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1519 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1520 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1521 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1522 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1523 119, 121, 123, 125, 128, 129, 131, 133, 135, 137,
1524 139, 141, 143, 145, 146, 148, 150, 151, 153, 155,
1525 157, 159, 160, 162, 164, 166, 168, 170, 172, 175,
1526 177, 179, 181, 185, 186, 189, 194, 195, 198, 199,
1527 203, 206, 207, 209, 210, 214, 216, 219, 221, 223,
1528 225, 227, 229, 231, 233, 235, 237, 239, 242, 244,
1529 247, 253, 259, 265, 271, 275, 278, 284, 289, 292,
1530 295, 298, 300, 304, 306, 310, 312, 313, 315, 319,
1531 324, 328, 332, 337, 342, 346, 349, 352, 355, 358,
1532 361, 364, 367, 370, 373, 376, 383, 389, 398, 405,
1533 412, 420, 428, 435, 442, 451, 460, 464, 466, 468,
1534 470, 472, 473, 475, 478, 479, 483, 484, 488, 492,
1535 494, 498, 502, 503, 509, 510, 517, 518, 525, 528,
1536 532, 534, 536, 538, 542, 546, 550, 554, 558, 562,
1537 564, 565, 567, 569, 571, 572, 578, 582, 584, 588,
1538 590, 591, 600, 602, 604, 608, 610, 612, 615, 618,
1539 619, 621, 623, 625, 627, 629, 631, 633, 635, 637,
1540 641, 643, 649, 651, 653, 655, 657, 660, 663, 666,
1541 670, 673, 674, 676, 679, 682, 686, 696, 706, 715,
1542 729, 731, 733, 740, 746, 749, 756, 764, 768, 774,
1543 775, 776, 780, 783, 785, 791, 797, 804, 811, 814,
1544 819, 824, 831, 836, 841, 848, 855, 858, 866, 868,
1545 870, 871, 875, 882, 886, 893, 896, 901, 908
1548 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1549 static const short int yyrhs[] =
1551 186, 0, -1, 5, -1, 6, -1, 74, -1, 75,
1552 -1, 76, -1, 77, -1, 78, -1, 79, -1, 80,
1553 -1, 81, -1, 82, -1, 83, -1, 84, -1, 85,
1554 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
1555 -1, 119, -1, 120, -1, 121, -1, 122, -1, 123,
1556 -1, 124, -1, 125, -1, 128, -1, 129, -1, 130,
1557 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1558 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1559 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1560 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1561 -1, 94, -1, 95, -1, 96, -1, 97, -1, 23,
1562 -1, 24, -1, 13, -1, 12, -1, 11, -1, 10,
1563 -1, 14, -1, 15, -1, 199, 135, -1, -1, 37,
1564 -1, 39, -1, 38, -1, 40, -1, 42, -1, 41,
1565 -1, 43, -1, 46, -1, -1, 41, -1, 43, -1,
1566 -1, 37, -1, 38, -1, 39, -1, 42, -1, -1,
1567 61, -1, 62, -1, 63, -1, 64, -1, 65, -1,
1568 66, -1, 60, 4, -1, 115, -1, 116, -1, 166,
1569 -1, 167, 136, 166, -1, -1, 137, 166, -1, 137,
1570 138, 167, 139, -1, -1, 53, 4, -1, -1, 136,
1571 53, 4, -1, 31, 20, -1, -1, 171, -1, -1,
1572 136, 174, 173, -1, 171, -1, 53, 4, -1, 9,
1573 -1, 10, -1, 11, -1, 12, -1, 13, -1, 14,
1574 -1, 15, -1, 16, -1, 44, -1, 175, -1, 176,
1575 140, -1, 211, -1, 141, 4, -1, 176, 168, 138,
1576 180, 139, -1, 8, 168, 138, 180, 139, -1, 142,
1577 4, 143, 176, 144, -1, 145, 4, 143, 176, 146,
1578 -1, 147, 181, 148, -1, 147, 148, -1, 145, 147,
1579 181, 148, 146, -1, 145, 147, 148, 146, -1, 176,
1580 168, -1, 176, 168, -1, 8, 168, -1, 177, -1,
1581 179, 136, 177, -1, 179, -1, 179, 136, 34, -1,
1582 34, -1, -1, 176, -1, 181, 136, 176, -1, 176,
1583 142, 184, 144, -1, 176, 142, 144, -1, 176, 149,
1584 20, -1, 176, 145, 184, 146, -1, 176, 147, 184,
1585 148, -1, 176, 147, 148, -1, 176, 35, -1, 176,
1586 36, -1, 176, 211, -1, 176, 183, -1, 176, 22,
1587 -1, 158, 3, -1, 158, 4, -1, 9, 23, -1,
1588 9, 24, -1, 159, 7, -1, 154, 138, 182, 33,
1589 176, 139, -1, 113, 138, 182, 222, 139, -1, 127,
1590 138, 182, 136, 182, 136, 182, 139, -1, 152, 138,
1591 182, 136, 182, 139, -1, 153, 138, 182, 136, 182,
1592 139, -1, 86, 156, 138, 182, 136, 182, 139, -1,
1593 87, 157, 138, 182, 136, 182, 139, -1, 155, 138,
1594 182, 136, 182, 139, -1, 132, 138, 182, 136, 182,
1595 139, -1, 133, 138, 182, 136, 182, 136, 182, 139,
1596 -1, 134, 138, 182, 136, 182, 136, 182, 139, -1,
1597 184, 136, 182, -1, 182, -1, 29, -1, 30, -1,
1598 187, -1, -1, 188, -1, 187, 188, -1, -1, 28,
1599 189, 207, -1, -1, 27, 190, 208, -1, 58, 57,
1600 194, -1, 21, -1, 160, 17, 176, -1, 160, 17,
1601 8, -1, -1, 160, 185, 182, 191, 173, -1, -1,
1602 160, 161, 185, 182, 192, 173, -1, -1, 160, 162,
1603 185, 176, 193, 173, -1, 47, 196, -1, 54, 135,
1604 197, -1, 20, -1, 52, -1, 51, -1, 49, 135,
1605 195, -1, 50, 135, 4, -1, 48, 135, 20, -1,
1606 67, 135, 20, -1, 142, 198, 144, -1, 198, 136,
1607 20, -1, 20, -1, -1, 18, -1, 20, -1, 199,
1608 -1, -1, 201, 136, 176, 168, 200, -1, 176, 168,
1609 200, -1, 201, -1, 201, 136, 34, -1, 34, -1,
1610 -1, 165, 178, 199, 138, 202, 139, 172, 169, -1,
1611 25, -1, 147, -1, 164, 203, 204, -1, 26, -1,
1612 148, -1, 214, 206, -1, 163, 203, -1, -1, 59,
1613 -1, 3, -1, 4, -1, 7, -1, 23, -1, 24,
1614 -1, 35, -1, 36, -1, 22, -1, 145, 184, 146,
1615 -1, 183, -1, 57, 209, 20, 136, 20, -1, 151,
1616 -1, 199, -1, 211, -1, 210, -1, 176, 212, -1,
1617 214, 215, -1, 205, 215, -1, 216, 160, 217, -1,
1618 216, 219, -1, -1, 19, -1, 68, 213, -1, 68,
1619 8, -1, 69, 16, 212, -1, 69, 9, 212, 136,
1620 16, 212, 136, 16, 212, -1, 70, 158, 212, 136,
1621 16, 212, 142, 218, 144, -1, 70, 158, 212, 136,
1622 16, 212, 142, 144, -1, 71, 165, 178, 212, 138,
1623 221, 139, 33, 16, 212, 72, 16, 212, -1, 72,
1624 -1, 73, -1, 218, 158, 210, 136, 16, 212, -1,
1625 158, 210, 136, 16, 212, -1, 160, 224, -1, 176,
1626 142, 212, 136, 212, 144, -1, 220, 136, 142, 212,
1627 136, 212, 144, -1, 176, 212, 168, -1, 221, 136,
1628 176, 212, 168, -1, -1, -1, 222, 136, 213, -1,
1629 56, 55, -1, 55, -1, 152, 176, 212, 136, 212,
1630 -1, 153, 176, 212, 136, 212, -1, 86, 156, 176,
1631 212, 136, 212, -1, 87, 157, 176, 212, 136, 212,
1632 -1, 45, 213, -1, 155, 213, 136, 213, -1, 154,
1633 213, 33, 176, -1, 127, 213, 136, 213, 136, 213,
1634 -1, 131, 213, 136, 176, -1, 132, 213, 136, 213,
1635 -1, 133, 213, 136, 213, 136, 213, -1, 134, 213,
1636 136, 213, 136, 213, -1, 126, 220, -1, 223, 165,
1637 178, 212, 138, 221, 139, -1, 226, -1, 32, -1,
1638 -1, 108, 176, 170, -1, 108, 176, 136, 12, 212,
1639 170, -1, 109, 176, 170, -1, 109, 176, 136, 12,
1640 212, 170, -1, 110, 213, -1, 225, 111, 176, 212,
1641 -1, 225, 112, 213, 136, 176, 212, -1, 113, 176,
1645 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1646 static const unsigned short int yyrline[] =
1648 0, 1035, 1035, 1036, 1046, 1046, 1046, 1046, 1046, 1046,
1649 1046, 1046, 1046, 1047, 1047, 1047, 1048, 1048, 1048, 1048,
1650 1048, 1048, 1049, 1049, 1049, 1049, 1049, 1049, 1050, 1050,
1651 1050, 1052, 1052, 1053, 1053, 1054, 1054, 1055, 1055, 1056,
1652 1056, 1060, 1060, 1061, 1061, 1062, 1062, 1063, 1063, 1064,
1653 1064, 1065, 1065, 1066, 1066, 1067, 1068, 1073, 1073, 1073,
1654 1073, 1074, 1074, 1077, 1081, 1087, 1088, 1089, 1090, 1091,
1655 1095, 1096, 1097, 1101, 1102, 1103, 1107, 1108, 1109, 1110,
1656 1111, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1128,
1657 1129, 1132, 1133, 1138, 1139, 1140, 1145, 1146, 1152, 1153,
1658 1161, 1169, 1170, 1175, 1176, 1177, 1182, 1195, 1195, 1195,
1659 1195, 1195, 1195, 1195, 1195, 1198, 1202, 1206, 1213, 1218,
1660 1226, 1244, 1262, 1267, 1279, 1289, 1293, 1303, 1310, 1317,
1661 1325, 1331, 1336, 1343, 1344, 1351, 1358, 1366, 1371, 1382,
1662 1410, 1426, 1455, 1483, 1504, 1519, 1531, 1538, 1601, 1611,
1663 1621, 1627, 1633, 1637, 1641, 1649, 1663, 1684, 1692, 1698,
1664 1709, 1714, 1719, 1728, 1734, 1740, 1749, 1753, 1761, 1761,
1665 1772, 1777, 1785, 1786, 1790, 1790, 1794, 1794, 1797, 1800,
1666 1812, 1836, 1847, 1847, 1856, 1856, 1864, 1864, 1874, 1877,
1667 1883, 1896, 1897, 1899, 1903, 1912, 1916, 1921, 1923, 1928,
1668 1933, 1942, 1942, 1943, 1943, 1945, 1955, 1966, 1970, 1979,
1669 1988, 1993, 2098, 2098, 2100, 2108, 2108, 2110, 2115, 2126,
1670 2130, 2135, 2139, 2143, 2147, 2151, 2155, 2159, 2163, 2167,
1671 2192, 2196, 2210, 2214, 2220, 2220, 2226, 2235, 2239, 2248,
1672 2259, 2268, 2280, 2293, 2297, 2301, 2306, 2315, 2334, 2343,
1673 2410, 2414, 2421, 2432, 2445, 2454, 2465, 2475, 2483, 2491,
1674 2494, 2495, 2502, 2506, 2511, 2532, 2549, 2562, 2575, 2588,
1675 2597, 2610, 2618, 2625, 2631, 2637, 2643, 2658, 2720, 2725,
1676 2729, 2736, 2743, 2751, 2758, 2766, 2774, 2788, 2805
1680 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1681 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1682 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1683 static const char *const yytname[] =
1685 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1686 "UINTVAL", "FPVAL", "VOID", "BOOL", "INT8", "INT16", "INT32", "INT64",
1687 "FLOAT", "DOUBLE", "LABEL", "TYPE", "VAR_ID", "LABELSTR",
1688 "STRINGCONSTANT", "IMPLEMENTATION", "ZEROINITIALIZER", "TRUETOK",
1689 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1690 "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK",
1691 "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT",
1692 "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "NOT", "EXTERNAL", "TARGET",
1693 "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS",
1694 "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1695 "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1696 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1697 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1698 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "ICMP", "FCMP", "EQ", "NE",
1699 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1700 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1701 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1702 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1703 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR",
1704 "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1705 "'='", "','", "'@'", "'('", "')'", "'*'", "'\\\\'", "'['", "'x'", "']'",
1706 "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "INTVAL", "ArithmeticOps",
1707 "LogicalOps", "CastOps", "ShiftOps", "IPredicates", "FPredicates",
1708 "IntType", "FPType", "OptAssign", "GVInternalLinkage",
1709 "GVExternalLinkage", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1710 "OptCallingConv", "ParamAttr", "ParamAttrList", "OptParamAttrs",
1711 "OptAlign", "OptCAlign", "SectionString", "OptSection",
1712 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1713 "ArgType", "ResultType", "ArgTypeList", "ArgTypeListI", "TypeListI",
1714 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1715 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1716 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1717 "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1718 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1719 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1720 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1721 "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList",
1722 "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0
1727 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1729 static const unsigned short int yytoknum[] =
1731 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1732 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1733 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1734 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1735 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1736 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1737 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1738 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1739 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1740 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1741 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1742 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1743 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1744 385, 386, 387, 388, 389, 61, 44, 64, 40, 41,
1745 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
1749 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1750 static const unsigned char yyr1[] =
1752 0, 150, 151, 151, 152, 152, 152, 152, 152, 152,
1753 152, 152, 152, 153, 153, 153, 154, 154, 154, 154,
1754 154, 154, 154, 154, 154, 154, 154, 154, 155, 155,
1755 155, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1756 156, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1757 157, 157, 157, 157, 157, 157, 157, 158, 158, 158,
1758 158, 159, 159, 160, 160, 161, 161, 161, 161, 161,
1759 162, 162, 162, 163, 163, 163, 164, 164, 164, 164,
1760 164, 165, 165, 165, 165, 165, 165, 165, 165, 166,
1761 166, 167, 167, 168, 168, 168, 169, 169, 170, 170,
1762 171, 172, 172, 173, 173, 174, 174, 175, 175, 175,
1763 175, 175, 175, 175, 175, 176, 176, 176, 176, 176,
1764 176, 176, 176, 176, 176, 176, 176, 176, 177, 178,
1765 178, 179, 179, 180, 180, 180, 180, 181, 181, 182,
1766 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
1767 182, 182, 182, 182, 182, 183, 183, 183, 183, 183,
1768 183, 183, 183, 183, 183, 183, 184, 184, 185, 185,
1769 186, 186, 187, 187, 189, 188, 190, 188, 188, 188,
1770 188, 188, 191, 188, 192, 188, 193, 188, 188, 188,
1771 194, 195, 195, 196, 196, 196, 196, 197, 198, 198,
1772 198, 199, 199, 200, 200, 201, 201, 202, 202, 202,
1773 202, 203, 204, 204, 205, 206, 206, 207, 208, 209,
1774 209, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1775 210, 210, 211, 211, 212, 212, 213, 214, 214, 215,
1776 216, 216, 216, 217, 217, 217, 217, 217, 217, 217,
1777 217, 217, 218, 218, 219, 220, 220, 221, 221, 221,
1778 222, 222, 223, 223, 224, 224, 224, 224, 224, 224,
1779 224, 224, 224, 224, 224, 224, 224, 224, 224, 225,
1780 225, 226, 226, 226, 226, 226, 226, 226, 226
1783 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1784 static const unsigned char yyr2[] =
1786 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1787 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1788 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1789 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1790 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1791 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1792 1, 1, 1, 2, 0, 1, 1, 1, 1, 1,
1793 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1794 1, 0, 1, 1, 1, 1, 1, 1, 2, 1,
1795 1, 1, 3, 0, 2, 4, 0, 2, 0, 3,
1796 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
1797 1, 1, 1, 1, 1, 1, 1, 2, 1, 2,
1798 5, 5, 5, 5, 3, 2, 5, 4, 2, 2,
1799 2, 1, 3, 1, 3, 1, 0, 1, 3, 4,
1800 3, 3, 4, 4, 3, 2, 2, 2, 2, 2,
1801 2, 2, 2, 2, 2, 6, 5, 8, 6, 6,
1802 7, 7, 6, 6, 8, 8, 3, 1, 1, 1,
1803 1, 0, 1, 2, 0, 3, 0, 3, 3, 1,
1804 3, 3, 0, 5, 0, 6, 0, 6, 2, 3,
1805 1, 1, 1, 3, 3, 3, 3, 3, 3, 1,
1806 0, 1, 1, 1, 0, 5, 3, 1, 3, 1,
1807 0, 8, 1, 1, 3, 1, 1, 2, 2, 0,
1808 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1809 1, 5, 1, 1, 1, 1, 2, 2, 2, 3,
1810 2, 0, 1, 2, 2, 3, 9, 9, 8, 13,
1811 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1812 0, 3, 2, 1, 5, 5, 6, 6, 2, 4,
1813 4, 6, 4, 4, 6, 6, 2, 7, 1, 1,
1814 0, 3, 6, 3, 6, 2, 4, 6, 4
1817 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1818 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1819 means the default is an error. */
1820 static const unsigned short int yydefact[] =
1822 64, 201, 202, 179, 176, 174, 0, 0, 0, 0,
1823 0, 64, 172, 0, 73, 76, 0, 0, 0, 0,
1824 188, 0, 0, 0, 168, 169, 65, 67, 66, 68,
1825 70, 69, 71, 72, 0, 0, 0, 1, 173, 63,
1826 74, 75, 81, 177, 77, 78, 79, 80, 81, 241,
1827 175, 241, 0, 0, 0, 0, 200, 189, 190, 178,
1828 2, 3, 181, 107, 108, 109, 110, 111, 112, 113,
1829 114, 115, 0, 0, 0, 0, 232, 116, 180, 233,
1830 118, 0, 0, 93, 107, 108, 109, 110, 111, 112,
1831 113, 0, 0, 93, 182, 0, 82, 83, 84, 85,
1832 86, 87, 0, 218, 0, 242, 238, 64, 215, 216,
1833 217, 237, 195, 192, 191, 193, 194, 196, 199, 0,
1834 0, 0, 119, 0, 0, 0, 125, 137, 0, 117,
1835 0, 184, 186, 152, 153, 150, 151, 154, 149, 145,
1836 146, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1837 13, 14, 15, 0, 0, 0, 16, 17, 18, 19,
1838 20, 21, 22, 23, 24, 25, 26, 27, 0, 28,
1839 29, 30, 0, 0, 0, 0, 0, 0, 0, 0,
1840 0, 0, 0, 148, 147, 103, 88, 93, 93, 0,
1841 212, 213, 214, 280, 240, 0, 197, 89, 90, 0,
1842 94, 136, 0, 0, 0, 0, 0, 124, 136, 103,
1843 103, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1844 40, 0, 55, 56, 51, 52, 53, 54, 41, 42,
1845 43, 44, 45, 46, 47, 48, 49, 50, 0, 0,
1846 0, 0, 0, 0, 140, 167, 0, 0, 144, 0,
1847 141, 0, 0, 0, 0, 0, 183, 130, 129, 0,
1848 279, 0, 263, 0, 0, 0, 0, 81, 250, 251,
1849 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1850 0, 0, 0, 0, 0, 0, 239, 81, 254, 0,
1851 278, 198, 91, 0, 135, 93, 131, 133, 0, 93,
1852 93, 127, 0, 138, 0, 185, 187, 0, 0, 260,
1853 0, 0, 0, 0, 0, 139, 142, 143, 0, 0,
1854 0, 0, 0, 0, 105, 103, 210, 93, 268, 262,
1855 244, 243, 0, 0, 60, 59, 58, 57, 0, 0,
1856 0, 0, 98, 98, 285, 93, 93, 276, 0, 0,
1857 0, 0, 0, 93, 93, 0, 0, 0, 0, 0,
1858 0, 95, 128, 0, 121, 122, 123, 126, 120, 0,
1859 0, 0, 0, 0, 0, 0, 166, 0, 0, 0,
1860 0, 100, 106, 104, 209, 93, 207, 0, 221, 222,
1861 223, 228, 224, 225, 226, 227, 219, 0, 230, 235,
1862 234, 236, 0, 245, 0, 0, 93, 93, 0, 281,
1863 0, 283, 260, 0, 0, 0, 0, 0, 0, 0,
1864 0, 0, 0, 0, 0, 93, 0, 92, 134, 132,
1865 0, 0, 0, 156, 0, 0, 0, 0, 0, 0,
1866 93, 0, 204, 0, 101, 220, 0, 0, 0, 0,
1867 0, 0, 0, 0, 0, 0, 288, 0, 0, 0,
1868 272, 273, 0, 0, 0, 0, 270, 269, 0, 286,
1869 0, 0, 0, 261, 0, 163, 0, 0, 158, 159,
1870 155, 162, 203, 206, 208, 93, 102, 96, 0, 229,
1871 0, 0, 259, 0, 0, 98, 99, 98, 0, 0,
1872 0, 0, 0, 264, 265, 259, 93, 160, 161, 0,
1873 0, 0, 204, 0, 211, 0, 0, 0, 93, 0,
1874 266, 267, 0, 282, 284, 0, 0, 271, 274, 275,
1875 0, 287, 157, 164, 165, 205, 97, 231, 0, 0,
1876 93, 0, 0, 255, 0, 277, 0, 248, 0, 0,
1877 257, 93, 0, 256, 246, 0, 247, 0, 93, 0,
1878 0, 0, 258, 0, 0, 0, 0, 253, 0, 0,
1882 /* YYDEFGOTO[NTERM-NUM]. */
1883 static const short int yydefgoto[] =
1885 -1, 76, 179, 180, 181, 182, 221, 238, 91, 92,
1886 9, 34, 35, 42, 48, 102, 200, 293, 130, 514,
1887 409, 324, 487, 256, 325, 77, 93, 296, 189, 297,
1888 298, 128, 245, 398, 246, 36, 10, 11, 12, 15,
1889 14, 185, 209, 210, 59, 115, 20, 57, 119, 79,
1890 483, 386, 387, 103, 192, 49, 110, 50, 43, 446,
1891 399, 80, 401, 328, 51, 106, 107, 286, 549, 194,
1892 347, 519, 371, 287, 288, 289, 290
1895 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1897 #define YYPACT_NINF -444
1898 static const short int yypact[] =
1900 76, -444, -444, -444, -444, -444, -14, -77, 12, 548,
1901 89, 91, -444, -40, 79, 116, -36, -29, -11, -3,
1902 -444, 14, 119, 949, -444, -444, -444, -444, -444, -444,
1903 -444, -444, -444, -444, 15, 15, 1230, -444, -444, -444,
1904 -444, -444, 131, -444, -444, -444, -444, -444, 131, 124,
1905 -444, -2, 130, -12, 173, 179, 188, -444, -444, -444,
1906 -444, -444, 25, -444, -444, -444, -444, -444, -444, -444,
1907 -444, -444, 212, 214, 4, 72, -444, -444, 44, -444,
1908 -444, 1230, 1271, 103, 152, 207, 225, 243, 260, 230,
1909 241, 262, 269, 575, -444, 263, -444, -444, -444, -444,
1910 -444, -444, 1288, -444, -16, -444, -444, 117, -444, -444,
1911 -444, -444, -444, -444, -444, -444, -444, -444, -444, -19,
1912 -84, 140, -444, 136, 139, 539, -444, 44, -99, -444,
1913 150, -444, 44, -444, -444, -444, -444, -444, -444, -444,
1914 -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,
1915 -444, -444, -444, 77, 283, 151, -444, -444, -444, -444,
1916 -444, -444, -444, -444, -444, -444, -444, -444, 154, -444,
1917 -444, -444, 156, 157, 158, 806, 1230, 720, 270, 159,
1918 162, 166, 170, -444, -444, 155, -444, 103, 20, 117,
1919 -444, -444, -444, 1369, -444, 289, -444, -444, -444, 153,
1920 -444, 1123, 1271, 1271, 164, -98, 1271, -444, 1123, 155,
1921 155, -444, -444, -444, -444, -444, -444, -444, -444, -444,
1922 -444, 174, -444, -444, -444, -444, -444, -444, -444, -444,
1923 -444, -444, -444, -444, -444, -444, -444, -444, 175, 1230,
1924 1230, 1230, 1230, 1230, -444, -444, -15, -90, -444, -93,
1925 -444, 1230, 1230, 1230, 1230, -5, -444, 140, 150, 177,
1926 -444, 1271, -444, 256, 1329, 84, 176, 131, -444, -444,
1927 77, 283, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271,
1928 1271, 1271, 1271, 1271, 1271, 1271, -444, 131, -444, 160,
1929 -444, -444, -444, 5, -444, 20, -444, 178, 180, -4,
1930 -39, -444, 181, 44, 182, -444, -444, 1230, 1230, -444,
1931 184, 186, 187, 190, 1230, -444, -444, -444, 192, 193,
1932 291, 194, 311, 328, -444, 155, 1169, 756, -444, -444,
1933 25, -444, 899, 899, -444, -444, -444, -444, 899, 1288,
1934 1271, 1271, 67, 85, -444, 756, -27, 197, 201, 202,
1935 203, 205, 206, 756, 756, 310, 208, 1288, 1271, 1271,
1936 153, -444, 150, 1186, -444, -444, -444, -444, -444, 209,
1937 210, 73, 1230, 1230, 1230, 1230, -444, 1230, 1230, 1271,
1938 1230, -444, -444, -444, -444, 20, 211, 213, -444, -444,
1939 -444, -444, -444, -444, -444, -444, 290, 1230, -444, -444,
1940 -444, -444, 215, -444, 221, 899, 756, 756, 13, -444,
1941 17, -444, -444, 899, 216, 1271, 1271, 1271, 1271, 1271,
1942 223, 224, 1271, 1271, 899, 756, 226, -444, -444, -444,
1943 1230, 1230, 1271, -444, 231, 235, 234, 240, 236, 252,
1944 -66, 258, 10, 1213, 317, -444, 330, -71, 382, 386,
1945 266, 271, 272, 899, 401, 899, 278, 279, 899, 281,
1946 44, -444, 282, 288, 899, 899, 44, -444, 292, -444,
1947 1271, 280, 287, -444, 1230, -444, 1230, 1230, -444, -444,
1948 -444, -444, -444, -444, -444, 20, -444, 374, 293, -444,
1949 899, 899, 1271, 899, 899, 297, -444, 297, 899, 298,
1950 1271, 1271, 1271, -444, -444, 1271, 756, -444, -444, 296,
1951 301, 305, 10, 424, -444, 416, 309, 295, 756, 88,
1952 -444, -444, 395, -444, -444, 306, 899, -444, -444, -444,
1953 100, -444, -444, -444, -444, -444, -444, -444, 433, 3,
1954 103, 1271, 418, -444, 308, -444, 899, -444, 1031, 8,
1955 -444, 756, 437, -444, -444, 319, -444, 1031, 103, 899,
1956 440, 321, -444, 387, 899, 442, 444, -444, 899, 899,
1960 /* YYPGOTO[NTERM-NUM]. */
1961 static const short int yypgoto[] =
1963 -444, -444, 268, 277, 294, 299, 218, 191, -262, -444,
1964 356, -444, -444, -444, -444, -245, -196, -444, -60, -444,
1965 -336, 27, -444, -199, -444, -444, -23, 101, -306, -444,
1966 264, 348, -9, 383, -171, 239, -444, -444, 464, -444,
1967 -444, -444, -444, -444, -444, -444, -444, -444, -444, 1,
1968 -31, -444, -444, 438, -444, -444, -444, -444, -444, -444,
1969 -443, -52, 78, -217, -444, 439, -444, -444, -444, -444,
1970 -444, -10, 81, -444, -444, -444, -444
1973 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1974 positive, shift that token. If negative, reduce the rule which
1975 number is the opposite. If zero, do what YYDEFACT says.
1976 If YYTABLE_NINF, syntax error. */
1977 #define YYTABLE_NINF -172
1978 static const short int yytable[] =
1980 78, 13, 121, 292, 338, 247, 249, 411, 124, 190,
1981 305, 306, 13, 334, 335, 336, 337, 105, 334, 335,
1982 336, 337, 339, 121, 108, 453, 322, 94, 1, 455,
1983 2, 197, 198, 405, 16, 17, 18, 206, 206, 113,
1984 114, 184, 357, 314, 24, 25, 314, 331, 323, 207,
1985 302, 424, 127, 19, 199, 317, 316, 344, 21, 132,
1986 348, 349, 350, 351, 352, 314, 454, 355, 356, 22,
1987 454, 120, 131, 480, 129, 489, -171, 60, 61, 188,
1988 83, 63, 64, 65, 66, 67, 68, 69, 70, 37,
1989 1, -170, 2, 332, 1, 39, 2, 3, 120, 52,
1990 333, 129, 127, 4, 5, 555, 53, 366, 13, 1,
1991 120, 2, 3, 129, 561, 413, 71, 195, 4, 5,
1992 40, 314, 41, 6, 54, 196, 383, 257, 258, 315,
1993 7, 191, 55, 120, 8, 1, 129, 2, 6, 58,
1994 365, 360, 426, 105, 361, 7, 109, 547, 208, 8,
1995 112, 125, 556, 44, 45, 46, 56, 120, 47, 523,
1996 129, 524, 120, -93, 427, 211, 212, 213, 214, 215,
1997 216, 217, 218, 219, 220, 133, 134, 116, 295, 299,
1998 300, 120, -93, 303, 129, 295, 334, 335, 336, 337,
1999 259, 95, 96, 97, 98, 99, 100, 101, 459, 117,
2000 461, 462, 463, 408, 120, -93, 467, 129, 118, 432,
2001 -60, -60, 433, 72, 73, 473, 122, 74, 123, 75,
2002 126, 410, 120, -93, 541, 129, 447, 542, -59, -59,
2003 309, 310, 311, 312, 313, 362, 541, -61, 327, 545,
2004 120, 327, 318, 319, 320, 321, -58, -58, -62, 342,
2005 343, 327, 345, 346, 327, 327, 327, 327, 327, 353,
2006 354, 327, 327, -57, -57, 135, 136, 186, 197, 198,
2007 121, 358, 359, 81, 82, 400, 137, 548, 201, 202,
2008 400, 400, 203, 527, 528, 529, 400, 557, 208, 239,
2009 250, 255, 240, 400, 241, 242, 243, 251, 369, 370,
2010 252, 400, 400, 385, 253, 376, 222, 223, 254, 291,
2011 301, 329, 307, 308, 363, 326, 188, 406, 407, 364,
2012 372, 368, 373, 374, 379, 442, 375, 367, 377, 378,
2013 380, 381, 382, 414, 188, 425, 327, 415, 416, 417,
2014 295, 418, 419, 422, 423, 430, 431, 443, 322, 445,
2015 488, 448, 444, 400, 400, 400, 440, 449, 458, 464,
2016 465, 400, 470, 434, 435, 436, 437, 474, 438, 439,
2017 476, 441, 400, 400, 475, 478, 477, 224, 225, 226,
2018 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
2019 237, 479, 327, 460, 327, 327, 327, 481, 490, 466,
2020 327, 400, 491, 400, 492, 496, 400, 493, 494, 327,
2021 402, 403, 400, 400, 432, 498, 404, 500, 501, 507,
2022 485, 471, 472, 412, 502, 512, 508, 513, 536, 515,
2023 505, 420, 421, 522, 526, 532, 537, 539, 400, 400,
2024 533, 400, 400, 482, 534, 538, 400, 506, 454, 546,
2025 543, 552, 553, 559, 400, 560, 564, 565, 568, 566,
2026 569, 282, 341, 193, 429, 509, 400, 510, 511, 518,
2027 283, 486, 304, 205, 400, 38, 183, 327, 327, 327,
2028 550, 535, 518, 450, 451, 452, 104, 284, 340, 0,
2029 111, 457, 285, 456, 400, 530, 0, 0, 562, 400,
2030 0, 0, 468, 469, 0, 0, 0, 400, 0, 0,
2031 0, 0, 400, 482, 0, 0, 400, 400, 551, 0,
2032 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2033 0, 495, 0, 497, 0, 0, 499, 0, 0, 0,
2034 0, 0, 503, 504, 60, 61, 0, 83, 63, 64,
2035 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2036 0, 0, 0, 0, 0, 23, 0, 0, 516, 517,
2037 0, 520, 521, 0, 0, 0, 525, 24, 25, 0,
2038 60, 61, 0, 71, 531, 26, 27, 28, 29, 30,
2039 31, 32, 0, 1, 33, 2, 540, 138, 0, 0,
2040 0, 0, 0, 0, 544, 0, 0, 0, 0, 0,
2041 139, 140, 0, 0, 0, 0, 0, 0, 0, 0,
2042 0, 0, 0, 0, 554, 0, 0, 0, 0, 558,
2043 0, 0, 0, 0, 0, 0, 0, 563, 0, 0,
2044 0, 0, 567, 0, 0, 0, 570, 571, 0, 141,
2045 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
2046 152, 153, 154, 0, 0, 0, 0, 0, 0, 0,
2047 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2048 72, 73, 0, 0, 74, 0, 75, 204, 155, 156,
2049 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2050 167, 0, 168, 169, 170, 171, 0, 172, 173, 174,
2051 0, 0, 120, 0, 0, 129, 0, 175, 0, 0,
2052 176, 0, 177, 0, 178, 60, 61, 0, 83, 84,
2053 85, 86, 87, 88, 89, 90, 70, 0, 1, 0,
2054 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2055 0, 0, 0, 0, 0, 0, 0, 0, 0, 388,
2056 389, 60, 61, 390, 71, 0, 0, 0, 0, 0,
2057 0, 0, 0, 0, 1, 0, 2, 0, 391, 392,
2058 393, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2059 0, 394, 395, 0, 0, 0, 0, 0, 0, 0,
2060 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2061 0, 60, 61, 396, 83, 84, 85, 86, 87, 88,
2062 89, 90, 70, 0, 1, 0, 2, 0, 0, 0,
2063 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2064 151, 152, 153, 154, 0, 0, 0, 0, 0, 0,
2065 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2066 0, 72, 73, 0, 0, 74, 0, 75, 248, 155,
2067 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2068 166, 167, 0, 168, 169, 170, 171, 0, 172, 173,
2069 174, 0, 0, 120, 0, 0, 129, 0, 0, 0,
2070 0, 397, 388, 389, 60, 61, 390, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
2072 0, 391, 392, 393, 0, 0, 0, 0, 0, 0,
2073 0, 0, 0, 0, 394, 395, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
2075 244, 74, 0, 75, 60, 61, 396, 62, 63, 64,
2076 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2077 0, 0, 0, 141, 142, 143, 144, 145, 146, 147,
2078 148, 149, 150, 151, 152, 153, 154, 0, 0, 0,
2079 0, 0, 0, 71, 0, 0, 0, 0, 0, 0,
2080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2081 0, 0, 155, 156, 157, 158, 159, 160, 161, 162,
2082 163, 164, 165, 166, 167, 0, 168, 169, 170, 171,
2083 0, 172, 173, 174, 388, 389, 0, 0, 390, 0,
2084 0, 0, 0, 0, 397, 0, 0, 0, 0, 0,
2085 0, 0, 0, 391, 392, 393, 0, 0, 0, 0,
2086 0, 0, 0, 0, 0, 0, 394, 395, 0, 0,
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2088 0, 0, 0, 0, 0, 0, 0, 0, 396, 0,
2089 72, 73, 0, 0, 74, 0, 75, 0, 0, 0,
2090 0, 0, 0, 0, 0, 141, 142, 143, 144, 145,
2091 146, 147, 148, 149, 150, 151, 152, 153, 154, 0,
2092 0, 0, 0, 0, 0, 0, 0, 0, 60, 61,
2093 0, 83, 63, 64, 65, 66, 67, 68, 69, 70,
2094 0, 1, 0, 2, 155, 156, 157, 158, 159, 160,
2095 161, 162, 163, 164, 165, 166, 167, 294, 168, 169,
2096 170, 171, 0, 172, 173, 174, 0, 71, 0, 0,
2097 0, 0, 0, 0, 60, 61, 397, 83, 63, 64,
2098 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2099 0, 60, 61, 0, 83, 63, 64, 65, 66, 67,
2100 68, 69, 70, 384, 1, 0, 2, 0, 0, 0,
2101 0, 0, 0, 71, 0, 0, 0, 0, 60, 61,
2102 428, 83, 63, 64, 65, 66, 67, 68, 69, 70,
2103 71, 1, 0, 2, 0, 60, 61, 0, 83, 84,
2104 85, 86, 87, 88, 89, 90, 70, 484, 1, 0,
2105 2, 0, 0, 0, 0, 0, 0, 71, 0, 0,
2106 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
2107 75, 0, 0, 0, 71, 0, 60, 61, 0, 83,
2108 63, 64, 65, 66, 67, 68, 69, 70, 0, 1,
2109 0, 2, 0, 60, 61, 0, 187, 63, 64, 65,
2110 66, 67, 68, 69, 70, 0, 1, 0, 2, 0,
2111 72, 73, 0, 0, 74, 71, 75, 0, 0, 0,
2112 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
2113 0, 74, 71, 75, 60, 61, 0, 330, 63, 64,
2114 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2115 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
2116 75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2117 0, 72, 73, 71, 0, 74, 0, 75, 0, 0,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2120 0, 260, 0, 0, 0, 0, 0, 0, 0, 0,
2121 0, 0, 72, 73, 261, 0, 74, 0, 75, 0,
2122 0, 0, 0, 0, 262, 263, 0, 0, 0, 72,
2123 73, 0, 0, 74, 0, 75, 0, 264, 265, 266,
2124 267, 268, 269, 141, 142, 143, 144, 145, 146, 147,
2125 148, 149, 150, 151, 152, 270, 271, 0, 0, 0,
2126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2127 72, 73, 0, 0, 74, 0, 75, 272, 273, 274,
2128 0, 0, 275, 156, 157, 158, 159, 160, 161, 162,
2129 163, 164, 165, 166, 167, 276, 277, 169, 170, 171,
2133 static const short int yycheck[] =
2135 23, 0, 62, 199, 266, 176, 177, 343, 4, 25,
2136 209, 210, 11, 10, 11, 12, 13, 19, 10, 11,
2137 12, 13, 267, 83, 26, 12, 31, 36, 18, 12,
2138 20, 115, 116, 339, 48, 49, 50, 136, 136, 51,
2139 52, 93, 287, 136, 29, 30, 136, 264, 53, 148,
2140 148, 357, 75, 67, 138, 148, 146, 274, 135, 82,
2141 277, 278, 279, 280, 281, 136, 53, 284, 285, 57,
2142 53, 137, 81, 139, 140, 146, 0, 5, 6, 102,
2143 8, 9, 10, 11, 12, 13, 14, 15, 16, 0,
2144 18, 0, 20, 9, 18, 135, 20, 21, 137, 135,
2145 16, 140, 125, 27, 28, 548, 135, 146, 107, 18,
2146 137, 20, 21, 140, 557, 142, 44, 136, 27, 28,
2147 41, 136, 43, 47, 135, 144, 325, 187, 188, 144,
2148 54, 147, 135, 137, 58, 18, 140, 20, 47, 20,
2149 144, 136, 359, 19, 139, 54, 148, 144, 138, 58,
2150 20, 147, 144, 37, 38, 39, 142, 137, 42, 495,
2151 140, 497, 137, 138, 360, 88, 89, 90, 91, 92,
2152 93, 94, 95, 96, 97, 23, 24, 4, 201, 202,
2153 203, 137, 138, 206, 140, 208, 10, 11, 12, 13,
2154 189, 60, 61, 62, 63, 64, 65, 66, 415, 20,
2155 417, 418, 419, 136, 137, 138, 423, 140, 20, 136,
2156 3, 4, 139, 141, 142, 432, 4, 145, 4, 147,
2157 148, 136, 137, 138, 136, 140, 397, 139, 3, 4,
2158 239, 240, 241, 242, 243, 295, 136, 7, 261, 139,
2159 137, 264, 251, 252, 253, 254, 3, 4, 7, 272,
2160 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
2161 283, 284, 285, 3, 4, 3, 4, 4, 115, 116,
2162 330, 111, 112, 34, 35, 327, 7, 539, 138, 143,
2163 332, 333, 143, 500, 501, 502, 338, 549, 138, 138,
2164 20, 136, 138, 345, 138, 138, 138, 138, 307, 308,
2165 138, 353, 354, 326, 138, 314, 23, 24, 138, 20,
2166 146, 55, 138, 138, 136, 138, 339, 340, 341, 139,
2167 136, 139, 136, 136, 33, 385, 136, 146, 136, 136,
2168 136, 20, 4, 136, 357, 358, 359, 136, 136, 136,
2169 363, 136, 136, 33, 136, 136, 136, 136, 31, 59,
2170 20, 136, 139, 405, 406, 407, 379, 136, 142, 136,
2171 136, 413, 136, 372, 373, 374, 375, 136, 377, 378,
2172 136, 380, 424, 425, 139, 139, 136, 94, 95, 96,
2173 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2174 107, 139, 415, 416, 417, 418, 419, 139, 16, 422,
2175 423, 453, 16, 455, 138, 4, 458, 136, 136, 432,
2176 332, 333, 464, 465, 136, 136, 338, 136, 136, 139,
2177 443, 430, 431, 345, 136, 485, 139, 53, 4, 136,
2178 138, 353, 354, 136, 136, 139, 20, 142, 490, 491,
2179 139, 493, 494, 442, 139, 136, 498, 470, 53, 16,
2180 144, 33, 144, 16, 506, 136, 16, 136, 16, 72,
2181 16, 193, 271, 107, 363, 474, 518, 476, 477, 492,
2182 193, 444, 208, 125, 526, 11, 93, 500, 501, 502,
2183 540, 512, 505, 405, 406, 407, 48, 193, 270, -1,
2184 51, 413, 193, 412, 546, 505, -1, -1, 558, 551,
2185 -1, -1, 424, 425, -1, -1, -1, 559, -1, -1,
2186 -1, -1, 564, 512, -1, -1, 568, 569, 541, -1,
2187 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2188 -1, 453, -1, 455, -1, -1, 458, -1, -1, -1,
2189 -1, -1, 464, 465, 5, 6, -1, 8, 9, 10,
2190 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2191 -1, -1, -1, -1, -1, 17, -1, -1, 490, 491,
2192 -1, 493, 494, -1, -1, -1, 498, 29, 30, -1,
2193 5, 6, -1, 44, 506, 37, 38, 39, 40, 41,
2194 42, 43, -1, 18, 46, 20, 518, 22, -1, -1,
2195 -1, -1, -1, -1, 526, -1, -1, -1, -1, -1,
2196 35, 36, -1, -1, -1, -1, -1, -1, -1, -1,
2197 -1, -1, -1, -1, 546, -1, -1, -1, -1, 551,
2198 -1, -1, -1, -1, -1, -1, -1, 559, -1, -1,
2199 -1, -1, 564, -1, -1, -1, 568, 569, -1, 74,
2200 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2201 85, 86, 87, -1, -1, -1, -1, -1, -1, -1,
2202 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2203 141, 142, -1, -1, 145, -1, 147, 148, 113, 114,
2204 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2205 125, -1, 127, 128, 129, 130, -1, 132, 133, 134,
2206 -1, -1, 137, -1, -1, 140, -1, 142, -1, -1,
2207 145, -1, 147, -1, 149, 5, 6, -1, 8, 9,
2208 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2209 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2210 -1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
2211 4, 5, 6, 7, 44, -1, -1, -1, -1, -1,
2212 -1, -1, -1, -1, 18, -1, 20, -1, 22, 23,
2213 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2214 -1, 35, 36, -1, -1, -1, -1, -1, -1, -1,
2215 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2216 -1, 5, 6, 57, 8, 9, 10, 11, 12, 13,
2217 14, 15, 16, -1, 18, -1, 20, -1, -1, -1,
2218 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2219 84, 85, 86, 87, -1, -1, -1, -1, -1, -1,
2220 44, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2221 -1, 141, 142, -1, -1, 145, -1, 147, 148, 113,
2222 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2223 124, 125, -1, 127, 128, 129, 130, -1, 132, 133,
2224 134, -1, -1, 137, -1, -1, 140, -1, -1, -1,
2225 -1, 145, 3, 4, 5, 6, 7, -1, -1, -1,
2226 -1, -1, -1, -1, -1, -1, -1, 18, -1, 20,
2227 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2228 -1, -1, -1, -1, 35, 36, -1, -1, -1, -1,
2229 -1, -1, -1, -1, -1, -1, -1, 141, 142, -1,
2230 144, 145, -1, 147, 5, 6, 57, 8, 9, 10,
2231 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2232 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2233 81, 82, 83, 84, 85, 86, 87, -1, -1, -1,
2234 -1, -1, -1, 44, -1, -1, -1, -1, -1, -1,
2235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2236 -1, -1, 113, 114, 115, 116, 117, 118, 119, 120,
2237 121, 122, 123, 124, 125, -1, 127, 128, 129, 130,
2238 -1, 132, 133, 134, 3, 4, -1, -1, 7, -1,
2239 -1, -1, -1, -1, 145, -1, -1, -1, -1, -1,
2240 -1, -1, -1, 22, 23, 24, -1, -1, -1, -1,
2241 -1, -1, -1, -1, -1, -1, 35, 36, -1, -1,
2242 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2243 -1, -1, -1, -1, -1, -1, -1, -1, 57, -1,
2244 141, 142, -1, -1, 145, -1, 147, -1, -1, -1,
2245 -1, -1, -1, -1, -1, 74, 75, 76, 77, 78,
2246 79, 80, 81, 82, 83, 84, 85, 86, 87, -1,
2247 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2248 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2249 -1, 18, -1, 20, 113, 114, 115, 116, 117, 118,
2250 119, 120, 121, 122, 123, 124, 125, 34, 127, 128,
2251 129, 130, -1, 132, 133, 134, -1, 44, -1, -1,
2252 -1, -1, -1, -1, 5, 6, 145, 8, 9, 10,
2253 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2254 -1, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2255 14, 15, 16, 34, 18, -1, 20, -1, -1, -1,
2256 -1, -1, -1, 44, -1, -1, -1, -1, 5, 6,
2257 34, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2258 44, 18, -1, 20, -1, 5, 6, -1, 8, 9,
2259 10, 11, 12, 13, 14, 15, 16, 34, 18, -1,
2260 20, -1, -1, -1, -1, -1, -1, 44, -1, -1,
2261 -1, -1, -1, -1, 141, 142, -1, -1, 145, -1,
2262 147, -1, -1, -1, 44, -1, 5, 6, -1, 8,
2263 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
2264 -1, 20, -1, 5, 6, -1, 8, 9, 10, 11,
2265 12, 13, 14, 15, 16, -1, 18, -1, 20, -1,
2266 141, 142, -1, -1, 145, 44, 147, -1, -1, -1,
2267 -1, -1, -1, -1, -1, -1, -1, 141, 142, -1,
2268 -1, 145, 44, 147, 5, 6, -1, 8, 9, 10,
2269 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2270 -1, -1, -1, -1, 141, 142, -1, -1, 145, -1,
2271 147, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2272 -1, 141, 142, 44, -1, 145, -1, 147, -1, -1,
2273 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2274 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2275 -1, 32, -1, -1, -1, -1, -1, -1, -1, -1,
2276 -1, -1, 141, 142, 45, -1, 145, -1, 147, -1,
2277 -1, -1, -1, -1, 55, 56, -1, -1, -1, 141,
2278 142, -1, -1, 145, -1, 147, -1, 68, 69, 70,
2279 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2280 81, 82, 83, 84, 85, 86, 87, -1, -1, -1,
2281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2282 141, 142, -1, -1, 145, -1, 147, 108, 109, 110,
2283 -1, -1, 113, 114, 115, 116, 117, 118, 119, 120,
2284 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2288 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2289 symbol of state STATE-NUM. */
2290 static const unsigned char yystos[] =
2292 0, 18, 20, 21, 27, 28, 47, 54, 58, 160,
2293 186, 187, 188, 199, 190, 189, 48, 49, 50, 67,
2294 196, 135, 57, 17, 29, 30, 37, 38, 39, 40,
2295 41, 42, 43, 46, 161, 162, 185, 0, 188, 135,
2296 41, 43, 163, 208, 37, 38, 39, 42, 164, 205,
2297 207, 214, 135, 135, 135, 135, 142, 197, 20, 194,
2298 5, 6, 8, 9, 10, 11, 12, 13, 14, 15,
2299 16, 44, 141, 142, 145, 147, 151, 175, 176, 199,
2300 211, 185, 185, 8, 9, 10, 11, 12, 13, 14,
2301 15, 158, 159, 176, 182, 60, 61, 62, 63, 64,
2302 65, 66, 165, 203, 203, 19, 215, 216, 26, 148,
2303 206, 215, 20, 51, 52, 195, 4, 20, 20, 198,
2304 137, 168, 4, 4, 4, 147, 148, 176, 181, 140,
2305 168, 182, 176, 23, 24, 3, 4, 7, 22, 35,
2306 36, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2307 83, 84, 85, 86, 87, 113, 114, 115, 116, 117,
2308 118, 119, 120, 121, 122, 123, 124, 125, 127, 128,
2309 129, 130, 132, 133, 134, 142, 145, 147, 149, 152,
2310 153, 154, 155, 183, 211, 191, 4, 8, 176, 178,
2311 25, 147, 204, 160, 219, 136, 144, 115, 116, 138,
2312 166, 138, 143, 143, 148, 181, 136, 148, 138, 192,
2313 193, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2314 97, 156, 23, 24, 94, 95, 96, 97, 98, 99,
2315 100, 101, 102, 103, 104, 105, 106, 107, 157, 138,
2316 138, 138, 138, 138, 144, 182, 184, 184, 148, 184,
2317 20, 138, 138, 138, 138, 136, 173, 168, 168, 199,
2318 32, 45, 55, 56, 68, 69, 70, 71, 72, 73,
2319 86, 87, 108, 109, 110, 113, 126, 127, 131, 132,
2320 133, 134, 152, 153, 154, 155, 217, 223, 224, 225,
2321 226, 20, 166, 167, 34, 176, 177, 179, 180, 176,
2322 176, 146, 148, 176, 180, 173, 173, 138, 138, 182,
2323 182, 182, 182, 182, 136, 144, 146, 148, 182, 182,
2324 182, 182, 31, 53, 171, 174, 138, 176, 213, 55,
2325 8, 213, 9, 16, 10, 11, 12, 13, 158, 165,
2326 156, 157, 176, 176, 213, 176, 176, 220, 213, 213,
2327 213, 213, 213, 176, 176, 213, 213, 165, 111, 112,
2328 136, 139, 168, 136, 139, 144, 146, 146, 139, 182,
2329 182, 222, 136, 136, 136, 136, 182, 136, 136, 33,
2330 136, 20, 4, 173, 34, 176, 201, 202, 3, 4,
2331 7, 22, 23, 24, 35, 36, 57, 145, 183, 210,
2332 211, 212, 212, 212, 212, 178, 176, 176, 136, 170,
2333 136, 170, 212, 142, 136, 136, 136, 136, 136, 136,
2334 212, 212, 33, 136, 178, 176, 213, 166, 34, 177,
2335 136, 136, 136, 139, 182, 182, 182, 182, 182, 182,
2336 176, 182, 168, 136, 139, 59, 209, 184, 136, 136,
2337 212, 212, 212, 12, 53, 12, 222, 212, 142, 213,
2338 176, 213, 213, 213, 136, 136, 176, 213, 212, 212,
2339 136, 182, 182, 213, 136, 139, 136, 136, 139, 139,
2340 139, 139, 199, 200, 34, 176, 171, 172, 20, 146,
2341 16, 16, 138, 136, 136, 212, 4, 212, 136, 212,
2342 136, 136, 136, 212, 212, 138, 176, 139, 139, 182,
2343 182, 182, 168, 53, 169, 136, 212, 212, 176, 221,
2344 212, 212, 136, 170, 170, 212, 136, 213, 213, 213,
2345 221, 212, 139, 139, 139, 200, 4, 20, 136, 142,
2346 212, 136, 139, 144, 212, 139, 16, 144, 158, 218,
2347 168, 176, 33, 144, 212, 210, 144, 158, 212, 16,
2348 136, 210, 168, 212, 16, 136, 72, 212, 16, 16,
2352 #define yyerrok (yyerrstatus = 0)
2353 #define yyclearin (yychar = YYEMPTY)
2354 #define YYEMPTY (-2)
2357 #define YYACCEPT goto yyacceptlab
2358 #define YYABORT goto yyabortlab
2359 #define YYERROR goto yyerrorlab
2362 /* Like YYERROR except do call yyerror. This remains here temporarily
2363 to ease the transition to the new meaning of YYERROR, for GCC.
2364 Once GCC version 2 has supplanted version 1, this can go. */
2366 #define YYFAIL goto yyerrlab
2368 #define YYRECOVERING() (!!yyerrstatus)
2370 #define YYBACKUP(Token, Value) \
2372 if (yychar == YYEMPTY && yylen == 1) \
2376 yytoken = YYTRANSLATE (yychar); \
2382 yyerror (YY_("syntax error: cannot back up")); \
2389 #define YYERRCODE 256
2392 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2393 If N is 0, then set CURRENT to the empty location which ends
2394 the previous symbol: RHS[0] (always defined). */
2396 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2397 #ifndef YYLLOC_DEFAULT
2398 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2402 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2403 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2404 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2405 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2409 (Current).first_line = (Current).last_line = \
2410 YYRHSLOC (Rhs, 0).last_line; \
2411 (Current).first_column = (Current).last_column = \
2412 YYRHSLOC (Rhs, 0).last_column; \
2418 /* YY_LOCATION_PRINT -- Print the location on the stream.
2419 This macro was not mandated originally: define only if we know
2420 we won't break user code: when these are the locations we know. */
2422 #ifndef YY_LOCATION_PRINT
2423 # if YYLTYPE_IS_TRIVIAL
2424 # define YY_LOCATION_PRINT(File, Loc) \
2425 fprintf (File, "%d.%d-%d.%d", \
2426 (Loc).first_line, (Loc).first_column, \
2427 (Loc).last_line, (Loc).last_column)
2429 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2434 /* YYLEX -- calling `yylex' with the right arguments. */
2437 # define YYLEX yylex (YYLEX_PARAM)
2439 # define YYLEX yylex ()
2442 /* Enable debugging if requested. */
2446 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2447 # define YYFPRINTF fprintf
2450 # define YYDPRINTF(Args) \
2456 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2460 YYFPRINTF (stderr, "%s ", Title); \
2461 yysymprint (stderr, \
2463 YYFPRINTF (stderr, "\n"); \
2467 /*------------------------------------------------------------------.
2468 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2470 `------------------------------------------------------------------*/
2472 #if defined (__STDC__) || defined (__cplusplus)
2474 yy_stack_print (short int *bottom, short int *top)
2477 yy_stack_print (bottom, top)
2482 YYFPRINTF (stderr, "Stack now");
2483 for (/* Nothing. */; bottom <= top; ++bottom)
2484 YYFPRINTF (stderr, " %d", *bottom);
2485 YYFPRINTF (stderr, "\n");
2488 # define YY_STACK_PRINT(Bottom, Top) \
2491 yy_stack_print ((Bottom), (Top)); \
2495 /*------------------------------------------------.
2496 | Report that the YYRULE is going to be reduced. |
2497 `------------------------------------------------*/
2499 #if defined (__STDC__) || defined (__cplusplus)
2501 yy_reduce_print (int yyrule)
2504 yy_reduce_print (yyrule)
2509 unsigned long int yylno = yyrline[yyrule];
2510 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2512 /* Print the symbols being reduced, and their result. */
2513 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2514 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2515 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2518 # define YY_REDUCE_PRINT(Rule) \
2521 yy_reduce_print (Rule); \
2524 /* Nonzero means print parse trace. It is left uninitialized so that
2525 multiple parsers can coexist. */
2527 #else /* !YYDEBUG */
2528 # define YYDPRINTF(Args)
2529 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2530 # define YY_STACK_PRINT(Bottom, Top)
2531 # define YY_REDUCE_PRINT(Rule)
2532 #endif /* !YYDEBUG */
2535 /* YYINITDEPTH -- initial size of the parser's stacks. */
2537 # define YYINITDEPTH 200
2540 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2541 if the built-in stack extension method is used).
2543 Do not make this value too large; the results are undefined if
2544 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2545 evaluated with infinite-precision integer arithmetic. */
2548 # define YYMAXDEPTH 10000
2556 # if defined (__GLIBC__) && defined (_STRING_H)
2557 # define yystrlen strlen
2559 /* Return the length of YYSTR. */
2561 # if defined (__STDC__) || defined (__cplusplus)
2562 yystrlen (const char *yystr)
2568 const char *yys = yystr;
2570 while (*yys++ != '\0')
2573 return yys - yystr - 1;
2579 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2580 # define yystpcpy stpcpy
2582 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2585 # if defined (__STDC__) || defined (__cplusplus)
2586 yystpcpy (char *yydest, const char *yysrc)
2588 yystpcpy (yydest, yysrc)
2594 const char *yys = yysrc;
2596 while ((*yyd++ = *yys++) != '\0')
2605 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2606 quotes and backslashes, so that it's suitable for yyerror. The
2607 heuristic is that double-quoting is unnecessary unless the string
2608 contains an apostrophe, a comma, or backslash (other than
2609 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2610 null, do not copy; instead, return the length of what the result
2613 yytnamerr (char *yyres, const char *yystr)
2618 char const *yyp = yystr;
2625 goto do_not_strip_quotes;
2629 goto do_not_strip_quotes;
2642 do_not_strip_quotes: ;
2646 return yystrlen (yystr);
2648 return yystpcpy (yyres, yystr) - yyres;
2652 #endif /* YYERROR_VERBOSE */
2657 /*--------------------------------.
2658 | Print this symbol on YYOUTPUT. |
2659 `--------------------------------*/
2661 #if defined (__STDC__) || defined (__cplusplus)
2663 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2666 yysymprint (yyoutput, yytype, yyvaluep)
2672 /* Pacify ``unused variable'' warnings. */
2675 if (yytype < YYNTOKENS)
2676 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2678 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2682 if (yytype < YYNTOKENS)
2683 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2690 YYFPRINTF (yyoutput, ")");
2693 #endif /* ! YYDEBUG */
2694 /*-----------------------------------------------.
2695 | Release the memory associated to this symbol. |
2696 `-----------------------------------------------*/
2698 #if defined (__STDC__) || defined (__cplusplus)
2700 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2703 yydestruct (yymsg, yytype, yyvaluep)
2709 /* Pacify ``unused variable'' warnings. */
2714 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2725 /* Prevent warnings from -Wmissing-prototypes. */
2727 #ifdef YYPARSE_PARAM
2728 # if defined (__STDC__) || defined (__cplusplus)
2729 int yyparse (void *YYPARSE_PARAM);
2733 #else /* ! YYPARSE_PARAM */
2734 #if defined (__STDC__) || defined (__cplusplus)
2739 #endif /* ! YYPARSE_PARAM */
2743 /* The look-ahead symbol. */
2746 /* The semantic value of the look-ahead symbol. */
2749 /* Number of syntax errors so far. */
2758 #ifdef YYPARSE_PARAM
2759 # if defined (__STDC__) || defined (__cplusplus)
2760 int yyparse (void *YYPARSE_PARAM)
2762 int yyparse (YYPARSE_PARAM)
2763 void *YYPARSE_PARAM;
2765 #else /* ! YYPARSE_PARAM */
2766 #if defined (__STDC__) || defined (__cplusplus)
2780 /* Number of tokens to shift before error messages enabled. */
2782 /* Look-ahead token as an internal (translated) token number. */
2785 /* Three stacks and their tools:
2786 `yyss': related to states,
2787 `yyvs': related to semantic values,
2788 `yyls': related to locations.
2790 Refer to the stacks thru separate pointers, to allow yyoverflow
2791 to reallocate them elsewhere. */
2793 /* The state stack. */
2794 short int yyssa[YYINITDEPTH];
2795 short int *yyss = yyssa;
2798 /* The semantic value stack. */
2799 YYSTYPE yyvsa[YYINITDEPTH];
2800 YYSTYPE *yyvs = yyvsa;
2805 #define YYPOPSTACK (yyvsp--, yyssp--)
2807 YYSIZE_T yystacksize = YYINITDEPTH;
2809 /* The variables used to return semantic value and location from the
2814 /* When reducing, the number of symbols on the RHS of the reduced
2818 YYDPRINTF ((stderr, "Starting parse\n"));
2823 yychar = YYEMPTY; /* Cause a token to be read. */
2825 /* Initialize stack pointers.
2826 Waste one element of value and location stack
2827 so that they stay on the same level as the state stack.
2828 The wasted elements are never initialized. */
2835 /*------------------------------------------------------------.
2836 | yynewstate -- Push a new state, which is found in yystate. |
2837 `------------------------------------------------------------*/
2839 /* In all cases, when you get here, the value and location stacks
2840 have just been pushed. so pushing a state here evens the stacks.
2847 if (yyss + yystacksize - 1 <= yyssp)
2849 /* Get the current used size of the three stacks, in elements. */
2850 YYSIZE_T yysize = yyssp - yyss + 1;
2854 /* Give user a chance to reallocate the stack. Use copies of
2855 these so that the &'s don't force the real ones into
2857 YYSTYPE *yyvs1 = yyvs;
2858 short int *yyss1 = yyss;
2861 /* Each stack pointer address is followed by the size of the
2862 data in use in that stack, in bytes. This used to be a
2863 conditional around just the two extra args, but that might
2864 be undefined if yyoverflow is a macro. */
2865 yyoverflow (YY_("memory exhausted"),
2866 &yyss1, yysize * sizeof (*yyssp),
2867 &yyvs1, yysize * sizeof (*yyvsp),
2874 #else /* no yyoverflow */
2875 # ifndef YYSTACK_RELOCATE
2876 goto yyexhaustedlab;
2878 /* Extend the stack our own way. */
2879 if (YYMAXDEPTH <= yystacksize)
2880 goto yyexhaustedlab;
2882 if (YYMAXDEPTH < yystacksize)
2883 yystacksize = YYMAXDEPTH;
2886 short int *yyss1 = yyss;
2887 union yyalloc *yyptr =
2888 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2890 goto yyexhaustedlab;
2891 YYSTACK_RELOCATE (yyss);
2892 YYSTACK_RELOCATE (yyvs);
2894 # undef YYSTACK_RELOCATE
2896 YYSTACK_FREE (yyss1);
2899 #endif /* no yyoverflow */
2901 yyssp = yyss + yysize - 1;
2902 yyvsp = yyvs + yysize - 1;
2905 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2906 (unsigned long int) yystacksize));
2908 if (yyss + yystacksize - 1 <= yyssp)
2912 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2921 /* Do appropriate processing given the current state. */
2922 /* Read a look-ahead token if we need one and don't already have one. */
2925 /* First try to decide what to do without reference to look-ahead token. */
2927 yyn = yypact[yystate];
2928 if (yyn == YYPACT_NINF)
2931 /* Not known => get a look-ahead token if don't already have one. */
2933 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2934 if (yychar == YYEMPTY)
2936 YYDPRINTF ((stderr, "Reading a token: "));
2940 if (yychar <= YYEOF)
2942 yychar = yytoken = YYEOF;
2943 YYDPRINTF ((stderr, "Now at end of input.\n"));
2947 yytoken = YYTRANSLATE (yychar);
2948 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2951 /* If the proper action on seeing token YYTOKEN is to reduce or to
2952 detect an error, take that action. */
2954 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2959 if (yyn == 0 || yyn == YYTABLE_NINF)
2968 /* Shift the look-ahead token. */
2969 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2971 /* Discard the token being shifted unless it is eof. */
2972 if (yychar != YYEOF)
2978 /* Count tokens shifted since error; after three, turn off error
2987 /*-----------------------------------------------------------.
2988 | yydefault -- do the default action for the current state. |
2989 `-----------------------------------------------------------*/
2991 yyn = yydefact[yystate];
2997 /*-----------------------------.
2998 | yyreduce -- Do a reduction. |
2999 `-----------------------------*/
3001 /* yyn is the number of a rule to reduce with. */
3004 /* If YYLEN is nonzero, implement the default value of the action:
3007 Otherwise, the following line sets YYVAL to garbage.
3008 This behavior is undocumented and Bison
3009 users should not rely upon it. Assigning to YYVAL
3010 unconditionally makes the parser a bit smaller, and it avoids a
3011 GCC warning that YYVAL may be used uninitialized. */
3012 yyval = yyvsp[1-yylen];
3015 YY_REDUCE_PRINT (yyn);
3019 #line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3021 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3022 GEN_ERROR("Value too large for type!");
3023 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3029 #line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3030 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3034 #line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3035 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3039 #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3040 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3044 #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3045 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3049 #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3050 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3054 #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3055 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3059 #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3060 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3064 #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3065 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3069 #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3070 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3074 #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3075 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3079 #line 1060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3080 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3084 #line 1060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3085 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3089 #line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3090 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3094 #line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3095 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3099 #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3100 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3104 #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3105 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3109 #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3110 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3114 #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3115 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3119 #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3120 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3124 #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3125 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3129 #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3130 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3134 #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3135 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3139 #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3140 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3144 #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3145 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3149 #line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3150 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3154 #line 1068 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3155 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3159 #line 1077 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3161 (yyval.StrVal) = (yyvsp[-1].StrVal);
3167 #line 1081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3175 #line 1087 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3176 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3180 #line 1088 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3181 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3185 #line 1089 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3186 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3190 #line 1090 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3191 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3195 #line 1091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3196 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3200 #line 1095 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3205 #line 1096 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3210 #line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3215 #line 1101 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3220 #line 1102 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3225 #line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3230 #line 1107 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3235 #line 1108 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3240 #line 1109 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3245 #line 1110 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3246 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3250 #line 1111 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3251 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3255 #line 1114 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.UIntVal) = CallingConv::C; ;}
3260 #line 1115 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3261 { (yyval.UIntVal) = CallingConv::C; ;}
3265 #line 1116 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3266 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3270 #line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.UIntVal) = CallingConv::Fast; ;}
3275 #line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3276 { (yyval.UIntVal) = CallingConv::Cold; ;}
3280 #line 1119 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3281 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3285 #line 1120 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3286 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3290 #line 1121 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3292 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3293 GEN_ERROR("Calling conv too large!");
3294 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3300 #line 1128 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3301 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3305 #line 1129 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3306 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3310 #line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3311 { (yyval.ParamAttrs) = (yyvsp[0].ParamAttrs); ;}
3315 #line 1133 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3317 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-2].ParamAttrs) | (yyvsp[0].ParamAttrs));
3322 #line 1138 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3323 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3327 #line 1139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3328 { (yyval.ParamAttrs) = (yyvsp[0].ParamAttrs); ;}
3332 #line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3333 { (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs); ;}
3337 #line 1145 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3338 { (yyval.UIntVal) = 0; ;}
3342 #line 1146 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3344 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3345 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3346 GEN_ERROR("Alignment must be a power of two!");
3352 #line 1152 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3353 { (yyval.UIntVal) = 0; ;}
3357 #line 1153 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3359 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3360 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3361 GEN_ERROR("Alignment must be a power of two!");
3367 #line 1161 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3369 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3370 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3371 GEN_ERROR("Invalid character in section name!");
3372 (yyval.StrVal) = (yyvsp[0].StrVal);
3378 #line 1169 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3379 { (yyval.StrVal) = 0; ;}
3383 #line 1170 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3384 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3388 #line 1175 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3393 #line 1176 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3398 #line 1177 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3400 CurGV->setSection((yyvsp[0].StrVal));
3401 free((yyvsp[0].StrVal));
3407 #line 1182 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3409 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3410 GEN_ERROR("Alignment must be a power of two!");
3411 CurGV->setAlignment((yyvsp[0].UInt64Val));
3417 #line 1198 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3419 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3425 #line 1202 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3427 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3433 #line 1206 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3435 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3436 GEN_ERROR("Cannot form a pointer to a basic block");
3437 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3438 delete (yyvsp[-1].TypeVal);
3444 #line 1213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3445 { // Named types are also simple types...
3446 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3448 (yyval.TypeVal) = new PATypeHolder(tmp);
3453 #line 1218 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3454 { // Type UpReference
3455 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3456 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3457 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3458 (yyval.TypeVal) = new PATypeHolder(OT);
3459 UR_OUT("New Upreference!\n");
3465 #line 1226 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3467 std::vector<const Type*> Params;
3468 std::vector<FunctionType::ParameterAttributes> Attrs;
3469 Attrs.push_back((yyvsp[-3].ParamAttrs));
3470 for (TypeWithAttrsList::iterator I=(yyvsp[-1].TypeWithAttrsList)->begin(), E=(yyvsp[-1].TypeWithAttrsList)->end(); I != E; ++I) {
3471 Params.push_back(I->Ty->get());
3472 if (I->Ty->get() != Type::VoidTy)
3473 Attrs.push_back(I->Attrs);
3475 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3476 if (isVarArg) Params.pop_back();
3478 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3479 delete (yyvsp[-1].TypeWithAttrsList); // Delete the argument list
3480 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3481 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3487 #line 1244 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3489 std::vector<const Type*> Params;
3490 std::vector<FunctionType::ParameterAttributes> Attrs;
3491 Attrs.push_back((yyvsp[-3].ParamAttrs));
3492 for (TypeWithAttrsList::iterator I=(yyvsp[-1].TypeWithAttrsList)->begin(), E=(yyvsp[-1].TypeWithAttrsList)->end(); I != E; ++I) {
3493 Params.push_back(I->Ty->get());
3494 if (I->Ty->get() != Type::VoidTy)
3495 Attrs.push_back(I->Attrs);
3497 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3498 if (isVarArg) Params.pop_back();
3500 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3501 delete (yyvsp[-1].TypeWithAttrsList); // Delete the argument list
3502 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3508 #line 1262 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3509 { // Sized array type?
3510 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3511 delete (yyvsp[-1].TypeVal);
3517 #line 1267 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3518 { // Packed array type?
3519 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3520 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3521 GEN_ERROR("Unsigned result not equal to signed result");
3522 if (!ElemTy->isPrimitiveType())
3523 GEN_ERROR("Elemental type of a PackedType must be primitive");
3524 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3525 GEN_ERROR("Vector length should be a power of 2!");
3526 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3527 delete (yyvsp[-1].TypeVal);
3533 #line 1279 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3534 { // Structure type?
3535 std::vector<const Type*> Elements;
3536 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3537 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3538 Elements.push_back(*I);
3540 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3541 delete (yyvsp[-1].TypeList);
3547 #line 1289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3548 { // Empty structure type?
3549 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3555 #line 1293 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3557 std::vector<const Type*> Elements;
3558 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3559 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3560 Elements.push_back(*I);
3562 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3563 delete (yyvsp[-2].TypeList);
3569 #line 1303 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3570 { // Empty structure type?
3571 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3577 #line 1310 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3579 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3580 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3585 #line 1317 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3587 if (!UpRefs.empty())
3588 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3589 if (!(*(yyvsp[-1].TypeVal))->isFirstClassType())
3590 GEN_ERROR("LLVM functions cannot return aggregate types!");
3591 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3592 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3597 #line 1325 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3599 (yyval.TypeWithAttrs).Ty = new PATypeHolder(Type::VoidTy);
3600 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3605 #line 1331 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3607 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3608 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3614 #line 1336 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3616 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3622 #line 1344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3624 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3625 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3626 TWA.Ty = new PATypeHolder(Type::VoidTy);
3627 (yyval.TypeWithAttrsList)->push_back(TWA);
3633 #line 1351 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3635 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3636 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3637 TWA.Ty = new PATypeHolder(Type::VoidTy);
3638 (yyval.TypeWithAttrsList)->push_back(TWA);
3644 #line 1358 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3646 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3652 #line 1366 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3654 (yyval.TypeList) = new std::list<PATypeHolder>();
3655 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3661 #line 1371 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3663 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3669 #line 1382 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3670 { // Nonempty unsized arr
3671 if (!UpRefs.empty())
3672 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3673 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3675 GEN_ERROR("Cannot make array constant with type: '" +
3676 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3677 const Type *ETy = ATy->getElementType();
3678 int NumElements = ATy->getNumElements();
3680 // Verify that we have the correct size...
3681 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3682 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3683 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3684 itostr(NumElements) + "!");
3686 // Verify all elements are correct type!
3687 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3688 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3689 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3690 ETy->getDescription() +"' as required!\nIt is of type '"+
3691 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3694 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3695 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3701 #line 1410 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3703 if (!UpRefs.empty())
3704 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3705 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3707 GEN_ERROR("Cannot make array constant with type: '" +
3708 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3710 int NumElements = ATy->getNumElements();
3711 if (NumElements != -1 && NumElements != 0)
3712 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3713 " arguments, but has size of " + itostr(NumElements) +"!");
3714 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3715 delete (yyvsp[-2].TypeVal);
3721 #line 1426 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3723 if (!UpRefs.empty())
3724 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3725 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3727 GEN_ERROR("Cannot make array constant with type: '" +
3728 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3730 int NumElements = ATy->getNumElements();
3731 const Type *ETy = ATy->getElementType();
3732 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3733 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3734 GEN_ERROR("Can't build string constant of size " +
3735 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3736 " when array has size " + itostr(NumElements) + "!");
3737 std::vector<Constant*> Vals;
3738 if (ETy == Type::Int8Ty) {
3739 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3740 C != (unsigned char*)EndStr; ++C)
3741 Vals.push_back(ConstantInt::get(ETy, *C));
3743 free((yyvsp[0].StrVal));
3744 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3746 free((yyvsp[0].StrVal));
3747 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3748 delete (yyvsp[-2].TypeVal);
3754 #line 1455 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3755 { // Nonempty unsized arr
3756 if (!UpRefs.empty())
3757 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3758 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3760 GEN_ERROR("Cannot make packed constant with type: '" +
3761 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3762 const Type *ETy = PTy->getElementType();
3763 int NumElements = PTy->getNumElements();
3765 // Verify that we have the correct size...
3766 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3767 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3768 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3769 itostr(NumElements) + "!");
3771 // Verify all elements are correct type!
3772 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3773 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3774 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3775 ETy->getDescription() +"' as required!\nIt is of type '"+
3776 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3779 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3780 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3786 #line 1483 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3788 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3790 GEN_ERROR("Cannot make struct constant with type: '" +
3791 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3793 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3794 GEN_ERROR("Illegal number of initializers for structure type!");
3796 // Check to ensure that constants are compatible with the type initializer!
3797 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3798 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3799 GEN_ERROR("Expected type '" +
3800 STy->getElementType(i)->getDescription() +
3801 "' for element #" + utostr(i) +
3802 " of structure initializer!");
3804 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3805 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3811 #line 1504 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3813 if (!UpRefs.empty())
3814 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3815 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3817 GEN_ERROR("Cannot make struct constant with type: '" +
3818 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3820 if (STy->getNumContainedTypes() != 0)
3821 GEN_ERROR("Illegal number of initializers for structure type!");
3823 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3824 delete (yyvsp[-2].TypeVal);
3830 #line 1519 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3832 if (!UpRefs.empty())
3833 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3834 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3836 GEN_ERROR("Cannot make null pointer constant with type: '" +
3837 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3839 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3840 delete (yyvsp[-1].TypeVal);
3846 #line 1531 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3848 if (!UpRefs.empty())
3849 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3850 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3851 delete (yyvsp[-1].TypeVal);
3857 #line 1538 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3859 if (!UpRefs.empty())
3860 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3861 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3863 GEN_ERROR("Global const reference must be a pointer type!");
3865 // ConstExprs can exist in the body of a function, thus creating
3866 // GlobalValues whenever they refer to a variable. Because we are in
3867 // the context of a function, getValNonImprovising will search the functions
3868 // symbol table instead of the module symbol table for the global symbol,
3869 // which throws things all off. To get around this, we just tell
3870 // getValNonImprovising that we are at global scope here.
3872 Function *SavedCurFn = CurFun.CurrentFunction;
3873 CurFun.CurrentFunction = 0;
3875 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3878 CurFun.CurrentFunction = SavedCurFn;
3880 // If this is an initializer for a constant pointer, which is referencing a
3881 // (currently) undefined variable, create a stub now that shall be replaced
3882 // in the future with the right type of variable.
3885 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3886 const PointerType *PT = cast<PointerType>(Ty);
3888 // First check to see if the forward references value is already created!
3889 PerModuleInfo::GlobalRefsType::iterator I =
3890 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3892 if (I != CurModule.GlobalRefs.end()) {
3893 V = I->second; // Placeholder already exists, use it...
3894 (yyvsp[0].ValIDVal).destroy();
3897 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3899 // Create the forward referenced global.
3901 if (const FunctionType *FTy =
3902 dyn_cast<FunctionType>(PT->getElementType())) {
3903 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3904 CurModule.CurrentModule);
3906 GV = new GlobalVariable(PT->getElementType(), false,
3907 GlobalValue::ExternalLinkage, 0,
3908 Name, CurModule.CurrentModule);
3911 // Keep track of the fact that we have a forward ref to recycle it
3912 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3917 (yyval.ConstVal) = cast<GlobalValue>(V);
3918 delete (yyvsp[-1].TypeVal); // Free the type handle
3924 #line 1601 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3926 if (!UpRefs.empty())
3927 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3928 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3929 GEN_ERROR("Mismatched types for constant expression: " +
3930 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
3931 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3932 delete (yyvsp[-1].TypeVal);
3938 #line 1611 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3940 if (!UpRefs.empty())
3941 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3942 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3943 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3944 GEN_ERROR("Cannot create a null initialized value of this type!");
3945 (yyval.ConstVal) = Constant::getNullValue(Ty);
3946 delete (yyvsp[-1].TypeVal);
3952 #line 1621 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3953 { // integral constants
3954 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3955 GEN_ERROR("Constant value doesn't fit in type!");
3956 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3962 #line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3963 { // integral constants
3964 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3965 GEN_ERROR("Constant value doesn't fit in type!");
3966 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3972 #line 1633 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3973 { // Boolean constants
3974 (yyval.ConstVal) = ConstantBool::getTrue();
3980 #line 1637 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3981 { // Boolean constants
3982 (yyval.ConstVal) = ConstantBool::getFalse();
3988 #line 1641 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3989 { // Float & Double constants
3990 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3991 GEN_ERROR("Floating point constant invalid for type!!");
3992 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3998 #line 1649 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4000 if (!UpRefs.empty())
4001 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4002 Constant *Val = (yyvsp[-3].ConstVal);
4003 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4004 if (!Val->getType()->isFirstClassType())
4005 GEN_ERROR("cast constant expression from a non-primitive type: '" +
4006 Val->getType()->getDescription() + "'!");
4007 if (!Ty->isFirstClassType())
4008 GEN_ERROR("cast constant expression to a non-primitive type: '" +
4009 Ty->getDescription() + "'!");
4010 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
4011 delete (yyvsp[-1].TypeVal);
4016 #line 1663 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4018 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4019 GEN_ERROR("GetElementPtr requires a pointer operand!");
4022 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
4024 GEN_ERROR("Index list invalid for constant getelementptr!");
4026 std::vector<Constant*> IdxVec;
4027 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4028 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4029 IdxVec.push_back(C);
4031 GEN_ERROR("Indices to constant getelementptr must be constants!");
4033 delete (yyvsp[-1].ValueList);
4035 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
4041 #line 1684 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4043 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
4044 GEN_ERROR("Select condition must be of boolean type!");
4045 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4046 GEN_ERROR("Select operand types must match!");
4047 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4053 #line 1692 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4055 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4056 GEN_ERROR("Binary operator types must match!");
4058 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4063 #line 1698 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4065 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4066 GEN_ERROR("Logical operator types must match!");
4067 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4068 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4069 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4070 GEN_ERROR("Logical operator requires integral operands!");
4072 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4078 #line 1709 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4080 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4081 GEN_ERROR("icmp operand types must match!");
4082 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4087 #line 1714 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4089 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4090 GEN_ERROR("fcmp operand types must match!");
4091 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4096 #line 1719 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4098 if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty)
4099 GEN_ERROR("Shift count for shift constant must be i8 type!");
4100 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4101 GEN_ERROR("Shift constant expression requires integer operand!");
4103 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4109 #line 1728 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4111 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4112 GEN_ERROR("Invalid extractelement operands!");
4113 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4119 #line 1734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4121 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4122 GEN_ERROR("Invalid insertelement operands!");
4123 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4129 #line 1740 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4131 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4132 GEN_ERROR("Invalid shufflevector operands!");
4133 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4139 #line 1749 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4141 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4147 #line 1753 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4149 (yyval.ConstVector) = new std::vector<Constant*>();
4150 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4156 #line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4157 { (yyval.BoolVal) = false; ;}
4161 #line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4162 { (yyval.BoolVal) = true; ;}
4166 #line 1772 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4168 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4169 CurModule.ModuleDone();
4175 #line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4177 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4178 CurModule.ModuleDone();
4184 #line 1790 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4185 { CurFun.isDeclare = false ;}
4189 #line 1790 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4191 CurFun.FunctionDone();
4197 #line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4198 { CurFun.isDeclare = true; ;}
4202 #line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4209 #line 1797 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4216 #line 1800 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4218 // Emit an error if there are any unresolved types left.
4219 if (!CurModule.LateResolveTypes.empty()) {
4220 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4221 if (DID.Type == ValID::NameVal) {
4222 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4224 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4232 #line 1812 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4234 if (!UpRefs.empty())
4235 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4236 // Eagerly resolve types. This is not an optimization, this is a
4237 // requirement that is due to the fact that we could have this:
4239 // %list = type { %list * }
4240 // %list = type { %list * } ; repeated type decl
4242 // If types are not resolved eagerly, then the two types will not be
4243 // determined to be the same type!
4245 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4247 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4249 // If this is a named type that is not a redefinition, add it to the slot
4251 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4254 delete (yyvsp[0].TypeVal);
4260 #line 1836 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4262 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4264 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4266 // If this is a named type that is not a redefinition, add it to the slot
4268 CurModule.Types.push_back((yyvsp[0].PrimType));
4275 #line 1847 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4276 { /* "Externally Visible" Linkage */
4277 if ((yyvsp[0].ConstVal) == 0)
4278 GEN_ERROR("Global value initializer is not a constant!");
4279 CurGV = ParseGlobalVariable((yyvsp[-2].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal),
4280 (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4286 #line 1853 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4293 #line 1856 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4295 if ((yyvsp[0].ConstVal) == 0)
4296 GEN_ERROR("Global value initializer is not a constant!");
4297 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4303 #line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4310 #line 1864 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4312 if (!UpRefs.empty())
4313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4314 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4316 delete (yyvsp[0].TypeVal);
4321 #line 1870 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4329 #line 1874 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4336 #line 1877 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4343 #line 1883 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4345 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4346 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4347 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4348 free((yyvsp[0].StrVal));
4350 if (AsmSoFar.empty())
4351 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4353 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4359 #line 1896 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4360 { (yyval.Endianness) = Module::BigEndian; ;}
4364 #line 1897 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4365 { (yyval.Endianness) = Module::LittleEndian; ;}
4369 #line 1899 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4371 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4377 #line 1903 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4379 if ((yyvsp[0].UInt64Val) == 32)
4380 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4381 else if ((yyvsp[0].UInt64Val) == 64)
4382 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4384 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4390 #line 1912 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4392 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4393 free((yyvsp[0].StrVal));
4398 #line 1916 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4400 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4401 free((yyvsp[0].StrVal));
4406 #line 1923 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4408 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4409 free((yyvsp[0].StrVal));
4415 #line 1928 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4417 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4418 free((yyvsp[0].StrVal));
4424 #line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4431 #line 1943 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4432 { (yyval.StrVal) = 0; ;}
4436 #line 1945 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4438 if (!UpRefs.empty())
4439 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4440 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4441 GEN_ERROR("void typed arguments are invalid!");
4442 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4443 (yyval.ArgList) = (yyvsp[-4].ArgList);
4444 (yyvsp[-4].ArgList)->push_back(E);
4450 #line 1955 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4452 if (!UpRefs.empty())
4453 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4454 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4455 GEN_ERROR("void typed arguments are invalid!");
4456 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4457 (yyval.ArgList) = new ArgListType;
4458 (yyval.ArgList)->push_back(E);
4464 #line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4466 (yyval.ArgList) = (yyvsp[0].ArgList);
4472 #line 1970 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4474 (yyval.ArgList) = (yyvsp[-2].ArgList);
4475 struct ArgListEntry E;
4476 E.Ty = new PATypeHolder(Type::VoidTy);
4478 E.Attrs = FunctionType::NoAttributeSet;
4479 (yyval.ArgList)->push_back(E);
4485 #line 1979 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4487 (yyval.ArgList) = new ArgListType;
4488 struct ArgListEntry E;
4489 E.Ty = new PATypeHolder(Type::VoidTy);
4491 E.Attrs = FunctionType::NoAttributeSet;
4492 (yyval.ArgList)->push_back(E);
4498 #line 1988 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4500 (yyval.ArgList) = 0;
4506 #line 1994 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4508 UnEscapeLexed((yyvsp[-5].StrVal));
4509 std::string FunctionName((yyvsp[-5].StrVal));
4510 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4512 // Check the function result for abstractness if this is a define. We should
4513 // have no abstract types at this point
4514 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-6].TypeWithAttrs).Ty))
4515 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-6].TypeWithAttrs).Ty->get()->getDescription());
4517 std::vector<const Type*> ParamTypeList;
4518 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4519 ParamAttrs.push_back((yyvsp[-6].TypeWithAttrs).Attrs);
4520 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4521 for (ArgListType::iterator I = (yyvsp[-3].ArgList)->begin(); I != (yyvsp[-3].ArgList)->end(); ++I) {
4522 const Type* Ty = I->Ty->get();
4523 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4524 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4525 ParamTypeList.push_back(Ty);
4526 if (Ty != Type::VoidTy)
4527 ParamAttrs.push_back(I->Attrs);
4531 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4532 if (isVarArg) ParamTypeList.pop_back();
4534 FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeWithAttrs).Ty, ParamTypeList, isVarArg,
4536 const PointerType *PFT = PointerType::get(FT);
4537 delete (yyvsp[-6].TypeWithAttrs).Ty;
4540 if (!FunctionName.empty()) {
4541 ID = ValID::create((char*)FunctionName.c_str());
4543 ID = ValID::create((int)CurModule.Values[PFT].size());
4547 // See if this function was forward referenced. If so, recycle the object.
4548 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4549 // Move the function to the end of the list, from whereever it was
4550 // previously inserted.
4551 Fn = cast<Function>(FWRef);
4552 CurModule.CurrentModule->getFunctionList().remove(Fn);
4553 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4554 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4555 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4556 // If this is the case, either we need to be a forward decl, or it needs
4558 if (!CurFun.isDeclare && !Fn->isExternal())
4559 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4561 // Make sure to strip off any argument names so we can't get conflicts.
4562 if (Fn->isExternal())
4563 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4566 } else { // Not already defined?
4567 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4568 CurModule.CurrentModule);
4570 InsertValue(Fn, CurModule.Values);
4573 CurFun.FunctionStart(Fn);
4575 if (CurFun.isDeclare) {
4576 // If we have declaration, always overwrite linkage. This will allow us to
4577 // correctly handle cases, when pointer to function is passed as argument to
4578 // another function.
4579 Fn->setLinkage(CurFun.Linkage);
4581 Fn->setCallingConv((yyvsp[-7].UIntVal));
4582 Fn->setAlignment((yyvsp[0].UIntVal));
4583 if ((yyvsp[-1].StrVal)) {
4584 Fn->setSection((yyvsp[-1].StrVal));
4585 free((yyvsp[-1].StrVal));
4588 // Add all of the arguments we parsed to the function...
4589 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4590 if (isVarArg) { // Nuke the last entry
4591 assert((yyvsp[-3].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().Name == 0&&
4592 "Not a varargs marker!");
4593 delete (yyvsp[-3].ArgList)->back().Ty;
4594 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4596 Function::arg_iterator ArgIt = Fn->arg_begin();
4598 for (ArgListType::iterator I = (yyvsp[-3].ArgList)->begin(); I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4599 delete I->Ty; // Delete the typeholder...
4600 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4606 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4613 #line 2100 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4615 (yyval.FunctionVal) = CurFun.CurrentFunction;
4617 // Make sure that we keep track of the linkage type even if there was a
4618 // previous "declare".
4619 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4624 #line 2110 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4626 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4632 #line 2115 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4634 CurFun.CurrentFunction->setLinkage((yyvsp[-1].Linkage));
4635 (yyval.FunctionVal) = CurFun.CurrentFunction;
4636 CurFun.FunctionDone();
4642 #line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4644 (yyval.BoolVal) = false;
4650 #line 2130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4652 (yyval.BoolVal) = true;
4658 #line 2135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4659 { // A reference to a direct constant
4660 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4666 #line 2139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4668 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4674 #line 2143 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4675 { // Perhaps it's an FP constant?
4676 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4682 #line 2147 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4684 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4690 #line 2151 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4692 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4698 #line 2155 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4700 (yyval.ValIDVal) = ValID::createNull();
4706 #line 2159 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4708 (yyval.ValIDVal) = ValID::createUndef();
4714 #line 2163 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4715 { // A vector zero constant.
4716 (yyval.ValIDVal) = ValID::createZeroInit();
4722 #line 2167 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4723 { // Nonempty unsized packed vector
4724 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4725 int NumElements = (yyvsp[-1].ConstVector)->size();
4727 PackedType* pt = PackedType::get(ETy, NumElements);
4728 PATypeHolder* PTy = new PATypeHolder(
4736 // Verify all elements are correct type!
4737 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4738 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4739 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4740 ETy->getDescription() +"' as required!\nIt is of type '" +
4741 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4744 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4745 delete PTy; delete (yyvsp[-1].ConstVector);
4751 #line 2192 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4753 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4759 #line 2196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4761 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4762 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4763 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4764 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4765 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4766 free((yyvsp[-2].StrVal));
4767 free((yyvsp[0].StrVal));
4773 #line 2210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4774 { // Is it an integer reference...?
4775 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4781 #line 2214 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4782 { // Is it a named reference...?
4783 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4789 #line 2226 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4791 if (!UpRefs.empty())
4792 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4793 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4794 delete (yyvsp[-1].TypeVal);
4800 #line 2235 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4802 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4808 #line 2239 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4809 { // Do not allow functions with 0 basic blocks
4810 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4816 #line 2248 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4818 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4820 InsertValue((yyvsp[0].TermInstVal));
4822 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4823 InsertValue((yyvsp[-2].BasicBlockVal));
4824 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4830 #line 2259 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4832 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4833 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4834 if (CI2->getParent() == 0)
4835 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4836 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4837 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4843 #line 2268 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4845 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4848 // Make sure to move the basic block to the correct location in the
4849 // function, instead of leaving it inserted wherever it was first
4851 Function::BasicBlockListType &BBL =
4852 CurFun.CurrentFunction->getBasicBlockList();
4853 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4859 #line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4861 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4864 // Make sure to move the basic block to the correct location in the
4865 // function, instead of leaving it inserted wherever it was first
4867 Function::BasicBlockListType &BBL =
4868 CurFun.CurrentFunction->getBasicBlockList();
4869 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4875 #line 2293 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4876 { // Return with a result...
4877 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4883 #line 2297 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4884 { // Return with no result...
4885 (yyval.TermInstVal) = new ReturnInst();
4891 #line 2301 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4892 { // Unconditional Branch...
4893 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4895 (yyval.TermInstVal) = new BranchInst(tmpBB);
4900 #line 2306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4902 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4904 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4906 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4908 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4913 #line 2315 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4915 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4917 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4919 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4920 (yyval.TermInstVal) = S;
4922 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4923 E = (yyvsp[-1].JumpTable)->end();
4924 for (; I != E; ++I) {
4925 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4926 S->addCase(CI, I->second);
4928 GEN_ERROR("Switch case is constant, but not a simple integer!");
4930 delete (yyvsp[-1].JumpTable);
4936 #line 2334 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4938 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4940 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4942 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4943 (yyval.TermInstVal) = S;
4949 #line 2344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4952 // Handle the short syntax
4953 const PointerType *PFTy = 0;
4954 const FunctionType *Ty = 0;
4955 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeWithAttrs).Ty->get())) ||
4956 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4957 // Pull out the types of all of the arguments...
4958 std::vector<const Type*> ParamTypes;
4959 FunctionType::ParamAttrsList ParamAttrs;
4960 ParamAttrs.push_back((yyvsp[-10].TypeWithAttrs).Attrs);
4961 for (ValueRefList::iterator I = (yyvsp[-7].ValueRefList)->begin(), E = (yyvsp[-7].ValueRefList)->end(); I != E; ++I) {
4962 const Type *Ty = I->Val->getType();
4963 if (Ty == Type::VoidTy)
4964 GEN_ERROR("Short call syntax cannot be used with varargs");
4965 ParamTypes.push_back(Ty);
4966 ParamAttrs.push_back(I->Attrs);
4969 Ty = FunctionType::get((yyvsp[-10].TypeWithAttrs).Ty->get(), ParamTypes, false, ParamAttrs);
4970 PFTy = PointerType::get(Ty);
4973 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4975 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4977 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4980 // Check the arguments
4982 if ((yyvsp[-7].ValueRefList)->empty()) { // Has no arguments?
4983 // Make sure no arguments is a good thing!
4984 if (Ty->getNumParams() != 0)
4985 GEN_ERROR("No arguments passed to a function that "
4986 "expects arguments!");
4987 } else { // Has arguments?
4988 // Loop through FunctionType's arguments and ensure they are specified
4990 FunctionType::param_iterator I = Ty->param_begin();
4991 FunctionType::param_iterator E = Ty->param_end();
4992 ValueRefList::iterator ArgI = (yyvsp[-7].ValueRefList)->begin(), ArgE = (yyvsp[-7].ValueRefList)->end();
4994 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4995 if (ArgI->Val->getType() != *I)
4996 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4997 (*I)->getDescription() + "'!");
4998 Args.push_back(ArgI->Val);
5001 if (Ty->isVarArg()) {
5003 for (; ArgI != ArgE; ++ArgI)
5004 Args.push_back(ArgI->Val); // push the remaining varargs
5005 } else if (I != E || ArgI != ArgE)
5006 GEN_ERROR("Invalid number of parameters detected!");
5009 // Create the InvokeInst
5010 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
5011 II->setCallingConv((yyvsp[-11].UIntVal));
5012 (yyval.TermInstVal) = II;
5013 delete (yyvsp[-7].ValueRefList);
5019 #line 2410 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5021 (yyval.TermInstVal) = new UnwindInst();
5027 #line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5029 (yyval.TermInstVal) = new UnreachableInst();
5035 #line 2421 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5037 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5038 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5041 GEN_ERROR("May only switch on a constant pool value!");
5043 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5045 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5050 #line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5052 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5053 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5057 GEN_ERROR("May only switch on a constant pool value!");
5059 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5061 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5066 #line 2445 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5068 // Is this definition named?? if so, assign the name...
5069 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5071 InsertValue((yyvsp[0].InstVal));
5072 (yyval.InstVal) = (yyvsp[0].InstVal);
5078 #line 2454 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5079 { // Used for PHI nodes
5080 if (!UpRefs.empty())
5081 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5082 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5083 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5085 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5087 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5088 delete (yyvsp[-5].TypeVal);
5093 #line 2465 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5095 (yyval.PHIList) = (yyvsp[-6].PHIList);
5096 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5098 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5100 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5105 #line 2475 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5107 if (!UpRefs.empty())
5108 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5109 // Used for call and invoke instructions
5110 (yyval.ValueRefList) = new ValueRefList();
5111 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5112 (yyval.ValueRefList)->push_back(E);
5117 #line 2483 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5119 if (!UpRefs.empty())
5120 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5121 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5122 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5123 (yyval.ValueRefList)->push_back(E);
5129 #line 2491 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5130 { (yyval.ValueRefList) = new ValueRefList(); ;}
5134 #line 2494 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5135 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5139 #line 2495 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5141 (yyval.ValueList) = (yyvsp[-2].ValueList);
5142 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5148 #line 2502 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5150 (yyval.BoolVal) = true;
5156 #line 2506 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5158 (yyval.BoolVal) = false;
5164 #line 2511 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5166 if (!UpRefs.empty())
5167 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5168 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5169 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5171 "Arithmetic operator requires integer, FP, or packed operands!");
5172 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5173 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5174 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5175 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5176 GEN_ERROR("U/S/FRem not supported on packed types!");
5177 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5179 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5181 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5182 if ((yyval.InstVal) == 0)
5183 GEN_ERROR("binary operator returned null!");
5184 delete (yyvsp[-3].TypeVal);
5189 #line 2532 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5191 if (!UpRefs.empty())
5192 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5193 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5194 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5195 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5196 GEN_ERROR("Logical operator requires integral operands!");
5198 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5200 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5202 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5203 if ((yyval.InstVal) == 0)
5204 GEN_ERROR("binary operator returned null!");
5205 delete (yyvsp[-3].TypeVal);
5210 #line 2549 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5212 if (!UpRefs.empty())
5213 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5214 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5215 GEN_ERROR("Packed types not supported by icmp instruction");
5216 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5218 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5220 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5221 if ((yyval.InstVal) == 0)
5222 GEN_ERROR("icmp operator returned null!");
5227 #line 2562 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5229 if (!UpRefs.empty())
5230 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5231 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5232 GEN_ERROR("Packed types not supported by fcmp instruction");
5233 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5235 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5237 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5238 if ((yyval.InstVal) == 0)
5239 GEN_ERROR("fcmp operator returned null!");
5244 #line 2575 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5246 cerr << "WARNING: Use of eliminated 'not' instruction:"
5247 << " Replacing with 'xor'.\n";
5249 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5251 GEN_ERROR("Expected integral type for not instruction!");
5253 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5254 if ((yyval.InstVal) == 0)
5255 GEN_ERROR("Could not create a xor instruction!");
5261 #line 2588 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5263 if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty)
5264 GEN_ERROR("Shift amount must be i8 type!");
5265 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5266 GEN_ERROR("Shift constant expression requires integer operand!");
5268 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5274 #line 2597 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5276 if (!UpRefs.empty())
5277 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5278 Value* Val = (yyvsp[-2].ValueVal);
5279 const Type* Ty = (yyvsp[0].TypeVal)->get();
5280 if (!Val->getType()->isFirstClassType())
5281 GEN_ERROR("cast from a non-primitive type: '" +
5282 Val->getType()->getDescription() + "'!");
5283 if (!Ty->isFirstClassType())
5284 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5285 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, (yyvsp[0].TypeVal)->get());
5286 delete (yyvsp[0].TypeVal);
5291 #line 2610 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5293 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5294 GEN_ERROR("select condition must be boolean!");
5295 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5296 GEN_ERROR("select value types should match!");
5297 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5303 #line 2618 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5305 if (!UpRefs.empty())
5306 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5307 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5308 delete (yyvsp[0].TypeVal);
5314 #line 2625 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5316 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5317 GEN_ERROR("Invalid extractelement operands!");
5318 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5324 #line 2631 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5326 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5327 GEN_ERROR("Invalid insertelement operands!");
5328 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5334 #line 2637 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5336 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5337 GEN_ERROR("Invalid shufflevector operands!");
5338 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5344 #line 2643 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5346 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5347 if (!Ty->isFirstClassType())
5348 GEN_ERROR("PHI node operands must be of first class type!");
5349 (yyval.InstVal) = new PHINode(Ty);
5350 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5351 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5352 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5353 GEN_ERROR("All elements of a PHI node must be of the same type!");
5354 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5355 (yyvsp[0].PHIList)->pop_front();
5357 delete (yyvsp[0].PHIList); // Free the list...
5363 #line 2658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5366 // Handle the short syntax
5367 const PointerType *PFTy = 0;
5368 const FunctionType *Ty = 0;
5369 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeWithAttrs).Ty->get())) ||
5370 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5371 // Pull out the types of all of the arguments...
5372 std::vector<const Type*> ParamTypes;
5373 FunctionType::ParamAttrsList ParamAttrs;
5374 ParamAttrs.push_back((yyvsp[-4].TypeWithAttrs).Attrs);
5375 for (ValueRefList::iterator I = (yyvsp[-1].ValueRefList)->begin(), E = (yyvsp[-1].ValueRefList)->end(); I != E; ++I) {
5376 const Type *Ty = I->Val->getType();
5377 if (Ty == Type::VoidTy)
5378 GEN_ERROR("Short call syntax cannot be used with varargs");
5379 ParamTypes.push_back(Ty);
5380 ParamAttrs.push_back(I->Attrs);
5383 Ty = FunctionType::get((yyvsp[-4].TypeWithAttrs).Ty->get(), ParamTypes, false, ParamAttrs);
5384 PFTy = PointerType::get(Ty);
5387 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5390 // Check the arguments
5392 if ((yyvsp[-1].ValueRefList)->empty()) { // Has no arguments?
5393 // Make sure no arguments is a good thing!
5394 if (Ty->getNumParams() != 0)
5395 GEN_ERROR("No arguments passed to a function that "
5396 "expects arguments!");
5397 } else { // Has arguments?
5398 // Loop through FunctionType's arguments and ensure they are specified
5401 FunctionType::param_iterator I = Ty->param_begin();
5402 FunctionType::param_iterator E = Ty->param_end();
5403 ValueRefList::iterator ArgI = (yyvsp[-1].ValueRefList)->begin(), ArgE = (yyvsp[-1].ValueRefList)->end();
5405 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5406 if (ArgI->Val->getType() != *I)
5407 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5408 (*I)->getDescription() + "'!");
5409 Args.push_back(ArgI->Val);
5411 if (Ty->isVarArg()) {
5413 for (; ArgI != ArgE; ++ArgI)
5414 Args.push_back(ArgI->Val); // push the remaining varargs
5415 } else if (I != E || ArgI != ArgE)
5416 GEN_ERROR("Invalid number of parameters detected!");
5418 // Create the call node
5419 CallInst *CI = new CallInst(V, Args);
5420 CI->setTailCall((yyvsp[-6].BoolVal));
5421 CI->setCallingConv((yyvsp[-5].UIntVal));
5422 (yyval.InstVal) = CI;
5423 delete (yyvsp[-1].ValueRefList);
5429 #line 2720 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5431 (yyval.InstVal) = (yyvsp[0].InstVal);
5437 #line 2725 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5439 (yyval.BoolVal) = true;
5445 #line 2729 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5447 (yyval.BoolVal) = false;
5453 #line 2736 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5455 if (!UpRefs.empty())
5456 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5457 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5458 delete (yyvsp[-1].TypeVal);
5464 #line 2743 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5466 if (!UpRefs.empty())
5467 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5468 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5470 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5471 delete (yyvsp[-4].TypeVal);
5476 #line 2751 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5478 if (!UpRefs.empty())
5479 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5480 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5481 delete (yyvsp[-1].TypeVal);
5487 #line 2758 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5489 if (!UpRefs.empty())
5490 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5491 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5493 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5494 delete (yyvsp[-4].TypeVal);
5499 #line 2766 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5501 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5502 GEN_ERROR("Trying to free nonpointer type " +
5503 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5504 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5510 #line 2774 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5512 if (!UpRefs.empty())
5513 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5514 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5515 GEN_ERROR("Can't load from nonpointer type: " +
5516 (*(yyvsp[-1].TypeVal))->getDescription());
5517 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5518 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5519 (*(yyvsp[-1].TypeVal))->getDescription());
5520 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5522 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5523 delete (yyvsp[-1].TypeVal);
5528 #line 2788 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5530 if (!UpRefs.empty())
5531 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5532 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5534 GEN_ERROR("Can't store to a nonpointer type: " +
5535 (*(yyvsp[-1].TypeVal))->getDescription());
5536 const Type *ElTy = PT->getElementType();
5537 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5538 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5539 "' into space of type '" + ElTy->getDescription() + "'!");
5541 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5543 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5544 delete (yyvsp[-1].TypeVal);
5549 #line 2805 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5551 if (!UpRefs.empty())
5552 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5553 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5554 GEN_ERROR("getelementptr insn requires pointer operand!");
5556 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5557 GEN_ERROR("Invalid getelementptr indices for type '" +
5558 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5559 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5561 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5562 delete (yyvsp[-2].TypeVal);
5563 delete (yyvsp[0].ValueList);
5571 /* Line 1126 of yacc.c. */
5572 #line 5573 "llvmAsmParser.tab.c"
5578 YY_STACK_PRINT (yyss, yyssp);
5583 /* Now `shift' the result of the reduction. Determine what state
5584 that goes to, based on the state we popped back to and the rule
5585 number reduced by. */
5589 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5590 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5591 yystate = yytable[yystate];
5593 yystate = yydefgoto[yyn - YYNTOKENS];
5598 /*------------------------------------.
5599 | yyerrlab -- here on detecting error |
5600 `------------------------------------*/
5602 /* If not already recovering from an error, report this error. */
5607 yyn = yypact[yystate];
5609 if (YYPACT_NINF < yyn && yyn < YYLAST)
5611 int yytype = YYTRANSLATE (yychar);
5612 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5613 YYSIZE_T yysize = yysize0;
5615 int yysize_overflow = 0;
5617 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5618 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5622 /* This is so xgettext sees the translatable formats that are
5623 constructed on the fly. */
5624 YY_("syntax error, unexpected %s");
5625 YY_("syntax error, unexpected %s, expecting %s");
5626 YY_("syntax error, unexpected %s, expecting %s or %s");
5627 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5628 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5632 static char const yyunexpected[] = "syntax error, unexpected %s";
5633 static char const yyexpecting[] = ", expecting %s";
5634 static char const yyor[] = " or %s";
5635 char yyformat[sizeof yyunexpected
5636 + sizeof yyexpecting - 1
5637 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5638 * (sizeof yyor - 1))];
5639 char const *yyprefix = yyexpecting;
5641 /* Start YYX at -YYN if negative to avoid negative indexes in
5643 int yyxbegin = yyn < 0 ? -yyn : 0;
5645 /* Stay within bounds of both yycheck and yytname. */
5646 int yychecklim = YYLAST - yyn;
5647 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5650 yyarg[0] = yytname[yytype];
5651 yyfmt = yystpcpy (yyformat, yyunexpected);
5653 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5654 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5656 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5660 yyformat[sizeof yyunexpected - 1] = '\0';
5663 yyarg[yycount++] = yytname[yyx];
5664 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5665 yysize_overflow |= yysize1 < yysize;
5667 yyfmt = yystpcpy (yyfmt, yyprefix);
5671 yyf = YY_(yyformat);
5672 yysize1 = yysize + yystrlen (yyf);
5673 yysize_overflow |= yysize1 < yysize;
5676 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5677 yymsg = (char *) YYSTACK_ALLOC (yysize);
5680 /* Avoid sprintf, as that infringes on the user's name space.
5681 Don't have undefined behavior even if the translation
5682 produced a string with the wrong number of "%s"s. */
5685 while ((*yyp = *yyf))
5687 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5689 yyp += yytnamerr (yyp, yyarg[yyi++]);
5699 YYSTACK_FREE (yymsg);
5703 yyerror (YY_("syntax error"));
5704 goto yyexhaustedlab;
5708 #endif /* YYERROR_VERBOSE */
5709 yyerror (YY_("syntax error"));
5714 if (yyerrstatus == 3)
5716 /* If just tried and failed to reuse look-ahead token after an
5717 error, discard it. */
5719 if (yychar <= YYEOF)
5721 /* Return failure if at end of input. */
5722 if (yychar == YYEOF)
5727 yydestruct ("Error: discarding", yytoken, &yylval);
5732 /* Else will try to reuse look-ahead token after shifting the error
5737 /*---------------------------------------------------.
5738 | yyerrorlab -- error raised explicitly by YYERROR. |
5739 `---------------------------------------------------*/
5742 /* Pacify compilers like GCC when the user code never invokes
5743 YYERROR and the label yyerrorlab therefore never appears in user
5754 /*-------------------------------------------------------------.
5755 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5756 `-------------------------------------------------------------*/
5758 yyerrstatus = 3; /* Each real token shifted decrements this. */
5762 yyn = yypact[yystate];
5763 if (yyn != YYPACT_NINF)
5766 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5774 /* Pop the current state because it cannot handle the error token. */
5779 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5782 YY_STACK_PRINT (yyss, yyssp);
5791 /* Shift the error token. */
5792 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5798 /*-------------------------------------.
5799 | yyacceptlab -- YYACCEPT comes here. |
5800 `-------------------------------------*/
5805 /*-----------------------------------.
5806 | yyabortlab -- YYABORT comes here. |
5807 `-----------------------------------*/
5813 /*-------------------------------------------------.
5814 | yyexhaustedlab -- memory exhaustion comes here. |
5815 `-------------------------------------------------*/
5817 yyerror (YY_("memory exhausted"));
5823 if (yychar != YYEOF && yychar != YYEMPTY)
5824 yydestruct ("Cleanup: discarding lookahead",
5826 while (yyssp != yyss)
5828 yydestruct ("Cleanup: popping",
5829 yystos[*yyssp], yyvsp);
5834 YYSTACK_FREE (yyss);
5840 #line 2822 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5843 // common code from the two 'RunVMAsmParser' functions
5844 static Module* RunParser(Module * M) {
5846 llvmAsmlineno = 1; // Reset the current line number...
5847 CurModule.CurrentModule = M;
5852 // Check to make sure the parser succeeded
5855 delete ParserResult;
5859 // Check to make sure that parsing produced a result
5863 // Reset ParserResult variable while saving its value for the result.
5864 Module *Result = ParserResult;
5870 void llvm::GenerateError(const std::string &message, int LineNo) {
5871 if (LineNo == -1) LineNo = llvmAsmlineno;
5872 // TODO: column number in exception
5874 TheParseError->setError(CurFilename, message, LineNo);
5878 int yyerror(const char *ErrorMsg) {
5880 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5881 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5882 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5883 if (yychar == YYEMPTY || yychar == 0)
5884 errMsg += "end-of-file.";
5886 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5887 GenerateError(errMsg);