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
90 ZEROINITIALIZER = 281,
133 X86_STDCALLCC_TOK = 324,
134 X86_FASTCALLCC_TOK = 325,
206 EXTRACTELEMENT = 397,
212 #define ESINT64VAL 258
213 #define EUINT64VAL 259
233 #define STRINGCONSTANT 279
234 #define IMPLEMENTATION 280
235 #define ZEROINITIALIZER 281
246 #define DOTDOTDOT 292
253 #define APPENDING 299
254 #define DLLIMPORT 300
255 #define DLLEXPORT 301
256 #define EXTERN_WEAK 302
263 #define POINTERSIZE 309
272 #define SIDEEFFECT 318
275 #define CSRETCC_TOK 321
276 #define FASTCC_TOK 322
277 #define COLDCC_TOK 323
278 #define X86_STDCALLCC_TOK 324
279 #define X86_FASTCALLCC_TOK 325
280 #define DATALAYOUT 326
286 #define UNREACHABLE 332
332 #define GETELEMENTPTR 378
351 #define EXTRACTELEMENT 397
352 #define INSERTELEMENT 398
353 #define SHUFFLEVECTOR 399
358 /* Copy the first part of user declarations. */
359 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
361 #include "ParserInternals.h"
362 #include "llvm/CallingConv.h"
363 #include "llvm/InlineAsm.h"
364 #include "llvm/Instructions.h"
365 #include "llvm/Module.h"
366 #include "llvm/SymbolTable.h"
367 #include "llvm/Support/GetElementPtrTypeIterator.h"
368 #include "llvm/ADT/STLExtras.h"
369 #include "llvm/Support/MathExtras.h"
370 #include "llvm/Support/Streams.h"
375 // The following is a gross hack. In order to rid the libAsmParser library of
376 // exceptions, we have to have a way of getting the yyparse function to go into
377 // an error situation. So, whenever we want an error to occur, the GenerateError
378 // function (see bottom of file) sets TriggerError. Then, at the end of each
379 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
380 // (a goto) to put YACC in error state. Furthermore, several calls to
381 // GenerateError are made from inside productions and they must simulate the
382 // previous exception behavior by exiting the production immediately. We have
383 // replaced these with the GEN_ERROR macro which calls GeneratError and then
384 // immediately invokes YYERROR. This would be so much cleaner if it was a
385 // recursive descent parser.
386 static bool TriggerError = false;
387 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
388 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
390 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
391 int yylex(); // declaration" of xxx warnings.
395 std::string CurFilename;
397 using namespace llvm;
399 static Module *ParserResult;
401 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
402 // relating to upreferences in the input stream.
404 //#define DEBUG_UPREFS 1
406 #define UR_OUT(X) llvm_cerr << X
411 #define YYERROR_VERBOSE 1
413 static GlobalVariable *CurGV;
416 // This contains info used when building the body of a function. It is
417 // destroyed when the function is completed.
419 typedef std::vector<Value *> ValueList; // Numbered defs
421 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
422 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
424 static struct PerModuleInfo {
425 Module *CurrentModule;
426 std::map<const Type *, ValueList> Values; // Module level numbered definitions
427 std::map<const Type *,ValueList> LateResolveValues;
428 std::vector<PATypeHolder> Types;
429 std::map<ValID, PATypeHolder> LateResolveTypes;
431 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
432 /// how they were referenced and on which line of the input they came from so
433 /// that we can resolve them later and print error messages as appropriate.
434 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
436 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
437 // references to global values. Global values may be referenced before they
438 // are defined, and if so, the temporary object that they represent is held
439 // here. This is used for forward references of GlobalValues.
441 typedef std::map<std::pair<const PointerType *,
442 ValID>, GlobalValue*> GlobalRefsType;
443 GlobalRefsType GlobalRefs;
446 // If we could not resolve some functions at function compilation time
447 // (calls to functions before they are defined), resolve them now... Types
448 // are resolved when the constant pool has been completely parsed.
450 ResolveDefinitions(LateResolveValues);
454 // Check to make sure that all global value forward references have been
457 if (!GlobalRefs.empty()) {
458 std::string UndefinedReferences = "Unresolved global references exist:\n";
460 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
462 UndefinedReferences += " " + I->first.first->getDescription() + " " +
463 I->first.second.getName() + "\n";
465 GenerateError(UndefinedReferences);
469 Values.clear(); // Clear out function local definitions
474 // GetForwardRefForGlobal - Check to see if there is a forward reference
475 // for this global. If so, remove it from the GlobalRefs map and return it.
476 // If not, just return null.
477 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
478 // Check to see if there is a forward reference to this global variable...
479 // if there is, eliminate it and patch the reference to use the new def'n.
480 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
481 GlobalValue *Ret = 0;
482 if (I != GlobalRefs.end()) {
490 static struct PerFunctionInfo {
491 Function *CurrentFunction; // Pointer to current function being created
493 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
494 std::map<const Type*, ValueList> LateResolveValues;
495 bool isDeclare; // Is this function a forward declararation?
496 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
498 /// BBForwardRefs - When we see forward references to basic blocks, keep
499 /// track of them here.
500 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
501 std::vector<BasicBlock*> NumberedBlocks;
504 inline PerFunctionInfo() {
507 Linkage = GlobalValue::ExternalLinkage;
510 inline void FunctionStart(Function *M) {
515 void FunctionDone() {
516 NumberedBlocks.clear();
518 // Any forward referenced blocks left?
519 if (!BBForwardRefs.empty()) {
520 GenerateError("Undefined reference to label " +
521 BBForwardRefs.begin()->first->getName());
525 // Resolve all forward references now.
526 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
528 Values.clear(); // Clear out function local definitions
531 Linkage = GlobalValue::ExternalLinkage;
533 } CurFun; // Info for the current function...
535 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
538 //===----------------------------------------------------------------------===//
539 // Code to handle definitions of all the types
540 //===----------------------------------------------------------------------===//
542 static int InsertValue(Value *V,
543 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
544 if (V->hasName()) return -1; // Is this a numbered definition?
546 // Yes, insert the value into the value table...
547 ValueList &List = ValueTab[V->getType()];
549 return List.size()-1;
552 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
554 case ValID::NumberVal: // Is it a numbered definition?
555 // Module constants occupy the lowest numbered slots...
556 if ((unsigned)D.Num < CurModule.Types.size())
557 return CurModule.Types[(unsigned)D.Num];
559 case ValID::NameVal: // Is it a named definition?
560 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
561 D.destroy(); // Free old strdup'd memory...
566 GenerateError("Internal parser error: Invalid symbol type reference!");
570 // If we reached here, we referenced either a symbol that we don't know about
571 // or an id number that hasn't been read yet. We may be referencing something
572 // forward, so just create an entry to be resolved later and get to it...
574 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
577 if (inFunctionScope()) {
578 if (D.Type == ValID::NameVal) {
579 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
582 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
587 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
588 if (I != CurModule.LateResolveTypes.end())
591 Type *Typ = OpaqueType::get();
592 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
596 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
597 SymbolTable &SymTab =
598 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
599 CurModule.CurrentModule->getSymbolTable();
600 return SymTab.lookup(Ty, Name);
603 // getValNonImprovising - Look up the value specified by the provided type and
604 // the provided ValID. If the value exists and has already been defined, return
605 // it. Otherwise return null.
607 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
608 if (isa<FunctionType>(Ty)) {
609 GenerateError("Functions are not values and "
610 "must be referenced as pointers");
615 case ValID::NumberVal: { // Is it a numbered definition?
616 unsigned Num = (unsigned)D.Num;
618 // Module constants occupy the lowest numbered slots...
619 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
620 if (VI != CurModule.Values.end()) {
621 if (Num < VI->second.size())
622 return VI->second[Num];
623 Num -= VI->second.size();
626 // Make sure that our type is within bounds
627 VI = CurFun.Values.find(Ty);
628 if (VI == CurFun.Values.end()) return 0;
630 // Check that the number is within bounds...
631 if (VI->second.size() <= Num) return 0;
633 return VI->second[Num];
636 case ValID::NameVal: { // Is it a named definition?
637 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
638 if (N == 0) return 0;
640 D.destroy(); // Free old strdup'd memory...
644 // Check to make sure that "Ty" is an integral type, and that our
645 // value will fit into the specified type...
646 case ValID::ConstSIntVal: // Is it a constant pool reference??
647 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
648 GenerateError("Signed integral constant '" +
649 itostr(D.ConstPool64) + "' is invalid for type '" +
650 Ty->getDescription() + "'!");
653 return ConstantInt::get(Ty, D.ConstPool64);
655 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
656 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
657 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
658 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
659 "' is invalid or out of range!");
661 } else { // This is really a signed reference. Transmogrify.
662 return ConstantInt::get(Ty, D.ConstPool64);
665 return ConstantInt::get(Ty, D.UConstPool64);
668 case ValID::ConstFPVal: // Is it a floating point const pool reference?
669 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
670 GenerateError("FP constant invalid for type!!");
673 return ConstantFP::get(Ty, D.ConstPoolFP);
675 case ValID::ConstNullVal: // Is it a null value?
676 if (!isa<PointerType>(Ty)) {
677 GenerateError("Cannot create a a non pointer null!");
680 return ConstantPointerNull::get(cast<PointerType>(Ty));
682 case ValID::ConstUndefVal: // Is it an undef value?
683 return UndefValue::get(Ty);
685 case ValID::ConstZeroVal: // Is it a zero value?
686 return Constant::getNullValue(Ty);
688 case ValID::ConstantVal: // Fully resolved constant?
689 if (D.ConstantValue->getType() != Ty) {
690 GenerateError("Constant expression type different from required type!");
693 return D.ConstantValue;
695 case ValID::InlineAsmVal: { // Inline asm expression
696 const PointerType *PTy = dyn_cast<PointerType>(Ty);
697 const FunctionType *FTy =
698 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
699 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
700 GenerateError("Invalid type for asm constraint string!");
703 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
704 D.IAD->HasSideEffects);
705 D.destroy(); // Free InlineAsmDescriptor.
709 assert(0 && "Unhandled case!");
713 assert(0 && "Unhandled case!");
717 // getVal - This function is identical to getValNonImprovising, except that if a
718 // value is not already defined, it "improvises" by creating a placeholder var
719 // that looks and acts just like the requested variable. When the value is
720 // defined later, all uses of the placeholder variable are replaced with the
723 static Value *getVal(const Type *Ty, const ValID &ID) {
724 if (Ty == Type::LabelTy) {
725 GenerateError("Cannot use a basic block here");
729 // See if the value has already been defined.
730 Value *V = getValNonImprovising(Ty, ID);
732 if (TriggerError) return 0;
734 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
735 GenerateError("Invalid use of a composite type!");
739 // If we reached here, we referenced either a symbol that we don't know about
740 // or an id number that hasn't been read yet. We may be referencing something
741 // forward, so just create an entry to be resolved later and get to it...
743 V = new Argument(Ty);
745 // Remember where this forward reference came from. FIXME, shouldn't we try
746 // to recycle these things??
747 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
750 if (inFunctionScope())
751 InsertValue(V, CurFun.LateResolveValues);
753 InsertValue(V, CurModule.LateResolveValues);
757 /// getBBVal - This is used for two purposes:
758 /// * If isDefinition is true, a new basic block with the specified ID is being
760 /// * If isDefinition is true, this is a reference to a basic block, which may
761 /// or may not be a forward reference.
763 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
764 assert(inFunctionScope() && "Can't get basic block at global scope!");
770 GenerateError("Illegal label reference " + ID.getName());
772 case ValID::NumberVal: // Is it a numbered definition?
773 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
774 CurFun.NumberedBlocks.resize(ID.Num+1);
775 BB = CurFun.NumberedBlocks[ID.Num];
777 case ValID::NameVal: // Is it a named definition?
779 if (Value *N = CurFun.CurrentFunction->
780 getSymbolTable().lookup(Type::LabelTy, Name))
781 BB = cast<BasicBlock>(N);
785 // See if the block has already been defined.
787 // If this is the definition of the block, make sure the existing value was
788 // just a forward reference. If it was a forward reference, there will be
789 // an entry for it in the PlaceHolderInfo map.
790 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
791 // The existing value was a definition, not a forward reference.
792 GenerateError("Redefinition of label " + ID.getName());
796 ID.destroy(); // Free strdup'd memory.
800 // Otherwise this block has not been seen before.
801 BB = new BasicBlock("", CurFun.CurrentFunction);
802 if (ID.Type == ValID::NameVal) {
803 BB->setName(ID.Name);
805 CurFun.NumberedBlocks[ID.Num] = BB;
808 // If this is not a definition, keep track of it so we can use it as a forward
811 // Remember where this forward reference came from.
812 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
814 // The forward declaration could have been inserted anywhere in the
815 // function: insert it into the correct place now.
816 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
817 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
824 //===----------------------------------------------------------------------===//
825 // Code to handle forward references in instructions
826 //===----------------------------------------------------------------------===//
828 // This code handles the late binding needed with statements that reference
829 // values not defined yet... for example, a forward branch, or the PHI node for
832 // This keeps a table (CurFun.LateResolveValues) of all such forward references
833 // and back patchs after we are done.
836 // ResolveDefinitions - If we could not resolve some defs at parsing
837 // time (forward branches, phi functions for loops, etc...) resolve the
841 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
842 std::map<const Type*,ValueList> *FutureLateResolvers) {
843 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
844 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
845 E = LateResolvers.end(); LRI != E; ++LRI) {
846 ValueList &List = LRI->second;
847 while (!List.empty()) {
848 Value *V = List.back();
851 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
852 CurModule.PlaceHolderInfo.find(V);
853 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
855 ValID &DID = PHI->second.first;
857 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
861 V->replaceAllUsesWith(TheRealValue);
863 CurModule.PlaceHolderInfo.erase(PHI);
864 } else if (FutureLateResolvers) {
865 // Functions have their unresolved items forwarded to the module late
867 InsertValue(V, *FutureLateResolvers);
869 if (DID.Type == ValID::NameVal) {
870 GenerateError("Reference to an invalid definition: '" +DID.getName()+
871 "' of type '" + V->getType()->getDescription() + "'",
875 GenerateError("Reference to an invalid definition: #" +
876 itostr(DID.Num) + " of type '" +
877 V->getType()->getDescription() + "'",
885 LateResolvers.clear();
888 // ResolveTypeTo - A brand new type was just declared. This means that (if
889 // name is not null) things referencing Name can be resolved. Otherwise, things
890 // refering to the number can be resolved. Do this now.
892 static void ResolveTypeTo(char *Name, const Type *ToTy) {
894 if (Name) D = ValID::create(Name);
895 else D = ValID::create((int)CurModule.Types.size());
897 std::map<ValID, PATypeHolder>::iterator I =
898 CurModule.LateResolveTypes.find(D);
899 if (I != CurModule.LateResolveTypes.end()) {
900 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
901 CurModule.LateResolveTypes.erase(I);
905 // setValueName - Set the specified value to the name given. The name may be
906 // null potentially, in which case this is a noop. The string passed in is
907 // assumed to be a malloc'd string buffer, and is free'd by this function.
909 static void setValueName(Value *V, char *NameStr) {
911 std::string Name(NameStr); // Copy string
912 free(NameStr); // Free old string
914 if (V->getType() == Type::VoidTy) {
915 GenerateError("Can't assign name '" + Name+"' to value with void type!");
919 assert(inFunctionScope() && "Must be in function scope!");
920 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
921 if (ST.lookup(V->getType(), Name)) {
922 GenerateError("Redefinition of value named '" + Name + "' in the '" +
923 V->getType()->getDescription() + "' type plane!");
932 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
933 /// this is a declaration, otherwise it is a definition.
934 static GlobalVariable *
935 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
936 bool isConstantGlobal, const Type *Ty,
937 Constant *Initializer) {
938 if (isa<FunctionType>(Ty)) {
939 GenerateError("Cannot declare global vars of function type!");
943 const PointerType *PTy = PointerType::get(Ty);
947 Name = NameStr; // Copy string
948 free(NameStr); // Free old string
951 // See if this global value was forward referenced. If so, recycle the
955 ID = ValID::create((char*)Name.c_str());
957 ID = ValID::create((int)CurModule.Values[PTy].size());
960 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
961 // Move the global to the end of the list, from whereever it was
962 // previously inserted.
963 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
964 CurModule.CurrentModule->getGlobalList().remove(GV);
965 CurModule.CurrentModule->getGlobalList().push_back(GV);
966 GV->setInitializer(Initializer);
967 GV->setLinkage(Linkage);
968 GV->setConstant(isConstantGlobal);
969 InsertValue(GV, CurModule.Values);
973 // If this global has a name, check to see if there is already a definition
974 // of this global in the module. If so, merge as appropriate. Note that
975 // this is really just a hack around problems in the CFE. :(
977 // We are a simple redefinition of a value, check to see if it is defined
978 // the same as the old one.
979 if (GlobalVariable *EGV =
980 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
981 // We are allowed to redefine a global variable in two circumstances:
982 // 1. If at least one of the globals is uninitialized or
983 // 2. If both initializers have the same value.
985 if (!EGV->hasInitializer() || !Initializer ||
986 EGV->getInitializer() == Initializer) {
988 // Make sure the existing global version gets the initializer! Make
989 // sure that it also gets marked const if the new version is.
990 if (Initializer && !EGV->hasInitializer())
991 EGV->setInitializer(Initializer);
992 if (isConstantGlobal)
993 EGV->setConstant(true);
994 EGV->setLinkage(Linkage);
998 GenerateError("Redefinition of global variable named '" + Name +
999 "' in the '" + Ty->getDescription() + "' type plane!");
1004 // Otherwise there is no existing GV to use, create one now.
1005 GlobalVariable *GV =
1006 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1007 CurModule.CurrentModule);
1008 InsertValue(GV, CurModule.Values);
1012 // setTypeName - Set the specified type to the name given. The name may be
1013 // null potentially, in which case this is a noop. The string passed in is
1014 // assumed to be a malloc'd string buffer, and is freed by this function.
1016 // This function returns true if the type has already been defined, but is
1017 // allowed to be redefined in the specified context. If the name is a new name
1018 // for the type plane, it is inserted and false is returned.
1019 static bool setTypeName(const Type *T, char *NameStr) {
1020 assert(!inFunctionScope() && "Can't give types function-local names!");
1021 if (NameStr == 0) return false;
1023 std::string Name(NameStr); // Copy string
1024 free(NameStr); // Free old string
1026 // We don't allow assigning names to void type
1027 if (T == Type::VoidTy) {
1028 GenerateError("Can't assign name '" + Name + "' to the void type!");
1032 // Set the type name, checking for conflicts as we do so.
1033 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1035 if (AlreadyExists) { // Inserting a name that is already defined???
1036 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1037 assert(Existing && "Conflict but no matching type?");
1039 // There is only one case where this is allowed: when we are refining an
1040 // opaque type. In this case, Existing will be an opaque type.
1041 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1042 // We ARE replacing an opaque type!
1043 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1047 // Otherwise, this is an attempt to redefine a type. That's okay if
1048 // the redefinition is identical to the original. This will be so if
1049 // Existing and T point to the same Type object. In this one case we
1050 // allow the equivalent redefinition.
1051 if (Existing == T) return true; // Yes, it's equal.
1053 // Any other kind of (non-equivalent) redefinition is an error.
1054 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1055 T->getDescription() + "' type plane!");
1061 //===----------------------------------------------------------------------===//
1062 // Code for handling upreferences in type names...
1065 // TypeContains - Returns true if Ty directly contains E in it.
1067 static bool TypeContains(const Type *Ty, const Type *E) {
1068 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1069 E) != Ty->subtype_end();
1073 struct UpRefRecord {
1074 // NestingLevel - The number of nesting levels that need to be popped before
1075 // this type is resolved.
1076 unsigned NestingLevel;
1078 // LastContainedTy - This is the type at the current binding level for the
1079 // type. Every time we reduce the nesting level, this gets updated.
1080 const Type *LastContainedTy;
1082 // UpRefTy - This is the actual opaque type that the upreference is
1083 // represented with.
1084 OpaqueType *UpRefTy;
1086 UpRefRecord(unsigned NL, OpaqueType *URTy)
1087 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1091 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1092 static std::vector<UpRefRecord> UpRefs;
1094 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1095 /// called. It loops through the UpRefs vector, which is a list of the
1096 /// currently active types. For each type, if the up reference is contained in
1097 /// the newly completed type, we decrement the level count. When the level
1098 /// count reaches zero, the upreferenced type is the type that is passed in:
1099 /// thus we can complete the cycle.
1101 static PATypeHolder HandleUpRefs(const Type *ty) {
1102 // If Ty isn't abstract, or if there are no up-references in it, then there is
1103 // nothing to resolve here.
1104 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1106 PATypeHolder Ty(ty);
1107 UR_OUT("Type '" << Ty->getDescription() <<
1108 "' newly formed. Resolving upreferences.\n" <<
1109 UpRefs.size() << " upreferences active!\n");
1111 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1112 // to zero), we resolve them all together before we resolve them to Ty. At
1113 // the end of the loop, if there is anything to resolve to Ty, it will be in
1115 OpaqueType *TypeToResolve = 0;
1117 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1118 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1119 << UpRefs[i].second->getDescription() << ") = "
1120 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1121 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1122 // Decrement level of upreference
1123 unsigned Level = --UpRefs[i].NestingLevel;
1124 UpRefs[i].LastContainedTy = Ty;
1125 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1126 if (Level == 0) { // Upreference should be resolved!
1127 if (!TypeToResolve) {
1128 TypeToResolve = UpRefs[i].UpRefTy;
1130 UR_OUT(" * Resolving upreference for "
1131 << UpRefs[i].second->getDescription() << "\n";
1132 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1133 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1134 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1135 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1137 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1138 --i; // Do not skip the next element...
1143 if (TypeToResolve) {
1144 UR_OUT(" * Resolving upreference for "
1145 << UpRefs[i].second->getDescription() << "\n";
1146 std::string OldName = TypeToResolve->getDescription());
1147 TypeToResolve->refineAbstractTypeTo(Ty);
1153 // common code from the two 'RunVMAsmParser' functions
1154 static Module* RunParser(Module * M) {
1156 llvmAsmlineno = 1; // Reset the current line number...
1157 CurModule.CurrentModule = M;
1159 // Check to make sure the parser succeeded
1162 delete ParserResult;
1166 // Check to make sure that parsing produced a result
1170 // Reset ParserResult variable while saving its value for the result.
1171 Module *Result = ParserResult;
1177 //===----------------------------------------------------------------------===//
1178 // RunVMAsmParser - Define an interface to this parser
1179 //===----------------------------------------------------------------------===//
1181 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1184 CurFilename = Filename;
1185 return RunParser(new Module(CurFilename));
1188 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1189 set_scan_string(AsmString);
1191 CurFilename = "from_memory";
1193 return RunParser(new Module (CurFilename));
1195 return RunParser(M);
1201 /* Enabling traces. */
1206 /* Enabling verbose error messages. */
1207 #ifdef YYERROR_VERBOSE
1208 # undef YYERROR_VERBOSE
1209 # define YYERROR_VERBOSE 1
1211 # define YYERROR_VERBOSE 0
1214 /* Enabling the token table. */
1215 #ifndef YYTOKEN_TABLE
1216 # define YYTOKEN_TABLE 0
1219 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1220 #line 855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1221 typedef union YYSTYPE {
1222 llvm::Module *ModuleVal;
1223 llvm::Function *FunctionVal;
1224 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1225 llvm::BasicBlock *BasicBlockVal;
1226 llvm::TerminatorInst *TermInstVal;
1227 llvm::Instruction *InstVal;
1228 llvm::Constant *ConstVal;
1230 const llvm::Type *PrimType;
1231 llvm::PATypeHolder *TypeVal;
1232 llvm::Value *ValueVal;
1234 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1235 std::vector<llvm::Value*> *ValueList;
1236 std::list<llvm::PATypeHolder> *TypeList;
1237 // Represent the RHS of PHI node
1238 std::list<std::pair<llvm::Value*,
1239 llvm::BasicBlock*> > *PHIList;
1240 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1241 std::vector<llvm::Constant*> *ConstVector;
1243 llvm::GlobalValue::LinkageTypes Linkage;
1251 char *StrVal; // This memory is strdup'd!
1252 llvm::ValID ValIDVal; // strdup'd memory maybe!
1254 llvm::Instruction::BinaryOps BinaryOpVal;
1255 llvm::Instruction::TermOps TermOpVal;
1256 llvm::Instruction::MemoryOps MemOpVal;
1257 llvm::Instruction::CastOps CastOpVal;
1258 llvm::Instruction::OtherOps OtherOpVal;
1259 llvm::Module::Endianness Endianness;
1260 llvm::ICmpInst::Predicate IPredicate;
1261 llvm::FCmpInst::Predicate FPredicate;
1263 /* Line 196 of yacc.c. */
1264 #line 1265 "llvmAsmParser.tab.c"
1265 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1266 # define YYSTYPE_IS_DECLARED 1
1267 # define YYSTYPE_IS_TRIVIAL 1
1272 /* Copy the second part of user declarations. */
1275 /* Line 219 of yacc.c. */
1276 #line 1277 "llvmAsmParser.tab.c"
1278 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1279 # define YYSIZE_T __SIZE_TYPE__
1281 #if ! defined (YYSIZE_T) && defined (size_t)
1282 # define YYSIZE_T size_t
1284 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1285 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1286 # define YYSIZE_T size_t
1288 #if ! defined (YYSIZE_T)
1289 # define YYSIZE_T unsigned int
1295 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1296 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1300 # define YY_(msgid) msgid
1304 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1306 /* The parser invokes alloca or malloc; define the necessary symbols. */
1308 # ifdef YYSTACK_USE_ALLOCA
1309 # if YYSTACK_USE_ALLOCA
1311 # define YYSTACK_ALLOC __builtin_alloca
1313 # define YYSTACK_ALLOC alloca
1314 # if defined (__STDC__) || defined (__cplusplus)
1315 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1316 # define YYINCLUDED_STDLIB_H
1322 # ifdef YYSTACK_ALLOC
1323 /* Pacify GCC's `empty if-body' warning. */
1324 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1325 # ifndef YYSTACK_ALLOC_MAXIMUM
1326 /* The OS might guarantee only one guard page at the bottom of the stack,
1327 and a page size can be as small as 4096 bytes. So we cannot safely
1328 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1329 to allow for a few compiler-allocated temporary stack slots. */
1330 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1333 # define YYSTACK_ALLOC YYMALLOC
1334 # define YYSTACK_FREE YYFREE
1335 # ifndef YYSTACK_ALLOC_MAXIMUM
1336 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1342 # define YYMALLOC malloc
1343 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1344 && (defined (__STDC__) || defined (__cplusplus)))
1345 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1349 # define YYFREE free
1350 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1351 && (defined (__STDC__) || defined (__cplusplus)))
1352 void free (void *); /* INFRINGES ON USER NAME SPACE */
1359 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1362 #if (! defined (yyoverflow) \
1363 && (! defined (__cplusplus) \
1364 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1366 /* A type that is properly aligned for any stack member. */
1373 /* The size of the maximum gap between one aligned stack and the next. */
1374 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1376 /* The size of an array large to enough to hold all stacks, each with
1378 # define YYSTACK_BYTES(N) \
1379 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1380 + YYSTACK_GAP_MAXIMUM)
1382 /* Copy COUNT objects from FROM to TO. The source and destination do
1385 # if defined (__GNUC__) && 1 < __GNUC__
1386 # define YYCOPY(To, From, Count) \
1387 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1389 # define YYCOPY(To, From, Count) \
1393 for (yyi = 0; yyi < (Count); yyi++) \
1394 (To)[yyi] = (From)[yyi]; \
1400 /* Relocate STACK from its old location to the new one. The
1401 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1402 elements in the stack, and YYPTR gives the new location of the
1403 stack. Advance YYPTR to a properly aligned location for the next
1405 # define YYSTACK_RELOCATE(Stack) \
1408 YYSIZE_T yynewbytes; \
1409 YYCOPY (&yyptr->Stack, Stack, yysize); \
1410 Stack = &yyptr->Stack; \
1411 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1412 yyptr += yynewbytes / sizeof (*yyptr); \
1418 #if defined (__STDC__) || defined (__cplusplus)
1419 typedef signed char yysigned_char;
1421 typedef short int yysigned_char;
1424 /* YYFINAL -- State number of the termination state. */
1426 /* YYLAST -- Last index in YYTABLE. */
1429 /* YYNTOKENS -- Number of terminals. */
1430 #define YYNTOKENS 159
1431 /* YYNNTS -- Number of nonterminals. */
1433 /* YYNRULES -- Number of rules. */
1434 #define YYNRULES 297
1435 /* YYNRULES -- Number of states. */
1436 #define YYNSTATES 578
1438 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1439 #define YYUNDEFTOK 2
1440 #define YYMAXUTOK 399
1442 #define YYTRANSLATE(YYX) \
1443 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1445 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1446 static const unsigned char yytranslate[] =
1448 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1452 148, 149, 157, 2, 146, 2, 2, 2, 2, 2,
1453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1454 153, 145, 154, 2, 2, 2, 2, 2, 2, 2,
1455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1457 2, 150, 147, 152, 2, 2, 2, 2, 2, 158,
1458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1460 151, 2, 2, 155, 2, 156, 2, 2, 2, 2,
1461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 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, 1, 2, 3, 4,
1474 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1475 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1476 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1477 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1478 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1479 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1480 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1481 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1482 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1483 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1484 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1485 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1486 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1487 135, 136, 137, 138, 139, 140, 141, 142, 143, 144
1491 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1493 static const unsigned short int yyprhs[] =
1495 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1496 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1497 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1498 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1499 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1500 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1501 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1502 139, 141, 143, 145, 147, 149, 151, 153, 156, 157,
1503 159, 161, 163, 165, 167, 169, 171, 172, 173, 175,
1504 177, 179, 181, 183, 185, 188, 189, 192, 193, 197,
1505 200, 201, 203, 204, 208, 210, 213, 215, 217, 219,
1506 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1507 241, 243, 245, 247, 249, 251, 253, 255, 258, 263,
1508 269, 275, 279, 282, 285, 287, 291, 293, 297, 299,
1509 300, 305, 309, 313, 318, 323, 327, 330, 333, 336,
1510 339, 342, 345, 348, 351, 354, 357, 364, 370, 379,
1511 386, 393, 400, 408, 416, 423, 430, 439, 448, 452,
1512 454, 456, 458, 460, 463, 466, 471, 474, 476, 481,
1513 484, 489, 490, 498, 499, 507, 508, 516, 517, 525,
1514 529, 534, 535, 537, 539, 541, 545, 549, 553, 557,
1515 561, 565, 567, 568, 570, 572, 574, 575, 578, 582,
1516 584, 586, 590, 592, 593, 602, 604, 606, 610, 612,
1517 614, 617, 618, 620, 622, 623, 628, 629, 631, 633,
1518 635, 637, 639, 641, 643, 645, 647, 651, 653, 659,
1519 661, 663, 665, 667, 670, 673, 676, 680, 683, 684,
1520 686, 689, 692, 696, 706, 716, 725, 739, 741, 743,
1521 750, 756, 759, 766, 774, 776, 780, 782, 783, 786,
1522 788, 794, 800, 806, 813, 820, 823, 828, 833, 840,
1523 845, 850, 857, 864, 867, 875, 877, 880, 881, 883,
1524 884, 888, 895, 899, 906, 909, 914, 921
1527 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1528 static const short int yyrhs[] =
1530 193, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1531 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1532 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1533 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1534 -1, 93, -1, 94, -1, 95, -1, 124, -1, 125,
1535 -1, 126, -1, 127, -1, 128, -1, 129, -1, 130,
1536 -1, 131, -1, 132, -1, 133, -1, 134, -1, 135,
1537 -1, 138, -1, 139, -1, 140, -1, 98, -1, 99,
1538 -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
1539 -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
1540 -1, 110, -1, 111, -1, 112, -1, 113, -1, 114,
1541 -1, 115, -1, 116, -1, 117, -1, 104, -1, 105,
1542 -1, 106, -1, 107, -1, 27, -1, 28, -1, 16,
1543 -1, 14, -1, 12, -1, 10, -1, 17, -1, 15,
1544 -1, 13, -1, 11, -1, 169, -1, 170, -1, 18,
1545 -1, 19, -1, 205, 145, -1, -1, 41, -1, 42,
1546 -1, 43, -1, 44, -1, 45, -1, 46, -1, 47,
1547 -1, -1, -1, 65, -1, 66, -1, 67, -1, 68,
1548 -1, 69, -1, 70, -1, 64, 4, -1, -1, 57,
1549 4, -1, -1, 146, 57, 4, -1, 34, 24, -1,
1550 -1, 178, -1, -1, 146, 181, 180, -1, 178, -1,
1551 57, 4, -1, 184, -1, 8, -1, 186, -1, 8,
1552 -1, 186, -1, 9, -1, 10, -1, 11, -1, 12,
1553 -1, 13, -1, 14, -1, 15, -1, 16, -1, 17,
1554 -1, 18, -1, 19, -1, 20, -1, 21, -1, 48,
1555 -1, 185, -1, 220, -1, 147, 4, -1, 183, 148,
1556 188, 149, -1, 150, 4, 151, 186, 152, -1, 153,
1557 4, 151, 186, 154, -1, 155, 187, 156, -1, 155,
1558 156, -1, 186, 157, -1, 186, -1, 187, 146, 186,
1559 -1, 187, -1, 187, 146, 37, -1, 37, -1, -1,
1560 184, 150, 191, 152, -1, 184, 150, 152, -1, 184,
1561 158, 24, -1, 184, 153, 191, 154, -1, 184, 155,
1562 191, 156, -1, 184, 155, 156, -1, 184, 38, -1,
1563 184, 39, -1, 184, 220, -1, 184, 190, -1, 184,
1564 26, -1, 169, 161, -1, 170, 4, -1, 9, 27,
1565 -1, 9, 28, -1, 172, 7, -1, 165, 148, 189,
1566 36, 184, 149, -1, 123, 148, 189, 234, 149, -1,
1567 137, 148, 189, 146, 189, 146, 189, 149, -1, 162,
1568 148, 189, 146, 189, 149, -1, 163, 148, 189, 146,
1569 189, 149, -1, 164, 148, 189, 146, 189, 149, -1,
1570 96, 167, 148, 189, 146, 189, 149, -1, 97, 168,
1571 148, 189, 146, 189, 149, -1, 166, 148, 189, 146,
1572 189, 149, -1, 142, 148, 189, 146, 189, 149, -1,
1573 143, 148, 189, 146, 189, 146, 189, 149, -1, 144,
1574 148, 189, 146, 189, 146, 189, 149, -1, 191, 146,
1575 189, -1, 189, -1, 32, -1, 33, -1, 194, -1,
1576 194, 214, -1, 194, 216, -1, 194, 62, 61, 200,
1577 -1, 194, 25, -1, 195, -1, 195, 173, 20, 182,
1578 -1, 195, 216, -1, 195, 62, 61, 200, -1, -1,
1579 195, 173, 174, 192, 189, 196, 180, -1, -1, 195,
1580 173, 50, 192, 184, 197, 180, -1, -1, 195, 173,
1581 45, 192, 184, 198, 180, -1, -1, 195, 173, 47,
1582 192, 184, 199, 180, -1, 195, 51, 202, -1, 195,
1583 58, 145, 203, -1, -1, 24, -1, 56, -1, 55,
1584 -1, 53, 145, 201, -1, 54, 145, 4, -1, 52,
1585 145, 24, -1, 71, 145, 24, -1, 150, 204, 152,
1586 -1, 204, 146, 24, -1, 24, -1, -1, 22, -1,
1587 24, -1, 205, -1, -1, 184, 206, -1, 208, 146,
1588 207, -1, 207, -1, 208, -1, 208, 146, 37, -1,
1589 37, -1, -1, 175, 182, 205, 148, 209, 149, 179,
1590 176, -1, 29, -1, 155, -1, 174, 210, 211, -1,
1591 30, -1, 156, -1, 223, 213, -1, -1, 45, -1,
1592 47, -1, -1, 31, 217, 215, 210, -1, -1, 63,
1593 -1, 3, -1, 4, -1, 7, -1, 27, -1, 28,
1594 -1, 38, -1, 39, -1, 26, -1, 153, 191, 154,
1595 -1, 190, -1, 61, 218, 24, 146, 24, -1, 160,
1596 -1, 205, -1, 220, -1, 219, -1, 184, 221, -1,
1597 223, 224, -1, 212, 224, -1, 225, 173, 226, -1,
1598 225, 228, -1, -1, 23, -1, 72, 222, -1, 72,
1599 8, -1, 73, 21, 221, -1, 73, 9, 221, 146,
1600 21, 221, 146, 21, 221, -1, 74, 171, 221, 146,
1601 21, 221, 150, 227, 152, -1, 74, 171, 221, 146,
1602 21, 221, 150, 152, -1, 75, 175, 182, 221, 148,
1603 231, 149, 36, 21, 221, 76, 21, 221, -1, 76,
1604 -1, 77, -1, 227, 171, 219, 146, 21, 221, -1,
1605 171, 219, 146, 21, 221, -1, 173, 233, -1, 184,
1606 150, 221, 146, 221, 152, -1, 229, 146, 150, 221,
1607 146, 221, 152, -1, 222, -1, 230, 146, 222, -1,
1608 230, -1, -1, 60, 59, -1, 59, -1, 162, 184,
1609 221, 146, 221, -1, 163, 184, 221, 146, 221, -1,
1610 164, 184, 221, 146, 221, -1, 96, 167, 184, 221,
1611 146, 221, -1, 97, 168, 184, 221, 146, 221, -1,
1612 49, 222, -1, 166, 222, 146, 222, -1, 165, 222,
1613 36, 184, -1, 137, 222, 146, 222, 146, 222, -1,
1614 141, 222, 146, 184, -1, 142, 222, 146, 222, -1,
1615 143, 222, 146, 222, 146, 222, -1, 144, 222, 146,
1616 222, 146, 222, -1, 136, 229, -1, 232, 175, 182,
1617 221, 148, 231, 149, -1, 236, -1, 146, 230, -1,
1618 -1, 35, -1, -1, 118, 184, 177, -1, 118, 184,
1619 146, 15, 221, 177, -1, 119, 184, 177, -1, 119,
1620 184, 146, 15, 221, 177, -1, 120, 222, -1, 235,
1621 121, 184, 221, -1, 235, 122, 222, 146, 184, 221,
1622 -1, 123, 184, 221, 234, -1
1625 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1626 static const unsigned short int yyrline[] =
1628 0, 990, 990, 991, 999, 1000, 1010, 1010, 1010, 1010,
1629 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1012, 1012,
1630 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013,
1631 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1017,
1632 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1025,
1633 1025, 1026, 1026, 1027, 1027, 1028, 1028, 1029, 1029, 1030,
1634 1030, 1031, 1031, 1032, 1033, 1038, 1038, 1038, 1038, 1039,
1635 1039, 1039, 1039, 1040, 1040, 1041, 1041, 1044, 1048, 1053,
1636 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1062, 1063, 1064,
1637 1065, 1066, 1067, 1068, 1069, 1078, 1079, 1085, 1086, 1094,
1638 1102, 1103, 1108, 1109, 1110, 1115, 1129, 1129, 1130, 1130,
1639 1132, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1143, 1143,
1640 1143, 1143, 1143, 1143, 1144, 1148, 1152, 1160, 1168, 1181,
1641 1186, 1198, 1208, 1212, 1223, 1228, 1234, 1235, 1239, 1243,
1642 1254, 1280, 1294, 1324, 1350, 1371, 1384, 1394, 1399, 1460,
1643 1467, 1475, 1481, 1487, 1491, 1495, 1503, 1515, 1536, 1544,
1644 1550, 1561, 1567, 1572, 1577, 1586, 1592, 1598, 1607, 1611,
1645 1619, 1619, 1629, 1637, 1642, 1646, 1650, 1654, 1669, 1691,
1646 1694, 1697, 1697, 1705, 1705, 1713, 1713, 1721, 1721, 1730,
1647 1733, 1736, 1740, 1753, 1754, 1756, 1760, 1769, 1773, 1778,
1648 1780, 1785, 1790, 1799, 1799, 1800, 1800, 1802, 1809, 1815,
1649 1822, 1826, 1832, 1837, 1842, 1937, 1937, 1939, 1947, 1947,
1650 1949, 1954, 1955, 1956, 1958, 1958, 1968, 1972, 1977, 1981,
1651 1985, 1989, 1993, 1997, 2001, 2005, 2009, 2034, 2038, 2052,
1652 2056, 2062, 2062, 2068, 2073, 2077, 2086, 2097, 2106, 2118,
1653 2131, 2135, 2139, 2144, 2153, 2172, 2181, 2237, 2241, 2248,
1654 2259, 2272, 2281, 2290, 2300, 2304, 2311, 2311, 2313, 2317,
1655 2322, 2341, 2356, 2370, 2381, 2392, 2405, 2414, 2425, 2433,
1656 2438, 2444, 2450, 2456, 2471, 2530, 2537, 2540, 2545, 2549,
1657 2556, 2561, 2567, 2572, 2578, 2586, 2598, 2613
1661 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1662 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1663 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1664 static const char *const yytname[] =
1666 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1667 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1668 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1669 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1670 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1671 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1672 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1673 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1674 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1675 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1676 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1677 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1678 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1679 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1680 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP",
1681 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1682 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1683 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1684 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1685 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1686 "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1687 "INSERTELEMENT", "SHUFFLEVECTOR", "'='", "','", "'\\\\'", "'('", "')'",
1688 "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept",
1689 "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps",
1690 "CastOps", "ShiftOps", "IPredicates", "FPredicates", "SIntType",
1691 "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage",
1692 "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1693 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV",
1694 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal",
1695 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList",
1696 "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle",
1697 "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName",
1698 "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1699 "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto",
1700 "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1701 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1702 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1703 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1709 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1711 static const unsigned short int yytoknum[] =
1713 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1714 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1715 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1716 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1717 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1718 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1719 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1720 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1721 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1722 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1723 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1724 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1725 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1726 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1727 395, 396, 397, 398, 399, 61, 44, 92, 40, 41,
1728 91, 120, 93, 60, 62, 123, 125, 42, 99
1732 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1733 static const unsigned char yyr1[] =
1735 0, 159, 160, 160, 161, 161, 162, 162, 162, 162,
1736 162, 162, 162, 162, 162, 163, 163, 163, 164, 164,
1737 164, 164, 164, 164, 165, 165, 165, 165, 165, 165,
1738 165, 165, 165, 165, 165, 165, 166, 166, 166, 167,
1739 167, 167, 167, 167, 167, 167, 167, 167, 167, 168,
1740 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1741 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
1742 170, 170, 170, 171, 171, 172, 172, 173, 173, 174,
1743 174, 174, 174, 174, 174, 174, 174, 175, 175, 175,
1744 175, 175, 175, 175, 175, 176, 176, 177, 177, 178,
1745 179, 179, 180, 180, 181, 181, 182, 182, 183, 183,
1746 184, 185, 185, 185, 185, 185, 185, 185, 185, 185,
1747 185, 185, 185, 185, 186, 186, 186, 186, 186, 186,
1748 186, 186, 186, 186, 187, 187, 188, 188, 188, 188,
1749 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
1750 189, 189, 189, 189, 189, 189, 190, 190, 190, 190,
1751 190, 190, 190, 190, 190, 190, 190, 190, 191, 191,
1752 192, 192, 193, 194, 194, 194, 194, 194, 195, 195,
1753 195, 196, 195, 197, 195, 198, 195, 199, 195, 195,
1754 195, 195, 200, 201, 201, 202, 202, 202, 202, 203,
1755 204, 204, 204, 205, 205, 206, 206, 207, 208, 208,
1756 209, 209, 209, 209, 210, 211, 211, 212, 213, 213,
1757 214, 215, 215, 215, 217, 216, 218, 218, 219, 219,
1758 219, 219, 219, 219, 219, 219, 219, 219, 219, 220,
1759 220, 221, 221, 222, 223, 223, 224, 225, 225, 225,
1760 226, 226, 226, 226, 226, 226, 226, 226, 226, 227,
1761 227, 228, 229, 229, 230, 230, 231, 231, 232, 232,
1762 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1763 233, 233, 233, 233, 233, 233, 234, 234, 235, 235,
1764 236, 236, 236, 236, 236, 236, 236, 236
1767 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1768 static const unsigned char yyr2[] =
1770 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1771 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1772 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1773 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1774 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1776 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1777 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
1778 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,
1779 1, 1, 1, 1, 2, 0, 2, 0, 3, 2,
1780 0, 1, 0, 3, 1, 2, 1, 1, 1, 1,
1781 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1782 1, 1, 1, 1, 1, 1, 1, 2, 4, 5,
1783 5, 3, 2, 2, 1, 3, 1, 3, 1, 0,
1784 4, 3, 3, 4, 4, 3, 2, 2, 2, 2,
1785 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1786 6, 6, 7, 7, 6, 6, 8, 8, 3, 1,
1787 1, 1, 1, 2, 2, 4, 2, 1, 4, 2,
1788 4, 0, 7, 0, 7, 0, 7, 0, 7, 3,
1789 4, 0, 1, 1, 1, 3, 3, 3, 3, 3,
1790 3, 1, 0, 1, 1, 1, 0, 2, 3, 1,
1791 1, 3, 1, 0, 8, 1, 1, 3, 1, 1,
1792 2, 0, 1, 1, 0, 4, 0, 1, 1, 1,
1793 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1794 1, 1, 1, 2, 2, 2, 3, 2, 0, 1,
1795 2, 2, 3, 9, 9, 8, 13, 1, 1, 6,
1796 5, 2, 6, 7, 1, 3, 1, 0, 2, 1,
1797 5, 5, 5, 6, 6, 2, 4, 4, 6, 4,
1798 4, 6, 6, 2, 7, 1, 2, 0, 1, 0,
1799 3, 6, 3, 6, 2, 4, 6, 4
1802 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1803 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1804 means the default is an error. */
1805 static const unsigned short int yydefact[] =
1807 191, 0, 86, 177, 1, 176, 224, 79, 80, 81,
1808 82, 83, 84, 85, 0, 87, 248, 173, 174, 248,
1809 203, 204, 0, 0, 0, 86, 0, 179, 221, 0,
1810 0, 88, 89, 90, 91, 92, 93, 0, 0, 249,
1811 245, 78, 218, 219, 220, 244, 0, 0, 0, 0,
1812 189, 0, 0, 0, 0, 0, 0, 0, 77, 222,
1813 223, 87, 192, 175, 94, 2, 3, 107, 111, 112,
1814 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
1815 123, 124, 0, 0, 0, 0, 239, 0, 0, 106,
1816 125, 110, 240, 126, 215, 216, 217, 289, 247, 0,
1817 0, 0, 0, 202, 190, 180, 178, 170, 171, 0,
1818 0, 0, 0, 225, 127, 0, 0, 109, 132, 134,
1819 0, 0, 139, 133, 288, 0, 269, 0, 0, 0,
1820 0, 87, 257, 258, 6, 7, 8, 9, 10, 11,
1821 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1822 22, 23, 0, 0, 0, 0, 0, 0, 24, 25,
1823 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1824 0, 0, 36, 37, 38, 0, 0, 0, 0, 0,
1825 0, 0, 0, 0, 246, 87, 261, 0, 285, 197,
1826 194, 193, 195, 196, 198, 201, 0, 185, 187, 183,
1827 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
1828 121, 0, 0, 0, 0, 181, 0, 0, 0, 131,
1829 213, 138, 136, 0, 0, 275, 268, 251, 250, 0,
1830 0, 68, 72, 67, 71, 66, 70, 65, 69, 73,
1831 74, 0, 0, 39, 40, 41, 42, 43, 44, 45,
1832 46, 47, 48, 0, 63, 64, 59, 60, 61, 62,
1833 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
1834 0, 97, 97, 294, 0, 0, 283, 0, 0, 0,
1835 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1836 0, 199, 102, 102, 102, 153, 154, 4, 5, 151,
1837 152, 155, 150, 146, 147, 0, 0, 0, 0, 0,
1838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1839 0, 149, 148, 102, 108, 108, 135, 212, 206, 209,
1840 210, 0, 0, 128, 228, 229, 230, 235, 231, 232,
1841 233, 234, 226, 0, 237, 242, 241, 243, 0, 252,
1842 0, 0, 0, 0, 0, 290, 0, 292, 287, 0,
1843 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1844 0, 0, 0, 0, 200, 0, 186, 188, 184, 0,
1845 0, 0, 0, 0, 0, 0, 141, 169, 0, 0,
1846 145, 0, 142, 0, 0, 0, 0, 0, 182, 129,
1847 130, 205, 207, 0, 100, 137, 227, 0, 0, 0,
1848 0, 0, 0, 0, 0, 0, 0, 0, 297, 0,
1849 0, 0, 279, 280, 0, 0, 0, 0, 0, 277,
1850 276, 0, 295, 0, 0, 0, 104, 102, 0, 0,
1851 287, 0, 0, 0, 0, 0, 140, 143, 144, 0,
1852 0, 0, 0, 0, 211, 208, 101, 95, 0, 236,
1853 0, 0, 267, 0, 0, 97, 98, 97, 264, 286,
1854 0, 0, 0, 0, 0, 270, 271, 272, 267, 0,
1855 99, 105, 103, 0, 0, 0, 0, 0, 0, 0,
1856 168, 0, 0, 0, 0, 0, 0, 214, 0, 0,
1857 0, 266, 0, 273, 274, 0, 291, 293, 0, 0,
1858 0, 278, 281, 282, 0, 296, 0, 0, 157, 0,
1859 0, 0, 0, 0, 0, 0, 0, 0, 96, 238,
1860 0, 0, 0, 265, 262, 0, 284, 0, 0, 0,
1861 165, 0, 0, 159, 160, 161, 156, 164, 0, 255,
1862 0, 0, 0, 263, 162, 163, 0, 0, 0, 253,
1863 0, 254, 0, 0, 158, 166, 167, 0, 0, 0,
1864 0, 0, 0, 260, 0, 0, 259, 256
1867 /* YYDEFGOTO[NTERM-NUM]. */
1868 static const short int yydefgoto[] =
1870 -1, 86, 299, 316, 317, 318, 319, 320, 253, 270,
1871 211, 212, 241, 213, 25, 15, 37, 497, 355, 436,
1872 457, 376, 437, 87, 88, 214, 90, 91, 120, 223,
1873 387, 344, 388, 109, 1, 2, 3, 323, 294, 292,
1874 293, 63, 192, 50, 104, 196, 92, 402, 329, 330,
1875 331, 38, 96, 16, 44, 17, 61, 18, 28, 407,
1876 345, 93, 347, 468, 19, 40, 41, 184, 551, 98,
1877 276, 501, 502, 185, 186, 418, 187, 188
1880 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1882 #define YYPACT_NINF -517
1883 static const short int yypact[] =
1885 -517, 40, 69, 528, -517, -517, -517, -517, -517, -517,
1886 -517, -517, -517, -517, 16, 90, 76, -517, -517, 5,
1887 -517, -517, 50, -40, 71, 37, -15, -517, -4, 124,
1888 164, -517, -517, -517, -517, -517, -517, 1244, -18, -517,
1889 -517, 125, -517, -517, -517, -517, 45, 53, 54, 59,
1890 -517, 67, 124, 1244, 103, 103, 103, 103, -517, -517,
1891 -517, 90, -517, -517, -517, -517, -517, 70, -517, -517,
1892 -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,
1893 -517, -517, 197, 215, 216, 670, -517, 125, 73, -517,
1894 -517, -62, -517, -517, -517, -517, -517, 1349, -517, 198,
1895 111, 219, 200, 201, -517, -517, -517, -517, -517, 1264,
1896 1264, 1264, 1309, -517, -517, 75, 77, -517, -517, -62,
1897 -108, 81, 1051, -517, -517, 1264, -517, 168, 1354, 24,
1898 112, 90, -517, -517, -517, -517, -517, -517, -517, -517,
1899 -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,
1900 -517, -517, 108, 65, 1264, 1264, 1264, 1264, -517, -517,
1901 -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,
1902 1264, 1264, -517, -517, -517, 1264, 1264, 1264, 1264, 1264,
1903 1264, 1264, 1264, 1264, -517, 90, -517, 42, -517, -517,
1904 -517, -517, -517, -517, -517, -517, -110, -517, -517, -517,
1905 157, 183, 226, 185, 227, 189, 228, 191, 230, 231,
1906 235, 193, 239, 237, 577, -517, 1264, 1264, 1264, -517,
1907 1092, -517, 89, 96, 763, -517, -517, 70, -517, 763,
1908 763, -517, -517, -517, -517, -517, -517, -517, -517, -517,
1909 -517, 763, 1244, -517, -517, -517, -517, -517, -517, -517,
1910 -517, -517, -517, 1264, -517, -517, -517, -517, -517, -517,
1911 -517, -517, -517, -517, -517, -517, -517, -517, -517, -517,
1912 1264, 101, 102, -517, 763, 99, 107, 109, 110, 113,
1913 114, 115, 763, 763, 763, 218, 116, 1244, 1264, 1264,
1914 233, -517, 117, 117, 117, -517, -517, -517, -517, -517,
1915 -517, -517, -517, -517, -517, 108, 65, 119, 120, 121,
1916 123, 126, 998, 1309, 728, 234, 127, 128, 129, 130,
1917 131, -517, -517, 117, -56, -142, -62, -517, 125, -517,
1918 118, 132, 1149, -517, -517, -517, -517, -517, -517, -517,
1919 -517, -517, 202, 1309, -517, -517, -517, -517, 136, -517,
1920 137, 763, 763, 763, -7, -517, -2, -517, 138, 763,
1921 122, 1264, 1264, 1264, 1264, 1264, 146, 147, 148, 1264,
1922 1264, 763, 763, 149, -517, -20, -517, -517, -517, 150,
1923 156, 1309, 1309, 1309, 1309, 1309, -517, -517, -76, -57,
1924 -517, -71, -517, 1309, 1309, 1309, 1309, 1309, -517, -517,
1925 -517, -517, -517, 1203, 262, -517, -517, 249, -48, 284,
1926 285, 159, 165, 166, 763, 306, 763, 1264, -517, 167,
1927 763, 169, -517, -517, 170, 171, 763, 763, 763, -517,
1928 -517, 173, -517, 1264, 290, 314, -517, 117, 1309, 1309,
1929 138, 176, 177, 188, 190, 1309, -517, -517, -517, 195,
1930 196, 206, 283, 208, -517, -517, -517, 272, 209, -517,
1931 763, 763, 1264, 763, 763, 210, -517, 210, -517, 211,
1932 763, 212, 1264, 1264, 1264, -517, -517, -517, 1264, 763,
1933 -517, -517, -517, 213, 214, 186, 1309, 1309, 1309, 1309,
1934 -517, 1309, 1309, 1309, 1264, 1309, 333, -517, 319, 221,
1935 220, 211, 222, -517, -517, 289, -517, -517, 1264, 217,
1936 763, -517, -517, -517, 223, -517, 1309, 1309, -517, 229,
1937 224, 232, 236, 225, 238, 240, 241, 242, -517, -517,
1938 326, 10, 328, -517, -517, 248, -517, 253, 254, 1309,
1939 -517, 1309, 1309, -517, -517, -517, -517, -517, 763, -517,
1940 905, 51, 344, -517, -517, -517, 256, 261, 263, -517,
1941 265, -517, 905, 763, -517, -517, -517, 347, 267, 300,
1942 763, 356, 358, -517, 763, 763, -517, -517
1945 /* YYPGOTO[NTERM-NUM]. */
1946 static const short int yypgoto[] =
1948 -517, -517, -517, 286, 288, 291, 317, 320, 134, 80,
1949 -127, -125, -502, -517, 340, 391, -114, -517, -265, 14,
1950 -517, -284, -517, -51, -517, -37, -517, -66, 297, -517,
1951 -94, 207, -283, 52, -517, -517, -517, -517, -517, -517,
1952 -517, 368, -517, -517, -517, -517, 3, -517, 26, -517,
1953 -517, 372, -517, -517, -517, -517, -517, 431, -517, -517,
1954 -516, 56, 79, -124, -517, 421, -517, -517, -517, -517,
1955 -517, 25, -35, -517, -517, 4, -517, -517
1958 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1959 positive, shift that token. If negative, reduce the rule which
1960 number is the opposite. If zero, do what YYDEFACT says.
1961 If YYTABLE_NINF, syntax error. */
1962 #define YYTABLE_NINF -173
1963 static const short int yytable[] =
1965 89, 225, 106, 239, 228, 240, 26, 357, 414, 377,
1966 378, 94, 400, 416, 434, 123, 89, 242, 215, 119,
1967 231, 232, 233, 234, 235, 236, 237, 238, 39, 550,
1968 389, 391, 273, 229, 560, 42, 290, 435, 218, 398,
1969 4, 59, 291, 60, 26, 230, 568, 277, 219, 562,
1970 415, 278, 279, 280, 281, 415, 119, 53, 285, 286,
1971 408, 231, 232, 233, 234, 235, 236, 237, 238, -172,
1972 445, 287, 197, 198, 199, 445, 446, 29, 7, 8,
1973 9, 10, 54, 12, 55, 448, -108, 56, 224, 445,
1974 121, 224, 254, 255, 5, 123, 399, 447, 445, 39,
1975 6, 123, 46, 47, 48, 51, 459, 110, 111, 112,
1976 7, 8, 9, 10, 11, 12, 13, 271, 272, 224,
1977 274, 49, 231, 232, 233, 234, 235, 236, 237, 238,
1978 58, 14, 52, 275, 224, 107, 108, 95, 224, 224,
1979 224, 224, 282, 283, 284, 224, 224, 20, 62, 21,
1980 324, 325, 326, 482, 30, 31, 32, 33, 34, 35,
1981 36, 43, 549, 288, 289, 373, 190, 191, 64, 256,
1982 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
1983 267, 268, 269, 328, 295, 296, -68, -68, -67, -67,
1984 99, 351, -66, -66, -65, -65, 297, 298, 100, 101,
1985 506, 114, 507, 561, 102, 89, 243, 244, 245, 246,
1986 247, 248, 249, 250, 251, 252, 352, 103, -109, 115,
1987 116, 122, 189, 193, 194, 195, 216, 226, 217, 220,
1988 -72, -71, -70, 353, -69, 332, 371, 421, -75, 423,
1989 424, 425, -76, 300, 301, 333, 430, 354, 356, 359,
1990 89, 372, 224, 360, 369, 361, 362, 374, 392, 363,
1991 364, 365, 370, 375, 403, 406, 326, 381, 382, 383,
1992 322, 384, 420, 458, 385, 393, 394, 395, 396, 397,
1993 346, 404, 409, 410, 417, 346, 346, 440, 441, 442,
1994 443, 444, 426, 427, 428, 433, 434, 346, 438, 449,
1995 450, 451, 452, 453, 439, 460, 461, 462, 348, 349,
1996 466, 463, 464, 470, 480, 472, 473, 474, 481, 494,
1997 350, 478, 486, 487, 224, 422, 224, 224, 224, 496,
1998 346, 401, 429, 224, 488, 518, 489, 528, 346, 346,
1999 346, 491, 492, 529, 483, 484, 415, 548, 511, 512,
2000 513, 490, 493, 358, 495, 498, 505, 508, 510, 516,
2001 517, 366, 367, 368, 552, 563, 328, 530, 570, 534,
2002 531, 532, 536, 540, 543, 539, 572, 574, 541, 575,
2003 224, 97, 542, 179, 533, 180, 380, 544, 181, 545,
2004 546, 547, 519, 520, 521, 522, 479, 523, 524, 525,
2005 553, 527, 554, 555, 239, 564, 240, 346, 346, 346,
2006 565, 567, 566, 571, 182, 346, 57, 183, 456, 222,
2007 105, 321, 537, 538, 239, 224, 240, 346, 346, 455,
2008 411, 412, 413, 113, 27, 224, 224, 224, 419, 379,
2009 45, 224, 469, 514, 485, 556, 0, 557, 558, 0,
2010 431, 432, 0, 0, 0, 0, 0, 526, 0, 0,
2011 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2012 346, 224, 346, 0, 0, 0, 346, 0, 0, 0,
2013 0, 0, 346, 346, 346, 0, 0, 0, 0, 0,
2014 0, 0, 0, 465, 0, 467, 0, 0, 0, 471,
2015 0, 0, 0, 0, 0, 475, 476, 477, 0, 0,
2016 0, 0, 0, 0, 0, 0, 346, 346, 0, 346,
2017 346, 0, 0, 0, 0, 0, 346, 0, 0, 0,
2018 0, 0, 0, 0, 0, 346, 0, 0, 0, 499,
2019 500, 0, 503, 504, 0, 0, 0, 0, -78, 509,
2020 20, 0, 21, 0, 0, 0, 0, 0, 515, 6,
2021 -78, -78, 0, 0, 0, 0, 346, 0, 0, -78,
2022 -78, -78, -78, -78, -78, -78, 0, 0, -78, 22,
2023 0, 0, 65, 66, 0, 0, 23, 0, 0, 535,
2024 24, 0, 0, 0, 0, 0, 0, 0, 0, 20,
2025 0, 21, 0, 302, 346, 0, 0, 0, 0, 0,
2026 0, 0, 0, 0, 0, 303, 304, 0, 0, 346,
2027 0, 0, 0, 0, 0, 0, 346, 559, 0, 0,
2028 346, 346, 0, 0, 0, 0, 0, 0, 0, 0,
2029 0, 0, 569, 0, 0, 0, 0, 0, 0, 573,
2030 0, 0, 0, 576, 577, 134, 135, 136, 137, 138,
2031 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
2032 149, 150, 151, 305, 306, 65, 66, 0, 117, 68,
2033 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2034 79, 80, 20, 0, 21, 0, 0, 0, 0, 0,
2035 307, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2036 167, 168, 169, 0, 308, 172, 173, 174, 81, 309,
2037 310, 311, 0, 0, 0, 0, 0, 312, 0, 0,
2038 313, 0, 314, 65, 66, 315, 117, 200, 201, 202,
2039 203, 204, 205, 206, 207, 208, 209, 210, 79, 80,
2040 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2041 0, 0, 0, 0, 0, 0, 334, 335, 65, 66,
2042 336, 0, 0, 0, 0, 0, 81, 0, 0, 0,
2043 0, 0, 0, 0, 0, 20, 0, 21, 0, 337,
2044 338, 339, 0, 0, 0, 0, 0, 0, 0, 0,
2045 0, 340, 341, 0, 0, 0, 0, 0, 0, 0,
2046 0, 0, 0, 0, 0, 0, 0, 82, 0, 0,
2047 83, 0, 0, 84, 342, 85, 118, 0, 0, 0,
2048 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2049 0, 134, 135, 136, 137, 138, 139, 140, 141, 142,
2050 143, 144, 145, 146, 147, 148, 149, 150, 151, 305,
2051 306, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2053 0, 84, 0, 85, 390, 0, 307, 158, 159, 160,
2054 161, 162, 163, 164, 165, 166, 167, 168, 169, 0,
2055 308, 172, 173, 174, 0, 309, 310, 311, 334, 335,
2056 0, 0, 336, 0, 0, 0, 343, 0, 0, 0,
2057 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2058 0, 337, 338, 339, 0, 0, 0, 0, 0, 0,
2059 0, 0, 0, 340, 341, 0, 0, 0, 0, 0,
2060 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2061 0, 0, 0, 0, 0, 0, 342, 0, 0, 0,
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2063 0, 0, 0, 134, 135, 136, 137, 138, 139, 140,
2064 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2065 151, 305, 306, 65, 66, 0, 117, 200, 201, 202,
2066 203, 204, 205, 206, 207, 208, 209, 210, 79, 80,
2067 20, 0, 21, 0, 0, 0, 0, 0, 307, 158,
2068 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
2069 169, 0, 308, 172, 173, 174, 81, 309, 310, 311,
2070 0, 0, 0, 0, 0, 0, 65, 66, 343, 117,
2071 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2072 78, 79, 80, 20, 0, 21, 0, 0, 0, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 221, 0,
2074 0, 0, 0, 0, 0, 0, 0, 65, 66, 81,
2075 117, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2076 77, 78, 79, 80, 20, 0, 21, 0, 0, 0,
2077 0, 0, 0, 0, 0, 0, 0, 0, 0, 327,
2078 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2079 81, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2080 386, 84, 0, 85, 65, 66, 0, 117, 68, 69,
2081 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2082 80, 20, 0, 21, 0, 0, 0, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 405, 0, 0, 0,
2084 0, 0, 0, 0, 0, 0, 0, 81, 82, 0,
2085 0, 83, 0, 0, 84, 0, 85, 0, 65, 66,
2086 0, 117, 68, 69, 70, 71, 72, 73, 74, 75,
2087 76, 77, 78, 79, 80, 20, 0, 21, 0, 0,
2088 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
2089 454, 0, 83, 0, 0, 84, 0, 85, 0, 65,
2090 66, 81, 67, 68, 69, 70, 71, 72, 73, 74,
2091 75, 76, 77, 78, 79, 80, 20, 0, 21, 65,
2092 66, 0, 117, 68, 69, 70, 71, 72, 73, 74,
2093 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2094 0, 0, 81, 0, 0, 0, 82, 0, 0, 83,
2095 0, 0, 84, 0, 85, 0, 0, 0, 0, 0,
2096 0, 0, 81, 0, 65, 66, 0, 117, 200, 201,
2097 202, 203, 204, 205, 206, 207, 208, 209, 210, 79,
2098 80, 20, 0, 21, 0, 0, 0, 0, 0, 0,
2099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2100 82, 0, 0, 83, 0, 0, 84, 81, 85, 65,
2101 66, 0, 227, 68, 69, 70, 71, 72, 73, 74,
2102 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2103 0, 0, 0, 0, 124, 0, 0, 0, 0, 0,
2104 0, 82, 0, 0, 83, 0, 0, 84, 125, 85,
2105 0, 0, 81, 0, 0, 0, 0, 0, 126, 127,
2106 0, 82, 0, 0, 83, 0, 0, 84, 0, 85,
2107 0, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2108 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2109 147, 148, 149, 150, 151, 152, 153, 0, 0, 0,
2110 0, 0, 0, 0, 0, 0, 82, 0, 0, 83,
2111 0, 0, 84, 0, 85, 0, 0, 154, 155, 156,
2112 0, 0, 157, 158, 159, 160, 161, 162, 163, 164,
2113 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
2114 175, 176, 177, 178, 0, 0, 0, 0, 0, 0,
2115 0, 82, 0, 0, 83, 0, 0, 84, 0, 85
2118 static const short int yycheck[] =
2120 37, 125, 53, 130, 128, 130, 3, 272, 15, 293,
2121 294, 29, 154, 15, 34, 157, 53, 131, 112, 85,
2122 10, 11, 12, 13, 14, 15, 16, 17, 23, 531,
2123 313, 314, 156, 9, 550, 30, 146, 57, 146, 323,
2124 0, 45, 152, 47, 41, 21, 562, 171, 156, 551,
2125 57, 175, 176, 177, 178, 57, 122, 20, 182, 183,
2126 343, 10, 11, 12, 13, 14, 15, 16, 17, 0,
2127 146, 185, 109, 110, 111, 146, 152, 61, 41, 42,
2128 43, 44, 45, 46, 47, 156, 148, 50, 125, 146,
2129 87, 128, 27, 28, 25, 157, 152, 154, 146, 23,
2130 31, 157, 52, 53, 54, 145, 154, 55, 56, 57,
2131 41, 42, 43, 44, 45, 46, 47, 154, 155, 156,
2132 157, 71, 10, 11, 12, 13, 14, 15, 16, 17,
2133 145, 62, 61, 170, 171, 32, 33, 155, 175, 176,
2134 177, 178, 179, 180, 181, 182, 183, 22, 24, 24,
2135 216, 217, 218, 437, 64, 65, 66, 67, 68, 69,
2136 70, 156, 152, 121, 122, 289, 55, 56, 4, 104,
2137 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2138 115, 116, 117, 220, 27, 28, 3, 4, 3, 4,
2139 145, 242, 3, 4, 3, 4, 3, 4, 145, 145,
2140 465, 4, 467, 152, 145, 242, 98, 99, 100, 101,
2141 102, 103, 104, 105, 106, 107, 253, 150, 148, 4,
2142 4, 148, 24, 4, 24, 24, 151, 59, 151, 148,
2143 4, 4, 4, 270, 4, 146, 287, 361, 7, 363,
2144 364, 365, 7, 4, 7, 149, 370, 146, 146, 150,
2145 287, 288, 289, 146, 36, 146, 146, 24, 24, 146,
2146 146, 146, 146, 146, 146, 63, 332, 148, 148, 148,
2147 214, 148, 150, 24, 148, 148, 148, 148, 148, 148,
2148 224, 149, 146, 146, 146, 229, 230, 381, 382, 383,
2149 384, 385, 146, 146, 146, 146, 34, 241, 148, 393,
2150 394, 395, 396, 397, 148, 21, 21, 148, 229, 230,
2151 4, 146, 146, 146, 24, 146, 146, 146, 4, 36,
2152 241, 148, 146, 146, 361, 362, 363, 364, 365, 57,
2153 274, 328, 369, 370, 146, 149, 146, 4, 282, 283,
2154 284, 146, 146, 24, 438, 439, 57, 21, 472, 473,
2155 474, 445, 146, 274, 146, 146, 146, 146, 146, 146,
2156 146, 282, 283, 284, 36, 21, 403, 146, 21, 152,
2157 150, 149, 149, 149, 149, 146, 76, 21, 146, 21,
2158 417, 41, 146, 97, 508, 97, 306, 149, 97, 149,
2159 149, 149, 486, 487, 488, 489, 433, 491, 492, 493,
2160 152, 495, 149, 149, 531, 149, 531, 351, 352, 353,
2161 149, 146, 149, 146, 97, 359, 25, 97, 404, 122,
2162 52, 214, 516, 517, 551, 462, 551, 371, 372, 403,
2163 351, 352, 353, 61, 3, 472, 473, 474, 359, 305,
2164 19, 478, 417, 478, 440, 539, -1, 541, 542, -1,
2165 371, 372, -1, -1, -1, -1, -1, 494, -1, -1,
2166 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2167 414, 508, 416, -1, -1, -1, 420, -1, -1, -1,
2168 -1, -1, 426, 427, 428, -1, -1, -1, -1, -1,
2169 -1, -1, -1, 414, -1, 416, -1, -1, -1, 420,
2170 -1, -1, -1, -1, -1, 426, 427, 428, -1, -1,
2171 -1, -1, -1, -1, -1, -1, 460, 461, -1, 463,
2172 464, -1, -1, -1, -1, -1, 470, -1, -1, -1,
2173 -1, -1, -1, -1, -1, 479, -1, -1, -1, 460,
2174 461, -1, 463, 464, -1, -1, -1, -1, 20, 470,
2175 22, -1, 24, -1, -1, -1, -1, -1, 479, 31,
2176 32, 33, -1, -1, -1, -1, 510, -1, -1, 41,
2177 42, 43, 44, 45, 46, 47, -1, -1, 50, 51,
2178 -1, -1, 5, 6, -1, -1, 58, -1, -1, 510,
2179 62, -1, -1, -1, -1, -1, -1, -1, -1, 22,
2180 -1, 24, -1, 26, 548, -1, -1, -1, -1, -1,
2181 -1, -1, -1, -1, -1, 38, 39, -1, -1, 563,
2182 -1, -1, -1, -1, -1, -1, 570, 548, -1, -1,
2183 574, 575, -1, -1, -1, -1, -1, -1, -1, -1,
2184 -1, -1, 563, -1, -1, -1, -1, -1, -1, 570,
2185 -1, -1, -1, 574, 575, 78, 79, 80, 81, 82,
2186 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2187 93, 94, 95, 96, 97, 5, 6, -1, 8, 9,
2188 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2189 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
2190 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2191 133, 134, 135, -1, 137, 138, 139, 140, 48, 142,
2192 143, 144, -1, -1, -1, -1, -1, 150, -1, -1,
2193 153, -1, 155, 5, 6, 158, 8, 9, 10, 11,
2194 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2195 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2196 -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
2197 7, -1, -1, -1, -1, -1, 48, -1, -1, -1,
2198 -1, -1, -1, -1, -1, 22, -1, 24, -1, 26,
2199 27, 28, -1, -1, -1, -1, -1, -1, -1, -1,
2200 -1, 38, 39, -1, -1, -1, -1, -1, -1, -1,
2201 -1, -1, -1, -1, -1, -1, -1, 147, -1, -1,
2202 150, -1, -1, 153, 61, 155, 156, -1, -1, -1,
2203 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2204 -1, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2205 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2206 97, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2207 -1, -1, -1, -1, -1, 147, -1, -1, 150, -1,
2208 -1, 153, -1, 155, 156, -1, 123, 124, 125, 126,
2209 127, 128, 129, 130, 131, 132, 133, 134, 135, -1,
2210 137, 138, 139, 140, -1, 142, 143, 144, 3, 4,
2211 -1, -1, 7, -1, -1, -1, 153, -1, -1, -1,
2212 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2213 -1, 26, 27, 28, -1, -1, -1, -1, -1, -1,
2214 -1, -1, -1, 38, 39, -1, -1, -1, -1, -1,
2215 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2216 -1, -1, -1, -1, -1, -1, 61, -1, -1, -1,
2217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2218 -1, -1, -1, 78, 79, 80, 81, 82, 83, 84,
2219 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2220 95, 96, 97, 5, 6, -1, 8, 9, 10, 11,
2221 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2222 22, -1, 24, -1, -1, -1, -1, -1, 123, 124,
2223 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
2224 135, -1, 137, 138, 139, 140, 48, 142, 143, 144,
2225 -1, -1, -1, -1, -1, -1, 5, 6, 153, 8,
2226 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2227 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
2228 -1, -1, -1, -1, -1, -1, -1, -1, 37, -1,
2229 -1, -1, -1, -1, -1, -1, -1, 5, 6, 48,
2230 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2231 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2232 -1, -1, -1, -1, -1, -1, -1, -1, -1, 37,
2233 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2234 48, -1, -1, -1, -1, 147, -1, -1, 150, -1,
2235 152, 153, -1, 155, 5, 6, -1, 8, 9, 10,
2236 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2237 21, 22, -1, 24, -1, -1, -1, -1, -1, -1,
2238 -1, -1, -1, -1, -1, -1, 37, -1, -1, -1,
2239 -1, -1, -1, -1, -1, -1, -1, 48, 147, -1,
2240 -1, 150, -1, -1, 153, -1, 155, -1, 5, 6,
2241 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2242 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2243 -1, -1, -1, -1, -1, -1, -1, -1, -1, 147,
2244 37, -1, 150, -1, -1, 153, -1, 155, -1, 5,
2245 6, 48, 8, 9, 10, 11, 12, 13, 14, 15,
2246 16, 17, 18, 19, 20, 21, 22, -1, 24, 5,
2247 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2248 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2249 -1, -1, 48, -1, -1, -1, 147, -1, -1, 150,
2250 -1, -1, 153, -1, 155, -1, -1, -1, -1, -1,
2251 -1, -1, 48, -1, 5, 6, -1, 8, 9, 10,
2252 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2253 21, 22, -1, 24, -1, -1, -1, -1, -1, -1,
2254 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2255 147, -1, -1, 150, -1, -1, 153, 48, 155, 5,
2256 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2257 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2258 -1, -1, -1, -1, 35, -1, -1, -1, -1, -1,
2259 -1, 147, -1, -1, 150, -1, -1, 153, 49, 155,
2260 -1, -1, 48, -1, -1, -1, -1, -1, 59, 60,
2261 -1, 147, -1, -1, 150, -1, -1, 153, -1, 155,
2262 -1, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2263 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2264 91, 92, 93, 94, 95, 96, 97, -1, -1, -1,
2265 -1, -1, -1, -1, -1, -1, 147, -1, -1, 150,
2266 -1, -1, 153, -1, 155, -1, -1, 118, 119, 120,
2267 -1, -1, 123, 124, 125, 126, 127, 128, 129, 130,
2268 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
2269 141, 142, 143, 144, -1, -1, -1, -1, -1, -1,
2270 -1, 147, -1, -1, 150, -1, -1, 153, -1, 155
2273 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2274 symbol of state STATE-NUM. */
2275 static const unsigned char yystos[] =
2277 0, 193, 194, 195, 0, 25, 31, 41, 42, 43,
2278 44, 45, 46, 47, 62, 174, 212, 214, 216, 223,
2279 22, 24, 51, 58, 62, 173, 205, 216, 217, 61,
2280 64, 65, 66, 67, 68, 69, 70, 175, 210, 23,
2281 224, 225, 30, 156, 213, 224, 52, 53, 54, 71,
2282 202, 145, 61, 20, 45, 47, 50, 174, 145, 45,
2283 47, 215, 24, 200, 4, 5, 6, 8, 9, 10,
2284 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2285 21, 48, 147, 150, 153, 155, 160, 182, 183, 184,
2286 185, 186, 205, 220, 29, 155, 211, 173, 228, 145,
2287 145, 145, 145, 150, 203, 200, 182, 32, 33, 192,
2288 192, 192, 192, 210, 4, 4, 4, 8, 156, 186,
2289 187, 205, 148, 157, 35, 49, 59, 60, 72, 73,
2290 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2291 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2292 94, 95, 96, 97, 118, 119, 120, 123, 124, 125,
2293 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2294 136, 137, 138, 139, 140, 141, 142, 143, 144, 162,
2295 163, 164, 165, 166, 226, 232, 233, 235, 236, 24,
2296 55, 56, 201, 4, 24, 24, 204, 184, 184, 184,
2297 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2298 19, 169, 170, 172, 184, 189, 151, 151, 146, 156,
2299 148, 37, 187, 188, 184, 222, 59, 8, 222, 9,
2300 21, 10, 11, 12, 13, 14, 15, 16, 17, 169,
2301 170, 171, 175, 98, 99, 100, 101, 102, 103, 104,
2302 105, 106, 107, 167, 27, 28, 104, 105, 106, 107,
2303 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2304 168, 184, 184, 222, 184, 184, 229, 222, 222, 222,
2305 222, 222, 184, 184, 184, 222, 222, 175, 121, 122,
2306 146, 152, 198, 199, 197, 27, 28, 3, 4, 161,
2307 4, 7, 26, 38, 39, 96, 97, 123, 137, 142,
2308 143, 144, 150, 153, 155, 158, 162, 163, 164, 165,
2309 166, 190, 220, 196, 186, 186, 186, 37, 184, 207,
2310 208, 209, 146, 149, 3, 4, 7, 26, 27, 28,
2311 38, 39, 61, 153, 190, 219, 220, 221, 221, 221,
2312 221, 182, 184, 184, 146, 177, 146, 177, 221, 150,
2313 146, 146, 146, 146, 146, 146, 221, 221, 221, 36,
2314 146, 182, 184, 222, 24, 146, 180, 180, 180, 167,
2315 168, 148, 148, 148, 148, 148, 152, 189, 191, 191,
2316 156, 191, 24, 148, 148, 148, 148, 148, 180, 152,
2317 154, 205, 206, 146, 149, 37, 63, 218, 191, 146,
2318 146, 221, 221, 221, 15, 57, 15, 146, 234, 221,
2319 150, 222, 184, 222, 222, 222, 146, 146, 146, 184,
2320 222, 221, 221, 146, 34, 57, 178, 181, 148, 148,
2321 189, 189, 189, 189, 189, 146, 152, 154, 156, 189,
2322 189, 189, 189, 189, 37, 207, 178, 179, 24, 154,
2323 21, 21, 148, 146, 146, 221, 4, 221, 222, 230,
2324 146, 221, 146, 146, 146, 221, 221, 221, 148, 184,
2325 24, 4, 180, 189, 189, 234, 146, 146, 146, 146,
2326 189, 146, 146, 146, 36, 146, 57, 176, 146, 221,
2327 221, 230, 231, 221, 221, 146, 177, 177, 146, 221,
2328 146, 222, 222, 222, 231, 221, 146, 146, 149, 189,
2329 189, 189, 189, 189, 189, 189, 184, 189, 4, 24,
2330 146, 150, 149, 222, 152, 221, 149, 189, 189, 146,
2331 149, 146, 146, 149, 149, 149, 149, 149, 21, 152,
2332 171, 227, 36, 152, 149, 149, 189, 189, 189, 221,
2333 219, 152, 171, 21, 149, 149, 149, 146, 219, 221,
2334 21, 146, 76, 221, 21, 21, 221, 221
2337 #define yyerrok (yyerrstatus = 0)
2338 #define yyclearin (yychar = YYEMPTY)
2339 #define YYEMPTY (-2)
2342 #define YYACCEPT goto yyacceptlab
2343 #define YYABORT goto yyabortlab
2344 #define YYERROR goto yyerrorlab
2347 /* Like YYERROR except do call yyerror. This remains here temporarily
2348 to ease the transition to the new meaning of YYERROR, for GCC.
2349 Once GCC version 2 has supplanted version 1, this can go. */
2351 #define YYFAIL goto yyerrlab
2353 #define YYRECOVERING() (!!yyerrstatus)
2355 #define YYBACKUP(Token, Value) \
2357 if (yychar == YYEMPTY && yylen == 1) \
2361 yytoken = YYTRANSLATE (yychar); \
2367 yyerror (YY_("syntax error: cannot back up")); \
2374 #define YYERRCODE 256
2377 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2378 If N is 0, then set CURRENT to the empty location which ends
2379 the previous symbol: RHS[0] (always defined). */
2381 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2382 #ifndef YYLLOC_DEFAULT
2383 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2387 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2388 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2389 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2390 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2394 (Current).first_line = (Current).last_line = \
2395 YYRHSLOC (Rhs, 0).last_line; \
2396 (Current).first_column = (Current).last_column = \
2397 YYRHSLOC (Rhs, 0).last_column; \
2403 /* YY_LOCATION_PRINT -- Print the location on the stream.
2404 This macro was not mandated originally: define only if we know
2405 we won't break user code: when these are the locations we know. */
2407 #ifndef YY_LOCATION_PRINT
2408 # if YYLTYPE_IS_TRIVIAL
2409 # define YY_LOCATION_PRINT(File, Loc) \
2410 fprintf (File, "%d.%d-%d.%d", \
2411 (Loc).first_line, (Loc).first_column, \
2412 (Loc).last_line, (Loc).last_column)
2414 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2419 /* YYLEX -- calling `yylex' with the right arguments. */
2422 # define YYLEX yylex (YYLEX_PARAM)
2424 # define YYLEX yylex ()
2427 /* Enable debugging if requested. */
2431 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2432 # define YYFPRINTF fprintf
2435 # define YYDPRINTF(Args) \
2441 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2445 YYFPRINTF (stderr, "%s ", Title); \
2446 yysymprint (stderr, \
2448 YYFPRINTF (stderr, "\n"); \
2452 /*------------------------------------------------------------------.
2453 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2455 `------------------------------------------------------------------*/
2457 #if defined (__STDC__) || defined (__cplusplus)
2459 yy_stack_print (short int *bottom, short int *top)
2462 yy_stack_print (bottom, top)
2467 YYFPRINTF (stderr, "Stack now");
2468 for (/* Nothing. */; bottom <= top; ++bottom)
2469 YYFPRINTF (stderr, " %d", *bottom);
2470 YYFPRINTF (stderr, "\n");
2473 # define YY_STACK_PRINT(Bottom, Top) \
2476 yy_stack_print ((Bottom), (Top)); \
2480 /*------------------------------------------------.
2481 | Report that the YYRULE is going to be reduced. |
2482 `------------------------------------------------*/
2484 #if defined (__STDC__) || defined (__cplusplus)
2486 yy_reduce_print (int yyrule)
2489 yy_reduce_print (yyrule)
2494 unsigned long int yylno = yyrline[yyrule];
2495 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2497 /* Print the symbols being reduced, and their result. */
2498 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2499 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2500 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2503 # define YY_REDUCE_PRINT(Rule) \
2506 yy_reduce_print (Rule); \
2509 /* Nonzero means print parse trace. It is left uninitialized so that
2510 multiple parsers can coexist. */
2512 #else /* !YYDEBUG */
2513 # define YYDPRINTF(Args)
2514 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2515 # define YY_STACK_PRINT(Bottom, Top)
2516 # define YY_REDUCE_PRINT(Rule)
2517 #endif /* !YYDEBUG */
2520 /* YYINITDEPTH -- initial size of the parser's stacks. */
2522 # define YYINITDEPTH 200
2525 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2526 if the built-in stack extension method is used).
2528 Do not make this value too large; the results are undefined if
2529 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2530 evaluated with infinite-precision integer arithmetic. */
2533 # define YYMAXDEPTH 10000
2541 # if defined (__GLIBC__) && defined (_STRING_H)
2542 # define yystrlen strlen
2544 /* Return the length of YYSTR. */
2546 # if defined (__STDC__) || defined (__cplusplus)
2547 yystrlen (const char *yystr)
2553 const char *yys = yystr;
2555 while (*yys++ != '\0')
2558 return yys - yystr - 1;
2564 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2565 # define yystpcpy stpcpy
2567 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2570 # if defined (__STDC__) || defined (__cplusplus)
2571 yystpcpy (char *yydest, const char *yysrc)
2573 yystpcpy (yydest, yysrc)
2579 const char *yys = yysrc;
2581 while ((*yyd++ = *yys++) != '\0')
2590 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2591 quotes and backslashes, so that it's suitable for yyerror. The
2592 heuristic is that double-quoting is unnecessary unless the string
2593 contains an apostrophe, a comma, or backslash (other than
2594 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2595 null, do not copy; instead, return the length of what the result
2598 yytnamerr (char *yyres, const char *yystr)
2603 char const *yyp = yystr;
2610 goto do_not_strip_quotes;
2614 goto do_not_strip_quotes;
2627 do_not_strip_quotes: ;
2631 return yystrlen (yystr);
2633 return yystpcpy (yyres, yystr) - yyres;
2637 #endif /* YYERROR_VERBOSE */
2642 /*--------------------------------.
2643 | Print this symbol on YYOUTPUT. |
2644 `--------------------------------*/
2646 #if defined (__STDC__) || defined (__cplusplus)
2648 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2651 yysymprint (yyoutput, yytype, yyvaluep)
2657 /* Pacify ``unused variable'' warnings. */
2660 if (yytype < YYNTOKENS)
2661 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2663 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2667 if (yytype < YYNTOKENS)
2668 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2675 YYFPRINTF (yyoutput, ")");
2678 #endif /* ! YYDEBUG */
2679 /*-----------------------------------------------.
2680 | Release the memory associated to this symbol. |
2681 `-----------------------------------------------*/
2683 #if defined (__STDC__) || defined (__cplusplus)
2685 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2688 yydestruct (yymsg, yytype, yyvaluep)
2694 /* Pacify ``unused variable'' warnings. */
2699 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2710 /* Prevent warnings from -Wmissing-prototypes. */
2712 #ifdef YYPARSE_PARAM
2713 # if defined (__STDC__) || defined (__cplusplus)
2714 int yyparse (void *YYPARSE_PARAM);
2718 #else /* ! YYPARSE_PARAM */
2719 #if defined (__STDC__) || defined (__cplusplus)
2724 #endif /* ! YYPARSE_PARAM */
2728 /* The look-ahead symbol. */
2731 /* The semantic value of the look-ahead symbol. */
2734 /* Number of syntax errors so far. */
2743 #ifdef YYPARSE_PARAM
2744 # if defined (__STDC__) || defined (__cplusplus)
2745 int yyparse (void *YYPARSE_PARAM)
2747 int yyparse (YYPARSE_PARAM)
2748 void *YYPARSE_PARAM;
2750 #else /* ! YYPARSE_PARAM */
2751 #if defined (__STDC__) || defined (__cplusplus)
2765 /* Number of tokens to shift before error messages enabled. */
2767 /* Look-ahead token as an internal (translated) token number. */
2770 /* Three stacks and their tools:
2771 `yyss': related to states,
2772 `yyvs': related to semantic values,
2773 `yyls': related to locations.
2775 Refer to the stacks thru separate pointers, to allow yyoverflow
2776 to reallocate them elsewhere. */
2778 /* The state stack. */
2779 short int yyssa[YYINITDEPTH];
2780 short int *yyss = yyssa;
2783 /* The semantic value stack. */
2784 YYSTYPE yyvsa[YYINITDEPTH];
2785 YYSTYPE *yyvs = yyvsa;
2790 #define YYPOPSTACK (yyvsp--, yyssp--)
2792 YYSIZE_T yystacksize = YYINITDEPTH;
2794 /* The variables used to return semantic value and location from the
2799 /* When reducing, the number of symbols on the RHS of the reduced
2803 YYDPRINTF ((stderr, "Starting parse\n"));
2808 yychar = YYEMPTY; /* Cause a token to be read. */
2810 /* Initialize stack pointers.
2811 Waste one element of value and location stack
2812 so that they stay on the same level as the state stack.
2813 The wasted elements are never initialized. */
2820 /*------------------------------------------------------------.
2821 | yynewstate -- Push a new state, which is found in yystate. |
2822 `------------------------------------------------------------*/
2824 /* In all cases, when you get here, the value and location stacks
2825 have just been pushed. so pushing a state here evens the stacks.
2832 if (yyss + yystacksize - 1 <= yyssp)
2834 /* Get the current used size of the three stacks, in elements. */
2835 YYSIZE_T yysize = yyssp - yyss + 1;
2839 /* Give user a chance to reallocate the stack. Use copies of
2840 these so that the &'s don't force the real ones into
2842 YYSTYPE *yyvs1 = yyvs;
2843 short int *yyss1 = yyss;
2846 /* Each stack pointer address is followed by the size of the
2847 data in use in that stack, in bytes. This used to be a
2848 conditional around just the two extra args, but that might
2849 be undefined if yyoverflow is a macro. */
2850 yyoverflow (YY_("memory exhausted"),
2851 &yyss1, yysize * sizeof (*yyssp),
2852 &yyvs1, yysize * sizeof (*yyvsp),
2859 #else /* no yyoverflow */
2860 # ifndef YYSTACK_RELOCATE
2861 goto yyexhaustedlab;
2863 /* Extend the stack our own way. */
2864 if (YYMAXDEPTH <= yystacksize)
2865 goto yyexhaustedlab;
2867 if (YYMAXDEPTH < yystacksize)
2868 yystacksize = YYMAXDEPTH;
2871 short int *yyss1 = yyss;
2872 union yyalloc *yyptr =
2873 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2875 goto yyexhaustedlab;
2876 YYSTACK_RELOCATE (yyss);
2877 YYSTACK_RELOCATE (yyvs);
2879 # undef YYSTACK_RELOCATE
2881 YYSTACK_FREE (yyss1);
2884 #endif /* no yyoverflow */
2886 yyssp = yyss + yysize - 1;
2887 yyvsp = yyvs + yysize - 1;
2890 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2891 (unsigned long int) yystacksize));
2893 if (yyss + yystacksize - 1 <= yyssp)
2897 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2906 /* Do appropriate processing given the current state. */
2907 /* Read a look-ahead token if we need one and don't already have one. */
2910 /* First try to decide what to do without reference to look-ahead token. */
2912 yyn = yypact[yystate];
2913 if (yyn == YYPACT_NINF)
2916 /* Not known => get a look-ahead token if don't already have one. */
2918 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2919 if (yychar == YYEMPTY)
2921 YYDPRINTF ((stderr, "Reading a token: "));
2925 if (yychar <= YYEOF)
2927 yychar = yytoken = YYEOF;
2928 YYDPRINTF ((stderr, "Now at end of input.\n"));
2932 yytoken = YYTRANSLATE (yychar);
2933 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2936 /* If the proper action on seeing token YYTOKEN is to reduce or to
2937 detect an error, take that action. */
2939 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2944 if (yyn == 0 || yyn == YYTABLE_NINF)
2953 /* Shift the look-ahead token. */
2954 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2956 /* Discard the token being shifted unless it is eof. */
2957 if (yychar != YYEOF)
2963 /* Count tokens shifted since error; after three, turn off error
2972 /*-----------------------------------------------------------.
2973 | yydefault -- do the default action for the current state. |
2974 `-----------------------------------------------------------*/
2976 yyn = yydefact[yystate];
2982 /*-----------------------------.
2983 | yyreduce -- Do a reduction. |
2984 `-----------------------------*/
2986 /* yyn is the number of a rule to reduce with. */
2989 /* If YYLEN is nonzero, implement the default value of the action:
2992 Otherwise, the following line sets YYVAL to garbage.
2993 This behavior is undocumented and Bison
2994 users should not rely upon it. Assigning to YYVAL
2995 unconditionally makes the parser a bit smaller, and it avoids a
2996 GCC warning that YYVAL may be used uninitialized. */
2997 yyval = yyvsp[1-yylen];
3000 YY_REDUCE_PRINT (yyn);
3004 #line 991 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3006 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3007 GEN_ERROR("Value too large for type!");
3008 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3014 #line 1000 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3016 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
3017 GEN_ERROR("Value too large for type!");
3018 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3024 #line 1017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3025 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3029 #line 1017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3030 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3034 #line 1018 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3035 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3039 #line 1018 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3040 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3044 #line 1019 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3045 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3049 #line 1019 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3050 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3054 #line 1020 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3055 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3059 #line 1020 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3060 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3064 #line 1021 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3065 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3069 #line 1021 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3070 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3074 #line 1025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3075 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3079 #line 1025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3080 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3084 #line 1026 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3085 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3089 #line 1026 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3090 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3094 #line 1027 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3095 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3099 #line 1027 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3100 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3104 #line 1028 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3105 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3109 #line 1028 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3110 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3114 #line 1029 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3115 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3119 #line 1029 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3120 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3124 #line 1030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3125 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3129 #line 1030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3130 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3134 #line 1031 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3135 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3139 #line 1031 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3140 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3144 #line 1032 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3145 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3149 #line 1033 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3150 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3154 #line 1044 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3156 (yyval.StrVal) = (yyvsp[-1].StrVal);
3162 #line 1048 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3170 #line 1053 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3171 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3175 #line 1054 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3176 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3180 #line 1055 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3181 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3185 #line 1056 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3186 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3190 #line 1057 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3191 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3195 #line 1058 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3196 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3200 #line 1059 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3205 #line 1060 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3210 #line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.UIntVal) = CallingConv::C; ;}
3215 #line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.UIntVal) = CallingConv::C; ;}
3220 #line 1064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3225 #line 1065 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.UIntVal) = CallingConv::Fast; ;}
3230 #line 1066 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.UIntVal) = CallingConv::Cold; ;}
3235 #line 1067 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3240 #line 1068 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3245 #line 1069 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3247 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3248 GEN_ERROR("Calling conv too large!");
3249 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3255 #line 1078 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.UIntVal) = 0; ;}
3260 #line 1079 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3262 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3263 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3264 GEN_ERROR("Alignment must be a power of two!");
3270 #line 1085 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.UIntVal) = 0; ;}
3275 #line 1086 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3277 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3278 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3279 GEN_ERROR("Alignment must be a power of two!");
3285 #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3287 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3288 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3289 GEN_ERROR("Invalid character in section name!");
3290 (yyval.StrVal) = (yyvsp[0].StrVal);
3296 #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3297 { (yyval.StrVal) = 0; ;}
3301 #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3302 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3306 #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3311 #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3316 #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3318 CurGV->setSection((yyvsp[0].StrVal));
3319 free((yyvsp[0].StrVal));
3325 #line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3327 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3328 GEN_ERROR("Alignment must be a power of two!");
3329 CurGV->setAlignment((yyvsp[0].UInt64Val));
3335 #line 1129 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3336 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3340 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3341 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3345 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3347 if (!UpRefs.empty())
3348 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3349 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3355 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3357 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3363 #line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3365 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3371 #line 1152 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3372 { // Named types are also simple types...
3373 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3375 (yyval.TypeVal) = new PATypeHolder(tmp);
3380 #line 1160 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3381 { // Type UpReference
3382 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3383 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3384 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3385 (yyval.TypeVal) = new PATypeHolder(OT);
3386 UR_OUT("New Upreference!\n");
3392 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3393 { // Function derived type?
3394 std::vector<const Type*> Params;
3395 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3396 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3397 Params.push_back(*I);
3398 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3399 if (isVarArg) Params.pop_back();
3401 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3402 delete (yyvsp[-1].TypeList); // Delete the argument list
3403 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3409 #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3410 { // Sized array type?
3411 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3412 delete (yyvsp[-1].TypeVal);
3418 #line 1186 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3419 { // Packed array type?
3420 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3421 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3422 GEN_ERROR("Unsigned result not equal to signed result");
3423 if (!ElemTy->isPrimitiveType())
3424 GEN_ERROR("Elemental type of a PackedType must be primitive");
3425 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3426 GEN_ERROR("Vector length should be a power of 2!");
3427 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3428 delete (yyvsp[-1].TypeVal);
3434 #line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3435 { // Structure type?
3436 std::vector<const Type*> Elements;
3437 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3438 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3439 Elements.push_back(*I);
3441 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3442 delete (yyvsp[-1].TypeList);
3448 #line 1208 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3449 { // Empty structure type?
3450 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3456 #line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3458 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3459 GEN_ERROR("Cannot form a pointer to a basic block");
3460 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3461 delete (yyvsp[-1].TypeVal);
3467 #line 1223 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3469 (yyval.TypeList) = new std::list<PATypeHolder>();
3470 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3476 #line 1228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3478 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3484 #line 1235 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3486 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3492 #line 1239 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3494 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3500 #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3502 (yyval.TypeList) = new std::list<PATypeHolder>();
3508 #line 1254 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3509 { // Nonempty unsized arr
3510 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3512 GEN_ERROR("Cannot make array constant with type: '" +
3513 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3514 const Type *ETy = ATy->getElementType();
3515 int NumElements = ATy->getNumElements();
3517 // Verify that we have the correct size...
3518 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3519 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3520 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3521 itostr(NumElements) + "!");
3523 // Verify all elements are correct type!
3524 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3525 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3526 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3527 ETy->getDescription() +"' as required!\nIt is of type '"+
3528 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3531 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3532 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3538 #line 1280 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3540 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3542 GEN_ERROR("Cannot make array constant with type: '" +
3543 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3545 int NumElements = ATy->getNumElements();
3546 if (NumElements != -1 && NumElements != 0)
3547 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3548 " arguments, but has size of " + itostr(NumElements) +"!");
3549 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3550 delete (yyvsp[-2].TypeVal);
3556 #line 1294 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3558 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3560 GEN_ERROR("Cannot make array constant with type: '" +
3561 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3563 int NumElements = ATy->getNumElements();
3564 const Type *ETy = ATy->getElementType();
3565 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3566 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3567 GEN_ERROR("Can't build string constant of size " +
3568 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3569 " when array has size " + itostr(NumElements) + "!");
3570 std::vector<Constant*> Vals;
3571 if (ETy == Type::SByteTy) {
3572 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3573 Vals.push_back(ConstantInt::get(ETy, *C));
3574 } else if (ETy == Type::UByteTy) {
3575 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3576 C != (unsigned char*)EndStr; ++C)
3577 Vals.push_back(ConstantInt::get(ETy, *C));
3579 free((yyvsp[0].StrVal));
3580 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3582 free((yyvsp[0].StrVal));
3583 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3584 delete (yyvsp[-2].TypeVal);
3590 #line 1324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3591 { // Nonempty unsized arr
3592 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3594 GEN_ERROR("Cannot make packed constant with type: '" +
3595 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3596 const Type *ETy = PTy->getElementType();
3597 int NumElements = PTy->getNumElements();
3599 // Verify that we have the correct size...
3600 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3601 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3602 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3603 itostr(NumElements) + "!");
3605 // Verify all elements are correct type!
3606 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3607 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3608 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3609 ETy->getDescription() +"' as required!\nIt is of type '"+
3610 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3613 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3614 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3620 #line 1350 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3622 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3624 GEN_ERROR("Cannot make struct constant with type: '" +
3625 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3627 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3628 GEN_ERROR("Illegal number of initializers for structure type!");
3630 // Check to ensure that constants are compatible with the type initializer!
3631 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3632 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3633 GEN_ERROR("Expected type '" +
3634 STy->getElementType(i)->getDescription() +
3635 "' for element #" + utostr(i) +
3636 " of structure initializer!");
3638 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3639 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3645 #line 1371 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3647 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3649 GEN_ERROR("Cannot make struct constant with type: '" +
3650 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3652 if (STy->getNumContainedTypes() != 0)
3653 GEN_ERROR("Illegal number of initializers for structure type!");
3655 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3656 delete (yyvsp[-2].TypeVal);
3662 #line 1384 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3664 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3666 GEN_ERROR("Cannot make null pointer constant with type: '" +
3667 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3669 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3670 delete (yyvsp[-1].TypeVal);
3676 #line 1394 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3678 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3679 delete (yyvsp[-1].TypeVal);
3685 #line 1399 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3687 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3689 GEN_ERROR("Global const reference must be a pointer type!");
3691 // ConstExprs can exist in the body of a function, thus creating
3692 // GlobalValues whenever they refer to a variable. Because we are in
3693 // the context of a function, getValNonImprovising will search the functions
3694 // symbol table instead of the module symbol table for the global symbol,
3695 // which throws things all off. To get around this, we just tell
3696 // getValNonImprovising that we are at global scope here.
3698 Function *SavedCurFn = CurFun.CurrentFunction;
3699 CurFun.CurrentFunction = 0;
3701 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3704 CurFun.CurrentFunction = SavedCurFn;
3706 // If this is an initializer for a constant pointer, which is referencing a
3707 // (currently) undefined variable, create a stub now that shall be replaced
3708 // in the future with the right type of variable.
3711 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3712 const PointerType *PT = cast<PointerType>(Ty);
3714 // First check to see if the forward references value is already created!
3715 PerModuleInfo::GlobalRefsType::iterator I =
3716 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3718 if (I != CurModule.GlobalRefs.end()) {
3719 V = I->second; // Placeholder already exists, use it...
3720 (yyvsp[0].ValIDVal).destroy();
3723 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3725 // Create the forward referenced global.
3727 if (const FunctionType *FTy =
3728 dyn_cast<FunctionType>(PT->getElementType())) {
3729 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3730 CurModule.CurrentModule);
3732 GV = new GlobalVariable(PT->getElementType(), false,
3733 GlobalValue::ExternalLinkage, 0,
3734 Name, CurModule.CurrentModule);
3737 // Keep track of the fact that we have a forward ref to recycle it
3738 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3743 (yyval.ConstVal) = cast<GlobalValue>(V);
3744 delete (yyvsp[-1].TypeVal); // Free the type handle
3750 #line 1460 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3752 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3753 GEN_ERROR("Mismatched types for constant expression!");
3754 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3755 delete (yyvsp[-1].TypeVal);
3761 #line 1467 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3763 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3764 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3765 GEN_ERROR("Cannot create a null initialized value of this type!");
3766 (yyval.ConstVal) = Constant::getNullValue(Ty);
3767 delete (yyvsp[-1].TypeVal);
3773 #line 1475 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3774 { // integral constants
3775 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3776 GEN_ERROR("Constant value doesn't fit in type!");
3777 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3783 #line 1481 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3784 { // integral constants
3785 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3786 GEN_ERROR("Constant value doesn't fit in type!");
3787 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3793 #line 1487 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3794 { // Boolean constants
3795 (yyval.ConstVal) = ConstantBool::getTrue();
3801 #line 1491 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3802 { // Boolean constants
3803 (yyval.ConstVal) = ConstantBool::getFalse();
3809 #line 1495 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3810 { // Float & Double constants
3811 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3812 GEN_ERROR("Floating point constant invalid for type!!");
3813 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3819 #line 1503 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3821 Constant *Val = (yyvsp[-3].ConstVal);
3822 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3823 if (!Val->getType()->isFirstClassType())
3824 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3825 Val->getType()->getDescription() + "'!");
3826 if (!Ty->isFirstClassType())
3827 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3828 Ty->getDescription() + "'!");
3829 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3830 delete (yyvsp[-1].TypeVal);
3835 #line 1515 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3837 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3838 GEN_ERROR("GetElementPtr requires a pointer operand!");
3841 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3843 GEN_ERROR("Index list invalid for constant getelementptr!");
3845 std::vector<Constant*> IdxVec;
3846 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3847 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3848 IdxVec.push_back(C);
3850 GEN_ERROR("Indices to constant getelementptr must be constants!");
3852 delete (yyvsp[-1].ValueList);
3854 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3860 #line 1536 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3862 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3863 GEN_ERROR("Select condition must be of boolean type!");
3864 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3865 GEN_ERROR("Select operand types must match!");
3866 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3872 #line 1544 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3874 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3875 GEN_ERROR("Binary operator types must match!");
3877 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3882 #line 1550 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3884 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3885 GEN_ERROR("Logical operator types must match!");
3886 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
3887 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
3888 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
3889 GEN_ERROR("Logical operator requires integral operands!");
3891 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3897 #line 1561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3899 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3900 GEN_ERROR("setcc operand types must match!");
3901 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3907 #line 1567 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3909 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3910 GEN_ERROR("icmp operand types must match!");
3911 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3916 #line 1572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3918 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3919 GEN_ERROR("fcmp operand types must match!");
3920 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3925 #line 1577 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3927 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
3928 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3929 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
3930 GEN_ERROR("Shift constant expression requires integer operand!");
3932 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3938 #line 1586 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3940 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3941 GEN_ERROR("Invalid extractelement operands!");
3942 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3948 #line 1592 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3950 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3951 GEN_ERROR("Invalid insertelement operands!");
3952 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3958 #line 1598 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3960 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3961 GEN_ERROR("Invalid shufflevector operands!");
3962 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3968 #line 1607 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3970 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
3976 #line 1611 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3978 (yyval.ConstVector) = new std::vector<Constant*>();
3979 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
3985 #line 1619 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3986 { (yyval.BoolVal) = false; ;}
3990 #line 1619 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3991 { (yyval.BoolVal) = true; ;}
3995 #line 1629 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3997 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
3998 CurModule.ModuleDone();
4004 #line 1637 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4006 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4007 CurFun.FunctionDone();
4013 #line 1642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4015 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4021 #line 1646 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4023 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4029 #line 1650 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4031 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4037 #line 1654 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4039 (yyval.ModuleVal) = CurModule.CurrentModule;
4040 // Emit an error if there are any unresolved types left.
4041 if (!CurModule.LateResolveTypes.empty()) {
4042 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4043 if (DID.Type == ValID::NameVal) {
4044 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4046 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4054 #line 1669 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4056 // Eagerly resolve types. This is not an optimization, this is a
4057 // requirement that is due to the fact that we could have this:
4059 // %list = type { %list * }
4060 // %list = type { %list * } ; repeated type decl
4062 // If types are not resolved eagerly, then the two types will not be
4063 // determined to be the same type!
4065 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4067 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4069 // If this is a named type that is not a redefinition, add it to the slot
4071 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4074 delete (yyvsp[0].TypeVal);
4080 #line 1691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4081 { // Function prototypes can be in const pool
4087 #line 1694 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4088 { // Asm blocks can be in the const pool
4094 #line 1697 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4096 if ((yyvsp[0].ConstVal) == 0)
4097 GEN_ERROR("Global value initializer is not a constant!");
4098 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4104 #line 1702 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4111 #line 1705 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4113 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4115 delete (yyvsp[0].TypeVal);
4120 #line 1709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4128 #line 1713 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4130 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4132 delete (yyvsp[0].TypeVal);
4137 #line 1717 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4145 #line 1721 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4148 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4150 delete (yyvsp[0].TypeVal);
4155 #line 1726 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4163 #line 1730 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4170 #line 1733 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4177 #line 1736 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4183 #line 1740 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4185 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4186 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4187 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4188 free((yyvsp[0].StrVal));
4190 if (AsmSoFar.empty())
4191 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4193 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4199 #line 1753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4200 { (yyval.Endianness) = Module::BigEndian; ;}
4204 #line 1754 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4205 { (yyval.Endianness) = Module::LittleEndian; ;}
4209 #line 1756 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4211 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4217 #line 1760 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4219 if ((yyvsp[0].UInt64Val) == 32)
4220 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4221 else if ((yyvsp[0].UInt64Val) == 64)
4222 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4224 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4230 #line 1769 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4232 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4233 free((yyvsp[0].StrVal));
4238 #line 1773 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4240 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4241 free((yyvsp[0].StrVal));
4246 #line 1780 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4248 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4249 free((yyvsp[0].StrVal));
4255 #line 1785 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4257 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4258 free((yyvsp[0].StrVal));
4264 #line 1790 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4271 #line 1800 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4272 { (yyval.StrVal) = 0; ;}
4276 #line 1802 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4278 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4279 GEN_ERROR("void typed arguments are invalid!");
4280 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4286 #line 1809 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4288 (yyval.ArgList) = (yyvsp[-2].ArgList);
4289 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4290 delete (yyvsp[0].ArgVal);
4296 #line 1815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4298 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4299 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4300 delete (yyvsp[0].ArgVal);
4306 #line 1822 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4308 (yyval.ArgList) = (yyvsp[0].ArgList);
4314 #line 1826 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4316 (yyval.ArgList) = (yyvsp[-2].ArgList);
4317 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4318 char*>(new PATypeHolder(Type::VoidTy), 0));
4324 #line 1832 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4326 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4327 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4333 #line 1837 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4335 (yyval.ArgList) = 0;
4341 #line 1843 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4343 UnEscapeLexed((yyvsp[-5].StrVal));
4344 std::string FunctionName((yyvsp[-5].StrVal));
4345 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4347 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4348 GEN_ERROR("LLVM functions cannot return aggregate types!");
4350 std::vector<const Type*> ParamTypeList;
4351 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4352 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4353 I != (yyvsp[-3].ArgList)->end(); ++I)
4354 ParamTypeList.push_back(I->first->get());
4357 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4358 if (isVarArg) ParamTypeList.pop_back();
4360 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4361 const PointerType *PFT = PointerType::get(FT);
4362 delete (yyvsp[-6].TypeVal);
4365 if (!FunctionName.empty()) {
4366 ID = ValID::create((char*)FunctionName.c_str());
4368 ID = ValID::create((int)CurModule.Values[PFT].size());
4372 // See if this function was forward referenced. If so, recycle the object.
4373 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4374 // Move the function to the end of the list, from whereever it was
4375 // previously inserted.
4376 Fn = cast<Function>(FWRef);
4377 CurModule.CurrentModule->getFunctionList().remove(Fn);
4378 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4379 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4380 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4381 // If this is the case, either we need to be a forward decl, or it needs
4383 if (!CurFun.isDeclare && !Fn->isExternal())
4384 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4386 // Make sure to strip off any argument names so we can't get conflicts.
4387 if (Fn->isExternal())
4388 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4391 } else { // Not already defined?
4392 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4393 CurModule.CurrentModule);
4395 InsertValue(Fn, CurModule.Values);
4398 CurFun.FunctionStart(Fn);
4400 if (CurFun.isDeclare) {
4401 // If we have declaration, always overwrite linkage. This will allow us to
4402 // correctly handle cases, when pointer to function is passed as argument to
4403 // another function.
4404 Fn->setLinkage(CurFun.Linkage);
4406 Fn->setCallingConv((yyvsp[-7].UIntVal));
4407 Fn->setAlignment((yyvsp[0].UIntVal));
4408 if ((yyvsp[-1].StrVal)) {
4409 Fn->setSection((yyvsp[-1].StrVal));
4410 free((yyvsp[-1].StrVal));
4413 // Add all of the arguments we parsed to the function...
4414 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4415 if (isVarArg) { // Nuke the last entry
4416 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4417 "Not a varargs marker!");
4418 delete (yyvsp[-3].ArgList)->back().first;
4419 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4421 Function::arg_iterator ArgIt = Fn->arg_begin();
4422 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4423 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4424 delete I->first; // Delete the typeholder...
4426 setValueName(ArgIt, I->second); // Insert arg into symtab...
4431 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4438 #line 1939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4440 (yyval.FunctionVal) = CurFun.CurrentFunction;
4442 // Make sure that we keep track of the linkage type even if there was a
4443 // previous "declare".
4444 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4449 #line 1949 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4451 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4457 #line 1955 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4458 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4462 #line 1956 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4463 { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4467 #line 1958 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4468 { CurFun.isDeclare = true; ;}
4472 #line 1958 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4474 (yyval.FunctionVal) = CurFun.CurrentFunction;
4475 CurFun.FunctionDone();
4481 #line 1968 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4483 (yyval.BoolVal) = false;
4489 #line 1972 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4491 (yyval.BoolVal) = true;
4497 #line 1977 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4498 { // A reference to a direct constant
4499 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4505 #line 1981 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4507 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4513 #line 1985 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4514 { // Perhaps it's an FP constant?
4515 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4521 #line 1989 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4523 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4529 #line 1993 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4531 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4537 #line 1997 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4539 (yyval.ValIDVal) = ValID::createNull();
4545 #line 2001 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4547 (yyval.ValIDVal) = ValID::createUndef();
4553 #line 2005 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4554 { // A vector zero constant.
4555 (yyval.ValIDVal) = ValID::createZeroInit();
4561 #line 2009 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4562 { // Nonempty unsized packed vector
4563 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4564 int NumElements = (yyvsp[-1].ConstVector)->size();
4566 PackedType* pt = PackedType::get(ETy, NumElements);
4567 PATypeHolder* PTy = new PATypeHolder(
4575 // Verify all elements are correct type!
4576 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4577 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4578 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4579 ETy->getDescription() +"' as required!\nIt is of type '" +
4580 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4583 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4584 delete PTy; delete (yyvsp[-1].ConstVector);
4590 #line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4592 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4598 #line 2038 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4600 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4601 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4602 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4603 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4604 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4605 free((yyvsp[-2].StrVal));
4606 free((yyvsp[0].StrVal));
4612 #line 2052 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4613 { // Is it an integer reference...?
4614 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4620 #line 2056 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4621 { // Is it a named reference...?
4622 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4628 #line 2068 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4630 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4636 #line 2073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4638 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4644 #line 2077 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4645 { // Do not allow functions with 0 basic blocks
4646 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4652 #line 2086 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4654 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4656 InsertValue((yyvsp[0].TermInstVal));
4658 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4659 InsertValue((yyvsp[-2].BasicBlockVal));
4660 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4666 #line 2097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4668 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4669 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4670 if (CI2->getParent() == 0)
4671 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4672 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4673 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4679 #line 2106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4681 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4684 // Make sure to move the basic block to the correct location in the
4685 // function, instead of leaving it inserted wherever it was first
4687 Function::BasicBlockListType &BBL =
4688 CurFun.CurrentFunction->getBasicBlockList();
4689 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4695 #line 2118 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4697 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4700 // Make sure to move the basic block to the correct location in the
4701 // function, instead of leaving it inserted wherever it was first
4703 Function::BasicBlockListType &BBL =
4704 CurFun.CurrentFunction->getBasicBlockList();
4705 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4711 #line 2131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4712 { // Return with a result...
4713 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4719 #line 2135 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4720 { // Return with no result...
4721 (yyval.TermInstVal) = new ReturnInst();
4727 #line 2139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4728 { // Unconditional Branch...
4729 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4731 (yyval.TermInstVal) = new BranchInst(tmpBB);
4736 #line 2144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4738 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4740 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4742 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4744 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4749 #line 2153 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4751 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4753 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4755 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4756 (yyval.TermInstVal) = S;
4758 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4759 E = (yyvsp[-1].JumpTable)->end();
4760 for (; I != E; ++I) {
4761 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4762 S->addCase(CI, I->second);
4764 GEN_ERROR("Switch case is constant, but not a simple integer!");
4766 delete (yyvsp[-1].JumpTable);
4772 #line 2172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4774 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4776 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4778 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4779 (yyval.TermInstVal) = S;
4785 #line 2182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4787 const PointerType *PFTy;
4788 const FunctionType *Ty;
4790 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4791 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4792 // Pull out the types of all of the arguments...
4793 std::vector<const Type*> ParamTypes;
4794 if ((yyvsp[-7].ValueList)) {
4795 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4797 ParamTypes.push_back((*I)->getType());
4800 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4801 if (isVarArg) ParamTypes.pop_back();
4803 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4804 PFTy = PointerType::get(Ty);
4807 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4809 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4811 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4814 // Create the call node...
4815 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4816 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4817 } else { // Has arguments?
4818 // Loop through FunctionType's arguments and ensure they are specified
4821 FunctionType::param_iterator I = Ty->param_begin();
4822 FunctionType::param_iterator E = Ty->param_end();
4823 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4825 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4826 if ((*ArgI)->getType() != *I)
4827 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4828 (*I)->getDescription() + "'!");
4830 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4831 GEN_ERROR("Invalid number of parameters detected!");
4833 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4835 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4837 delete (yyvsp[-10].TypeVal);
4838 delete (yyvsp[-7].ValueList);
4844 #line 2237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4846 (yyval.TermInstVal) = new UnwindInst();
4852 #line 2241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4854 (yyval.TermInstVal) = new UnreachableInst();
4860 #line 2248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4862 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4863 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4866 GEN_ERROR("May only switch on a constant pool value!");
4868 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4870 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4875 #line 2259 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4877 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4878 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4882 GEN_ERROR("May only switch on a constant pool value!");
4884 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4886 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4891 #line 2272 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4893 // Is this definition named?? if so, assign the name...
4894 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4896 InsertValue((yyvsp[0].InstVal));
4897 (yyval.InstVal) = (yyvsp[0].InstVal);
4903 #line 2281 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4904 { // Used for PHI nodes
4905 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4906 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
4908 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4910 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4911 delete (yyvsp[-5].TypeVal);
4916 #line 2290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4918 (yyval.PHIList) = (yyvsp[-6].PHIList);
4919 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
4921 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4923 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4928 #line 2300 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4929 { // Used for call statements, and memory insts...
4930 (yyval.ValueList) = new std::vector<Value*>();
4931 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4936 #line 2304 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4938 (yyval.ValueList) = (yyvsp[-2].ValueList);
4939 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4945 #line 2311 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4946 { (yyval.ValueList) = 0; ;}
4950 #line 2313 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4952 (yyval.BoolVal) = true;
4958 #line 2317 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4960 (yyval.BoolVal) = false;
4966 #line 2322 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4968 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
4969 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
4971 "Arithmetic operator requires integer, FP, or packed operands!");
4972 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
4973 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
4974 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
4975 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
4976 GEN_ERROR("U/S/FRem not supported on packed types!");
4977 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4979 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4981 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
4982 if ((yyval.InstVal) == 0)
4983 GEN_ERROR("binary operator returned null!");
4984 delete (yyvsp[-3].TypeVal);
4989 #line 2341 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4991 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
4992 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
4993 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
4994 GEN_ERROR("Logical operator requires integral operands!");
4996 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4998 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5000 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5001 if ((yyval.InstVal) == 0)
5002 GEN_ERROR("binary operator returned null!");
5003 delete (yyvsp[-3].TypeVal);
5008 #line 2356 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5010 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
5012 "PackedTypes currently not supported in setcc instructions!");
5014 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5016 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5018 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5019 if ((yyval.InstVal) == 0)
5020 GEN_ERROR("binary operator returned null!");
5021 delete (yyvsp[-3].TypeVal);
5026 #line 2370 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5028 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5029 GEN_ERROR("Packed types not supported by icmp instruction");
5030 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5032 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5034 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5035 if ((yyval.InstVal) == 0)
5036 GEN_ERROR("icmp operator returned null!");
5041 #line 2381 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5043 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5044 GEN_ERROR("Packed types not supported by fcmp instruction");
5045 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5047 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5049 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5050 if ((yyval.InstVal) == 0)
5051 GEN_ERROR("fcmp operator returned null!");
5056 #line 2392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5058 llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
5059 << " Replacing with 'xor'.\n";
5061 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5063 GEN_ERROR("Expected integral type for not instruction!");
5065 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5066 if ((yyval.InstVal) == 0)
5067 GEN_ERROR("Could not create a xor instruction!");
5073 #line 2405 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5075 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
5076 GEN_ERROR("Shift amount must be ubyte!");
5077 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5078 GEN_ERROR("Shift constant expression requires integer operand!");
5080 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5086 #line 2414 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5088 Value* Val = (yyvsp[-2].ValueVal);
5089 const Type* Ty = (yyvsp[0].TypeVal)->get();
5090 if (!Val->getType()->isFirstClassType())
5091 GEN_ERROR("cast from a non-primitive type: '" +
5092 Val->getType()->getDescription() + "'!");
5093 if (!Ty->isFirstClassType())
5094 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5095 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
5096 delete (yyvsp[0].TypeVal);
5101 #line 2425 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5103 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5104 GEN_ERROR("select condition must be boolean!");
5105 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5106 GEN_ERROR("select value types should match!");
5107 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5113 #line 2433 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5115 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5116 delete (yyvsp[0].TypeVal);
5122 #line 2438 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5124 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5125 GEN_ERROR("Invalid extractelement operands!");
5126 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5132 #line 2444 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5134 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5135 GEN_ERROR("Invalid insertelement operands!");
5136 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5142 #line 2450 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5144 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5145 GEN_ERROR("Invalid shufflevector operands!");
5146 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5152 #line 2456 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5154 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5155 if (!Ty->isFirstClassType())
5156 GEN_ERROR("PHI node operands must be of first class type!");
5157 (yyval.InstVal) = new PHINode(Ty);
5158 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5159 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5160 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5161 GEN_ERROR("All elements of a PHI node must be of the same type!");
5162 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5163 (yyvsp[0].PHIList)->pop_front();
5165 delete (yyvsp[0].PHIList); // Free the list...
5171 #line 2471 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5173 const PointerType *PFTy = 0;
5174 const FunctionType *Ty = 0;
5176 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5177 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5178 // Pull out the types of all of the arguments...
5179 std::vector<const Type*> ParamTypes;
5180 if ((yyvsp[-1].ValueList)) {
5181 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5183 ParamTypes.push_back((*I)->getType());
5186 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5187 if (isVarArg) ParamTypes.pop_back();
5189 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5190 GEN_ERROR("LLVM functions cannot return aggregate types!");
5192 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5193 PFTy = PointerType::get(Ty);
5196 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5199 // Create the call node...
5200 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5201 // Make sure no arguments is a good thing!
5202 if (Ty->getNumParams() != 0)
5203 GEN_ERROR("No arguments passed to a function that "
5204 "expects arguments!");
5206 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5207 } else { // Has arguments?
5208 // Loop through FunctionType's arguments and ensure they are specified
5211 FunctionType::param_iterator I = Ty->param_begin();
5212 FunctionType::param_iterator E = Ty->param_end();
5213 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5215 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5216 if ((*ArgI)->getType() != *I)
5217 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5218 (*I)->getDescription() + "'!");
5220 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5221 GEN_ERROR("Invalid number of parameters detected!");
5223 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5225 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5226 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5227 delete (yyvsp[-4].TypeVal);
5228 delete (yyvsp[-1].ValueList);
5234 #line 2530 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5236 (yyval.InstVal) = (yyvsp[0].InstVal);
5242 #line 2537 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5244 (yyval.ValueList) = (yyvsp[0].ValueList);
5250 #line 2540 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5252 (yyval.ValueList) = new std::vector<Value*>();
5258 #line 2545 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5260 (yyval.BoolVal) = true;
5266 #line 2549 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5268 (yyval.BoolVal) = false;
5274 #line 2556 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5276 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5277 delete (yyvsp[-1].TypeVal);
5283 #line 2561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5285 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5287 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5288 delete (yyvsp[-4].TypeVal);
5293 #line 2567 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5295 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5296 delete (yyvsp[-1].TypeVal);
5302 #line 2572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5304 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5306 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5307 delete (yyvsp[-4].TypeVal);
5312 #line 2578 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5314 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5315 GEN_ERROR("Trying to free nonpointer type " +
5316 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5317 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5323 #line 2586 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5325 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5326 GEN_ERROR("Can't load from nonpointer type: " +
5327 (*(yyvsp[-1].TypeVal))->getDescription());
5328 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5329 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5330 (*(yyvsp[-1].TypeVal))->getDescription());
5331 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5333 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5334 delete (yyvsp[-1].TypeVal);
5339 #line 2598 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5341 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5343 GEN_ERROR("Can't store to a nonpointer type: " +
5344 (*(yyvsp[-1].TypeVal))->getDescription());
5345 const Type *ElTy = PT->getElementType();
5346 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5347 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5348 "' into space of type '" + ElTy->getDescription() + "'!");
5350 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5352 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5353 delete (yyvsp[-1].TypeVal);
5358 #line 2613 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5360 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5361 GEN_ERROR("getelementptr insn requires pointer operand!");
5363 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5364 GEN_ERROR("Invalid getelementptr indices for type '" +
5365 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5366 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5368 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5369 delete (yyvsp[-2].TypeVal);
5370 delete (yyvsp[0].ValueList);
5378 /* Line 1126 of yacc.c. */
5379 #line 5380 "llvmAsmParser.tab.c"
5385 YY_STACK_PRINT (yyss, yyssp);
5390 /* Now `shift' the result of the reduction. Determine what state
5391 that goes to, based on the state we popped back to and the rule
5392 number reduced by. */
5396 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5397 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5398 yystate = yytable[yystate];
5400 yystate = yydefgoto[yyn - YYNTOKENS];
5405 /*------------------------------------.
5406 | yyerrlab -- here on detecting error |
5407 `------------------------------------*/
5409 /* If not already recovering from an error, report this error. */
5414 yyn = yypact[yystate];
5416 if (YYPACT_NINF < yyn && yyn < YYLAST)
5418 int yytype = YYTRANSLATE (yychar);
5419 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5420 YYSIZE_T yysize = yysize0;
5422 int yysize_overflow = 0;
5424 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5425 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5429 /* This is so xgettext sees the translatable formats that are
5430 constructed on the fly. */
5431 YY_("syntax error, unexpected %s");
5432 YY_("syntax error, unexpected %s, expecting %s");
5433 YY_("syntax error, unexpected %s, expecting %s or %s");
5434 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5435 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5439 static char const yyunexpected[] = "syntax error, unexpected %s";
5440 static char const yyexpecting[] = ", expecting %s";
5441 static char const yyor[] = " or %s";
5442 char yyformat[sizeof yyunexpected
5443 + sizeof yyexpecting - 1
5444 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5445 * (sizeof yyor - 1))];
5446 char const *yyprefix = yyexpecting;
5448 /* Start YYX at -YYN if negative to avoid negative indexes in
5450 int yyxbegin = yyn < 0 ? -yyn : 0;
5452 /* Stay within bounds of both yycheck and yytname. */
5453 int yychecklim = YYLAST - yyn;
5454 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5457 yyarg[0] = yytname[yytype];
5458 yyfmt = yystpcpy (yyformat, yyunexpected);
5460 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5461 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5463 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5467 yyformat[sizeof yyunexpected - 1] = '\0';
5470 yyarg[yycount++] = yytname[yyx];
5471 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5472 yysize_overflow |= yysize1 < yysize;
5474 yyfmt = yystpcpy (yyfmt, yyprefix);
5478 yyf = YY_(yyformat);
5479 yysize1 = yysize + yystrlen (yyf);
5480 yysize_overflow |= yysize1 < yysize;
5483 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5484 yymsg = (char *) YYSTACK_ALLOC (yysize);
5487 /* Avoid sprintf, as that infringes on the user's name space.
5488 Don't have undefined behavior even if the translation
5489 produced a string with the wrong number of "%s"s. */
5492 while ((*yyp = *yyf))
5494 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5496 yyp += yytnamerr (yyp, yyarg[yyi++]);
5506 YYSTACK_FREE (yymsg);
5510 yyerror (YY_("syntax error"));
5511 goto yyexhaustedlab;
5515 #endif /* YYERROR_VERBOSE */
5516 yyerror (YY_("syntax error"));
5521 if (yyerrstatus == 3)
5523 /* If just tried and failed to reuse look-ahead token after an
5524 error, discard it. */
5526 if (yychar <= YYEOF)
5528 /* Return failure if at end of input. */
5529 if (yychar == YYEOF)
5534 yydestruct ("Error: discarding", yytoken, &yylval);
5539 /* Else will try to reuse look-ahead token after shifting the error
5544 /*---------------------------------------------------.
5545 | yyerrorlab -- error raised explicitly by YYERROR. |
5546 `---------------------------------------------------*/
5549 /* Pacify compilers like GCC when the user code never invokes
5550 YYERROR and the label yyerrorlab therefore never appears in user
5561 /*-------------------------------------------------------------.
5562 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5563 `-------------------------------------------------------------*/
5565 yyerrstatus = 3; /* Each real token shifted decrements this. */
5569 yyn = yypact[yystate];
5570 if (yyn != YYPACT_NINF)
5573 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5581 /* Pop the current state because it cannot handle the error token. */
5586 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5589 YY_STACK_PRINT (yyss, yyssp);
5598 /* Shift the error token. */
5599 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5605 /*-------------------------------------.
5606 | yyacceptlab -- YYACCEPT comes here. |
5607 `-------------------------------------*/
5612 /*-----------------------------------.
5613 | yyabortlab -- YYABORT comes here. |
5614 `-----------------------------------*/
5620 /*-------------------------------------------------.
5621 | yyexhaustedlab -- memory exhaustion comes here. |
5622 `-------------------------------------------------*/
5624 yyerror (YY_("memory exhausted"));
5630 if (yychar != YYEOF && yychar != YYEMPTY)
5631 yydestruct ("Cleanup: discarding lookahead",
5633 while (yyssp != yyss)
5635 yydestruct ("Cleanup: popping",
5636 yystos[*yyssp], yyvsp);
5641 YYSTACK_FREE (yyss);
5647 #line 2628 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5650 void llvm::GenerateError(const std::string &message, int LineNo) {
5651 if (LineNo == -1) LineNo = llvmAsmlineno;
5652 // TODO: column number in exception
5654 TheParseError->setError(CurFilename, message, LineNo);
5658 int yyerror(const char *ErrorMsg) {
5660 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5661 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5662 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5663 if (yychar == YYEMPTY || yychar == 0)
5664 errMsg += "end-of-file.";
5666 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5667 GenerateError(errMsg);