1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
86 ZEROINITIALIZER = 277,
123 X86_STDCALLCC_TOK = 314,
124 X86_FASTCALLCC_TOK = 315,
190 EXTRACTELEMENT = 381,
201 #define ESINT64VAL 258
202 #define EUINT64VAL 259
203 #define ESAPINTVAL 260
204 #define EUAPINTVAL 261
205 #define LOCALVAL_ID 262
206 #define GLOBALVAL_ID 263
215 #define GLOBALVAR 272
217 #define STRINGCONSTANT 274
218 #define ATSTRINGCONSTANT 275
219 #define IMPLEMENTATION 276
220 #define ZEROINITIALIZER 277
232 #define DOTDOTDOT 289
238 #define APPENDING 295
239 #define DLLIMPORT 296
240 #define DLLEXPORT 297
241 #define EXTERN_WEAK 298
252 #define SIDEEFFECT 309
255 #define FASTCC_TOK 312
256 #define COLDCC_TOK 313
257 #define X86_STDCALLCC_TOK 314
258 #define X86_FASTCALLCC_TOK 315
259 #define DATALAYOUT 316
265 #define UNREACHABLE 322
308 #define GETELEMENTPTR 365
324 #define EXTRACTELEMENT 381
325 #define INSERTELEMENT 382
326 #define SHUFFLEVECTOR 383
336 /* Copy the first part of user declarations. */
337 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
339 #include "ParserInternals.h"
340 #include "llvm/CallingConv.h"
341 #include "llvm/InlineAsm.h"
342 #include "llvm/Instructions.h"
343 #include "llvm/Module.h"
344 #include "llvm/ValueSymbolTable.h"
345 #include "llvm/Support/GetElementPtrTypeIterator.h"
346 #include "llvm/Support/CommandLine.h"
347 #include "llvm/ADT/SmallVector.h"
348 #include "llvm/ADT/STLExtras.h"
349 #include "llvm/Support/MathExtras.h"
350 #include "llvm/Support/Streams.h"
359 // The following is a gross hack. In order to rid the libAsmParser library of
360 // exceptions, we have to have a way of getting the yyparse function to go into
361 // an error situation. So, whenever we want an error to occur, the GenerateError
362 // function (see bottom of file) sets TriggerError. Then, at the end of each
363 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
364 // (a goto) to put YACC in error state. Furthermore, several calls to
365 // GenerateError are made from inside productions and they must simulate the
366 // previous exception behavior by exiting the production immediately. We have
367 // replaced these with the GEN_ERROR macro which calls GeneratError and then
368 // immediately invokes YYERROR. This would be so much cleaner if it was a
369 // recursive descent parser.
370 static bool TriggerError = false;
371 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
372 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
374 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
375 int yylex(); // declaration" of xxx warnings.
379 std::string CurFilename;
382 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
383 cl::Hidden, cl::init(false));
386 using namespace llvm;
388 static Module *ParserResult;
390 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
391 // relating to upreferences in the input stream.
393 //#define DEBUG_UPREFS 1
395 #define UR_OUT(X) cerr << X
400 #define YYERROR_VERBOSE 1
402 static GlobalVariable *CurGV;
405 // This contains info used when building the body of a function. It is
406 // destroyed when the function is completed.
408 typedef std::vector<Value *> ValueList; // Numbered defs
411 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
412 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
414 static struct PerModuleInfo {
415 Module *CurrentModule;
416 std::map<const Type *, ValueList> Values; // Module level numbered definitions
417 std::map<const Type *,ValueList> LateResolveValues;
418 std::vector<PATypeHolder> Types;
419 std::map<ValID, PATypeHolder> LateResolveTypes;
421 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
422 /// how they were referenced and on which line of the input they came from so
423 /// that we can resolve them later and print error messages as appropriate.
424 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
426 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
427 // references to global values. Global values may be referenced before they
428 // are defined, and if so, the temporary object that they represent is held
429 // here. This is used for forward references of GlobalValues.
431 typedef std::map<std::pair<const PointerType *,
432 ValID>, GlobalValue*> GlobalRefsType;
433 GlobalRefsType GlobalRefs;
436 // If we could not resolve some functions at function compilation time
437 // (calls to functions before they are defined), resolve them now... Types
438 // are resolved when the constant pool has been completely parsed.
440 ResolveDefinitions(LateResolveValues);
444 // Check to make sure that all global value forward references have been
447 if (!GlobalRefs.empty()) {
448 std::string UndefinedReferences = "Unresolved global references exist:\n";
450 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
452 UndefinedReferences += " " + I->first.first->getDescription() + " " +
453 I->first.second.getName() + "\n";
455 GenerateError(UndefinedReferences);
459 Values.clear(); // Clear out function local definitions
464 // GetForwardRefForGlobal - Check to see if there is a forward reference
465 // for this global. If so, remove it from the GlobalRefs map and return it.
466 // If not, just return null.
467 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
468 // Check to see if there is a forward reference to this global variable...
469 // if there is, eliminate it and patch the reference to use the new def'n.
470 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
471 GlobalValue *Ret = 0;
472 if (I != GlobalRefs.end()) {
479 bool TypeIsUnresolved(PATypeHolder* PATy) {
480 // If it isn't abstract, its resolved
481 const Type* Ty = PATy->get();
482 if (!Ty->isAbstract())
484 // Traverse the type looking for abstract types. If it isn't abstract then
485 // we don't need to traverse that leg of the type.
486 std::vector<const Type*> WorkList, SeenList;
487 WorkList.push_back(Ty);
488 while (!WorkList.empty()) {
489 const Type* Ty = WorkList.back();
490 SeenList.push_back(Ty);
492 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
493 // Check to see if this is an unresolved type
494 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
495 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
496 for ( ; I != E; ++I) {
497 if (I->second.get() == OpTy)
500 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
501 const Type* TheTy = SeqTy->getElementType();
502 if (TheTy->isAbstract() && TheTy != Ty) {
503 std::vector<const Type*>::iterator I = SeenList.begin(),
509 WorkList.push_back(TheTy);
511 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
512 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
513 const Type* TheTy = StrTy->getElementType(i);
514 if (TheTy->isAbstract() && TheTy != Ty) {
515 std::vector<const Type*>::iterator I = SeenList.begin(),
521 WorkList.push_back(TheTy);
532 static struct PerFunctionInfo {
533 Function *CurrentFunction; // Pointer to current function being created
535 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
536 std::map<const Type*, ValueList> LateResolveValues;
537 bool isDeclare; // Is this function a forward declararation?
538 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
539 GlobalValue::VisibilityTypes Visibility;
541 /// BBForwardRefs - When we see forward references to basic blocks, keep
542 /// track of them here.
543 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
544 std::vector<BasicBlock*> NumberedBlocks;
547 inline PerFunctionInfo() {
550 Linkage = GlobalValue::ExternalLinkage;
551 Visibility = GlobalValue::DefaultVisibility;
554 inline void FunctionStart(Function *M) {
559 void FunctionDone() {
560 NumberedBlocks.clear();
562 // Any forward referenced blocks left?
563 if (!BBForwardRefs.empty()) {
564 GenerateError("Undefined reference to label " +
565 BBForwardRefs.begin()->first->getName());
569 // Resolve all forward references now.
570 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
572 Values.clear(); // Clear out function local definitions
575 Linkage = GlobalValue::ExternalLinkage;
576 Visibility = GlobalValue::DefaultVisibility;
578 } CurFun; // Info for the current function...
580 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
583 //===----------------------------------------------------------------------===//
584 // Code to handle definitions of all the types
585 //===----------------------------------------------------------------------===//
587 static int InsertValue(Value *V,
588 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
589 if (V->hasName()) return -1; // Is this a numbered definition?
591 // Yes, insert the value into the value table...
592 ValueList &List = ValueTab[V->getType()];
594 return List.size()-1;
597 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
599 case ValID::LocalID: // Is it a numbered definition?
600 // Module constants occupy the lowest numbered slots...
601 if (D.Num < CurModule.Types.size())
602 return CurModule.Types[D.Num];
604 case ValID::LocalName: // Is it a named definition?
605 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
606 D.destroy(); // Free old strdup'd memory...
611 GenerateError("Internal parser error: Invalid symbol type reference");
615 // If we reached here, we referenced either a symbol that we don't know about
616 // or an id number that hasn't been read yet. We may be referencing something
617 // forward, so just create an entry to be resolved later and get to it...
619 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
622 if (inFunctionScope()) {
623 if (D.Type == ValID::LocalName) {
624 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
627 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
632 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
633 if (I != CurModule.LateResolveTypes.end())
636 Type *Typ = OpaqueType::get();
637 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
641 // getValNonImprovising - Look up the value specified by the provided type and
642 // the provided ValID. If the value exists and has already been defined, return
643 // it. Otherwise return null.
645 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
646 if (isa<FunctionType>(Ty)) {
647 GenerateError("Functions are not values and "
648 "must be referenced as pointers");
653 case ValID::LocalID: { // Is it a numbered definition?
654 // Module constants occupy the lowest numbered slots.
655 std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
656 // Make sure that our type is within bounds.
657 if (VI == CurFun.Values.end()) return 0;
659 // Check that the number is within bounds.
660 if (D.Num >= VI->second.size()) return 0;
662 return VI->second[D.Num];
664 case ValID::GlobalID: { // Is it a numbered definition?
665 unsigned Num = D.Num;
667 // Module constants occupy the lowest numbered slots...
668 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
669 if (VI == CurModule.Values.end())
671 if (D.Num >= VI->second.size())
673 return VI->second[Num];
676 case ValID::LocalName: { // Is it a named definition?
677 if (!inFunctionScope())
679 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
680 Value *N = SymTab.lookup(D.Name);
683 if (N->getType() != Ty)
686 D.destroy(); // Free old strdup'd memory...
689 case ValID::GlobalName: { // Is it a named definition?
690 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
691 Value *N = SymTab.lookup(D.Name);
694 if (N->getType() != Ty)
697 D.destroy(); // Free old strdup'd memory...
701 // Check to make sure that "Ty" is an integral type, and that our
702 // value will fit into the specified type...
703 case ValID::ConstSIntVal: // Is it a constant pool reference??
704 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
705 GenerateError("Signed integral constant '" +
706 itostr(D.ConstPool64) + "' is invalid for type '" +
707 Ty->getDescription() + "'");
710 return ConstantInt::get(Ty, D.ConstPool64);
712 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
713 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
714 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
715 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
716 "' is invalid or out of range");
718 } else { // This is really a signed reference. Transmogrify.
719 return ConstantInt::get(Ty, D.ConstPool64);
722 return ConstantInt::get(Ty, D.UConstPool64);
725 case ValID::ConstFPVal: // Is it a floating point const pool reference?
726 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
727 GenerateError("FP constant invalid for type");
730 return ConstantFP::get(Ty, D.ConstPoolFP);
732 case ValID::ConstNullVal: // Is it a null value?
733 if (!isa<PointerType>(Ty)) {
734 GenerateError("Cannot create a a non pointer null");
737 return ConstantPointerNull::get(cast<PointerType>(Ty));
739 case ValID::ConstUndefVal: // Is it an undef value?
740 return UndefValue::get(Ty);
742 case ValID::ConstZeroVal: // Is it a zero value?
743 return Constant::getNullValue(Ty);
745 case ValID::ConstantVal: // Fully resolved constant?
746 if (D.ConstantValue->getType() != Ty) {
747 GenerateError("Constant expression type different from required type");
750 return D.ConstantValue;
752 case ValID::InlineAsmVal: { // Inline asm expression
753 const PointerType *PTy = dyn_cast<PointerType>(Ty);
754 const FunctionType *FTy =
755 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
756 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
757 GenerateError("Invalid type for asm constraint string");
760 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
761 D.IAD->HasSideEffects);
762 D.destroy(); // Free InlineAsmDescriptor.
766 assert(0 && "Unhandled case!");
770 assert(0 && "Unhandled case!");
774 // getVal - This function is identical to getValNonImprovising, except that if a
775 // value is not already defined, it "improvises" by creating a placeholder var
776 // that looks and acts just like the requested variable. When the value is
777 // defined later, all uses of the placeholder variable are replaced with the
780 static Value *getVal(const Type *Ty, const ValID &ID) {
781 if (Ty == Type::LabelTy) {
782 GenerateError("Cannot use a basic block here");
786 // See if the value has already been defined.
787 Value *V = getValNonImprovising(Ty, ID);
789 if (TriggerError) return 0;
791 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
792 GenerateError("Invalid use of a composite type");
796 // If we reached here, we referenced either a symbol that we don't know about
797 // or an id number that hasn't been read yet. We may be referencing something
798 // forward, so just create an entry to be resolved later and get to it...
800 V = new Argument(Ty);
802 // Remember where this forward reference came from. FIXME, shouldn't we try
803 // to recycle these things??
804 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
807 if (inFunctionScope())
808 InsertValue(V, CurFun.LateResolveValues);
810 InsertValue(V, CurModule.LateResolveValues);
814 /// getBBVal - This is used for two purposes:
815 /// * If isDefinition is true, a new basic block with the specified ID is being
817 /// * If isDefinition is true, this is a reference to a basic block, which may
818 /// or may not be a forward reference.
820 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
821 assert(inFunctionScope() && "Can't get basic block at global scope!");
827 GenerateError("Illegal label reference " + ID.getName());
829 case ValID::LocalID: // Is it a numbered definition?
830 if (ID.Num >= CurFun.NumberedBlocks.size())
831 CurFun.NumberedBlocks.resize(ID.Num+1);
832 BB = CurFun.NumberedBlocks[ID.Num];
834 case ValID::LocalName: // Is it a named definition?
836 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
837 if (N && N->getType()->getTypeID() == Type::LabelTyID)
838 BB = cast<BasicBlock>(N);
842 // See if the block has already been defined.
844 // If this is the definition of the block, make sure the existing value was
845 // just a forward reference. If it was a forward reference, there will be
846 // an entry for it in the PlaceHolderInfo map.
847 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
848 // The existing value was a definition, not a forward reference.
849 GenerateError("Redefinition of label " + ID.getName());
853 ID.destroy(); // Free strdup'd memory.
857 // Otherwise this block has not been seen before.
858 BB = new BasicBlock("", CurFun.CurrentFunction);
859 if (ID.Type == ValID::LocalName) {
860 BB->setName(ID.Name);
862 CurFun.NumberedBlocks[ID.Num] = BB;
865 // If this is not a definition, keep track of it so we can use it as a forward
868 // Remember where this forward reference came from.
869 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
871 // The forward declaration could have been inserted anywhere in the
872 // function: insert it into the correct place now.
873 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
874 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
881 //===----------------------------------------------------------------------===//
882 // Code to handle forward references in instructions
883 //===----------------------------------------------------------------------===//
885 // This code handles the late binding needed with statements that reference
886 // values not defined yet... for example, a forward branch, or the PHI node for
889 // This keeps a table (CurFun.LateResolveValues) of all such forward references
890 // and back patchs after we are done.
893 // ResolveDefinitions - If we could not resolve some defs at parsing
894 // time (forward branches, phi functions for loops, etc...) resolve the
898 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
899 std::map<const Type*,ValueList> *FutureLateResolvers) {
900 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
901 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
902 E = LateResolvers.end(); LRI != E; ++LRI) {
903 ValueList &List = LRI->second;
904 while (!List.empty()) {
905 Value *V = List.back();
908 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
909 CurModule.PlaceHolderInfo.find(V);
910 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
912 ValID &DID = PHI->second.first;
914 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
918 V->replaceAllUsesWith(TheRealValue);
920 CurModule.PlaceHolderInfo.erase(PHI);
921 } else if (FutureLateResolvers) {
922 // Functions have their unresolved items forwarded to the module late
924 InsertValue(V, *FutureLateResolvers);
926 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
927 GenerateError("Reference to an invalid definition: '" +DID.getName()+
928 "' of type '" + V->getType()->getDescription() + "'",
932 GenerateError("Reference to an invalid definition: #" +
933 itostr(DID.Num) + " of type '" +
934 V->getType()->getDescription() + "'",
942 LateResolvers.clear();
945 // ResolveTypeTo - A brand new type was just declared. This means that (if
946 // name is not null) things referencing Name can be resolved. Otherwise, things
947 // refering to the number can be resolved. Do this now.
949 static void ResolveTypeTo(char *Name, const Type *ToTy) {
951 if (Name) D = ValID::createLocalName(Name);
952 else D = ValID::createLocalID(CurModule.Types.size());
954 std::map<ValID, PATypeHolder>::iterator I =
955 CurModule.LateResolveTypes.find(D);
956 if (I != CurModule.LateResolveTypes.end()) {
957 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
958 CurModule.LateResolveTypes.erase(I);
962 // setValueName - Set the specified value to the name given. The name may be
963 // null potentially, in which case this is a noop. The string passed in is
964 // assumed to be a malloc'd string buffer, and is free'd by this function.
966 static void setValueName(Value *V, char *NameStr) {
967 if (!NameStr) return;
968 std::string Name(NameStr); // Copy string
969 free(NameStr); // Free old string
971 if (V->getType() == Type::VoidTy) {
972 GenerateError("Can't assign name '" + Name+"' to value with void type");
976 assert(inFunctionScope() && "Must be in function scope!");
977 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
978 if (ST.lookup(Name)) {
979 GenerateError("Redefinition of value '" + Name + "' of type '" +
980 V->getType()->getDescription() + "'");
988 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
989 /// this is a declaration, otherwise it is a definition.
990 static GlobalVariable *
991 ParseGlobalVariable(char *NameStr,
992 GlobalValue::LinkageTypes Linkage,
993 GlobalValue::VisibilityTypes Visibility,
994 bool isConstantGlobal, const Type *Ty,
995 Constant *Initializer) {
996 if (isa<FunctionType>(Ty)) {
997 GenerateError("Cannot declare global vars of function type");
1001 const PointerType *PTy = PointerType::get(Ty);
1005 Name = NameStr; // Copy string
1006 free(NameStr); // Free old string
1009 // See if this global value was forward referenced. If so, recycle the
1012 if (!Name.empty()) {
1013 ID = ValID::createGlobalName((char*)Name.c_str());
1015 ID = ValID::createGlobalID(CurModule.Values[PTy].size());
1018 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1019 // Move the global to the end of the list, from whereever it was
1020 // previously inserted.
1021 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1022 CurModule.CurrentModule->getGlobalList().remove(GV);
1023 CurModule.CurrentModule->getGlobalList().push_back(GV);
1024 GV->setInitializer(Initializer);
1025 GV->setLinkage(Linkage);
1026 GV->setVisibility(Visibility);
1027 GV->setConstant(isConstantGlobal);
1028 InsertValue(GV, CurModule.Values);
1032 // If this global has a name
1033 if (!Name.empty()) {
1034 // if the global we're parsing has an initializer (is a definition) and
1035 // has external linkage.
1036 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1037 // If there is already a global with external linkage with this name
1038 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1039 // If we allow this GVar to get created, it will be renamed in the
1040 // symbol table because it conflicts with an existing GVar. We can't
1041 // allow redefinition of GVars whose linking indicates that their name
1042 // must stay the same. Issue the error.
1043 GenerateError("Redefinition of global variable named '" + Name +
1044 "' of type '" + Ty->getDescription() + "'");
1049 // Otherwise there is no existing GV to use, create one now.
1050 GlobalVariable *GV =
1051 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1052 CurModule.CurrentModule);
1053 GV->setVisibility(Visibility);
1054 InsertValue(GV, CurModule.Values);
1058 // setTypeName - Set the specified type to the name given. The name may be
1059 // null potentially, in which case this is a noop. The string passed in is
1060 // assumed to be a malloc'd string buffer, and is freed by this function.
1062 // This function returns true if the type has already been defined, but is
1063 // allowed to be redefined in the specified context. If the name is a new name
1064 // for the type plane, it is inserted and false is returned.
1065 static bool setTypeName(const Type *T, char *NameStr) {
1066 assert(!inFunctionScope() && "Can't give types function-local names!");
1067 if (NameStr == 0) return false;
1069 std::string Name(NameStr); // Copy string
1070 free(NameStr); // Free old string
1072 // We don't allow assigning names to void type
1073 if (T == Type::VoidTy) {
1074 GenerateError("Can't assign name '" + Name + "' to the void type");
1078 // Set the type name, checking for conflicts as we do so.
1079 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1081 if (AlreadyExists) { // Inserting a name that is already defined???
1082 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1083 assert(Existing && "Conflict but no matching type?!");
1085 // There is only one case where this is allowed: when we are refining an
1086 // opaque type. In this case, Existing will be an opaque type.
1087 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1088 // We ARE replacing an opaque type!
1089 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1093 // Otherwise, this is an attempt to redefine a type. That's okay if
1094 // the redefinition is identical to the original. This will be so if
1095 // Existing and T point to the same Type object. In this one case we
1096 // allow the equivalent redefinition.
1097 if (Existing == T) return true; // Yes, it's equal.
1099 // Any other kind of (non-equivalent) redefinition is an error.
1100 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1101 T->getDescription() + "'");
1107 //===----------------------------------------------------------------------===//
1108 // Code for handling upreferences in type names...
1111 // TypeContains - Returns true if Ty directly contains E in it.
1113 static bool TypeContains(const Type *Ty, const Type *E) {
1114 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1115 E) != Ty->subtype_end();
1119 struct UpRefRecord {
1120 // NestingLevel - The number of nesting levels that need to be popped before
1121 // this type is resolved.
1122 unsigned NestingLevel;
1124 // LastContainedTy - This is the type at the current binding level for the
1125 // type. Every time we reduce the nesting level, this gets updated.
1126 const Type *LastContainedTy;
1128 // UpRefTy - This is the actual opaque type that the upreference is
1129 // represented with.
1130 OpaqueType *UpRefTy;
1132 UpRefRecord(unsigned NL, OpaqueType *URTy)
1133 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1137 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1138 static std::vector<UpRefRecord> UpRefs;
1140 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1141 /// called. It loops through the UpRefs vector, which is a list of the
1142 /// currently active types. For each type, if the up reference is contained in
1143 /// the newly completed type, we decrement the level count. When the level
1144 /// count reaches zero, the upreferenced type is the type that is passed in:
1145 /// thus we can complete the cycle.
1147 static PATypeHolder HandleUpRefs(const Type *ty) {
1148 // If Ty isn't abstract, or if there are no up-references in it, then there is
1149 // nothing to resolve here.
1150 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1152 PATypeHolder Ty(ty);
1153 UR_OUT("Type '" << Ty->getDescription() <<
1154 "' newly formed. Resolving upreferences.\n" <<
1155 UpRefs.size() << " upreferences active!\n");
1157 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1158 // to zero), we resolve them all together before we resolve them to Ty. At
1159 // the end of the loop, if there is anything to resolve to Ty, it will be in
1161 OpaqueType *TypeToResolve = 0;
1163 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1164 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1165 << UpRefs[i].second->getDescription() << ") = "
1166 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1167 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1168 // Decrement level of upreference
1169 unsigned Level = --UpRefs[i].NestingLevel;
1170 UpRefs[i].LastContainedTy = Ty;
1171 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1172 if (Level == 0) { // Upreference should be resolved!
1173 if (!TypeToResolve) {
1174 TypeToResolve = UpRefs[i].UpRefTy;
1176 UR_OUT(" * Resolving upreference for "
1177 << UpRefs[i].second->getDescription() << "\n";
1178 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1179 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1180 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1181 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1183 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1184 --i; // Do not skip the next element...
1189 if (TypeToResolve) {
1190 UR_OUT(" * Resolving upreference for "
1191 << UpRefs[i].second->getDescription() << "\n";
1192 std::string OldName = TypeToResolve->getDescription());
1193 TypeToResolve->refineAbstractTypeTo(Ty);
1199 //===----------------------------------------------------------------------===//
1200 // RunVMAsmParser - Define an interface to this parser
1201 //===----------------------------------------------------------------------===//
1203 static Module* RunParser(Module * M);
1205 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1208 CurFilename = Filename;
1209 return RunParser(new Module(CurFilename));
1212 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1213 set_scan_string(AsmString);
1215 CurFilename = "from_memory";
1217 return RunParser(new Module (CurFilename));
1219 return RunParser(M);
1225 /* Enabling traces. */
1230 /* Enabling verbose error messages. */
1231 #ifdef YYERROR_VERBOSE
1232 # undef YYERROR_VERBOSE
1233 # define YYERROR_VERBOSE 1
1235 # define YYERROR_VERBOSE 0
1238 /* Enabling the token table. */
1239 #ifndef YYTOKEN_TABLE
1240 # define YYTOKEN_TABLE 0
1243 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1244 #line 901 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1245 typedef union YYSTYPE {
1246 llvm::Module *ModuleVal;
1247 llvm::Function *FunctionVal;
1248 llvm::BasicBlock *BasicBlockVal;
1249 llvm::TerminatorInst *TermInstVal;
1250 llvm::Instruction *InstVal;
1251 llvm::Constant *ConstVal;
1253 const llvm::Type *PrimType;
1254 std::list<llvm::PATypeHolder> *TypeList;
1255 llvm::PATypeHolder *TypeVal;
1256 llvm::Value *ValueVal;
1257 std::vector<llvm::Value*> *ValueList;
1258 llvm::ArgListType *ArgList;
1259 llvm::TypeWithAttrs TypeWithAttrs;
1260 llvm::TypeWithAttrsList *TypeWithAttrsList;
1261 llvm::ValueRefList *ValueRefList;
1263 // Represent the RHS of PHI node
1264 std::list<std::pair<llvm::Value*,
1265 llvm::BasicBlock*> > *PHIList;
1266 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1267 std::vector<llvm::Constant*> *ConstVector;
1269 llvm::GlobalValue::LinkageTypes Linkage;
1270 llvm::GlobalValue::VisibilityTypes Visibility;
1271 llvm::FunctionType::ParameterAttributes ParamAttrs;
1272 llvm::APInt *APIntVal;
1280 char *StrVal; // This memory is strdup'd!
1281 llvm::ValID ValIDVal; // strdup'd memory maybe!
1283 llvm::Instruction::BinaryOps BinaryOpVal;
1284 llvm::Instruction::TermOps TermOpVal;
1285 llvm::Instruction::MemoryOps MemOpVal;
1286 llvm::Instruction::CastOps CastOpVal;
1287 llvm::Instruction::OtherOps OtherOpVal;
1288 llvm::ICmpInst::Predicate IPredicate;
1289 llvm::FCmpInst::Predicate FPredicate;
1291 /* Line 196 of yacc.c. */
1292 #line 1293 "llvmAsmParser.tab.c"
1293 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1294 # define YYSTYPE_IS_DECLARED 1
1295 # define YYSTYPE_IS_TRIVIAL 1
1300 /* Copy the second part of user declarations. */
1303 /* Line 219 of yacc.c. */
1304 #line 1305 "llvmAsmParser.tab.c"
1306 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1307 # define YYSIZE_T __SIZE_TYPE__
1309 #if ! defined (YYSIZE_T) && defined (size_t)
1310 # define YYSIZE_T size_t
1312 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1313 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1314 # define YYSIZE_T size_t
1316 #if ! defined (YYSIZE_T)
1317 # define YYSIZE_T unsigned int
1323 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1324 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1328 # define YY_(msgid) msgid
1332 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1334 /* The parser invokes alloca or malloc; define the necessary symbols. */
1336 # ifdef YYSTACK_USE_ALLOCA
1337 # if YYSTACK_USE_ALLOCA
1339 # define YYSTACK_ALLOC __builtin_alloca
1341 # define YYSTACK_ALLOC alloca
1342 # if defined (__STDC__) || defined (__cplusplus)
1343 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1344 # define YYINCLUDED_STDLIB_H
1350 # ifdef YYSTACK_ALLOC
1351 /* Pacify GCC's `empty if-body' warning. */
1352 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1353 # ifndef YYSTACK_ALLOC_MAXIMUM
1354 /* The OS might guarantee only one guard page at the bottom of the stack,
1355 and a page size can be as small as 4096 bytes. So we cannot safely
1356 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1357 to allow for a few compiler-allocated temporary stack slots. */
1358 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1361 # define YYSTACK_ALLOC YYMALLOC
1362 # define YYSTACK_FREE YYFREE
1363 # ifndef YYSTACK_ALLOC_MAXIMUM
1364 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1370 # define YYMALLOC malloc
1371 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1372 && (defined (__STDC__) || defined (__cplusplus)))
1373 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1377 # define YYFREE free
1378 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1379 && (defined (__STDC__) || defined (__cplusplus)))
1380 void free (void *); /* INFRINGES ON USER NAME SPACE */
1387 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1390 #if (! defined (yyoverflow) \
1391 && (! defined (__cplusplus) \
1392 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1394 /* A type that is properly aligned for any stack member. */
1401 /* The size of the maximum gap between one aligned stack and the next. */
1402 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1404 /* The size of an array large to enough to hold all stacks, each with
1406 # define YYSTACK_BYTES(N) \
1407 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1408 + YYSTACK_GAP_MAXIMUM)
1410 /* Copy COUNT objects from FROM to TO. The source and destination do
1413 # if defined (__GNUC__) && 1 < __GNUC__
1414 # define YYCOPY(To, From, Count) \
1415 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1417 # define YYCOPY(To, From, Count) \
1421 for (yyi = 0; yyi < (Count); yyi++) \
1422 (To)[yyi] = (From)[yyi]; \
1428 /* Relocate STACK from its old location to the new one. The
1429 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1430 elements in the stack, and YYPTR gives the new location of the
1431 stack. Advance YYPTR to a properly aligned location for the next
1433 # define YYSTACK_RELOCATE(Stack) \
1436 YYSIZE_T yynewbytes; \
1437 YYCOPY (&yyptr->Stack, Stack, yysize); \
1438 Stack = &yyptr->Stack; \
1439 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1440 yyptr += yynewbytes / sizeof (*yyptr); \
1446 #if defined (__STDC__) || defined (__cplusplus)
1447 typedef signed char yysigned_char;
1449 typedef short int yysigned_char;
1452 /* YYFINAL -- State number of the termination state. */
1454 /* YYLAST -- Last index in YYTABLE. */
1457 /* YYNTOKENS -- Number of terminals. */
1458 #define YYNTOKENS 148
1459 /* YYNNTS -- Number of nonterminals. */
1461 /* YYNRULES -- Number of rules. */
1462 #define YYNRULES 286
1463 /* YYNRULES -- Number of states. */
1464 #define YYNSTATES 559
1466 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1467 #define YYUNDEFTOK 2
1468 #define YYMAXUTOK 388
1470 #define YYTRANSLATE(YYX) \
1471 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1473 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1474 static const unsigned char yytranslate[] =
1476 0, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1480 138, 139, 136, 2, 135, 2, 2, 2, 2, 2,
1481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1482 143, 134, 144, 2, 2, 2, 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, 140, 137, 142, 2, 2, 2, 2, 2, 147,
1486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1488 141, 2, 2, 145, 2, 146, 2, 2, 2, 2,
1489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1501 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1502 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1503 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1504 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1505 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1506 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1507 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1508 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1509 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1510 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1511 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1512 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1513 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1514 125, 126, 127, 128, 129, 130, 131, 132, 133
1518 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1520 static const unsigned short int yyprhs[] =
1522 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1523 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1524 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1525 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1526 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1527 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1528 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1529 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1530 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1531 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1532 195, 197, 198, 201, 202, 205, 206, 210, 213, 214,
1533 216, 217, 221, 223, 226, 228, 230, 232, 234, 236,
1534 238, 241, 243, 246, 252, 258, 264, 270, 274, 277,
1535 283, 288, 291, 293, 295, 297, 301, 303, 307, 309,
1536 310, 312, 316, 321, 325, 329, 334, 339, 343, 350,
1537 356, 359, 362, 365, 368, 371, 374, 377, 380, 383,
1538 386, 389, 392, 399, 405, 414, 421, 428, 436, 444,
1539 451, 460, 469, 473, 475, 477, 479, 481, 482, 484,
1540 487, 488, 492, 493, 497, 501, 503, 507, 511, 512,
1541 519, 520, 528, 529, 537, 540, 544, 546, 550, 554,
1542 558, 562, 564, 565, 571, 575, 577, 581, 583, 584,
1543 594, 596, 598, 603, 605, 607, 610, 614, 615, 617,
1544 619, 621, 623, 625, 627, 629, 631, 633, 637, 639,
1545 645, 647, 649, 651, 653, 655, 657, 660, 663, 666,
1546 670, 673, 674, 676, 679, 682, 686, 696, 706, 715,
1547 730, 732, 734, 741, 747, 750, 757, 765, 769, 775,
1548 776, 777, 781, 784, 786, 792, 798, 805, 812, 817,
1549 824, 829, 834, 841, 848, 851, 860, 862, 864, 865,
1550 869, 876, 880, 887, 890, 895, 902
1553 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1554 static const short int yyrhs[] =
1556 188, 0, -1, 68, -1, 69, -1, 70, -1, 71,
1557 -1, 72, -1, 73, -1, 74, -1, 75, -1, 76,
1558 -1, 80, -1, 81, -1, 82, -1, 77, -1, 78,
1559 -1, 79, -1, 111, -1, 112, -1, 113, -1, 114,
1560 -1, 115, -1, 116, -1, 117, -1, 118, -1, 119,
1561 -1, 120, -1, 121, -1, 122, -1, 85, -1, 86,
1562 -1, 87, -1, 88, -1, 89, -1, 90, -1, 91,
1563 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1564 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1565 -1, 102, -1, 103, -1, 104, -1, 91, -1, 92,
1566 -1, 93, -1, 94, -1, 23, -1, 24, -1, 11,
1567 -1, 12, -1, 13, -1, 16, -1, 19, -1, 156,
1568 -1, -1, 156, 134, -1, -1, 17, -1, 20, -1,
1569 159, 134, -1, -1, 37, -1, 39, -1, 38, -1,
1570 40, -1, 42, -1, 41, -1, 43, -1, 45, -1,
1571 -1, 133, -1, -1, 41, -1, 43, -1, -1, 37,
1572 -1, 38, -1, 39, -1, 42, -1, -1, 56, -1,
1573 57, -1, 58, -1, 59, -1, 60, -1, 55, 4,
1574 -1, 112, -1, 113, -1, 130, -1, 131, -1, -1,
1575 168, 167, -1, 129, -1, 167, -1, -1, 170, 169,
1576 -1, -1, 48, 4, -1, -1, 135, 48, 4, -1,
1577 31, 19, -1, -1, 173, -1, -1, 135, 176, 175,
1578 -1, 173, -1, 48, 4, -1, 11, -1, 12, -1,
1579 13, -1, 14, -1, 44, -1, 177, -1, 178, 136,
1580 -1, 210, -1, 137, 4, -1, 178, 138, 182, 139,
1581 170, -1, 10, 138, 182, 139, 170, -1, 140, 4,
1582 141, 178, 142, -1, 143, 4, 141, 178, 144, -1,
1583 145, 183, 146, -1, 145, 146, -1, 143, 145, 183,
1584 146, 144, -1, 143, 145, 146, 144, -1, 178, 168,
1585 -1, 178, -1, 10, -1, 179, -1, 181, 135, 179,
1586 -1, 181, -1, 181, 135, 34, -1, 34, -1, -1,
1587 178, -1, 183, 135, 178, -1, 178, 140, 186, 142,
1588 -1, 178, 140, 142, -1, 178, 147, 19, -1, 178,
1589 143, 186, 144, -1, 178, 145, 186, 146, -1, 178,
1590 145, 146, -1, 178, 143, 145, 186, 146, 144, -1,
1591 178, 143, 145, 146, 144, -1, 178, 35, -1, 178,
1592 36, -1, 178, 210, -1, 178, 185, -1, 178, 22,
1593 -1, 154, 3, -1, 154, 5, -1, 154, 4, -1,
1594 154, 6, -1, 11, 23, -1, 11, 24, -1, 155,
1595 9, -1, 151, 138, 184, 33, 178, 139, -1, 110,
1596 138, 184, 221, 139, -1, 124, 138, 184, 135, 184,
1597 135, 184, 139, -1, 149, 138, 184, 135, 184, 139,
1598 -1, 150, 138, 184, 135, 184, 139, -1, 83, 152,
1599 138, 184, 135, 184, 139, -1, 84, 153, 138, 184,
1600 135, 184, 139, -1, 126, 138, 184, 135, 184, 139,
1601 -1, 127, 138, 184, 135, 184, 135, 184, 139, -1,
1602 128, 138, 184, 135, 184, 135, 184, 139, -1, 186,
1603 135, 184, -1, 184, -1, 29, -1, 30, -1, 189,
1604 -1, -1, 190, -1, 189, 190, -1, -1, 28, 191,
1605 206, -1, -1, 27, 192, 207, -1, 53, 52, 196,
1606 -1, 21, -1, 158, 15, 178, -1, 158, 15, 10,
1607 -1, -1, 160, 163, 187, 184, 193, 175, -1, -1,
1608 160, 161, 163, 187, 184, 194, 175, -1, -1, 160,
1609 162, 163, 187, 178, 195, 175, -1, 46, 197, -1,
1610 49, 134, 198, -1, 19, -1, 47, 134, 19, -1,
1611 61, 134, 19, -1, 140, 199, 142, -1, 199, 135,
1612 19, -1, 19, -1, -1, 200, 135, 178, 168, 157,
1613 -1, 178, 168, 157, -1, 200, -1, 200, 135, 34,
1614 -1, 34, -1, -1, 166, 180, 159, 138, 201, 139,
1615 170, 174, 171, -1, 25, -1, 145, -1, 165, 163,
1616 202, 203, -1, 26, -1, 146, -1, 213, 205, -1,
1617 164, 163, 202, -1, -1, 54, -1, 3, -1, 4,
1618 -1, 9, -1, 23, -1, 24, -1, 35, -1, 36,
1619 -1, 22, -1, 143, 186, 144, -1, 185, -1, 52,
1620 208, 19, 135, 19, -1, 7, -1, 8, -1, 156,
1621 -1, 159, -1, 210, -1, 209, -1, 178, 211, -1,
1622 213, 214, -1, 204, 214, -1, 215, 158, 216, -1,
1623 215, 218, -1, -1, 18, -1, 62, 212, -1, 62,
1624 10, -1, 63, 14, 211, -1, 63, 11, 211, 135,
1625 14, 211, 135, 14, 211, -1, 64, 154, 211, 135,
1626 14, 211, 140, 217, 142, -1, 64, 154, 211, 135,
1627 14, 211, 140, 142, -1, 65, 166, 180, 211, 138,
1628 220, 139, 170, 33, 14, 211, 66, 14, 211, -1,
1629 66, -1, 67, -1, 217, 154, 209, 135, 14, 211,
1630 -1, 154, 209, 135, 14, 211, -1, 158, 223, -1,
1631 178, 140, 211, 135, 211, 142, -1, 219, 135, 140,
1632 211, 135, 211, 142, -1, 178, 211, 168, -1, 220,
1633 135, 178, 211, 168, -1, -1, -1, 221, 135, 212,
1634 -1, 51, 50, -1, 50, -1, 149, 178, 211, 135,
1635 211, -1, 150, 178, 211, 135, 211, -1, 83, 152,
1636 178, 211, 135, 211, -1, 84, 153, 178, 211, 135,
1637 211, -1, 151, 212, 33, 178, -1, 124, 212, 135,
1638 212, 135, 212, -1, 125, 212, 135, 178, -1, 126,
1639 212, 135, 212, -1, 127, 212, 135, 212, 135, 212,
1640 -1, 128, 212, 135, 212, 135, 212, -1, 123, 219,
1641 -1, 222, 166, 180, 211, 138, 220, 139, 170, -1,
1642 225, -1, 32, -1, -1, 105, 178, 172, -1, 105,
1643 178, 135, 11, 211, 172, -1, 106, 178, 172, -1,
1644 106, 178, 135, 11, 211, 172, -1, 107, 212, -1,
1645 224, 108, 178, 211, -1, 224, 109, 212, 135, 178,
1646 211, -1, 110, 178, 211, 221, -1
1649 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1650 static const unsigned short int yyrline[] =
1652 0, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055,
1653 1055, 1056, 1056, 1056, 1056, 1056, 1056, 1057, 1057, 1057,
1654 1057, 1057, 1057, 1058, 1058, 1058, 1058, 1058, 1058, 1061,
1655 1061, 1062, 1062, 1063, 1063, 1064, 1064, 1065, 1065, 1069,
1656 1069, 1070, 1070, 1071, 1071, 1072, 1072, 1073, 1073, 1074,
1657 1074, 1075, 1075, 1076, 1077, 1082, 1083, 1083, 1085, 1085,
1658 1086, 1086, 1090, 1094, 1099, 1099, 1101, 1105, 1111, 1112,
1659 1113, 1114, 1115, 1119, 1120, 1121, 1125, 1126, 1130, 1131,
1660 1132, 1136, 1137, 1138, 1139, 1140, 1143, 1144, 1145, 1146,
1661 1147, 1148, 1149, 1156, 1157, 1158, 1159, 1162, 1163, 1168,
1662 1169, 1172, 1173, 1180, 1181, 1187, 1188, 1196, 1204, 1205,
1663 1210, 1211, 1212, 1217, 1230, 1230, 1230, 1230, 1233, 1237,
1664 1241, 1248, 1253, 1261, 1279, 1297, 1302, 1314, 1324, 1328,
1665 1338, 1345, 1352, 1359, 1364, 1369, 1376, 1377, 1384, 1391,
1666 1399, 1404, 1415, 1443, 1459, 1488, 1516, 1541, 1560, 1586,
1667 1606, 1618, 1625, 1691, 1701, 1711, 1720, 1730, 1738, 1748,
1668 1753, 1758, 1766, 1778, 1800, 1808, 1814, 1825, 1830, 1835,
1669 1841, 1847, 1856, 1860, 1868, 1868, 1879, 1884, 1892, 1893,
1670 1897, 1897, 1901, 1901, 1904, 1907, 1919, 1943, 1954, 1954,
1671 1964, 1964, 1972, 1972, 1982, 1985, 1991, 2004, 2008, 2013,
1672 2015, 2020, 2025, 2034, 2044, 2055, 2059, 2068, 2077, 2082,
1673 2194, 2194, 2196, 2205, 2205, 2207, 2212, 2224, 2228, 2233,
1674 2237, 2241, 2245, 2249, 2253, 2257, 2261, 2265, 2290, 2294,
1675 2308, 2312, 2316, 2320, 2326, 2326, 2332, 2341, 2345, 2354,
1676 2364, 2373, 2385, 2398, 2402, 2406, 2411, 2421, 2440, 2449,
1677 2516, 2520, 2527, 2538, 2551, 2561, 2572, 2582, 2590, 2598,
1678 2601, 2602, 2609, 2613, 2618, 2639, 2656, 2669, 2682, 2694,
1679 2702, 2709, 2715, 2721, 2727, 2742, 2806, 2811, 2815, 2822,
1680 2829, 2837, 2844, 2852, 2860, 2874, 2891
1684 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1685 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1686 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1687 static const char *const yytname[] =
1689 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1690 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1691 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1692 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1693 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1694 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1695 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1696 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1697 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1698 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1699 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1700 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1701 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1702 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1703 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1704 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1705 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1706 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1707 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1708 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT",
1709 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1710 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1711 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1712 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1713 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1714 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1715 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1716 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1717 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1718 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1719 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1720 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1721 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1722 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1723 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1724 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1725 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1726 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1727 "OptVolatile", "MemoryInst", 0
1732 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1734 static const unsigned short int yytoknum[] =
1736 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1737 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1738 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1739 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1740 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1741 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1742 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1743 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1744 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1745 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1746 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1747 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1748 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1749 385, 386, 387, 388, 61, 44, 42, 92, 40, 41,
1750 91, 120, 93, 60, 62, 123, 125, 99
1754 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1755 static const unsigned char yyr1[] =
1757 0, 148, 149, 149, 149, 149, 149, 149, 149, 149,
1758 149, 150, 150, 150, 150, 150, 150, 151, 151, 151,
1759 151, 151, 151, 151, 151, 151, 151, 151, 151, 152,
1760 152, 152, 152, 152, 152, 152, 152, 152, 152, 153,
1761 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
1762 153, 153, 153, 153, 153, 154, 155, 155, 156, 156,
1763 157, 157, 158, 158, 159, 159, 160, 160, 161, 161,
1764 161, 161, 161, 162, 162, 162, 163, 163, 164, 164,
1765 164, 165, 165, 165, 165, 165, 166, 166, 166, 166,
1766 166, 166, 166, 167, 167, 167, 167, 168, 168, 169,
1767 169, 170, 170, 171, 171, 172, 172, 173, 174, 174,
1768 175, 175, 176, 176, 177, 177, 177, 177, 178, 178,
1769 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
1770 178, 179, 180, 180, 181, 181, 182, 182, 182, 182,
1771 183, 183, 184, 184, 184, 184, 184, 184, 184, 184,
1772 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1773 184, 184, 185, 185, 185, 185, 185, 185, 185, 185,
1774 185, 185, 186, 186, 187, 187, 188, 188, 189, 189,
1775 191, 190, 192, 190, 190, 190, 190, 190, 193, 190,
1776 194, 190, 195, 190, 190, 190, 196, 197, 197, 198,
1777 199, 199, 199, 200, 200, 201, 201, 201, 201, 202,
1778 203, 203, 204, 205, 205, 206, 207, 208, 208, 209,
1779 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1780 210, 210, 210, 210, 211, 211, 212, 213, 213, 214,
1781 215, 215, 215, 216, 216, 216, 216, 216, 216, 216,
1782 216, 216, 217, 217, 218, 219, 219, 220, 220, 220,
1783 221, 221, 222, 222, 223, 223, 223, 223, 223, 223,
1784 223, 223, 223, 223, 223, 223, 223, 224, 224, 225,
1785 225, 225, 225, 225, 225, 225, 225
1788 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1789 static const unsigned char yyr2[] =
1791 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1792 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1793 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1794 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1795 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1796 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1797 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1798 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1799 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1800 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1801 1, 0, 2, 0, 2, 0, 3, 2, 0, 1,
1802 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1803 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1804 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1805 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1806 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1807 2, 2, 6, 5, 8, 6, 6, 7, 7, 6,
1808 8, 8, 3, 1, 1, 1, 1, 0, 1, 2,
1809 0, 3, 0, 3, 3, 1, 3, 3, 0, 6,
1810 0, 7, 0, 7, 2, 3, 1, 3, 3, 3,
1811 3, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1812 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1813 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1814 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
1815 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
1816 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1817 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1818 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1822 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1823 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1824 means the default is an error. */
1825 static const unsigned short int yydefact[] =
1827 67, 58, 64, 59, 65, 185, 182, 180, 0, 0,
1828 0, 0, 0, 0, 76, 0, 67, 178, 78, 81,
1829 0, 0, 194, 0, 0, 62, 0, 66, 68, 70,
1830 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
1831 1, 179, 79, 80, 76, 183, 82, 83, 84, 85,
1832 76, 241, 181, 241, 0, 0, 202, 195, 196, 184,
1833 230, 231, 187, 114, 115, 116, 117, 118, 0, 0,
1834 0, 0, 232, 233, 119, 186, 121, 0, 0, 174,
1835 175, 0, 86, 86, 242, 238, 63, 213, 214, 215,
1836 237, 197, 198, 201, 0, 139, 122, 0, 0, 0,
1837 0, 128, 140, 0, 120, 139, 0, 0, 114, 115,
1838 116, 0, 0, 0, 188, 0, 87, 88, 89, 90,
1839 91, 0, 216, 0, 278, 240, 0, 199, 138, 97,
1840 134, 136, 0, 0, 0, 0, 0, 0, 127, 0,
1841 190, 192, 159, 160, 155, 157, 156, 158, 161, 154,
1842 150, 151, 2, 3, 4, 5, 6, 7, 8, 9,
1843 10, 14, 15, 16, 11, 12, 13, 0, 0, 0,
1844 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1845 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
1846 0, 0, 0, 153, 152, 110, 92, 133, 132, 0,
1847 210, 211, 212, 277, 263, 0, 0, 0, 0, 86,
1848 250, 251, 0, 0, 0, 0, 0, 0, 0, 0,
1849 0, 0, 0, 0, 0, 0, 0, 239, 86, 254,
1850 0, 276, 200, 131, 0, 101, 0, 0, 130, 0,
1851 141, 101, 110, 110, 29, 30, 31, 32, 33, 34,
1852 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
1853 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1854 48, 0, 0, 0, 0, 0, 0, 143, 173, 0,
1855 0, 0, 147, 0, 144, 0, 0, 0, 0, 189,
1856 0, 262, 244, 0, 243, 0, 0, 55, 0, 0,
1857 0, 0, 105, 105, 283, 0, 0, 274, 0, 0,
1858 0, 0, 0, 0, 0, 0, 0, 0, 0, 93,
1859 94, 95, 96, 98, 137, 135, 124, 125, 126, 129,
1860 123, 191, 193, 0, 0, 260, 0, 0, 0, 0,
1861 0, 142, 128, 140, 0, 145, 146, 0, 0, 0,
1862 0, 0, 112, 110, 208, 219, 220, 221, 226, 222,
1863 223, 224, 225, 217, 0, 228, 235, 234, 236, 0,
1864 245, 0, 0, 0, 0, 0, 279, 0, 281, 260,
1865 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1866 0, 0, 0, 99, 100, 102, 0, 0, 0, 0,
1867 0, 0, 0, 172, 149, 0, 0, 0, 0, 107,
1868 113, 111, 207, 97, 205, 0, 218, 0, 0, 0,
1869 0, 0, 0, 0, 0, 0, 0, 286, 0, 0,
1870 0, 270, 271, 0, 0, 0, 0, 268, 0, 284,
1871 0, 0, 0, 0, 163, 0, 0, 0, 0, 148,
1872 0, 0, 0, 61, 0, 101, 0, 227, 0, 0,
1873 259, 0, 0, 105, 106, 105, 0, 0, 0, 0,
1874 0, 264, 265, 259, 0, 0, 0, 261, 0, 169,
1875 0, 0, 165, 166, 162, 60, 204, 206, 97, 108,
1876 0, 0, 0, 0, 0, 266, 267, 0, 280, 282,
1877 0, 0, 269, 272, 273, 0, 285, 167, 168, 0,
1878 0, 0, 61, 109, 103, 229, 0, 0, 97, 0,
1879 101, 255, 0, 101, 164, 170, 171, 203, 0, 209,
1880 0, 248, 0, 0, 257, 0, 0, 256, 275, 104,
1881 246, 0, 247, 0, 97, 0, 0, 0, 258, 0,
1882 0, 0, 0, 253, 0, 0, 252, 0, 249
1885 /* YYDEFGOTO[NTERM-NUM]. */
1886 static const short int yydefgoto[] =
1888 -1, 190, 191, 192, 254, 271, 111, 112, 72, 486,
1889 12, 73, 14, 37, 38, 39, 44, 50, 121, 323,
1890 233, 395, 326, 529, 376, 352, 514, 289, 353, 74,
1891 113, 130, 199, 131, 132, 103, 278, 365, 279, 81,
1892 15, 16, 17, 19, 18, 195, 242, 243, 59, 22,
1893 57, 94, 414, 415, 122, 202, 51, 89, 52, 45,
1894 417, 366, 76, 368, 294, 53, 85, 86, 227, 533,
1895 125, 307, 494, 398, 228, 229, 230, 231
1898 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1900 #define YYPACT_NINF -440
1901 static const short int yypact[] =
1903 406, -440, -440, -440, -440, -440, -440, -440, -2, -101,
1904 21, -55, 80, -20, 15, 132, 556, -440, 253, 197,
1905 -7, 87, -440, 20, 207, -440, 893, -440, -440, -440,
1906 -440, -440, -440, -440, -440, -440, -440, 97, 97, 125,
1907 -440, -440, -440, -440, 97, -440, -440, -440, -440, -440,
1908 97, 235, -440, 6, 240, 248, 258, -440, -440, -440,
1909 -440, -440, 134, -440, -440, -440, -440, -440, 269, 277,
1910 11, 123, -440, -440, -440, 33, -440, 125, 125, -440,
1911 -440, 1055, 128, 128, -440, -440, 47, -440, -440, -440,
1912 -440, -440, -440, -440, -57, 939, -440, 154, 156, 488,
1913 134, -440, 33, -112, -440, 939, 1055, 1149, 38, 281,
1914 289, 239, 293, 850, -440, 299, -440, -440, -440, -440,
1915 -440, 1168, -440, 2, 1301, -440, 285, -440, -440, 33,
1916 -440, 170, 167, 1149, 1149, 164, -97, 1149, -440, 171,
1917 -440, 33, -440, -440, -440, -440, -440, -440, -440, -440,
1918 -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,
1919 -440, -440, -440, -440, -440, -440, -440, 254, 446, 174,
1920 -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,
1921 -440, -440, 175, 176, 177, 178, 109, 1203, 676, 290,
1922 181, 182, 183, -440, -440, 187, -440, 134, 33, 93,
1923 -440, -440, -440, -440, -440, 273, 1217, 127, 313, 128,
1924 -440, -440, 254, 446, 1149, 1149, 1149, 1149, 1149, 1149,
1925 1149, 1149, 1149, 1149, 1149, 1149, 1149, -440, 128, -440,
1926 70, -440, -440, -29, 1098, -440, 72, -39, -440, 184,
1927 33, -440, 187, 187, -440, -440, -440, -440, -440, -440,
1928 -440, -440, -440, -440, 188, -440, -440, -440, -440, -440,
1929 -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,
1930 -440, 196, 1055, 1055, 1055, 1055, 1055, -440, -440, 22,
1931 771, -44, -440, -59, -440, 1055, 1055, 1055, -9, -440,
1932 198, -440, 134, 591, -440, 728, 728, -440, 728, 1168,
1933 1149, 1149, 112, 147, -440, 591, 75, 190, 200, 214,
1934 215, 217, 219, 591, 591, 322, 1168, 1149, 1149, -440,
1935 -440, -440, -440, -440, -440, -440, -41, -440, -440, -440,
1936 -41, -440, -440, 1055, 1055, -440, 230, 231, 232, 233,
1937 1055, -440, 225, 850, -43, -440, -440, 236, 241, 337,
1938 355, 371, -440, 187, 1114, -440, -440, -440, -440, -440,
1939 -440, -440, -440, 323, 1055, -440, -440, -440, -440, 243,
1940 -440, 244, 728, 591, 591, 17, -440, 19, -440, -440,
1941 728, 242, 1149, 1149, 1149, 1149, 1149, 245, 246, 1149,
1942 728, 591, 249, -440, -440, -440, 252, 255, -24, 1055,
1943 1055, 1055, 1055, -440, -440, 247, 1055, 1055, 1149, -440,
1944 -440, -440, -440, 33, 257, 260, -440, 375, -37, 383,
1945 386, 264, 268, 272, 728, 400, 728, 275, 282, 728,
1946 284, 33, -440, 295, 296, 728, 728, 33, 270, -440,
1947 1149, 1055, 1055, 1149, -440, 297, 298, 301, 303, -440,
1948 300, 302, 150, 32, 1133, -440, 305, -440, 728, 728,
1949 1149, 728, 728, 307, -440, 307, 728, 311, 1149, 1149,
1950 1149, -440, -440, 1149, 591, 308, 310, -440, 1055, -440,
1951 1055, 1055, -440, -440, -440, -440, -440, -440, 33, 46,
1952 397, 315, 314, 591, 26, -440, -440, 376, -440, -440,
1953 309, 728, -440, -440, -440, 89, -440, -440, -440, 317,
1954 319, 321, 32, -440, 413, -440, 449, 7, -440, 1149,
1955 -440, -440, 324, -440, -440, -440, -440, -440, 460, -440,
1956 728, -440, 976, 9, -29, 591, 149, -440, -41, -440,
1957 -440, 330, -440, 976, -440, 453, 454, 336, -29, 728,
1958 728, 461, 412, -440, 728, 465, -440, 728, -440
1961 /* YYPGOTO[NTERM-NUM]. */
1962 static const short int yypgoto[] =
1964 -440, 358, 359, 361, 274, 276, -206, -440, 0, -19,
1965 401, 13, -440, -440, -440, 31, -440, -440, -178, -309,
1966 -394, -440, -236, -440, -297, -1, -440, -207, -440, -440,
1967 -25, 263, -252, -440, 387, 404, -69, -110, -162, 160,
1968 -440, -440, 490, -440, -440, -440, -440, -440, -440, -440,
1969 -440, -440, -440, -440, 426, -440, -440, -440, -440, -440,
1970 -440, -439, -73, 100, -212, -440, 457, -440, -440, -440,
1971 -440, -440, 40, 135, -440, -440, -440, -440
1974 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1975 positive, shift that token. If negative, reduce the rule which
1976 number is the opposite. If zero, do what YYDEFACT says.
1977 If YYTABLE_NINF, syntax error. */
1978 #define YYTABLE_NINF -178
1979 static const short int yytable[] =
1981 11, 75, 298, 193, 304, 330, 378, 308, 309, 310,
1982 311, 312, 114, 13, 315, 98, 11, 394, 297, 453,
1983 297, 394, 350, 137, 84, 281, 283, 200, 424, 13,
1984 426, 299, 87, 23, 138, 331, 332, 140, 137, 351,
1985 194, -55, -55, -55, -55, 20, 102, 372, 1, 239,
1986 316, 3, 28, 29, 30, 31, 32, 33, 34, 21,
1987 35, 142, 143, 1, 390, 425, 3, 425, 77, 78,
1988 129, 319, 320, 24, 102, 82, 340, 350, 126, 25,
1989 129, 83, 141, 319, 320, 127, 11, 346, 393, 321,
1990 322, 340, 340, 541, 512, 26, 198, 104, 340, 105,
1991 345, 321, 322, 405, 547, 328, 392, 457, 236, 237,
1992 2, 443, 240, 4, 27, 444, 60, 61, 344, 100,
1993 108, 109, 110, 66, 534, 1, 2, 54, 3, 4,
1994 60, 61, 40, 100, 63, 64, 65, 66, 295, 1,
1995 2, 296, 3, 4, 319, 320, 411, 201, 36, 531,
1996 548, 542, 88, 67, 79, 80, 99, 340, 319, 320,
1997 56, 519, 321, 322, 341, 520, 498, 67, 499, 104,
1998 430, 105, 432, 433, 434, 393, 321, 322, 317, 318,
1999 394, 293, 545, 115, 116, 117, 118, 119, 120, 302,
2000 303, 293, 305, 306, 293, 293, 293, 293, 293, 313,
2001 314, 293, 418, 335, 336, 337, 338, 339, 104, 129,
2002 105, 104, 290, 105, 327, 380, 347, 348, 349, 489,
2003 367, 55, 367, 367, 519, 367, 58, 394, 523, 394,
2004 36, 477, 367, 193, 46, 47, 48, 106, 107, 49,
2005 367, 367, 144, 145, 146, 147, 68, 375, 104, 69,
2006 105, 277, 70, 84, 71, 343, 502, 503, 504, 91,
2007 68, 319, 320, 69, 396, 397, 70, 92, 71, 101,
2008 194, 403, 95, 96, 198, 373, 374, 93, 393, 321,
2009 322, 97, 377, 104, 536, 105, 104, 538, 105, 484,
2010 -56, 198, 391, 293, 42, 133, 43, 134, -57, 367,
2011 367, 367, 148, 196, 232, 234, 235, 367, 238, 284,
2012 241, 532, 272, 273, 274, 275, 276, 367, 367, 285,
2013 286, 287, 288, 291, 297, 381, 333, 543, 329, 413,
2014 445, 446, 447, 448, 334, 382, 354, 450, 451, 244,
2015 245, 246, 247, 248, 249, 250, 251, 252, 253, 383,
2016 384, 367, 385, 367, 386, 389, 367, 293, 431, 293,
2017 293, 293, 367, 367, 437, 399, 400, 401, 402, 404,
2018 408, 406, 475, 476, 409, 410, 407, 416, 419, 420,
2019 435, 436, 429, 452, 440, 367, 367, 441, 367, 367,
2020 442, 449, 454, 367, 456, 369, 370, 458, 371, 455,
2021 459, 367, 460, 461, 464, 379, -177, 462, 473, 509,
2022 443, 510, 511, 387, 388, 474, 515, 466, 293, 468,
2023 367, -63, 1, 2, 425, 3, 4, 5, 367, 488,
2024 469, 470, 478, 6, 7, 493, 480, 479, 481, 482,
2025 490, 483, 497, 293, 293, 293, 501, 507, 493, 508,
2026 516, 521, 8, 485, 517, 9, 524, 367, 525, 10,
2027 526, 528, 367, 530, 539, 546, 537, 549, 550, 255,
2028 256, 551, 421, 422, 423, 554, 367, 367, 555, 557,
2029 428, 367, 224, 225, 367, 226, 300, 124, 513, 301,
2030 438, 439, 139, 527, 535, 60, 61, 325, 100, 63,
2031 64, 65, 66, 136, 1, 2, 41, 3, 4, 123,
2032 90, 0, 485, 505, 427, 0, 0, 0, 0, 0,
2033 0, 0, 0, 0, 463, 0, 465, 0, 0, 467,
2034 0, 0, 67, 0, 0, 471, 472, 257, 258, 259,
2035 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
2036 270, 0, 0, 0, 0, 0, -176, 0, 491, 492,
2037 0, 495, 496, 0, 0, 0, 500, 0, 0, 0,
2038 0, -63, 1, 2, 506, 3, 4, 5, 0, 0,
2039 0, 0, 0, 6, 7, 0, 0, 0, 0, 0,
2040 0, 0, 0, 518, 355, 356, 0, 0, 60, 61,
2041 357, 522, 8, 0, 0, 9, 0, 1, 2, 10,
2042 3, 4, 0, 358, 359, 360, 0, 0, 0, 0,
2043 0, 0, 0, 0, 0, 68, 361, 362, 69, 0,
2044 540, 70, 0, 71, 135, 544, 0, 0, 0, 0,
2045 0, 0, 0, 363, 0, 0, 0, 0, 0, 552,
2046 553, 0, 0, 0, 556, 0, 0, 558, 0, 152,
2047 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2048 163, 164, 165, 166, 167, 168, 0, 0, 0, 0,
2049 0, 0, 0, 60, 61, 0, 100, 108, 109, 110,
2050 66, 0, 1, 2, 0, 3, 4, 0, 0, 0,
2051 0, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2052 178, 179, 180, 181, 0, 182, 0, 183, 184, 185,
2053 67, 0, 0, 0, 0, 0, 0, 104, 0, 105,
2054 0, 355, 356, 0, 364, 60, 61, 357, 0, 0,
2055 0, 0, 0, 0, 1, 2, 0, 3, 4, 0,
2056 358, 359, 360, 0, 0, 0, 0, 0, 0, 0,
2057 0, 0, 0, 361, 362, 0, 0, 0, 0, 0,
2058 0, 0, 0, 0, 0, 0, 0, 0, 60, 61,
2059 363, 100, 108, 109, 110, 66, 0, 1, 2, 0,
2060 3, 4, 0, 0, 0, 0, 152, 153, 154, 155,
2061 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2062 166, 167, 168, 68, 0, 67, 69, 0, 0, 70,
2063 0, 71, 282, 0, 0, 0, 0, 0, 0, 0,
2064 0, 0, 0, 0, 0, 0, 0, 0, 169, 170,
2065 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
2066 181, 0, 182, 0, 183, 184, 185, 60, 61, 0,
2067 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2068 4, 364, 149, 0, 0, 0, 0, 0, 0, 0,
2069 0, 0, 0, 0, 0, 150, 151, 0, 0, 0,
2070 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2071 60, 61, 0, 62, 63, 64, 65, 66, 68, 1,
2072 2, 69, 3, 4, 70, 0, 71, 342, 152, 153,
2073 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2074 164, 165, 166, 167, 168, 0, 0, 67, 0, 0,
2075 0, 0, 0, 0, 0, 0, 60, 61, 0, 100,
2076 63, 64, 65, 66, 0, 1, 2, 0, 3, 4,
2077 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2078 179, 180, 181, 128, 182, 0, 183, 184, 185, 355,
2079 356, 0, 0, 67, 0, 357, 104, 0, 105, 0,
2080 186, 0, 0, 187, 0, 188, 0, 189, 358, 359,
2081 360, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2082 0, 361, 362, 0, 0, 0, 0, 0, 0, 0,
2083 0, 0, 0, 0, 0, 0, 0, 0, 363, 0,
2084 68, 0, 0, 69, 0, 0, 70, 0, 71, 0,
2085 0, 0, 0, 0, 152, 153, 154, 155, 156, 157,
2086 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2087 168, 0, 60, 61, 0, 100, 108, 109, 110, 66,
2088 0, 1, 2, 0, 3, 4, 68, 0, 0, 69,
2089 0, 0, 70, 0, 71, 0, 169, 170, 171, 172,
2090 173, 174, 175, 176, 177, 178, 179, 180, 181, 67,
2091 182, 0, 183, 184, 185, 60, 61, 0, 100, 63,
2092 64, 65, 66, 0, 1, 2, 0, 3, 4, 364,
2093 0, 60, 61, 0, 100, 63, 64, 65, 66, 0,
2094 1, 2, 324, 3, 4, 0, 0, 0, 0, 0,
2095 60, 61, 67, 100, 63, 64, 65, 66, 412, 1,
2096 2, 0, 3, 4, 0, 0, 60, 61, 67, 100,
2097 63, 64, 65, 66, 0, 1, 2, 487, 3, 4,
2098 0, 0, 0, 0, 0, 60, 61, 67, 197, 63,
2099 64, 65, 66, 0, 1, 2, 0, 3, 4, 0,
2100 0, 0, 68, 67, 0, 69, 0, 0, 70, 0,
2101 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2102 60, 61, 67, 100, 108, 109, 110, 66, 0, 1,
2103 2, 0, 3, 4, 60, 61, 0, 292, 63, 64,
2104 65, 66, 0, 1, 2, 68, 3, 4, 69, 0,
2105 0, 70, 0, 71, 0, 0, 0, 67, 0, 0,
2106 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2107 0, 67, 0, 0, 0, 0, 0, 0, 0, 0,
2108 68, 0, 0, 69, 0, 0, 70, 0, 71, 0,
2109 0, 0, 0, 0, 0, 0, 68, 0, 0, 69,
2110 0, 0, 70, 0, 71, 0, 0, 0, 0, 0,
2111 0, 0, 0, 0, 0, 68, 0, 0, 69, 0,
2112 0, 70, 0, 71, 0, 0, 0, 0, 0, 0,
2113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2114 0, 0, 0, 203, 0, 0, 0, 0, 0, 0,
2115 68, 0, 0, 69, 0, 0, 70, 0, 280, 0,
2116 0, 204, 205, 0, 68, 0, 0, 69, 0, 0,
2117 70, 0, 71, 206, 207, 208, 209, 210, 211, 152,
2118 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2119 163, 164, 165, 166, 212, 213, 0, 0, 0, 0,
2120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2121 0, 0, 0, 0, 0, 0, 214, 215, 216, 0,
2122 0, 217, 170, 171, 172, 173, 174, 175, 176, 177,
2123 178, 179, 180, 181, 218, 219, 220, 221, 222, 223
2126 static const short int yycheck[] =
2128 0, 26, 208, 113, 216, 241, 303, 219, 220, 221,
2129 222, 223, 81, 0, 226, 4, 16, 326, 11, 413,
2130 11, 330, 31, 135, 18, 187, 188, 25, 11, 16,
2131 11, 209, 26, 134, 146, 242, 243, 106, 135, 48,
2132 113, 3, 4, 5, 6, 47, 71, 299, 16, 146,
2133 228, 19, 37, 38, 39, 40, 41, 42, 43, 61,
2134 45, 23, 24, 16, 316, 48, 19, 48, 37, 38,
2135 95, 112, 113, 52, 99, 44, 135, 31, 135, 134,
2136 105, 50, 107, 112, 113, 142, 86, 146, 129, 130,
2137 131, 135, 135, 532, 488, 15, 121, 136, 135, 138,
2138 144, 130, 131, 146, 543, 144, 318, 144, 133, 134,
2139 17, 135, 137, 20, 134, 139, 7, 8, 280, 10,
2140 11, 12, 13, 14, 518, 16, 17, 134, 19, 20,
2141 7, 8, 0, 10, 11, 12, 13, 14, 11, 16,
2142 17, 14, 19, 20, 112, 113, 353, 145, 133, 142,
2143 544, 142, 146, 44, 29, 30, 145, 135, 112, 113,
2144 140, 135, 130, 131, 142, 139, 463, 44, 465, 136,
2145 382, 138, 384, 385, 386, 129, 130, 131, 108, 109,
2146 489, 206, 33, 55, 56, 57, 58, 59, 60, 214,
2147 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
2148 225, 226, 364, 272, 273, 274, 275, 276, 136, 234,
2149 138, 136, 199, 138, 142, 140, 285, 286, 287, 455,
2150 293, 134, 295, 296, 135, 298, 19, 536, 139, 538,
2151 133, 443, 305, 343, 37, 38, 39, 77, 78, 42,
2152 313, 314, 3, 4, 5, 6, 137, 135, 136, 140,
2153 138, 142, 143, 18, 145, 280, 468, 469, 470, 19,
2154 137, 112, 113, 140, 333, 334, 143, 19, 145, 146,
2155 343, 340, 138, 4, 299, 300, 301, 19, 129, 130,
2156 131, 4, 135, 136, 520, 138, 136, 523, 138, 139,
2157 9, 316, 317, 318, 41, 141, 43, 141, 9, 372,
2158 373, 374, 9, 4, 19, 135, 139, 380, 144, 19,
2159 139, 517, 138, 138, 138, 138, 138, 390, 391, 138,
2160 138, 138, 135, 50, 11, 135, 138, 533, 144, 354,
2161 399, 400, 401, 402, 138, 135, 138, 406, 407, 85,
2162 86, 87, 88, 89, 90, 91, 92, 93, 94, 135,
2163 135, 424, 135, 426, 135, 33, 429, 382, 383, 384,
2164 385, 386, 435, 436, 389, 135, 135, 135, 135, 144,
2165 33, 135, 441, 442, 19, 4, 135, 54, 135, 135,
2166 135, 135, 140, 408, 135, 458, 459, 135, 461, 462,
2167 135, 144, 135, 466, 19, 295, 296, 14, 298, 139,
2168 14, 474, 138, 135, 4, 305, 0, 135, 138, 478,
2169 135, 480, 481, 313, 314, 440, 19, 135, 443, 135,
2170 493, 15, 16, 17, 48, 19, 20, 21, 501, 454,
2171 135, 135, 135, 27, 28, 460, 135, 139, 135, 139,
2172 135, 139, 135, 468, 469, 470, 135, 139, 473, 139,
2173 135, 142, 46, 453, 140, 49, 139, 530, 139, 53,
2174 139, 48, 535, 14, 4, 135, 142, 14, 14, 23,
2175 24, 135, 372, 373, 374, 14, 549, 550, 66, 14,
2176 380, 554, 124, 124, 557, 124, 212, 86, 489, 213,
2177 390, 391, 105, 512, 519, 7, 8, 234, 10, 11,
2178 12, 13, 14, 99, 16, 17, 16, 19, 20, 83,
2179 53, -1, 512, 473, 379, -1, -1, -1, -1, -1,
2180 -1, -1, -1, -1, 424, -1, 426, -1, -1, 429,
2181 -1, -1, 44, -1, -1, 435, 436, 91, 92, 93,
2182 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2183 104, -1, -1, -1, -1, -1, 0, -1, 458, 459,
2184 -1, 461, 462, -1, -1, -1, 466, -1, -1, -1,
2185 -1, 15, 16, 17, 474, 19, 20, 21, -1, -1,
2186 -1, -1, -1, 27, 28, -1, -1, -1, -1, -1,
2187 -1, -1, -1, 493, 3, 4, -1, -1, 7, 8,
2188 9, 501, 46, -1, -1, 49, -1, 16, 17, 53,
2189 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2190 -1, -1, -1, -1, -1, 137, 35, 36, 140, -1,
2191 530, 143, -1, 145, 146, 535, -1, -1, -1, -1,
2192 -1, -1, -1, 52, -1, -1, -1, -1, -1, 549,
2193 550, -1, -1, -1, 554, -1, -1, 557, -1, 68,
2194 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2195 79, 80, 81, 82, 83, 84, -1, -1, -1, -1,
2196 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2197 14, -1, 16, 17, -1, 19, 20, -1, -1, -1,
2198 -1, 110, 111, 112, 113, 114, 115, 116, 117, 118,
2199 119, 120, 121, 122, -1, 124, -1, 126, 127, 128,
2200 44, -1, -1, -1, -1, -1, -1, 136, -1, 138,
2201 -1, 3, 4, -1, 143, 7, 8, 9, -1, -1,
2202 -1, -1, -1, -1, 16, 17, -1, 19, 20, -1,
2203 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2204 -1, -1, -1, 35, 36, -1, -1, -1, -1, -1,
2205 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2206 52, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2207 19, 20, -1, -1, -1, -1, 68, 69, 70, 71,
2208 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2209 82, 83, 84, 137, -1, 44, 140, -1, -1, 143,
2210 -1, 145, 146, -1, -1, -1, -1, -1, -1, -1,
2211 -1, -1, -1, -1, -1, -1, -1, -1, 110, 111,
2212 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2213 122, -1, 124, -1, 126, 127, 128, 7, 8, -1,
2214 -1, -1, -1, -1, -1, -1, 16, 17, -1, 19,
2215 20, 143, 22, -1, -1, -1, -1, -1, -1, -1,
2216 -1, -1, -1, -1, -1, 35, 36, -1, -1, -1,
2217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2218 7, 8, -1, 10, 11, 12, 13, 14, 137, 16,
2219 17, 140, 19, 20, 143, -1, 145, 146, 68, 69,
2220 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2221 80, 81, 82, 83, 84, -1, -1, 44, -1, -1,
2222 -1, -1, -1, -1, -1, -1, 7, 8, -1, 10,
2223 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2224 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2225 120, 121, 122, 34, 124, -1, 126, 127, 128, 3,
2226 4, -1, -1, 44, -1, 9, 136, -1, 138, -1,
2227 140, -1, -1, 143, -1, 145, -1, 147, 22, 23,
2228 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2229 -1, 35, 36, -1, -1, -1, -1, -1, -1, -1,
2230 -1, -1, -1, -1, -1, -1, -1, -1, 52, -1,
2231 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2232 -1, -1, -1, -1, 68, 69, 70, 71, 72, 73,
2233 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2234 84, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2235 -1, 16, 17, -1, 19, 20, 137, -1, -1, 140,
2236 -1, -1, 143, -1, 145, -1, 110, 111, 112, 113,
2237 114, 115, 116, 117, 118, 119, 120, 121, 122, 44,
2238 124, -1, 126, 127, 128, 7, 8, -1, 10, 11,
2239 12, 13, 14, -1, 16, 17, -1, 19, 20, 143,
2240 -1, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2241 16, 17, 34, 19, 20, -1, -1, -1, -1, -1,
2242 7, 8, 44, 10, 11, 12, 13, 14, 34, 16,
2243 17, -1, 19, 20, -1, -1, 7, 8, 44, 10,
2244 11, 12, 13, 14, -1, 16, 17, 34, 19, 20,
2245 -1, -1, -1, -1, -1, 7, 8, 44, 10, 11,
2246 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2247 -1, -1, 137, 44, -1, 140, -1, -1, 143, -1,
2248 145, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2249 7, 8, 44, 10, 11, 12, 13, 14, -1, 16,
2250 17, -1, 19, 20, 7, 8, -1, 10, 11, 12,
2251 13, 14, -1, 16, 17, 137, 19, 20, 140, -1,
2252 -1, 143, -1, 145, -1, -1, -1, 44, -1, -1,
2253 -1, 137, -1, -1, 140, -1, -1, 143, -1, 145,
2254 -1, 44, -1, -1, -1, -1, -1, -1, -1, -1,
2255 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2256 -1, -1, -1, -1, -1, -1, 137, -1, -1, 140,
2257 -1, -1, 143, -1, 145, -1, -1, -1, -1, -1,
2258 -1, -1, -1, -1, -1, 137, -1, -1, 140, -1,
2259 -1, 143, -1, 145, -1, -1, -1, -1, -1, -1,
2260 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2261 -1, -1, -1, 32, -1, -1, -1, -1, -1, -1,
2262 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2263 -1, 50, 51, -1, 137, -1, -1, 140, -1, -1,
2264 143, -1, 145, 62, 63, 64, 65, 66, 67, 68,
2265 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2266 79, 80, 81, 82, 83, 84, -1, -1, -1, -1,
2267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2268 -1, -1, -1, -1, -1, -1, 105, 106, 107, -1,
2269 -1, 110, 111, 112, 113, 114, 115, 116, 117, 118,
2270 119, 120, 121, 122, 123, 124, 125, 126, 127, 128
2273 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2274 symbol of state STATE-NUM. */
2275 static const unsigned char yystos[] =
2277 0, 16, 17, 19, 20, 21, 27, 28, 46, 49,
2278 53, 156, 158, 159, 160, 188, 189, 190, 192, 191,
2279 47, 61, 197, 134, 52, 134, 15, 134, 37, 38,
2280 39, 40, 41, 42, 43, 45, 133, 161, 162, 163,
2281 0, 190, 41, 43, 164, 207, 37, 38, 39, 42,
2282 165, 204, 206, 213, 134, 134, 140, 198, 19, 196,
2283 7, 8, 10, 11, 12, 13, 14, 44, 137, 140,
2284 143, 145, 156, 159, 177, 178, 210, 163, 163, 29,
2285 30, 187, 163, 163, 18, 214, 215, 26, 146, 205,
2286 214, 19, 19, 19, 199, 138, 4, 4, 4, 145,
2287 10, 146, 178, 183, 136, 138, 187, 187, 11, 12,
2288 13, 154, 155, 178, 184, 55, 56, 57, 58, 59,
2289 60, 166, 202, 202, 158, 218, 135, 142, 34, 178,
2290 179, 181, 182, 141, 141, 146, 183, 135, 146, 182,
2291 184, 178, 23, 24, 3, 4, 5, 6, 9, 22,
2292 35, 36, 68, 69, 70, 71, 72, 73, 74, 75,
2293 76, 77, 78, 79, 80, 81, 82, 83, 84, 110,
2294 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2295 121, 122, 124, 126, 127, 128, 140, 143, 145, 147,
2296 149, 150, 151, 185, 210, 193, 4, 10, 178, 180,
2297 25, 145, 203, 32, 50, 51, 62, 63, 64, 65,
2298 66, 67, 83, 84, 105, 106, 107, 110, 123, 124,
2299 125, 126, 127, 128, 149, 150, 151, 216, 222, 223,
2300 224, 225, 19, 168, 135, 139, 178, 178, 144, 146,
2301 178, 139, 194, 195, 85, 86, 87, 88, 89, 90,
2302 91, 92, 93, 94, 152, 23, 24, 91, 92, 93,
2303 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2304 104, 153, 138, 138, 138, 138, 138, 142, 184, 186,
2305 145, 186, 146, 186, 19, 138, 138, 138, 135, 175,
2306 159, 50, 10, 178, 212, 11, 14, 11, 154, 166,
2307 152, 153, 178, 178, 212, 178, 178, 219, 212, 212,
2308 212, 212, 212, 178, 178, 212, 166, 108, 109, 112,
2309 113, 130, 131, 167, 34, 179, 170, 142, 144, 144,
2310 170, 175, 175, 138, 138, 184, 184, 184, 184, 184,
2311 135, 142, 146, 178, 186, 144, 146, 184, 184, 184,
2312 31, 48, 173, 176, 138, 3, 4, 9, 22, 23,
2313 24, 35, 36, 52, 143, 185, 209, 210, 211, 211,
2314 211, 211, 180, 178, 178, 135, 172, 135, 172, 211,
2315 140, 135, 135, 135, 135, 135, 135, 211, 211, 33,
2316 180, 178, 212, 129, 167, 169, 184, 184, 221, 135,
2317 135, 135, 135, 184, 144, 146, 135, 135, 33, 19,
2318 4, 175, 34, 178, 200, 201, 54, 208, 186, 135,
2319 135, 211, 211, 211, 11, 48, 11, 221, 211, 140,
2320 212, 178, 212, 212, 212, 135, 135, 178, 211, 211,
2321 135, 135, 135, 135, 139, 184, 184, 184, 184, 144,
2322 184, 184, 178, 168, 135, 139, 19, 144, 14, 14,
2323 138, 135, 135, 211, 4, 211, 135, 211, 135, 135,
2324 135, 211, 211, 138, 178, 184, 184, 212, 135, 139,
2325 135, 135, 139, 139, 139, 156, 157, 34, 178, 170,
2326 135, 211, 211, 178, 220, 211, 211, 135, 172, 172,
2327 211, 135, 212, 212, 212, 220, 211, 139, 139, 184,
2328 184, 184, 168, 173, 174, 19, 135, 140, 211, 135,
2329 139, 142, 211, 139, 139, 139, 139, 157, 48, 171,
2330 14, 142, 154, 217, 168, 178, 170, 142, 170, 4,
2331 211, 209, 142, 154, 211, 33, 135, 209, 168, 14,
2332 14, 135, 211, 211, 14, 66, 211, 14, 211
2335 #define yyerrok (yyerrstatus = 0)
2336 #define yyclearin (yychar = YYEMPTY)
2337 #define YYEMPTY (-2)
2340 #define YYACCEPT goto yyacceptlab
2341 #define YYABORT goto yyabortlab
2342 #define YYERROR goto yyerrorlab
2345 /* Like YYERROR except do call yyerror. This remains here temporarily
2346 to ease the transition to the new meaning of YYERROR, for GCC.
2347 Once GCC version 2 has supplanted version 1, this can go. */
2349 #define YYFAIL goto yyerrlab
2351 #define YYRECOVERING() (!!yyerrstatus)
2353 #define YYBACKUP(Token, Value) \
2355 if (yychar == YYEMPTY && yylen == 1) \
2359 yytoken = YYTRANSLATE (yychar); \
2365 yyerror (YY_("syntax error: cannot back up")); \
2372 #define YYERRCODE 256
2375 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2376 If N is 0, then set CURRENT to the empty location which ends
2377 the previous symbol: RHS[0] (always defined). */
2379 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2380 #ifndef YYLLOC_DEFAULT
2381 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2385 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2386 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2387 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2388 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2392 (Current).first_line = (Current).last_line = \
2393 YYRHSLOC (Rhs, 0).last_line; \
2394 (Current).first_column = (Current).last_column = \
2395 YYRHSLOC (Rhs, 0).last_column; \
2401 /* YY_LOCATION_PRINT -- Print the location on the stream.
2402 This macro was not mandated originally: define only if we know
2403 we won't break user code: when these are the locations we know. */
2405 #ifndef YY_LOCATION_PRINT
2406 # if YYLTYPE_IS_TRIVIAL
2407 # define YY_LOCATION_PRINT(File, Loc) \
2408 fprintf (File, "%d.%d-%d.%d", \
2409 (Loc).first_line, (Loc).first_column, \
2410 (Loc).last_line, (Loc).last_column)
2412 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2417 /* YYLEX -- calling `yylex' with the right arguments. */
2420 # define YYLEX yylex (YYLEX_PARAM)
2422 # define YYLEX yylex ()
2425 /* Enable debugging if requested. */
2429 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2430 # define YYFPRINTF fprintf
2433 # define YYDPRINTF(Args) \
2439 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2443 YYFPRINTF (stderr, "%s ", Title); \
2444 yysymprint (stderr, \
2446 YYFPRINTF (stderr, "\n"); \
2450 /*------------------------------------------------------------------.
2451 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2453 `------------------------------------------------------------------*/
2455 #if defined (__STDC__) || defined (__cplusplus)
2457 yy_stack_print (short int *bottom, short int *top)
2460 yy_stack_print (bottom, top)
2465 YYFPRINTF (stderr, "Stack now");
2466 for (/* Nothing. */; bottom <= top; ++bottom)
2467 YYFPRINTF (stderr, " %d", *bottom);
2468 YYFPRINTF (stderr, "\n");
2471 # define YY_STACK_PRINT(Bottom, Top) \
2474 yy_stack_print ((Bottom), (Top)); \
2478 /*------------------------------------------------.
2479 | Report that the YYRULE is going to be reduced. |
2480 `------------------------------------------------*/
2482 #if defined (__STDC__) || defined (__cplusplus)
2484 yy_reduce_print (int yyrule)
2487 yy_reduce_print (yyrule)
2492 unsigned long int yylno = yyrline[yyrule];
2493 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2495 /* Print the symbols being reduced, and their result. */
2496 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2497 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2498 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2501 # define YY_REDUCE_PRINT(Rule) \
2504 yy_reduce_print (Rule); \
2507 /* Nonzero means print parse trace. It is left uninitialized so that
2508 multiple parsers can coexist. */
2510 #else /* !YYDEBUG */
2511 # define YYDPRINTF(Args)
2512 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2513 # define YY_STACK_PRINT(Bottom, Top)
2514 # define YY_REDUCE_PRINT(Rule)
2515 #endif /* !YYDEBUG */
2518 /* YYINITDEPTH -- initial size of the parser's stacks. */
2520 # define YYINITDEPTH 200
2523 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2524 if the built-in stack extension method is used).
2526 Do not make this value too large; the results are undefined if
2527 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2528 evaluated with infinite-precision integer arithmetic. */
2531 # define YYMAXDEPTH 10000
2539 # if defined (__GLIBC__) && defined (_STRING_H)
2540 # define yystrlen strlen
2542 /* Return the length of YYSTR. */
2544 # if defined (__STDC__) || defined (__cplusplus)
2545 yystrlen (const char *yystr)
2551 const char *yys = yystr;
2553 while (*yys++ != '\0')
2556 return yys - yystr - 1;
2562 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2563 # define yystpcpy stpcpy
2565 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2568 # if defined (__STDC__) || defined (__cplusplus)
2569 yystpcpy (char *yydest, const char *yysrc)
2571 yystpcpy (yydest, yysrc)
2577 const char *yys = yysrc;
2579 while ((*yyd++ = *yys++) != '\0')
2588 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2589 quotes and backslashes, so that it's suitable for yyerror. The
2590 heuristic is that double-quoting is unnecessary unless the string
2591 contains an apostrophe, a comma, or backslash (other than
2592 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2593 null, do not copy; instead, return the length of what the result
2596 yytnamerr (char *yyres, const char *yystr)
2601 char const *yyp = yystr;
2608 goto do_not_strip_quotes;
2612 goto do_not_strip_quotes;
2625 do_not_strip_quotes: ;
2629 return yystrlen (yystr);
2631 return yystpcpy (yyres, yystr) - yyres;
2635 #endif /* YYERROR_VERBOSE */
2640 /*--------------------------------.
2641 | Print this symbol on YYOUTPUT. |
2642 `--------------------------------*/
2644 #if defined (__STDC__) || defined (__cplusplus)
2646 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2649 yysymprint (yyoutput, yytype, yyvaluep)
2655 /* Pacify ``unused variable'' warnings. */
2658 if (yytype < YYNTOKENS)
2659 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2661 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2665 if (yytype < YYNTOKENS)
2666 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2673 YYFPRINTF (yyoutput, ")");
2676 #endif /* ! YYDEBUG */
2677 /*-----------------------------------------------.
2678 | Release the memory associated to this symbol. |
2679 `-----------------------------------------------*/
2681 #if defined (__STDC__) || defined (__cplusplus)
2683 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2686 yydestruct (yymsg, yytype, yyvaluep)
2692 /* Pacify ``unused variable'' warnings. */
2697 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2708 /* Prevent warnings from -Wmissing-prototypes. */
2710 #ifdef YYPARSE_PARAM
2711 # if defined (__STDC__) || defined (__cplusplus)
2712 int yyparse (void *YYPARSE_PARAM);
2716 #else /* ! YYPARSE_PARAM */
2717 #if defined (__STDC__) || defined (__cplusplus)
2722 #endif /* ! YYPARSE_PARAM */
2726 /* The look-ahead symbol. */
2729 /* The semantic value of the look-ahead symbol. */
2732 /* Number of syntax errors so far. */
2741 #ifdef YYPARSE_PARAM
2742 # if defined (__STDC__) || defined (__cplusplus)
2743 int yyparse (void *YYPARSE_PARAM)
2745 int yyparse (YYPARSE_PARAM)
2746 void *YYPARSE_PARAM;
2748 #else /* ! YYPARSE_PARAM */
2749 #if defined (__STDC__) || defined (__cplusplus)
2763 /* Number of tokens to shift before error messages enabled. */
2765 /* Look-ahead token as an internal (translated) token number. */
2768 /* Three stacks and their tools:
2769 `yyss': related to states,
2770 `yyvs': related to semantic values,
2771 `yyls': related to locations.
2773 Refer to the stacks thru separate pointers, to allow yyoverflow
2774 to reallocate them elsewhere. */
2776 /* The state stack. */
2777 short int yyssa[YYINITDEPTH];
2778 short int *yyss = yyssa;
2781 /* The semantic value stack. */
2782 YYSTYPE yyvsa[YYINITDEPTH];
2783 YYSTYPE *yyvs = yyvsa;
2788 #define YYPOPSTACK (yyvsp--, yyssp--)
2790 YYSIZE_T yystacksize = YYINITDEPTH;
2792 /* The variables used to return semantic value and location from the
2797 /* When reducing, the number of symbols on the RHS of the reduced
2801 YYDPRINTF ((stderr, "Starting parse\n"));
2806 yychar = YYEMPTY; /* Cause a token to be read. */
2808 /* Initialize stack pointers.
2809 Waste one element of value and location stack
2810 so that they stay on the same level as the state stack.
2811 The wasted elements are never initialized. */
2818 /*------------------------------------------------------------.
2819 | yynewstate -- Push a new state, which is found in yystate. |
2820 `------------------------------------------------------------*/
2822 /* In all cases, when you get here, the value and location stacks
2823 have just been pushed. so pushing a state here evens the stacks.
2830 if (yyss + yystacksize - 1 <= yyssp)
2832 /* Get the current used size of the three stacks, in elements. */
2833 YYSIZE_T yysize = yyssp - yyss + 1;
2837 /* Give user a chance to reallocate the stack. Use copies of
2838 these so that the &'s don't force the real ones into
2840 YYSTYPE *yyvs1 = yyvs;
2841 short int *yyss1 = yyss;
2844 /* Each stack pointer address is followed by the size of the
2845 data in use in that stack, in bytes. This used to be a
2846 conditional around just the two extra args, but that might
2847 be undefined if yyoverflow is a macro. */
2848 yyoverflow (YY_("memory exhausted"),
2849 &yyss1, yysize * sizeof (*yyssp),
2850 &yyvs1, yysize * sizeof (*yyvsp),
2857 #else /* no yyoverflow */
2858 # ifndef YYSTACK_RELOCATE
2859 goto yyexhaustedlab;
2861 /* Extend the stack our own way. */
2862 if (YYMAXDEPTH <= yystacksize)
2863 goto yyexhaustedlab;
2865 if (YYMAXDEPTH < yystacksize)
2866 yystacksize = YYMAXDEPTH;
2869 short int *yyss1 = yyss;
2870 union yyalloc *yyptr =
2871 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2873 goto yyexhaustedlab;
2874 YYSTACK_RELOCATE (yyss);
2875 YYSTACK_RELOCATE (yyvs);
2877 # undef YYSTACK_RELOCATE
2879 YYSTACK_FREE (yyss1);
2882 #endif /* no yyoverflow */
2884 yyssp = yyss + yysize - 1;
2885 yyvsp = yyvs + yysize - 1;
2888 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2889 (unsigned long int) yystacksize));
2891 if (yyss + yystacksize - 1 <= yyssp)
2895 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2904 /* Do appropriate processing given the current state. */
2905 /* Read a look-ahead token if we need one and don't already have one. */
2908 /* First try to decide what to do without reference to look-ahead token. */
2910 yyn = yypact[yystate];
2911 if (yyn == YYPACT_NINF)
2914 /* Not known => get a look-ahead token if don't already have one. */
2916 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2917 if (yychar == YYEMPTY)
2919 YYDPRINTF ((stderr, "Reading a token: "));
2923 if (yychar <= YYEOF)
2925 yychar = yytoken = YYEOF;
2926 YYDPRINTF ((stderr, "Now at end of input.\n"));
2930 yytoken = YYTRANSLATE (yychar);
2931 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2934 /* If the proper action on seeing token YYTOKEN is to reduce or to
2935 detect an error, take that action. */
2937 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2942 if (yyn == 0 || yyn == YYTABLE_NINF)
2951 /* Shift the look-ahead token. */
2952 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2954 /* Discard the token being shifted unless it is eof. */
2955 if (yychar != YYEOF)
2961 /* Count tokens shifted since error; after three, turn off error
2970 /*-----------------------------------------------------------.
2971 | yydefault -- do the default action for the current state. |
2972 `-----------------------------------------------------------*/
2974 yyn = yydefact[yystate];
2980 /*-----------------------------.
2981 | yyreduce -- Do a reduction. |
2982 `-----------------------------*/
2984 /* yyn is the number of a rule to reduce with. */
2987 /* If YYLEN is nonzero, implement the default value of the action:
2990 Otherwise, the following line sets YYVAL to garbage.
2991 This behavior is undocumented and Bison
2992 users should not rely upon it. Assigning to YYVAL
2993 unconditionally makes the parser a bit smaller, and it avoids a
2994 GCC warning that YYVAL may be used uninitialized. */
2995 yyval = yyvsp[1-yylen];
2998 YY_REDUCE_PRINT (yyn);
3002 #line 1061 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3003 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3007 #line 1061 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3008 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3012 #line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3013 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3017 #line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3018 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3022 #line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3023 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3027 #line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3028 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3032 #line 1064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3033 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3037 #line 1064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3038 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3042 #line 1065 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3043 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3047 #line 1065 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3048 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3052 #line 1069 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3053 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3057 #line 1069 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3058 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3062 #line 1070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3063 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3067 #line 1070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3068 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3072 #line 1071 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3073 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3077 #line 1071 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3078 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3082 #line 1072 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3083 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3087 #line 1072 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3088 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3092 #line 1073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3093 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3097 #line 1073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3098 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3102 #line 1074 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3103 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3107 #line 1074 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3108 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3112 #line 1075 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3113 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3117 #line 1075 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3118 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3122 #line 1076 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3123 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3127 #line 1077 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3128 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3132 #line 1086 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3133 { (yyval.StrVal) = 0; ;}
3137 #line 1090 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3139 (yyval.StrVal) = (yyvsp[-1].StrVal);
3145 #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3153 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3155 (yyval.StrVal) = (yyvsp[-1].StrVal);
3161 #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3169 #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3170 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3174 #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3175 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3179 #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3180 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3184 #line 1114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3185 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3189 #line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3190 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3194 #line 1119 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3195 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3199 #line 1120 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3200 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3204 #line 1121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3205 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3209 #line 1125 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3210 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3214 #line 1126 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3215 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3219 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3220 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3224 #line 1131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3225 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3229 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3230 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3234 #line 1136 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3235 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3239 #line 1137 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3240 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3244 #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3245 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3249 #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3250 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3254 #line 1140 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3255 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3259 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3260 { (yyval.UIntVal) = CallingConv::C; ;}
3264 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3265 { (yyval.UIntVal) = CallingConv::C; ;}
3269 #line 1145 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3270 { (yyval.UIntVal) = CallingConv::Fast; ;}
3274 #line 1146 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3275 { (yyval.UIntVal) = CallingConv::Cold; ;}
3279 #line 1147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3280 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3284 #line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3285 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3289 #line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3291 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3292 GEN_ERROR("Calling conv too large");
3293 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3299 #line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3300 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3304 #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3305 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3309 #line 1158 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3310 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
3314 #line 1159 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3315 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
3319 #line 1162 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3320 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3324 #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3326 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3331 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3332 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3336 #line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3337 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3341 #line 1173 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3343 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3348 #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3349 { (yyval.UIntVal) = 0; ;}
3353 #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3355 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3356 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3357 GEN_ERROR("Alignment must be a power of two");
3363 #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3364 { (yyval.UIntVal) = 0; ;}
3368 #line 1188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3370 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3371 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3372 GEN_ERROR("Alignment must be a power of two");
3378 #line 1196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3380 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3381 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3382 GEN_ERROR("Invalid character in section name");
3383 (yyval.StrVal) = (yyvsp[0].StrVal);
3389 #line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3390 { (yyval.StrVal) = 0; ;}
3394 #line 1205 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3395 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3399 #line 1210 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3404 #line 1211 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3409 #line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3411 CurGV->setSection((yyvsp[0].StrVal));
3412 free((yyvsp[0].StrVal));
3418 #line 1217 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3420 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3421 GEN_ERROR("Alignment must be a power of two");
3422 CurGV->setAlignment((yyvsp[0].UInt64Val));
3428 #line 1233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3430 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3436 #line 1237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3438 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3444 #line 1241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3446 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3447 GEN_ERROR("Cannot form a pointer to a basic block");
3448 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3449 delete (yyvsp[-1].TypeVal);
3455 #line 1248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3456 { // Named types are also simple types...
3457 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3459 (yyval.TypeVal) = new PATypeHolder(tmp);
3464 #line 1253 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3465 { // Type UpReference
3466 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3467 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3468 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3469 (yyval.TypeVal) = new PATypeHolder(OT);
3470 UR_OUT("New Upreference!\n");
3476 #line 1261 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3478 std::vector<const Type*> Params;
3479 std::vector<FunctionType::ParameterAttributes> Attrs;
3480 Attrs.push_back((yyvsp[0].ParamAttrs));
3481 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3482 Params.push_back(I->Ty->get());
3483 if (I->Ty->get() != Type::VoidTy)
3484 Attrs.push_back(I->Attrs);
3486 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3487 if (isVarArg) Params.pop_back();
3489 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3490 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3491 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3492 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3498 #line 1279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3500 std::vector<const Type*> Params;
3501 std::vector<FunctionType::ParameterAttributes> Attrs;
3502 Attrs.push_back((yyvsp[0].ParamAttrs));
3503 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3504 Params.push_back(I->Ty->get());
3505 if (I->Ty->get() != Type::VoidTy)
3506 Attrs.push_back(I->Attrs);
3508 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3509 if (isVarArg) Params.pop_back();
3511 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3512 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3513 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3519 #line 1297 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3520 { // Sized array type?
3521 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3522 delete (yyvsp[-1].TypeVal);
3528 #line 1302 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3530 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3531 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3532 GEN_ERROR("Unsigned result not equal to signed result");
3533 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3534 GEN_ERROR("Element type of a VectorType must be primitive");
3535 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3536 GEN_ERROR("Vector length should be a power of 2");
3537 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3538 delete (yyvsp[-1].TypeVal);
3544 #line 1314 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3545 { // Structure type?
3546 std::vector<const Type*> Elements;
3547 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3548 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3549 Elements.push_back(*I);
3551 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3552 delete (yyvsp[-1].TypeList);
3558 #line 1324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3559 { // Empty structure type?
3560 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3566 #line 1328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3568 std::vector<const Type*> Elements;
3569 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3570 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3571 Elements.push_back(*I);
3573 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3574 delete (yyvsp[-2].TypeList);
3580 #line 1338 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3581 { // Empty structure type?
3582 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3588 #line 1345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3590 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3591 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3596 #line 1352 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3598 if (!UpRefs.empty())
3599 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3600 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3601 GEN_ERROR("LLVM functions cannot return aggregate types");
3602 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3607 #line 1359 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3609 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3614 #line 1364 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3616 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3617 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3623 #line 1369 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3625 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3631 #line 1377 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3633 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3634 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3635 TWA.Ty = new PATypeHolder(Type::VoidTy);
3636 (yyval.TypeWithAttrsList)->push_back(TWA);
3642 #line 1384 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3644 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3645 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3646 TWA.Ty = new PATypeHolder(Type::VoidTy);
3647 (yyval.TypeWithAttrsList)->push_back(TWA);
3653 #line 1391 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3655 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3661 #line 1399 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3663 (yyval.TypeList) = new std::list<PATypeHolder>();
3664 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3670 #line 1404 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3672 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3678 #line 1415 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3679 { // Nonempty unsized arr
3680 if (!UpRefs.empty())
3681 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3682 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3684 GEN_ERROR("Cannot make array constant with type: '" +
3685 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3686 const Type *ETy = ATy->getElementType();
3687 int NumElements = ATy->getNumElements();
3689 // Verify that we have the correct size...
3690 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3691 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3692 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3693 itostr(NumElements) + "");
3695 // Verify all elements are correct type!
3696 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3697 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3698 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3699 ETy->getDescription() +"' as required!\nIt is of type '"+
3700 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3703 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3704 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3710 #line 1443 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3712 if (!UpRefs.empty())
3713 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3714 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3716 GEN_ERROR("Cannot make array constant with type: '" +
3717 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3719 int NumElements = ATy->getNumElements();
3720 if (NumElements != -1 && NumElements != 0)
3721 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3722 " arguments, but has size of " + itostr(NumElements) +"");
3723 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3724 delete (yyvsp[-2].TypeVal);
3730 #line 1459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3732 if (!UpRefs.empty())
3733 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3734 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3736 GEN_ERROR("Cannot make array constant with type: '" +
3737 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3739 int NumElements = ATy->getNumElements();
3740 const Type *ETy = ATy->getElementType();
3741 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3742 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3743 GEN_ERROR("Can't build string constant of size " +
3744 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3745 " when array has size " + itostr(NumElements) + "");
3746 std::vector<Constant*> Vals;
3747 if (ETy == Type::Int8Ty) {
3748 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3749 C != (unsigned char*)EndStr; ++C)
3750 Vals.push_back(ConstantInt::get(ETy, *C));
3752 free((yyvsp[0].StrVal));
3753 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3755 free((yyvsp[0].StrVal));
3756 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3757 delete (yyvsp[-2].TypeVal);
3763 #line 1488 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3764 { // Nonempty unsized arr
3765 if (!UpRefs.empty())
3766 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3767 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3769 GEN_ERROR("Cannot make packed constant with type: '" +
3770 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3771 const Type *ETy = PTy->getElementType();
3772 int NumElements = PTy->getNumElements();
3774 // Verify that we have the correct size...
3775 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3776 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3777 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3778 itostr(NumElements) + "");
3780 // Verify all elements are correct type!
3781 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3782 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3783 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3784 ETy->getDescription() +"' as required!\nIt is of type '"+
3785 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3788 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3789 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3795 #line 1516 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3797 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3799 GEN_ERROR("Cannot make struct constant with type: '" +
3800 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3802 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3803 GEN_ERROR("Illegal number of initializers for structure type");
3805 // Check to ensure that constants are compatible with the type initializer!
3806 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3807 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3808 GEN_ERROR("Expected type '" +
3809 STy->getElementType(i)->getDescription() +
3810 "' for element #" + utostr(i) +
3811 " of structure initializer");
3813 // Check to ensure that Type is not packed
3814 if (STy->isPacked())
3815 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3817 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3818 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3824 #line 1541 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3826 if (!UpRefs.empty())
3827 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3828 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3830 GEN_ERROR("Cannot make struct constant with type: '" +
3831 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3833 if (STy->getNumContainedTypes() != 0)
3834 GEN_ERROR("Illegal number of initializers for structure type");
3836 // Check to ensure that Type is not packed
3837 if (STy->isPacked())
3838 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3840 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3841 delete (yyvsp[-2].TypeVal);
3847 #line 1560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3849 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3851 GEN_ERROR("Cannot make struct constant with type: '" +
3852 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3854 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3855 GEN_ERROR("Illegal number of initializers for structure type");
3857 // Check to ensure that constants are compatible with the type initializer!
3858 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3859 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3860 GEN_ERROR("Expected type '" +
3861 STy->getElementType(i)->getDescription() +
3862 "' for element #" + utostr(i) +
3863 " of structure initializer");
3865 // Check to ensure that Type is packed
3866 if (!STy->isPacked())
3867 GEN_ERROR("Vector initializer to non-vector type '" +
3868 STy->getDescription() + "'");
3870 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3871 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3877 #line 1586 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3879 if (!UpRefs.empty())
3880 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3881 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3883 GEN_ERROR("Cannot make struct constant with type: '" +
3884 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3886 if (STy->getNumContainedTypes() != 0)
3887 GEN_ERROR("Illegal number of initializers for structure type");
3889 // Check to ensure that Type is packed
3890 if (!STy->isPacked())
3891 GEN_ERROR("Vector initializer to non-vector type '" +
3892 STy->getDescription() + "'");
3894 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3895 delete (yyvsp[-4].TypeVal);
3901 #line 1606 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3903 if (!UpRefs.empty())
3904 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3905 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3907 GEN_ERROR("Cannot make null pointer constant with type: '" +
3908 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3910 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3911 delete (yyvsp[-1].TypeVal);
3917 #line 1618 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3919 if (!UpRefs.empty())
3920 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3921 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3922 delete (yyvsp[-1].TypeVal);
3928 #line 1625 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3930 if (!UpRefs.empty())
3931 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3932 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3934 GEN_ERROR("Global const reference must be a pointer type");
3936 // ConstExprs can exist in the body of a function, thus creating
3937 // GlobalValues whenever they refer to a variable. Because we are in
3938 // the context of a function, getValNonImprovising will search the functions
3939 // symbol table instead of the module symbol table for the global symbol,
3940 // which throws things all off. To get around this, we just tell
3941 // getValNonImprovising that we are at global scope here.
3943 Function *SavedCurFn = CurFun.CurrentFunction;
3944 CurFun.CurrentFunction = 0;
3946 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3949 CurFun.CurrentFunction = SavedCurFn;
3951 // If this is an initializer for a constant pointer, which is referencing a
3952 // (currently) undefined variable, create a stub now that shall be replaced
3953 // in the future with the right type of variable.
3956 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3957 const PointerType *PT = cast<PointerType>(Ty);
3959 // First check to see if the forward references value is already created!
3960 PerModuleInfo::GlobalRefsType::iterator I =
3961 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3963 if (I != CurModule.GlobalRefs.end()) {
3964 V = I->second; // Placeholder already exists, use it...
3965 (yyvsp[0].ValIDVal).destroy();
3968 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
3969 Name = (yyvsp[0].ValIDVal).Name;
3970 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
3971 GEN_ERROR("Invalid reference to global");
3973 // Create the forward referenced global.
3975 if (const FunctionType *FTy =
3976 dyn_cast<FunctionType>(PT->getElementType())) {
3977 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3978 CurModule.CurrentModule);
3980 GV = new GlobalVariable(PT->getElementType(), false,
3981 GlobalValue::ExternalLinkage, 0,
3982 Name, CurModule.CurrentModule);
3985 // Keep track of the fact that we have a forward ref to recycle it
3986 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3991 (yyval.ConstVal) = cast<GlobalValue>(V);
3992 delete (yyvsp[-1].TypeVal); // Free the type handle
3998 #line 1691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4000 if (!UpRefs.empty())
4001 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4002 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4003 GEN_ERROR("Mismatched types for constant expression: " +
4004 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4005 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4006 delete (yyvsp[-1].TypeVal);
4012 #line 1701 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4014 if (!UpRefs.empty())
4015 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4016 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4017 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4018 GEN_ERROR("Cannot create a null initialized value of this type");
4019 (yyval.ConstVal) = Constant::getNullValue(Ty);
4020 delete (yyvsp[-1].TypeVal);
4026 #line 1711 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4027 { // integral constants
4028 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4029 GEN_ERROR("Constant value doesn't fit in type");
4030 APInt Val(64, (yyvsp[0].SInt64Val));
4031 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4032 Val.sextOrTrunc(BitWidth);
4033 (yyval.ConstVal) = ConstantInt::get(Val);
4039 #line 1720 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4040 { // arbitrary precision integer constants
4041 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4042 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4043 GEN_ERROR("Constant value does not fit in type");
4045 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4046 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4047 delete (yyvsp[0].APIntVal);
4053 #line 1730 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4054 { // integral constants
4055 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4056 GEN_ERROR("Constant value doesn't fit in type");
4057 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4058 APInt Val(BitWidth, (yyvsp[0].UInt64Val));
4059 (yyval.ConstVal) = ConstantInt::get(Val);
4065 #line 1738 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4066 { // arbitrary precision integer constants
4067 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4068 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4069 GEN_ERROR("Constant value does not fit in type");
4071 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4072 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4073 delete (yyvsp[0].APIntVal);
4079 #line 1748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4080 { // Boolean constants
4081 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4082 (yyval.ConstVal) = ConstantInt::getTrue();
4088 #line 1753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4089 { // Boolean constants
4090 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4091 (yyval.ConstVal) = ConstantInt::getFalse();
4097 #line 1758 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4098 { // Float & Double constants
4099 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4100 GEN_ERROR("Floating point constant invalid for type");
4101 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4107 #line 1766 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4109 if (!UpRefs.empty())
4110 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4111 Constant *Val = (yyvsp[-3].ConstVal);
4112 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4113 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4114 GEN_ERROR("invalid cast opcode for cast from '" +
4115 Val->getType()->getDescription() + "' to '" +
4116 DestTy->getDescription() + "'");
4117 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4118 delete (yyvsp[-1].TypeVal);
4123 #line 1778 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4125 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4126 GEN_ERROR("GetElementPtr requires a pointer operand");
4129 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4132 GEN_ERROR("Index list invalid for constant getelementptr");
4134 SmallVector<Constant*, 8> IdxVec;
4135 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4136 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4137 IdxVec.push_back(C);
4139 GEN_ERROR("Indices to constant getelementptr must be constants");
4141 delete (yyvsp[-1].ValueList);
4143 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4149 #line 1800 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4151 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4152 GEN_ERROR("Select condition must be of boolean type");
4153 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4154 GEN_ERROR("Select operand types must match");
4155 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4161 #line 1808 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4163 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4164 GEN_ERROR("Binary operator types must match");
4166 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4171 #line 1814 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4173 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4174 GEN_ERROR("Logical operator types must match");
4175 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4176 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4177 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4178 GEN_ERROR("Logical operator requires integral operands");
4180 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4186 #line 1825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4188 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4189 GEN_ERROR("icmp operand types must match");
4190 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4195 #line 1830 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4197 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4198 GEN_ERROR("fcmp operand types must match");
4199 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4204 #line 1835 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4206 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4207 GEN_ERROR("Invalid extractelement operands");
4208 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4214 #line 1841 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4216 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4217 GEN_ERROR("Invalid insertelement operands");
4218 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4224 #line 1847 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4226 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4227 GEN_ERROR("Invalid shufflevector operands");
4228 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4234 #line 1856 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4236 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4242 #line 1860 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4244 (yyval.ConstVector) = new std::vector<Constant*>();
4245 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4251 #line 1868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4252 { (yyval.BoolVal) = false; ;}
4256 #line 1868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4257 { (yyval.BoolVal) = true; ;}
4261 #line 1879 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4263 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4264 CurModule.ModuleDone();
4270 #line 1884 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4272 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4273 CurModule.ModuleDone();
4279 #line 1897 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4280 { CurFun.isDeclare = false; ;}
4284 #line 1897 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4286 CurFun.FunctionDone();
4292 #line 1901 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4293 { CurFun.isDeclare = true; ;}
4297 #line 1901 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4304 #line 1904 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4311 #line 1907 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4313 // Emit an error if there are any unresolved types left.
4314 if (!CurModule.LateResolveTypes.empty()) {
4315 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4316 if (DID.Type == ValID::LocalName) {
4317 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4319 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4327 #line 1919 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4329 if (!UpRefs.empty())
4330 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4331 // Eagerly resolve types. This is not an optimization, this is a
4332 // requirement that is due to the fact that we could have this:
4334 // %list = type { %list * }
4335 // %list = type { %list * } ; repeated type decl
4337 // If types are not resolved eagerly, then the two types will not be
4338 // determined to be the same type!
4340 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4342 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4344 // If this is a named type that is not a redefinition, add it to the slot
4346 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4349 delete (yyvsp[0].TypeVal);
4355 #line 1943 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4357 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4359 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4361 // If this is a named type that is not a redefinition, add it to the slot
4363 CurModule.Types.push_back((yyvsp[0].PrimType));
4370 #line 1954 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4372 /* "Externally Visible" Linkage */
4373 if ((yyvsp[0].ConstVal) == 0)
4374 GEN_ERROR("Global value initializer is not a constant");
4375 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4376 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4382 #line 1961 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4389 #line 1964 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4391 if ((yyvsp[0].ConstVal) == 0)
4392 GEN_ERROR("Global value initializer is not a constant");
4393 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4399 #line 1969 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4406 #line 1972 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4408 if (!UpRefs.empty())
4409 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4410 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4412 delete (yyvsp[0].TypeVal);
4417 #line 1978 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4425 #line 1982 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4432 #line 1985 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4439 #line 1991 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4441 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4442 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4443 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4444 free((yyvsp[0].StrVal));
4446 if (AsmSoFar.empty())
4447 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4449 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4455 #line 2004 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4457 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4458 free((yyvsp[0].StrVal));
4463 #line 2008 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4465 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4466 free((yyvsp[0].StrVal));
4471 #line 2015 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4473 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4474 free((yyvsp[0].StrVal));
4480 #line 2020 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4482 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4483 free((yyvsp[0].StrVal));
4489 #line 2025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4496 #line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4498 if (!UpRefs.empty())
4499 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4500 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4501 GEN_ERROR("void typed arguments are invalid");
4502 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4503 (yyval.ArgList) = (yyvsp[-4].ArgList);
4504 (yyvsp[-4].ArgList)->push_back(E);
4510 #line 2044 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4512 if (!UpRefs.empty())
4513 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4514 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4515 GEN_ERROR("void typed arguments are invalid");
4516 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4517 (yyval.ArgList) = new ArgListType;
4518 (yyval.ArgList)->push_back(E);
4524 #line 2055 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4526 (yyval.ArgList) = (yyvsp[0].ArgList);
4532 #line 2059 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4534 (yyval.ArgList) = (yyvsp[-2].ArgList);
4535 struct ArgListEntry E;
4536 E.Ty = new PATypeHolder(Type::VoidTy);
4538 E.Attrs = FunctionType::NoAttributeSet;
4539 (yyval.ArgList)->push_back(E);
4545 #line 2068 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4547 (yyval.ArgList) = new ArgListType;
4548 struct ArgListEntry E;
4549 E.Ty = new PATypeHolder(Type::VoidTy);
4551 E.Attrs = FunctionType::NoAttributeSet;
4552 (yyval.ArgList)->push_back(E);
4558 #line 2077 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4560 (yyval.ArgList) = 0;
4566 #line 2083 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4568 UnEscapeLexed((yyvsp[-6].StrVal));
4569 std::string FunctionName((yyvsp[-6].StrVal));
4570 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4572 // Check the function result for abstractness if this is a define. We should
4573 // have no abstract types at this point
4574 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4575 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4577 std::vector<const Type*> ParamTypeList;
4578 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4579 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4580 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4581 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4582 const Type* Ty = I->Ty->get();
4583 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4584 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4585 ParamTypeList.push_back(Ty);
4586 if (Ty != Type::VoidTy)
4587 ParamAttrs.push_back(I->Attrs);
4591 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4592 if (isVarArg) ParamTypeList.pop_back();
4594 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4596 const PointerType *PFT = PointerType::get(FT);
4597 delete (yyvsp[-7].TypeVal);
4600 if (!FunctionName.empty()) {
4601 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4603 ID = ValID::createGlobalID(CurModule.Values[PFT].size());
4607 // See if this function was forward referenced. If so, recycle the object.
4608 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4609 // Move the function to the end of the list, from whereever it was
4610 // previously inserted.
4611 Fn = cast<Function>(FWRef);
4612 CurModule.CurrentModule->getFunctionList().remove(Fn);
4613 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4614 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4615 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4616 if (Fn->getFunctionType() != FT ) {
4617 // The existing function doesn't have the same type. This is an overload
4619 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4620 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4621 // Neither the existing or the current function is a declaration and they
4622 // have the same name and same type. Clearly this is a redefinition.
4623 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4624 } if (Fn->isDeclaration()) {
4625 // Make sure to strip off any argument names so we can't get conflicts.
4626 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4630 } else { // Not already defined?
4631 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4632 CurModule.CurrentModule);
4634 InsertValue(Fn, CurModule.Values);
4637 CurFun.FunctionStart(Fn);
4639 if (CurFun.isDeclare) {
4640 // If we have declaration, always overwrite linkage. This will allow us to
4641 // correctly handle cases, when pointer to function is passed as argument to
4642 // another function.
4643 Fn->setLinkage(CurFun.Linkage);
4644 Fn->setVisibility(CurFun.Visibility);
4646 Fn->setCallingConv((yyvsp[-8].UIntVal));
4647 Fn->setAlignment((yyvsp[0].UIntVal));
4648 if ((yyvsp[-1].StrVal)) {
4649 Fn->setSection((yyvsp[-1].StrVal));
4650 free((yyvsp[-1].StrVal));
4653 // Add all of the arguments we parsed to the function...
4654 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4655 if (isVarArg) { // Nuke the last entry
4656 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4657 "Not a varargs marker!");
4658 delete (yyvsp[-4].ArgList)->back().Ty;
4659 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4661 Function::arg_iterator ArgIt = Fn->arg_begin();
4662 Function::arg_iterator ArgEnd = Fn->arg_end();
4664 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4665 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4666 delete I->Ty; // Delete the typeholder...
4667 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4673 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4680 #line 2196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4682 (yyval.FunctionVal) = CurFun.CurrentFunction;
4684 // Make sure that we keep track of the linkage type even if there was a
4685 // previous "declare".
4686 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4687 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4692 #line 2207 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4694 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4700 #line 2212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4702 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4703 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4704 (yyval.FunctionVal) = CurFun.CurrentFunction;
4705 CurFun.FunctionDone();
4711 #line 2224 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4713 (yyval.BoolVal) = false;
4719 #line 2228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4721 (yyval.BoolVal) = true;
4727 #line 2233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4728 { // A reference to a direct constant
4729 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4735 #line 2237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4737 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4743 #line 2241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4744 { // Perhaps it's an FP constant?
4745 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4751 #line 2245 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4753 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4759 #line 2249 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4761 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4767 #line 2253 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4769 (yyval.ValIDVal) = ValID::createNull();
4775 #line 2257 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4777 (yyval.ValIDVal) = ValID::createUndef();
4783 #line 2261 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4784 { // A vector zero constant.
4785 (yyval.ValIDVal) = ValID::createZeroInit();
4791 #line 2265 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4792 { // Nonempty unsized packed vector
4793 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4794 int NumElements = (yyvsp[-1].ConstVector)->size();
4796 VectorType* pt = VectorType::get(ETy, NumElements);
4797 PATypeHolder* PTy = new PATypeHolder(
4805 // Verify all elements are correct type!
4806 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4807 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4808 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4809 ETy->getDescription() +"' as required!\nIt is of type '" +
4810 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4813 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
4814 delete PTy; delete (yyvsp[-1].ConstVector);
4820 #line 2290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4822 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4828 #line 2294 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4830 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4831 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4832 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4833 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4834 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4835 free((yyvsp[-2].StrVal));
4836 free((yyvsp[0].StrVal));
4842 #line 2308 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4843 { // Is it an integer reference...?
4844 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4850 #line 2312 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4852 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4858 #line 2316 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4859 { // Is it a named reference...?
4860 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4866 #line 2320 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4867 { // Is it a named reference...?
4868 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4874 #line 2332 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4876 if (!UpRefs.empty())
4877 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4878 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4879 delete (yyvsp[-1].TypeVal);
4885 #line 2341 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4887 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4893 #line 2345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4894 { // Do not allow functions with 0 basic blocks
4895 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4901 #line 2354 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4903 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4905 InsertValue((yyvsp[0].TermInstVal));
4906 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4907 InsertValue((yyvsp[-2].BasicBlockVal));
4908 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4914 #line 2364 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4916 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4917 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4918 if (CI2->getParent() == 0)
4919 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4920 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4921 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4927 #line 2373 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4929 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
4932 // Make sure to move the basic block to the correct location in the
4933 // function, instead of leaving it inserted wherever it was first
4935 Function::BasicBlockListType &BBL =
4936 CurFun.CurrentFunction->getBasicBlockList();
4937 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4943 #line 2385 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4945 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true);
4948 // Make sure to move the basic block to the correct location in the
4949 // function, instead of leaving it inserted wherever it was first
4951 Function::BasicBlockListType &BBL =
4952 CurFun.CurrentFunction->getBasicBlockList();
4953 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4959 #line 2398 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4960 { // Return with a result...
4961 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4967 #line 2402 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4968 { // Return with no result...
4969 (yyval.TermInstVal) = new ReturnInst();
4975 #line 2406 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4976 { // Unconditional Branch...
4977 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4979 (yyval.TermInstVal) = new BranchInst(tmpBB);
4984 #line 2411 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4986 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
4987 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4989 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4991 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
4993 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4998 #line 2421 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5000 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5002 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5004 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5005 (yyval.TermInstVal) = S;
5007 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5008 E = (yyvsp[-1].JumpTable)->end();
5009 for (; I != E; ++I) {
5010 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5011 S->addCase(CI, I->second);
5013 GEN_ERROR("Switch case is constant, but not a simple integer");
5015 delete (yyvsp[-1].JumpTable);
5021 #line 2440 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5023 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5025 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5027 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5028 (yyval.TermInstVal) = S;
5034 #line 2450 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5037 // Handle the short syntax
5038 const PointerType *PFTy = 0;
5039 const FunctionType *Ty = 0;
5040 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5041 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5042 // Pull out the types of all of the arguments...
5043 std::vector<const Type*> ParamTypes;
5044 FunctionType::ParamAttrsList ParamAttrs;
5045 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5046 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
5047 const Type *Ty = I->Val->getType();
5048 if (Ty == Type::VoidTy)
5049 GEN_ERROR("Short call syntax cannot be used with varargs");
5050 ParamTypes.push_back(Ty);
5051 ParamAttrs.push_back(I->Attrs);
5054 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5055 PFTy = PointerType::get(Ty);
5058 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5060 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5062 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5065 // Check the arguments
5067 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5068 // Make sure no arguments is a good thing!
5069 if (Ty->getNumParams() != 0)
5070 GEN_ERROR("No arguments passed to a function that "
5071 "expects arguments");
5072 } else { // Has arguments?
5073 // Loop through FunctionType's arguments and ensure they are specified
5075 FunctionType::param_iterator I = Ty->param_begin();
5076 FunctionType::param_iterator E = Ty->param_end();
5077 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5079 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5080 if (ArgI->Val->getType() != *I)
5081 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5082 (*I)->getDescription() + "'");
5083 Args.push_back(ArgI->Val);
5086 if (Ty->isVarArg()) {
5088 for (; ArgI != ArgE; ++ArgI)
5089 Args.push_back(ArgI->Val); // push the remaining varargs
5090 } else if (I != E || ArgI != ArgE)
5091 GEN_ERROR("Invalid number of parameters detected");
5094 // Create the InvokeInst
5095 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5096 II->setCallingConv((yyvsp[-12].UIntVal));
5097 (yyval.TermInstVal) = II;
5098 delete (yyvsp[-8].ValueRefList);
5104 #line 2516 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5106 (yyval.TermInstVal) = new UnwindInst();
5112 #line 2520 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5114 (yyval.TermInstVal) = new UnreachableInst();
5120 #line 2527 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5122 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5123 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5126 GEN_ERROR("May only switch on a constant pool value");
5128 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5130 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5135 #line 2538 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5137 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5138 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5142 GEN_ERROR("May only switch on a constant pool value");
5144 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5146 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5151 #line 2551 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5153 // Is this definition named?? if so, assign the name...
5154 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5156 InsertValue((yyvsp[0].InstVal));
5157 (yyval.InstVal) = (yyvsp[0].InstVal);
5163 #line 2561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5164 { // Used for PHI nodes
5165 if (!UpRefs.empty())
5166 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5167 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5168 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5170 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5172 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5173 delete (yyvsp[-5].TypeVal);
5178 #line 2572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5180 (yyval.PHIList) = (yyvsp[-6].PHIList);
5181 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5183 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5185 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5190 #line 2582 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5192 if (!UpRefs.empty())
5193 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5194 // Used for call and invoke instructions
5195 (yyval.ValueRefList) = new ValueRefList();
5196 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5197 (yyval.ValueRefList)->push_back(E);
5202 #line 2590 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5204 if (!UpRefs.empty())
5205 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5206 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5207 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5208 (yyval.ValueRefList)->push_back(E);
5214 #line 2598 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5215 { (yyval.ValueRefList) = new ValueRefList(); ;}
5219 #line 2601 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5220 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5224 #line 2602 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5226 (yyval.ValueList) = (yyvsp[-2].ValueList);
5227 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5233 #line 2609 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5235 (yyval.BoolVal) = true;
5241 #line 2613 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5243 (yyval.BoolVal) = false;
5249 #line 2618 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5251 if (!UpRefs.empty())
5252 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5253 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5254 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5256 "Arithmetic operator requires integer, FP, or packed operands");
5257 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5258 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5259 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5260 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5261 GEN_ERROR("Remainder not supported on vector types");
5262 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5264 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5266 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5267 if ((yyval.InstVal) == 0)
5268 GEN_ERROR("binary operator returned null");
5269 delete (yyvsp[-3].TypeVal);
5274 #line 2639 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5276 if (!UpRefs.empty())
5277 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5278 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5279 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5280 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5281 GEN_ERROR("Logical operator requires integral operands");
5283 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5285 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5287 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5288 if ((yyval.InstVal) == 0)
5289 GEN_ERROR("binary operator returned null");
5290 delete (yyvsp[-3].TypeVal);
5295 #line 2656 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5297 if (!UpRefs.empty())
5298 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5299 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5300 GEN_ERROR("Vector types not supported by icmp instruction");
5301 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5303 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5305 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5306 if ((yyval.InstVal) == 0)
5307 GEN_ERROR("icmp operator returned null");
5312 #line 2669 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5314 if (!UpRefs.empty())
5315 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5316 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5317 GEN_ERROR("Vector types not supported by fcmp instruction");
5318 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5320 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5322 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5323 if ((yyval.InstVal) == 0)
5324 GEN_ERROR("fcmp operator returned null");
5329 #line 2682 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5331 if (!UpRefs.empty())
5332 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5333 Value* Val = (yyvsp[-2].ValueVal);
5334 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5335 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5336 GEN_ERROR("invalid cast opcode for cast from '" +
5337 Val->getType()->getDescription() + "' to '" +
5338 DestTy->getDescription() + "'");
5339 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5340 delete (yyvsp[0].TypeVal);
5345 #line 2694 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5347 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5348 GEN_ERROR("select condition must be boolean");
5349 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5350 GEN_ERROR("select value types should match");
5351 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5357 #line 2702 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5359 if (!UpRefs.empty())
5360 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5361 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5362 delete (yyvsp[0].TypeVal);
5368 #line 2709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5370 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5371 GEN_ERROR("Invalid extractelement operands");
5372 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5378 #line 2715 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5380 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5381 GEN_ERROR("Invalid insertelement operands");
5382 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5388 #line 2721 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5390 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5391 GEN_ERROR("Invalid shufflevector operands");
5392 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5398 #line 2727 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5400 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5401 if (!Ty->isFirstClassType())
5402 GEN_ERROR("PHI node operands must be of first class type");
5403 (yyval.InstVal) = new PHINode(Ty);
5404 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5405 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5406 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5407 GEN_ERROR("All elements of a PHI node must be of the same type");
5408 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5409 (yyvsp[0].PHIList)->pop_front();
5411 delete (yyvsp[0].PHIList); // Free the list...
5417 #line 2743 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5420 // Handle the short syntax
5421 const PointerType *PFTy = 0;
5422 const FunctionType *Ty = 0;
5423 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5424 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5425 // Pull out the types of all of the arguments...
5426 std::vector<const Type*> ParamTypes;
5427 FunctionType::ParamAttrsList ParamAttrs;
5428 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5429 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5430 const Type *Ty = I->Val->getType();
5431 if (Ty == Type::VoidTy)
5432 GEN_ERROR("Short call syntax cannot be used with varargs");
5433 ParamTypes.push_back(Ty);
5434 ParamAttrs.push_back(I->Attrs);
5437 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5438 PFTy = PointerType::get(Ty);
5441 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5444 // Check the arguments
5446 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5447 // Make sure no arguments is a good thing!
5448 if (Ty->getNumParams() != 0)
5449 GEN_ERROR("No arguments passed to a function that "
5450 "expects arguments");
5451 } else { // Has arguments?
5452 // Loop through FunctionType's arguments and ensure they are specified
5455 FunctionType::param_iterator I = Ty->param_begin();
5456 FunctionType::param_iterator E = Ty->param_end();
5457 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5459 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5460 if (ArgI->Val->getType() != *I)
5461 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5462 (*I)->getDescription() + "'");
5463 Args.push_back(ArgI->Val);
5465 if (Ty->isVarArg()) {
5467 for (; ArgI != ArgE; ++ArgI)
5468 Args.push_back(ArgI->Val); // push the remaining varargs
5469 } else if (I != E || ArgI != ArgE)
5470 GEN_ERROR("Invalid number of parameters detected");
5472 // Create the call node
5473 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5474 CI->setTailCall((yyvsp[-7].BoolVal));
5475 CI->setCallingConv((yyvsp[-6].UIntVal));
5476 (yyval.InstVal) = CI;
5477 delete (yyvsp[-2].ValueRefList);
5478 delete (yyvsp[-5].TypeVal);
5484 #line 2806 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5486 (yyval.InstVal) = (yyvsp[0].InstVal);
5492 #line 2811 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5494 (yyval.BoolVal) = true;
5500 #line 2815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5502 (yyval.BoolVal) = false;
5508 #line 2822 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5510 if (!UpRefs.empty())
5511 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5512 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5513 delete (yyvsp[-1].TypeVal);
5519 #line 2829 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5521 if (!UpRefs.empty())
5522 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5523 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5525 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5526 delete (yyvsp[-4].TypeVal);
5531 #line 2837 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5533 if (!UpRefs.empty())
5534 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5535 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5536 delete (yyvsp[-1].TypeVal);
5542 #line 2844 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5544 if (!UpRefs.empty())
5545 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5546 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5548 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5549 delete (yyvsp[-4].TypeVal);
5554 #line 2852 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5556 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5557 GEN_ERROR("Trying to free nonpointer type " +
5558 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5559 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5565 #line 2860 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5567 if (!UpRefs.empty())
5568 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5569 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5570 GEN_ERROR("Can't load from nonpointer type: " +
5571 (*(yyvsp[-1].TypeVal))->getDescription());
5572 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5573 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5574 (*(yyvsp[-1].TypeVal))->getDescription());
5575 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5577 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5578 delete (yyvsp[-1].TypeVal);
5583 #line 2874 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5585 if (!UpRefs.empty())
5586 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5587 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5589 GEN_ERROR("Can't store to a nonpointer type: " +
5590 (*(yyvsp[-1].TypeVal))->getDescription());
5591 const Type *ElTy = PT->getElementType();
5592 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5593 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5594 "' into space of type '" + ElTy->getDescription() + "'");
5596 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5598 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5599 delete (yyvsp[-1].TypeVal);
5604 #line 2891 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5606 if (!UpRefs.empty())
5607 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5608 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5609 GEN_ERROR("getelementptr insn requires pointer operand");
5611 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5612 GEN_ERROR("Invalid getelementptr indices for type '" +
5613 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5614 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5616 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5617 delete (yyvsp[-2].TypeVal);
5618 delete (yyvsp[0].ValueList);
5626 /* Line 1126 of yacc.c. */
5627 #line 5628 "llvmAsmParser.tab.c"
5633 YY_STACK_PRINT (yyss, yyssp);
5638 /* Now `shift' the result of the reduction. Determine what state
5639 that goes to, based on the state we popped back to and the rule
5640 number reduced by. */
5644 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5645 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5646 yystate = yytable[yystate];
5648 yystate = yydefgoto[yyn - YYNTOKENS];
5653 /*------------------------------------.
5654 | yyerrlab -- here on detecting error |
5655 `------------------------------------*/
5657 /* If not already recovering from an error, report this error. */
5662 yyn = yypact[yystate];
5664 if (YYPACT_NINF < yyn && yyn < YYLAST)
5666 int yytype = YYTRANSLATE (yychar);
5667 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5668 YYSIZE_T yysize = yysize0;
5670 int yysize_overflow = 0;
5672 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5673 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5677 /* This is so xgettext sees the translatable formats that are
5678 constructed on the fly. */
5679 YY_("syntax error, unexpected %s");
5680 YY_("syntax error, unexpected %s, expecting %s");
5681 YY_("syntax error, unexpected %s, expecting %s or %s");
5682 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5683 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5687 static char const yyunexpected[] = "syntax error, unexpected %s";
5688 static char const yyexpecting[] = ", expecting %s";
5689 static char const yyor[] = " or %s";
5690 char yyformat[sizeof yyunexpected
5691 + sizeof yyexpecting - 1
5692 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5693 * (sizeof yyor - 1))];
5694 char const *yyprefix = yyexpecting;
5696 /* Start YYX at -YYN if negative to avoid negative indexes in
5698 int yyxbegin = yyn < 0 ? -yyn : 0;
5700 /* Stay within bounds of both yycheck and yytname. */
5701 int yychecklim = YYLAST - yyn;
5702 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5705 yyarg[0] = yytname[yytype];
5706 yyfmt = yystpcpy (yyformat, yyunexpected);
5708 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5709 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5711 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5715 yyformat[sizeof yyunexpected - 1] = '\0';
5718 yyarg[yycount++] = yytname[yyx];
5719 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5720 yysize_overflow |= yysize1 < yysize;
5722 yyfmt = yystpcpy (yyfmt, yyprefix);
5726 yyf = YY_(yyformat);
5727 yysize1 = yysize + yystrlen (yyf);
5728 yysize_overflow |= yysize1 < yysize;
5731 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5732 yymsg = (char *) YYSTACK_ALLOC (yysize);
5735 /* Avoid sprintf, as that infringes on the user's name space.
5736 Don't have undefined behavior even if the translation
5737 produced a string with the wrong number of "%s"s. */
5740 while ((*yyp = *yyf))
5742 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5744 yyp += yytnamerr (yyp, yyarg[yyi++]);
5754 YYSTACK_FREE (yymsg);
5758 yyerror (YY_("syntax error"));
5759 goto yyexhaustedlab;
5763 #endif /* YYERROR_VERBOSE */
5764 yyerror (YY_("syntax error"));
5769 if (yyerrstatus == 3)
5771 /* If just tried and failed to reuse look-ahead token after an
5772 error, discard it. */
5774 if (yychar <= YYEOF)
5776 /* Return failure if at end of input. */
5777 if (yychar == YYEOF)
5782 yydestruct ("Error: discarding", yytoken, &yylval);
5787 /* Else will try to reuse look-ahead token after shifting the error
5792 /*---------------------------------------------------.
5793 | yyerrorlab -- error raised explicitly by YYERROR. |
5794 `---------------------------------------------------*/
5797 /* Pacify compilers like GCC when the user code never invokes
5798 YYERROR and the label yyerrorlab therefore never appears in user
5809 /*-------------------------------------------------------------.
5810 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5811 `-------------------------------------------------------------*/
5813 yyerrstatus = 3; /* Each real token shifted decrements this. */
5817 yyn = yypact[yystate];
5818 if (yyn != YYPACT_NINF)
5821 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5829 /* Pop the current state because it cannot handle the error token. */
5834 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5837 YY_STACK_PRINT (yyss, yyssp);
5846 /* Shift the error token. */
5847 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5853 /*-------------------------------------.
5854 | yyacceptlab -- YYACCEPT comes here. |
5855 `-------------------------------------*/
5860 /*-----------------------------------.
5861 | yyabortlab -- YYABORT comes here. |
5862 `-----------------------------------*/
5868 /*-------------------------------------------------.
5869 | yyexhaustedlab -- memory exhaustion comes here. |
5870 `-------------------------------------------------*/
5872 yyerror (YY_("memory exhausted"));
5878 if (yychar != YYEOF && yychar != YYEMPTY)
5879 yydestruct ("Cleanup: discarding lookahead",
5881 while (yyssp != yyss)
5883 yydestruct ("Cleanup: popping",
5884 yystos[*yyssp], yyvsp);
5889 YYSTACK_FREE (yyss);
5895 #line 2908 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5898 // common code from the two 'RunVMAsmParser' functions
5899 static Module* RunParser(Module * M) {
5901 llvmAsmlineno = 1; // Reset the current line number...
5902 CurModule.CurrentModule = M;
5907 // Check to make sure the parser succeeded
5910 delete ParserResult;
5914 // Check to make sure that parsing produced a result
5918 // Reset ParserResult variable while saving its value for the result.
5919 Module *Result = ParserResult;
5925 void llvm::GenerateError(const std::string &message, int LineNo) {
5926 if (LineNo == -1) LineNo = llvmAsmlineno;
5927 // TODO: column number in exception
5929 TheParseError->setError(CurFilename, message, LineNo);
5933 int yyerror(const char *ErrorMsg) {
5935 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5936 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5937 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5938 if (yychar != YYEMPTY && yychar != 0)
5939 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5941 GenerateError(errMsg);