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,
200 EXTRACTELEMENT = 391,
206 #define ESINT64VAL 258
207 #define EUINT64VAL 259
227 #define STRINGCONSTANT 279
228 #define IMPLEMENTATION 280
229 #define ZEROINITIALIZER 281
240 #define DOTDOTDOT 292
247 #define APPENDING 299
248 #define DLLIMPORT 300
249 #define DLLEXPORT 301
250 #define EXTERN_WEAK 302
257 #define POINTERSIZE 309
266 #define SIDEEFFECT 318
269 #define CSRETCC_TOK 321
270 #define FASTCC_TOK 322
271 #define COLDCC_TOK 323
272 #define X86_STDCALLCC_TOK 324
273 #define X86_FASTCALLCC_TOK 325
274 #define DATALAYOUT 326
280 #define UNREACHABLE 332
320 #define GETELEMENTPTR 372
339 #define EXTRACTELEMENT 391
340 #define INSERTELEMENT 392
341 #define SHUFFLEVECTOR 393
346 /* Copy the first part of user declarations. */
347 #line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
349 #include "ParserInternals.h"
350 #include "llvm/CallingConv.h"
351 #include "llvm/InlineAsm.h"
352 #include "llvm/Instructions.h"
353 #include "llvm/Module.h"
354 #include "llvm/SymbolTable.h"
355 #include "llvm/Support/GetElementPtrTypeIterator.h"
356 #include "llvm/ADT/STLExtras.h"
357 #include "llvm/Support/MathExtras.h"
358 #include "llvm/Support/Streams.h"
363 // The following is a gross hack. In order to rid the libAsmParser library of
364 // exceptions, we have to have a way of getting the yyparse function to go into
365 // an error situation. So, whenever we want an error to occur, the GenerateError
366 // function (see bottom of file) sets TriggerError. Then, at the end of each
367 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
368 // (a goto) to put YACC in error state. Furthermore, several calls to
369 // GenerateError are made from inside productions and they must simulate the
370 // previous exception behavior by exiting the production immediately. We have
371 // replaced these with the GEN_ERROR macro which calls GeneratError and then
372 // immediately invokes YYERROR. This would be so much cleaner if it was a
373 // recursive descent parser.
374 static bool TriggerError = false;
375 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
376 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
378 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
379 int yylex(); // declaration" of xxx warnings.
383 std::string CurFilename;
385 using namespace llvm;
387 static Module *ParserResult;
389 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
390 // relating to upreferences in the input stream.
392 //#define DEBUG_UPREFS 1
394 #define UR_OUT(X) cerr << X
399 #define YYERROR_VERBOSE 1
401 static GlobalVariable *CurGV;
404 // This contains info used when building the body of a function. It is
405 // destroyed when the function is completed.
407 typedef std::vector<Value *> ValueList; // Numbered defs
409 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
410 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
412 static struct PerModuleInfo {
413 Module *CurrentModule;
414 std::map<const Type *, ValueList> Values; // Module level numbered definitions
415 std::map<const Type *,ValueList> LateResolveValues;
416 std::vector<PATypeHolder> Types;
417 std::map<ValID, PATypeHolder> LateResolveTypes;
419 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
420 /// how they were referenced and on which line of the input they came from so
421 /// that we can resolve them later and print error messages as appropriate.
422 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
424 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
425 // references to global values. Global values may be referenced before they
426 // are defined, and if so, the temporary object that they represent is held
427 // here. This is used for forward references of GlobalValues.
429 typedef std::map<std::pair<const PointerType *,
430 ValID>, GlobalValue*> GlobalRefsType;
431 GlobalRefsType GlobalRefs;
434 // If we could not resolve some functions at function compilation time
435 // (calls to functions before they are defined), resolve them now... Types
436 // are resolved when the constant pool has been completely parsed.
438 ResolveDefinitions(LateResolveValues);
442 // Check to make sure that all global value forward references have been
445 if (!GlobalRefs.empty()) {
446 std::string UndefinedReferences = "Unresolved global references exist:\n";
448 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
450 UndefinedReferences += " " + I->first.first->getDescription() + " " +
451 I->first.second.getName() + "\n";
453 GenerateError(UndefinedReferences);
457 Values.clear(); // Clear out function local definitions
462 // GetForwardRefForGlobal - Check to see if there is a forward reference
463 // for this global. If so, remove it from the GlobalRefs map and return it.
464 // If not, just return null.
465 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
466 // Check to see if there is a forward reference to this global variable...
467 // if there is, eliminate it and patch the reference to use the new def'n.
468 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
469 GlobalValue *Ret = 0;
470 if (I != GlobalRefs.end()) {
478 static struct PerFunctionInfo {
479 Function *CurrentFunction; // Pointer to current function being created
481 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
482 std::map<const Type*, ValueList> LateResolveValues;
483 bool isDeclare; // Is this function a forward declararation?
484 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
486 /// BBForwardRefs - When we see forward references to basic blocks, keep
487 /// track of them here.
488 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
489 std::vector<BasicBlock*> NumberedBlocks;
492 inline PerFunctionInfo() {
495 Linkage = GlobalValue::ExternalLinkage;
498 inline void FunctionStart(Function *M) {
503 void FunctionDone() {
504 NumberedBlocks.clear();
506 // Any forward referenced blocks left?
507 if (!BBForwardRefs.empty()) {
508 GenerateError("Undefined reference to label " +
509 BBForwardRefs.begin()->first->getName());
513 // Resolve all forward references now.
514 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
516 Values.clear(); // Clear out function local definitions
519 Linkage = GlobalValue::ExternalLinkage;
521 } CurFun; // Info for the current function...
523 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
526 //===----------------------------------------------------------------------===//
527 // Code to handle definitions of all the types
528 //===----------------------------------------------------------------------===//
530 static int InsertValue(Value *V,
531 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
532 if (V->hasName()) return -1; // Is this a numbered definition?
534 // Yes, insert the value into the value table...
535 ValueList &List = ValueTab[V->getType()];
537 return List.size()-1;
540 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
542 case ValID::NumberVal: // Is it a numbered definition?
543 // Module constants occupy the lowest numbered slots...
544 if ((unsigned)D.Num < CurModule.Types.size())
545 return CurModule.Types[(unsigned)D.Num];
547 case ValID::NameVal: // Is it a named definition?
548 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
549 D.destroy(); // Free old strdup'd memory...
554 GenerateError("Internal parser error: Invalid symbol type reference!");
558 // If we reached here, we referenced either a symbol that we don't know about
559 // or an id number that hasn't been read yet. We may be referencing something
560 // forward, so just create an entry to be resolved later and get to it...
562 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
565 if (inFunctionScope()) {
566 if (D.Type == ValID::NameVal) {
567 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
570 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
575 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
576 if (I != CurModule.LateResolveTypes.end())
579 Type *Typ = OpaqueType::get();
580 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
584 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
585 SymbolTable &SymTab =
586 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
587 CurModule.CurrentModule->getSymbolTable();
588 return SymTab.lookup(Ty, Name);
591 // getValNonImprovising - Look up the value specified by the provided type and
592 // the provided ValID. If the value exists and has already been defined, return
593 // it. Otherwise return null.
595 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
596 if (isa<FunctionType>(Ty)) {
597 GenerateError("Functions are not values and "
598 "must be referenced as pointers");
603 case ValID::NumberVal: { // Is it a numbered definition?
604 unsigned Num = (unsigned)D.Num;
606 // Module constants occupy the lowest numbered slots...
607 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
608 if (VI != CurModule.Values.end()) {
609 if (Num < VI->second.size())
610 return VI->second[Num];
611 Num -= VI->second.size();
614 // Make sure that our type is within bounds
615 VI = CurFun.Values.find(Ty);
616 if (VI == CurFun.Values.end()) return 0;
618 // Check that the number is within bounds...
619 if (VI->second.size() <= Num) return 0;
621 return VI->second[Num];
624 case ValID::NameVal: { // Is it a named definition?
625 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
626 if (N == 0) return 0;
628 D.destroy(); // Free old strdup'd memory...
632 // Check to make sure that "Ty" is an integral type, and that our
633 // value will fit into the specified type...
634 case ValID::ConstSIntVal: // Is it a constant pool reference??
635 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
636 GenerateError("Signed integral constant '" +
637 itostr(D.ConstPool64) + "' is invalid for type '" +
638 Ty->getDescription() + "'!");
641 return ConstantInt::get(Ty, D.ConstPool64);
643 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
644 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
645 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
646 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
647 "' is invalid or out of range!");
649 } else { // This is really a signed reference. Transmogrify.
650 return ConstantInt::get(Ty, D.ConstPool64);
653 return ConstantInt::get(Ty, D.UConstPool64);
656 case ValID::ConstFPVal: // Is it a floating point const pool reference?
657 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
658 GenerateError("FP constant invalid for type!!");
661 return ConstantFP::get(Ty, D.ConstPoolFP);
663 case ValID::ConstNullVal: // Is it a null value?
664 if (!isa<PointerType>(Ty)) {
665 GenerateError("Cannot create a a non pointer null!");
668 return ConstantPointerNull::get(cast<PointerType>(Ty));
670 case ValID::ConstUndefVal: // Is it an undef value?
671 return UndefValue::get(Ty);
673 case ValID::ConstZeroVal: // Is it a zero value?
674 return Constant::getNullValue(Ty);
676 case ValID::ConstantVal: // Fully resolved constant?
677 if (D.ConstantValue->getType() != Ty) {
678 GenerateError("Constant expression type different from required type!");
681 return D.ConstantValue;
683 case ValID::InlineAsmVal: { // Inline asm expression
684 const PointerType *PTy = dyn_cast<PointerType>(Ty);
685 const FunctionType *FTy =
686 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
687 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
688 GenerateError("Invalid type for asm constraint string!");
691 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
692 D.IAD->HasSideEffects);
693 D.destroy(); // Free InlineAsmDescriptor.
697 assert(0 && "Unhandled case!");
701 assert(0 && "Unhandled case!");
705 // getVal - This function is identical to getValNonImprovising, except that if a
706 // value is not already defined, it "improvises" by creating a placeholder var
707 // that looks and acts just like the requested variable. When the value is
708 // defined later, all uses of the placeholder variable are replaced with the
711 static Value *getVal(const Type *Ty, const ValID &ID) {
712 if (Ty == Type::LabelTy) {
713 GenerateError("Cannot use a basic block here");
717 // See if the value has already been defined.
718 Value *V = getValNonImprovising(Ty, ID);
720 if (TriggerError) return 0;
722 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
723 GenerateError("Invalid use of a composite type!");
727 // If we reached here, we referenced either a symbol that we don't know about
728 // or an id number that hasn't been read yet. We may be referencing something
729 // forward, so just create an entry to be resolved later and get to it...
731 V = new Argument(Ty);
733 // Remember where this forward reference came from. FIXME, shouldn't we try
734 // to recycle these things??
735 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
738 if (inFunctionScope())
739 InsertValue(V, CurFun.LateResolveValues);
741 InsertValue(V, CurModule.LateResolveValues);
745 /// getBBVal - This is used for two purposes:
746 /// * If isDefinition is true, a new basic block with the specified ID is being
748 /// * If isDefinition is true, this is a reference to a basic block, which may
749 /// or may not be a forward reference.
751 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
752 assert(inFunctionScope() && "Can't get basic block at global scope!");
758 GenerateError("Illegal label reference " + ID.getName());
760 case ValID::NumberVal: // Is it a numbered definition?
761 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
762 CurFun.NumberedBlocks.resize(ID.Num+1);
763 BB = CurFun.NumberedBlocks[ID.Num];
765 case ValID::NameVal: // Is it a named definition?
767 if (Value *N = CurFun.CurrentFunction->
768 getSymbolTable().lookup(Type::LabelTy, Name))
769 BB = cast<BasicBlock>(N);
773 // See if the block has already been defined.
775 // If this is the definition of the block, make sure the existing value was
776 // just a forward reference. If it was a forward reference, there will be
777 // an entry for it in the PlaceHolderInfo map.
778 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
779 // The existing value was a definition, not a forward reference.
780 GenerateError("Redefinition of label " + ID.getName());
784 ID.destroy(); // Free strdup'd memory.
788 // Otherwise this block has not been seen before.
789 BB = new BasicBlock("", CurFun.CurrentFunction);
790 if (ID.Type == ValID::NameVal) {
791 BB->setName(ID.Name);
793 CurFun.NumberedBlocks[ID.Num] = BB;
796 // If this is not a definition, keep track of it so we can use it as a forward
799 // Remember where this forward reference came from.
800 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
802 // The forward declaration could have been inserted anywhere in the
803 // function: insert it into the correct place now.
804 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
805 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
812 //===----------------------------------------------------------------------===//
813 // Code to handle forward references in instructions
814 //===----------------------------------------------------------------------===//
816 // This code handles the late binding needed with statements that reference
817 // values not defined yet... for example, a forward branch, or the PHI node for
820 // This keeps a table (CurFun.LateResolveValues) of all such forward references
821 // and back patchs after we are done.
824 // ResolveDefinitions - If we could not resolve some defs at parsing
825 // time (forward branches, phi functions for loops, etc...) resolve the
829 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
830 std::map<const Type*,ValueList> *FutureLateResolvers) {
831 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
832 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
833 E = LateResolvers.end(); LRI != E; ++LRI) {
834 ValueList &List = LRI->second;
835 while (!List.empty()) {
836 Value *V = List.back();
839 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
840 CurModule.PlaceHolderInfo.find(V);
841 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
843 ValID &DID = PHI->second.first;
845 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
849 V->replaceAllUsesWith(TheRealValue);
851 CurModule.PlaceHolderInfo.erase(PHI);
852 } else if (FutureLateResolvers) {
853 // Functions have their unresolved items forwarded to the module late
855 InsertValue(V, *FutureLateResolvers);
857 if (DID.Type == ValID::NameVal) {
858 GenerateError("Reference to an invalid definition: '" +DID.getName()+
859 "' of type '" + V->getType()->getDescription() + "'",
863 GenerateError("Reference to an invalid definition: #" +
864 itostr(DID.Num) + " of type '" +
865 V->getType()->getDescription() + "'",
873 LateResolvers.clear();
876 // ResolveTypeTo - A brand new type was just declared. This means that (if
877 // name is not null) things referencing Name can be resolved. Otherwise, things
878 // refering to the number can be resolved. Do this now.
880 static void ResolveTypeTo(char *Name, const Type *ToTy) {
882 if (Name) D = ValID::create(Name);
883 else D = ValID::create((int)CurModule.Types.size());
885 std::map<ValID, PATypeHolder>::iterator I =
886 CurModule.LateResolveTypes.find(D);
887 if (I != CurModule.LateResolveTypes.end()) {
888 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
889 CurModule.LateResolveTypes.erase(I);
893 // setValueName - Set the specified value to the name given. The name may be
894 // null potentially, in which case this is a noop. The string passed in is
895 // assumed to be a malloc'd string buffer, and is free'd by this function.
897 static void setValueName(Value *V, char *NameStr) {
899 std::string Name(NameStr); // Copy string
900 free(NameStr); // Free old string
902 if (V->getType() == Type::VoidTy) {
903 GenerateError("Can't assign name '" + Name+"' to value with void type!");
907 assert(inFunctionScope() && "Must be in function scope!");
908 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
909 if (ST.lookup(V->getType(), Name)) {
910 GenerateError("Redefinition of value named '" + Name + "' in the '" +
911 V->getType()->getDescription() + "' type plane!");
920 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
921 /// this is a declaration, otherwise it is a definition.
922 static GlobalVariable *
923 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
924 bool isConstantGlobal, const Type *Ty,
925 Constant *Initializer) {
926 if (isa<FunctionType>(Ty)) {
927 GenerateError("Cannot declare global vars of function type!");
931 const PointerType *PTy = PointerType::get(Ty);
935 Name = NameStr; // Copy string
936 free(NameStr); // Free old string
939 // See if this global value was forward referenced. If so, recycle the
943 ID = ValID::create((char*)Name.c_str());
945 ID = ValID::create((int)CurModule.Values[PTy].size());
948 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
949 // Move the global to the end of the list, from whereever it was
950 // previously inserted.
951 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
952 CurModule.CurrentModule->getGlobalList().remove(GV);
953 CurModule.CurrentModule->getGlobalList().push_back(GV);
954 GV->setInitializer(Initializer);
955 GV->setLinkage(Linkage);
956 GV->setConstant(isConstantGlobal);
957 InsertValue(GV, CurModule.Values);
961 // If this global has a name, check to see if there is already a definition
962 // of this global in the module. If so, merge as appropriate. Note that
963 // this is really just a hack around problems in the CFE. :(
965 // We are a simple redefinition of a value, check to see if it is defined
966 // the same as the old one.
967 if (GlobalVariable *EGV =
968 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
969 // We are allowed to redefine a global variable in two circumstances:
970 // 1. If at least one of the globals is uninitialized or
971 // 2. If both initializers have the same value.
973 if (!EGV->hasInitializer() || !Initializer ||
974 EGV->getInitializer() == Initializer) {
976 // Make sure the existing global version gets the initializer! Make
977 // sure that it also gets marked const if the new version is.
978 if (Initializer && !EGV->hasInitializer())
979 EGV->setInitializer(Initializer);
980 if (isConstantGlobal)
981 EGV->setConstant(true);
982 EGV->setLinkage(Linkage);
986 GenerateError("Redefinition of global variable named '" + Name +
987 "' in the '" + Ty->getDescription() + "' type plane!");
992 // Otherwise there is no existing GV to use, create one now.
994 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
995 CurModule.CurrentModule);
996 InsertValue(GV, CurModule.Values);
1000 // setTypeName - Set the specified type to the name given. The name may be
1001 // null potentially, in which case this is a noop. The string passed in is
1002 // assumed to be a malloc'd string buffer, and is freed by this function.
1004 // This function returns true if the type has already been defined, but is
1005 // allowed to be redefined in the specified context. If the name is a new name
1006 // for the type plane, it is inserted and false is returned.
1007 static bool setTypeName(const Type *T, char *NameStr) {
1008 assert(!inFunctionScope() && "Can't give types function-local names!");
1009 if (NameStr == 0) return false;
1011 std::string Name(NameStr); // Copy string
1012 free(NameStr); // Free old string
1014 // We don't allow assigning names to void type
1015 if (T == Type::VoidTy) {
1016 GenerateError("Can't assign name '" + Name + "' to the void type!");
1020 // Set the type name, checking for conflicts as we do so.
1021 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1023 if (AlreadyExists) { // Inserting a name that is already defined???
1024 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1025 assert(Existing && "Conflict but no matching type?");
1027 // There is only one case where this is allowed: when we are refining an
1028 // opaque type. In this case, Existing will be an opaque type.
1029 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1030 // We ARE replacing an opaque type!
1031 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1035 // Otherwise, this is an attempt to redefine a type. That's okay if
1036 // the redefinition is identical to the original. This will be so if
1037 // Existing and T point to the same Type object. In this one case we
1038 // allow the equivalent redefinition.
1039 if (Existing == T) return true; // Yes, it's equal.
1041 // Any other kind of (non-equivalent) redefinition is an error.
1042 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1043 T->getDescription() + "' type plane!");
1049 //===----------------------------------------------------------------------===//
1050 // Code for handling upreferences in type names...
1053 // TypeContains - Returns true if Ty directly contains E in it.
1055 static bool TypeContains(const Type *Ty, const Type *E) {
1056 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1057 E) != Ty->subtype_end();
1061 struct UpRefRecord {
1062 // NestingLevel - The number of nesting levels that need to be popped before
1063 // this type is resolved.
1064 unsigned NestingLevel;
1066 // LastContainedTy - This is the type at the current binding level for the
1067 // type. Every time we reduce the nesting level, this gets updated.
1068 const Type *LastContainedTy;
1070 // UpRefTy - This is the actual opaque type that the upreference is
1071 // represented with.
1072 OpaqueType *UpRefTy;
1074 UpRefRecord(unsigned NL, OpaqueType *URTy)
1075 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1079 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1080 static std::vector<UpRefRecord> UpRefs;
1082 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1083 /// called. It loops through the UpRefs vector, which is a list of the
1084 /// currently active types. For each type, if the up reference is contained in
1085 /// the newly completed type, we decrement the level count. When the level
1086 /// count reaches zero, the upreferenced type is the type that is passed in:
1087 /// thus we can complete the cycle.
1089 static PATypeHolder HandleUpRefs(const Type *ty) {
1090 // If Ty isn't abstract, or if there are no up-references in it, then there is
1091 // nothing to resolve here.
1092 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1094 PATypeHolder Ty(ty);
1095 UR_OUT("Type '" << Ty->getDescription() <<
1096 "' newly formed. Resolving upreferences.\n" <<
1097 UpRefs.size() << " upreferences active!\n");
1099 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1100 // to zero), we resolve them all together before we resolve them to Ty. At
1101 // the end of the loop, if there is anything to resolve to Ty, it will be in
1103 OpaqueType *TypeToResolve = 0;
1105 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1106 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1107 << UpRefs[i].second->getDescription() << ") = "
1108 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1109 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1110 // Decrement level of upreference
1111 unsigned Level = --UpRefs[i].NestingLevel;
1112 UpRefs[i].LastContainedTy = Ty;
1113 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1114 if (Level == 0) { // Upreference should be resolved!
1115 if (!TypeToResolve) {
1116 TypeToResolve = UpRefs[i].UpRefTy;
1118 UR_OUT(" * Resolving upreference for "
1119 << UpRefs[i].second->getDescription() << "\n";
1120 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1121 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1122 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1123 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1125 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1126 --i; // Do not skip the next element...
1131 if (TypeToResolve) {
1132 UR_OUT(" * Resolving upreference for "
1133 << UpRefs[i].second->getDescription() << "\n";
1134 std::string OldName = TypeToResolve->getDescription());
1135 TypeToResolve->refineAbstractTypeTo(Ty);
1141 // common code from the two 'RunVMAsmParser' functions
1142 static Module* RunParser(Module * M) {
1144 llvmAsmlineno = 1; // Reset the current line number...
1145 CurModule.CurrentModule = M;
1147 // Check to make sure the parser succeeded
1150 delete ParserResult;
1154 // Check to make sure that parsing produced a result
1158 // Reset ParserResult variable while saving its value for the result.
1159 Module *Result = ParserResult;
1165 //===----------------------------------------------------------------------===//
1166 // RunVMAsmParser - Define an interface to this parser
1167 //===----------------------------------------------------------------------===//
1169 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1172 CurFilename = Filename;
1173 return RunParser(new Module(CurFilename));
1176 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1177 set_scan_string(AsmString);
1179 CurFilename = "from_memory";
1181 return RunParser(new Module (CurFilename));
1183 return RunParser(M);
1189 /* Enabling traces. */
1194 /* Enabling verbose error messages. */
1195 #ifdef YYERROR_VERBOSE
1196 # undef YYERROR_VERBOSE
1197 # define YYERROR_VERBOSE 1
1199 # define YYERROR_VERBOSE 0
1202 /* Enabling the token table. */
1203 #ifndef YYTOKEN_TABLE
1204 # define YYTOKEN_TABLE 0
1207 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1208 #line 855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
1209 typedef union YYSTYPE {
1210 llvm::Module *ModuleVal;
1211 llvm::Function *FunctionVal;
1212 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1213 llvm::BasicBlock *BasicBlockVal;
1214 llvm::TerminatorInst *TermInstVal;
1215 llvm::Instruction *InstVal;
1216 llvm::Constant *ConstVal;
1218 const llvm::Type *PrimType;
1219 llvm::PATypeHolder *TypeVal;
1220 llvm::Value *ValueVal;
1222 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1223 std::vector<llvm::Value*> *ValueList;
1224 std::list<llvm::PATypeHolder> *TypeList;
1225 // Represent the RHS of PHI node
1226 std::list<std::pair<llvm::Value*,
1227 llvm::BasicBlock*> > *PHIList;
1228 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1229 std::vector<llvm::Constant*> *ConstVector;
1231 llvm::GlobalValue::LinkageTypes Linkage;
1239 char *StrVal; // This memory is strdup'd!
1240 llvm::ValID ValIDVal; // strdup'd memory maybe!
1242 llvm::Instruction::BinaryOps BinaryOpVal;
1243 llvm::Instruction::TermOps TermOpVal;
1244 llvm::Instruction::MemoryOps MemOpVal;
1245 llvm::Instruction::CastOps CastOpVal;
1246 llvm::Instruction::OtherOps OtherOpVal;
1247 llvm::Module::Endianness Endianness;
1248 llvm::ICmpInst::Predicate IPredicate;
1249 llvm::FCmpInst::Predicate FPredicate;
1251 /* Line 196 of yacc.c. */
1252 #line 1253 "llvmAsmParser.tab.c"
1253 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1254 # define YYSTYPE_IS_DECLARED 1
1255 # define YYSTYPE_IS_TRIVIAL 1
1260 /* Copy the second part of user declarations. */
1263 /* Line 219 of yacc.c. */
1264 #line 1265 "llvmAsmParser.tab.c"
1266 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1267 # define YYSIZE_T __SIZE_TYPE__
1269 #if ! defined (YYSIZE_T) && defined (size_t)
1270 # define YYSIZE_T size_t
1272 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1273 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1274 # define YYSIZE_T size_t
1276 #if ! defined (YYSIZE_T)
1277 # define YYSIZE_T unsigned int
1283 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1284 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1288 # define YY_(msgid) msgid
1292 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1294 /* The parser invokes alloca or malloc; define the necessary symbols. */
1296 # ifdef YYSTACK_USE_ALLOCA
1297 # if YYSTACK_USE_ALLOCA
1299 # define YYSTACK_ALLOC __builtin_alloca
1301 # define YYSTACK_ALLOC alloca
1302 # if defined (__STDC__) || defined (__cplusplus)
1303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1304 # define YYINCLUDED_STDLIB_H
1310 # ifdef YYSTACK_ALLOC
1311 /* Pacify GCC's `empty if-body' warning. */
1312 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1313 # ifndef YYSTACK_ALLOC_MAXIMUM
1314 /* The OS might guarantee only one guard page at the bottom of the stack,
1315 and a page size can be as small as 4096 bytes. So we cannot safely
1316 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1317 to allow for a few compiler-allocated temporary stack slots. */
1318 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1321 # define YYSTACK_ALLOC YYMALLOC
1322 # define YYSTACK_FREE YYFREE
1323 # ifndef YYSTACK_ALLOC_MAXIMUM
1324 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1330 # define YYMALLOC malloc
1331 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1332 && (defined (__STDC__) || defined (__cplusplus)))
1333 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1337 # define YYFREE free
1338 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1339 && (defined (__STDC__) || defined (__cplusplus)))
1340 void free (void *); /* INFRINGES ON USER NAME SPACE */
1347 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1350 #if (! defined (yyoverflow) \
1351 && (! defined (__cplusplus) \
1352 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1354 /* A type that is properly aligned for any stack member. */
1361 /* The size of the maximum gap between one aligned stack and the next. */
1362 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1364 /* The size of an array large to enough to hold all stacks, each with
1366 # define YYSTACK_BYTES(N) \
1367 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1368 + YYSTACK_GAP_MAXIMUM)
1370 /* Copy COUNT objects from FROM to TO. The source and destination do
1373 # if defined (__GNUC__) && 1 < __GNUC__
1374 # define YYCOPY(To, From, Count) \
1375 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1377 # define YYCOPY(To, From, Count) \
1381 for (yyi = 0; yyi < (Count); yyi++) \
1382 (To)[yyi] = (From)[yyi]; \
1388 /* Relocate STACK from its old location to the new one. The
1389 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1390 elements in the stack, and YYPTR gives the new location of the
1391 stack. Advance YYPTR to a properly aligned location for the next
1393 # define YYSTACK_RELOCATE(Stack) \
1396 YYSIZE_T yynewbytes; \
1397 YYCOPY (&yyptr->Stack, Stack, yysize); \
1398 Stack = &yyptr->Stack; \
1399 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1400 yyptr += yynewbytes / sizeof (*yyptr); \
1406 #if defined (__STDC__) || defined (__cplusplus)
1407 typedef signed char yysigned_char;
1409 typedef short int yysigned_char;
1412 /* YYFINAL -- State number of the termination state. */
1414 /* YYLAST -- Last index in YYTABLE. */
1417 /* YYNTOKENS -- Number of terminals. */
1418 #define YYNTOKENS 153
1419 /* YYNNTS -- Number of nonterminals. */
1421 /* YYNRULES -- Number of rules. */
1422 #define YYNRULES 291
1423 /* YYNRULES -- Number of states. */
1424 #define YYNSTATES 567
1426 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1427 #define YYUNDEFTOK 2
1428 #define YYMAXUTOK 393
1430 #define YYTRANSLATE(YYX) \
1431 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1433 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1434 static const unsigned char yytranslate[] =
1436 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1440 142, 143, 151, 2, 140, 2, 2, 2, 2, 2,
1441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1442 147, 139, 148, 2, 2, 2, 2, 2, 2, 2,
1443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1445 2, 144, 141, 146, 2, 2, 2, 2, 2, 152,
1446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1448 145, 2, 2, 149, 2, 150, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1454 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1461 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1462 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1463 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1464 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1465 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1466 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1467 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1468 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1469 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1470 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1471 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1472 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1473 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1474 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1479 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1481 static const unsigned short int yyprhs[] =
1483 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1484 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1485 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1486 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1487 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1488 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1489 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1490 140, 141, 143, 145, 147, 149, 151, 153, 155, 156,
1491 157, 159, 161, 163, 165, 167, 169, 172, 173, 176,
1492 177, 181, 184, 185, 187, 188, 192, 194, 197, 199,
1493 201, 203, 205, 207, 209, 211, 213, 215, 217, 219,
1494 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1495 242, 247, 253, 259, 263, 266, 272, 277, 280, 282,
1496 286, 288, 292, 294, 295, 300, 304, 308, 313, 318,
1497 322, 325, 328, 331, 334, 337, 340, 343, 346, 349,
1498 352, 355, 358, 365, 371, 380, 387, 394, 402, 410,
1499 417, 424, 433, 442, 446, 448, 450, 452, 454, 457,
1500 460, 465, 468, 470, 475, 478, 483, 484, 492, 493,
1501 501, 502, 510, 511, 519, 523, 528, 529, 531, 533,
1502 535, 539, 543, 547, 551, 555, 559, 561, 562, 564,
1503 566, 568, 569, 572, 576, 578, 580, 584, 586, 587,
1504 596, 598, 600, 604, 606, 608, 611, 612, 614, 616,
1505 617, 622, 623, 625, 627, 629, 631, 633, 635, 637,
1506 639, 641, 645, 647, 653, 655, 657, 659, 661, 664,
1507 667, 670, 674, 677, 678, 680, 683, 686, 690, 700,
1508 710, 719, 733, 735, 737, 744, 750, 753, 760, 768,
1509 770, 774, 776, 777, 780, 782, 788, 794, 801, 808,
1510 811, 816, 821, 828, 833, 838, 845, 852, 855, 863,
1511 865, 868, 869, 871, 872, 876, 883, 887, 894, 897,
1515 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1516 static const short int yyrhs[] =
1518 185, 0, -1, 5, -1, 6, -1, 78, -1, 79,
1519 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1520 -1, 85, -1, 86, -1, 87, -1, 88, -1, 89,
1521 -1, 118, -1, 119, -1, 120, -1, 121, -1, 122,
1522 -1, 123, -1, 124, -1, 125, -1, 126, -1, 127,
1523 -1, 128, -1, 129, -1, 132, -1, 133, -1, 134,
1524 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1525 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1526 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1527 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1528 -1, 98, -1, 99, -1, 100, -1, 101, -1, 27,
1529 -1, 28, -1, 16, -1, 14, -1, 12, -1, 10,
1530 -1, 17, -1, 15, -1, 13, -1, 11, -1, 161,
1531 -1, 162, -1, 18, -1, 19, -1, 197, 139, -1,
1532 -1, 41, -1, 42, -1, 43, -1, 44, -1, 45,
1533 -1, 46, -1, 47, -1, -1, -1, 65, -1, 66,
1534 -1, 67, -1, 68, -1, 69, -1, 70, -1, 64,
1535 4, -1, -1, 57, 4, -1, -1, 140, 57, 4,
1536 -1, 34, 24, -1, -1, 170, -1, -1, 140, 173,
1537 172, -1, 170, -1, 57, 4, -1, 176, -1, 8,
1538 -1, 178, -1, 8, -1, 178, -1, 9, -1, 10,
1539 -1, 11, -1, 12, -1, 13, -1, 14, -1, 15,
1540 -1, 16, -1, 17, -1, 18, -1, 19, -1, 20,
1541 -1, 21, -1, 48, -1, 177, -1, 212, -1, 141,
1542 4, -1, 175, 142, 180, 143, -1, 144, 4, 145,
1543 178, 146, -1, 147, 4, 145, 178, 148, -1, 149,
1544 179, 150, -1, 149, 150, -1, 147, 149, 179, 150,
1545 148, -1, 147, 149, 150, 148, -1, 178, 151, -1,
1546 178, -1, 179, 140, 178, -1, 179, -1, 179, 140,
1547 37, -1, 37, -1, -1, 176, 144, 183, 146, -1,
1548 176, 144, 146, -1, 176, 152, 24, -1, 176, 147,
1549 183, 148, -1, 176, 149, 183, 150, -1, 176, 149,
1550 150, -1, 176, 38, -1, 176, 39, -1, 176, 212,
1551 -1, 176, 182, -1, 176, 26, -1, 161, 3, -1,
1552 161, 4, -1, 162, 4, -1, 162, 3, -1, 9,
1553 27, -1, 9, 28, -1, 164, 7, -1, 157, 142,
1554 181, 36, 176, 143, -1, 117, 142, 181, 226, 143,
1555 -1, 131, 142, 181, 140, 181, 140, 181, 143, -1,
1556 155, 142, 181, 140, 181, 143, -1, 156, 142, 181,
1557 140, 181, 143, -1, 90, 159, 142, 181, 140, 181,
1558 143, -1, 91, 160, 142, 181, 140, 181, 143, -1,
1559 158, 142, 181, 140, 181, 143, -1, 136, 142, 181,
1560 140, 181, 143, -1, 137, 142, 181, 140, 181, 140,
1561 181, 143, -1, 138, 142, 181, 140, 181, 140, 181,
1562 143, -1, 183, 140, 181, -1, 181, -1, 32, -1,
1563 33, -1, 186, -1, 186, 206, -1, 186, 208, -1,
1564 186, 62, 61, 192, -1, 186, 25, -1, 187, -1,
1565 187, 165, 20, 174, -1, 187, 208, -1, 187, 62,
1566 61, 192, -1, -1, 187, 165, 166, 184, 181, 188,
1567 172, -1, -1, 187, 165, 50, 184, 176, 189, 172,
1568 -1, -1, 187, 165, 45, 184, 176, 190, 172, -1,
1569 -1, 187, 165, 47, 184, 176, 191, 172, -1, 187,
1570 51, 194, -1, 187, 58, 139, 195, -1, -1, 24,
1571 -1, 56, -1, 55, -1, 53, 139, 193, -1, 54,
1572 139, 4, -1, 52, 139, 24, -1, 71, 139, 24,
1573 -1, 144, 196, 146, -1, 196, 140, 24, -1, 24,
1574 -1, -1, 22, -1, 24, -1, 197, -1, -1, 176,
1575 198, -1, 200, 140, 199, -1, 199, -1, 200, -1,
1576 200, 140, 37, -1, 37, -1, -1, 167, 174, 197,
1577 142, 201, 143, 171, 168, -1, 29, -1, 149, -1,
1578 166, 202, 203, -1, 30, -1, 150, -1, 215, 205,
1579 -1, -1, 45, -1, 47, -1, -1, 31, 209, 207,
1580 202, -1, -1, 63, -1, 3, -1, 4, -1, 7,
1581 -1, 27, -1, 28, -1, 38, -1, 39, -1, 26,
1582 -1, 147, 183, 148, -1, 182, -1, 61, 210, 24,
1583 140, 24, -1, 154, -1, 197, -1, 212, -1, 211,
1584 -1, 176, 213, -1, 215, 216, -1, 204, 216, -1,
1585 217, 165, 218, -1, 217, 220, -1, -1, 23, -1,
1586 72, 214, -1, 72, 8, -1, 73, 21, 213, -1,
1587 73, 9, 213, 140, 21, 213, 140, 21, 213, -1,
1588 74, 163, 213, 140, 21, 213, 144, 219, 146, -1,
1589 74, 163, 213, 140, 21, 213, 144, 146, -1, 75,
1590 167, 174, 213, 142, 223, 143, 36, 21, 213, 76,
1591 21, 213, -1, 76, -1, 77, -1, 219, 163, 211,
1592 140, 21, 213, -1, 163, 211, 140, 21, 213, -1,
1593 165, 225, -1, 176, 144, 213, 140, 213, 146, -1,
1594 221, 140, 144, 213, 140, 213, 146, -1, 214, -1,
1595 222, 140, 214, -1, 222, -1, -1, 60, 59, -1,
1596 59, -1, 155, 176, 213, 140, 213, -1, 156, 176,
1597 213, 140, 213, -1, 90, 159, 176, 213, 140, 213,
1598 -1, 91, 160, 176, 213, 140, 213, -1, 49, 214,
1599 -1, 158, 214, 140, 214, -1, 157, 214, 36, 176,
1600 -1, 131, 214, 140, 214, 140, 214, -1, 135, 214,
1601 140, 176, -1, 136, 214, 140, 214, -1, 137, 214,
1602 140, 214, 140, 214, -1, 138, 214, 140, 214, 140,
1603 214, -1, 130, 221, -1, 224, 167, 174, 213, 142,
1604 223, 143, -1, 228, -1, 140, 222, -1, -1, 35,
1605 -1, -1, 112, 176, 169, -1, 112, 176, 140, 15,
1606 213, 169, -1, 113, 176, 169, -1, 113, 176, 140,
1607 15, 213, 169, -1, 114, 214, -1, 227, 115, 176,
1608 213, -1, 227, 116, 214, 140, 176, 213, -1, 117,
1612 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1613 static const unsigned short int yyrline[] =
1615 0, 988, 988, 989, 999, 999, 999, 999, 999, 999,
1616 999, 999, 999, 1000, 1000, 1000, 1001, 1001, 1001, 1001,
1617 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1003, 1003,
1618 1003, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1008, 1009,
1619 1009, 1013, 1013, 1014, 1014, 1015, 1015, 1016, 1016, 1017,
1620 1017, 1018, 1018, 1019, 1019, 1020, 1021, 1026, 1026, 1026,
1621 1026, 1027, 1027, 1027, 1027, 1028, 1028, 1029, 1029, 1032,
1622 1036, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1050,
1623 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1066, 1067, 1073,
1624 1074, 1082, 1090, 1091, 1096, 1097, 1098, 1103, 1117, 1117,
1625 1118, 1118, 1120, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
1626 1131, 1131, 1131, 1131, 1131, 1131, 1132, 1136, 1140, 1148,
1627 1156, 1169, 1174, 1186, 1196, 1200, 1210, 1214, 1225, 1230,
1628 1236, 1237, 1241, 1245, 1256, 1282, 1296, 1326, 1352, 1373,
1629 1386, 1396, 1401, 1462, 1469, 1477, 1483, 1489, 1495, 1501,
1630 1505, 1509, 1517, 1529, 1550, 1558, 1564, 1575, 1580, 1585,
1631 1594, 1600, 1606, 1615, 1619, 1627, 1627, 1637, 1645, 1650,
1632 1654, 1658, 1662, 1677, 1699, 1702, 1705, 1705, 1713, 1713,
1633 1721, 1721, 1729, 1729, 1738, 1741, 1744, 1748, 1761, 1762,
1634 1764, 1768, 1777, 1781, 1786, 1788, 1793, 1798, 1807, 1807,
1635 1808, 1808, 1810, 1817, 1823, 1830, 1834, 1840, 1845, 1850,
1636 1945, 1945, 1947, 1955, 1955, 1957, 1962, 1963, 1964, 1966,
1637 1966, 1976, 1980, 1985, 1989, 1993, 1997, 2001, 2005, 2009,
1638 2013, 2017, 2042, 2046, 2060, 2064, 2070, 2070, 2076, 2081,
1639 2085, 2094, 2105, 2114, 2126, 2139, 2143, 2147, 2152, 2161,
1640 2180, 2189, 2245, 2249, 2256, 2267, 2280, 2289, 2298, 2308,
1641 2312, 2319, 2319, 2321, 2325, 2330, 2349, 2364, 2375, 2386,
1642 2399, 2408, 2419, 2427, 2432, 2438, 2444, 2450, 2465, 2524,
1643 2531, 2534, 2539, 2543, 2550, 2555, 2561, 2566, 2572, 2580,
1648 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1649 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1650 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1651 static const char *const yytname[] =
1653 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1654 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1655 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1656 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1657 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1658 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1659 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1660 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1661 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1662 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1663 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1664 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1665 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1666 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1667 "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT",
1668 "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD",
1669 "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1670 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1671 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1672 "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1673 "INSERTELEMENT", "SHUFFLEVECTOR", "'='", "','", "'\\\\'", "'('", "')'",
1674 "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept",
1675 "INTVAL", "ArithmeticOps", "LogicalOps", "CastOps", "ShiftOps",
1676 "IPredicates", "FPredicates", "SIntType", "UIntType", "IntType",
1677 "FPType", "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign",
1678 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1679 "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType",
1680 "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr",
1681 "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1",
1682 "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition",
1683 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
1684 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1685 "END", "Function", "FnDeclareLinkage", "FunctionProto", "@5",
1686 "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1687 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1688 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1689 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1695 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1697 static const unsigned short int yytoknum[] =
1699 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1700 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1701 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1702 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1703 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1704 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1705 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1706 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1707 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1708 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1709 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1710 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1711 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1712 385, 386, 387, 388, 389, 390, 391, 392, 393, 61,
1713 44, 92, 40, 41, 91, 120, 93, 60, 62, 123,
1718 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1719 static const unsigned char yyr1[] =
1721 0, 153, 154, 154, 155, 155, 155, 155, 155, 155,
1722 155, 155, 155, 156, 156, 156, 157, 157, 157, 157,
1723 157, 157, 157, 157, 157, 157, 157, 157, 158, 158,
1724 158, 159, 159, 159, 159, 159, 159, 159, 159, 159,
1725 159, 160, 160, 160, 160, 160, 160, 160, 160, 160,
1726 160, 160, 160, 160, 160, 160, 160, 161, 161, 161,
1727 161, 162, 162, 162, 162, 163, 163, 164, 164, 165,
1728 165, 166, 166, 166, 166, 166, 166, 166, 166, 167,
1729 167, 167, 167, 167, 167, 167, 167, 168, 168, 169,
1730 169, 170, 171, 171, 172, 172, 173, 173, 174, 174,
1731 175, 175, 176, 177, 177, 177, 177, 177, 177, 177,
1732 177, 177, 177, 177, 177, 177, 178, 178, 178, 178,
1733 178, 178, 178, 178, 178, 178, 178, 178, 179, 179,
1734 180, 180, 180, 180, 181, 181, 181, 181, 181, 181,
1735 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
1736 181, 181, 182, 182, 182, 182, 182, 182, 182, 182,
1737 182, 182, 182, 183, 183, 184, 184, 185, 186, 186,
1738 186, 186, 186, 187, 187, 187, 188, 187, 189, 187,
1739 190, 187, 191, 187, 187, 187, 187, 192, 193, 193,
1740 194, 194, 194, 194, 195, 196, 196, 196, 197, 197,
1741 198, 198, 199, 200, 200, 201, 201, 201, 201, 202,
1742 203, 203, 204, 205, 205, 206, 207, 207, 207, 209,
1743 208, 210, 210, 211, 211, 211, 211, 211, 211, 211,
1744 211, 211, 211, 211, 212, 212, 213, 213, 214, 215,
1745 215, 216, 217, 217, 217, 218, 218, 218, 218, 218,
1746 218, 218, 218, 218, 219, 219, 220, 221, 221, 222,
1747 222, 223, 223, 224, 224, 225, 225, 225, 225, 225,
1748 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1749 226, 226, 227, 227, 228, 228, 228, 228, 228, 228,
1753 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1754 static const unsigned char yyr2[] =
1756 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1757 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1758 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1759 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1760 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1761 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1762 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1763 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1764 1, 1, 1, 1, 1, 1, 2, 0, 2, 0,
1765 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1766 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1767 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1768 4, 5, 5, 3, 2, 5, 4, 2, 1, 3,
1769 1, 3, 1, 0, 4, 3, 3, 4, 4, 3,
1770 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1771 2, 2, 6, 5, 8, 6, 6, 7, 7, 6,
1772 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1773 4, 2, 1, 4, 2, 4, 0, 7, 0, 7,
1774 0, 7, 0, 7, 3, 4, 0, 1, 1, 1,
1775 3, 3, 3, 3, 3, 3, 1, 0, 1, 1,
1776 1, 0, 2, 3, 1, 1, 3, 1, 0, 8,
1777 1, 1, 3, 1, 1, 2, 0, 1, 1, 0,
1778 4, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1779 1, 3, 1, 5, 1, 1, 1, 1, 2, 2,
1780 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1781 8, 13, 1, 1, 6, 5, 2, 6, 7, 1,
1782 3, 1, 0, 2, 1, 5, 5, 6, 6, 2,
1783 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
1784 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1788 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1789 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1790 means the default is an error. */
1791 static const unsigned short int yydefact[] =
1793 186, 0, 78, 172, 1, 171, 219, 71, 72, 73,
1794 74, 75, 76, 77, 0, 79, 243, 168, 169, 243,
1795 198, 199, 0, 0, 0, 78, 0, 174, 216, 0,
1796 0, 80, 81, 82, 83, 84, 85, 0, 0, 244,
1797 240, 70, 213, 214, 215, 239, 0, 0, 0, 0,
1798 184, 0, 0, 0, 0, 0, 0, 0, 69, 217,
1799 218, 79, 187, 170, 86, 2, 3, 99, 103, 104,
1800 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1801 115, 116, 0, 0, 0, 0, 234, 0, 0, 98,
1802 117, 102, 235, 118, 210, 211, 212, 283, 242, 0,
1803 0, 0, 0, 197, 185, 175, 173, 165, 166, 0,
1804 0, 0, 0, 220, 119, 0, 0, 0, 101, 124,
1805 128, 0, 0, 133, 127, 282, 0, 264, 0, 0,
1806 0, 0, 79, 252, 253, 4, 5, 6, 7, 8,
1807 9, 10, 11, 12, 13, 14, 15, 0, 0, 0,
1808 0, 0, 0, 16, 17, 18, 19, 20, 21, 22,
1809 23, 24, 25, 26, 27, 0, 0, 28, 29, 30,
1810 0, 0, 0, 0, 0, 0, 0, 0, 241, 79,
1811 256, 0, 279, 192, 189, 188, 190, 191, 193, 196,
1812 0, 180, 182, 178, 103, 104, 105, 106, 107, 108,
1813 109, 110, 111, 112, 113, 0, 0, 0, 0, 176,
1814 0, 0, 0, 0, 0, 123, 208, 132, 130, 0,
1815 0, 269, 263, 246, 245, 0, 0, 60, 64, 59,
1816 63, 58, 62, 57, 61, 65, 66, 0, 0, 31,
1817 32, 33, 34, 35, 36, 37, 38, 39, 40, 0,
1818 55, 56, 51, 52, 53, 54, 41, 42, 43, 44,
1819 45, 46, 47, 48, 49, 50, 0, 89, 89, 288,
1820 0, 0, 277, 0, 0, 0, 0, 0, 0, 0,
1821 0, 0, 0, 0, 0, 0, 194, 94, 94, 94,
1822 149, 150, 145, 146, 148, 147, 151, 144, 140, 141,
1823 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1824 0, 0, 0, 0, 0, 143, 142, 94, 100, 100,
1825 126, 0, 129, 207, 201, 204, 205, 0, 0, 120,
1826 223, 224, 225, 230, 226, 227, 228, 229, 221, 0,
1827 232, 237, 236, 238, 0, 247, 0, 0, 0, 0,
1828 0, 284, 0, 286, 281, 0, 0, 0, 0, 0,
1829 0, 0, 0, 0, 0, 0, 0, 0, 0, 195,
1830 0, 181, 183, 179, 0, 0, 0, 0, 0, 0,
1831 0, 135, 164, 0, 0, 139, 0, 136, 0, 0,
1832 0, 0, 177, 121, 122, 125, 200, 202, 0, 92,
1833 131, 222, 0, 0, 0, 0, 0, 0, 0, 0,
1834 0, 0, 0, 291, 0, 0, 0, 273, 274, 0,
1835 0, 0, 0, 271, 270, 0, 289, 0, 0, 0,
1836 96, 94, 0, 0, 281, 0, 0, 0, 0, 0,
1837 134, 137, 138, 0, 0, 0, 0, 206, 203, 93,
1838 87, 0, 231, 0, 0, 262, 0, 0, 89, 90,
1839 89, 259, 280, 0, 0, 0, 0, 0, 265, 266,
1840 262, 0, 91, 97, 95, 0, 0, 0, 0, 0,
1841 0, 0, 163, 0, 0, 0, 0, 0, 209, 0,
1842 0, 0, 261, 0, 267, 268, 0, 285, 287, 0,
1843 0, 0, 272, 275, 276, 0, 290, 0, 0, 153,
1844 0, 0, 0, 0, 0, 0, 0, 0, 88, 233,
1845 0, 0, 0, 260, 257, 0, 278, 0, 0, 0,
1846 160, 0, 0, 155, 156, 152, 159, 0, 250, 0,
1847 0, 0, 258, 157, 158, 0, 0, 0, 248, 0,
1848 249, 0, 0, 154, 161, 162, 0, 0, 0, 0,
1849 0, 0, 255, 0, 0, 254, 251
1852 /* YYDEFGOTO[NTERM-NUM]. */
1853 static const short int yydefgoto[] =
1855 -1, 86, 311, 312, 313, 314, 249, 266, 205, 206,
1856 237, 207, 25, 15, 37, 488, 351, 430, 450, 371,
1857 431, 87, 88, 208, 90, 91, 121, 219, 382, 340,
1858 383, 109, 1, 2, 3, 317, 289, 287, 288, 63,
1859 186, 50, 104, 190, 92, 397, 325, 326, 327, 38,
1860 96, 16, 44, 17, 61, 18, 28, 402, 341, 93,
1861 343, 461, 19, 40, 41, 178, 540, 98, 272, 492,
1862 493, 179, 180, 413, 181, 182
1865 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1867 #define YYPACT_NINF -514
1868 static const short int yypact[] =
1870 -514, 47, 80, 817, -514, -514, -514, -514, -514, -514,
1871 -514, -514, -514, -514, -3, 79, 67, -514, -514, -9,
1872 -514, -514, 33, -46, 42, 139, -29, -514, -2, 95,
1873 126, -514, -514, -514, -514, -514, -514, 1112, -18, -514,
1874 -514, 96, -514, -514, -514, -514, -7, 29, 56, 61,
1875 -514, 34, 95, 1112, 74, 74, 74, 74, -514, -514,
1876 -514, 79, -514, -514, -514, -514, -514, 45, -514, -514,
1877 -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,
1878 -514, -514, 209, 211, 2, 538, -514, 96, 77, -514,
1879 -514, -118, -514, -514, -514, -514, -514, 1252, -514, 201,
1880 102, 224, 206, 215, -514, -514, -514, -514, -514, 1153,
1881 1153, 1153, 1173, -514, -514, 112, 115, 598, -514, -514,
1882 -118, -111, 99, 643, -514, -514, 1153, -514, 207, 1214,
1883 14, 239, 79, -514, -514, -514, -514, -514, -514, -514,
1884 -514, -514, -514, -514, -514, -514, -514, 110, 190, 1153,
1885 1153, 1153, 1153, -514, -514, -514, -514, -514, -514, -514,
1886 -514, -514, -514, -514, -514, 1153, 1153, -514, -514, -514,
1887 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, -514, 79,
1888 -514, 48, -514, -514, -514, -514, -514, -514, -514, -514,
1889 -94, -514, -514, -514, 138, 171, 173, 187, 189, 195,
1890 218, 220, 230, 258, 260, 232, 234, 267, 393, -514,
1891 1153, 1153, 129, -99, 1153, -514, 967, -514, 140, 135,
1892 691, -514, -514, 45, -514, 691, 691, -514, -514, -514,
1893 -514, -514, -514, -514, -514, -514, -514, 691, 1112, -514,
1894 -514, -514, -514, -514, -514, -514, -514, -514, -514, 1153,
1895 -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,
1896 -514, -514, -514, -514, -514, -514, 1153, 145, 146, -514,
1897 691, 158, 163, 164, 165, 167, 169, 170, 691, 691,
1898 243, 172, 1112, 1153, 1153, 287, -514, 174, 174, 174,
1899 -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,
1900 110, 190, 176, 177, 188, 191, 192, 914, 1173, 618,
1901 289, 193, 194, 196, 197, -514, -514, 174, -119, -60,
1902 -514, 181, -118, -514, 96, -514, 175, 198, 1008, -514,
1903 -514, -514, -514, -514, -514, -514, -514, -514, 274, 1173,
1904 -514, -514, -514, -514, 200, -514, 203, 691, 691, 691,
1905 0, -514, 13, -514, 204, 691, 202, 1153, 1153, 1153,
1906 1153, 1153, 205, 212, 1153, 1153, 691, 691, 213, -514,
1907 -17, -514, -514, -514, 214, 216, 1173, 1173, 1173, 1173,
1908 1173, -514, -514, 15, -32, -514, -69, -514, 1173, 1173,
1909 1173, 1173, -514, -514, -514, -514, -514, -514, 1059, 313,
1910 -514, -514, 327, -31, 333, 334, 217, 222, 223, 691,
1911 356, 691, 1153, -514, 225, 691, 226, -514, -514, 227,
1912 238, 691, 691, -514, -514, 228, -514, 1153, 357, 376,
1913 -514, 174, 1173, 1173, 204, 244, 248, 249, 254, 1173,
1914 -514, -514, -514, 255, 256, 347, 257, -514, -514, -514,
1915 345, 263, -514, 691, 691, 1153, 691, 691, 266, -514,
1916 266, -514, 268, 691, 269, 1153, 1153, 1153, -514, -514,
1917 1153, 691, -514, -514, -514, 272, 273, 264, 1173, 1173,
1918 1173, 1173, -514, 1173, 1173, 1153, 1173, 410, -514, 392,
1919 280, 277, 268, 283, -514, -514, 366, -514, -514, 1153,
1920 281, 691, -514, -514, -514, 291, -514, 1173, 1173, -514,
1921 295, 293, 297, 298, 296, 299, 300, 301, -514, -514,
1922 419, 51, 405, -514, -514, 304, -514, 302, 303, 1173,
1923 -514, 1173, 1173, -514, -514, -514, -514, 691, -514, 827,
1924 85, 430, -514, -514, -514, 309, 311, 312, -514, 316,
1925 -514, 827, 691, -514, -514, -514, 436, 318, 385, 691,
1926 442, 443, -514, 691, 691, -514, -514
1929 /* YYPGOTO[NTERM-NUM]. */
1930 static const short int yypgoto[] =
1932 -514, -514, 368, 369, 370, 371, 185, 168, -130, -129,
1933 -503, -514, 429, 461, -110, -514, -264, 88, -514, -281,
1934 -514, -50, -514, -37, -514, -41, 39, -514, -107, 282,
1935 -289, 22, -514, -514, -514, -514, -514, -514, -514, 437,
1936 -514, -514, -514, -514, 7, -514, 90, -514, -514, 432,
1937 -514, -514, -514, -514, -514, 493, -514, -514, -513, -195,
1938 38, -117, -514, 478, -514, -514, -514, -514, -514, 86,
1939 30, -514, -514, 65, -514, -514
1942 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1943 positive, shift that token. If negative, reduce the rule which
1944 number is the opposite. If zero, do what YYDEFACT says.
1945 If YYTABLE_NINF, syntax error. */
1946 #define YYTABLE_NINF -168
1947 static const short int yytable[] =
1949 89, 235, 236, 106, 353, 209, 116, 372, 373, 221,
1950 26, 94, 224, 316, 39, 409, 89, 428, 539, 384,
1951 386, 42, 238, 225, -100, 342, 549, 393, 411, 214,
1952 342, 342, 124, 124, 269, 226, 392, 551, 557, 215,
1953 429, 214, 342, 59, 120, 60, 285, 4, 26, 273,
1954 403, 321, 286, 274, 275, 276, 277, 410, 29, 280,
1955 281, 227, 228, 229, 230, 231, 232, 233, 234, 282,
1956 410, 439, 191, 192, 193, 342, 120, 110, 111, 112,
1957 -167, 442, 120, 342, 342, 46, 47, 48, 394, 220,
1958 39, 124, 220, 51, 122, 227, 228, 229, 230, 231,
1959 232, 233, 234, 52, 49, 5, 107, 108, 439, 439,
1960 58, 6, 267, 268, 220, 270, 441, 452, 20, 62,
1961 21, 7, 8, 9, 10, 11, 12, 13, 271, 220,
1962 64, 95, 99, 220, 220, 220, 220, 278, 279, 220,
1963 220, 43, 14, 30, 31, 32, 33, 34, 35, 36,
1964 474, 117, 342, 342, 342, 439, 213, 184, 185, 53,
1965 342, 440, 218, 283, 284, 290, 291, 368, 100, 318,
1966 319, 342, 342, 322, -60, -60, -64, -64, 103, 324,
1967 7, 8, 9, 10, 54, 12, 55, -101, 347, 56,
1968 -59, -59, -63, -63, 497, 101, 498, 538, -58, -58,
1969 102, 89, 239, 240, 241, 242, 243, 244, 245, 246,
1970 247, 248, 348, 114, 342, 115, 342, 250, 251, 123,
1971 342, -62, -62, -57, -57, 183, 342, 342, 187, 349,
1972 188, 550, 366, -61, -61, 292, 293, 294, 295, 189,
1973 416, 216, 418, 419, 420, 89, 367, 220, 424, 227,
1974 228, 229, 230, 231, 232, 233, 234, 210, 342, 342,
1975 211, 342, 342, 344, 345, -67, 222, -68, 342, 434,
1976 435, 436, 437, 438, 296, 346, 342, 320, 329, 364,
1977 328, 443, 444, 445, 446, 350, 352, 322, 252, 253,
1978 254, 255, 256, 257, 258, 259, 260, 261, 262, 263,
1979 264, 265, 355, 356, 357, 358, 342, 359, 354, 360,
1980 361, 369, 365, 387, 370, 398, 362, 363, 376, 377,
1981 220, 417, 220, 220, 220, 475, 476, 423, 220, 395,
1982 378, 396, 482, 379, 380, 388, 389, 401, 390, 391,
1983 404, 399, 342, 405, 412, 421, 415, 428, 502, 503,
1984 504, 451, 422, 427, 453, 454, 432, 342, 433, 455,
1985 459, 324, 456, 457, 342, 463, 465, 466, 342, 342,
1986 470, 510, 511, 512, 513, 220, 514, 515, 467, 517,
1987 473, 472, 523, 485, 478, 406, 407, 408, 479, 480,
1988 471, 235, 236, 414, 481, 483, 484, 486, 65, 66,
1989 527, 528, 487, 489, 425, 426, 496, 509, 499, 501,
1990 235, 236, 507, 508, 518, 20, 519, 21, 220, 297,
1991 520, 521, 545, 410, 546, 547, 522, 524, 220, 220,
1992 220, 298, 299, 220, 526, 529, 530, 531, 532, 533,
1993 537, 541, 534, 535, 536, 543, 544, 458, 516, 460,
1994 542, 552, 553, 464, 554, 555, 556, 559, 560, 468,
1995 469, 561, 220, 563, 564, 174, 175, 176, 177, 375,
1996 97, 135, 136, 137, 138, 139, 140, 141, 142, 143,
1997 144, 145, 146, 300, 301, 374, 57, 449, 448, 105,
1998 315, 490, 491, 113, 494, 495, 27, 45, 462, 477,
1999 505, 500, 0, 0, 0, 0, 0, 0, 0, 506,
2000 302, 153, 154, 155, 156, 157, 158, 159, 160, 161,
2001 162, 163, 164, 0, 303, 167, 168, 169, 0, 304,
2002 305, 306, 0, 0, 0, 0, 0, 307, 0, 525,
2003 308, 0, 309, 65, 66, 310, 118, 68, 69, 70,
2004 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2005 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2006 0, 0, 0, 0, 0, 548, 0, 0, 0, 0,
2007 0, 0, 0, 0, 0, 0, 81, 0, 0, 0,
2008 558, 0, 0, 0, 0, 0, 0, 562, 0, 0,
2009 0, 565, 566, 65, 66, 0, 118, 68, 69, 70,
2010 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2011 20, 0, 21, 65, 66, 0, 118, 194, 195, 196,
2012 197, 198, 199, 200, 201, 202, 203, 204, 79, 80,
2013 20, 0, 21, 0, 0, 0, 81, 0, 65, 66,
2014 0, 118, 68, 69, 70, 71, 72, 73, 74, 75,
2015 76, 77, 78, 79, 80, 20, 81, 21, 0, 0,
2016 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
2017 217, 0, 83, 0, 0, 84, 0, 85, 119, 0,
2018 0, 81, 0, 0, 330, 331, 65, 66, 332, 0,
2019 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2020 0, 0, 0, 20, 0, 21, 0, 333, 334, 335,
2021 0, 0, 0, 0, 0, 0, 0, 0, 0, 336,
2022 337, 0, 0, 0, 0, 0, 0, 0, 0, 82,
2023 0, 0, 83, 0, 0, 84, 0, 85, 212, 0,
2024 0, 0, 338, 0, 0, 0, 0, 0, 0, 82,
2025 0, 0, 83, 0, 0, 84, 0, 85, 385, 135,
2026 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2027 146, 300, 301, 0, 82, 0, 0, 83, 0, 0,
2028 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
2029 0, 0, 0, 0, 0, 0, 0, 0, 302, 153,
2030 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2031 164, 0, 303, 167, 168, 169, 0, 304, 305, 306,
2032 330, 331, 0, 0, 332, 0, 0, -70, 339, 20,
2033 0, 21, 0, 0, 0, 0, 0, 0, 6, -70,
2034 -70, 0, 0, 333, 334, 335, 0, 0, -70, -70,
2035 -70, -70, -70, -70, -70, 336, 337, -70, 22, 0,
2036 0, 0, 0, 0, 0, 23, 0, 0, 0, 24,
2037 0, 0, 0, 0, 0, 0, 0, 0, 338, 0,
2038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2039 0, 0, 0, 0, 0, 135, 136, 137, 138, 139,
2040 140, 141, 142, 143, 144, 145, 146, 300, 301, 65,
2041 66, 0, 118, 194, 195, 196, 197, 198, 199, 200,
2042 201, 202, 203, 204, 79, 80, 20, 0, 21, 0,
2043 0, 0, 0, 0, 302, 153, 154, 155, 156, 157,
2044 158, 159, 160, 161, 162, 163, 164, 0, 303, 167,
2045 168, 169, 81, 304, 305, 306, 0, 0, 0, 0,
2046 0, 0, 65, 66, 339, 118, 68, 69, 70, 71,
2047 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
2048 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 323, 0, 0, 0, 0, 0,
2050 0, 0, 0, 65, 66, 81, 118, 68, 69, 70,
2051 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2052 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 0, 0, 400, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 82, 81, 0, 83, 0,
2055 381, 84, 0, 85, 65, 66, 0, 118, 68, 69,
2056 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2057 80, 20, 0, 21, 0, 0, 0, 0, 0, 0,
2058 0, 0, 0, 0, 0, 0, 447, 0, 0, 0,
2059 0, 0, 0, 0, 0, 0, 0, 81, 82, 0,
2060 0, 83, 0, 0, 84, 0, 85, 65, 66, 0,
2061 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2062 77, 78, 79, 80, 20, 0, 21, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
2064 0, 0, 83, 0, 0, 84, 0, 85, 65, 66,
2065 81, 118, 68, 69, 70, 71, 72, 73, 74, 75,
2066 76, 77, 78, 79, 80, 20, 0, 21, 65, 66,
2067 0, 118, 194, 195, 196, 197, 198, 199, 200, 201,
2068 202, 203, 204, 79, 80, 20, 0, 21, 0, 0,
2069 82, 81, 0, 83, 0, 0, 84, 0, 85, 0,
2070 0, 0, 0, 0, 0, 0, 0, 0, 0, 65,
2071 66, 81, 223, 68, 69, 70, 71, 72, 73, 74,
2072 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2075 0, 85, 81, 0, 0, 0, 0, 0, 0, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2077 0, 0, 0, 0, 0, 0, 0, 125, 0, 0,
2078 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
2079 84, 126, 85, 0, 0, 0, 0, 0, 0, 0,
2080 0, 127, 128, 0, 82, 0, 0, 83, 0, 0,
2081 84, 0, 85, 0, 129, 130, 131, 132, 133, 134,
2082 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
2083 145, 146, 147, 148, 0, 0, 0, 0, 0, 0,
2084 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2085 0, 84, 0, 85, 149, 150, 151, 0, 0, 152,
2086 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2087 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
2091 static const short int yycheck[] =
2093 37, 131, 131, 53, 268, 112, 4, 288, 289, 126,
2094 3, 29, 129, 208, 23, 15, 53, 34, 521, 308,
2095 309, 30, 132, 9, 142, 220, 539, 146, 15, 140,
2096 225, 226, 151, 151, 151, 21, 317, 540, 551, 150,
2097 57, 140, 237, 45, 85, 47, 140, 0, 41, 166,
2098 339, 150, 146, 170, 171, 172, 173, 57, 61, 176,
2099 177, 10, 11, 12, 13, 14, 15, 16, 17, 179,
2100 57, 140, 109, 110, 111, 270, 117, 55, 56, 57,
2101 0, 150, 123, 278, 279, 52, 53, 54, 148, 126,
2102 23, 151, 129, 139, 87, 10, 11, 12, 13, 14,
2103 15, 16, 17, 61, 71, 25, 32, 33, 140, 140,
2104 139, 31, 149, 150, 151, 152, 148, 148, 22, 24,
2105 24, 41, 42, 43, 44, 45, 46, 47, 165, 166,
2106 4, 149, 139, 170, 171, 172, 173, 174, 175, 176,
2107 177, 150, 62, 64, 65, 66, 67, 68, 69, 70,
2108 431, 149, 347, 348, 349, 140, 117, 55, 56, 20,
2109 355, 146, 123, 115, 116, 27, 28, 284, 139, 210,
2110 211, 366, 367, 214, 3, 4, 3, 4, 144, 216,
2111 41, 42, 43, 44, 45, 46, 47, 142, 238, 50,
2112 3, 4, 3, 4, 458, 139, 460, 146, 3, 4,
2113 139, 238, 92, 93, 94, 95, 96, 97, 98, 99,
2114 100, 101, 249, 4, 409, 4, 411, 27, 28, 142,
2115 415, 3, 4, 3, 4, 24, 421, 422, 4, 266,
2116 24, 146, 282, 3, 4, 3, 4, 3, 4, 24,
2117 357, 142, 359, 360, 361, 282, 283, 284, 365, 10,
2118 11, 12, 13, 14, 15, 16, 17, 145, 453, 454,
2119 145, 456, 457, 225, 226, 7, 59, 7, 463, 376,
2120 377, 378, 379, 380, 7, 237, 471, 148, 143, 36,
2121 140, 388, 389, 390, 391, 140, 140, 328, 98, 99,
2122 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2123 110, 111, 144, 140, 140, 140, 501, 140, 270, 140,
2124 140, 24, 140, 24, 140, 140, 278, 279, 142, 142,
2125 357, 358, 359, 360, 361, 432, 433, 364, 365, 148,
2126 142, 324, 439, 142, 142, 142, 142, 63, 142, 142,
2127 140, 143, 537, 140, 140, 140, 144, 34, 465, 466,
2128 467, 24, 140, 140, 21, 21, 142, 552, 142, 142,
2129 4, 398, 140, 140, 559, 140, 140, 140, 563, 564,
2130 142, 478, 479, 480, 481, 412, 483, 484, 140, 486,
2131 4, 24, 499, 36, 140, 347, 348, 349, 140, 140,
2132 427, 521, 521, 355, 140, 140, 140, 140, 5, 6,
2133 507, 508, 57, 140, 366, 367, 140, 143, 140, 140,
2134 540, 540, 140, 140, 4, 22, 24, 24, 455, 26,
2135 140, 144, 529, 57, 531, 532, 143, 146, 465, 466,
2136 467, 38, 39, 470, 143, 140, 143, 140, 140, 143,
2137 21, 36, 143, 143, 143, 143, 143, 409, 485, 411,
2138 146, 21, 143, 415, 143, 143, 140, 21, 140, 421,
2139 422, 76, 499, 21, 21, 97, 97, 97, 97, 301,
2140 41, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2141 87, 88, 89, 90, 91, 300, 25, 399, 398, 52,
2142 208, 453, 454, 61, 456, 457, 3, 19, 412, 434,
2143 470, 463, -1, -1, -1, -1, -1, -1, -1, 471,
2144 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2145 127, 128, 129, -1, 131, 132, 133, 134, -1, 136,
2146 137, 138, -1, -1, -1, -1, -1, 144, -1, 501,
2147 147, -1, 149, 5, 6, 152, 8, 9, 10, 11,
2148 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2149 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2150 -1, -1, -1, -1, -1, 537, -1, -1, -1, -1,
2151 -1, -1, -1, -1, -1, -1, 48, -1, -1, -1,
2152 552, -1, -1, -1, -1, -1, -1, 559, -1, -1,
2153 -1, 563, 564, 5, 6, -1, 8, 9, 10, 11,
2154 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2155 22, -1, 24, 5, 6, -1, 8, 9, 10, 11,
2156 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2157 22, -1, 24, -1, -1, -1, 48, -1, 5, 6,
2158 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2159 17, 18, 19, 20, 21, 22, 48, 24, -1, -1,
2160 -1, -1, -1, -1, -1, -1, -1, -1, -1, 141,
2161 37, -1, 144, -1, -1, 147, -1, 149, 150, -1,
2162 -1, 48, -1, -1, 3, 4, 5, 6, 7, -1,
2163 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2164 -1, -1, -1, 22, -1, 24, -1, 26, 27, 28,
2165 -1, -1, -1, -1, -1, -1, -1, -1, -1, 38,
2166 39, -1, -1, -1, -1, -1, -1, -1, -1, 141,
2167 -1, -1, 144, -1, -1, 147, -1, 149, 150, -1,
2168 -1, -1, 61, -1, -1, -1, -1, -1, -1, 141,
2169 -1, -1, 144, -1, -1, 147, -1, 149, 150, 78,
2170 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2171 89, 90, 91, -1, 141, -1, -1, 144, -1, -1,
2172 147, -1, 149, -1, -1, -1, -1, -1, -1, -1,
2173 -1, -1, -1, -1, -1, -1, -1, -1, 117, 118,
2174 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2175 129, -1, 131, 132, 133, 134, -1, 136, 137, 138,
2176 3, 4, -1, -1, 7, -1, -1, 20, 147, 22,
2177 -1, 24, -1, -1, -1, -1, -1, -1, 31, 32,
2178 33, -1, -1, 26, 27, 28, -1, -1, 41, 42,
2179 43, 44, 45, 46, 47, 38, 39, 50, 51, -1,
2180 -1, -1, -1, -1, -1, 58, -1, -1, -1, 62,
2181 -1, -1, -1, -1, -1, -1, -1, -1, 61, -1,
2182 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2183 -1, -1, -1, -1, -1, 78, 79, 80, 81, 82,
2184 83, 84, 85, 86, 87, 88, 89, 90, 91, 5,
2185 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2186 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2187 -1, -1, -1, -1, 117, 118, 119, 120, 121, 122,
2188 123, 124, 125, 126, 127, 128, 129, -1, 131, 132,
2189 133, 134, 48, 136, 137, 138, -1, -1, -1, -1,
2190 -1, -1, 5, 6, 147, 8, 9, 10, 11, 12,
2191 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2192 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2193 -1, -1, -1, -1, 37, -1, -1, -1, -1, -1,
2194 -1, -1, -1, 5, 6, 48, 8, 9, 10, 11,
2195 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2196 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2197 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
2198 -1, -1, -1, -1, -1, 141, 48, -1, 144, -1,
2199 146, 147, -1, 149, 5, 6, -1, 8, 9, 10,
2200 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2201 21, 22, -1, 24, -1, -1, -1, -1, -1, -1,
2202 -1, -1, -1, -1, -1, -1, 37, -1, -1, -1,
2203 -1, -1, -1, -1, -1, -1, -1, 48, 141, -1,
2204 -1, 144, -1, -1, 147, -1, 149, 5, 6, -1,
2205 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2206 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2207 -1, -1, -1, -1, -1, -1, -1, -1, -1, 141,
2208 -1, -1, 144, -1, -1, 147, -1, 149, 5, 6,
2209 48, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2210 17, 18, 19, 20, 21, 22, -1, 24, 5, 6,
2211 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2212 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2213 141, 48, -1, 144, -1, -1, 147, -1, 149, -1,
2214 -1, -1, -1, -1, -1, -1, -1, -1, -1, 5,
2215 6, 48, 8, 9, 10, 11, 12, 13, 14, 15,
2216 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2218 -1, -1, -1, 141, -1, -1, 144, -1, -1, 147,
2219 -1, 149, 48, -1, -1, -1, -1, -1, -1, -1,
2220 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2221 -1, -1, -1, -1, -1, -1, -1, 35, -1, -1,
2222 -1, -1, -1, -1, 141, -1, -1, 144, -1, -1,
2223 147, 49, 149, -1, -1, -1, -1, -1, -1, -1,
2224 -1, 59, 60, -1, 141, -1, -1, 144, -1, -1,
2225 147, -1, 149, -1, 72, 73, 74, 75, 76, 77,
2226 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2227 88, 89, 90, 91, -1, -1, -1, -1, -1, -1,
2228 -1, -1, -1, -1, -1, 141, -1, -1, 144, -1,
2229 -1, 147, -1, 149, 112, 113, 114, -1, -1, 117,
2230 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2231 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
2235 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2236 symbol of state STATE-NUM. */
2237 static const unsigned char yystos[] =
2239 0, 185, 186, 187, 0, 25, 31, 41, 42, 43,
2240 44, 45, 46, 47, 62, 166, 204, 206, 208, 215,
2241 22, 24, 51, 58, 62, 165, 197, 208, 209, 61,
2242 64, 65, 66, 67, 68, 69, 70, 167, 202, 23,
2243 216, 217, 30, 150, 205, 216, 52, 53, 54, 71,
2244 194, 139, 61, 20, 45, 47, 50, 166, 139, 45,
2245 47, 207, 24, 192, 4, 5, 6, 8, 9, 10,
2246 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2247 21, 48, 141, 144, 147, 149, 154, 174, 175, 176,
2248 177, 178, 197, 212, 29, 149, 203, 165, 220, 139,
2249 139, 139, 139, 144, 195, 192, 174, 32, 33, 184,
2250 184, 184, 184, 202, 4, 4, 4, 149, 8, 150,
2251 178, 179, 197, 142, 151, 35, 49, 59, 60, 72,
2252 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2253 83, 84, 85, 86, 87, 88, 89, 90, 91, 112,
2254 113, 114, 117, 118, 119, 120, 121, 122, 123, 124,
2255 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
2256 135, 136, 137, 138, 155, 156, 157, 158, 218, 224,
2257 225, 227, 228, 24, 55, 56, 193, 4, 24, 24,
2258 196, 176, 176, 176, 9, 10, 11, 12, 13, 14,
2259 15, 16, 17, 18, 19, 161, 162, 164, 176, 181,
2260 145, 145, 150, 179, 140, 150, 142, 37, 179, 180,
2261 176, 214, 59, 8, 214, 9, 21, 10, 11, 12,
2262 13, 14, 15, 16, 17, 161, 162, 163, 167, 92,
2263 93, 94, 95, 96, 97, 98, 99, 100, 101, 159,
2264 27, 28, 98, 99, 100, 101, 102, 103, 104, 105,
2265 106, 107, 108, 109, 110, 111, 160, 176, 176, 214,
2266 176, 176, 221, 214, 214, 214, 214, 214, 176, 176,
2267 214, 214, 167, 115, 116, 140, 146, 190, 191, 189,
2268 27, 28, 3, 4, 3, 4, 7, 26, 38, 39,
2269 90, 91, 117, 131, 136, 137, 138, 144, 147, 149,
2270 152, 155, 156, 157, 158, 182, 212, 188, 178, 178,
2271 148, 150, 178, 37, 176, 199, 200, 201, 140, 143,
2272 3, 4, 7, 26, 27, 28, 38, 39, 61, 147,
2273 182, 211, 212, 213, 213, 213, 213, 174, 176, 176,
2274 140, 169, 140, 169, 213, 144, 140, 140, 140, 140,
2275 140, 140, 213, 213, 36, 140, 174, 176, 214, 24,
2276 140, 172, 172, 172, 159, 160, 142, 142, 142, 142,
2277 142, 146, 181, 183, 183, 150, 183, 24, 142, 142,
2278 142, 142, 172, 146, 148, 148, 197, 198, 140, 143,
2279 37, 63, 210, 183, 140, 140, 213, 213, 213, 15,
2280 57, 15, 140, 226, 213, 144, 214, 176, 214, 214,
2281 214, 140, 140, 176, 214, 213, 213, 140, 34, 57,
2282 170, 173, 142, 142, 181, 181, 181, 181, 181, 140,
2283 146, 148, 150, 181, 181, 181, 181, 37, 199, 170,
2284 171, 24, 148, 21, 21, 142, 140, 140, 213, 4,
2285 213, 214, 222, 140, 213, 140, 140, 140, 213, 213,
2286 142, 176, 24, 4, 172, 181, 181, 226, 140, 140,
2287 140, 140, 181, 140, 140, 36, 140, 57, 168, 140,
2288 213, 213, 222, 223, 213, 213, 140, 169, 169, 140,
2289 213, 140, 214, 214, 214, 223, 213, 140, 140, 143,
2290 181, 181, 181, 181, 181, 181, 176, 181, 4, 24,
2291 140, 144, 143, 214, 146, 213, 143, 181, 181, 140,
2292 143, 140, 140, 143, 143, 143, 143, 21, 146, 163,
2293 219, 36, 146, 143, 143, 181, 181, 181, 213, 211,
2294 146, 163, 21, 143, 143, 143, 140, 211, 213, 21,
2295 140, 76, 213, 21, 21, 213, 213
2298 #define yyerrok (yyerrstatus = 0)
2299 #define yyclearin (yychar = YYEMPTY)
2300 #define YYEMPTY (-2)
2303 #define YYACCEPT goto yyacceptlab
2304 #define YYABORT goto yyabortlab
2305 #define YYERROR goto yyerrorlab
2308 /* Like YYERROR except do call yyerror. This remains here temporarily
2309 to ease the transition to the new meaning of YYERROR, for GCC.
2310 Once GCC version 2 has supplanted version 1, this can go. */
2312 #define YYFAIL goto yyerrlab
2314 #define YYRECOVERING() (!!yyerrstatus)
2316 #define YYBACKUP(Token, Value) \
2318 if (yychar == YYEMPTY && yylen == 1) \
2322 yytoken = YYTRANSLATE (yychar); \
2328 yyerror (YY_("syntax error: cannot back up")); \
2335 #define YYERRCODE 256
2338 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2339 If N is 0, then set CURRENT to the empty location which ends
2340 the previous symbol: RHS[0] (always defined). */
2342 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2343 #ifndef YYLLOC_DEFAULT
2344 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2348 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2349 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2350 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2351 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2355 (Current).first_line = (Current).last_line = \
2356 YYRHSLOC (Rhs, 0).last_line; \
2357 (Current).first_column = (Current).last_column = \
2358 YYRHSLOC (Rhs, 0).last_column; \
2364 /* YY_LOCATION_PRINT -- Print the location on the stream.
2365 This macro was not mandated originally: define only if we know
2366 we won't break user code: when these are the locations we know. */
2368 #ifndef YY_LOCATION_PRINT
2369 # if YYLTYPE_IS_TRIVIAL
2370 # define YY_LOCATION_PRINT(File, Loc) \
2371 fprintf (File, "%d.%d-%d.%d", \
2372 (Loc).first_line, (Loc).first_column, \
2373 (Loc).last_line, (Loc).last_column)
2375 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2380 /* YYLEX -- calling `yylex' with the right arguments. */
2383 # define YYLEX yylex (YYLEX_PARAM)
2385 # define YYLEX yylex ()
2388 /* Enable debugging if requested. */
2392 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2393 # define YYFPRINTF fprintf
2396 # define YYDPRINTF(Args) \
2402 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2406 YYFPRINTF (stderr, "%s ", Title); \
2407 yysymprint (stderr, \
2409 YYFPRINTF (stderr, "\n"); \
2413 /*------------------------------------------------------------------.
2414 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2416 `------------------------------------------------------------------*/
2418 #if defined (__STDC__) || defined (__cplusplus)
2420 yy_stack_print (short int *bottom, short int *top)
2423 yy_stack_print (bottom, top)
2428 YYFPRINTF (stderr, "Stack now");
2429 for (/* Nothing. */; bottom <= top; ++bottom)
2430 YYFPRINTF (stderr, " %d", *bottom);
2431 YYFPRINTF (stderr, "\n");
2434 # define YY_STACK_PRINT(Bottom, Top) \
2437 yy_stack_print ((Bottom), (Top)); \
2441 /*------------------------------------------------.
2442 | Report that the YYRULE is going to be reduced. |
2443 `------------------------------------------------*/
2445 #if defined (__STDC__) || defined (__cplusplus)
2447 yy_reduce_print (int yyrule)
2450 yy_reduce_print (yyrule)
2455 unsigned long int yylno = yyrline[yyrule];
2456 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2458 /* Print the symbols being reduced, and their result. */
2459 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2460 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2461 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2464 # define YY_REDUCE_PRINT(Rule) \
2467 yy_reduce_print (Rule); \
2470 /* Nonzero means print parse trace. It is left uninitialized so that
2471 multiple parsers can coexist. */
2473 #else /* !YYDEBUG */
2474 # define YYDPRINTF(Args)
2475 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2476 # define YY_STACK_PRINT(Bottom, Top)
2477 # define YY_REDUCE_PRINT(Rule)
2478 #endif /* !YYDEBUG */
2481 /* YYINITDEPTH -- initial size of the parser's stacks. */
2483 # define YYINITDEPTH 200
2486 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2487 if the built-in stack extension method is used).
2489 Do not make this value too large; the results are undefined if
2490 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2491 evaluated with infinite-precision integer arithmetic. */
2494 # define YYMAXDEPTH 10000
2502 # if defined (__GLIBC__) && defined (_STRING_H)
2503 # define yystrlen strlen
2505 /* Return the length of YYSTR. */
2507 # if defined (__STDC__) || defined (__cplusplus)
2508 yystrlen (const char *yystr)
2514 const char *yys = yystr;
2516 while (*yys++ != '\0')
2519 return yys - yystr - 1;
2525 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2526 # define yystpcpy stpcpy
2528 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2531 # if defined (__STDC__) || defined (__cplusplus)
2532 yystpcpy (char *yydest, const char *yysrc)
2534 yystpcpy (yydest, yysrc)
2540 const char *yys = yysrc;
2542 while ((*yyd++ = *yys++) != '\0')
2551 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2552 quotes and backslashes, so that it's suitable for yyerror. The
2553 heuristic is that double-quoting is unnecessary unless the string
2554 contains an apostrophe, a comma, or backslash (other than
2555 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2556 null, do not copy; instead, return the length of what the result
2559 yytnamerr (char *yyres, const char *yystr)
2564 char const *yyp = yystr;
2571 goto do_not_strip_quotes;
2575 goto do_not_strip_quotes;
2588 do_not_strip_quotes: ;
2592 return yystrlen (yystr);
2594 return yystpcpy (yyres, yystr) - yyres;
2598 #endif /* YYERROR_VERBOSE */
2603 /*--------------------------------.
2604 | Print this symbol on YYOUTPUT. |
2605 `--------------------------------*/
2607 #if defined (__STDC__) || defined (__cplusplus)
2609 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2612 yysymprint (yyoutput, yytype, yyvaluep)
2618 /* Pacify ``unused variable'' warnings. */
2621 if (yytype < YYNTOKENS)
2622 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2624 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2628 if (yytype < YYNTOKENS)
2629 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2636 YYFPRINTF (yyoutput, ")");
2639 #endif /* ! YYDEBUG */
2640 /*-----------------------------------------------.
2641 | Release the memory associated to this symbol. |
2642 `-----------------------------------------------*/
2644 #if defined (__STDC__) || defined (__cplusplus)
2646 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2649 yydestruct (yymsg, yytype, yyvaluep)
2655 /* Pacify ``unused variable'' warnings. */
2660 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2671 /* Prevent warnings from -Wmissing-prototypes. */
2673 #ifdef YYPARSE_PARAM
2674 # if defined (__STDC__) || defined (__cplusplus)
2675 int yyparse (void *YYPARSE_PARAM);
2679 #else /* ! YYPARSE_PARAM */
2680 #if defined (__STDC__) || defined (__cplusplus)
2685 #endif /* ! YYPARSE_PARAM */
2689 /* The look-ahead symbol. */
2692 /* The semantic value of the look-ahead symbol. */
2695 /* Number of syntax errors so far. */
2704 #ifdef YYPARSE_PARAM
2705 # if defined (__STDC__) || defined (__cplusplus)
2706 int yyparse (void *YYPARSE_PARAM)
2708 int yyparse (YYPARSE_PARAM)
2709 void *YYPARSE_PARAM;
2711 #else /* ! YYPARSE_PARAM */
2712 #if defined (__STDC__) || defined (__cplusplus)
2726 /* Number of tokens to shift before error messages enabled. */
2728 /* Look-ahead token as an internal (translated) token number. */
2731 /* Three stacks and their tools:
2732 `yyss': related to states,
2733 `yyvs': related to semantic values,
2734 `yyls': related to locations.
2736 Refer to the stacks thru separate pointers, to allow yyoverflow
2737 to reallocate them elsewhere. */
2739 /* The state stack. */
2740 short int yyssa[YYINITDEPTH];
2741 short int *yyss = yyssa;
2744 /* The semantic value stack. */
2745 YYSTYPE yyvsa[YYINITDEPTH];
2746 YYSTYPE *yyvs = yyvsa;
2751 #define YYPOPSTACK (yyvsp--, yyssp--)
2753 YYSIZE_T yystacksize = YYINITDEPTH;
2755 /* The variables used to return semantic value and location from the
2760 /* When reducing, the number of symbols on the RHS of the reduced
2764 YYDPRINTF ((stderr, "Starting parse\n"));
2769 yychar = YYEMPTY; /* Cause a token to be read. */
2771 /* Initialize stack pointers.
2772 Waste one element of value and location stack
2773 so that they stay on the same level as the state stack.
2774 The wasted elements are never initialized. */
2781 /*------------------------------------------------------------.
2782 | yynewstate -- Push a new state, which is found in yystate. |
2783 `------------------------------------------------------------*/
2785 /* In all cases, when you get here, the value and location stacks
2786 have just been pushed. so pushing a state here evens the stacks.
2793 if (yyss + yystacksize - 1 <= yyssp)
2795 /* Get the current used size of the three stacks, in elements. */
2796 YYSIZE_T yysize = yyssp - yyss + 1;
2800 /* Give user a chance to reallocate the stack. Use copies of
2801 these so that the &'s don't force the real ones into
2803 YYSTYPE *yyvs1 = yyvs;
2804 short int *yyss1 = yyss;
2807 /* Each stack pointer address is followed by the size of the
2808 data in use in that stack, in bytes. This used to be a
2809 conditional around just the two extra args, but that might
2810 be undefined if yyoverflow is a macro. */
2811 yyoverflow (YY_("memory exhausted"),
2812 &yyss1, yysize * sizeof (*yyssp),
2813 &yyvs1, yysize * sizeof (*yyvsp),
2820 #else /* no yyoverflow */
2821 # ifndef YYSTACK_RELOCATE
2822 goto yyexhaustedlab;
2824 /* Extend the stack our own way. */
2825 if (YYMAXDEPTH <= yystacksize)
2826 goto yyexhaustedlab;
2828 if (YYMAXDEPTH < yystacksize)
2829 yystacksize = YYMAXDEPTH;
2832 short int *yyss1 = yyss;
2833 union yyalloc *yyptr =
2834 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2836 goto yyexhaustedlab;
2837 YYSTACK_RELOCATE (yyss);
2838 YYSTACK_RELOCATE (yyvs);
2840 # undef YYSTACK_RELOCATE
2842 YYSTACK_FREE (yyss1);
2845 #endif /* no yyoverflow */
2847 yyssp = yyss + yysize - 1;
2848 yyvsp = yyvs + yysize - 1;
2851 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2852 (unsigned long int) yystacksize));
2854 if (yyss + yystacksize - 1 <= yyssp)
2858 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2867 /* Do appropriate processing given the current state. */
2868 /* Read a look-ahead token if we need one and don't already have one. */
2871 /* First try to decide what to do without reference to look-ahead token. */
2873 yyn = yypact[yystate];
2874 if (yyn == YYPACT_NINF)
2877 /* Not known => get a look-ahead token if don't already have one. */
2879 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2880 if (yychar == YYEMPTY)
2882 YYDPRINTF ((stderr, "Reading a token: "));
2886 if (yychar <= YYEOF)
2888 yychar = yytoken = YYEOF;
2889 YYDPRINTF ((stderr, "Now at end of input.\n"));
2893 yytoken = YYTRANSLATE (yychar);
2894 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2897 /* If the proper action on seeing token YYTOKEN is to reduce or to
2898 detect an error, take that action. */
2900 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2905 if (yyn == 0 || yyn == YYTABLE_NINF)
2914 /* Shift the look-ahead token. */
2915 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2917 /* Discard the token being shifted unless it is eof. */
2918 if (yychar != YYEOF)
2924 /* Count tokens shifted since error; after three, turn off error
2933 /*-----------------------------------------------------------.
2934 | yydefault -- do the default action for the current state. |
2935 `-----------------------------------------------------------*/
2937 yyn = yydefact[yystate];
2943 /*-----------------------------.
2944 | yyreduce -- Do a reduction. |
2945 `-----------------------------*/
2947 /* yyn is the number of a rule to reduce with. */
2950 /* If YYLEN is nonzero, implement the default value of the action:
2953 Otherwise, the following line sets YYVAL to garbage.
2954 This behavior is undocumented and Bison
2955 users should not rely upon it. Assigning to YYVAL
2956 unconditionally makes the parser a bit smaller, and it avoids a
2957 GCC warning that YYVAL may be used uninitialized. */
2958 yyval = yyvsp[1-yylen];
2961 YY_REDUCE_PRINT (yyn);
2965 #line 989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2967 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
2968 GEN_ERROR("Value too large for type!");
2969 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
2975 #line 1005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2976 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
2980 #line 1005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2981 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
2985 #line 1006 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2986 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
2990 #line 1006 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2991 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
2995 #line 1007 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2996 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3000 #line 1007 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3001 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3005 #line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3006 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3010 #line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3011 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3015 #line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3016 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3020 #line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3021 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3025 #line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3026 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3030 #line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3031 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3035 #line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3036 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3040 #line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3041 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3045 #line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3046 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3050 #line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3051 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3055 #line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3056 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3060 #line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3061 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3065 #line 1017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3066 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3070 #line 1017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3071 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3075 #line 1018 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3076 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3080 #line 1018 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3081 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3085 #line 1019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3086 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3090 #line 1019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3091 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3095 #line 1020 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3096 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3100 #line 1021 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3101 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3105 #line 1032 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3107 (yyval.StrVal) = (yyvsp[-1].StrVal);
3113 #line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3121 #line 1041 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3122 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3126 #line 1042 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3127 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3131 #line 1043 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3132 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3136 #line 1044 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3137 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3141 #line 1045 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3142 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3146 #line 1046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3147 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3151 #line 1047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3152 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3156 #line 1048 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3157 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3161 #line 1050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3162 { (yyval.UIntVal) = CallingConv::C; ;}
3166 #line 1051 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3167 { (yyval.UIntVal) = CallingConv::C; ;}
3171 #line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3172 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3176 #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3177 { (yyval.UIntVal) = CallingConv::Fast; ;}
3181 #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3182 { (yyval.UIntVal) = CallingConv::Cold; ;}
3186 #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3187 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3191 #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3192 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3196 #line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3198 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3199 GEN_ERROR("Calling conv too large!");
3200 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3206 #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3207 { (yyval.UIntVal) = 0; ;}
3211 #line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3213 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3214 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3215 GEN_ERROR("Alignment must be a power of two!");
3221 #line 1073 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3222 { (yyval.UIntVal) = 0; ;}
3226 #line 1074 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3228 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3229 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3230 GEN_ERROR("Alignment must be a power of two!");
3236 #line 1082 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3238 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3239 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3240 GEN_ERROR("Invalid character in section name!");
3241 (yyval.StrVal) = (yyvsp[0].StrVal);
3247 #line 1090 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3248 { (yyval.StrVal) = 0; ;}
3252 #line 1091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3253 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3257 #line 1096 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3262 #line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3267 #line 1098 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3269 CurGV->setSection((yyvsp[0].StrVal));
3270 free((yyvsp[0].StrVal));
3276 #line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3278 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3279 GEN_ERROR("Alignment must be a power of two!");
3280 CurGV->setAlignment((yyvsp[0].UInt64Val));
3286 #line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3287 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3291 #line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3292 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3296 #line 1120 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3298 if (!UpRefs.empty())
3299 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3300 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3306 #line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3308 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3314 #line 1136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3316 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3322 #line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3323 { // Named types are also simple types...
3324 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3326 (yyval.TypeVal) = new PATypeHolder(tmp);
3331 #line 1148 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3332 { // Type UpReference
3333 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3334 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3335 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3336 (yyval.TypeVal) = new PATypeHolder(OT);
3337 UR_OUT("New Upreference!\n");
3343 #line 1156 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3344 { // Function derived type?
3345 std::vector<const Type*> Params;
3346 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3347 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3348 Params.push_back(*I);
3349 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3350 if (isVarArg) Params.pop_back();
3352 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3353 delete (yyvsp[-1].TypeList); // Delete the argument list
3354 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3360 #line 1169 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3361 { // Sized array type?
3362 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3363 delete (yyvsp[-1].TypeVal);
3369 #line 1174 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3370 { // Packed array type?
3371 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3372 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3373 GEN_ERROR("Unsigned result not equal to signed result");
3374 if (!ElemTy->isPrimitiveType())
3375 GEN_ERROR("Elemental type of a PackedType must be primitive");
3376 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3377 GEN_ERROR("Vector length should be a power of 2!");
3378 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3379 delete (yyvsp[-1].TypeVal);
3385 #line 1186 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3386 { // Structure type?
3387 std::vector<const Type*> Elements;
3388 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3389 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3390 Elements.push_back(*I);
3392 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3393 delete (yyvsp[-1].TypeList);
3399 #line 1196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3400 { // Empty structure type?
3401 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3407 #line 1200 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3409 std::vector<const Type*> Elements;
3410 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3411 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3412 Elements.push_back(*I);
3414 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3415 delete (yyvsp[-2].TypeList);
3421 #line 1210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3422 { // Empty structure type?
3423 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3429 #line 1214 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3431 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3432 GEN_ERROR("Cannot form a pointer to a basic block");
3433 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3434 delete (yyvsp[-1].TypeVal);
3440 #line 1225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3442 (yyval.TypeList) = new std::list<PATypeHolder>();
3443 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3449 #line 1230 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3451 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3457 #line 1237 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3459 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3465 #line 1241 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3467 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3473 #line 1245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3475 (yyval.TypeList) = new std::list<PATypeHolder>();
3481 #line 1256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3482 { // Nonempty unsized arr
3483 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3485 GEN_ERROR("Cannot make array constant with type: '" +
3486 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3487 const Type *ETy = ATy->getElementType();
3488 int NumElements = ATy->getNumElements();
3490 // Verify that we have the correct size...
3491 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3492 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3493 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3494 itostr(NumElements) + "!");
3496 // Verify all elements are correct type!
3497 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3498 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3499 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3500 ETy->getDescription() +"' as required!\nIt is of type '"+
3501 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3504 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3505 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3511 #line 1282 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3513 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3515 GEN_ERROR("Cannot make array constant with type: '" +
3516 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3518 int NumElements = ATy->getNumElements();
3519 if (NumElements != -1 && NumElements != 0)
3520 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3521 " arguments, but has size of " + itostr(NumElements) +"!");
3522 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3523 delete (yyvsp[-2].TypeVal);
3529 #line 1296 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3531 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3533 GEN_ERROR("Cannot make array constant with type: '" +
3534 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3536 int NumElements = ATy->getNumElements();
3537 const Type *ETy = ATy->getElementType();
3538 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3539 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3540 GEN_ERROR("Can't build string constant of size " +
3541 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3542 " when array has size " + itostr(NumElements) + "!");
3543 std::vector<Constant*> Vals;
3544 if (ETy == Type::SByteTy) {
3545 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3546 Vals.push_back(ConstantInt::get(ETy, *C));
3547 } else if (ETy == Type::UByteTy) {
3548 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3549 C != (unsigned char*)EndStr; ++C)
3550 Vals.push_back(ConstantInt::get(ETy, *C));
3552 free((yyvsp[0].StrVal));
3553 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3555 free((yyvsp[0].StrVal));
3556 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3557 delete (yyvsp[-2].TypeVal);
3563 #line 1326 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3564 { // Nonempty unsized arr
3565 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3567 GEN_ERROR("Cannot make packed constant with type: '" +
3568 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3569 const Type *ETy = PTy->getElementType();
3570 int NumElements = PTy->getNumElements();
3572 // Verify that we have the correct size...
3573 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3574 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3575 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3576 itostr(NumElements) + "!");
3578 // Verify all elements are correct type!
3579 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3580 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3581 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3582 ETy->getDescription() +"' as required!\nIt is of type '"+
3583 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3586 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3587 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3593 #line 1352 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3595 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3597 GEN_ERROR("Cannot make struct constant with type: '" +
3598 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3600 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3601 GEN_ERROR("Illegal number of initializers for structure type!");
3603 // Check to ensure that constants are compatible with the type initializer!
3604 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3605 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3606 GEN_ERROR("Expected type '" +
3607 STy->getElementType(i)->getDescription() +
3608 "' for element #" + utostr(i) +
3609 " of structure initializer!");
3611 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3612 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3618 #line 1373 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3620 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3622 GEN_ERROR("Cannot make struct constant with type: '" +
3623 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3625 if (STy->getNumContainedTypes() != 0)
3626 GEN_ERROR("Illegal number of initializers for structure type!");
3628 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3629 delete (yyvsp[-2].TypeVal);
3635 #line 1386 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3637 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3639 GEN_ERROR("Cannot make null pointer constant with type: '" +
3640 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3642 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3643 delete (yyvsp[-1].TypeVal);
3649 #line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3651 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3652 delete (yyvsp[-1].TypeVal);
3658 #line 1401 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3660 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3662 GEN_ERROR("Global const reference must be a pointer type!");
3664 // ConstExprs can exist in the body of a function, thus creating
3665 // GlobalValues whenever they refer to a variable. Because we are in
3666 // the context of a function, getValNonImprovising will search the functions
3667 // symbol table instead of the module symbol table for the global symbol,
3668 // which throws things all off. To get around this, we just tell
3669 // getValNonImprovising that we are at global scope here.
3671 Function *SavedCurFn = CurFun.CurrentFunction;
3672 CurFun.CurrentFunction = 0;
3674 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3677 CurFun.CurrentFunction = SavedCurFn;
3679 // If this is an initializer for a constant pointer, which is referencing a
3680 // (currently) undefined variable, create a stub now that shall be replaced
3681 // in the future with the right type of variable.
3684 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3685 const PointerType *PT = cast<PointerType>(Ty);
3687 // First check to see if the forward references value is already created!
3688 PerModuleInfo::GlobalRefsType::iterator I =
3689 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3691 if (I != CurModule.GlobalRefs.end()) {
3692 V = I->second; // Placeholder already exists, use it...
3693 (yyvsp[0].ValIDVal).destroy();
3696 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3698 // Create the forward referenced global.
3700 if (const FunctionType *FTy =
3701 dyn_cast<FunctionType>(PT->getElementType())) {
3702 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3703 CurModule.CurrentModule);
3705 GV = new GlobalVariable(PT->getElementType(), false,
3706 GlobalValue::ExternalLinkage, 0,
3707 Name, CurModule.CurrentModule);
3710 // Keep track of the fact that we have a forward ref to recycle it
3711 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3716 (yyval.ConstVal) = cast<GlobalValue>(V);
3717 delete (yyvsp[-1].TypeVal); // Free the type handle
3723 #line 1462 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3725 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3726 GEN_ERROR("Mismatched types for constant expression!");
3727 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3728 delete (yyvsp[-1].TypeVal);
3734 #line 1469 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3736 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3737 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3738 GEN_ERROR("Cannot create a null initialized value of this type!");
3739 (yyval.ConstVal) = Constant::getNullValue(Ty);
3740 delete (yyvsp[-1].TypeVal);
3746 #line 1477 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3747 { // integral constants
3748 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3749 GEN_ERROR("Constant value doesn't fit in type!");
3750 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3756 #line 1483 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3757 { // integral constants
3758 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3759 GEN_ERROR("Constant value doesn't fit in type!");
3760 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3766 #line 1489 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3767 { // integral constants
3768 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3769 GEN_ERROR("Constant value doesn't fit in type!");
3770 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3776 #line 1495 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3778 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3779 GEN_ERROR("Constant value doesn't fit in type!");
3780 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3786 #line 1501 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3787 { // Boolean constants
3788 (yyval.ConstVal) = ConstantBool::getTrue();
3794 #line 1505 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3795 { // Boolean constants
3796 (yyval.ConstVal) = ConstantBool::getFalse();
3802 #line 1509 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3803 { // Float & Double constants
3804 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3805 GEN_ERROR("Floating point constant invalid for type!!");
3806 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3812 #line 1517 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3814 Constant *Val = (yyvsp[-3].ConstVal);
3815 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3816 if (!Val->getType()->isFirstClassType())
3817 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3818 Val->getType()->getDescription() + "'!");
3819 if (!Ty->isFirstClassType())
3820 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3821 Ty->getDescription() + "'!");
3822 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3823 delete (yyvsp[-1].TypeVal);
3828 #line 1529 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3830 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3831 GEN_ERROR("GetElementPtr requires a pointer operand!");
3834 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3836 GEN_ERROR("Index list invalid for constant getelementptr!");
3838 std::vector<Constant*> IdxVec;
3839 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3840 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3841 IdxVec.push_back(C);
3843 GEN_ERROR("Indices to constant getelementptr must be constants!");
3845 delete (yyvsp[-1].ValueList);
3847 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3853 #line 1550 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3855 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3856 GEN_ERROR("Select condition must be of boolean type!");
3857 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3858 GEN_ERROR("Select operand types must match!");
3859 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3865 #line 1558 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3867 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3868 GEN_ERROR("Binary operator types must match!");
3870 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3875 #line 1564 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3877 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3878 GEN_ERROR("Logical operator types must match!");
3879 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
3880 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
3881 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
3882 GEN_ERROR("Logical operator requires integral operands!");
3884 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3890 #line 1575 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3892 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3893 GEN_ERROR("icmp operand types must match!");
3894 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3899 #line 1580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3901 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3902 GEN_ERROR("fcmp operand types must match!");
3903 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3908 #line 1585 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3910 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
3911 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3912 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
3913 GEN_ERROR("Shift constant expression requires integer operand!");
3915 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3921 #line 1594 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3923 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3924 GEN_ERROR("Invalid extractelement operands!");
3925 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3931 #line 1600 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3933 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3934 GEN_ERROR("Invalid insertelement operands!");
3935 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3941 #line 1606 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3943 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3944 GEN_ERROR("Invalid shufflevector operands!");
3945 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3951 #line 1615 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3953 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
3959 #line 1619 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3961 (yyval.ConstVector) = new std::vector<Constant*>();
3962 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
3968 #line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3969 { (yyval.BoolVal) = false; ;}
3973 #line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3974 { (yyval.BoolVal) = true; ;}
3978 #line 1637 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3980 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
3981 CurModule.ModuleDone();
3987 #line 1645 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3989 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3990 CurFun.FunctionDone();
3996 #line 1650 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3998 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4004 #line 1654 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4006 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4012 #line 1658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4014 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4020 #line 1662 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4022 (yyval.ModuleVal) = CurModule.CurrentModule;
4023 // Emit an error if there are any unresolved types left.
4024 if (!CurModule.LateResolveTypes.empty()) {
4025 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4026 if (DID.Type == ValID::NameVal) {
4027 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4029 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4037 #line 1677 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4039 // Eagerly resolve types. This is not an optimization, this is a
4040 // requirement that is due to the fact that we could have this:
4042 // %list = type { %list * }
4043 // %list = type { %list * } ; repeated type decl
4045 // If types are not resolved eagerly, then the two types will not be
4046 // determined to be the same type!
4048 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4050 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4052 // If this is a named type that is not a redefinition, add it to the slot
4054 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4057 delete (yyvsp[0].TypeVal);
4063 #line 1699 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4064 { // Function prototypes can be in const pool
4070 #line 1702 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4071 { // Asm blocks can be in the const pool
4077 #line 1705 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4079 if ((yyvsp[0].ConstVal) == 0)
4080 GEN_ERROR("Global value initializer is not a constant!");
4081 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4087 #line 1710 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4094 #line 1713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4096 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4098 delete (yyvsp[0].TypeVal);
4103 #line 1717 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4111 #line 1721 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4113 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4115 delete (yyvsp[0].TypeVal);
4120 #line 1725 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4128 #line 1729 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4131 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4133 delete (yyvsp[0].TypeVal);
4138 #line 1734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4146 #line 1738 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4153 #line 1741 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4160 #line 1744 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4166 #line 1748 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4168 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4169 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4170 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4171 free((yyvsp[0].StrVal));
4173 if (AsmSoFar.empty())
4174 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4176 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4182 #line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4183 { (yyval.Endianness) = Module::BigEndian; ;}
4187 #line 1762 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4188 { (yyval.Endianness) = Module::LittleEndian; ;}
4192 #line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4194 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4200 #line 1768 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4202 if ((yyvsp[0].UInt64Val) == 32)
4203 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4204 else if ((yyvsp[0].UInt64Val) == 64)
4205 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4207 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4213 #line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4215 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4216 free((yyvsp[0].StrVal));
4221 #line 1781 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4223 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4224 free((yyvsp[0].StrVal));
4229 #line 1788 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4231 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4232 free((yyvsp[0].StrVal));
4238 #line 1793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4240 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4241 free((yyvsp[0].StrVal));
4247 #line 1798 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4254 #line 1808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4255 { (yyval.StrVal) = 0; ;}
4259 #line 1810 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4261 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4262 GEN_ERROR("void typed arguments are invalid!");
4263 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4269 #line 1817 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4271 (yyval.ArgList) = (yyvsp[-2].ArgList);
4272 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4273 delete (yyvsp[0].ArgVal);
4279 #line 1823 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4281 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4282 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4283 delete (yyvsp[0].ArgVal);
4289 #line 1830 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4291 (yyval.ArgList) = (yyvsp[0].ArgList);
4297 #line 1834 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4299 (yyval.ArgList) = (yyvsp[-2].ArgList);
4300 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4301 char*>(new PATypeHolder(Type::VoidTy), 0));
4307 #line 1840 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4309 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4310 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4316 #line 1845 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4318 (yyval.ArgList) = 0;
4324 #line 1851 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4326 UnEscapeLexed((yyvsp[-5].StrVal));
4327 std::string FunctionName((yyvsp[-5].StrVal));
4328 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4330 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4331 GEN_ERROR("LLVM functions cannot return aggregate types!");
4333 std::vector<const Type*> ParamTypeList;
4334 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4335 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4336 I != (yyvsp[-3].ArgList)->end(); ++I)
4337 ParamTypeList.push_back(I->first->get());
4340 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4341 if (isVarArg) ParamTypeList.pop_back();
4343 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4344 const PointerType *PFT = PointerType::get(FT);
4345 delete (yyvsp[-6].TypeVal);
4348 if (!FunctionName.empty()) {
4349 ID = ValID::create((char*)FunctionName.c_str());
4351 ID = ValID::create((int)CurModule.Values[PFT].size());
4355 // See if this function was forward referenced. If so, recycle the object.
4356 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4357 // Move the function to the end of the list, from whereever it was
4358 // previously inserted.
4359 Fn = cast<Function>(FWRef);
4360 CurModule.CurrentModule->getFunctionList().remove(Fn);
4361 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4362 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4363 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4364 // If this is the case, either we need to be a forward decl, or it needs
4366 if (!CurFun.isDeclare && !Fn->isExternal())
4367 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4369 // Make sure to strip off any argument names so we can't get conflicts.
4370 if (Fn->isExternal())
4371 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4374 } else { // Not already defined?
4375 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4376 CurModule.CurrentModule);
4378 InsertValue(Fn, CurModule.Values);
4381 CurFun.FunctionStart(Fn);
4383 if (CurFun.isDeclare) {
4384 // If we have declaration, always overwrite linkage. This will allow us to
4385 // correctly handle cases, when pointer to function is passed as argument to
4386 // another function.
4387 Fn->setLinkage(CurFun.Linkage);
4389 Fn->setCallingConv((yyvsp[-7].UIntVal));
4390 Fn->setAlignment((yyvsp[0].UIntVal));
4391 if ((yyvsp[-1].StrVal)) {
4392 Fn->setSection((yyvsp[-1].StrVal));
4393 free((yyvsp[-1].StrVal));
4396 // Add all of the arguments we parsed to the function...
4397 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4398 if (isVarArg) { // Nuke the last entry
4399 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4400 "Not a varargs marker!");
4401 delete (yyvsp[-3].ArgList)->back().first;
4402 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4404 Function::arg_iterator ArgIt = Fn->arg_begin();
4405 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4406 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4407 delete I->first; // Delete the typeholder...
4409 setValueName(ArgIt, I->second); // Insert arg into symtab...
4414 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4421 #line 1947 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4423 (yyval.FunctionVal) = CurFun.CurrentFunction;
4425 // Make sure that we keep track of the linkage type even if there was a
4426 // previous "declare".
4427 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4432 #line 1957 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4434 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4440 #line 1963 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4441 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4445 #line 1964 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4446 { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4450 #line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4451 { CurFun.isDeclare = true; ;}
4455 #line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4457 (yyval.FunctionVal) = CurFun.CurrentFunction;
4458 CurFun.FunctionDone();
4464 #line 1976 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4466 (yyval.BoolVal) = false;
4472 #line 1980 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4474 (yyval.BoolVal) = true;
4480 #line 1985 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4481 { // A reference to a direct constant
4482 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4488 #line 1989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4490 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4496 #line 1993 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4497 { // Perhaps it's an FP constant?
4498 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4504 #line 1997 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4506 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4512 #line 2001 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4514 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4520 #line 2005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4522 (yyval.ValIDVal) = ValID::createNull();
4528 #line 2009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4530 (yyval.ValIDVal) = ValID::createUndef();
4536 #line 2013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4537 { // A vector zero constant.
4538 (yyval.ValIDVal) = ValID::createZeroInit();
4544 #line 2017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4545 { // Nonempty unsized packed vector
4546 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4547 int NumElements = (yyvsp[-1].ConstVector)->size();
4549 PackedType* pt = PackedType::get(ETy, NumElements);
4550 PATypeHolder* PTy = new PATypeHolder(
4558 // Verify all elements are correct type!
4559 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4560 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4561 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4562 ETy->getDescription() +"' as required!\nIt is of type '" +
4563 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4566 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4567 delete PTy; delete (yyvsp[-1].ConstVector);
4573 #line 2042 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4575 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4581 #line 2046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4583 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4584 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4585 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4586 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4587 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4588 free((yyvsp[-2].StrVal));
4589 free((yyvsp[0].StrVal));
4595 #line 2060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4596 { // Is it an integer reference...?
4597 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4603 #line 2064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4604 { // Is it a named reference...?
4605 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4611 #line 2076 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4613 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4619 #line 2081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4621 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4627 #line 2085 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4628 { // Do not allow functions with 0 basic blocks
4629 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4635 #line 2094 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4637 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4639 InsertValue((yyvsp[0].TermInstVal));
4641 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4642 InsertValue((yyvsp[-2].BasicBlockVal));
4643 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4649 #line 2105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4651 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4652 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4653 if (CI2->getParent() == 0)
4654 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4655 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4656 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4662 #line 2114 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4664 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4667 // Make sure to move the basic block to the correct location in the
4668 // function, instead of leaving it inserted wherever it was first
4670 Function::BasicBlockListType &BBL =
4671 CurFun.CurrentFunction->getBasicBlockList();
4672 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4678 #line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4680 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4683 // Make sure to move the basic block to the correct location in the
4684 // function, instead of leaving it inserted wherever it was first
4686 Function::BasicBlockListType &BBL =
4687 CurFun.CurrentFunction->getBasicBlockList();
4688 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4694 #line 2139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4695 { // Return with a result...
4696 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4702 #line 2143 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4703 { // Return with no result...
4704 (yyval.TermInstVal) = new ReturnInst();
4710 #line 2147 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4711 { // Unconditional Branch...
4712 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4714 (yyval.TermInstVal) = new BranchInst(tmpBB);
4719 #line 2152 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4721 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4723 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4725 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4727 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4732 #line 2161 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4734 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4736 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4738 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4739 (yyval.TermInstVal) = S;
4741 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4742 E = (yyvsp[-1].JumpTable)->end();
4743 for (; I != E; ++I) {
4744 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4745 S->addCase(CI, I->second);
4747 GEN_ERROR("Switch case is constant, but not a simple integer!");
4749 delete (yyvsp[-1].JumpTable);
4755 #line 2180 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4757 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4759 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4761 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4762 (yyval.TermInstVal) = S;
4768 #line 2190 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4770 const PointerType *PFTy;
4771 const FunctionType *Ty;
4773 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4774 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4775 // Pull out the types of all of the arguments...
4776 std::vector<const Type*> ParamTypes;
4777 if ((yyvsp[-7].ValueList)) {
4778 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4780 ParamTypes.push_back((*I)->getType());
4783 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4784 if (isVarArg) ParamTypes.pop_back();
4786 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4787 PFTy = PointerType::get(Ty);
4790 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4792 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4794 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4797 // Create the call node...
4798 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4799 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4800 } else { // Has arguments?
4801 // Loop through FunctionType's arguments and ensure they are specified
4804 FunctionType::param_iterator I = Ty->param_begin();
4805 FunctionType::param_iterator E = Ty->param_end();
4806 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4808 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4809 if ((*ArgI)->getType() != *I)
4810 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4811 (*I)->getDescription() + "'!");
4813 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4814 GEN_ERROR("Invalid number of parameters detected!");
4816 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4818 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4820 delete (yyvsp[-10].TypeVal);
4821 delete (yyvsp[-7].ValueList);
4827 #line 2245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4829 (yyval.TermInstVal) = new UnwindInst();
4835 #line 2249 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4837 (yyval.TermInstVal) = new UnreachableInst();
4843 #line 2256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4845 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4846 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4849 GEN_ERROR("May only switch on a constant pool value!");
4851 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4853 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4858 #line 2267 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4860 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4861 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4865 GEN_ERROR("May only switch on a constant pool value!");
4867 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4869 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4874 #line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4876 // Is this definition named?? if so, assign the name...
4877 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4879 InsertValue((yyvsp[0].InstVal));
4880 (yyval.InstVal) = (yyvsp[0].InstVal);
4886 #line 2289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4887 { // Used for PHI nodes
4888 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4889 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
4891 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4893 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4894 delete (yyvsp[-5].TypeVal);
4899 #line 2298 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4901 (yyval.PHIList) = (yyvsp[-6].PHIList);
4902 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
4904 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4906 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4911 #line 2308 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4912 { // Used for call statements, and memory insts...
4913 (yyval.ValueList) = new std::vector<Value*>();
4914 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4919 #line 2312 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4921 (yyval.ValueList) = (yyvsp[-2].ValueList);
4922 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4928 #line 2319 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4929 { (yyval.ValueList) = 0; ;}
4933 #line 2321 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4935 (yyval.BoolVal) = true;
4941 #line 2325 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4943 (yyval.BoolVal) = false;
4949 #line 2330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4951 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
4952 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
4954 "Arithmetic operator requires integer, FP, or packed operands!");
4955 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
4956 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
4957 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
4958 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
4959 GEN_ERROR("U/S/FRem not supported on packed types!");
4960 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4962 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4964 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
4965 if ((yyval.InstVal) == 0)
4966 GEN_ERROR("binary operator returned null!");
4967 delete (yyvsp[-3].TypeVal);
4972 #line 2349 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4974 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
4975 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
4976 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
4977 GEN_ERROR("Logical operator requires integral operands!");
4979 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4981 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4983 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
4984 if ((yyval.InstVal) == 0)
4985 GEN_ERROR("binary operator returned null!");
4986 delete (yyvsp[-3].TypeVal);
4991 #line 2364 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4993 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
4994 GEN_ERROR("Packed types not supported by icmp instruction");
4995 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4997 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4999 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5000 if ((yyval.InstVal) == 0)
5001 GEN_ERROR("icmp operator returned null!");
5006 #line 2375 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5008 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5009 GEN_ERROR("Packed types not supported by fcmp instruction");
5010 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5012 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5014 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5015 if ((yyval.InstVal) == 0)
5016 GEN_ERROR("fcmp operator returned null!");
5021 #line 2386 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5023 cerr << "WARNING: Use of eliminated 'not' instruction:"
5024 << " Replacing with 'xor'.\n";
5026 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5028 GEN_ERROR("Expected integral type for not instruction!");
5030 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5031 if ((yyval.InstVal) == 0)
5032 GEN_ERROR("Could not create a xor instruction!");
5038 #line 2399 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5040 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
5041 GEN_ERROR("Shift amount must be ubyte!");
5042 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5043 GEN_ERROR("Shift constant expression requires integer operand!");
5045 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5051 #line 2408 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5053 Value* Val = (yyvsp[-2].ValueVal);
5054 const Type* Ty = (yyvsp[0].TypeVal)->get();
5055 if (!Val->getType()->isFirstClassType())
5056 GEN_ERROR("cast from a non-primitive type: '" +
5057 Val->getType()->getDescription() + "'!");
5058 if (!Ty->isFirstClassType())
5059 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5060 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
5061 delete (yyvsp[0].TypeVal);
5066 #line 2419 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5068 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5069 GEN_ERROR("select condition must be boolean!");
5070 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5071 GEN_ERROR("select value types should match!");
5072 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5078 #line 2427 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5080 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5081 delete (yyvsp[0].TypeVal);
5087 #line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5089 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5090 GEN_ERROR("Invalid extractelement operands!");
5091 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5097 #line 2438 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5099 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5100 GEN_ERROR("Invalid insertelement operands!");
5101 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5107 #line 2444 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5109 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5110 GEN_ERROR("Invalid shufflevector operands!");
5111 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5117 #line 2450 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5119 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5120 if (!Ty->isFirstClassType())
5121 GEN_ERROR("PHI node operands must be of first class type!");
5122 (yyval.InstVal) = new PHINode(Ty);
5123 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5124 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5125 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5126 GEN_ERROR("All elements of a PHI node must be of the same type!");
5127 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5128 (yyvsp[0].PHIList)->pop_front();
5130 delete (yyvsp[0].PHIList); // Free the list...
5136 #line 2465 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5138 const PointerType *PFTy = 0;
5139 const FunctionType *Ty = 0;
5141 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5142 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5143 // Pull out the types of all of the arguments...
5144 std::vector<const Type*> ParamTypes;
5145 if ((yyvsp[-1].ValueList)) {
5146 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5148 ParamTypes.push_back((*I)->getType());
5151 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5152 if (isVarArg) ParamTypes.pop_back();
5154 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5155 GEN_ERROR("LLVM functions cannot return aggregate types!");
5157 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5158 PFTy = PointerType::get(Ty);
5161 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5164 // Create the call node...
5165 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5166 // Make sure no arguments is a good thing!
5167 if (Ty->getNumParams() != 0)
5168 GEN_ERROR("No arguments passed to a function that "
5169 "expects arguments!");
5171 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5172 } else { // Has arguments?
5173 // Loop through FunctionType's arguments and ensure they are specified
5176 FunctionType::param_iterator I = Ty->param_begin();
5177 FunctionType::param_iterator E = Ty->param_end();
5178 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5180 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5181 if ((*ArgI)->getType() != *I)
5182 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5183 (*I)->getDescription() + "'!");
5185 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5186 GEN_ERROR("Invalid number of parameters detected!");
5188 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5190 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5191 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5192 delete (yyvsp[-4].TypeVal);
5193 delete (yyvsp[-1].ValueList);
5199 #line 2524 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5201 (yyval.InstVal) = (yyvsp[0].InstVal);
5207 #line 2531 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5209 (yyval.ValueList) = (yyvsp[0].ValueList);
5215 #line 2534 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5217 (yyval.ValueList) = new std::vector<Value*>();
5223 #line 2539 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5225 (yyval.BoolVal) = true;
5231 #line 2543 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5233 (yyval.BoolVal) = false;
5239 #line 2550 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5241 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5242 delete (yyvsp[-1].TypeVal);
5248 #line 2555 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5250 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5252 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5253 delete (yyvsp[-4].TypeVal);
5258 #line 2561 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5260 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5261 delete (yyvsp[-1].TypeVal);
5267 #line 2566 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5269 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5271 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5272 delete (yyvsp[-4].TypeVal);
5277 #line 2572 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5279 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5280 GEN_ERROR("Trying to free nonpointer type " +
5281 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5282 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5288 #line 2580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5290 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5291 GEN_ERROR("Can't load from nonpointer type: " +
5292 (*(yyvsp[-1].TypeVal))->getDescription());
5293 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5294 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5295 (*(yyvsp[-1].TypeVal))->getDescription());
5296 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5298 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5299 delete (yyvsp[-1].TypeVal);
5304 #line 2592 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5306 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5308 GEN_ERROR("Can't store to a nonpointer type: " +
5309 (*(yyvsp[-1].TypeVal))->getDescription());
5310 const Type *ElTy = PT->getElementType();
5311 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5312 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5313 "' into space of type '" + ElTy->getDescription() + "'!");
5315 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5317 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5318 delete (yyvsp[-1].TypeVal);
5323 #line 2607 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5325 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5326 GEN_ERROR("getelementptr insn requires pointer operand!");
5328 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5329 GEN_ERROR("Invalid getelementptr indices for type '" +
5330 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5331 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5333 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5334 delete (yyvsp[-2].TypeVal);
5335 delete (yyvsp[0].ValueList);
5343 /* Line 1126 of yacc.c. */
5344 #line 5345 "llvmAsmParser.tab.c"
5350 YY_STACK_PRINT (yyss, yyssp);
5355 /* Now `shift' the result of the reduction. Determine what state
5356 that goes to, based on the state we popped back to and the rule
5357 number reduced by. */
5361 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5362 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5363 yystate = yytable[yystate];
5365 yystate = yydefgoto[yyn - YYNTOKENS];
5370 /*------------------------------------.
5371 | yyerrlab -- here on detecting error |
5372 `------------------------------------*/
5374 /* If not already recovering from an error, report this error. */
5379 yyn = yypact[yystate];
5381 if (YYPACT_NINF < yyn && yyn < YYLAST)
5383 int yytype = YYTRANSLATE (yychar);
5384 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5385 YYSIZE_T yysize = yysize0;
5387 int yysize_overflow = 0;
5389 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5390 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5394 /* This is so xgettext sees the translatable formats that are
5395 constructed on the fly. */
5396 YY_("syntax error, unexpected %s");
5397 YY_("syntax error, unexpected %s, expecting %s");
5398 YY_("syntax error, unexpected %s, expecting %s or %s");
5399 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5400 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5404 static char const yyunexpected[] = "syntax error, unexpected %s";
5405 static char const yyexpecting[] = ", expecting %s";
5406 static char const yyor[] = " or %s";
5407 char yyformat[sizeof yyunexpected
5408 + sizeof yyexpecting - 1
5409 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5410 * (sizeof yyor - 1))];
5411 char const *yyprefix = yyexpecting;
5413 /* Start YYX at -YYN if negative to avoid negative indexes in
5415 int yyxbegin = yyn < 0 ? -yyn : 0;
5417 /* Stay within bounds of both yycheck and yytname. */
5418 int yychecklim = YYLAST - yyn;
5419 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5422 yyarg[0] = yytname[yytype];
5423 yyfmt = yystpcpy (yyformat, yyunexpected);
5425 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5426 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5428 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5432 yyformat[sizeof yyunexpected - 1] = '\0';
5435 yyarg[yycount++] = yytname[yyx];
5436 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5437 yysize_overflow |= yysize1 < yysize;
5439 yyfmt = yystpcpy (yyfmt, yyprefix);
5443 yyf = YY_(yyformat);
5444 yysize1 = yysize + yystrlen (yyf);
5445 yysize_overflow |= yysize1 < yysize;
5448 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5449 yymsg = (char *) YYSTACK_ALLOC (yysize);
5452 /* Avoid sprintf, as that infringes on the user's name space.
5453 Don't have undefined behavior even if the translation
5454 produced a string with the wrong number of "%s"s. */
5457 while ((*yyp = *yyf))
5459 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5461 yyp += yytnamerr (yyp, yyarg[yyi++]);
5471 YYSTACK_FREE (yymsg);
5475 yyerror (YY_("syntax error"));
5476 goto yyexhaustedlab;
5480 #endif /* YYERROR_VERBOSE */
5481 yyerror (YY_("syntax error"));
5486 if (yyerrstatus == 3)
5488 /* If just tried and failed to reuse look-ahead token after an
5489 error, discard it. */
5491 if (yychar <= YYEOF)
5493 /* Return failure if at end of input. */
5494 if (yychar == YYEOF)
5499 yydestruct ("Error: discarding", yytoken, &yylval);
5504 /* Else will try to reuse look-ahead token after shifting the error
5509 /*---------------------------------------------------.
5510 | yyerrorlab -- error raised explicitly by YYERROR. |
5511 `---------------------------------------------------*/
5514 /* Pacify compilers like GCC when the user code never invokes
5515 YYERROR and the label yyerrorlab therefore never appears in user
5526 /*-------------------------------------------------------------.
5527 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5528 `-------------------------------------------------------------*/
5530 yyerrstatus = 3; /* Each real token shifted decrements this. */
5534 yyn = yypact[yystate];
5535 if (yyn != YYPACT_NINF)
5538 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5546 /* Pop the current state because it cannot handle the error token. */
5551 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5554 YY_STACK_PRINT (yyss, yyssp);
5563 /* Shift the error token. */
5564 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5570 /*-------------------------------------.
5571 | yyacceptlab -- YYACCEPT comes here. |
5572 `-------------------------------------*/
5577 /*-----------------------------------.
5578 | yyabortlab -- YYABORT comes here. |
5579 `-----------------------------------*/
5585 /*-------------------------------------------------.
5586 | yyexhaustedlab -- memory exhaustion comes here. |
5587 `-------------------------------------------------*/
5589 yyerror (YY_("memory exhausted"));
5595 if (yychar != YYEOF && yychar != YYEMPTY)
5596 yydestruct ("Cleanup: discarding lookahead",
5598 while (yyssp != yyss)
5600 yydestruct ("Cleanup: popping",
5601 yystos[*yyssp], yyvsp);
5606 YYSTACK_FREE (yyss);
5612 #line 2622 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5615 void llvm::GenerateError(const std::string &message, int LineNo) {
5616 if (LineNo == -1) LineNo = llvmAsmlineno;
5617 // TODO: column number in exception
5619 TheParseError->setError(CurFilename, message, LineNo);
5623 int yyerror(const char *ErrorMsg) {
5625 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5626 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5627 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5628 if (yychar == YYEMPTY || yychar == 0)
5629 errMsg += "end-of-file.";
5631 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5632 GenerateError(errMsg);