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
82 ATSTRINGCONSTANT = 273,
84 ZEROINITIALIZER = 275,
121 X86_STDCALLCC_TOK = 312,
122 X86_FASTCALLCC_TOK = 313,
188 EXTRACTELEMENT = 379,
199 #define ESINT64VAL 258
200 #define EUINT64VAL 259
201 #define LOCALVAL_ID 260
202 #define GLOBALVAL_ID 261
211 #define GLOBALVAR 270
213 #define STRINGCONSTANT 272
214 #define ATSTRINGCONSTANT 273
215 #define IMPLEMENTATION 274
216 #define ZEROINITIALIZER 275
228 #define DOTDOTDOT 287
234 #define APPENDING 293
235 #define DLLIMPORT 294
236 #define DLLEXPORT 295
237 #define EXTERN_WEAK 296
248 #define SIDEEFFECT 307
251 #define FASTCC_TOK 310
252 #define COLDCC_TOK 311
253 #define X86_STDCALLCC_TOK 312
254 #define X86_FASTCALLCC_TOK 313
255 #define DATALAYOUT 314
261 #define UNREACHABLE 320
304 #define GETELEMENTPTR 363
320 #define EXTRACTELEMENT 379
321 #define INSERTELEMENT 380
322 #define SHUFFLEVECTOR 381
332 /* Copy the first part of user declarations. */
333 #line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
335 #include "ParserInternals.h"
336 #include "llvm/CallingConv.h"
337 #include "llvm/InlineAsm.h"
338 #include "llvm/Instructions.h"
339 #include "llvm/Module.h"
340 #include "llvm/ValueSymbolTable.h"
341 #include "llvm/Support/GetElementPtrTypeIterator.h"
342 #include "llvm/Support/CommandLine.h"
343 #include "llvm/ADT/SmallVector.h"
344 #include "llvm/ADT/STLExtras.h"
345 #include "llvm/Support/MathExtras.h"
346 #include "llvm/Support/Streams.h"
354 // The following is a gross hack. In order to rid the libAsmParser library of
355 // exceptions, we have to have a way of getting the yyparse function to go into
356 // an error situation. So, whenever we want an error to occur, the GenerateError
357 // function (see bottom of file) sets TriggerError. Then, at the end of each
358 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
359 // (a goto) to put YACC in error state. Furthermore, several calls to
360 // GenerateError are made from inside productions and they must simulate the
361 // previous exception behavior by exiting the production immediately. We have
362 // replaced these with the GEN_ERROR macro which calls GeneratError and then
363 // immediately invokes YYERROR. This would be so much cleaner if it was a
364 // recursive descent parser.
365 static bool TriggerError = false;
366 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
367 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
369 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
370 int yylex(); // declaration" of xxx warnings.
374 std::string CurFilename;
377 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
378 cl::Hidden, cl::init(false));
381 using namespace llvm;
383 static Module *ParserResult;
385 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
386 // relating to upreferences in the input stream.
388 //#define DEBUG_UPREFS 1
390 #define UR_OUT(X) cerr << X
395 #define YYERROR_VERBOSE 1
397 static GlobalVariable *CurGV;
400 // This contains info used when building the body of a function. It is
401 // destroyed when the function is completed.
403 typedef std::vector<Value *> ValueList; // Numbered defs
406 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
407 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
409 static struct PerModuleInfo {
410 Module *CurrentModule;
411 std::map<const Type *, ValueList> Values; // Module level numbered definitions
412 std::map<const Type *,ValueList> LateResolveValues;
413 std::vector<PATypeHolder> Types;
414 std::map<ValID, PATypeHolder> LateResolveTypes;
416 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
417 /// how they were referenced and on which line of the input they came from so
418 /// that we can resolve them later and print error messages as appropriate.
419 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
421 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
422 // references to global values. Global values may be referenced before they
423 // are defined, and if so, the temporary object that they represent is held
424 // here. This is used for forward references of GlobalValues.
426 typedef std::map<std::pair<const PointerType *,
427 ValID>, GlobalValue*> GlobalRefsType;
428 GlobalRefsType GlobalRefs;
431 // If we could not resolve some functions at function compilation time
432 // (calls to functions before they are defined), resolve them now... Types
433 // are resolved when the constant pool has been completely parsed.
435 ResolveDefinitions(LateResolveValues);
439 // Check to make sure that all global value forward references have been
442 if (!GlobalRefs.empty()) {
443 std::string UndefinedReferences = "Unresolved global references exist:\n";
445 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
447 UndefinedReferences += " " + I->first.first->getDescription() + " " +
448 I->first.second.getName() + "\n";
450 GenerateError(UndefinedReferences);
454 Values.clear(); // Clear out function local definitions
459 // GetForwardRefForGlobal - Check to see if there is a forward reference
460 // for this global. If so, remove it from the GlobalRefs map and return it.
461 // If not, just return null.
462 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
463 // Check to see if there is a forward reference to this global variable...
464 // if there is, eliminate it and patch the reference to use the new def'n.
465 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
466 GlobalValue *Ret = 0;
467 if (I != GlobalRefs.end()) {
474 bool TypeIsUnresolved(PATypeHolder* PATy) {
475 // If it isn't abstract, its resolved
476 const Type* Ty = PATy->get();
477 if (!Ty->isAbstract())
479 // Traverse the type looking for abstract types. If it isn't abstract then
480 // we don't need to traverse that leg of the type.
481 std::vector<const Type*> WorkList, SeenList;
482 WorkList.push_back(Ty);
483 while (!WorkList.empty()) {
484 const Type* Ty = WorkList.back();
485 SeenList.push_back(Ty);
487 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
488 // Check to see if this is an unresolved type
489 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
490 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
491 for ( ; I != E; ++I) {
492 if (I->second.get() == OpTy)
495 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
496 const Type* TheTy = SeqTy->getElementType();
497 if (TheTy->isAbstract() && TheTy != Ty) {
498 std::vector<const Type*>::iterator I = SeenList.begin(),
504 WorkList.push_back(TheTy);
506 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
507 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
508 const Type* TheTy = StrTy->getElementType(i);
509 if (TheTy->isAbstract() && TheTy != Ty) {
510 std::vector<const Type*>::iterator I = SeenList.begin(),
516 WorkList.push_back(TheTy);
527 static struct PerFunctionInfo {
528 Function *CurrentFunction; // Pointer to current function being created
530 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
531 std::map<const Type*, ValueList> LateResolveValues;
532 bool isDeclare; // Is this function a forward declararation?
533 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
534 GlobalValue::VisibilityTypes Visibility;
536 /// BBForwardRefs - When we see forward references to basic blocks, keep
537 /// track of them here.
538 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
539 std::vector<BasicBlock*> NumberedBlocks;
542 inline PerFunctionInfo() {
545 Linkage = GlobalValue::ExternalLinkage;
546 Visibility = GlobalValue::DefaultVisibility;
549 inline void FunctionStart(Function *M) {
554 void FunctionDone() {
555 NumberedBlocks.clear();
557 // Any forward referenced blocks left?
558 if (!BBForwardRefs.empty()) {
559 GenerateError("Undefined reference to label " +
560 BBForwardRefs.begin()->first->getName());
564 // Resolve all forward references now.
565 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
567 Values.clear(); // Clear out function local definitions
570 Linkage = GlobalValue::ExternalLinkage;
571 Visibility = GlobalValue::DefaultVisibility;
573 } CurFun; // Info for the current function...
575 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
578 //===----------------------------------------------------------------------===//
579 // Code to handle definitions of all the types
580 //===----------------------------------------------------------------------===//
582 static int InsertValue(Value *V,
583 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
584 if (V->hasName()) return -1; // Is this a numbered definition?
586 // Yes, insert the value into the value table...
587 ValueList &List = ValueTab[V->getType()];
589 return List.size()-1;
592 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
594 case ValID::LocalID: // Is it a numbered definition?
595 // Module constants occupy the lowest numbered slots...
596 if (D.Num < CurModule.Types.size())
597 return CurModule.Types[D.Num];
599 case ValID::LocalName: // Is it a named definition?
600 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
601 D.destroy(); // Free old strdup'd memory...
606 GenerateError("Internal parser error: Invalid symbol type reference");
610 // If we reached here, we referenced either a symbol that we don't know about
611 // or an id number that hasn't been read yet. We may be referencing something
612 // forward, so just create an entry to be resolved later and get to it...
614 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
617 if (inFunctionScope()) {
618 if (D.Type == ValID::LocalName) {
619 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
622 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
627 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
628 if (I != CurModule.LateResolveTypes.end())
631 Type *Typ = OpaqueType::get();
632 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
636 // getValNonImprovising - Look up the value specified by the provided type and
637 // the provided ValID. If the value exists and has already been defined, return
638 // it. Otherwise return null.
640 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
641 if (isa<FunctionType>(Ty)) {
642 GenerateError("Functions are not values and "
643 "must be referenced as pointers");
648 case ValID::LocalID: { // Is it a numbered definition?
649 // Module constants occupy the lowest numbered slots.
650 std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
651 // Make sure that our type is within bounds.
652 if (VI == CurFun.Values.end()) return 0;
654 // Check that the number is within bounds.
655 if (D.Num >= VI->second.size()) return 0;
657 return VI->second[D.Num];
659 case ValID::GlobalID: { // Is it a numbered definition?
660 unsigned Num = D.Num;
662 // Module constants occupy the lowest numbered slots...
663 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
664 if (VI == CurModule.Values.end())
666 if (D.Num >= VI->second.size())
668 return VI->second[Num];
671 case ValID::LocalName: { // Is it a named definition?
672 if (!inFunctionScope())
674 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
675 Value *N = SymTab.lookup(D.Name);
678 if (N->getType() != Ty)
681 D.destroy(); // Free old strdup'd memory...
684 case ValID::GlobalName: { // Is it a named definition?
685 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
686 Value *N = SymTab.lookup(D.Name);
689 if (N->getType() != Ty)
692 D.destroy(); // Free old strdup'd memory...
696 // Check to make sure that "Ty" is an integral type, and that our
697 // value will fit into the specified type...
698 case ValID::ConstSIntVal: // Is it a constant pool reference??
699 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
700 GenerateError("Signed integral constant '" +
701 itostr(D.ConstPool64) + "' is invalid for type '" +
702 Ty->getDescription() + "'");
705 return ConstantInt::get(Ty, D.ConstPool64);
707 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
708 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
709 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
710 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
711 "' is invalid or out of range");
713 } else { // This is really a signed reference. Transmogrify.
714 return ConstantInt::get(Ty, D.ConstPool64);
717 return ConstantInt::get(Ty, D.UConstPool64);
720 case ValID::ConstFPVal: // Is it a floating point const pool reference?
721 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
722 GenerateError("FP constant invalid for type");
725 return ConstantFP::get(Ty, D.ConstPoolFP);
727 case ValID::ConstNullVal: // Is it a null value?
728 if (!isa<PointerType>(Ty)) {
729 GenerateError("Cannot create a a non pointer null");
732 return ConstantPointerNull::get(cast<PointerType>(Ty));
734 case ValID::ConstUndefVal: // Is it an undef value?
735 return UndefValue::get(Ty);
737 case ValID::ConstZeroVal: // Is it a zero value?
738 return Constant::getNullValue(Ty);
740 case ValID::ConstantVal: // Fully resolved constant?
741 if (D.ConstantValue->getType() != Ty) {
742 GenerateError("Constant expression type different from required type");
745 return D.ConstantValue;
747 case ValID::InlineAsmVal: { // Inline asm expression
748 const PointerType *PTy = dyn_cast<PointerType>(Ty);
749 const FunctionType *FTy =
750 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
751 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
752 GenerateError("Invalid type for asm constraint string");
755 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
756 D.IAD->HasSideEffects);
757 D.destroy(); // Free InlineAsmDescriptor.
761 assert(0 && "Unhandled case!");
765 assert(0 && "Unhandled case!");
769 // getVal - This function is identical to getValNonImprovising, except that if a
770 // value is not already defined, it "improvises" by creating a placeholder var
771 // that looks and acts just like the requested variable. When the value is
772 // defined later, all uses of the placeholder variable are replaced with the
775 static Value *getVal(const Type *Ty, const ValID &ID) {
776 if (Ty == Type::LabelTy) {
777 GenerateError("Cannot use a basic block here");
781 // See if the value has already been defined.
782 Value *V = getValNonImprovising(Ty, ID);
784 if (TriggerError) return 0;
786 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
787 GenerateError("Invalid use of a composite type");
791 // If we reached here, we referenced either a symbol that we don't know about
792 // or an id number that hasn't been read yet. We may be referencing something
793 // forward, so just create an entry to be resolved later and get to it...
795 V = new Argument(Ty);
797 // Remember where this forward reference came from. FIXME, shouldn't we try
798 // to recycle these things??
799 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
802 if (inFunctionScope())
803 InsertValue(V, CurFun.LateResolveValues);
805 InsertValue(V, CurModule.LateResolveValues);
809 /// getBBVal - This is used for two purposes:
810 /// * If isDefinition is true, a new basic block with the specified ID is being
812 /// * If isDefinition is true, this is a reference to a basic block, which may
813 /// or may not be a forward reference.
815 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
816 assert(inFunctionScope() && "Can't get basic block at global scope!");
822 GenerateError("Illegal label reference " + ID.getName());
824 case ValID::LocalID: // Is it a numbered definition?
825 if (ID.Num >= CurFun.NumberedBlocks.size())
826 CurFun.NumberedBlocks.resize(ID.Num+1);
827 BB = CurFun.NumberedBlocks[ID.Num];
829 case ValID::LocalName: // Is it a named definition?
831 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
832 if (N && N->getType()->getTypeID() == Type::LabelTyID)
833 BB = cast<BasicBlock>(N);
837 // See if the block has already been defined.
839 // If this is the definition of the block, make sure the existing value was
840 // just a forward reference. If it was a forward reference, there will be
841 // an entry for it in the PlaceHolderInfo map.
842 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
843 // The existing value was a definition, not a forward reference.
844 GenerateError("Redefinition of label " + ID.getName());
848 ID.destroy(); // Free strdup'd memory.
852 // Otherwise this block has not been seen before.
853 BB = new BasicBlock("", CurFun.CurrentFunction);
854 if (ID.Type == ValID::LocalName) {
855 BB->setName(ID.Name);
857 CurFun.NumberedBlocks[ID.Num] = BB;
860 // If this is not a definition, keep track of it so we can use it as a forward
863 // Remember where this forward reference came from.
864 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
866 // The forward declaration could have been inserted anywhere in the
867 // function: insert it into the correct place now.
868 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
869 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
876 //===----------------------------------------------------------------------===//
877 // Code to handle forward references in instructions
878 //===----------------------------------------------------------------------===//
880 // This code handles the late binding needed with statements that reference
881 // values not defined yet... for example, a forward branch, or the PHI node for
884 // This keeps a table (CurFun.LateResolveValues) of all such forward references
885 // and back patchs after we are done.
888 // ResolveDefinitions - If we could not resolve some defs at parsing
889 // time (forward branches, phi functions for loops, etc...) resolve the
893 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
894 std::map<const Type*,ValueList> *FutureLateResolvers) {
895 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
896 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
897 E = LateResolvers.end(); LRI != E; ++LRI) {
898 ValueList &List = LRI->second;
899 while (!List.empty()) {
900 Value *V = List.back();
903 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
904 CurModule.PlaceHolderInfo.find(V);
905 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
907 ValID &DID = PHI->second.first;
909 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
913 V->replaceAllUsesWith(TheRealValue);
915 CurModule.PlaceHolderInfo.erase(PHI);
916 } else if (FutureLateResolvers) {
917 // Functions have their unresolved items forwarded to the module late
919 InsertValue(V, *FutureLateResolvers);
921 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
922 GenerateError("Reference to an invalid definition: '" +DID.getName()+
923 "' of type '" + V->getType()->getDescription() + "'",
927 GenerateError("Reference to an invalid definition: #" +
928 itostr(DID.Num) + " of type '" +
929 V->getType()->getDescription() + "'",
937 LateResolvers.clear();
940 // ResolveTypeTo - A brand new type was just declared. This means that (if
941 // name is not null) things referencing Name can be resolved. Otherwise, things
942 // refering to the number can be resolved. Do this now.
944 static void ResolveTypeTo(char *Name, const Type *ToTy) {
946 if (Name) D = ValID::createLocalName(Name);
947 else D = ValID::createLocalID(CurModule.Types.size());
949 std::map<ValID, PATypeHolder>::iterator I =
950 CurModule.LateResolveTypes.find(D);
951 if (I != CurModule.LateResolveTypes.end()) {
952 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
953 CurModule.LateResolveTypes.erase(I);
957 // setValueName - Set the specified value to the name given. The name may be
958 // null potentially, in which case this is a noop. The string passed in is
959 // assumed to be a malloc'd string buffer, and is free'd by this function.
961 static void setValueName(Value *V, char *NameStr) {
962 if (!NameStr) return;
963 std::string Name(NameStr); // Copy string
964 free(NameStr); // Free old string
966 if (V->getType() == Type::VoidTy) {
967 GenerateError("Can't assign name '" + Name+"' to value with void type");
971 assert(inFunctionScope() && "Must be in function scope!");
972 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
973 if (ST.lookup(Name)) {
974 GenerateError("Redefinition of value '" + Name + "' of type '" +
975 V->getType()->getDescription() + "'");
983 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
984 /// this is a declaration, otherwise it is a definition.
985 static GlobalVariable *
986 ParseGlobalVariable(char *NameStr,
987 GlobalValue::LinkageTypes Linkage,
988 GlobalValue::VisibilityTypes Visibility,
989 bool isConstantGlobal, const Type *Ty,
990 Constant *Initializer) {
991 if (isa<FunctionType>(Ty)) {
992 GenerateError("Cannot declare global vars of function type");
996 const PointerType *PTy = PointerType::get(Ty);
1000 Name = NameStr; // Copy string
1001 free(NameStr); // Free old string
1004 // See if this global value was forward referenced. If so, recycle the
1007 if (!Name.empty()) {
1008 ID = ValID::createGlobalName((char*)Name.c_str());
1010 ID = ValID::createGlobalID(CurModule.Values[PTy].size());
1013 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1014 // Move the global to the end of the list, from whereever it was
1015 // previously inserted.
1016 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1017 CurModule.CurrentModule->getGlobalList().remove(GV);
1018 CurModule.CurrentModule->getGlobalList().push_back(GV);
1019 GV->setInitializer(Initializer);
1020 GV->setLinkage(Linkage);
1021 GV->setVisibility(Visibility);
1022 GV->setConstant(isConstantGlobal);
1023 InsertValue(GV, CurModule.Values);
1027 // If this global has a name
1028 if (!Name.empty()) {
1029 // if the global we're parsing has an initializer (is a definition) and
1030 // has external linkage.
1031 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1032 // If there is already a global with external linkage with this name
1033 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1034 // If we allow this GVar to get created, it will be renamed in the
1035 // symbol table because it conflicts with an existing GVar. We can't
1036 // allow redefinition of GVars whose linking indicates that their name
1037 // must stay the same. Issue the error.
1038 GenerateError("Redefinition of global variable named '" + Name +
1039 "' of type '" + Ty->getDescription() + "'");
1044 // Otherwise there is no existing GV to use, create one now.
1045 GlobalVariable *GV =
1046 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1047 CurModule.CurrentModule);
1048 GV->setVisibility(Visibility);
1049 InsertValue(GV, CurModule.Values);
1053 // setTypeName - Set the specified type to the name given. The name may be
1054 // null potentially, in which case this is a noop. The string passed in is
1055 // assumed to be a malloc'd string buffer, and is freed by this function.
1057 // This function returns true if the type has already been defined, but is
1058 // allowed to be redefined in the specified context. If the name is a new name
1059 // for the type plane, it is inserted and false is returned.
1060 static bool setTypeName(const Type *T, char *NameStr) {
1061 assert(!inFunctionScope() && "Can't give types function-local names!");
1062 if (NameStr == 0) return false;
1064 std::string Name(NameStr); // Copy string
1065 free(NameStr); // Free old string
1067 // We don't allow assigning names to void type
1068 if (T == Type::VoidTy) {
1069 GenerateError("Can't assign name '" + Name + "' to the void type");
1073 // Set the type name, checking for conflicts as we do so.
1074 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1076 if (AlreadyExists) { // Inserting a name that is already defined???
1077 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1078 assert(Existing && "Conflict but no matching type?!");
1080 // There is only one case where this is allowed: when we are refining an
1081 // opaque type. In this case, Existing will be an opaque type.
1082 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1083 // We ARE replacing an opaque type!
1084 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1088 // Otherwise, this is an attempt to redefine a type. That's okay if
1089 // the redefinition is identical to the original. This will be so if
1090 // Existing and T point to the same Type object. In this one case we
1091 // allow the equivalent redefinition.
1092 if (Existing == T) return true; // Yes, it's equal.
1094 // Any other kind of (non-equivalent) redefinition is an error.
1095 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1096 T->getDescription() + "'");
1102 //===----------------------------------------------------------------------===//
1103 // Code for handling upreferences in type names...
1106 // TypeContains - Returns true if Ty directly contains E in it.
1108 static bool TypeContains(const Type *Ty, const Type *E) {
1109 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1110 E) != Ty->subtype_end();
1114 struct UpRefRecord {
1115 // NestingLevel - The number of nesting levels that need to be popped before
1116 // this type is resolved.
1117 unsigned NestingLevel;
1119 // LastContainedTy - This is the type at the current binding level for the
1120 // type. Every time we reduce the nesting level, this gets updated.
1121 const Type *LastContainedTy;
1123 // UpRefTy - This is the actual opaque type that the upreference is
1124 // represented with.
1125 OpaqueType *UpRefTy;
1127 UpRefRecord(unsigned NL, OpaqueType *URTy)
1128 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1132 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1133 static std::vector<UpRefRecord> UpRefs;
1135 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1136 /// called. It loops through the UpRefs vector, which is a list of the
1137 /// currently active types. For each type, if the up reference is contained in
1138 /// the newly completed type, we decrement the level count. When the level
1139 /// count reaches zero, the upreferenced type is the type that is passed in:
1140 /// thus we can complete the cycle.
1142 static PATypeHolder HandleUpRefs(const Type *ty) {
1143 // If Ty isn't abstract, or if there are no up-references in it, then there is
1144 // nothing to resolve here.
1145 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1147 PATypeHolder Ty(ty);
1148 UR_OUT("Type '" << Ty->getDescription() <<
1149 "' newly formed. Resolving upreferences.\n" <<
1150 UpRefs.size() << " upreferences active!\n");
1152 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1153 // to zero), we resolve them all together before we resolve them to Ty. At
1154 // the end of the loop, if there is anything to resolve to Ty, it will be in
1156 OpaqueType *TypeToResolve = 0;
1158 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1159 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1160 << UpRefs[i].second->getDescription() << ") = "
1161 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1162 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1163 // Decrement level of upreference
1164 unsigned Level = --UpRefs[i].NestingLevel;
1165 UpRefs[i].LastContainedTy = Ty;
1166 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1167 if (Level == 0) { // Upreference should be resolved!
1168 if (!TypeToResolve) {
1169 TypeToResolve = UpRefs[i].UpRefTy;
1171 UR_OUT(" * Resolving upreference for "
1172 << UpRefs[i].second->getDescription() << "\n";
1173 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1174 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1175 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1176 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1178 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1179 --i; // Do not skip the next element...
1184 if (TypeToResolve) {
1185 UR_OUT(" * Resolving upreference for "
1186 << UpRefs[i].second->getDescription() << "\n";
1187 std::string OldName = TypeToResolve->getDescription());
1188 TypeToResolve->refineAbstractTypeTo(Ty);
1194 //===----------------------------------------------------------------------===//
1195 // RunVMAsmParser - Define an interface to this parser
1196 //===----------------------------------------------------------------------===//
1198 static Module* RunParser(Module * M);
1200 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1203 CurFilename = Filename;
1204 return RunParser(new Module(CurFilename));
1207 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1208 set_scan_string(AsmString);
1210 CurFilename = "from_memory";
1212 return RunParser(new Module (CurFilename));
1214 return RunParser(M);
1220 /* Enabling traces. */
1225 /* Enabling verbose error messages. */
1226 #ifdef YYERROR_VERBOSE
1227 # undef YYERROR_VERBOSE
1228 # define YYERROR_VERBOSE 1
1230 # define YYERROR_VERBOSE 0
1233 /* Enabling the token table. */
1234 #ifndef YYTOKEN_TABLE
1235 # define YYTOKEN_TABLE 0
1238 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1239 #line 900 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
1240 typedef union YYSTYPE {
1241 llvm::Module *ModuleVal;
1242 llvm::Function *FunctionVal;
1243 llvm::BasicBlock *BasicBlockVal;
1244 llvm::TerminatorInst *TermInstVal;
1245 llvm::Instruction *InstVal;
1246 llvm::Constant *ConstVal;
1248 const llvm::Type *PrimType;
1249 std::list<llvm::PATypeHolder> *TypeList;
1250 llvm::PATypeHolder *TypeVal;
1251 llvm::Value *ValueVal;
1252 std::vector<llvm::Value*> *ValueList;
1253 llvm::ArgListType *ArgList;
1254 llvm::TypeWithAttrs TypeWithAttrs;
1255 llvm::TypeWithAttrsList *TypeWithAttrsList;
1256 llvm::ValueRefList *ValueRefList;
1258 // Represent the RHS of PHI node
1259 std::list<std::pair<llvm::Value*,
1260 llvm::BasicBlock*> > *PHIList;
1261 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1262 std::vector<llvm::Constant*> *ConstVector;
1264 llvm::GlobalValue::LinkageTypes Linkage;
1265 llvm::GlobalValue::VisibilityTypes Visibility;
1266 llvm::FunctionType::ParameterAttributes ParamAttrs;
1274 char *StrVal; // This memory is strdup'd!
1275 llvm::ValID ValIDVal; // strdup'd memory maybe!
1277 llvm::Instruction::BinaryOps BinaryOpVal;
1278 llvm::Instruction::TermOps TermOpVal;
1279 llvm::Instruction::MemoryOps MemOpVal;
1280 llvm::Instruction::CastOps CastOpVal;
1281 llvm::Instruction::OtherOps OtherOpVal;
1282 llvm::ICmpInst::Predicate IPredicate;
1283 llvm::FCmpInst::Predicate FPredicate;
1285 /* Line 196 of yacc.c. */
1286 #line 1287 "llvmAsmParser.tab.c"
1287 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1288 # define YYSTYPE_IS_DECLARED 1
1289 # define YYSTYPE_IS_TRIVIAL 1
1294 /* Copy the second part of user declarations. */
1297 /* Line 219 of yacc.c. */
1298 #line 1299 "llvmAsmParser.tab.c"
1300 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1301 # define YYSIZE_T __SIZE_TYPE__
1303 #if ! defined (YYSIZE_T) && defined (size_t)
1304 # define YYSIZE_T size_t
1306 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1307 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1308 # define YYSIZE_T size_t
1310 #if ! defined (YYSIZE_T)
1311 # define YYSIZE_T unsigned int
1317 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1318 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1322 # define YY_(msgid) msgid
1326 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1328 /* The parser invokes alloca or malloc; define the necessary symbols. */
1330 # ifdef YYSTACK_USE_ALLOCA
1331 # if YYSTACK_USE_ALLOCA
1333 # define YYSTACK_ALLOC __builtin_alloca
1335 # define YYSTACK_ALLOC alloca
1336 # if defined (__STDC__) || defined (__cplusplus)
1337 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1338 # define YYINCLUDED_STDLIB_H
1344 # ifdef YYSTACK_ALLOC
1345 /* Pacify GCC's `empty if-body' warning. */
1346 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1347 # ifndef YYSTACK_ALLOC_MAXIMUM
1348 /* The OS might guarantee only one guard page at the bottom of the stack,
1349 and a page size can be as small as 4096 bytes. So we cannot safely
1350 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1351 to allow for a few compiler-allocated temporary stack slots. */
1352 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1355 # define YYSTACK_ALLOC YYMALLOC
1356 # define YYSTACK_FREE YYFREE
1357 # ifndef YYSTACK_ALLOC_MAXIMUM
1358 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1364 # define YYMALLOC malloc
1365 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1366 && (defined (__STDC__) || defined (__cplusplus)))
1367 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1371 # define YYFREE free
1372 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1373 && (defined (__STDC__) || defined (__cplusplus)))
1374 void free (void *); /* INFRINGES ON USER NAME SPACE */
1381 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1384 #if (! defined (yyoverflow) \
1385 && (! defined (__cplusplus) \
1386 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1388 /* A type that is properly aligned for any stack member. */
1395 /* The size of the maximum gap between one aligned stack and the next. */
1396 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1398 /* The size of an array large to enough to hold all stacks, each with
1400 # define YYSTACK_BYTES(N) \
1401 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1402 + YYSTACK_GAP_MAXIMUM)
1404 /* Copy COUNT objects from FROM to TO. The source and destination do
1407 # if defined (__GNUC__) && 1 < __GNUC__
1408 # define YYCOPY(To, From, Count) \
1409 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1411 # define YYCOPY(To, From, Count) \
1415 for (yyi = 0; yyi < (Count); yyi++) \
1416 (To)[yyi] = (From)[yyi]; \
1422 /* Relocate STACK from its old location to the new one. The
1423 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1424 elements in the stack, and YYPTR gives the new location of the
1425 stack. Advance YYPTR to a properly aligned location for the next
1427 # define YYSTACK_RELOCATE(Stack) \
1430 YYSIZE_T yynewbytes; \
1431 YYCOPY (&yyptr->Stack, Stack, yysize); \
1432 Stack = &yyptr->Stack; \
1433 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1434 yyptr += yynewbytes / sizeof (*yyptr); \
1440 #if defined (__STDC__) || defined (__cplusplus)
1441 typedef signed char yysigned_char;
1443 typedef short int yysigned_char;
1446 /* YYFINAL -- State number of the termination state. */
1448 /* YYLAST -- Last index in YYTABLE. */
1451 /* YYNTOKENS -- Number of terminals. */
1452 #define YYNTOKENS 146
1453 /* YYNNTS -- Number of nonterminals. */
1455 /* YYNRULES -- Number of rules. */
1456 #define YYNRULES 284
1457 /* YYNRULES -- Number of states. */
1458 #define YYNSTATES 557
1460 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1461 #define YYUNDEFTOK 2
1462 #define YYMAXUTOK 386
1464 #define YYTRANSLATE(YYX) \
1465 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1467 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1468 static const unsigned char yytranslate[] =
1470 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474 136, 137, 134, 2, 133, 2, 2, 2, 2, 2,
1475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1476 141, 132, 142, 2, 2, 2, 2, 2, 2, 2,
1477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1479 2, 138, 135, 140, 2, 2, 2, 2, 2, 145,
1480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1482 139, 2, 2, 143, 2, 144, 2, 2, 2, 2,
1483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1495 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1496 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1497 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1498 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1499 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1500 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1501 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1502 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1503 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1504 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1505 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1506 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1507 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1508 125, 126, 127, 128, 129, 130, 131
1512 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1514 static const unsigned short int yyprhs[] =
1516 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1517 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1518 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1519 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1520 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1521 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1522 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1523 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1524 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1525 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1526 195, 197, 198, 201, 202, 205, 206, 210, 213, 214,
1527 216, 217, 221, 223, 226, 228, 230, 232, 234, 236,
1528 238, 241, 243, 246, 252, 258, 264, 270, 274, 277,
1529 283, 288, 291, 293, 295, 297, 301, 303, 307, 309,
1530 310, 312, 316, 321, 325, 329, 334, 339, 343, 350,
1531 356, 359, 362, 365, 368, 371, 374, 377, 380, 383,
1532 386, 393, 399, 408, 415, 422, 430, 438, 445, 454,
1533 463, 467, 469, 471, 473, 475, 476, 478, 481, 482,
1534 486, 487, 491, 495, 497, 501, 505, 506, 513, 514,
1535 522, 523, 531, 534, 538, 540, 544, 548, 552, 556,
1536 558, 559, 565, 569, 571, 575, 577, 578, 588, 590,
1537 592, 597, 599, 601, 604, 608, 609, 611, 613, 615,
1538 617, 619, 621, 623, 625, 627, 631, 633, 639, 641,
1539 643, 645, 647, 649, 651, 654, 657, 660, 664, 667,
1540 668, 670, 673, 676, 680, 690, 700, 709, 724, 726,
1541 728, 735, 741, 744, 751, 759, 763, 769, 770, 771,
1542 775, 778, 780, 786, 792, 799, 806, 811, 818, 823,
1543 828, 835, 842, 845, 854, 856, 858, 859, 863, 870,
1544 874, 881, 884, 889, 896
1547 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1548 static const short int yyrhs[] =
1550 186, 0, -1, 66, -1, 67, -1, 68, -1, 69,
1551 -1, 70, -1, 71, -1, 72, -1, 73, -1, 74,
1552 -1, 78, -1, 79, -1, 80, -1, 75, -1, 76,
1553 -1, 77, -1, 109, -1, 110, -1, 111, -1, 112,
1554 -1, 113, -1, 114, -1, 115, -1, 116, -1, 117,
1555 -1, 118, -1, 119, -1, 120, -1, 83, -1, 84,
1556 -1, 85, -1, 86, -1, 87, -1, 88, -1, 89,
1557 -1, 90, -1, 91, -1, 92, -1, 93, -1, 94,
1558 -1, 95, -1, 96, -1, 97, -1, 98, -1, 99,
1559 -1, 100, -1, 101, -1, 102, -1, 89, -1, 90,
1560 -1, 91, -1, 92, -1, 21, -1, 22, -1, 9,
1561 -1, 10, -1, 11, -1, 14, -1, 17, -1, 154,
1562 -1, -1, 154, 132, -1, -1, 15, -1, 18, -1,
1563 157, 132, -1, -1, 35, -1, 37, -1, 36, -1,
1564 38, -1, 40, -1, 39, -1, 41, -1, 43, -1,
1565 -1, 131, -1, -1, 39, -1, 41, -1, -1, 35,
1566 -1, 36, -1, 37, -1, 40, -1, -1, 54, -1,
1567 55, -1, 56, -1, 57, -1, 58, -1, 53, 4,
1568 -1, 110, -1, 111, -1, 128, -1, 129, -1, -1,
1569 166, 165, -1, 127, -1, 165, -1, -1, 168, 167,
1570 -1, -1, 46, 4, -1, -1, 133, 46, 4, -1,
1571 29, 17, -1, -1, 171, -1, -1, 133, 174, 173,
1572 -1, 171, -1, 46, 4, -1, 9, -1, 10, -1,
1573 11, -1, 12, -1, 42, -1, 175, -1, 176, 134,
1574 -1, 208, -1, 135, 4, -1, 176, 136, 180, 137,
1575 168, -1, 8, 136, 180, 137, 168, -1, 138, 4,
1576 139, 176, 140, -1, 141, 4, 139, 176, 142, -1,
1577 143, 181, 144, -1, 143, 144, -1, 141, 143, 181,
1578 144, 142, -1, 141, 143, 144, 142, -1, 176, 166,
1579 -1, 176, -1, 8, -1, 177, -1, 179, 133, 177,
1580 -1, 179, -1, 179, 133, 32, -1, 32, -1, -1,
1581 176, -1, 181, 133, 176, -1, 176, 138, 184, 140,
1582 -1, 176, 138, 140, -1, 176, 145, 17, -1, 176,
1583 141, 184, 142, -1, 176, 143, 184, 144, -1, 176,
1584 143, 144, -1, 176, 141, 143, 184, 144, 142, -1,
1585 176, 141, 143, 144, 142, -1, 176, 33, -1, 176,
1586 34, -1, 176, 208, -1, 176, 183, -1, 176, 20,
1587 -1, 152, 3, -1, 152, 4, -1, 9, 21, -1,
1588 9, 22, -1, 153, 7, -1, 149, 136, 182, 31,
1589 176, 137, -1, 108, 136, 182, 219, 137, -1, 122,
1590 136, 182, 133, 182, 133, 182, 137, -1, 147, 136,
1591 182, 133, 182, 137, -1, 148, 136, 182, 133, 182,
1592 137, -1, 81, 150, 136, 182, 133, 182, 137, -1,
1593 82, 151, 136, 182, 133, 182, 137, -1, 124, 136,
1594 182, 133, 182, 137, -1, 125, 136, 182, 133, 182,
1595 133, 182, 137, -1, 126, 136, 182, 133, 182, 133,
1596 182, 137, -1, 184, 133, 182, -1, 182, -1, 27,
1597 -1, 28, -1, 187, -1, -1, 188, -1, 187, 188,
1598 -1, -1, 26, 189, 204, -1, -1, 25, 190, 205,
1599 -1, 51, 50, 194, -1, 19, -1, 156, 13, 176,
1600 -1, 156, 13, 8, -1, -1, 158, 161, 185, 182,
1601 191, 173, -1, -1, 158, 159, 161, 185, 182, 192,
1602 173, -1, -1, 158, 160, 161, 185, 176, 193, 173,
1603 -1, 44, 195, -1, 47, 132, 196, -1, 17, -1,
1604 45, 132, 17, -1, 59, 132, 17, -1, 138, 197,
1605 140, -1, 197, 133, 17, -1, 17, -1, -1, 198,
1606 133, 176, 166, 155, -1, 176, 166, 155, -1, 198,
1607 -1, 198, 133, 32, -1, 32, -1, -1, 164, 178,
1608 157, 136, 199, 137, 168, 172, 169, -1, 23, -1,
1609 143, -1, 163, 161, 200, 201, -1, 24, -1, 144,
1610 -1, 211, 203, -1, 162, 161, 200, -1, -1, 52,
1611 -1, 3, -1, 4, -1, 7, -1, 21, -1, 22,
1612 -1, 33, -1, 34, -1, 20, -1, 141, 184, 142,
1613 -1, 183, -1, 50, 206, 17, 133, 17, -1, 5,
1614 -1, 6, -1, 154, -1, 157, -1, 208, -1, 207,
1615 -1, 176, 209, -1, 211, 212, -1, 202, 212, -1,
1616 213, 156, 214, -1, 213, 216, -1, -1, 16, -1,
1617 60, 210, -1, 60, 8, -1, 61, 12, 209, -1,
1618 61, 9, 209, 133, 12, 209, 133, 12, 209, -1,
1619 62, 152, 209, 133, 12, 209, 138, 215, 140, -1,
1620 62, 152, 209, 133, 12, 209, 138, 140, -1, 63,
1621 164, 178, 209, 136, 218, 137, 168, 31, 12, 209,
1622 64, 12, 209, -1, 64, -1, 65, -1, 215, 152,
1623 207, 133, 12, 209, -1, 152, 207, 133, 12, 209,
1624 -1, 156, 221, -1, 176, 138, 209, 133, 209, 140,
1625 -1, 217, 133, 138, 209, 133, 209, 140, -1, 176,
1626 209, 166, -1, 218, 133, 176, 209, 166, -1, -1,
1627 -1, 219, 133, 210, -1, 49, 48, -1, 48, -1,
1628 147, 176, 209, 133, 209, -1, 148, 176, 209, 133,
1629 209, -1, 81, 150, 176, 209, 133, 209, -1, 82,
1630 151, 176, 209, 133, 209, -1, 149, 210, 31, 176,
1631 -1, 122, 210, 133, 210, 133, 210, -1, 123, 210,
1632 133, 176, -1, 124, 210, 133, 210, -1, 125, 210,
1633 133, 210, 133, 210, -1, 126, 210, 133, 210, 133,
1634 210, -1, 121, 217, -1, 220, 164, 178, 209, 136,
1635 218, 137, 168, -1, 223, -1, 30, -1, -1, 103,
1636 176, 170, -1, 103, 176, 133, 9, 209, 170, -1,
1637 104, 176, 170, -1, 104, 176, 133, 9, 209, 170,
1638 -1, 105, 210, -1, 222, 106, 176, 209, -1, 222,
1639 107, 210, 133, 176, 209, -1, 108, 176, 209, 219,
1643 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1644 static const unsigned short int yyrline[] =
1646 0, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047,
1647 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, 1049,
1648 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1050, 1053,
1649 1053, 1054, 1054, 1055, 1055, 1056, 1056, 1057, 1057, 1061,
1650 1061, 1062, 1062, 1063, 1063, 1064, 1064, 1065, 1065, 1066,
1651 1066, 1067, 1067, 1068, 1069, 1074, 1075, 1075, 1077, 1077,
1652 1078, 1078, 1082, 1086, 1091, 1091, 1093, 1097, 1103, 1104,
1653 1105, 1106, 1107, 1111, 1112, 1113, 1117, 1118, 1122, 1123,
1654 1124, 1128, 1129, 1130, 1131, 1132, 1135, 1136, 1137, 1138,
1655 1139, 1140, 1141, 1148, 1149, 1150, 1151, 1154, 1155, 1160,
1656 1161, 1164, 1165, 1172, 1173, 1179, 1180, 1188, 1196, 1197,
1657 1202, 1203, 1204, 1209, 1222, 1222, 1222, 1222, 1225, 1229,
1658 1233, 1240, 1245, 1253, 1271, 1289, 1294, 1306, 1316, 1320,
1659 1330, 1337, 1344, 1351, 1356, 1361, 1368, 1369, 1376, 1383,
1660 1391, 1396, 1407, 1435, 1451, 1480, 1508, 1533, 1552, 1577,
1661 1596, 1608, 1615, 1681, 1691, 1701, 1707, 1713, 1718, 1723,
1662 1731, 1743, 1764, 1772, 1778, 1789, 1794, 1799, 1805, 1811,
1663 1820, 1824, 1832, 1832, 1843, 1848, 1856, 1857, 1861, 1861,
1664 1865, 1865, 1868, 1871, 1883, 1907, 1918, 1918, 1928, 1928,
1665 1936, 1936, 1946, 1949, 1955, 1968, 1972, 1977, 1979, 1984,
1666 1989, 1998, 2008, 2019, 2023, 2032, 2041, 2046, 2158, 2158,
1667 2160, 2169, 2169, 2171, 2176, 2188, 2192, 2197, 2201, 2205,
1668 2209, 2213, 2217, 2221, 2225, 2229, 2254, 2258, 2272, 2276,
1669 2280, 2284, 2290, 2290, 2296, 2305, 2309, 2318, 2328, 2337,
1670 2349, 2362, 2366, 2370, 2375, 2385, 2404, 2413, 2480, 2484,
1671 2491, 2502, 2515, 2525, 2536, 2546, 2554, 2562, 2565, 2566,
1672 2573, 2577, 2582, 2603, 2620, 2633, 2646, 2658, 2666, 2673,
1673 2679, 2685, 2691, 2706, 2770, 2775, 2779, 2786, 2793, 2801,
1674 2808, 2816, 2824, 2838, 2855
1678 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1679 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1680 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1681 static const char *const yytname[] =
1683 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL",
1684 "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", "FLOAT",
1685 "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1686 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1687 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1688 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1689 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1690 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1691 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1692 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1693 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1694 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1695 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1696 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1697 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1698 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1699 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1700 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1701 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1702 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT",
1703 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1704 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1705 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1706 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1707 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1708 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1709 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1710 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1711 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1712 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1713 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1714 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1715 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1716 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1717 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1718 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1719 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1720 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1721 "OptVolatile", "MemoryInst", 0
1726 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1728 static const unsigned short int yytoknum[] =
1730 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1731 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1732 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1733 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1734 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1735 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1736 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1737 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1738 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1739 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1740 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1741 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1742 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1743 385, 386, 61, 44, 42, 92, 40, 41, 91, 120,
1744 93, 60, 62, 123, 125, 99
1748 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1749 static const unsigned char yyr1[] =
1751 0, 146, 147, 147, 147, 147, 147, 147, 147, 147,
1752 147, 148, 148, 148, 148, 148, 148, 149, 149, 149,
1753 149, 149, 149, 149, 149, 149, 149, 149, 149, 150,
1754 150, 150, 150, 150, 150, 150, 150, 150, 150, 151,
1755 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1756 151, 151, 151, 151, 151, 152, 153, 153, 154, 154,
1757 155, 155, 156, 156, 157, 157, 158, 158, 159, 159,
1758 159, 159, 159, 160, 160, 160, 161, 161, 162, 162,
1759 162, 163, 163, 163, 163, 163, 164, 164, 164, 164,
1760 164, 164, 164, 165, 165, 165, 165, 166, 166, 167,
1761 167, 168, 168, 169, 169, 170, 170, 171, 172, 172,
1762 173, 173, 174, 174, 175, 175, 175, 175, 176, 176,
1763 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1764 176, 177, 178, 178, 179, 179, 180, 180, 180, 180,
1765 181, 181, 182, 182, 182, 182, 182, 182, 182, 182,
1766 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
1767 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
1768 184, 184, 185, 185, 186, 186, 187, 187, 189, 188,
1769 190, 188, 188, 188, 188, 188, 191, 188, 192, 188,
1770 193, 188, 188, 188, 194, 195, 195, 196, 197, 197,
1771 197, 198, 198, 199, 199, 199, 199, 200, 201, 201,
1772 202, 203, 203, 204, 205, 206, 206, 207, 207, 207,
1773 207, 207, 207, 207, 207, 207, 207, 207, 208, 208,
1774 208, 208, 209, 209, 210, 211, 211, 212, 213, 213,
1775 213, 214, 214, 214, 214, 214, 214, 214, 214, 214,
1776 215, 215, 216, 217, 217, 218, 218, 218, 219, 219,
1777 220, 220, 221, 221, 221, 221, 221, 221, 221, 221,
1778 221, 221, 221, 221, 221, 222, 222, 223, 223, 223,
1779 223, 223, 223, 223, 223
1782 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1783 static const unsigned char yyr2[] =
1785 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1786 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1787 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1788 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1789 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1790 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1791 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1792 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1793 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1794 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1795 1, 0, 2, 0, 2, 0, 3, 2, 0, 1,
1796 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1797 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1798 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1799 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1800 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1801 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1802 3, 1, 1, 1, 1, 0, 1, 2, 0, 3,
1803 0, 3, 3, 1, 3, 3, 0, 6, 0, 7,
1804 0, 7, 2, 3, 1, 3, 3, 3, 3, 1,
1805 0, 5, 3, 1, 3, 1, 0, 9, 1, 1,
1806 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1807 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1808 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1809 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1810 6, 5, 2, 6, 7, 3, 5, 0, 0, 3,
1811 2, 1, 5, 5, 6, 6, 4, 6, 4, 4,
1812 6, 6, 2, 8, 1, 1, 0, 3, 6, 3,
1816 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1817 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1818 means the default is an error. */
1819 static const unsigned short int yydefact[] =
1821 67, 58, 64, 59, 65, 183, 180, 178, 0, 0,
1822 0, 0, 0, 0, 76, 0, 67, 176, 78, 81,
1823 0, 0, 192, 0, 0, 62, 0, 66, 68, 70,
1824 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
1825 1, 177, 79, 80, 76, 181, 82, 83, 84, 85,
1826 76, 239, 179, 239, 0, 0, 200, 193, 194, 182,
1827 228, 229, 185, 114, 115, 116, 117, 118, 0, 0,
1828 0, 0, 230, 231, 119, 184, 121, 0, 0, 172,
1829 173, 0, 86, 86, 240, 236, 63, 211, 212, 213,
1830 235, 195, 196, 199, 0, 139, 122, 0, 0, 0,
1831 0, 128, 140, 0, 120, 139, 0, 0, 114, 115,
1832 116, 0, 0, 0, 186, 0, 87, 88, 89, 90,
1833 91, 0, 214, 0, 276, 238, 0, 197, 138, 97,
1834 134, 136, 0, 0, 0, 0, 0, 0, 127, 0,
1835 188, 190, 157, 158, 155, 156, 159, 154, 150, 151,
1836 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
1837 15, 16, 11, 12, 13, 0, 0, 0, 17, 18,
1838 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1839 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1840 0, 153, 152, 110, 92, 133, 132, 0, 208, 209,
1841 210, 275, 261, 0, 0, 0, 0, 86, 248, 249,
1842 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1843 0, 0, 0, 0, 0, 237, 86, 252, 0, 274,
1844 198, 131, 0, 101, 0, 0, 130, 0, 141, 101,
1845 110, 110, 29, 30, 31, 32, 33, 34, 35, 36,
1846 37, 38, 0, 53, 54, 49, 50, 51, 52, 39,
1847 40, 41, 42, 43, 44, 45, 46, 47, 48, 0,
1848 0, 0, 0, 0, 0, 143, 171, 0, 0, 0,
1849 147, 0, 144, 0, 0, 0, 0, 187, 0, 260,
1850 242, 0, 241, 0, 0, 55, 0, 0, 0, 0,
1851 105, 105, 281, 0, 0, 272, 0, 0, 0, 0,
1852 0, 0, 0, 0, 0, 0, 0, 93, 94, 95,
1853 96, 98, 137, 135, 124, 125, 126, 129, 123, 189,
1854 191, 0, 0, 258, 0, 0, 0, 0, 0, 142,
1855 128, 140, 0, 145, 146, 0, 0, 0, 0, 0,
1856 112, 110, 206, 217, 218, 219, 224, 220, 221, 222,
1857 223, 215, 0, 226, 233, 232, 234, 0, 243, 0,
1858 0, 0, 0, 0, 277, 0, 279, 258, 0, 0,
1859 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1860 0, 99, 100, 102, 0, 0, 0, 0, 0, 0,
1861 0, 170, 149, 0, 0, 0, 0, 107, 113, 111,
1862 205, 97, 203, 0, 216, 0, 0, 0, 0, 0,
1863 0, 0, 0, 0, 0, 284, 0, 0, 0, 268,
1864 269, 0, 0, 0, 0, 266, 0, 282, 0, 0,
1865 0, 0, 161, 0, 0, 0, 0, 148, 0, 0,
1866 0, 61, 0, 101, 0, 225, 0, 0, 257, 0,
1867 0, 105, 106, 105, 0, 0, 0, 0, 0, 262,
1868 263, 257, 0, 0, 0, 259, 0, 167, 0, 0,
1869 163, 164, 160, 60, 202, 204, 97, 108, 0, 0,
1870 0, 0, 0, 264, 265, 0, 278, 280, 0, 0,
1871 267, 270, 271, 0, 283, 165, 166, 0, 0, 0,
1872 61, 109, 103, 227, 0, 0, 97, 0, 101, 253,
1873 0, 101, 162, 168, 169, 201, 0, 207, 0, 246,
1874 0, 0, 255, 0, 0, 254, 273, 104, 244, 0,
1875 245, 0, 97, 0, 0, 0, 256, 0, 0, 0,
1876 0, 251, 0, 0, 250, 0, 247
1879 /* YYDEFGOTO[NTERM-NUM]. */
1880 static const short int yydefgoto[] =
1882 -1, 188, 189, 190, 252, 269, 111, 112, 72, 484,
1883 12, 73, 14, 37, 38, 39, 44, 50, 121, 321,
1884 231, 393, 324, 527, 374, 350, 512, 287, 351, 74,
1885 113, 130, 197, 131, 132, 103, 276, 363, 277, 81,
1886 15, 16, 17, 19, 18, 193, 240, 241, 59, 22,
1887 57, 94, 412, 413, 122, 200, 51, 89, 52, 45,
1888 415, 364, 76, 366, 292, 53, 85, 86, 225, 531,
1889 125, 305, 492, 396, 226, 227, 228, 229
1892 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1894 #define YYPACT_NINF -399
1895 static const short int yypact[] =
1897 406, -399, -399, -399, -399, -399, -399, -399, -26, -114,
1898 -16, -53, 92, -11, 54, 136, 526, -399, 247, 173,
1899 43, 49, -399, 62, 194, -399, 814, -399, -399, -399,
1900 -399, -399, -399, -399, -399, -399, -399, 134, 134, 99,
1901 -399, -399, -399, -399, 134, -399, -399, -399, -399, -399,
1902 134, 212, -399, -1, 219, 225, 253, -399, -399, -399,
1903 -399, -399, 135, -399, -399, -399, -399, -399, 271, 275,
1904 3, 33, -399, -399, -399, 160, -399, 99, 99, -399,
1905 -399, 1029, 287, 287, -399, -399, 220, -399, -399, -399,
1906 -399, -399, -399, -399, 20, 1071, -399, 141, 148, 105,
1907 135, -399, 160, -75, -399, 1071, 1029, 1174, 32, 286,
1908 293, 151, 294, 590, -399, 298, -399, -399, -399, -399,
1909 -399, 1190, -399, -13, 1313, -399, 289, -399, -399, 160,
1910 -399, 170, 167, 1174, 1174, 165, -68, 1174, -399, 174,
1911 -399, 160, -399, -399, -399, -399, -399, -399, -399, -399,
1912 -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,
1913 -399, -399, -399, -399, -399, 495, 591, 176, -399, -399,
1914 -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,
1915 177, 178, 182, 183, 776, 1212, 123, 305, 187, 188,
1916 189, -399, -399, 193, -399, 135, 160, 266, -399, -399,
1917 -399, -399, -399, 284, 1229, 283, 325, 287, -399, -399,
1918 495, 591, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174,
1919 1174, 1174, 1174, 1174, 1174, -399, 287, -399, 144, -399,
1920 -399, -4, 1110, -399, -63, -110, -399, 204, 160, -399,
1921 193, 193, -399, -399, -399, -399, -399, -399, -399, -399,
1922 -399, -399, 211, -399, -399, -399, -399, -399, -399, -399,
1923 -399, -399, -399, -399, -399, -399, -399, -399, -399, 214,
1924 1029, 1029, 1029, 1029, 1029, -399, -399, 79, 494, -111,
1925 -399, -66, -399, 1029, 1029, 1029, 39, -399, 216, -399,
1926 135, 733, -399, 858, 858, -399, 858, 1190, 1174, 1174,
1927 50, 111, -399, 733, 97, 215, 230, 231, 232, 233,
1928 234, 733, 733, 322, 1190, 1174, 1174, -399, -399, -399,
1929 -399, -399, -399, -399, -27, -399, -399, -399, -27, -399,
1930 -399, 1029, 1029, -399, 235, 236, 239, 240, 1029, -399,
1931 237, 590, 26, -399, -399, 241, 242, 345, 360, 374,
1932 -399, 193, 1126, -399, -399, -399, -399, -399, -399, -399,
1933 -399, 328, 1029, -399, -399, -399, -399, 249, -399, 252,
1934 858, 733, 733, 11, -399, 18, -399, -399, 858, 250,
1935 1174, 1174, 1174, 1174, 1174, 256, 257, 1174, 858, 733,
1936 259, -399, -399, -399, 262, 264, -34, 1029, 1029, 1029,
1937 1029, -399, -399, 258, 1029, 1029, 1174, -399, -399, -399,
1938 -399, 160, 265, 267, -399, 384, -61, 390, 393, 272,
1939 281, 282, 858, 413, 858, 295, 296, 858, 297, 160,
1940 -399, 301, 302, 858, 858, 160, 300, -399, 1174, 1029,
1941 1029, 1174, -399, 304, 285, 306, 307, -399, 308, 310,
1942 118, 38, 1145, -399, 311, -399, 858, 858, 1174, 858,
1943 858, 315, -399, 315, 858, 316, 1174, 1174, 1174, -399,
1944 -399, 1174, 733, 317, 319, -399, 1029, -399, 1029, 1029,
1945 -399, -399, -399, -399, -399, -399, 160, 149, 421, 326,
1946 314, 733, 19, -399, -399, 412, -399, -399, 321, 858,
1947 -399, -399, -399, 36, -399, -399, -399, 327, 329, 330,
1948 38, -399, 416, -399, 451, 2, -399, 1174, -399, -399,
1949 333, -399, -399, -399, -399, -399, 461, -399, 858, -399,
1950 982, 5, -4, 733, 210, -399, -27, -399, -399, 335,
1951 -399, 982, -399, 457, 464, 344, -4, 858, 858, 468,
1952 417, -399, 858, 471, -399, 858, -399
1955 /* YYPGOTO[NTERM-NUM]. */
1956 static const short int yypgoto[] =
1958 -399, 361, 362, 363, 274, 279, -198, -399, 0, -19,
1959 407, 9, -399, -399, -399, 113, -399, -399, -177, -307,
1960 -398, -399, -236, -399, -299, 7, -399, -212, -399, -399,
1961 -25, 263, -210, -399, 391, 398, -69, -109, -180, 179,
1962 -399, -399, 482, -399, -399, -399, -399, -399, -399, -399,
1963 -399, -399, -399, -399, 418, -399, -399, -399, -399, -399,
1964 -399, -369, -73, 100, -158, -399, 454, -399, -399, -399,
1965 -399, -399, 42, 137, -399, -399, -399, -399
1968 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1969 positive, shift that token. If negative, reduce the rule which
1970 number is the opposite. If zero, do what YYDEFACT says.
1971 If YYTABLE_NINF, syntax error. */
1972 #define YYTABLE_NINF -176
1973 static const short int yytable[] =
1975 11, 75, 376, 328, 191, 279, 281, 98, 296, 13,
1976 198, 295, 114, 451, 295, 84, 11, 392, 23, 20,
1977 422, 392, 338, 87, 104, 13, 105, 424, 329, 330,
1978 297, 343, 326, 21, 24, -55, -55, 140, 60, 61,
1979 192, 100, 63, 64, 65, 66, 102, 1, 2, 314,
1980 3, 4, 1, 142, 143, 3, 302, 423, 137, 306,
1981 307, 308, 309, 310, 423, 137, 313, 338, 348, 138,
1982 129, 104, 338, 105, 102, 67, 237, 325, 344, 25,
1983 129, 455, 141, 317, 318, 349, 11, 370, 510, 28,
1984 29, 30, 31, 32, 33, 34, 196, 35, 342, 441,
1985 391, 319, 320, 442, 388, 26, 317, 318, 234, 235,
1986 60, 61, 238, 100, 63, 64, 65, 66, 532, 1,
1987 2, 27, 3, 4, 319, 320, 79, 80, 60, 61,
1988 199, 100, 108, 109, 110, 66, 40, 1, 2, 409,
1989 3, 4, 529, 88, 546, 540, 99, 67, 317, 318,
1990 77, 78, 517, 126, 144, 145, 518, 82, 390, 338,
1991 127, 539, 496, 83, 497, 67, 319, 320, 68, 517,
1992 403, 69, 545, 521, 70, 54, 71, 101, 348, 291,
1993 392, 55, 416, 373, 104, 36, 105, 300, 301, 291,
1994 303, 304, 291, 291, 291, 291, 291, 311, 312, 291,
1995 56, 333, 334, 335, 336, 337, 288, 129, 46, 47,
1996 48, 58, 338, 49, 345, 346, 347, 487, 365, 339,
1997 365, 365, 428, 365, 430, 431, 432, 392, 84, 392,
1998 365, 104, 191, 105, 1, 378, 91, 3, 365, 365,
1999 68, 543, 92, 69, 375, 104, 70, 105, 71, 135,
2000 315, 316, 104, 341, 105, 482, 106, 107, 68, 317,
2001 318, 69, 394, 395, 70, 36, 71, 280, 192, 401,
2002 93, 95, 196, 371, 372, 96, 391, 319, 320, 97,
2003 133, 2, 534, 475, 4, 536, 42, 134, 43, 196,
2004 389, 291, 293, -56, 104, 294, 105, 365, 365, 365,
2005 -57, 146, 194, 232, 233, 365, 230, 236, 500, 501,
2006 502, 239, 270, 271, 272, 365, 365, 530, 273, 274,
2007 317, 318, 282, 283, 284, 285, 286, 411, 443, 444,
2008 445, 446, 289, 541, 295, 448, 449, 391, 319, 320,
2009 115, 116, 117, 118, 119, 120, 327, 331, 379, 365,
2010 332, 365, 352, 387, 365, 291, 429, 291, 291, 291,
2011 365, 365, 435, 380, 381, 382, 383, 384, 397, 398,
2012 473, 474, 399, 400, 404, 405, 406, 407, 408, 402,
2013 414, 450, 417, 365, 365, 418, 365, 365, 427, 433,
2014 434, 365, 438, 367, 368, 439, 369, 440, 452, 365,
2015 447, 454, 456, 377, 453, 457, -175, 507, 458, 508,
2016 509, 385, 386, 472, 459, 460, 291, 462, 365, -63,
2017 1, 2, 477, 3, 4, 5, 365, 486, 441, 464,
2018 466, 6, 7, 491, 467, 468, 471, 476, 513, 478,
2019 479, 291, 291, 291, 488, 480, 491, 481, 495, 499,
2020 8, 483, 515, 9, 505, 365, 506, 10, 423, 514,
2021 365, 519, 526, 528, 522, 537, 523, 524, 544, 547,
2022 419, 420, 421, 535, 365, 365, 548, 549, 426, 365,
2023 552, 553, 365, 555, 298, 222, 223, 224, 436, 437,
2024 299, 525, 533, 124, 511, 323, 139, 136, 41, 60,
2025 61, 123, 100, 108, 109, 110, 66, 90, 1, 2,
2026 483, 3, 4, 503, 425, 0, 0, 0, 0, 0,
2027 0, 0, 461, 0, 463, 0, -174, 465, 0, 0,
2028 0, 0, 0, 469, 470, 0, 67, 0, 0, -63,
2029 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2030 0, 6, 7, 0, 0, 0, 489, 490, 0, 493,
2031 494, 0, 0, 0, 498, 0, 0, 0, 0, 0,
2032 8, 0, 504, 9, 0, 0, 0, 10, 242, 243,
2033 244, 245, 246, 247, 248, 249, 250, 251, 0, 0,
2034 0, 516, 0, 0, 0, 60, 61, 0, 0, 520,
2035 0, 0, 0, 0, 1, 2, 0, 3, 4, 0,
2036 147, 0, 253, 254, 0, 0, 0, 0, 0, 0,
2037 0, 0, 0, 148, 149, 0, 0, 0, 538, 68,
2038 0, 0, 69, 542, 0, 70, 0, 71, 340, 0,
2039 0, 0, 0, 0, 0, 0, 0, 550, 551, 0,
2040 0, 0, 554, 0, 0, 556, 150, 151, 152, 153,
2041 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2042 164, 165, 166, 0, 0, 0, 0, 0, 0, 0,
2043 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
2044 265, 266, 267, 268, 0, 0, 0, 0, 167, 168,
2045 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2046 179, 0, 180, 0, 181, 182, 183, 0, 0, 0,
2047 0, 0, 0, 0, 104, 0, 105, 0, 184, 0,
2048 0, 185, 0, 186, 0, 187, 353, 354, 60, 61,
2049 355, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2050 3, 4, 0, 356, 357, 358, 0, 0, 0, 0,
2051 0, 0, 0, 0, 0, 0, 359, 360, 0, 0,
2052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2053 0, 60, 61, 361, 100, 108, 109, 110, 66, 0,
2054 1, 2, 0, 3, 4, 0, 0, 0, 0, 150,
2055 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
2056 161, 162, 163, 164, 165, 166, 0, 0, 67, 60,
2057 61, 0, 62, 63, 64, 65, 66, 0, 1, 2,
2058 0, 3, 4, 0, 0, 0, 0, 0, 0, 0,
2059 0, 167, 168, 169, 170, 171, 172, 173, 174, 175,
2060 176, 177, 178, 179, 0, 180, 67, 181, 182, 183,
2061 0, 353, 354, 60, 61, 355, 0, 104, 0, 105,
2062 0, 0, 1, 2, 362, 3, 4, 0, 356, 357,
2063 358, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2064 0, 359, 360, 0, 0, 0, 0, 0, 0, 0,
2065 0, 0, 0, 0, 0, 0, 0, 0, 361, 0,
2066 0, 68, 0, 0, 69, 0, 275, 70, 0, 71,
2067 0, 0, 0, 0, 150, 151, 152, 153, 154, 155,
2068 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2069 166, 0, 0, 0, 0, 0, 0, 0, 0, 68,
2070 0, 0, 69, 0, 0, 70, 0, 71, 0, 0,
2071 0, 0, 0, 0, 0, 0, 167, 168, 169, 170,
2072 171, 172, 173, 174, 175, 176, 177, 178, 179, 0,
2073 180, 0, 181, 182, 183, 353, 354, 0, 0, 355,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 362,
2075 0, 0, 356, 357, 358, 0, 0, 0, 0, 0,
2076 0, 0, 0, 0, 0, 359, 360, 0, 0, 0,
2077 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2078 0, 0, 361, 0, 60, 61, 0, 100, 108, 109,
2079 110, 66, 0, 1, 2, 0, 3, 4, 150, 151,
2080 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
2081 162, 163, 164, 165, 166, 0, 0, 0, 0, 0,
2082 0, 67, 0, 0, 0, 0, 60, 61, 0, 100,
2083 63, 64, 65, 66, 0, 1, 2, 0, 3, 4,
2084 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2085 177, 178, 179, 128, 180, 0, 181, 182, 183, 0,
2086 0, 0, 0, 67, 0, 60, 61, 0, 100, 63,
2087 64, 65, 66, 362, 1, 2, 0, 3, 4, 0,
2088 0, 60, 61, 0, 100, 63, 64, 65, 66, 0,
2089 1, 2, 322, 3, 4, 0, 0, 0, 0, 0,
2090 60, 61, 67, 100, 63, 64, 65, 66, 410, 1,
2091 2, 0, 3, 4, 68, 0, 0, 69, 67, 0,
2092 70, 0, 71, 0, 0, 0, 0, 485, 0, 60,
2093 61, 0, 100, 63, 64, 65, 66, 67, 1, 2,
2094 0, 3, 4, 0, 0, 60, 61, 0, 195, 63,
2095 64, 65, 66, 0, 1, 2, 68, 3, 4, 69,
2096 0, 0, 70, 0, 71, 0, 67, 60, 61, 0,
2097 100, 108, 109, 110, 66, 0, 1, 2, 0, 3,
2098 4, 0, 67, 0, 60, 61, 0, 290, 63, 64,
2099 65, 66, 0, 1, 2, 68, 3, 4, 69, 0,
2100 0, 70, 0, 71, 67, 0, 0, 0, 0, 0,
2101 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2102 0, 67, 0, 0, 0, 0, 0, 0, 0, 0,
2103 68, 0, 0, 69, 0, 0, 70, 0, 71, 0,
2104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2105 0, 0, 0, 0, 0, 0, 0, 0, 0, 68,
2106 0, 0, 69, 0, 0, 70, 0, 71, 0, 0,
2107 0, 0, 0, 0, 0, 68, 0, 0, 69, 0,
2108 0, 70, 0, 71, 0, 0, 0, 0, 0, 0,
2109 0, 0, 0, 201, 0, 0, 0, 68, 0, 0,
2110 69, 0, 0, 70, 0, 278, 0, 0, 0, 0,
2111 0, 202, 203, 0, 68, 0, 0, 69, 0, 0,
2112 70, 0, 71, 204, 205, 206, 207, 208, 209, 150,
2113 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
2114 161, 162, 163, 164, 210, 211, 0, 0, 0, 0,
2115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 0, 212, 213, 214, 0,
2117 0, 215, 168, 169, 170, 171, 172, 173, 174, 175,
2118 176, 177, 178, 179, 216, 217, 218, 219, 220, 221
2121 static const short int yycheck[] =
2123 0, 26, 301, 239, 113, 185, 186, 4, 206, 0,
2124 23, 9, 81, 411, 9, 16, 16, 324, 132, 45,
2125 9, 328, 133, 24, 134, 16, 136, 9, 240, 241,
2126 207, 142, 142, 59, 50, 3, 4, 106, 5, 6,
2127 113, 8, 9, 10, 11, 12, 71, 14, 15, 226,
2128 17, 18, 14, 21, 22, 17, 214, 46, 133, 217,
2129 218, 219, 220, 221, 46, 133, 224, 133, 29, 144,
2130 95, 134, 133, 136, 99, 42, 144, 140, 144, 132,
2131 105, 142, 107, 110, 111, 46, 86, 297, 486, 35,
2132 36, 37, 38, 39, 40, 41, 121, 43, 278, 133,
2133 127, 128, 129, 137, 314, 13, 110, 111, 133, 134,
2134 5, 6, 137, 8, 9, 10, 11, 12, 516, 14,
2135 15, 132, 17, 18, 128, 129, 27, 28, 5, 6,
2136 143, 8, 9, 10, 11, 12, 0, 14, 15, 351,
2137 17, 18, 140, 144, 542, 140, 143, 42, 110, 111,
2138 37, 38, 133, 133, 3, 4, 137, 44, 316, 133,
2139 140, 530, 461, 50, 463, 42, 128, 129, 135, 133,
2140 144, 138, 541, 137, 141, 132, 143, 144, 29, 204,
2141 487, 132, 362, 133, 134, 131, 136, 212, 213, 214,
2142 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
2143 138, 270, 271, 272, 273, 274, 197, 232, 35, 36,
2144 37, 17, 133, 40, 283, 284, 285, 453, 291, 140,
2145 293, 294, 380, 296, 382, 383, 384, 534, 16, 536,
2146 303, 134, 341, 136, 14, 138, 17, 17, 311, 312,
2147 135, 31, 17, 138, 133, 134, 141, 136, 143, 144,
2148 106, 107, 134, 278, 136, 137, 77, 78, 135, 110,
2149 111, 138, 331, 332, 141, 131, 143, 144, 341, 338,
2150 17, 136, 297, 298, 299, 4, 127, 128, 129, 4,
2151 139, 15, 518, 441, 18, 521, 39, 139, 41, 314,
2152 315, 316, 9, 7, 134, 12, 136, 370, 371, 372,
2153 7, 7, 4, 133, 137, 378, 17, 142, 466, 467,
2154 468, 137, 136, 136, 136, 388, 389, 515, 136, 136,
2155 110, 111, 17, 136, 136, 136, 133, 352, 397, 398,
2156 399, 400, 48, 531, 9, 404, 405, 127, 128, 129,
2157 53, 54, 55, 56, 57, 58, 142, 136, 133, 422,
2158 136, 424, 136, 31, 427, 380, 381, 382, 383, 384,
2159 433, 434, 387, 133, 133, 133, 133, 133, 133, 133,
2160 439, 440, 133, 133, 133, 133, 31, 17, 4, 142,
2161 52, 406, 133, 456, 457, 133, 459, 460, 138, 133,
2162 133, 464, 133, 293, 294, 133, 296, 133, 133, 472,
2163 142, 17, 12, 303, 137, 12, 0, 476, 136, 478,
2164 479, 311, 312, 438, 133, 133, 441, 4, 491, 13,
2165 14, 15, 137, 17, 18, 19, 499, 452, 133, 133,
2166 133, 25, 26, 458, 133, 133, 136, 133, 17, 133,
2167 133, 466, 467, 468, 133, 137, 471, 137, 133, 133,
2168 44, 451, 138, 47, 137, 528, 137, 51, 46, 133,
2169 533, 140, 46, 12, 137, 4, 137, 137, 133, 12,
2170 370, 371, 372, 140, 547, 548, 12, 133, 378, 552,
2171 12, 64, 555, 12, 210, 124, 124, 124, 388, 389,
2172 211, 510, 517, 86, 487, 232, 105, 99, 16, 5,
2173 6, 83, 8, 9, 10, 11, 12, 53, 14, 15,
2174 510, 17, 18, 471, 377, -1, -1, -1, -1, -1,
2175 -1, -1, 422, -1, 424, -1, 0, 427, -1, -1,
2176 -1, -1, -1, 433, 434, -1, 42, -1, -1, 13,
2177 14, 15, -1, 17, 18, 19, -1, -1, -1, -1,
2178 -1, 25, 26, -1, -1, -1, 456, 457, -1, 459,
2179 460, -1, -1, -1, 464, -1, -1, -1, -1, -1,
2180 44, -1, 472, 47, -1, -1, -1, 51, 83, 84,
2181 85, 86, 87, 88, 89, 90, 91, 92, -1, -1,
2182 -1, 491, -1, -1, -1, 5, 6, -1, -1, 499,
2183 -1, -1, -1, -1, 14, 15, -1, 17, 18, -1,
2184 20, -1, 21, 22, -1, -1, -1, -1, -1, -1,
2185 -1, -1, -1, 33, 34, -1, -1, -1, 528, 135,
2186 -1, -1, 138, 533, -1, 141, -1, 143, 144, -1,
2187 -1, -1, -1, -1, -1, -1, -1, 547, 548, -1,
2188 -1, -1, 552, -1, -1, 555, 66, 67, 68, 69,
2189 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2190 80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
2191 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
2192 99, 100, 101, 102, -1, -1, -1, -1, 108, 109,
2193 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2194 120, -1, 122, -1, 124, 125, 126, -1, -1, -1,
2195 -1, -1, -1, -1, 134, -1, 136, -1, 138, -1,
2196 -1, 141, -1, 143, -1, 145, 3, 4, 5, 6,
2197 7, -1, -1, -1, -1, -1, -1, 14, 15, -1,
2198 17, 18, -1, 20, 21, 22, -1, -1, -1, -1,
2199 -1, -1, -1, -1, -1, -1, 33, 34, -1, -1,
2200 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2201 -1, 5, 6, 50, 8, 9, 10, 11, 12, -1,
2202 14, 15, -1, 17, 18, -1, -1, -1, -1, 66,
2203 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2204 77, 78, 79, 80, 81, 82, -1, -1, 42, 5,
2205 6, -1, 8, 9, 10, 11, 12, -1, 14, 15,
2206 -1, 17, 18, -1, -1, -1, -1, -1, -1, -1,
2207 -1, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2208 117, 118, 119, 120, -1, 122, 42, 124, 125, 126,
2209 -1, 3, 4, 5, 6, 7, -1, 134, -1, 136,
2210 -1, -1, 14, 15, 141, 17, 18, -1, 20, 21,
2211 22, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2212 -1, 33, 34, -1, -1, -1, -1, -1, -1, -1,
2213 -1, -1, -1, -1, -1, -1, -1, -1, 50, -1,
2214 -1, 135, -1, -1, 138, -1, 140, 141, -1, 143,
2215 -1, -1, -1, -1, 66, 67, 68, 69, 70, 71,
2216 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2217 82, -1, -1, -1, -1, -1, -1, -1, -1, 135,
2218 -1, -1, 138, -1, -1, 141, -1, 143, -1, -1,
2219 -1, -1, -1, -1, -1, -1, 108, 109, 110, 111,
2220 112, 113, 114, 115, 116, 117, 118, 119, 120, -1,
2221 122, -1, 124, 125, 126, 3, 4, -1, -1, 7,
2222 -1, -1, -1, -1, -1, -1, -1, -1, -1, 141,
2223 -1, -1, 20, 21, 22, -1, -1, -1, -1, -1,
2224 -1, -1, -1, -1, -1, 33, 34, -1, -1, -1,
2225 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2226 -1, -1, 50, -1, 5, 6, -1, 8, 9, 10,
2227 11, 12, -1, 14, 15, -1, 17, 18, 66, 67,
2228 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2229 78, 79, 80, 81, 82, -1, -1, -1, -1, -1,
2230 -1, 42, -1, -1, -1, -1, 5, 6, -1, 8,
2231 9, 10, 11, 12, -1, 14, 15, -1, 17, 18,
2232 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2233 118, 119, 120, 32, 122, -1, 124, 125, 126, -1,
2234 -1, -1, -1, 42, -1, 5, 6, -1, 8, 9,
2235 10, 11, 12, 141, 14, 15, -1, 17, 18, -1,
2236 -1, 5, 6, -1, 8, 9, 10, 11, 12, -1,
2237 14, 15, 32, 17, 18, -1, -1, -1, -1, -1,
2238 5, 6, 42, 8, 9, 10, 11, 12, 32, 14,
2239 15, -1, 17, 18, 135, -1, -1, 138, 42, -1,
2240 141, -1, 143, -1, -1, -1, -1, 32, -1, 5,
2241 6, -1, 8, 9, 10, 11, 12, 42, 14, 15,
2242 -1, 17, 18, -1, -1, 5, 6, -1, 8, 9,
2243 10, 11, 12, -1, 14, 15, 135, 17, 18, 138,
2244 -1, -1, 141, -1, 143, -1, 42, 5, 6, -1,
2245 8, 9, 10, 11, 12, -1, 14, 15, -1, 17,
2246 18, -1, 42, -1, 5, 6, -1, 8, 9, 10,
2247 11, 12, -1, 14, 15, 135, 17, 18, 138, -1,
2248 -1, 141, -1, 143, 42, -1, -1, -1, -1, -1,
2249 -1, 135, -1, -1, 138, -1, -1, 141, -1, 143,
2250 -1, 42, -1, -1, -1, -1, -1, -1, -1, -1,
2251 135, -1, -1, 138, -1, -1, 141, -1, 143, -1,
2252 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2253 -1, -1, -1, -1, -1, -1, -1, -1, -1, 135,
2254 -1, -1, 138, -1, -1, 141, -1, 143, -1, -1,
2255 -1, -1, -1, -1, -1, 135, -1, -1, 138, -1,
2256 -1, 141, -1, 143, -1, -1, -1, -1, -1, -1,
2257 -1, -1, -1, 30, -1, -1, -1, 135, -1, -1,
2258 138, -1, -1, 141, -1, 143, -1, -1, -1, -1,
2259 -1, 48, 49, -1, 135, -1, -1, 138, -1, -1,
2260 141, -1, 143, 60, 61, 62, 63, 64, 65, 66,
2261 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2262 77, 78, 79, 80, 81, 82, -1, -1, -1, -1,
2263 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2264 -1, -1, -1, -1, -1, -1, 103, 104, 105, -1,
2265 -1, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2266 117, 118, 119, 120, 121, 122, 123, 124, 125, 126
2269 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2270 symbol of state STATE-NUM. */
2271 static const unsigned char yystos[] =
2273 0, 14, 15, 17, 18, 19, 25, 26, 44, 47,
2274 51, 154, 156, 157, 158, 186, 187, 188, 190, 189,
2275 45, 59, 195, 132, 50, 132, 13, 132, 35, 36,
2276 37, 38, 39, 40, 41, 43, 131, 159, 160, 161,
2277 0, 188, 39, 41, 162, 205, 35, 36, 37, 40,
2278 163, 202, 204, 211, 132, 132, 138, 196, 17, 194,
2279 5, 6, 8, 9, 10, 11, 12, 42, 135, 138,
2280 141, 143, 154, 157, 175, 176, 208, 161, 161, 27,
2281 28, 185, 161, 161, 16, 212, 213, 24, 144, 203,
2282 212, 17, 17, 17, 197, 136, 4, 4, 4, 143,
2283 8, 144, 176, 181, 134, 136, 185, 185, 9, 10,
2284 11, 152, 153, 176, 182, 53, 54, 55, 56, 57,
2285 58, 164, 200, 200, 156, 216, 133, 140, 32, 176,
2286 177, 179, 180, 139, 139, 144, 181, 133, 144, 180,
2287 182, 176, 21, 22, 3, 4, 7, 20, 33, 34,
2288 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2289 76, 77, 78, 79, 80, 81, 82, 108, 109, 110,
2290 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2291 122, 124, 125, 126, 138, 141, 143, 145, 147, 148,
2292 149, 183, 208, 191, 4, 8, 176, 178, 23, 143,
2293 201, 30, 48, 49, 60, 61, 62, 63, 64, 65,
2294 81, 82, 103, 104, 105, 108, 121, 122, 123, 124,
2295 125, 126, 147, 148, 149, 214, 220, 221, 222, 223,
2296 17, 166, 133, 137, 176, 176, 142, 144, 176, 137,
2297 192, 193, 83, 84, 85, 86, 87, 88, 89, 90,
2298 91, 92, 150, 21, 22, 89, 90, 91, 92, 93,
2299 94, 95, 96, 97, 98, 99, 100, 101, 102, 151,
2300 136, 136, 136, 136, 136, 140, 182, 184, 143, 184,
2301 144, 184, 17, 136, 136, 136, 133, 173, 157, 48,
2302 8, 176, 210, 9, 12, 9, 152, 164, 150, 151,
2303 176, 176, 210, 176, 176, 217, 210, 210, 210, 210,
2304 210, 176, 176, 210, 164, 106, 107, 110, 111, 128,
2305 129, 165, 32, 177, 168, 140, 142, 142, 168, 173,
2306 173, 136, 136, 182, 182, 182, 182, 182, 133, 140,
2307 144, 176, 184, 142, 144, 182, 182, 182, 29, 46,
2308 171, 174, 136, 3, 4, 7, 20, 21, 22, 33,
2309 34, 50, 141, 183, 207, 208, 209, 209, 209, 209,
2310 178, 176, 176, 133, 170, 133, 170, 209, 138, 133,
2311 133, 133, 133, 133, 133, 209, 209, 31, 178, 176,
2312 210, 127, 165, 167, 182, 182, 219, 133, 133, 133,
2313 133, 182, 142, 144, 133, 133, 31, 17, 4, 173,
2314 32, 176, 198, 199, 52, 206, 184, 133, 133, 209,
2315 209, 209, 9, 46, 9, 219, 209, 138, 210, 176,
2316 210, 210, 210, 133, 133, 176, 209, 209, 133, 133,
2317 133, 133, 137, 182, 182, 182, 182, 142, 182, 182,
2318 176, 166, 133, 137, 17, 142, 12, 12, 136, 133,
2319 133, 209, 4, 209, 133, 209, 133, 133, 133, 209,
2320 209, 136, 176, 182, 182, 210, 133, 137, 133, 133,
2321 137, 137, 137, 154, 155, 32, 176, 168, 133, 209,
2322 209, 176, 218, 209, 209, 133, 170, 170, 209, 133,
2323 210, 210, 210, 218, 209, 137, 137, 182, 182, 182,
2324 166, 171, 172, 17, 133, 138, 209, 133, 137, 140,
2325 209, 137, 137, 137, 137, 155, 46, 169, 12, 140,
2326 152, 215, 166, 176, 168, 140, 168, 4, 209, 207,
2327 140, 152, 209, 31, 133, 207, 166, 12, 12, 133,
2328 209, 209, 12, 64, 209, 12, 209
2331 #define yyerrok (yyerrstatus = 0)
2332 #define yyclearin (yychar = YYEMPTY)
2333 #define YYEMPTY (-2)
2336 #define YYACCEPT goto yyacceptlab
2337 #define YYABORT goto yyabortlab
2338 #define YYERROR goto yyerrorlab
2341 /* Like YYERROR except do call yyerror. This remains here temporarily
2342 to ease the transition to the new meaning of YYERROR, for GCC.
2343 Once GCC version 2 has supplanted version 1, this can go. */
2345 #define YYFAIL goto yyerrlab
2347 #define YYRECOVERING() (!!yyerrstatus)
2349 #define YYBACKUP(Token, Value) \
2351 if (yychar == YYEMPTY && yylen == 1) \
2355 yytoken = YYTRANSLATE (yychar); \
2361 yyerror (YY_("syntax error: cannot back up")); \
2368 #define YYERRCODE 256
2371 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2372 If N is 0, then set CURRENT to the empty location which ends
2373 the previous symbol: RHS[0] (always defined). */
2375 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2376 #ifndef YYLLOC_DEFAULT
2377 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2381 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2382 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2383 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2384 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2388 (Current).first_line = (Current).last_line = \
2389 YYRHSLOC (Rhs, 0).last_line; \
2390 (Current).first_column = (Current).last_column = \
2391 YYRHSLOC (Rhs, 0).last_column; \
2397 /* YY_LOCATION_PRINT -- Print the location on the stream.
2398 This macro was not mandated originally: define only if we know
2399 we won't break user code: when these are the locations we know. */
2401 #ifndef YY_LOCATION_PRINT
2402 # if YYLTYPE_IS_TRIVIAL
2403 # define YY_LOCATION_PRINT(File, Loc) \
2404 fprintf (File, "%d.%d-%d.%d", \
2405 (Loc).first_line, (Loc).first_column, \
2406 (Loc).last_line, (Loc).last_column)
2408 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2413 /* YYLEX -- calling `yylex' with the right arguments. */
2416 # define YYLEX yylex (YYLEX_PARAM)
2418 # define YYLEX yylex ()
2421 /* Enable debugging if requested. */
2425 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2426 # define YYFPRINTF fprintf
2429 # define YYDPRINTF(Args) \
2435 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2439 YYFPRINTF (stderr, "%s ", Title); \
2440 yysymprint (stderr, \
2442 YYFPRINTF (stderr, "\n"); \
2446 /*------------------------------------------------------------------.
2447 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2449 `------------------------------------------------------------------*/
2451 #if defined (__STDC__) || defined (__cplusplus)
2453 yy_stack_print (short int *bottom, short int *top)
2456 yy_stack_print (bottom, top)
2461 YYFPRINTF (stderr, "Stack now");
2462 for (/* Nothing. */; bottom <= top; ++bottom)
2463 YYFPRINTF (stderr, " %d", *bottom);
2464 YYFPRINTF (stderr, "\n");
2467 # define YY_STACK_PRINT(Bottom, Top) \
2470 yy_stack_print ((Bottom), (Top)); \
2474 /*------------------------------------------------.
2475 | Report that the YYRULE is going to be reduced. |
2476 `------------------------------------------------*/
2478 #if defined (__STDC__) || defined (__cplusplus)
2480 yy_reduce_print (int yyrule)
2483 yy_reduce_print (yyrule)
2488 unsigned long int yylno = yyrline[yyrule];
2489 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2491 /* Print the symbols being reduced, and their result. */
2492 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2493 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2494 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2497 # define YY_REDUCE_PRINT(Rule) \
2500 yy_reduce_print (Rule); \
2503 /* Nonzero means print parse trace. It is left uninitialized so that
2504 multiple parsers can coexist. */
2506 #else /* !YYDEBUG */
2507 # define YYDPRINTF(Args)
2508 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2509 # define YY_STACK_PRINT(Bottom, Top)
2510 # define YY_REDUCE_PRINT(Rule)
2511 #endif /* !YYDEBUG */
2514 /* YYINITDEPTH -- initial size of the parser's stacks. */
2516 # define YYINITDEPTH 200
2519 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2520 if the built-in stack extension method is used).
2522 Do not make this value too large; the results are undefined if
2523 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2524 evaluated with infinite-precision integer arithmetic. */
2527 # define YYMAXDEPTH 10000
2535 # if defined (__GLIBC__) && defined (_STRING_H)
2536 # define yystrlen strlen
2538 /* Return the length of YYSTR. */
2540 # if defined (__STDC__) || defined (__cplusplus)
2541 yystrlen (const char *yystr)
2547 const char *yys = yystr;
2549 while (*yys++ != '\0')
2552 return yys - yystr - 1;
2558 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2559 # define yystpcpy stpcpy
2561 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2564 # if defined (__STDC__) || defined (__cplusplus)
2565 yystpcpy (char *yydest, const char *yysrc)
2567 yystpcpy (yydest, yysrc)
2573 const char *yys = yysrc;
2575 while ((*yyd++ = *yys++) != '\0')
2584 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2585 quotes and backslashes, so that it's suitable for yyerror. The
2586 heuristic is that double-quoting is unnecessary unless the string
2587 contains an apostrophe, a comma, or backslash (other than
2588 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2589 null, do not copy; instead, return the length of what the result
2592 yytnamerr (char *yyres, const char *yystr)
2597 char const *yyp = yystr;
2604 goto do_not_strip_quotes;
2608 goto do_not_strip_quotes;
2621 do_not_strip_quotes: ;
2625 return yystrlen (yystr);
2627 return yystpcpy (yyres, yystr) - yyres;
2631 #endif /* YYERROR_VERBOSE */
2636 /*--------------------------------.
2637 | Print this symbol on YYOUTPUT. |
2638 `--------------------------------*/
2640 #if defined (__STDC__) || defined (__cplusplus)
2642 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2645 yysymprint (yyoutput, yytype, yyvaluep)
2651 /* Pacify ``unused variable'' warnings. */
2654 if (yytype < YYNTOKENS)
2655 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2657 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2661 if (yytype < YYNTOKENS)
2662 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2669 YYFPRINTF (yyoutput, ")");
2672 #endif /* ! YYDEBUG */
2673 /*-----------------------------------------------.
2674 | Release the memory associated to this symbol. |
2675 `-----------------------------------------------*/
2677 #if defined (__STDC__) || defined (__cplusplus)
2679 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2682 yydestruct (yymsg, yytype, yyvaluep)
2688 /* Pacify ``unused variable'' warnings. */
2693 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2704 /* Prevent warnings from -Wmissing-prototypes. */
2706 #ifdef YYPARSE_PARAM
2707 # if defined (__STDC__) || defined (__cplusplus)
2708 int yyparse (void *YYPARSE_PARAM);
2712 #else /* ! YYPARSE_PARAM */
2713 #if defined (__STDC__) || defined (__cplusplus)
2718 #endif /* ! YYPARSE_PARAM */
2722 /* The look-ahead symbol. */
2725 /* The semantic value of the look-ahead symbol. */
2728 /* Number of syntax errors so far. */
2737 #ifdef YYPARSE_PARAM
2738 # if defined (__STDC__) || defined (__cplusplus)
2739 int yyparse (void *YYPARSE_PARAM)
2741 int yyparse (YYPARSE_PARAM)
2742 void *YYPARSE_PARAM;
2744 #else /* ! YYPARSE_PARAM */
2745 #if defined (__STDC__) || defined (__cplusplus)
2759 /* Number of tokens to shift before error messages enabled. */
2761 /* Look-ahead token as an internal (translated) token number. */
2764 /* Three stacks and their tools:
2765 `yyss': related to states,
2766 `yyvs': related to semantic values,
2767 `yyls': related to locations.
2769 Refer to the stacks thru separate pointers, to allow yyoverflow
2770 to reallocate them elsewhere. */
2772 /* The state stack. */
2773 short int yyssa[YYINITDEPTH];
2774 short int *yyss = yyssa;
2777 /* The semantic value stack. */
2778 YYSTYPE yyvsa[YYINITDEPTH];
2779 YYSTYPE *yyvs = yyvsa;
2784 #define YYPOPSTACK (yyvsp--, yyssp--)
2786 YYSIZE_T yystacksize = YYINITDEPTH;
2788 /* The variables used to return semantic value and location from the
2793 /* When reducing, the number of symbols on the RHS of the reduced
2797 YYDPRINTF ((stderr, "Starting parse\n"));
2802 yychar = YYEMPTY; /* Cause a token to be read. */
2804 /* Initialize stack pointers.
2805 Waste one element of value and location stack
2806 so that they stay on the same level as the state stack.
2807 The wasted elements are never initialized. */
2814 /*------------------------------------------------------------.
2815 | yynewstate -- Push a new state, which is found in yystate. |
2816 `------------------------------------------------------------*/
2818 /* In all cases, when you get here, the value and location stacks
2819 have just been pushed. so pushing a state here evens the stacks.
2826 if (yyss + yystacksize - 1 <= yyssp)
2828 /* Get the current used size of the three stacks, in elements. */
2829 YYSIZE_T yysize = yyssp - yyss + 1;
2833 /* Give user a chance to reallocate the stack. Use copies of
2834 these so that the &'s don't force the real ones into
2836 YYSTYPE *yyvs1 = yyvs;
2837 short int *yyss1 = yyss;
2840 /* Each stack pointer address is followed by the size of the
2841 data in use in that stack, in bytes. This used to be a
2842 conditional around just the two extra args, but that might
2843 be undefined if yyoverflow is a macro. */
2844 yyoverflow (YY_("memory exhausted"),
2845 &yyss1, yysize * sizeof (*yyssp),
2846 &yyvs1, yysize * sizeof (*yyvsp),
2853 #else /* no yyoverflow */
2854 # ifndef YYSTACK_RELOCATE
2855 goto yyexhaustedlab;
2857 /* Extend the stack our own way. */
2858 if (YYMAXDEPTH <= yystacksize)
2859 goto yyexhaustedlab;
2861 if (YYMAXDEPTH < yystacksize)
2862 yystacksize = YYMAXDEPTH;
2865 short int *yyss1 = yyss;
2866 union yyalloc *yyptr =
2867 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2869 goto yyexhaustedlab;
2870 YYSTACK_RELOCATE (yyss);
2871 YYSTACK_RELOCATE (yyvs);
2873 # undef YYSTACK_RELOCATE
2875 YYSTACK_FREE (yyss1);
2878 #endif /* no yyoverflow */
2880 yyssp = yyss + yysize - 1;
2881 yyvsp = yyvs + yysize - 1;
2884 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2885 (unsigned long int) yystacksize));
2887 if (yyss + yystacksize - 1 <= yyssp)
2891 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2900 /* Do appropriate processing given the current state. */
2901 /* Read a look-ahead token if we need one and don't already have one. */
2904 /* First try to decide what to do without reference to look-ahead token. */
2906 yyn = yypact[yystate];
2907 if (yyn == YYPACT_NINF)
2910 /* Not known => get a look-ahead token if don't already have one. */
2912 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2913 if (yychar == YYEMPTY)
2915 YYDPRINTF ((stderr, "Reading a token: "));
2919 if (yychar <= YYEOF)
2921 yychar = yytoken = YYEOF;
2922 YYDPRINTF ((stderr, "Now at end of input.\n"));
2926 yytoken = YYTRANSLATE (yychar);
2927 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2930 /* If the proper action on seeing token YYTOKEN is to reduce or to
2931 detect an error, take that action. */
2933 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2938 if (yyn == 0 || yyn == YYTABLE_NINF)
2947 /* Shift the look-ahead token. */
2948 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2950 /* Discard the token being shifted unless it is eof. */
2951 if (yychar != YYEOF)
2957 /* Count tokens shifted since error; after three, turn off error
2966 /*-----------------------------------------------------------.
2967 | yydefault -- do the default action for the current state. |
2968 `-----------------------------------------------------------*/
2970 yyn = yydefact[yystate];
2976 /*-----------------------------.
2977 | yyreduce -- Do a reduction. |
2978 `-----------------------------*/
2980 /* yyn is the number of a rule to reduce with. */
2983 /* If YYLEN is nonzero, implement the default value of the action:
2986 Otherwise, the following line sets YYVAL to garbage.
2987 This behavior is undocumented and Bison
2988 users should not rely upon it. Assigning to YYVAL
2989 unconditionally makes the parser a bit smaller, and it avoids a
2990 GCC warning that YYVAL may be used uninitialized. */
2991 yyval = yyvsp[1-yylen];
2994 YY_REDUCE_PRINT (yyn);
2998 #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2999 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3003 #line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3004 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3008 #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3009 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3013 #line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3014 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3018 #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3019 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3023 #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3024 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3028 #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3029 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3033 #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3034 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3038 #line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3039 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3043 #line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3044 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3048 #line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3049 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3053 #line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3054 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3058 #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3059 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3063 #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3064 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3068 #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3069 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3073 #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3074 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3078 #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3079 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3083 #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3084 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3088 #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3089 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3093 #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3094 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3098 #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3099 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3103 #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3104 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3108 #line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3109 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3113 #line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3114 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3118 #line 1068 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3119 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3123 #line 1069 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3124 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3128 #line 1078 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3129 { (yyval.StrVal) = 0; ;}
3133 #line 1082 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3135 (yyval.StrVal) = (yyvsp[-1].StrVal);
3141 #line 1086 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3149 #line 1093 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3151 (yyval.StrVal) = (yyvsp[-1].StrVal);
3157 #line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3165 #line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3166 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3170 #line 1104 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3171 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3175 #line 1105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3176 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3180 #line 1106 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3181 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3185 #line 1107 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3186 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3190 #line 1111 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3191 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3195 #line 1112 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3196 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3200 #line 1113 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3205 #line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3210 #line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3215 #line 1122 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3220 #line 1123 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3225 #line 1124 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3230 #line 1128 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3235 #line 1129 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3240 #line 1130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3245 #line 1131 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3246 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3250 #line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3251 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3255 #line 1135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.UIntVal) = CallingConv::C; ;}
3260 #line 1136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3261 { (yyval.UIntVal) = CallingConv::C; ;}
3265 #line 1137 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3266 { (yyval.UIntVal) = CallingConv::Fast; ;}
3270 #line 1138 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.UIntVal) = CallingConv::Cold; ;}
3275 #line 1139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3276 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3280 #line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3281 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3285 #line 1141 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3287 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3288 GEN_ERROR("Calling conv too large");
3289 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3295 #line 1148 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3296 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3300 #line 1149 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3301 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3305 #line 1150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3306 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
3310 #line 1151 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3311 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
3315 #line 1154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3316 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3320 #line 1155 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3322 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3327 #line 1160 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3328 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3332 #line 1164 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3333 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3337 #line 1165 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3339 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3344 #line 1172 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3345 { (yyval.UIntVal) = 0; ;}
3349 #line 1173 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3351 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3352 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3353 GEN_ERROR("Alignment must be a power of two");
3359 #line 1179 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3360 { (yyval.UIntVal) = 0; ;}
3364 #line 1180 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3366 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3367 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3368 GEN_ERROR("Alignment must be a power of two");
3374 #line 1188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3376 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3377 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3378 GEN_ERROR("Invalid character in section name");
3379 (yyval.StrVal) = (yyvsp[0].StrVal);
3385 #line 1196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3386 { (yyval.StrVal) = 0; ;}
3390 #line 1197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3391 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3395 #line 1202 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3400 #line 1203 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3405 #line 1204 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3407 CurGV->setSection((yyvsp[0].StrVal));
3408 free((yyvsp[0].StrVal));
3414 #line 1209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3416 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3417 GEN_ERROR("Alignment must be a power of two");
3418 CurGV->setAlignment((yyvsp[0].UInt64Val));
3424 #line 1225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3426 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3432 #line 1229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3434 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3440 #line 1233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3442 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3443 GEN_ERROR("Cannot form a pointer to a basic block");
3444 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3445 delete (yyvsp[-1].TypeVal);
3451 #line 1240 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3452 { // Named types are also simple types...
3453 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3455 (yyval.TypeVal) = new PATypeHolder(tmp);
3460 #line 1245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3461 { // Type UpReference
3462 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3463 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3464 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3465 (yyval.TypeVal) = new PATypeHolder(OT);
3466 UR_OUT("New Upreference!\n");
3472 #line 1253 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3474 std::vector<const Type*> Params;
3475 std::vector<FunctionType::ParameterAttributes> Attrs;
3476 Attrs.push_back((yyvsp[0].ParamAttrs));
3477 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3478 Params.push_back(I->Ty->get());
3479 if (I->Ty->get() != Type::VoidTy)
3480 Attrs.push_back(I->Attrs);
3482 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3483 if (isVarArg) Params.pop_back();
3485 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3486 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3487 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3488 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3494 #line 1271 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3496 std::vector<const Type*> Params;
3497 std::vector<FunctionType::ParameterAttributes> Attrs;
3498 Attrs.push_back((yyvsp[0].ParamAttrs));
3499 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3500 Params.push_back(I->Ty->get());
3501 if (I->Ty->get() != Type::VoidTy)
3502 Attrs.push_back(I->Attrs);
3504 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3505 if (isVarArg) Params.pop_back();
3507 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3508 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3509 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3515 #line 1289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3516 { // Sized array type?
3517 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3518 delete (yyvsp[-1].TypeVal);
3524 #line 1294 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3525 { // Packed array type?
3526 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3527 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3528 GEN_ERROR("Unsigned result not equal to signed result");
3529 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3530 GEN_ERROR("Element type of a PackedType must be primitive");
3531 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3532 GEN_ERROR("Vector length should be a power of 2");
3533 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3534 delete (yyvsp[-1].TypeVal);
3540 #line 1306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3541 { // Structure type?
3542 std::vector<const Type*> Elements;
3543 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3544 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3545 Elements.push_back(*I);
3547 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3548 delete (yyvsp[-1].TypeList);
3554 #line 1316 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3555 { // Empty structure type?
3556 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3562 #line 1320 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3564 std::vector<const Type*> Elements;
3565 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3566 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3567 Elements.push_back(*I);
3569 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3570 delete (yyvsp[-2].TypeList);
3576 #line 1330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3577 { // Empty structure type?
3578 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3584 #line 1337 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3586 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3587 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3592 #line 1344 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3594 if (!UpRefs.empty())
3595 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3596 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3597 GEN_ERROR("LLVM functions cannot return aggregate types");
3598 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3603 #line 1351 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3605 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3610 #line 1356 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3612 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3613 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3619 #line 1361 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3621 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3627 #line 1369 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3629 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3630 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3631 TWA.Ty = new PATypeHolder(Type::VoidTy);
3632 (yyval.TypeWithAttrsList)->push_back(TWA);
3638 #line 1376 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3640 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3641 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3642 TWA.Ty = new PATypeHolder(Type::VoidTy);
3643 (yyval.TypeWithAttrsList)->push_back(TWA);
3649 #line 1383 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3651 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3657 #line 1391 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3659 (yyval.TypeList) = new std::list<PATypeHolder>();
3660 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3666 #line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3668 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3674 #line 1407 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3675 { // Nonempty unsized arr
3676 if (!UpRefs.empty())
3677 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3678 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3680 GEN_ERROR("Cannot make array constant with type: '" +
3681 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3682 const Type *ETy = ATy->getElementType();
3683 int NumElements = ATy->getNumElements();
3685 // Verify that we have the correct size...
3686 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3687 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3688 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3689 itostr(NumElements) + "");
3691 // Verify all elements are correct type!
3692 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3693 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3694 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3695 ETy->getDescription() +"' as required!\nIt is of type '"+
3696 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3699 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3700 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3706 #line 1435 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3708 if (!UpRefs.empty())
3709 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3710 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3712 GEN_ERROR("Cannot make array constant with type: '" +
3713 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3715 int NumElements = ATy->getNumElements();
3716 if (NumElements != -1 && NumElements != 0)
3717 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3718 " arguments, but has size of " + itostr(NumElements) +"");
3719 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3720 delete (yyvsp[-2].TypeVal);
3726 #line 1451 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3728 if (!UpRefs.empty())
3729 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3730 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3732 GEN_ERROR("Cannot make array constant with type: '" +
3733 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3735 int NumElements = ATy->getNumElements();
3736 const Type *ETy = ATy->getElementType();
3737 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3738 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3739 GEN_ERROR("Can't build string constant of size " +
3740 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3741 " when array has size " + itostr(NumElements) + "");
3742 std::vector<Constant*> Vals;
3743 if (ETy == Type::Int8Ty) {
3744 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3745 C != (unsigned char*)EndStr; ++C)
3746 Vals.push_back(ConstantInt::get(ETy, *C));
3748 free((yyvsp[0].StrVal));
3749 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3751 free((yyvsp[0].StrVal));
3752 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3753 delete (yyvsp[-2].TypeVal);
3759 #line 1480 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3760 { // Nonempty unsized arr
3761 if (!UpRefs.empty())
3762 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3763 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3765 GEN_ERROR("Cannot make packed constant with type: '" +
3766 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3767 const Type *ETy = PTy->getElementType();
3768 int NumElements = PTy->getNumElements();
3770 // Verify that we have the correct size...
3771 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3772 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3773 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3774 itostr(NumElements) + "");
3776 // Verify all elements are correct type!
3777 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3778 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3779 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3780 ETy->getDescription() +"' as required!\nIt is of type '"+
3781 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3784 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3785 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3791 #line 1508 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3793 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3795 GEN_ERROR("Cannot make struct constant with type: '" +
3796 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3798 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3799 GEN_ERROR("Illegal number of initializers for structure type");
3801 // Check to ensure that constants are compatible with the type initializer!
3802 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3803 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3804 GEN_ERROR("Expected type '" +
3805 STy->getElementType(i)->getDescription() +
3806 "' for element #" + utostr(i) +
3807 " of structure initializer");
3809 // Check to ensure that Type is not packed
3810 if (STy->isPacked())
3811 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3813 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3814 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3820 #line 1533 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3822 if (!UpRefs.empty())
3823 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3824 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3826 GEN_ERROR("Cannot make struct constant with type: '" +
3827 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3829 if (STy->getNumContainedTypes() != 0)
3830 GEN_ERROR("Illegal number of initializers for structure type");
3832 // Check to ensure that Type is not packed
3833 if (STy->isPacked())
3834 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3836 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3837 delete (yyvsp[-2].TypeVal);
3843 #line 1552 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3845 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3847 GEN_ERROR("Cannot make struct constant with type: '" +
3848 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3850 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3851 GEN_ERROR("Illegal number of initializers for structure type");
3853 // Check to ensure that constants are compatible with the type initializer!
3854 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3855 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3856 GEN_ERROR("Expected type '" +
3857 STy->getElementType(i)->getDescription() +
3858 "' for element #" + utostr(i) +
3859 " of structure initializer");
3861 // Check to ensure that Type is packed
3862 if (!STy->isPacked())
3863 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3865 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3866 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3872 #line 1577 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3874 if (!UpRefs.empty())
3875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3876 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3878 GEN_ERROR("Cannot make struct constant with type: '" +
3879 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3881 if (STy->getNumContainedTypes() != 0)
3882 GEN_ERROR("Illegal number of initializers for structure type");
3884 // Check to ensure that Type is packed
3885 if (!STy->isPacked())
3886 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3888 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3889 delete (yyvsp[-4].TypeVal);
3895 #line 1596 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3897 if (!UpRefs.empty())
3898 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3899 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3901 GEN_ERROR("Cannot make null pointer constant with type: '" +
3902 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3904 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3905 delete (yyvsp[-1].TypeVal);
3911 #line 1608 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3913 if (!UpRefs.empty())
3914 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3915 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3916 delete (yyvsp[-1].TypeVal);
3922 #line 1615 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3924 if (!UpRefs.empty())
3925 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3926 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3928 GEN_ERROR("Global const reference must be a pointer type");
3930 // ConstExprs can exist in the body of a function, thus creating
3931 // GlobalValues whenever they refer to a variable. Because we are in
3932 // the context of a function, getValNonImprovising will search the functions
3933 // symbol table instead of the module symbol table for the global symbol,
3934 // which throws things all off. To get around this, we just tell
3935 // getValNonImprovising that we are at global scope here.
3937 Function *SavedCurFn = CurFun.CurrentFunction;
3938 CurFun.CurrentFunction = 0;
3940 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3943 CurFun.CurrentFunction = SavedCurFn;
3945 // If this is an initializer for a constant pointer, which is referencing a
3946 // (currently) undefined variable, create a stub now that shall be replaced
3947 // in the future with the right type of variable.
3950 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3951 const PointerType *PT = cast<PointerType>(Ty);
3953 // First check to see if the forward references value is already created!
3954 PerModuleInfo::GlobalRefsType::iterator I =
3955 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3957 if (I != CurModule.GlobalRefs.end()) {
3958 V = I->second; // Placeholder already exists, use it...
3959 (yyvsp[0].ValIDVal).destroy();
3962 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
3963 Name = (yyvsp[0].ValIDVal).Name;
3964 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
3965 GEN_ERROR("Invalid reference to global");
3967 // Create the forward referenced global.
3969 if (const FunctionType *FTy =
3970 dyn_cast<FunctionType>(PT->getElementType())) {
3971 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3972 CurModule.CurrentModule);
3974 GV = new GlobalVariable(PT->getElementType(), false,
3975 GlobalValue::ExternalLinkage, 0,
3976 Name, CurModule.CurrentModule);
3979 // Keep track of the fact that we have a forward ref to recycle it
3980 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3985 (yyval.ConstVal) = cast<GlobalValue>(V);
3986 delete (yyvsp[-1].TypeVal); // Free the type handle
3992 #line 1681 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3994 if (!UpRefs.empty())
3995 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3996 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3997 GEN_ERROR("Mismatched types for constant expression: " +
3998 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
3999 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4000 delete (yyvsp[-1].TypeVal);
4006 #line 1691 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4008 if (!UpRefs.empty())
4009 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4010 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4011 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4012 GEN_ERROR("Cannot create a null initialized value of this type");
4013 (yyval.ConstVal) = Constant::getNullValue(Ty);
4014 delete (yyvsp[-1].TypeVal);
4020 #line 1701 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4021 { // integral constants
4022 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4023 GEN_ERROR("Constant value doesn't fit in type");
4024 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
4030 #line 1707 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4031 { // integral constants
4032 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4033 GEN_ERROR("Constant value doesn't fit in type");
4034 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
4040 #line 1713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4041 { // Boolean constants
4042 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4043 (yyval.ConstVal) = ConstantInt::getTrue();
4049 #line 1718 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4050 { // Boolean constants
4051 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4052 (yyval.ConstVal) = ConstantInt::getFalse();
4058 #line 1723 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4059 { // Float & Double constants
4060 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4061 GEN_ERROR("Floating point constant invalid for type");
4062 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4068 #line 1731 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4070 if (!UpRefs.empty())
4071 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4072 Constant *Val = (yyvsp[-3].ConstVal);
4073 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4074 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4075 GEN_ERROR("invalid cast opcode for cast from '" +
4076 Val->getType()->getDescription() + "' to '" +
4077 DestTy->getDescription() + "'");
4078 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4079 delete (yyvsp[-1].TypeVal);
4084 #line 1743 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4086 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4087 GEN_ERROR("GetElementPtr requires a pointer operand");
4090 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
4092 GEN_ERROR("Index list invalid for constant getelementptr");
4094 SmallVector<Constant*, 8> IdxVec;
4095 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4096 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4097 IdxVec.push_back(C);
4099 GEN_ERROR("Indices to constant getelementptr must be constants");
4101 delete (yyvsp[-1].ValueList);
4103 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4109 #line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4111 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4112 GEN_ERROR("Select condition must be of boolean type");
4113 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4114 GEN_ERROR("Select operand types must match");
4115 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4121 #line 1772 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4123 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4124 GEN_ERROR("Binary operator types must match");
4126 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4131 #line 1778 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4133 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4134 GEN_ERROR("Logical operator types must match");
4135 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4136 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4137 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4138 GEN_ERROR("Logical operator requires integral operands");
4140 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4146 #line 1789 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4148 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4149 GEN_ERROR("icmp operand types must match");
4150 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4155 #line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4157 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4158 GEN_ERROR("fcmp operand types must match");
4159 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4164 #line 1799 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4166 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4167 GEN_ERROR("Invalid extractelement operands");
4168 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4174 #line 1805 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4176 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4177 GEN_ERROR("Invalid insertelement operands");
4178 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4184 #line 1811 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4186 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4187 GEN_ERROR("Invalid shufflevector operands");
4188 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4194 #line 1820 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4196 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4202 #line 1824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4204 (yyval.ConstVector) = new std::vector<Constant*>();
4205 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4211 #line 1832 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4212 { (yyval.BoolVal) = false; ;}
4216 #line 1832 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4217 { (yyval.BoolVal) = true; ;}
4221 #line 1843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4223 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4224 CurModule.ModuleDone();
4230 #line 1848 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4232 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4233 CurModule.ModuleDone();
4239 #line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4240 { CurFun.isDeclare = false; ;}
4244 #line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4246 CurFun.FunctionDone();
4252 #line 1865 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4253 { CurFun.isDeclare = true; ;}
4257 #line 1865 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4264 #line 1868 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4271 #line 1871 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4273 // Emit an error if there are any unresolved types left.
4274 if (!CurModule.LateResolveTypes.empty()) {
4275 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4276 if (DID.Type == ValID::LocalName) {
4277 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4279 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4287 #line 1883 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4289 if (!UpRefs.empty())
4290 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4291 // Eagerly resolve types. This is not an optimization, this is a
4292 // requirement that is due to the fact that we could have this:
4294 // %list = type { %list * }
4295 // %list = type { %list * } ; repeated type decl
4297 // If types are not resolved eagerly, then the two types will not be
4298 // determined to be the same type!
4300 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4302 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4304 // If this is a named type that is not a redefinition, add it to the slot
4306 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4309 delete (yyvsp[0].TypeVal);
4315 #line 1907 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4317 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4319 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4321 // If this is a named type that is not a redefinition, add it to the slot
4323 CurModule.Types.push_back((yyvsp[0].PrimType));
4330 #line 1918 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4332 /* "Externally Visible" Linkage */
4333 if ((yyvsp[0].ConstVal) == 0)
4334 GEN_ERROR("Global value initializer is not a constant");
4335 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4336 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4342 #line 1925 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4349 #line 1928 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4351 if ((yyvsp[0].ConstVal) == 0)
4352 GEN_ERROR("Global value initializer is not a constant");
4353 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4359 #line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4366 #line 1936 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4368 if (!UpRefs.empty())
4369 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4370 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4372 delete (yyvsp[0].TypeVal);
4377 #line 1942 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4385 #line 1946 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4392 #line 1949 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4399 #line 1955 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4401 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4402 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4403 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4404 free((yyvsp[0].StrVal));
4406 if (AsmSoFar.empty())
4407 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4409 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4415 #line 1968 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4417 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4418 free((yyvsp[0].StrVal));
4423 #line 1972 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4425 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4426 free((yyvsp[0].StrVal));
4431 #line 1979 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4433 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4434 free((yyvsp[0].StrVal));
4440 #line 1984 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4442 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4443 free((yyvsp[0].StrVal));
4449 #line 1989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4456 #line 1998 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4458 if (!UpRefs.empty())
4459 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4460 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4461 GEN_ERROR("void typed arguments are invalid");
4462 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4463 (yyval.ArgList) = (yyvsp[-4].ArgList);
4464 (yyvsp[-4].ArgList)->push_back(E);
4470 #line 2008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4472 if (!UpRefs.empty())
4473 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4474 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4475 GEN_ERROR("void typed arguments are invalid");
4476 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4477 (yyval.ArgList) = new ArgListType;
4478 (yyval.ArgList)->push_back(E);
4484 #line 2019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4486 (yyval.ArgList) = (yyvsp[0].ArgList);
4492 #line 2023 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4494 (yyval.ArgList) = (yyvsp[-2].ArgList);
4495 struct ArgListEntry E;
4496 E.Ty = new PATypeHolder(Type::VoidTy);
4498 E.Attrs = FunctionType::NoAttributeSet;
4499 (yyval.ArgList)->push_back(E);
4505 #line 2032 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4507 (yyval.ArgList) = new ArgListType;
4508 struct ArgListEntry E;
4509 E.Ty = new PATypeHolder(Type::VoidTy);
4511 E.Attrs = FunctionType::NoAttributeSet;
4512 (yyval.ArgList)->push_back(E);
4518 #line 2041 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4520 (yyval.ArgList) = 0;
4526 #line 2047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4528 UnEscapeLexed((yyvsp[-6].StrVal));
4529 std::string FunctionName((yyvsp[-6].StrVal));
4530 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4532 // Check the function result for abstractness if this is a define. We should
4533 // have no abstract types at this point
4534 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4535 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4537 std::vector<const Type*> ParamTypeList;
4538 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4539 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4540 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4541 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4542 const Type* Ty = I->Ty->get();
4543 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4544 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4545 ParamTypeList.push_back(Ty);
4546 if (Ty != Type::VoidTy)
4547 ParamAttrs.push_back(I->Attrs);
4551 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4552 if (isVarArg) ParamTypeList.pop_back();
4554 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4556 const PointerType *PFT = PointerType::get(FT);
4557 delete (yyvsp[-7].TypeVal);
4560 if (!FunctionName.empty()) {
4561 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4563 ID = ValID::createGlobalID(CurModule.Values[PFT].size());
4567 // See if this function was forward referenced. If so, recycle the object.
4568 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4569 // Move the function to the end of the list, from whereever it was
4570 // previously inserted.
4571 Fn = cast<Function>(FWRef);
4572 CurModule.CurrentModule->getFunctionList().remove(Fn);
4573 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4574 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4575 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4576 if (Fn->getFunctionType() != FT ) {
4577 // The existing function doesn't have the same type. This is an overload
4579 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4580 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4581 // Neither the existing or the current function is a declaration and they
4582 // have the same name and same type. Clearly this is a redefinition.
4583 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4584 } if (Fn->isDeclaration()) {
4585 // Make sure to strip off any argument names so we can't get conflicts.
4586 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4590 } else { // Not already defined?
4591 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4592 CurModule.CurrentModule);
4594 InsertValue(Fn, CurModule.Values);
4597 CurFun.FunctionStart(Fn);
4599 if (CurFun.isDeclare) {
4600 // If we have declaration, always overwrite linkage. This will allow us to
4601 // correctly handle cases, when pointer to function is passed as argument to
4602 // another function.
4603 Fn->setLinkage(CurFun.Linkage);
4604 Fn->setVisibility(CurFun.Visibility);
4606 Fn->setCallingConv((yyvsp[-8].UIntVal));
4607 Fn->setAlignment((yyvsp[0].UIntVal));
4608 if ((yyvsp[-1].StrVal)) {
4609 Fn->setSection((yyvsp[-1].StrVal));
4610 free((yyvsp[-1].StrVal));
4613 // Add all of the arguments we parsed to the function...
4614 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4615 if (isVarArg) { // Nuke the last entry
4616 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4617 "Not a varargs marker!");
4618 delete (yyvsp[-4].ArgList)->back().Ty;
4619 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4621 Function::arg_iterator ArgIt = Fn->arg_begin();
4622 Function::arg_iterator ArgEnd = Fn->arg_end();
4624 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4625 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4626 delete I->Ty; // Delete the typeholder...
4627 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4633 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4640 #line 2160 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4642 (yyval.FunctionVal) = CurFun.CurrentFunction;
4644 // Make sure that we keep track of the linkage type even if there was a
4645 // previous "declare".
4646 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4647 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4652 #line 2171 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4654 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4660 #line 2176 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4662 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4663 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4664 (yyval.FunctionVal) = CurFun.CurrentFunction;
4665 CurFun.FunctionDone();
4671 #line 2188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4673 (yyval.BoolVal) = false;
4679 #line 2192 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4681 (yyval.BoolVal) = true;
4687 #line 2197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4688 { // A reference to a direct constant
4689 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4695 #line 2201 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4697 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4703 #line 2205 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4704 { // Perhaps it's an FP constant?
4705 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4711 #line 2209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4713 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4719 #line 2213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4721 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4727 #line 2217 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4729 (yyval.ValIDVal) = ValID::createNull();
4735 #line 2221 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4737 (yyval.ValIDVal) = ValID::createUndef();
4743 #line 2225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4744 { // A vector zero constant.
4745 (yyval.ValIDVal) = ValID::createZeroInit();
4751 #line 2229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4752 { // Nonempty unsized packed vector
4753 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4754 int NumElements = (yyvsp[-1].ConstVector)->size();
4756 PackedType* pt = PackedType::get(ETy, NumElements);
4757 PATypeHolder* PTy = new PATypeHolder(
4765 // Verify all elements are correct type!
4766 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4767 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4768 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4769 ETy->getDescription() +"' as required!\nIt is of type '" +
4770 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4773 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4774 delete PTy; delete (yyvsp[-1].ConstVector);
4780 #line 2254 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4782 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4788 #line 2258 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4790 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4791 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4792 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4793 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4794 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4795 free((yyvsp[-2].StrVal));
4796 free((yyvsp[0].StrVal));
4802 #line 2272 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4803 { // Is it an integer reference...?
4804 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4810 #line 2276 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4812 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4818 #line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4819 { // Is it a named reference...?
4820 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4826 #line 2284 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4827 { // Is it a named reference...?
4828 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4834 #line 2296 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4836 if (!UpRefs.empty())
4837 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4838 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4839 delete (yyvsp[-1].TypeVal);
4845 #line 2305 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4847 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4853 #line 2309 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4854 { // Do not allow functions with 0 basic blocks
4855 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4861 #line 2318 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4863 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4865 InsertValue((yyvsp[0].TermInstVal));
4866 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4867 InsertValue((yyvsp[-2].BasicBlockVal));
4868 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4874 #line 2328 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4876 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4877 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4878 if (CI2->getParent() == 0)
4879 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4880 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4881 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4887 #line 2337 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4889 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
4892 // Make sure to move the basic block to the correct location in the
4893 // function, instead of leaving it inserted wherever it was first
4895 Function::BasicBlockListType &BBL =
4896 CurFun.CurrentFunction->getBasicBlockList();
4897 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4903 #line 2349 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4905 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true);
4908 // Make sure to move the basic block to the correct location in the
4909 // function, instead of leaving it inserted wherever it was first
4911 Function::BasicBlockListType &BBL =
4912 CurFun.CurrentFunction->getBasicBlockList();
4913 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4919 #line 2362 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4920 { // Return with a result...
4921 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4927 #line 2366 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4928 { // Return with no result...
4929 (yyval.TermInstVal) = new ReturnInst();
4935 #line 2370 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4936 { // Unconditional Branch...
4937 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4939 (yyval.TermInstVal) = new BranchInst(tmpBB);
4944 #line 2375 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4946 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
4947 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4949 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4951 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
4953 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4958 #line 2385 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4960 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4962 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4964 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4965 (yyval.TermInstVal) = S;
4967 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4968 E = (yyvsp[-1].JumpTable)->end();
4969 for (; I != E; ++I) {
4970 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4971 S->addCase(CI, I->second);
4973 GEN_ERROR("Switch case is constant, but not a simple integer");
4975 delete (yyvsp[-1].JumpTable);
4981 #line 2404 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4983 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4985 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4987 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4988 (yyval.TermInstVal) = S;
4994 #line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4997 // Handle the short syntax
4998 const PointerType *PFTy = 0;
4999 const FunctionType *Ty = 0;
5000 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5001 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5002 // Pull out the types of all of the arguments...
5003 std::vector<const Type*> ParamTypes;
5004 FunctionType::ParamAttrsList ParamAttrs;
5005 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5006 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
5007 const Type *Ty = I->Val->getType();
5008 if (Ty == Type::VoidTy)
5009 GEN_ERROR("Short call syntax cannot be used with varargs");
5010 ParamTypes.push_back(Ty);
5011 ParamAttrs.push_back(I->Attrs);
5014 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5015 PFTy = PointerType::get(Ty);
5018 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5020 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5022 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5025 // Check the arguments
5027 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5028 // Make sure no arguments is a good thing!
5029 if (Ty->getNumParams() != 0)
5030 GEN_ERROR("No arguments passed to a function that "
5031 "expects arguments");
5032 } else { // Has arguments?
5033 // Loop through FunctionType's arguments and ensure they are specified
5035 FunctionType::param_iterator I = Ty->param_begin();
5036 FunctionType::param_iterator E = Ty->param_end();
5037 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5039 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5040 if (ArgI->Val->getType() != *I)
5041 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5042 (*I)->getDescription() + "'");
5043 Args.push_back(ArgI->Val);
5046 if (Ty->isVarArg()) {
5048 for (; ArgI != ArgE; ++ArgI)
5049 Args.push_back(ArgI->Val); // push the remaining varargs
5050 } else if (I != E || ArgI != ArgE)
5051 GEN_ERROR("Invalid number of parameters detected");
5054 // Create the InvokeInst
5055 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
5056 II->setCallingConv((yyvsp[-12].UIntVal));
5057 (yyval.TermInstVal) = II;
5058 delete (yyvsp[-8].ValueRefList);
5064 #line 2480 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5066 (yyval.TermInstVal) = new UnwindInst();
5072 #line 2484 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5074 (yyval.TermInstVal) = new UnreachableInst();
5080 #line 2491 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5082 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5083 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5086 GEN_ERROR("May only switch on a constant pool value");
5088 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5090 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5095 #line 2502 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5097 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5098 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5102 GEN_ERROR("May only switch on a constant pool value");
5104 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5106 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5111 #line 2515 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5113 // Is this definition named?? if so, assign the name...
5114 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5116 InsertValue((yyvsp[0].InstVal));
5117 (yyval.InstVal) = (yyvsp[0].InstVal);
5123 #line 2525 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5124 { // Used for PHI nodes
5125 if (!UpRefs.empty())
5126 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5127 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5128 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5130 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5132 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5133 delete (yyvsp[-5].TypeVal);
5138 #line 2536 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5140 (yyval.PHIList) = (yyvsp[-6].PHIList);
5141 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5143 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5145 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5150 #line 2546 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5152 if (!UpRefs.empty())
5153 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5154 // Used for call and invoke instructions
5155 (yyval.ValueRefList) = new ValueRefList();
5156 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5157 (yyval.ValueRefList)->push_back(E);
5162 #line 2554 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5164 if (!UpRefs.empty())
5165 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5166 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5167 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5168 (yyval.ValueRefList)->push_back(E);
5174 #line 2562 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5175 { (yyval.ValueRefList) = new ValueRefList(); ;}
5179 #line 2565 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5180 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5184 #line 2566 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5186 (yyval.ValueList) = (yyvsp[-2].ValueList);
5187 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5193 #line 2573 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5195 (yyval.BoolVal) = true;
5201 #line 2577 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5203 (yyval.BoolVal) = false;
5209 #line 2582 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5211 if (!UpRefs.empty())
5212 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5213 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5214 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5216 "Arithmetic operator requires integer, FP, or packed operands");
5217 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5218 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5219 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5220 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5221 GEN_ERROR("Remainder not supported on packed types");
5222 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5224 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5226 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5227 if ((yyval.InstVal) == 0)
5228 GEN_ERROR("binary operator returned null");
5229 delete (yyvsp[-3].TypeVal);
5234 #line 2603 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5236 if (!UpRefs.empty())
5237 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5238 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5239 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5240 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5241 GEN_ERROR("Logical operator requires integral operands");
5243 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5245 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5247 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5248 if ((yyval.InstVal) == 0)
5249 GEN_ERROR("binary operator returned null");
5250 delete (yyvsp[-3].TypeVal);
5255 #line 2620 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5257 if (!UpRefs.empty())
5258 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5259 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5260 GEN_ERROR("Packed types not supported by icmp instruction");
5261 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5263 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5265 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5266 if ((yyval.InstVal) == 0)
5267 GEN_ERROR("icmp operator returned null");
5272 #line 2633 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5274 if (!UpRefs.empty())
5275 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5276 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5277 GEN_ERROR("Packed types not supported by fcmp instruction");
5278 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5280 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5282 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5283 if ((yyval.InstVal) == 0)
5284 GEN_ERROR("fcmp operator returned null");
5289 #line 2646 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5291 if (!UpRefs.empty())
5292 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5293 Value* Val = (yyvsp[-2].ValueVal);
5294 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5295 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5296 GEN_ERROR("invalid cast opcode for cast from '" +
5297 Val->getType()->getDescription() + "' to '" +
5298 DestTy->getDescription() + "'");
5299 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5300 delete (yyvsp[0].TypeVal);
5305 #line 2658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5307 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5308 GEN_ERROR("select condition must be boolean");
5309 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5310 GEN_ERROR("select value types should match");
5311 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5317 #line 2666 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5319 if (!UpRefs.empty())
5320 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5321 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5322 delete (yyvsp[0].TypeVal);
5328 #line 2673 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5330 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5331 GEN_ERROR("Invalid extractelement operands");
5332 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5338 #line 2679 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5340 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5341 GEN_ERROR("Invalid insertelement operands");
5342 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5348 #line 2685 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5350 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5351 GEN_ERROR("Invalid shufflevector operands");
5352 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5358 #line 2691 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5360 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5361 if (!Ty->isFirstClassType())
5362 GEN_ERROR("PHI node operands must be of first class type");
5363 (yyval.InstVal) = new PHINode(Ty);
5364 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5365 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5366 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5367 GEN_ERROR("All elements of a PHI node must be of the same type");
5368 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5369 (yyvsp[0].PHIList)->pop_front();
5371 delete (yyvsp[0].PHIList); // Free the list...
5377 #line 2707 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5380 // Handle the short syntax
5381 const PointerType *PFTy = 0;
5382 const FunctionType *Ty = 0;
5383 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5384 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5385 // Pull out the types of all of the arguments...
5386 std::vector<const Type*> ParamTypes;
5387 FunctionType::ParamAttrsList ParamAttrs;
5388 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5389 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5390 const Type *Ty = I->Val->getType();
5391 if (Ty == Type::VoidTy)
5392 GEN_ERROR("Short call syntax cannot be used with varargs");
5393 ParamTypes.push_back(Ty);
5394 ParamAttrs.push_back(I->Attrs);
5397 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5398 PFTy = PointerType::get(Ty);
5401 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5404 // Check the arguments
5406 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5407 // Make sure no arguments is a good thing!
5408 if (Ty->getNumParams() != 0)
5409 GEN_ERROR("No arguments passed to a function that "
5410 "expects arguments");
5411 } else { // Has arguments?
5412 // Loop through FunctionType's arguments and ensure they are specified
5415 FunctionType::param_iterator I = Ty->param_begin();
5416 FunctionType::param_iterator E = Ty->param_end();
5417 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5419 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5420 if (ArgI->Val->getType() != *I)
5421 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5422 (*I)->getDescription() + "'");
5423 Args.push_back(ArgI->Val);
5425 if (Ty->isVarArg()) {
5427 for (; ArgI != ArgE; ++ArgI)
5428 Args.push_back(ArgI->Val); // push the remaining varargs
5429 } else if (I != E || ArgI != ArgE)
5430 GEN_ERROR("Invalid number of parameters detected");
5432 // Create the call node
5433 CallInst *CI = new CallInst(V, Args);
5434 CI->setTailCall((yyvsp[-7].BoolVal));
5435 CI->setCallingConv((yyvsp[-6].UIntVal));
5436 (yyval.InstVal) = CI;
5437 delete (yyvsp[-2].ValueRefList);
5438 delete (yyvsp[-5].TypeVal);
5444 #line 2770 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5446 (yyval.InstVal) = (yyvsp[0].InstVal);
5452 #line 2775 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5454 (yyval.BoolVal) = true;
5460 #line 2779 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5462 (yyval.BoolVal) = false;
5468 #line 2786 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5470 if (!UpRefs.empty())
5471 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5472 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5473 delete (yyvsp[-1].TypeVal);
5479 #line 2793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5481 if (!UpRefs.empty())
5482 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5483 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5485 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5486 delete (yyvsp[-4].TypeVal);
5491 #line 2801 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5493 if (!UpRefs.empty())
5494 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5495 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5496 delete (yyvsp[-1].TypeVal);
5502 #line 2808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5504 if (!UpRefs.empty())
5505 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5506 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5508 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5509 delete (yyvsp[-4].TypeVal);
5514 #line 2816 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5516 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5517 GEN_ERROR("Trying to free nonpointer type " +
5518 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5519 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5525 #line 2824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5527 if (!UpRefs.empty())
5528 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5529 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5530 GEN_ERROR("Can't load from nonpointer type: " +
5531 (*(yyvsp[-1].TypeVal))->getDescription());
5532 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5533 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5534 (*(yyvsp[-1].TypeVal))->getDescription());
5535 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5537 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5538 delete (yyvsp[-1].TypeVal);
5543 #line 2838 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5545 if (!UpRefs.empty())
5546 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5547 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5549 GEN_ERROR("Can't store to a nonpointer type: " +
5550 (*(yyvsp[-1].TypeVal))->getDescription());
5551 const Type *ElTy = PT->getElementType();
5552 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5553 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5554 "' into space of type '" + ElTy->getDescription() + "'");
5556 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5558 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5559 delete (yyvsp[-1].TypeVal);
5564 #line 2855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5566 if (!UpRefs.empty())
5567 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5568 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5569 GEN_ERROR("getelementptr insn requires pointer operand");
5571 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5572 GEN_ERROR("Invalid getelementptr indices for type '" +
5573 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5574 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5576 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5577 delete (yyvsp[-2].TypeVal);
5578 delete (yyvsp[0].ValueList);
5586 /* Line 1126 of yacc.c. */
5587 #line 5588 "llvmAsmParser.tab.c"
5593 YY_STACK_PRINT (yyss, yyssp);
5598 /* Now `shift' the result of the reduction. Determine what state
5599 that goes to, based on the state we popped back to and the rule
5600 number reduced by. */
5604 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5605 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5606 yystate = yytable[yystate];
5608 yystate = yydefgoto[yyn - YYNTOKENS];
5613 /*------------------------------------.
5614 | yyerrlab -- here on detecting error |
5615 `------------------------------------*/
5617 /* If not already recovering from an error, report this error. */
5622 yyn = yypact[yystate];
5624 if (YYPACT_NINF < yyn && yyn < YYLAST)
5626 int yytype = YYTRANSLATE (yychar);
5627 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5628 YYSIZE_T yysize = yysize0;
5630 int yysize_overflow = 0;
5632 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5633 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5637 /* This is so xgettext sees the translatable formats that are
5638 constructed on the fly. */
5639 YY_("syntax error, unexpected %s");
5640 YY_("syntax error, unexpected %s, expecting %s");
5641 YY_("syntax error, unexpected %s, expecting %s or %s");
5642 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5643 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5647 static char const yyunexpected[] = "syntax error, unexpected %s";
5648 static char const yyexpecting[] = ", expecting %s";
5649 static char const yyor[] = " or %s";
5650 char yyformat[sizeof yyunexpected
5651 + sizeof yyexpecting - 1
5652 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5653 * (sizeof yyor - 1))];
5654 char const *yyprefix = yyexpecting;
5656 /* Start YYX at -YYN if negative to avoid negative indexes in
5658 int yyxbegin = yyn < 0 ? -yyn : 0;
5660 /* Stay within bounds of both yycheck and yytname. */
5661 int yychecklim = YYLAST - yyn;
5662 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5665 yyarg[0] = yytname[yytype];
5666 yyfmt = yystpcpy (yyformat, yyunexpected);
5668 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5669 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5671 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5675 yyformat[sizeof yyunexpected - 1] = '\0';
5678 yyarg[yycount++] = yytname[yyx];
5679 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5680 yysize_overflow |= yysize1 < yysize;
5682 yyfmt = yystpcpy (yyfmt, yyprefix);
5686 yyf = YY_(yyformat);
5687 yysize1 = yysize + yystrlen (yyf);
5688 yysize_overflow |= yysize1 < yysize;
5691 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5692 yymsg = (char *) YYSTACK_ALLOC (yysize);
5695 /* Avoid sprintf, as that infringes on the user's name space.
5696 Don't have undefined behavior even if the translation
5697 produced a string with the wrong number of "%s"s. */
5700 while ((*yyp = *yyf))
5702 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5704 yyp += yytnamerr (yyp, yyarg[yyi++]);
5714 YYSTACK_FREE (yymsg);
5718 yyerror (YY_("syntax error"));
5719 goto yyexhaustedlab;
5723 #endif /* YYERROR_VERBOSE */
5724 yyerror (YY_("syntax error"));
5729 if (yyerrstatus == 3)
5731 /* If just tried and failed to reuse look-ahead token after an
5732 error, discard it. */
5734 if (yychar <= YYEOF)
5736 /* Return failure if at end of input. */
5737 if (yychar == YYEOF)
5742 yydestruct ("Error: discarding", yytoken, &yylval);
5747 /* Else will try to reuse look-ahead token after shifting the error
5752 /*---------------------------------------------------.
5753 | yyerrorlab -- error raised explicitly by YYERROR. |
5754 `---------------------------------------------------*/
5757 /* Pacify compilers like GCC when the user code never invokes
5758 YYERROR and the label yyerrorlab therefore never appears in user
5769 /*-------------------------------------------------------------.
5770 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5771 `-------------------------------------------------------------*/
5773 yyerrstatus = 3; /* Each real token shifted decrements this. */
5777 yyn = yypact[yystate];
5778 if (yyn != YYPACT_NINF)
5781 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5789 /* Pop the current state because it cannot handle the error token. */
5794 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5797 YY_STACK_PRINT (yyss, yyssp);
5806 /* Shift the error token. */
5807 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5813 /*-------------------------------------.
5814 | yyacceptlab -- YYACCEPT comes here. |
5815 `-------------------------------------*/
5820 /*-----------------------------------.
5821 | yyabortlab -- YYABORT comes here. |
5822 `-----------------------------------*/
5828 /*-------------------------------------------------.
5829 | yyexhaustedlab -- memory exhaustion comes here. |
5830 `-------------------------------------------------*/
5832 yyerror (YY_("memory exhausted"));
5838 if (yychar != YYEOF && yychar != YYEMPTY)
5839 yydestruct ("Cleanup: discarding lookahead",
5841 while (yyssp != yyss)
5843 yydestruct ("Cleanup: popping",
5844 yystos[*yyssp], yyvsp);
5849 YYSTACK_FREE (yyss);
5855 #line 2872 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5858 // common code from the two 'RunVMAsmParser' functions
5859 static Module* RunParser(Module * M) {
5861 llvmAsmlineno = 1; // Reset the current line number...
5862 CurModule.CurrentModule = M;
5867 // Check to make sure the parser succeeded
5870 delete ParserResult;
5874 // Check to make sure that parsing produced a result
5878 // Reset ParserResult variable while saving its value for the result.
5879 Module *Result = ParserResult;
5885 void llvm::GenerateError(const std::string &message, int LineNo) {
5886 if (LineNo == -1) LineNo = llvmAsmlineno;
5887 // TODO: column number in exception
5889 TheParseError->setError(CurFilename, message, LineNo);
5893 int yyerror(const char *ErrorMsg) {
5895 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5896 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5897 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5898 if (yychar != YYEMPTY && yychar != 0)
5899 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5901 GenerateError(errMsg);