1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
82 ATSTRINGCONSTANT = 273,
84 ZEROINITIALIZER = 275,
121 X86_STDCALLCC_TOK = 312,
122 X86_FASTCALLCC_TOK = 313,
188 EXTRACTELEMENT = 379,
199 #define ESINT64VAL 258
200 #define EUINT64VAL 259
201 #define LOCALVAL_ID 260
202 #define GLOBALVAL_ID 261
211 #define GLOBALVAR 270
213 #define STRINGCONSTANT 272
214 #define ATSTRINGCONSTANT 273
215 #define IMPLEMENTATION 274
216 #define ZEROINITIALIZER 275
228 #define DOTDOTDOT 287
234 #define APPENDING 293
235 #define DLLIMPORT 294
236 #define DLLEXPORT 295
237 #define EXTERN_WEAK 296
248 #define SIDEEFFECT 307
251 #define FASTCC_TOK 310
252 #define COLDCC_TOK 311
253 #define X86_STDCALLCC_TOK 312
254 #define X86_FASTCALLCC_TOK 313
255 #define DATALAYOUT 314
261 #define UNREACHABLE 320
304 #define GETELEMENTPTR 363
320 #define EXTRACTELEMENT 379
321 #define INSERTELEMENT 380
322 #define SHUFFLEVECTOR 381
332 /* Copy the first part of user declarations. */
333 #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
335 #include "ParserInternals.h"
336 #include "llvm/CallingConv.h"
337 #include "llvm/InlineAsm.h"
338 #include "llvm/Instructions.h"
339 #include "llvm/Module.h"
340 #include "llvm/SymbolTable.h"
341 #include "llvm/Support/GetElementPtrTypeIterator.h"
342 #include "llvm/Support/CommandLine.h"
343 #include "llvm/ADT/SmallVector.h"
344 #include "llvm/ADT/STLExtras.h"
345 #include "llvm/Support/MathExtras.h"
346 #include "llvm/Support/Streams.h"
354 // The following is a gross hack. In order to rid the libAsmParser library of
355 // exceptions, we have to have a way of getting the yyparse function to go into
356 // an error situation. So, whenever we want an error to occur, the GenerateError
357 // function (see bottom of file) sets TriggerError. Then, at the end of each
358 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
359 // (a goto) to put YACC in error state. Furthermore, several calls to
360 // GenerateError are made from inside productions and they must simulate the
361 // previous exception behavior by exiting the production immediately. We have
362 // replaced these with the GEN_ERROR macro which calls GeneratError and then
363 // immediately invokes YYERROR. This would be so much cleaner if it was a
364 // recursive descent parser.
365 static bool TriggerError = false;
366 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
367 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
369 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
370 int yylex(); // declaration" of xxx warnings.
374 std::string CurFilename;
377 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
378 cl::Hidden, cl::init(false));
381 using namespace llvm;
383 static Module *ParserResult;
385 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
386 // relating to upreferences in the input stream.
388 //#define DEBUG_UPREFS 1
390 #define UR_OUT(X) cerr << X
395 #define YYERROR_VERBOSE 1
397 static GlobalVariable *CurGV;
400 // This contains info used when building the body of a function. It is
401 // destroyed when the function is completed.
403 typedef std::vector<Value *> ValueList; // Numbered defs
406 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
407 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
409 static struct PerModuleInfo {
410 Module *CurrentModule;
411 std::map<const Type *, ValueList> Values; // Module level numbered definitions
412 std::map<const Type *,ValueList> LateResolveValues;
413 std::vector<PATypeHolder> Types;
414 std::map<ValID, PATypeHolder> LateResolveTypes;
416 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
417 /// how they were referenced and on which line of the input they came from so
418 /// that we can resolve them later and print error messages as appropriate.
419 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
421 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
422 // references to global values. Global values may be referenced before they
423 // are defined, and if so, the temporary object that they represent is held
424 // here. This is used for forward references of GlobalValues.
426 typedef std::map<std::pair<const PointerType *,
427 ValID>, GlobalValue*> GlobalRefsType;
428 GlobalRefsType GlobalRefs;
431 // If we could not resolve some functions at function compilation time
432 // (calls to functions before they are defined), resolve them now... Types
433 // are resolved when the constant pool has been completely parsed.
435 ResolveDefinitions(LateResolveValues);
439 // Check to make sure that all global value forward references have been
442 if (!GlobalRefs.empty()) {
443 std::string UndefinedReferences = "Unresolved global references exist:\n";
445 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
447 UndefinedReferences += " " + I->first.first->getDescription() + " " +
448 I->first.second.getName() + "\n";
450 GenerateError(UndefinedReferences);
454 Values.clear(); // Clear out function local definitions
459 // GetForwardRefForGlobal - Check to see if there is a forward reference
460 // for this global. If so, remove it from the GlobalRefs map and return it.
461 // If not, just return null.
462 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
463 // Check to see if there is a forward reference to this global variable...
464 // if there is, eliminate it and patch the reference to use the new def'n.
465 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
466 GlobalValue *Ret = 0;
467 if (I != GlobalRefs.end()) {
474 bool TypeIsUnresolved(PATypeHolder* PATy) {
475 // If it isn't abstract, its resolved
476 const Type* Ty = PATy->get();
477 if (!Ty->isAbstract())
479 // Traverse the type looking for abstract types. If it isn't abstract then
480 // we don't need to traverse that leg of the type.
481 std::vector<const Type*> WorkList, SeenList;
482 WorkList.push_back(Ty);
483 while (!WorkList.empty()) {
484 const Type* Ty = WorkList.back();
485 SeenList.push_back(Ty);
487 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
488 // Check to see if this is an unresolved type
489 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
490 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
491 for ( ; I != E; ++I) {
492 if (I->second.get() == OpTy)
495 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
496 const Type* TheTy = SeqTy->getElementType();
497 if (TheTy->isAbstract() && TheTy != Ty) {
498 std::vector<const Type*>::iterator I = SeenList.begin(),
504 WorkList.push_back(TheTy);
506 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
507 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
508 const Type* TheTy = StrTy->getElementType(i);
509 if (TheTy->isAbstract() && TheTy != Ty) {
510 std::vector<const Type*>::iterator I = SeenList.begin(),
516 WorkList.push_back(TheTy);
527 static struct PerFunctionInfo {
528 Function *CurrentFunction; // Pointer to current function being created
530 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
531 std::map<const Type*, ValueList> LateResolveValues;
532 bool isDeclare; // Is this function a forward declararation?
533 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
534 GlobalValue::VisibilityTypes Visibility;
536 /// BBForwardRefs - When we see forward references to basic blocks, keep
537 /// track of them here.
538 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
539 std::vector<BasicBlock*> NumberedBlocks;
542 inline PerFunctionInfo() {
545 Linkage = GlobalValue::ExternalLinkage;
546 Visibility = GlobalValue::DefaultVisibility;
549 inline void FunctionStart(Function *M) {
554 void FunctionDone() {
555 NumberedBlocks.clear();
557 // Any forward referenced blocks left?
558 if (!BBForwardRefs.empty()) {
559 GenerateError("Undefined reference to label " +
560 BBForwardRefs.begin()->first->getName());
564 // Resolve all forward references now.
565 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
567 Values.clear(); // Clear out function local definitions
570 Linkage = GlobalValue::ExternalLinkage;
571 Visibility = GlobalValue::DefaultVisibility;
573 } CurFun; // Info for the current function...
575 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
578 //===----------------------------------------------------------------------===//
579 // Code to handle definitions of all the types
580 //===----------------------------------------------------------------------===//
582 static int InsertValue(Value *V,
583 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
584 if (V->hasName()) return -1; // Is this a numbered definition?
586 // Yes, insert the value into the value table...
587 ValueList &List = ValueTab[V->getType()];
589 return List.size()-1;
592 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
594 case ValID::LocalID: // Is it a numbered definition?
595 // Module constants occupy the lowest numbered slots...
596 if (D.Num < CurModule.Types.size())
597 return CurModule.Types[D.Num];
599 case ValID::LocalName: // Is it a named definition?
600 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
601 D.destroy(); // Free old strdup'd memory...
606 GenerateError("Internal parser error: Invalid symbol type reference");
610 // If we reached here, we referenced either a symbol that we don't know about
611 // or an id number that hasn't been read yet. We may be referencing something
612 // forward, so just create an entry to be resolved later and get to it...
614 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
617 if (inFunctionScope()) {
618 if (D.Type == ValID::LocalName) {
619 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
622 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
627 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
628 if (I != CurModule.LateResolveTypes.end())
631 Type *Typ = OpaqueType::get();
632 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
636 // getValNonImprovising - Look up the value specified by the provided type and
637 // the provided ValID. If the value exists and has already been defined, return
638 // it. Otherwise return null.
640 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
641 if (isa<FunctionType>(Ty)) {
642 GenerateError("Functions are not values and "
643 "must be referenced as pointers");
648 case ValID::LocalID: { // Is it a numbered definition?
649 // Module constants occupy the lowest numbered slots.
650 std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
651 // Make sure that our type is within bounds.
652 if (VI == CurFun.Values.end()) return 0;
654 // Check that the number is within bounds.
655 if (D.Num >= VI->second.size()) return 0;
657 return VI->second[D.Num];
659 case ValID::GlobalID: { // Is it a numbered definition?
660 unsigned Num = D.Num;
662 // Module constants occupy the lowest numbered slots...
663 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
664 if (VI == CurModule.Values.end()) return 0;
665 if (D.Num >= VI->second.size()) return 0;
666 return VI->second[Num];
669 case ValID::LocalName: { // Is it a named definition?
670 if (!inFunctionScope()) return 0;
671 SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
672 Value *N = SymTab.lookup(Ty, D.Name);
673 if (N == 0) return 0;
675 D.destroy(); // Free old strdup'd memory...
678 case ValID::GlobalName: { // Is it a named definition?
679 SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
680 Value *N = SymTab.lookup(Ty, D.Name);
681 if (N == 0) return 0;
683 D.destroy(); // Free old strdup'd memory...
687 // Check to make sure that "Ty" is an integral type, and that our
688 // value will fit into the specified type...
689 case ValID::ConstSIntVal: // Is it a constant pool reference??
690 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
691 GenerateError("Signed integral constant '" +
692 itostr(D.ConstPool64) + "' is invalid for type '" +
693 Ty->getDescription() + "'");
696 return ConstantInt::get(Ty, D.ConstPool64);
698 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
699 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
700 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
701 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
702 "' is invalid or out of range");
704 } else { // This is really a signed reference. Transmogrify.
705 return ConstantInt::get(Ty, D.ConstPool64);
708 return ConstantInt::get(Ty, D.UConstPool64);
711 case ValID::ConstFPVal: // Is it a floating point const pool reference?
712 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
713 GenerateError("FP constant invalid for type");
716 return ConstantFP::get(Ty, D.ConstPoolFP);
718 case ValID::ConstNullVal: // Is it a null value?
719 if (!isa<PointerType>(Ty)) {
720 GenerateError("Cannot create a a non pointer null");
723 return ConstantPointerNull::get(cast<PointerType>(Ty));
725 case ValID::ConstUndefVal: // Is it an undef value?
726 return UndefValue::get(Ty);
728 case ValID::ConstZeroVal: // Is it a zero value?
729 return Constant::getNullValue(Ty);
731 case ValID::ConstantVal: // Fully resolved constant?
732 if (D.ConstantValue->getType() != Ty) {
733 GenerateError("Constant expression type different from required type");
736 return D.ConstantValue;
738 case ValID::InlineAsmVal: { // Inline asm expression
739 const PointerType *PTy = dyn_cast<PointerType>(Ty);
740 const FunctionType *FTy =
741 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
742 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
743 GenerateError("Invalid type for asm constraint string");
746 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
747 D.IAD->HasSideEffects);
748 D.destroy(); // Free InlineAsmDescriptor.
752 assert(0 && "Unhandled case!");
756 assert(0 && "Unhandled case!");
760 // getVal - This function is identical to getValNonImprovising, except that if a
761 // value is not already defined, it "improvises" by creating a placeholder var
762 // that looks and acts just like the requested variable. When the value is
763 // defined later, all uses of the placeholder variable are replaced with the
766 static Value *getVal(const Type *Ty, const ValID &ID) {
767 if (Ty == Type::LabelTy) {
768 GenerateError("Cannot use a basic block here");
772 // See if the value has already been defined.
773 Value *V = getValNonImprovising(Ty, ID);
775 if (TriggerError) return 0;
777 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
778 GenerateError("Invalid use of a composite type");
782 // If we reached here, we referenced either a symbol that we don't know about
783 // or an id number that hasn't been read yet. We may be referencing something
784 // forward, so just create an entry to be resolved later and get to it...
786 V = new Argument(Ty);
788 // Remember where this forward reference came from. FIXME, shouldn't we try
789 // to recycle these things??
790 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
793 if (inFunctionScope())
794 InsertValue(V, CurFun.LateResolveValues);
796 InsertValue(V, CurModule.LateResolveValues);
800 /// getBBVal - This is used for two purposes:
801 /// * If isDefinition is true, a new basic block with the specified ID is being
803 /// * If isDefinition is true, this is a reference to a basic block, which may
804 /// or may not be a forward reference.
806 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
807 assert(inFunctionScope() && "Can't get basic block at global scope!");
813 GenerateError("Illegal label reference " + ID.getName());
815 case ValID::LocalID: // Is it a numbered definition?
816 if (ID.Num >= CurFun.NumberedBlocks.size())
817 CurFun.NumberedBlocks.resize(ID.Num+1);
818 BB = CurFun.NumberedBlocks[ID.Num];
820 case ValID::LocalName: // Is it a named definition?
822 if (Value *N = CurFun.CurrentFunction->
823 getValueSymbolTable().lookup(Type::LabelTy, Name))
824 BB = cast<BasicBlock>(N);
828 // See if the block has already been defined.
830 // If this is the definition of the block, make sure the existing value was
831 // just a forward reference. If it was a forward reference, there will be
832 // an entry for it in the PlaceHolderInfo map.
833 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
834 // The existing value was a definition, not a forward reference.
835 GenerateError("Redefinition of label " + ID.getName());
839 ID.destroy(); // Free strdup'd memory.
843 // Otherwise this block has not been seen before.
844 BB = new BasicBlock("", CurFun.CurrentFunction);
845 if (ID.Type == ValID::LocalName) {
846 BB->setName(ID.Name);
848 CurFun.NumberedBlocks[ID.Num] = BB;
851 // If this is not a definition, keep track of it so we can use it as a forward
854 // Remember where this forward reference came from.
855 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
857 // The forward declaration could have been inserted anywhere in the
858 // function: insert it into the correct place now.
859 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
860 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
867 //===----------------------------------------------------------------------===//
868 // Code to handle forward references in instructions
869 //===----------------------------------------------------------------------===//
871 // This code handles the late binding needed with statements that reference
872 // values not defined yet... for example, a forward branch, or the PHI node for
875 // This keeps a table (CurFun.LateResolveValues) of all such forward references
876 // and back patchs after we are done.
879 // ResolveDefinitions - If we could not resolve some defs at parsing
880 // time (forward branches, phi functions for loops, etc...) resolve the
884 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
885 std::map<const Type*,ValueList> *FutureLateResolvers) {
886 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
887 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
888 E = LateResolvers.end(); LRI != E; ++LRI) {
889 ValueList &List = LRI->second;
890 while (!List.empty()) {
891 Value *V = List.back();
894 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
895 CurModule.PlaceHolderInfo.find(V);
896 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
898 ValID &DID = PHI->second.first;
900 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
904 V->replaceAllUsesWith(TheRealValue);
906 CurModule.PlaceHolderInfo.erase(PHI);
907 } else if (FutureLateResolvers) {
908 // Functions have their unresolved items forwarded to the module late
910 InsertValue(V, *FutureLateResolvers);
912 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
913 GenerateError("Reference to an invalid definition: '" +DID.getName()+
914 "' of type '" + V->getType()->getDescription() + "'",
918 GenerateError("Reference to an invalid definition: #" +
919 itostr(DID.Num) + " of type '" +
920 V->getType()->getDescription() + "'",
928 LateResolvers.clear();
931 // ResolveTypeTo - A brand new type was just declared. This means that (if
932 // name is not null) things referencing Name can be resolved. Otherwise, things
933 // refering to the number can be resolved. Do this now.
935 static void ResolveTypeTo(char *Name, const Type *ToTy) {
937 if (Name) D = ValID::createLocalName(Name);
938 else D = ValID::createLocalID(CurModule.Types.size());
940 std::map<ValID, PATypeHolder>::iterator I =
941 CurModule.LateResolveTypes.find(D);
942 if (I != CurModule.LateResolveTypes.end()) {
943 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
944 CurModule.LateResolveTypes.erase(I);
948 // setValueName - Set the specified value to the name given. The name may be
949 // null potentially, in which case this is a noop. The string passed in is
950 // assumed to be a malloc'd string buffer, and is free'd by this function.
952 static void setValueName(Value *V, char *NameStr) {
953 if (!NameStr) return;
954 std::string Name(NameStr); // Copy string
955 free(NameStr); // Free old string
957 if (V->getType() == Type::VoidTy) {
958 GenerateError("Can't assign name '" + Name+"' to value with void type");
962 assert(inFunctionScope() && "Must be in function scope!");
963 SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
964 if (ST.lookup(V->getType(), Name)) {
965 GenerateError("Redefinition of value '" + Name + "' of type '" +
966 V->getType()->getDescription() + "'");
974 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
975 /// this is a declaration, otherwise it is a definition.
976 static GlobalVariable *
977 ParseGlobalVariable(char *NameStr,
978 GlobalValue::LinkageTypes Linkage,
979 GlobalValue::VisibilityTypes Visibility,
980 bool isConstantGlobal, const Type *Ty,
981 Constant *Initializer) {
982 if (isa<FunctionType>(Ty)) {
983 GenerateError("Cannot declare global vars of function type");
987 const PointerType *PTy = PointerType::get(Ty);
991 Name = NameStr; // Copy string
992 free(NameStr); // Free old string
995 // See if this global value was forward referenced. If so, recycle the
999 ID = ValID::createGlobalName((char*)Name.c_str());
1001 ID = ValID::createGlobalID(CurModule.Values[PTy].size());
1004 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1005 // Move the global to the end of the list, from whereever it was
1006 // previously inserted.
1007 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1008 CurModule.CurrentModule->getGlobalList().remove(GV);
1009 CurModule.CurrentModule->getGlobalList().push_back(GV);
1010 GV->setInitializer(Initializer);
1011 GV->setLinkage(Linkage);
1012 GV->setVisibility(Visibility);
1013 GV->setConstant(isConstantGlobal);
1014 InsertValue(GV, CurModule.Values);
1018 // If this global has a name, check to see if there is already a definition
1019 // of this global in the module. If so, it is an error.
1020 if (!Name.empty()) {
1021 // We are a simple redefinition of a value, check to see if it is defined
1022 // the same as the old one.
1023 if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
1024 GenerateError("Redefinition of global variable named '" + Name +
1025 "' of type '" + Ty->getDescription() + "'");
1030 // Otherwise there is no existing GV to use, create one now.
1031 GlobalVariable *GV =
1032 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1033 CurModule.CurrentModule);
1034 GV->setVisibility(Visibility);
1035 InsertValue(GV, CurModule.Values);
1039 // setTypeName - Set the specified type to the name given. The name may be
1040 // null potentially, in which case this is a noop. The string passed in is
1041 // assumed to be a malloc'd string buffer, and is freed by this function.
1043 // This function returns true if the type has already been defined, but is
1044 // allowed to be redefined in the specified context. If the name is a new name
1045 // for the type plane, it is inserted and false is returned.
1046 static bool setTypeName(const Type *T, char *NameStr) {
1047 assert(!inFunctionScope() && "Can't give types function-local names!");
1048 if (NameStr == 0) return false;
1050 std::string Name(NameStr); // Copy string
1051 free(NameStr); // Free old string
1053 // We don't allow assigning names to void type
1054 if (T == Type::VoidTy) {
1055 GenerateError("Can't assign name '" + Name + "' to the void type");
1059 // Set the type name, checking for conflicts as we do so.
1060 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1062 if (AlreadyExists) { // Inserting a name that is already defined???
1063 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1064 assert(Existing && "Conflict but no matching type?!");
1066 // There is only one case where this is allowed: when we are refining an
1067 // opaque type. In this case, Existing will be an opaque type.
1068 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1069 // We ARE replacing an opaque type!
1070 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1074 // Otherwise, this is an attempt to redefine a type. That's okay if
1075 // the redefinition is identical to the original. This will be so if
1076 // Existing and T point to the same Type object. In this one case we
1077 // allow the equivalent redefinition.
1078 if (Existing == T) return true; // Yes, it's equal.
1080 // Any other kind of (non-equivalent) redefinition is an error.
1081 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1082 T->getDescription() + "'");
1088 //===----------------------------------------------------------------------===//
1089 // Code for handling upreferences in type names...
1092 // TypeContains - Returns true if Ty directly contains E in it.
1094 static bool TypeContains(const Type *Ty, const Type *E) {
1095 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1096 E) != Ty->subtype_end();
1100 struct UpRefRecord {
1101 // NestingLevel - The number of nesting levels that need to be popped before
1102 // this type is resolved.
1103 unsigned NestingLevel;
1105 // LastContainedTy - This is the type at the current binding level for the
1106 // type. Every time we reduce the nesting level, this gets updated.
1107 const Type *LastContainedTy;
1109 // UpRefTy - This is the actual opaque type that the upreference is
1110 // represented with.
1111 OpaqueType *UpRefTy;
1113 UpRefRecord(unsigned NL, OpaqueType *URTy)
1114 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1118 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1119 static std::vector<UpRefRecord> UpRefs;
1121 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1122 /// called. It loops through the UpRefs vector, which is a list of the
1123 /// currently active types. For each type, if the up reference is contained in
1124 /// the newly completed type, we decrement the level count. When the level
1125 /// count reaches zero, the upreferenced type is the type that is passed in:
1126 /// thus we can complete the cycle.
1128 static PATypeHolder HandleUpRefs(const Type *ty) {
1129 // If Ty isn't abstract, or if there are no up-references in it, then there is
1130 // nothing to resolve here.
1131 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1133 PATypeHolder Ty(ty);
1134 UR_OUT("Type '" << Ty->getDescription() <<
1135 "' newly formed. Resolving upreferences.\n" <<
1136 UpRefs.size() << " upreferences active!\n");
1138 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1139 // to zero), we resolve them all together before we resolve them to Ty. At
1140 // the end of the loop, if there is anything to resolve to Ty, it will be in
1142 OpaqueType *TypeToResolve = 0;
1144 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1145 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1146 << UpRefs[i].second->getDescription() << ") = "
1147 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1148 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1149 // Decrement level of upreference
1150 unsigned Level = --UpRefs[i].NestingLevel;
1151 UpRefs[i].LastContainedTy = Ty;
1152 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1153 if (Level == 0) { // Upreference should be resolved!
1154 if (!TypeToResolve) {
1155 TypeToResolve = UpRefs[i].UpRefTy;
1157 UR_OUT(" * Resolving upreference for "
1158 << UpRefs[i].second->getDescription() << "\n";
1159 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1160 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1161 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1162 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1164 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1165 --i; // Do not skip the next element...
1170 if (TypeToResolve) {
1171 UR_OUT(" * Resolving upreference for "
1172 << UpRefs[i].second->getDescription() << "\n";
1173 std::string OldName = TypeToResolve->getDescription());
1174 TypeToResolve->refineAbstractTypeTo(Ty);
1180 //===----------------------------------------------------------------------===//
1181 // RunVMAsmParser - Define an interface to this parser
1182 //===----------------------------------------------------------------------===//
1184 static Module* RunParser(Module * M);
1186 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1189 CurFilename = Filename;
1190 return RunParser(new Module(CurFilename));
1193 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1194 set_scan_string(AsmString);
1196 CurFilename = "from_memory";
1198 return RunParser(new Module (CurFilename));
1200 return RunParser(M);
1206 /* Enabling traces. */
1211 /* Enabling verbose error messages. */
1212 #ifdef YYERROR_VERBOSE
1213 # undef YYERROR_VERBOSE
1214 # define YYERROR_VERBOSE 1
1216 # define YYERROR_VERBOSE 0
1219 /* Enabling the token table. */
1220 #ifndef YYTOKEN_TABLE
1221 # define YYTOKEN_TABLE 0
1224 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1225 #line 886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
1226 typedef union YYSTYPE {
1227 llvm::Module *ModuleVal;
1228 llvm::Function *FunctionVal;
1229 llvm::BasicBlock *BasicBlockVal;
1230 llvm::TerminatorInst *TermInstVal;
1231 llvm::Instruction *InstVal;
1232 llvm::Constant *ConstVal;
1234 const llvm::Type *PrimType;
1235 std::list<llvm::PATypeHolder> *TypeList;
1236 llvm::PATypeHolder *TypeVal;
1237 llvm::Value *ValueVal;
1238 std::vector<llvm::Value*> *ValueList;
1239 llvm::ArgListType *ArgList;
1240 llvm::TypeWithAttrs TypeWithAttrs;
1241 llvm::TypeWithAttrsList *TypeWithAttrsList;
1242 llvm::ValueRefList *ValueRefList;
1244 // Represent the RHS of PHI node
1245 std::list<std::pair<llvm::Value*,
1246 llvm::BasicBlock*> > *PHIList;
1247 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1248 std::vector<llvm::Constant*> *ConstVector;
1250 llvm::GlobalValue::LinkageTypes Linkage;
1251 llvm::GlobalValue::VisibilityTypes Visibility;
1252 llvm::FunctionType::ParameterAttributes ParamAttrs;
1260 char *StrVal; // This memory is strdup'd!
1261 llvm::ValID ValIDVal; // strdup'd memory maybe!
1263 llvm::Instruction::BinaryOps BinaryOpVal;
1264 llvm::Instruction::TermOps TermOpVal;
1265 llvm::Instruction::MemoryOps MemOpVal;
1266 llvm::Instruction::CastOps CastOpVal;
1267 llvm::Instruction::OtherOps OtherOpVal;
1268 llvm::ICmpInst::Predicate IPredicate;
1269 llvm::FCmpInst::Predicate FPredicate;
1271 /* Line 196 of yacc.c. */
1272 #line 1273 "llvmAsmParser.tab.c"
1273 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1274 # define YYSTYPE_IS_DECLARED 1
1275 # define YYSTYPE_IS_TRIVIAL 1
1280 /* Copy the second part of user declarations. */
1283 /* Line 219 of yacc.c. */
1284 #line 1285 "llvmAsmParser.tab.c"
1286 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1287 # define YYSIZE_T __SIZE_TYPE__
1289 #if ! defined (YYSIZE_T) && defined (size_t)
1290 # define YYSIZE_T size_t
1292 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1293 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1294 # define YYSIZE_T size_t
1296 #if ! defined (YYSIZE_T)
1297 # define YYSIZE_T unsigned int
1303 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1304 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1308 # define YY_(msgid) msgid
1312 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1314 /* The parser invokes alloca or malloc; define the necessary symbols. */
1316 # ifdef YYSTACK_USE_ALLOCA
1317 # if YYSTACK_USE_ALLOCA
1319 # define YYSTACK_ALLOC __builtin_alloca
1321 # define YYSTACK_ALLOC alloca
1322 # if defined (__STDC__) || defined (__cplusplus)
1323 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1324 # define YYINCLUDED_STDLIB_H
1330 # ifdef YYSTACK_ALLOC
1331 /* Pacify GCC's `empty if-body' warning. */
1332 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1333 # ifndef YYSTACK_ALLOC_MAXIMUM
1334 /* The OS might guarantee only one guard page at the bottom of the stack,
1335 and a page size can be as small as 4096 bytes. So we cannot safely
1336 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1337 to allow for a few compiler-allocated temporary stack slots. */
1338 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1341 # define YYSTACK_ALLOC YYMALLOC
1342 # define YYSTACK_FREE YYFREE
1343 # ifndef YYSTACK_ALLOC_MAXIMUM
1344 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1350 # define YYMALLOC malloc
1351 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1352 && (defined (__STDC__) || defined (__cplusplus)))
1353 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1357 # define YYFREE free
1358 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1359 && (defined (__STDC__) || defined (__cplusplus)))
1360 void free (void *); /* INFRINGES ON USER NAME SPACE */
1367 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1370 #if (! defined (yyoverflow) \
1371 && (! defined (__cplusplus) \
1372 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1374 /* A type that is properly aligned for any stack member. */
1381 /* The size of the maximum gap between one aligned stack and the next. */
1382 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1384 /* The size of an array large to enough to hold all stacks, each with
1386 # define YYSTACK_BYTES(N) \
1387 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1388 + YYSTACK_GAP_MAXIMUM)
1390 /* Copy COUNT objects from FROM to TO. The source and destination do
1393 # if defined (__GNUC__) && 1 < __GNUC__
1394 # define YYCOPY(To, From, Count) \
1395 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1397 # define YYCOPY(To, From, Count) \
1401 for (yyi = 0; yyi < (Count); yyi++) \
1402 (To)[yyi] = (From)[yyi]; \
1408 /* Relocate STACK from its old location to the new one. The
1409 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1410 elements in the stack, and YYPTR gives the new location of the
1411 stack. Advance YYPTR to a properly aligned location for the next
1413 # define YYSTACK_RELOCATE(Stack) \
1416 YYSIZE_T yynewbytes; \
1417 YYCOPY (&yyptr->Stack, Stack, yysize); \
1418 Stack = &yyptr->Stack; \
1419 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1420 yyptr += yynewbytes / sizeof (*yyptr); \
1426 #if defined (__STDC__) || defined (__cplusplus)
1427 typedef signed char yysigned_char;
1429 typedef short int yysigned_char;
1432 /* YYFINAL -- State number of the termination state. */
1434 /* YYLAST -- Last index in YYTABLE. */
1437 /* YYNTOKENS -- Number of terminals. */
1438 #define YYNTOKENS 146
1439 /* YYNNTS -- Number of nonterminals. */
1441 /* YYNRULES -- Number of rules. */
1442 #define YYNRULES 284
1443 /* YYNRULES -- Number of states. */
1444 #define YYNSTATES 557
1446 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1447 #define YYUNDEFTOK 2
1448 #define YYMAXUTOK 386
1450 #define YYTRANSLATE(YYX) \
1451 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1453 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1454 static const unsigned char yytranslate[] =
1456 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1460 136, 137, 134, 2, 133, 2, 2, 2, 2, 2,
1461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1462 141, 132, 142, 2, 2, 2, 2, 2, 2, 2,
1463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1465 2, 138, 135, 140, 2, 2, 2, 2, 2, 145,
1466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1468 139, 2, 2, 143, 2, 144, 2, 2, 2, 2,
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1476 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1481 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1482 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1483 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1484 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1485 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1486 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1487 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1488 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1489 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1490 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1491 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1492 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1493 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1494 125, 126, 127, 128, 129, 130, 131
1498 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1500 static const unsigned short int yyprhs[] =
1502 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1503 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1504 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1505 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1506 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1507 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1508 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1509 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1510 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1511 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1512 195, 197, 198, 201, 202, 205, 206, 210, 213, 214,
1513 216, 217, 221, 223, 226, 228, 230, 232, 234, 236,
1514 238, 241, 243, 246, 252, 258, 264, 270, 274, 277,
1515 283, 288, 291, 293, 295, 297, 301, 303, 307, 309,
1516 310, 312, 316, 321, 325, 329, 334, 339, 343, 350,
1517 356, 359, 362, 365, 368, 371, 374, 377, 380, 383,
1518 386, 393, 399, 408, 415, 422, 430, 438, 445, 454,
1519 463, 467, 469, 471, 473, 475, 476, 478, 481, 482,
1520 486, 487, 491, 495, 497, 501, 505, 506, 513, 514,
1521 522, 523, 531, 534, 538, 540, 544, 548, 552, 556,
1522 558, 559, 565, 569, 571, 575, 577, 578, 588, 590,
1523 592, 597, 599, 601, 604, 608, 609, 611, 613, 615,
1524 617, 619, 621, 623, 625, 627, 631, 633, 639, 641,
1525 643, 645, 647, 649, 651, 654, 657, 660, 664, 667,
1526 668, 670, 673, 676, 680, 690, 700, 709, 724, 726,
1527 728, 735, 741, 744, 751, 759, 763, 769, 770, 771,
1528 775, 778, 780, 786, 792, 799, 806, 811, 818, 823,
1529 828, 835, 842, 845, 854, 856, 858, 859, 863, 870,
1530 874, 881, 884, 889, 896
1533 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1534 static const short int yyrhs[] =
1536 186, 0, -1, 66, -1, 67, -1, 68, -1, 69,
1537 -1, 70, -1, 71, -1, 72, -1, 73, -1, 74,
1538 -1, 78, -1, 79, -1, 80, -1, 75, -1, 76,
1539 -1, 77, -1, 109, -1, 110, -1, 111, -1, 112,
1540 -1, 113, -1, 114, -1, 115, -1, 116, -1, 117,
1541 -1, 118, -1, 119, -1, 120, -1, 83, -1, 84,
1542 -1, 85, -1, 86, -1, 87, -1, 88, -1, 89,
1543 -1, 90, -1, 91, -1, 92, -1, 93, -1, 94,
1544 -1, 95, -1, 96, -1, 97, -1, 98, -1, 99,
1545 -1, 100, -1, 101, -1, 102, -1, 89, -1, 90,
1546 -1, 91, -1, 92, -1, 21, -1, 22, -1, 9,
1547 -1, 10, -1, 11, -1, 14, -1, 17, -1, 154,
1548 -1, -1, 154, 132, -1, -1, 15, -1, 18, -1,
1549 157, 132, -1, -1, 35, -1, 37, -1, 36, -1,
1550 38, -1, 40, -1, 39, -1, 41, -1, 43, -1,
1551 -1, 131, -1, -1, 39, -1, 41, -1, -1, 35,
1552 -1, 36, -1, 37, -1, 40, -1, -1, 54, -1,
1553 55, -1, 56, -1, 57, -1, 58, -1, 53, 4,
1554 -1, 110, -1, 111, -1, 128, -1, 129, -1, -1,
1555 166, 165, -1, 127, -1, 165, -1, -1, 168, 167,
1556 -1, -1, 46, 4, -1, -1, 133, 46, 4, -1,
1557 29, 17, -1, -1, 171, -1, -1, 133, 174, 173,
1558 -1, 171, -1, 46, 4, -1, 9, -1, 10, -1,
1559 11, -1, 12, -1, 42, -1, 175, -1, 176, 134,
1560 -1, 208, -1, 135, 4, -1, 176, 136, 180, 137,
1561 168, -1, 8, 136, 180, 137, 168, -1, 138, 4,
1562 139, 176, 140, -1, 141, 4, 139, 176, 142, -1,
1563 143, 181, 144, -1, 143, 144, -1, 141, 143, 181,
1564 144, 142, -1, 141, 143, 144, 142, -1, 176, 166,
1565 -1, 176, -1, 8, -1, 177, -1, 179, 133, 177,
1566 -1, 179, -1, 179, 133, 32, -1, 32, -1, -1,
1567 176, -1, 181, 133, 176, -1, 176, 138, 184, 140,
1568 -1, 176, 138, 140, -1, 176, 145, 17, -1, 176,
1569 141, 184, 142, -1, 176, 143, 184, 144, -1, 176,
1570 143, 144, -1, 176, 141, 143, 184, 144, 142, -1,
1571 176, 141, 143, 144, 142, -1, 176, 33, -1, 176,
1572 34, -1, 176, 208, -1, 176, 183, -1, 176, 20,
1573 -1, 152, 3, -1, 152, 4, -1, 9, 21, -1,
1574 9, 22, -1, 153, 7, -1, 149, 136, 182, 31,
1575 176, 137, -1, 108, 136, 182, 219, 137, -1, 122,
1576 136, 182, 133, 182, 133, 182, 137, -1, 147, 136,
1577 182, 133, 182, 137, -1, 148, 136, 182, 133, 182,
1578 137, -1, 81, 150, 136, 182, 133, 182, 137, -1,
1579 82, 151, 136, 182, 133, 182, 137, -1, 124, 136,
1580 182, 133, 182, 137, -1, 125, 136, 182, 133, 182,
1581 133, 182, 137, -1, 126, 136, 182, 133, 182, 133,
1582 182, 137, -1, 184, 133, 182, -1, 182, -1, 27,
1583 -1, 28, -1, 187, -1, -1, 188, -1, 187, 188,
1584 -1, -1, 26, 189, 204, -1, -1, 25, 190, 205,
1585 -1, 51, 50, 194, -1, 19, -1, 156, 13, 176,
1586 -1, 156, 13, 8, -1, -1, 158, 161, 185, 182,
1587 191, 173, -1, -1, 158, 159, 161, 185, 182, 192,
1588 173, -1, -1, 158, 160, 161, 185, 176, 193, 173,
1589 -1, 44, 195, -1, 47, 132, 196, -1, 17, -1,
1590 45, 132, 17, -1, 59, 132, 17, -1, 138, 197,
1591 140, -1, 197, 133, 17, -1, 17, -1, -1, 198,
1592 133, 176, 166, 155, -1, 176, 166, 155, -1, 198,
1593 -1, 198, 133, 32, -1, 32, -1, -1, 164, 178,
1594 157, 136, 199, 137, 168, 172, 169, -1, 23, -1,
1595 143, -1, 163, 161, 200, 201, -1, 24, -1, 144,
1596 -1, 211, 203, -1, 162, 161, 200, -1, -1, 52,
1597 -1, 3, -1, 4, -1, 7, -1, 21, -1, 22,
1598 -1, 33, -1, 34, -1, 20, -1, 141, 184, 142,
1599 -1, 183, -1, 50, 206, 17, 133, 17, -1, 5,
1600 -1, 6, -1, 154, -1, 157, -1, 208, -1, 207,
1601 -1, 176, 209, -1, 211, 212, -1, 202, 212, -1,
1602 213, 156, 214, -1, 213, 216, -1, -1, 16, -1,
1603 60, 210, -1, 60, 8, -1, 61, 12, 209, -1,
1604 61, 9, 209, 133, 12, 209, 133, 12, 209, -1,
1605 62, 152, 209, 133, 12, 209, 138, 215, 140, -1,
1606 62, 152, 209, 133, 12, 209, 138, 140, -1, 63,
1607 164, 178, 209, 136, 218, 137, 168, 31, 12, 209,
1608 64, 12, 209, -1, 64, -1, 65, -1, 215, 152,
1609 207, 133, 12, 209, -1, 152, 207, 133, 12, 209,
1610 -1, 156, 221, -1, 176, 138, 209, 133, 209, 140,
1611 -1, 217, 133, 138, 209, 133, 209, 140, -1, 176,
1612 209, 166, -1, 218, 133, 176, 209, 166, -1, -1,
1613 -1, 219, 133, 210, -1, 49, 48, -1, 48, -1,
1614 147, 176, 209, 133, 209, -1, 148, 176, 209, 133,
1615 209, -1, 81, 150, 176, 209, 133, 209, -1, 82,
1616 151, 176, 209, 133, 209, -1, 149, 210, 31, 176,
1617 -1, 122, 210, 133, 210, 133, 210, -1, 123, 210,
1618 133, 176, -1, 124, 210, 133, 210, -1, 125, 210,
1619 133, 210, 133, 210, -1, 126, 210, 133, 210, 133,
1620 210, -1, 121, 217, -1, 220, 164, 178, 209, 136,
1621 218, 137, 168, -1, 223, -1, 30, -1, -1, 103,
1622 176, 170, -1, 103, 176, 133, 9, 209, 170, -1,
1623 104, 176, 170, -1, 104, 176, 133, 9, 209, 170,
1624 -1, 105, 210, -1, 222, 106, 176, 209, -1, 222,
1625 107, 210, 133, 176, 209, -1, 108, 176, 209, 219,
1629 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1630 static const unsigned short int yyrline[] =
1632 0, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033, 1033,
1633 1033, 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035,
1634 1035, 1035, 1035, 1036, 1036, 1036, 1036, 1036, 1036, 1039,
1635 1039, 1040, 1040, 1041, 1041, 1042, 1042, 1043, 1043, 1047,
1636 1047, 1048, 1048, 1049, 1049, 1050, 1050, 1051, 1051, 1052,
1637 1052, 1053, 1053, 1054, 1055, 1060, 1061, 1061, 1063, 1063,
1638 1064, 1064, 1068, 1072, 1077, 1077, 1079, 1083, 1089, 1090,
1639 1091, 1092, 1093, 1097, 1098, 1099, 1103, 1104, 1108, 1109,
1640 1110, 1114, 1115, 1116, 1117, 1118, 1121, 1122, 1123, 1124,
1641 1125, 1126, 1127, 1134, 1135, 1136, 1137, 1140, 1141, 1146,
1642 1147, 1150, 1151, 1158, 1159, 1165, 1166, 1174, 1182, 1183,
1643 1188, 1189, 1190, 1195, 1208, 1208, 1208, 1208, 1211, 1215,
1644 1219, 1226, 1231, 1239, 1257, 1275, 1280, 1292, 1302, 1306,
1645 1316, 1323, 1330, 1337, 1342, 1347, 1354, 1355, 1362, 1369,
1646 1377, 1382, 1393, 1421, 1437, 1466, 1494, 1519, 1538, 1563,
1647 1582, 1594, 1601, 1667, 1677, 1687, 1693, 1699, 1704, 1709,
1648 1717, 1729, 1750, 1758, 1764, 1775, 1780, 1785, 1791, 1797,
1649 1806, 1810, 1818, 1818, 1829, 1834, 1842, 1843, 1847, 1847,
1650 1851, 1851, 1854, 1857, 1869, 1893, 1904, 1904, 1914, 1914,
1651 1922, 1922, 1932, 1935, 1941, 1954, 1958, 1963, 1965, 1970,
1652 1975, 1984, 1994, 2005, 2009, 2018, 2027, 2032, 2138, 2138,
1653 2140, 2149, 2149, 2151, 2156, 2168, 2172, 2177, 2181, 2185,
1654 2189, 2193, 2197, 2201, 2205, 2209, 2234, 2238, 2252, 2256,
1655 2260, 2264, 2270, 2270, 2276, 2285, 2289, 2298, 2309, 2318,
1656 2330, 2343, 2347, 2351, 2356, 2366, 2385, 2394, 2461, 2465,
1657 2472, 2483, 2496, 2505, 2516, 2526, 2534, 2542, 2545, 2546,
1658 2553, 2557, 2562, 2583, 2600, 2613, 2626, 2638, 2646, 2653,
1659 2659, 2665, 2671, 2686, 2750, 2755, 2759, 2766, 2773, 2781,
1660 2788, 2796, 2804, 2818, 2835
1664 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1665 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1666 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1667 static const char *const yytname[] =
1669 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL",
1670 "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", "FLOAT",
1671 "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1672 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1673 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1674 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1675 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1676 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1677 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1678 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1679 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1680 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1681 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1682 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1683 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1684 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1685 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1686 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1687 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1688 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT",
1689 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1690 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1691 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1692 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1693 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1694 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1695 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1696 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1697 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1698 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1699 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1700 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1701 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1702 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1703 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1704 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1705 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1706 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1707 "OptVolatile", "MemoryInst", 0
1712 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1714 static const unsigned short int yytoknum[] =
1716 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1717 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1718 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1719 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1720 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1721 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1722 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1723 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1724 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1725 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1726 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1727 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1728 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1729 385, 386, 61, 44, 42, 92, 40, 41, 91, 120,
1730 93, 60, 62, 123, 125, 99
1734 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1735 static const unsigned char yyr1[] =
1737 0, 146, 147, 147, 147, 147, 147, 147, 147, 147,
1738 147, 148, 148, 148, 148, 148, 148, 149, 149, 149,
1739 149, 149, 149, 149, 149, 149, 149, 149, 149, 150,
1740 150, 150, 150, 150, 150, 150, 150, 150, 150, 151,
1741 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
1742 151, 151, 151, 151, 151, 152, 153, 153, 154, 154,
1743 155, 155, 156, 156, 157, 157, 158, 158, 159, 159,
1744 159, 159, 159, 160, 160, 160, 161, 161, 162, 162,
1745 162, 163, 163, 163, 163, 163, 164, 164, 164, 164,
1746 164, 164, 164, 165, 165, 165, 165, 166, 166, 167,
1747 167, 168, 168, 169, 169, 170, 170, 171, 172, 172,
1748 173, 173, 174, 174, 175, 175, 175, 175, 176, 176,
1749 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1750 176, 177, 178, 178, 179, 179, 180, 180, 180, 180,
1751 181, 181, 182, 182, 182, 182, 182, 182, 182, 182,
1752 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
1753 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
1754 184, 184, 185, 185, 186, 186, 187, 187, 189, 188,
1755 190, 188, 188, 188, 188, 188, 191, 188, 192, 188,
1756 193, 188, 188, 188, 194, 195, 195, 196, 197, 197,
1757 197, 198, 198, 199, 199, 199, 199, 200, 201, 201,
1758 202, 203, 203, 204, 205, 206, 206, 207, 207, 207,
1759 207, 207, 207, 207, 207, 207, 207, 207, 208, 208,
1760 208, 208, 209, 209, 210, 211, 211, 212, 213, 213,
1761 213, 214, 214, 214, 214, 214, 214, 214, 214, 214,
1762 215, 215, 216, 217, 217, 218, 218, 218, 219, 219,
1763 220, 220, 221, 221, 221, 221, 221, 221, 221, 221,
1764 221, 221, 221, 221, 221, 222, 222, 223, 223, 223,
1765 223, 223, 223, 223, 223
1768 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1769 static const unsigned char yyr2[] =
1771 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1772 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1773 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1774 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1776 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1777 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1778 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1779 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1780 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1781 1, 0, 2, 0, 2, 0, 3, 2, 0, 1,
1782 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1783 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1784 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1785 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1786 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1787 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1788 3, 1, 1, 1, 1, 0, 1, 2, 0, 3,
1789 0, 3, 3, 1, 3, 3, 0, 6, 0, 7,
1790 0, 7, 2, 3, 1, 3, 3, 3, 3, 1,
1791 0, 5, 3, 1, 3, 1, 0, 9, 1, 1,
1792 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1793 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1794 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1795 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1796 6, 5, 2, 6, 7, 3, 5, 0, 0, 3,
1797 2, 1, 5, 5, 6, 6, 4, 6, 4, 4,
1798 6, 6, 2, 8, 1, 1, 0, 3, 6, 3,
1802 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1803 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1804 means the default is an error. */
1805 static const unsigned short int yydefact[] =
1807 67, 58, 64, 59, 65, 183, 180, 178, 0, 0,
1808 0, 0, 0, 0, 76, 0, 67, 176, 78, 81,
1809 0, 0, 192, 0, 0, 62, 0, 66, 68, 70,
1810 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
1811 1, 177, 79, 80, 76, 181, 82, 83, 84, 85,
1812 76, 239, 179, 239, 0, 0, 200, 193, 194, 182,
1813 228, 229, 185, 114, 115, 116, 117, 118, 0, 0,
1814 0, 0, 230, 231, 119, 184, 121, 0, 0, 172,
1815 173, 0, 86, 86, 240, 236, 63, 211, 212, 213,
1816 235, 195, 196, 199, 0, 139, 122, 0, 0, 0,
1817 0, 128, 140, 0, 120, 139, 0, 0, 114, 115,
1818 116, 0, 0, 0, 186, 0, 87, 88, 89, 90,
1819 91, 0, 214, 0, 276, 238, 0, 197, 138, 97,
1820 134, 136, 0, 0, 0, 0, 0, 0, 127, 0,
1821 188, 190, 157, 158, 155, 156, 159, 154, 150, 151,
1822 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
1823 15, 16, 11, 12, 13, 0, 0, 0, 17, 18,
1824 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1825 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1826 0, 153, 152, 110, 92, 133, 132, 0, 208, 209,
1827 210, 275, 261, 0, 0, 0, 0, 86, 248, 249,
1828 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1829 0, 0, 0, 0, 0, 237, 86, 252, 0, 274,
1830 198, 131, 0, 101, 0, 0, 130, 0, 141, 101,
1831 110, 110, 29, 30, 31, 32, 33, 34, 35, 36,
1832 37, 38, 0, 53, 54, 49, 50, 51, 52, 39,
1833 40, 41, 42, 43, 44, 45, 46, 47, 48, 0,
1834 0, 0, 0, 0, 0, 143, 171, 0, 0, 0,
1835 147, 0, 144, 0, 0, 0, 0, 187, 0, 260,
1836 242, 0, 241, 0, 0, 55, 0, 0, 0, 0,
1837 105, 105, 281, 0, 0, 272, 0, 0, 0, 0,
1838 0, 0, 0, 0, 0, 0, 0, 93, 94, 95,
1839 96, 98, 137, 135, 124, 125, 126, 129, 123, 189,
1840 191, 0, 0, 258, 0, 0, 0, 0, 0, 142,
1841 128, 140, 0, 145, 146, 0, 0, 0, 0, 0,
1842 112, 110, 206, 217, 218, 219, 224, 220, 221, 222,
1843 223, 215, 0, 226, 233, 232, 234, 0, 243, 0,
1844 0, 0, 0, 0, 277, 0, 279, 258, 0, 0,
1845 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1846 0, 99, 100, 102, 0, 0, 0, 0, 0, 0,
1847 0, 170, 149, 0, 0, 0, 0, 107, 113, 111,
1848 205, 97, 203, 0, 216, 0, 0, 0, 0, 0,
1849 0, 0, 0, 0, 0, 284, 0, 0, 0, 268,
1850 269, 0, 0, 0, 0, 266, 0, 282, 0, 0,
1851 0, 0, 161, 0, 0, 0, 0, 148, 0, 0,
1852 0, 61, 0, 101, 0, 225, 0, 0, 257, 0,
1853 0, 105, 106, 105, 0, 0, 0, 0, 0, 262,
1854 263, 257, 0, 0, 0, 259, 0, 167, 0, 0,
1855 163, 164, 160, 60, 202, 204, 97, 108, 0, 0,
1856 0, 0, 0, 264, 265, 0, 278, 280, 0, 0,
1857 267, 270, 271, 0, 283, 165, 166, 0, 0, 0,
1858 61, 109, 103, 227, 0, 0, 97, 0, 101, 253,
1859 0, 101, 162, 168, 169, 201, 0, 207, 0, 246,
1860 0, 0, 255, 0, 0, 254, 273, 104, 244, 0,
1861 245, 0, 97, 0, 0, 0, 256, 0, 0, 0,
1862 0, 251, 0, 0, 250, 0, 247
1865 /* YYDEFGOTO[NTERM-NUM]. */
1866 static const short int yydefgoto[] =
1868 -1, 188, 189, 190, 252, 269, 111, 112, 72, 484,
1869 12, 73, 14, 37, 38, 39, 44, 50, 121, 321,
1870 231, 393, 324, 527, 374, 350, 512, 287, 351, 74,
1871 113, 130, 197, 131, 132, 103, 276, 363, 277, 81,
1872 15, 16, 17, 19, 18, 193, 240, 241, 59, 22,
1873 57, 94, 412, 413, 122, 200, 51, 89, 52, 45,
1874 415, 364, 76, 366, 292, 53, 85, 86, 225, 531,
1875 125, 305, 492, 396, 226, 227, 228, 229
1878 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1880 #define YYPACT_NINF -399
1881 static const short int yypact[] =
1883 406, -399, -399, -399, -399, -399, -399, -399, -26, -114,
1884 -16, -53, 92, -11, 54, 136, 526, -399, 247, 173,
1885 43, 49, -399, 62, 194, -399, 814, -399, -399, -399,
1886 -399, -399, -399, -399, -399, -399, -399, 134, 134, 99,
1887 -399, -399, -399, -399, 134, -399, -399, -399, -399, -399,
1888 134, 212, -399, -1, 219, 225, 253, -399, -399, -399,
1889 -399, -399, 135, -399, -399, -399, -399, -399, 271, 275,
1890 3, 33, -399, -399, -399, 160, -399, 99, 99, -399,
1891 -399, 1029, 287, 287, -399, -399, 220, -399, -399, -399,
1892 -399, -399, -399, -399, 20, 1071, -399, 141, 148, 105,
1893 135, -399, 160, -75, -399, 1071, 1029, 1174, 32, 286,
1894 293, 151, 294, 590, -399, 298, -399, -399, -399, -399,
1895 -399, 1190, -399, -13, 1313, -399, 289, -399, -399, 160,
1896 -399, 170, 167, 1174, 1174, 165, -68, 1174, -399, 174,
1897 -399, 160, -399, -399, -399, -399, -399, -399, -399, -399,
1898 -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,
1899 -399, -399, -399, -399, -399, 495, 591, 176, -399, -399,
1900 -399, -399, -399, -399, -399, -399, -399, -399, -399, -399,
1901 177, 178, 182, 183, 776, 1212, 123, 305, 187, 188,
1902 189, -399, -399, 193, -399, 135, 160, 266, -399, -399,
1903 -399, -399, -399, 284, 1229, 283, 325, 287, -399, -399,
1904 495, 591, 1174, 1174, 1174, 1174, 1174, 1174, 1174, 1174,
1905 1174, 1174, 1174, 1174, 1174, -399, 287, -399, 144, -399,
1906 -399, -4, 1110, -399, -63, -110, -399, 204, 160, -399,
1907 193, 193, -399, -399, -399, -399, -399, -399, -399, -399,
1908 -399, -399, 211, -399, -399, -399, -399, -399, -399, -399,
1909 -399, -399, -399, -399, -399, -399, -399, -399, -399, 214,
1910 1029, 1029, 1029, 1029, 1029, -399, -399, 79, 494, -111,
1911 -399, -66, -399, 1029, 1029, 1029, 39, -399, 216, -399,
1912 135, 733, -399, 858, 858, -399, 858, 1190, 1174, 1174,
1913 50, 111, -399, 733, 97, 215, 230, 231, 232, 233,
1914 234, 733, 733, 322, 1190, 1174, 1174, -399, -399, -399,
1915 -399, -399, -399, -399, -27, -399, -399, -399, -27, -399,
1916 -399, 1029, 1029, -399, 235, 236, 239, 240, 1029, -399,
1917 237, 590, 26, -399, -399, 241, 242, 345, 360, 374,
1918 -399, 193, 1126, -399, -399, -399, -399, -399, -399, -399,
1919 -399, 328, 1029, -399, -399, -399, -399, 249, -399, 252,
1920 858, 733, 733, 11, -399, 18, -399, -399, 858, 250,
1921 1174, 1174, 1174, 1174, 1174, 256, 257, 1174, 858, 733,
1922 259, -399, -399, -399, 262, 264, -34, 1029, 1029, 1029,
1923 1029, -399, -399, 258, 1029, 1029, 1174, -399, -399, -399,
1924 -399, 160, 265, 267, -399, 384, -61, 390, 393, 272,
1925 281, 282, 858, 413, 858, 295, 296, 858, 297, 160,
1926 -399, 301, 302, 858, 858, 160, 300, -399, 1174, 1029,
1927 1029, 1174, -399, 304, 285, 306, 307, -399, 308, 310,
1928 118, 38, 1145, -399, 311, -399, 858, 858, 1174, 858,
1929 858, 315, -399, 315, 858, 316, 1174, 1174, 1174, -399,
1930 -399, 1174, 733, 317, 319, -399, 1029, -399, 1029, 1029,
1931 -399, -399, -399, -399, -399, -399, 160, 149, 421, 326,
1932 314, 733, 19, -399, -399, 412, -399, -399, 321, 858,
1933 -399, -399, -399, 36, -399, -399, -399, 327, 329, 330,
1934 38, -399, 416, -399, 451, 2, -399, 1174, -399, -399,
1935 333, -399, -399, -399, -399, -399, 461, -399, 858, -399,
1936 982, 5, -4, 733, 210, -399, -27, -399, -399, 335,
1937 -399, 982, -399, 457, 464, 344, -4, 858, 858, 468,
1938 417, -399, 858, 471, -399, 858, -399
1941 /* YYPGOTO[NTERM-NUM]. */
1942 static const short int yypgoto[] =
1944 -399, 361, 362, 363, 274, 279, -198, -399, 0, -19,
1945 407, 9, -399, -399, -399, 113, -399, -399, -177, -307,
1946 -398, -399, -236, -399, -299, 7, -399, -212, -399, -399,
1947 -25, 263, -210, -399, 391, 398, -69, -109, -180, 179,
1948 -399, -399, 482, -399, -399, -399, -399, -399, -399, -399,
1949 -399, -399, -399, -399, 418, -399, -399, -399, -399, -399,
1950 -399, -369, -73, 100, -158, -399, 454, -399, -399, -399,
1951 -399, -399, 42, 137, -399, -399, -399, -399
1954 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1955 positive, shift that token. If negative, reduce the rule which
1956 number is the opposite. If zero, do what YYDEFACT says.
1957 If YYTABLE_NINF, syntax error. */
1958 #define YYTABLE_NINF -176
1959 static const short int yytable[] =
1961 11, 75, 376, 328, 191, 279, 281, 98, 296, 13,
1962 198, 295, 114, 451, 295, 84, 11, 392, 23, 20,
1963 422, 392, 338, 87, 104, 13, 105, 424, 329, 330,
1964 297, 343, 326, 21, 24, -55, -55, 140, 60, 61,
1965 192, 100, 63, 64, 65, 66, 102, 1, 2, 314,
1966 3, 4, 1, 142, 143, 3, 302, 423, 137, 306,
1967 307, 308, 309, 310, 423, 137, 313, 338, 348, 138,
1968 129, 104, 338, 105, 102, 67, 237, 325, 344, 25,
1969 129, 455, 141, 317, 318, 349, 11, 370, 510, 28,
1970 29, 30, 31, 32, 33, 34, 196, 35, 342, 441,
1971 391, 319, 320, 442, 388, 26, 317, 318, 234, 235,
1972 60, 61, 238, 100, 63, 64, 65, 66, 532, 1,
1973 2, 27, 3, 4, 319, 320, 79, 80, 60, 61,
1974 199, 100, 108, 109, 110, 66, 40, 1, 2, 409,
1975 3, 4, 529, 88, 546, 540, 99, 67, 317, 318,
1976 77, 78, 517, 126, 144, 145, 518, 82, 390, 338,
1977 127, 539, 496, 83, 497, 67, 319, 320, 68, 517,
1978 403, 69, 545, 521, 70, 54, 71, 101, 348, 291,
1979 392, 55, 416, 373, 104, 36, 105, 300, 301, 291,
1980 303, 304, 291, 291, 291, 291, 291, 311, 312, 291,
1981 56, 333, 334, 335, 336, 337, 288, 129, 46, 47,
1982 48, 58, 338, 49, 345, 346, 347, 487, 365, 339,
1983 365, 365, 428, 365, 430, 431, 432, 392, 84, 392,
1984 365, 104, 191, 105, 1, 378, 91, 3, 365, 365,
1985 68, 543, 92, 69, 375, 104, 70, 105, 71, 135,
1986 315, 316, 104, 341, 105, 482, 106, 107, 68, 317,
1987 318, 69, 394, 395, 70, 36, 71, 280, 192, 401,
1988 93, 95, 196, 371, 372, 96, 391, 319, 320, 97,
1989 133, 2, 534, 475, 4, 536, 42, 134, 43, 196,
1990 389, 291, 293, -56, 104, 294, 105, 365, 365, 365,
1991 -57, 146, 194, 232, 233, 365, 230, 236, 500, 501,
1992 502, 239, 270, 271, 272, 365, 365, 530, 273, 274,
1993 317, 318, 282, 283, 284, 285, 286, 411, 443, 444,
1994 445, 446, 289, 541, 295, 448, 449, 391, 319, 320,
1995 115, 116, 117, 118, 119, 120, 327, 331, 379, 365,
1996 332, 365, 352, 387, 365, 291, 429, 291, 291, 291,
1997 365, 365, 435, 380, 381, 382, 383, 384, 397, 398,
1998 473, 474, 399, 400, 404, 405, 406, 407, 408, 402,
1999 414, 450, 417, 365, 365, 418, 365, 365, 427, 433,
2000 434, 365, 438, 367, 368, 439, 369, 440, 452, 365,
2001 447, 454, 456, 377, 453, 457, -175, 507, 458, 508,
2002 509, 385, 386, 472, 459, 460, 291, 462, 365, -63,
2003 1, 2, 477, 3, 4, 5, 365, 486, 441, 464,
2004 466, 6, 7, 491, 467, 468, 471, 476, 513, 478,
2005 479, 291, 291, 291, 488, 480, 491, 481, 495, 499,
2006 8, 483, 515, 9, 505, 365, 506, 10, 423, 514,
2007 365, 519, 526, 528, 522, 537, 523, 524, 544, 547,
2008 419, 420, 421, 535, 365, 365, 548, 549, 426, 365,
2009 552, 553, 365, 555, 298, 222, 223, 224, 436, 437,
2010 299, 525, 533, 124, 511, 323, 139, 136, 41, 60,
2011 61, 123, 100, 108, 109, 110, 66, 90, 1, 2,
2012 483, 3, 4, 503, 425, 0, 0, 0, 0, 0,
2013 0, 0, 461, 0, 463, 0, -174, 465, 0, 0,
2014 0, 0, 0, 469, 470, 0, 67, 0, 0, -63,
2015 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2016 0, 6, 7, 0, 0, 0, 489, 490, 0, 493,
2017 494, 0, 0, 0, 498, 0, 0, 0, 0, 0,
2018 8, 0, 504, 9, 0, 0, 0, 10, 242, 243,
2019 244, 245, 246, 247, 248, 249, 250, 251, 0, 0,
2020 0, 516, 0, 0, 0, 60, 61, 0, 0, 520,
2021 0, 0, 0, 0, 1, 2, 0, 3, 4, 0,
2022 147, 0, 253, 254, 0, 0, 0, 0, 0, 0,
2023 0, 0, 0, 148, 149, 0, 0, 0, 538, 68,
2024 0, 0, 69, 542, 0, 70, 0, 71, 340, 0,
2025 0, 0, 0, 0, 0, 0, 0, 550, 551, 0,
2026 0, 0, 554, 0, 0, 556, 150, 151, 152, 153,
2027 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2028 164, 165, 166, 0, 0, 0, 0, 0, 0, 0,
2029 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
2030 265, 266, 267, 268, 0, 0, 0, 0, 167, 168,
2031 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2032 179, 0, 180, 0, 181, 182, 183, 0, 0, 0,
2033 0, 0, 0, 0, 104, 0, 105, 0, 184, 0,
2034 0, 185, 0, 186, 0, 187, 353, 354, 60, 61,
2035 355, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2036 3, 4, 0, 356, 357, 358, 0, 0, 0, 0,
2037 0, 0, 0, 0, 0, 0, 359, 360, 0, 0,
2038 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2039 0, 60, 61, 361, 100, 108, 109, 110, 66, 0,
2040 1, 2, 0, 3, 4, 0, 0, 0, 0, 150,
2041 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
2042 161, 162, 163, 164, 165, 166, 0, 0, 67, 60,
2043 61, 0, 62, 63, 64, 65, 66, 0, 1, 2,
2044 0, 3, 4, 0, 0, 0, 0, 0, 0, 0,
2045 0, 167, 168, 169, 170, 171, 172, 173, 174, 175,
2046 176, 177, 178, 179, 0, 180, 67, 181, 182, 183,
2047 0, 353, 354, 60, 61, 355, 0, 104, 0, 105,
2048 0, 0, 1, 2, 362, 3, 4, 0, 356, 357,
2049 358, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050 0, 359, 360, 0, 0, 0, 0, 0, 0, 0,
2051 0, 0, 0, 0, 0, 0, 0, 0, 361, 0,
2052 0, 68, 0, 0, 69, 0, 275, 70, 0, 71,
2053 0, 0, 0, 0, 150, 151, 152, 153, 154, 155,
2054 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2055 166, 0, 0, 0, 0, 0, 0, 0, 0, 68,
2056 0, 0, 69, 0, 0, 70, 0, 71, 0, 0,
2057 0, 0, 0, 0, 0, 0, 167, 168, 169, 170,
2058 171, 172, 173, 174, 175, 176, 177, 178, 179, 0,
2059 180, 0, 181, 182, 183, 353, 354, 0, 0, 355,
2060 0, 0, 0, 0, 0, 0, 0, 0, 0, 362,
2061 0, 0, 356, 357, 358, 0, 0, 0, 0, 0,
2062 0, 0, 0, 0, 0, 359, 360, 0, 0, 0,
2063 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2064 0, 0, 361, 0, 60, 61, 0, 100, 108, 109,
2065 110, 66, 0, 1, 2, 0, 3, 4, 150, 151,
2066 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
2067 162, 163, 164, 165, 166, 0, 0, 0, 0, 0,
2068 0, 67, 0, 0, 0, 0, 60, 61, 0, 100,
2069 63, 64, 65, 66, 0, 1, 2, 0, 3, 4,
2070 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2071 177, 178, 179, 128, 180, 0, 181, 182, 183, 0,
2072 0, 0, 0, 67, 0, 60, 61, 0, 100, 63,
2073 64, 65, 66, 362, 1, 2, 0, 3, 4, 0,
2074 0, 60, 61, 0, 100, 63, 64, 65, 66, 0,
2075 1, 2, 322, 3, 4, 0, 0, 0, 0, 0,
2076 60, 61, 67, 100, 63, 64, 65, 66, 410, 1,
2077 2, 0, 3, 4, 68, 0, 0, 69, 67, 0,
2078 70, 0, 71, 0, 0, 0, 0, 485, 0, 60,
2079 61, 0, 100, 63, 64, 65, 66, 67, 1, 2,
2080 0, 3, 4, 0, 0, 60, 61, 0, 195, 63,
2081 64, 65, 66, 0, 1, 2, 68, 3, 4, 69,
2082 0, 0, 70, 0, 71, 0, 67, 60, 61, 0,
2083 100, 108, 109, 110, 66, 0, 1, 2, 0, 3,
2084 4, 0, 67, 0, 60, 61, 0, 290, 63, 64,
2085 65, 66, 0, 1, 2, 68, 3, 4, 69, 0,
2086 0, 70, 0, 71, 67, 0, 0, 0, 0, 0,
2087 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2088 0, 67, 0, 0, 0, 0, 0, 0, 0, 0,
2089 68, 0, 0, 69, 0, 0, 70, 0, 71, 0,
2090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 68,
2092 0, 0, 69, 0, 0, 70, 0, 71, 0, 0,
2093 0, 0, 0, 0, 0, 68, 0, 0, 69, 0,
2094 0, 70, 0, 71, 0, 0, 0, 0, 0, 0,
2095 0, 0, 0, 201, 0, 0, 0, 68, 0, 0,
2096 69, 0, 0, 70, 0, 278, 0, 0, 0, 0,
2097 0, 202, 203, 0, 68, 0, 0, 69, 0, 0,
2098 70, 0, 71, 204, 205, 206, 207, 208, 209, 150,
2099 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
2100 161, 162, 163, 164, 210, 211, 0, 0, 0, 0,
2101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2102 0, 0, 0, 0, 0, 0, 212, 213, 214, 0,
2103 0, 215, 168, 169, 170, 171, 172, 173, 174, 175,
2104 176, 177, 178, 179, 216, 217, 218, 219, 220, 221
2107 static const short int yycheck[] =
2109 0, 26, 301, 239, 113, 185, 186, 4, 206, 0,
2110 23, 9, 81, 411, 9, 16, 16, 324, 132, 45,
2111 9, 328, 133, 24, 134, 16, 136, 9, 240, 241,
2112 207, 142, 142, 59, 50, 3, 4, 106, 5, 6,
2113 113, 8, 9, 10, 11, 12, 71, 14, 15, 226,
2114 17, 18, 14, 21, 22, 17, 214, 46, 133, 217,
2115 218, 219, 220, 221, 46, 133, 224, 133, 29, 144,
2116 95, 134, 133, 136, 99, 42, 144, 140, 144, 132,
2117 105, 142, 107, 110, 111, 46, 86, 297, 486, 35,
2118 36, 37, 38, 39, 40, 41, 121, 43, 278, 133,
2119 127, 128, 129, 137, 314, 13, 110, 111, 133, 134,
2120 5, 6, 137, 8, 9, 10, 11, 12, 516, 14,
2121 15, 132, 17, 18, 128, 129, 27, 28, 5, 6,
2122 143, 8, 9, 10, 11, 12, 0, 14, 15, 351,
2123 17, 18, 140, 144, 542, 140, 143, 42, 110, 111,
2124 37, 38, 133, 133, 3, 4, 137, 44, 316, 133,
2125 140, 530, 461, 50, 463, 42, 128, 129, 135, 133,
2126 144, 138, 541, 137, 141, 132, 143, 144, 29, 204,
2127 487, 132, 362, 133, 134, 131, 136, 212, 213, 214,
2128 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
2129 138, 270, 271, 272, 273, 274, 197, 232, 35, 36,
2130 37, 17, 133, 40, 283, 284, 285, 453, 291, 140,
2131 293, 294, 380, 296, 382, 383, 384, 534, 16, 536,
2132 303, 134, 341, 136, 14, 138, 17, 17, 311, 312,
2133 135, 31, 17, 138, 133, 134, 141, 136, 143, 144,
2134 106, 107, 134, 278, 136, 137, 77, 78, 135, 110,
2135 111, 138, 331, 332, 141, 131, 143, 144, 341, 338,
2136 17, 136, 297, 298, 299, 4, 127, 128, 129, 4,
2137 139, 15, 518, 441, 18, 521, 39, 139, 41, 314,
2138 315, 316, 9, 7, 134, 12, 136, 370, 371, 372,
2139 7, 7, 4, 133, 137, 378, 17, 142, 466, 467,
2140 468, 137, 136, 136, 136, 388, 389, 515, 136, 136,
2141 110, 111, 17, 136, 136, 136, 133, 352, 397, 398,
2142 399, 400, 48, 531, 9, 404, 405, 127, 128, 129,
2143 53, 54, 55, 56, 57, 58, 142, 136, 133, 422,
2144 136, 424, 136, 31, 427, 380, 381, 382, 383, 384,
2145 433, 434, 387, 133, 133, 133, 133, 133, 133, 133,
2146 439, 440, 133, 133, 133, 133, 31, 17, 4, 142,
2147 52, 406, 133, 456, 457, 133, 459, 460, 138, 133,
2148 133, 464, 133, 293, 294, 133, 296, 133, 133, 472,
2149 142, 17, 12, 303, 137, 12, 0, 476, 136, 478,
2150 479, 311, 312, 438, 133, 133, 441, 4, 491, 13,
2151 14, 15, 137, 17, 18, 19, 499, 452, 133, 133,
2152 133, 25, 26, 458, 133, 133, 136, 133, 17, 133,
2153 133, 466, 467, 468, 133, 137, 471, 137, 133, 133,
2154 44, 451, 138, 47, 137, 528, 137, 51, 46, 133,
2155 533, 140, 46, 12, 137, 4, 137, 137, 133, 12,
2156 370, 371, 372, 140, 547, 548, 12, 133, 378, 552,
2157 12, 64, 555, 12, 210, 124, 124, 124, 388, 389,
2158 211, 510, 517, 86, 487, 232, 105, 99, 16, 5,
2159 6, 83, 8, 9, 10, 11, 12, 53, 14, 15,
2160 510, 17, 18, 471, 377, -1, -1, -1, -1, -1,
2161 -1, -1, 422, -1, 424, -1, 0, 427, -1, -1,
2162 -1, -1, -1, 433, 434, -1, 42, -1, -1, 13,
2163 14, 15, -1, 17, 18, 19, -1, -1, -1, -1,
2164 -1, 25, 26, -1, -1, -1, 456, 457, -1, 459,
2165 460, -1, -1, -1, 464, -1, -1, -1, -1, -1,
2166 44, -1, 472, 47, -1, -1, -1, 51, 83, 84,
2167 85, 86, 87, 88, 89, 90, 91, 92, -1, -1,
2168 -1, 491, -1, -1, -1, 5, 6, -1, -1, 499,
2169 -1, -1, -1, -1, 14, 15, -1, 17, 18, -1,
2170 20, -1, 21, 22, -1, -1, -1, -1, -1, -1,
2171 -1, -1, -1, 33, 34, -1, -1, -1, 528, 135,
2172 -1, -1, 138, 533, -1, 141, -1, 143, 144, -1,
2173 -1, -1, -1, -1, -1, -1, -1, 547, 548, -1,
2174 -1, -1, 552, -1, -1, 555, 66, 67, 68, 69,
2175 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2176 80, 81, 82, -1, -1, -1, -1, -1, -1, -1,
2177 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
2178 99, 100, 101, 102, -1, -1, -1, -1, 108, 109,
2179 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2180 120, -1, 122, -1, 124, 125, 126, -1, -1, -1,
2181 -1, -1, -1, -1, 134, -1, 136, -1, 138, -1,
2182 -1, 141, -1, 143, -1, 145, 3, 4, 5, 6,
2183 7, -1, -1, -1, -1, -1, -1, 14, 15, -1,
2184 17, 18, -1, 20, 21, 22, -1, -1, -1, -1,
2185 -1, -1, -1, -1, -1, -1, 33, 34, -1, -1,
2186 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2187 -1, 5, 6, 50, 8, 9, 10, 11, 12, -1,
2188 14, 15, -1, 17, 18, -1, -1, -1, -1, 66,
2189 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2190 77, 78, 79, 80, 81, 82, -1, -1, 42, 5,
2191 6, -1, 8, 9, 10, 11, 12, -1, 14, 15,
2192 -1, 17, 18, -1, -1, -1, -1, -1, -1, -1,
2193 -1, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2194 117, 118, 119, 120, -1, 122, 42, 124, 125, 126,
2195 -1, 3, 4, 5, 6, 7, -1, 134, -1, 136,
2196 -1, -1, 14, 15, 141, 17, 18, -1, 20, 21,
2197 22, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2198 -1, 33, 34, -1, -1, -1, -1, -1, -1, -1,
2199 -1, -1, -1, -1, -1, -1, -1, -1, 50, -1,
2200 -1, 135, -1, -1, 138, -1, 140, 141, -1, 143,
2201 -1, -1, -1, -1, 66, 67, 68, 69, 70, 71,
2202 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2203 82, -1, -1, -1, -1, -1, -1, -1, -1, 135,
2204 -1, -1, 138, -1, -1, 141, -1, 143, -1, -1,
2205 -1, -1, -1, -1, -1, -1, 108, 109, 110, 111,
2206 112, 113, 114, 115, 116, 117, 118, 119, 120, -1,
2207 122, -1, 124, 125, 126, 3, 4, -1, -1, 7,
2208 -1, -1, -1, -1, -1, -1, -1, -1, -1, 141,
2209 -1, -1, 20, 21, 22, -1, -1, -1, -1, -1,
2210 -1, -1, -1, -1, -1, 33, 34, -1, -1, -1,
2211 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2212 -1, -1, 50, -1, 5, 6, -1, 8, 9, 10,
2213 11, 12, -1, 14, 15, -1, 17, 18, 66, 67,
2214 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2215 78, 79, 80, 81, 82, -1, -1, -1, -1, -1,
2216 -1, 42, -1, -1, -1, -1, 5, 6, -1, 8,
2217 9, 10, 11, 12, -1, 14, 15, -1, 17, 18,
2218 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2219 118, 119, 120, 32, 122, -1, 124, 125, 126, -1,
2220 -1, -1, -1, 42, -1, 5, 6, -1, 8, 9,
2221 10, 11, 12, 141, 14, 15, -1, 17, 18, -1,
2222 -1, 5, 6, -1, 8, 9, 10, 11, 12, -1,
2223 14, 15, 32, 17, 18, -1, -1, -1, -1, -1,
2224 5, 6, 42, 8, 9, 10, 11, 12, 32, 14,
2225 15, -1, 17, 18, 135, -1, -1, 138, 42, -1,
2226 141, -1, 143, -1, -1, -1, -1, 32, -1, 5,
2227 6, -1, 8, 9, 10, 11, 12, 42, 14, 15,
2228 -1, 17, 18, -1, -1, 5, 6, -1, 8, 9,
2229 10, 11, 12, -1, 14, 15, 135, 17, 18, 138,
2230 -1, -1, 141, -1, 143, -1, 42, 5, 6, -1,
2231 8, 9, 10, 11, 12, -1, 14, 15, -1, 17,
2232 18, -1, 42, -1, 5, 6, -1, 8, 9, 10,
2233 11, 12, -1, 14, 15, 135, 17, 18, 138, -1,
2234 -1, 141, -1, 143, 42, -1, -1, -1, -1, -1,
2235 -1, 135, -1, -1, 138, -1, -1, 141, -1, 143,
2236 -1, 42, -1, -1, -1, -1, -1, -1, -1, -1,
2237 135, -1, -1, 138, -1, -1, 141, -1, 143, -1,
2238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2239 -1, -1, -1, -1, -1, -1, -1, -1, -1, 135,
2240 -1, -1, 138, -1, -1, 141, -1, 143, -1, -1,
2241 -1, -1, -1, -1, -1, 135, -1, -1, 138, -1,
2242 -1, 141, -1, 143, -1, -1, -1, -1, -1, -1,
2243 -1, -1, -1, 30, -1, -1, -1, 135, -1, -1,
2244 138, -1, -1, 141, -1, 143, -1, -1, -1, -1,
2245 -1, 48, 49, -1, 135, -1, -1, 138, -1, -1,
2246 141, -1, 143, 60, 61, 62, 63, 64, 65, 66,
2247 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2248 77, 78, 79, 80, 81, 82, -1, -1, -1, -1,
2249 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2250 -1, -1, -1, -1, -1, -1, 103, 104, 105, -1,
2251 -1, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2252 117, 118, 119, 120, 121, 122, 123, 124, 125, 126
2255 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2256 symbol of state STATE-NUM. */
2257 static const unsigned char yystos[] =
2259 0, 14, 15, 17, 18, 19, 25, 26, 44, 47,
2260 51, 154, 156, 157, 158, 186, 187, 188, 190, 189,
2261 45, 59, 195, 132, 50, 132, 13, 132, 35, 36,
2262 37, 38, 39, 40, 41, 43, 131, 159, 160, 161,
2263 0, 188, 39, 41, 162, 205, 35, 36, 37, 40,
2264 163, 202, 204, 211, 132, 132, 138, 196, 17, 194,
2265 5, 6, 8, 9, 10, 11, 12, 42, 135, 138,
2266 141, 143, 154, 157, 175, 176, 208, 161, 161, 27,
2267 28, 185, 161, 161, 16, 212, 213, 24, 144, 203,
2268 212, 17, 17, 17, 197, 136, 4, 4, 4, 143,
2269 8, 144, 176, 181, 134, 136, 185, 185, 9, 10,
2270 11, 152, 153, 176, 182, 53, 54, 55, 56, 57,
2271 58, 164, 200, 200, 156, 216, 133, 140, 32, 176,
2272 177, 179, 180, 139, 139, 144, 181, 133, 144, 180,
2273 182, 176, 21, 22, 3, 4, 7, 20, 33, 34,
2274 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2275 76, 77, 78, 79, 80, 81, 82, 108, 109, 110,
2276 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2277 122, 124, 125, 126, 138, 141, 143, 145, 147, 148,
2278 149, 183, 208, 191, 4, 8, 176, 178, 23, 143,
2279 201, 30, 48, 49, 60, 61, 62, 63, 64, 65,
2280 81, 82, 103, 104, 105, 108, 121, 122, 123, 124,
2281 125, 126, 147, 148, 149, 214, 220, 221, 222, 223,
2282 17, 166, 133, 137, 176, 176, 142, 144, 176, 137,
2283 192, 193, 83, 84, 85, 86, 87, 88, 89, 90,
2284 91, 92, 150, 21, 22, 89, 90, 91, 92, 93,
2285 94, 95, 96, 97, 98, 99, 100, 101, 102, 151,
2286 136, 136, 136, 136, 136, 140, 182, 184, 143, 184,
2287 144, 184, 17, 136, 136, 136, 133, 173, 157, 48,
2288 8, 176, 210, 9, 12, 9, 152, 164, 150, 151,
2289 176, 176, 210, 176, 176, 217, 210, 210, 210, 210,
2290 210, 176, 176, 210, 164, 106, 107, 110, 111, 128,
2291 129, 165, 32, 177, 168, 140, 142, 142, 168, 173,
2292 173, 136, 136, 182, 182, 182, 182, 182, 133, 140,
2293 144, 176, 184, 142, 144, 182, 182, 182, 29, 46,
2294 171, 174, 136, 3, 4, 7, 20, 21, 22, 33,
2295 34, 50, 141, 183, 207, 208, 209, 209, 209, 209,
2296 178, 176, 176, 133, 170, 133, 170, 209, 138, 133,
2297 133, 133, 133, 133, 133, 209, 209, 31, 178, 176,
2298 210, 127, 165, 167, 182, 182, 219, 133, 133, 133,
2299 133, 182, 142, 144, 133, 133, 31, 17, 4, 173,
2300 32, 176, 198, 199, 52, 206, 184, 133, 133, 209,
2301 209, 209, 9, 46, 9, 219, 209, 138, 210, 176,
2302 210, 210, 210, 133, 133, 176, 209, 209, 133, 133,
2303 133, 133, 137, 182, 182, 182, 182, 142, 182, 182,
2304 176, 166, 133, 137, 17, 142, 12, 12, 136, 133,
2305 133, 209, 4, 209, 133, 209, 133, 133, 133, 209,
2306 209, 136, 176, 182, 182, 210, 133, 137, 133, 133,
2307 137, 137, 137, 154, 155, 32, 176, 168, 133, 209,
2308 209, 176, 218, 209, 209, 133, 170, 170, 209, 133,
2309 210, 210, 210, 218, 209, 137, 137, 182, 182, 182,
2310 166, 171, 172, 17, 133, 138, 209, 133, 137, 140,
2311 209, 137, 137, 137, 137, 155, 46, 169, 12, 140,
2312 152, 215, 166, 176, 168, 140, 168, 4, 209, 207,
2313 140, 152, 209, 31, 133, 207, 166, 12, 12, 133,
2314 209, 209, 12, 64, 209, 12, 209
2317 #define yyerrok (yyerrstatus = 0)
2318 #define yyclearin (yychar = YYEMPTY)
2319 #define YYEMPTY (-2)
2322 #define YYACCEPT goto yyacceptlab
2323 #define YYABORT goto yyabortlab
2324 #define YYERROR goto yyerrorlab
2327 /* Like YYERROR except do call yyerror. This remains here temporarily
2328 to ease the transition to the new meaning of YYERROR, for GCC.
2329 Once GCC version 2 has supplanted version 1, this can go. */
2331 #define YYFAIL goto yyerrlab
2333 #define YYRECOVERING() (!!yyerrstatus)
2335 #define YYBACKUP(Token, Value) \
2337 if (yychar == YYEMPTY && yylen == 1) \
2341 yytoken = YYTRANSLATE (yychar); \
2347 yyerror (YY_("syntax error: cannot back up")); \
2354 #define YYERRCODE 256
2357 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2358 If N is 0, then set CURRENT to the empty location which ends
2359 the previous symbol: RHS[0] (always defined). */
2361 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2362 #ifndef YYLLOC_DEFAULT
2363 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2367 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2368 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2369 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2370 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2374 (Current).first_line = (Current).last_line = \
2375 YYRHSLOC (Rhs, 0).last_line; \
2376 (Current).first_column = (Current).last_column = \
2377 YYRHSLOC (Rhs, 0).last_column; \
2383 /* YY_LOCATION_PRINT -- Print the location on the stream.
2384 This macro was not mandated originally: define only if we know
2385 we won't break user code: when these are the locations we know. */
2387 #ifndef YY_LOCATION_PRINT
2388 # if YYLTYPE_IS_TRIVIAL
2389 # define YY_LOCATION_PRINT(File, Loc) \
2390 fprintf (File, "%d.%d-%d.%d", \
2391 (Loc).first_line, (Loc).first_column, \
2392 (Loc).last_line, (Loc).last_column)
2394 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2399 /* YYLEX -- calling `yylex' with the right arguments. */
2402 # define YYLEX yylex (YYLEX_PARAM)
2404 # define YYLEX yylex ()
2407 /* Enable debugging if requested. */
2411 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2412 # define YYFPRINTF fprintf
2415 # define YYDPRINTF(Args) \
2421 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2425 YYFPRINTF (stderr, "%s ", Title); \
2426 yysymprint (stderr, \
2428 YYFPRINTF (stderr, "\n"); \
2432 /*------------------------------------------------------------------.
2433 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2435 `------------------------------------------------------------------*/
2437 #if defined (__STDC__) || defined (__cplusplus)
2439 yy_stack_print (short int *bottom, short int *top)
2442 yy_stack_print (bottom, top)
2447 YYFPRINTF (stderr, "Stack now");
2448 for (/* Nothing. */; bottom <= top; ++bottom)
2449 YYFPRINTF (stderr, " %d", *bottom);
2450 YYFPRINTF (stderr, "\n");
2453 # define YY_STACK_PRINT(Bottom, Top) \
2456 yy_stack_print ((Bottom), (Top)); \
2460 /*------------------------------------------------.
2461 | Report that the YYRULE is going to be reduced. |
2462 `------------------------------------------------*/
2464 #if defined (__STDC__) || defined (__cplusplus)
2466 yy_reduce_print (int yyrule)
2469 yy_reduce_print (yyrule)
2474 unsigned long int yylno = yyrline[yyrule];
2475 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2477 /* Print the symbols being reduced, and their result. */
2478 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2479 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2480 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2483 # define YY_REDUCE_PRINT(Rule) \
2486 yy_reduce_print (Rule); \
2489 /* Nonzero means print parse trace. It is left uninitialized so that
2490 multiple parsers can coexist. */
2492 #else /* !YYDEBUG */
2493 # define YYDPRINTF(Args)
2494 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2495 # define YY_STACK_PRINT(Bottom, Top)
2496 # define YY_REDUCE_PRINT(Rule)
2497 #endif /* !YYDEBUG */
2500 /* YYINITDEPTH -- initial size of the parser's stacks. */
2502 # define YYINITDEPTH 200
2505 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2506 if the built-in stack extension method is used).
2508 Do not make this value too large; the results are undefined if
2509 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2510 evaluated with infinite-precision integer arithmetic. */
2513 # define YYMAXDEPTH 10000
2521 # if defined (__GLIBC__) && defined (_STRING_H)
2522 # define yystrlen strlen
2524 /* Return the length of YYSTR. */
2526 # if defined (__STDC__) || defined (__cplusplus)
2527 yystrlen (const char *yystr)
2533 const char *yys = yystr;
2535 while (*yys++ != '\0')
2538 return yys - yystr - 1;
2544 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2545 # define yystpcpy stpcpy
2547 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2550 # if defined (__STDC__) || defined (__cplusplus)
2551 yystpcpy (char *yydest, const char *yysrc)
2553 yystpcpy (yydest, yysrc)
2559 const char *yys = yysrc;
2561 while ((*yyd++ = *yys++) != '\0')
2570 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2571 quotes and backslashes, so that it's suitable for yyerror. The
2572 heuristic is that double-quoting is unnecessary unless the string
2573 contains an apostrophe, a comma, or backslash (other than
2574 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2575 null, do not copy; instead, return the length of what the result
2578 yytnamerr (char *yyres, const char *yystr)
2583 char const *yyp = yystr;
2590 goto do_not_strip_quotes;
2594 goto do_not_strip_quotes;
2607 do_not_strip_quotes: ;
2611 return yystrlen (yystr);
2613 return yystpcpy (yyres, yystr) - yyres;
2617 #endif /* YYERROR_VERBOSE */
2622 /*--------------------------------.
2623 | Print this symbol on YYOUTPUT. |
2624 `--------------------------------*/
2626 #if defined (__STDC__) || defined (__cplusplus)
2628 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2631 yysymprint (yyoutput, yytype, yyvaluep)
2637 /* Pacify ``unused variable'' warnings. */
2640 if (yytype < YYNTOKENS)
2641 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2643 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2647 if (yytype < YYNTOKENS)
2648 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2655 YYFPRINTF (yyoutput, ")");
2658 #endif /* ! YYDEBUG */
2659 /*-----------------------------------------------.
2660 | Release the memory associated to this symbol. |
2661 `-----------------------------------------------*/
2663 #if defined (__STDC__) || defined (__cplusplus)
2665 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2668 yydestruct (yymsg, yytype, yyvaluep)
2674 /* Pacify ``unused variable'' warnings. */
2679 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2690 /* Prevent warnings from -Wmissing-prototypes. */
2692 #ifdef YYPARSE_PARAM
2693 # if defined (__STDC__) || defined (__cplusplus)
2694 int yyparse (void *YYPARSE_PARAM);
2698 #else /* ! YYPARSE_PARAM */
2699 #if defined (__STDC__) || defined (__cplusplus)
2704 #endif /* ! YYPARSE_PARAM */
2708 /* The look-ahead symbol. */
2711 /* The semantic value of the look-ahead symbol. */
2714 /* Number of syntax errors so far. */
2723 #ifdef YYPARSE_PARAM
2724 # if defined (__STDC__) || defined (__cplusplus)
2725 int yyparse (void *YYPARSE_PARAM)
2727 int yyparse (YYPARSE_PARAM)
2728 void *YYPARSE_PARAM;
2730 #else /* ! YYPARSE_PARAM */
2731 #if defined (__STDC__) || defined (__cplusplus)
2745 /* Number of tokens to shift before error messages enabled. */
2747 /* Look-ahead token as an internal (translated) token number. */
2750 /* Three stacks and their tools:
2751 `yyss': related to states,
2752 `yyvs': related to semantic values,
2753 `yyls': related to locations.
2755 Refer to the stacks thru separate pointers, to allow yyoverflow
2756 to reallocate them elsewhere. */
2758 /* The state stack. */
2759 short int yyssa[YYINITDEPTH];
2760 short int *yyss = yyssa;
2763 /* The semantic value stack. */
2764 YYSTYPE yyvsa[YYINITDEPTH];
2765 YYSTYPE *yyvs = yyvsa;
2770 #define YYPOPSTACK (yyvsp--, yyssp--)
2772 YYSIZE_T yystacksize = YYINITDEPTH;
2774 /* The variables used to return semantic value and location from the
2779 /* When reducing, the number of symbols on the RHS of the reduced
2783 YYDPRINTF ((stderr, "Starting parse\n"));
2788 yychar = YYEMPTY; /* Cause a token to be read. */
2790 /* Initialize stack pointers.
2791 Waste one element of value and location stack
2792 so that they stay on the same level as the state stack.
2793 The wasted elements are never initialized. */
2800 /*------------------------------------------------------------.
2801 | yynewstate -- Push a new state, which is found in yystate. |
2802 `------------------------------------------------------------*/
2804 /* In all cases, when you get here, the value and location stacks
2805 have just been pushed. so pushing a state here evens the stacks.
2812 if (yyss + yystacksize - 1 <= yyssp)
2814 /* Get the current used size of the three stacks, in elements. */
2815 YYSIZE_T yysize = yyssp - yyss + 1;
2819 /* Give user a chance to reallocate the stack. Use copies of
2820 these so that the &'s don't force the real ones into
2822 YYSTYPE *yyvs1 = yyvs;
2823 short int *yyss1 = yyss;
2826 /* Each stack pointer address is followed by the size of the
2827 data in use in that stack, in bytes. This used to be a
2828 conditional around just the two extra args, but that might
2829 be undefined if yyoverflow is a macro. */
2830 yyoverflow (YY_("memory exhausted"),
2831 &yyss1, yysize * sizeof (*yyssp),
2832 &yyvs1, yysize * sizeof (*yyvsp),
2839 #else /* no yyoverflow */
2840 # ifndef YYSTACK_RELOCATE
2841 goto yyexhaustedlab;
2843 /* Extend the stack our own way. */
2844 if (YYMAXDEPTH <= yystacksize)
2845 goto yyexhaustedlab;
2847 if (YYMAXDEPTH < yystacksize)
2848 yystacksize = YYMAXDEPTH;
2851 short int *yyss1 = yyss;
2852 union yyalloc *yyptr =
2853 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2855 goto yyexhaustedlab;
2856 YYSTACK_RELOCATE (yyss);
2857 YYSTACK_RELOCATE (yyvs);
2859 # undef YYSTACK_RELOCATE
2861 YYSTACK_FREE (yyss1);
2864 #endif /* no yyoverflow */
2866 yyssp = yyss + yysize - 1;
2867 yyvsp = yyvs + yysize - 1;
2870 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2871 (unsigned long int) yystacksize));
2873 if (yyss + yystacksize - 1 <= yyssp)
2877 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2886 /* Do appropriate processing given the current state. */
2887 /* Read a look-ahead token if we need one and don't already have one. */
2890 /* First try to decide what to do without reference to look-ahead token. */
2892 yyn = yypact[yystate];
2893 if (yyn == YYPACT_NINF)
2896 /* Not known => get a look-ahead token if don't already have one. */
2898 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2899 if (yychar == YYEMPTY)
2901 YYDPRINTF ((stderr, "Reading a token: "));
2905 if (yychar <= YYEOF)
2907 yychar = yytoken = YYEOF;
2908 YYDPRINTF ((stderr, "Now at end of input.\n"));
2912 yytoken = YYTRANSLATE (yychar);
2913 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2916 /* If the proper action on seeing token YYTOKEN is to reduce or to
2917 detect an error, take that action. */
2919 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2924 if (yyn == 0 || yyn == YYTABLE_NINF)
2933 /* Shift the look-ahead token. */
2934 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2936 /* Discard the token being shifted unless it is eof. */
2937 if (yychar != YYEOF)
2943 /* Count tokens shifted since error; after three, turn off error
2952 /*-----------------------------------------------------------.
2953 | yydefault -- do the default action for the current state. |
2954 `-----------------------------------------------------------*/
2956 yyn = yydefact[yystate];
2962 /*-----------------------------.
2963 | yyreduce -- Do a reduction. |
2964 `-----------------------------*/
2966 /* yyn is the number of a rule to reduce with. */
2969 /* If YYLEN is nonzero, implement the default value of the action:
2972 Otherwise, the following line sets YYVAL to garbage.
2973 This behavior is undocumented and Bison
2974 users should not rely upon it. Assigning to YYVAL
2975 unconditionally makes the parser a bit smaller, and it avoids a
2976 GCC warning that YYVAL may be used uninitialized. */
2977 yyval = yyvsp[1-yylen];
2980 YY_REDUCE_PRINT (yyn);
2984 #line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
2985 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
2989 #line 1039 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
2990 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
2994 #line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
2995 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
2999 #line 1040 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3000 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3004 #line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3005 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3009 #line 1041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3010 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3014 #line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3015 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3019 #line 1042 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3020 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3024 #line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3025 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3029 #line 1043 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3030 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3034 #line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3035 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3039 #line 1047 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3040 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3044 #line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3045 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3049 #line 1048 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3050 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3054 #line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3055 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3059 #line 1049 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3060 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3064 #line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3065 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3069 #line 1050 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3070 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3074 #line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3075 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3079 #line 1051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3080 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3084 #line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3085 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3089 #line 1052 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3090 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3094 #line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3095 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3099 #line 1053 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3100 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3104 #line 1054 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3105 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3109 #line 1055 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3110 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3114 #line 1064 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3115 { (yyval.StrVal) = 0; ;}
3119 #line 1068 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3121 (yyval.StrVal) = (yyvsp[-1].StrVal);
3127 #line 1072 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3135 #line 1079 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3137 (yyval.StrVal) = (yyvsp[-1].StrVal);
3143 #line 1083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3151 #line 1089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3152 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3156 #line 1090 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3157 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3161 #line 1091 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3162 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3166 #line 1092 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3167 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3171 #line 1093 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3172 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3176 #line 1097 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3177 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3181 #line 1098 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3182 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3186 #line 1099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3187 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3191 #line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3192 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3196 #line 1104 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3197 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3201 #line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3202 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3206 #line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3207 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3211 #line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3212 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3216 #line 1114 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3217 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3221 #line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3222 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3226 #line 1116 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3227 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3231 #line 1117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3232 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3236 #line 1118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3237 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3241 #line 1121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3242 { (yyval.UIntVal) = CallingConv::C; ;}
3246 #line 1122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3247 { (yyval.UIntVal) = CallingConv::C; ;}
3251 #line 1123 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3252 { (yyval.UIntVal) = CallingConv::Fast; ;}
3256 #line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3257 { (yyval.UIntVal) = CallingConv::Cold; ;}
3261 #line 1125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3262 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3266 #line 1126 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3267 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3271 #line 1127 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3273 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3274 GEN_ERROR("Calling conv too large");
3275 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3281 #line 1134 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3282 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3286 #line 1135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3287 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3291 #line 1136 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3292 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
3296 #line 1137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3297 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
3301 #line 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3302 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3306 #line 1141 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3308 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3313 #line 1146 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3314 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3318 #line 1150 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3319 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3323 #line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3325 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3330 #line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3331 { (yyval.UIntVal) = 0; ;}
3335 #line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3337 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3338 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3339 GEN_ERROR("Alignment must be a power of two");
3345 #line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3346 { (yyval.UIntVal) = 0; ;}
3350 #line 1166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3352 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3353 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3354 GEN_ERROR("Alignment must be a power of two");
3360 #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3362 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3363 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3364 GEN_ERROR("Invalid character in section name");
3365 (yyval.StrVal) = (yyvsp[0].StrVal);
3371 #line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3372 { (yyval.StrVal) = 0; ;}
3376 #line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3377 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3381 #line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3386 #line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3391 #line 1190 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3393 CurGV->setSection((yyvsp[0].StrVal));
3394 free((yyvsp[0].StrVal));
3400 #line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3402 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3403 GEN_ERROR("Alignment must be a power of two");
3404 CurGV->setAlignment((yyvsp[0].UInt64Val));
3410 #line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3412 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3418 #line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3420 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3426 #line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3428 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3429 GEN_ERROR("Cannot form a pointer to a basic block");
3430 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3431 delete (yyvsp[-1].TypeVal);
3437 #line 1226 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3438 { // Named types are also simple types...
3439 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3441 (yyval.TypeVal) = new PATypeHolder(tmp);
3446 #line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3447 { // Type UpReference
3448 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3449 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3450 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3451 (yyval.TypeVal) = new PATypeHolder(OT);
3452 UR_OUT("New Upreference!\n");
3458 #line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3460 std::vector<const Type*> Params;
3461 std::vector<FunctionType::ParameterAttributes> Attrs;
3462 Attrs.push_back((yyvsp[0].ParamAttrs));
3463 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3464 Params.push_back(I->Ty->get());
3465 if (I->Ty->get() != Type::VoidTy)
3466 Attrs.push_back(I->Attrs);
3468 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3469 if (isVarArg) Params.pop_back();
3471 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3472 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3473 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3474 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3480 #line 1257 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3482 std::vector<const Type*> Params;
3483 std::vector<FunctionType::ParameterAttributes> Attrs;
3484 Attrs.push_back((yyvsp[0].ParamAttrs));
3485 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3486 Params.push_back(I->Ty->get());
3487 if (I->Ty->get() != Type::VoidTy)
3488 Attrs.push_back(I->Attrs);
3490 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3491 if (isVarArg) Params.pop_back();
3493 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3494 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3495 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3501 #line 1275 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3502 { // Sized array type?
3503 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3504 delete (yyvsp[-1].TypeVal);
3510 #line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3511 { // Packed array type?
3512 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3513 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3514 GEN_ERROR("Unsigned result not equal to signed result");
3515 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3516 GEN_ERROR("Element type of a PackedType must be primitive");
3517 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3518 GEN_ERROR("Vector length should be a power of 2");
3519 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3520 delete (yyvsp[-1].TypeVal);
3526 #line 1292 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3527 { // Structure type?
3528 std::vector<const Type*> Elements;
3529 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3530 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3531 Elements.push_back(*I);
3533 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3534 delete (yyvsp[-1].TypeList);
3540 #line 1302 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3541 { // Empty structure type?
3542 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3548 #line 1306 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3550 std::vector<const Type*> Elements;
3551 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3552 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3553 Elements.push_back(*I);
3555 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3556 delete (yyvsp[-2].TypeList);
3562 #line 1316 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3563 { // Empty structure type?
3564 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3570 #line 1323 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3572 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3573 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3578 #line 1330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3580 if (!UpRefs.empty())
3581 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3582 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3583 GEN_ERROR("LLVM functions cannot return aggregate types");
3584 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3589 #line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3591 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3596 #line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3598 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3599 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3605 #line 1347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3607 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3613 #line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3615 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3616 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3617 TWA.Ty = new PATypeHolder(Type::VoidTy);
3618 (yyval.TypeWithAttrsList)->push_back(TWA);
3624 #line 1362 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3626 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3627 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3628 TWA.Ty = new PATypeHolder(Type::VoidTy);
3629 (yyval.TypeWithAttrsList)->push_back(TWA);
3635 #line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3637 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3643 #line 1377 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3645 (yyval.TypeList) = new std::list<PATypeHolder>();
3646 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3652 #line 1382 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3654 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3660 #line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3661 { // Nonempty unsized arr
3662 if (!UpRefs.empty())
3663 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3664 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3666 GEN_ERROR("Cannot make array constant with type: '" +
3667 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3668 const Type *ETy = ATy->getElementType();
3669 int NumElements = ATy->getNumElements();
3671 // Verify that we have the correct size...
3672 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3673 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3674 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3675 itostr(NumElements) + "");
3677 // Verify all elements are correct type!
3678 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3679 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3680 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3681 ETy->getDescription() +"' as required!\nIt is of type '"+
3682 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3685 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3686 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3692 #line 1421 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3694 if (!UpRefs.empty())
3695 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3696 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3698 GEN_ERROR("Cannot make array constant with type: '" +
3699 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3701 int NumElements = ATy->getNumElements();
3702 if (NumElements != -1 && NumElements != 0)
3703 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3704 " arguments, but has size of " + itostr(NumElements) +"");
3705 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3706 delete (yyvsp[-2].TypeVal);
3712 #line 1437 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3714 if (!UpRefs.empty())
3715 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3716 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3718 GEN_ERROR("Cannot make array constant with type: '" +
3719 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3721 int NumElements = ATy->getNumElements();
3722 const Type *ETy = ATy->getElementType();
3723 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3724 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3725 GEN_ERROR("Can't build string constant of size " +
3726 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3727 " when array has size " + itostr(NumElements) + "");
3728 std::vector<Constant*> Vals;
3729 if (ETy == Type::Int8Ty) {
3730 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3731 C != (unsigned char*)EndStr; ++C)
3732 Vals.push_back(ConstantInt::get(ETy, *C));
3734 free((yyvsp[0].StrVal));
3735 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3737 free((yyvsp[0].StrVal));
3738 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3739 delete (yyvsp[-2].TypeVal);
3745 #line 1466 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3746 { // Nonempty unsized arr
3747 if (!UpRefs.empty())
3748 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3749 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3751 GEN_ERROR("Cannot make packed constant with type: '" +
3752 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3753 const Type *ETy = PTy->getElementType();
3754 int NumElements = PTy->getNumElements();
3756 // Verify that we have the correct size...
3757 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3758 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3759 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3760 itostr(NumElements) + "");
3762 // Verify all elements are correct type!
3763 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3764 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3765 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3766 ETy->getDescription() +"' as required!\nIt is of type '"+
3767 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3770 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3771 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3777 #line 1494 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3779 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3781 GEN_ERROR("Cannot make struct constant with type: '" +
3782 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3784 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3785 GEN_ERROR("Illegal number of initializers for structure type");
3787 // Check to ensure that constants are compatible with the type initializer!
3788 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3789 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3790 GEN_ERROR("Expected type '" +
3791 STy->getElementType(i)->getDescription() +
3792 "' for element #" + utostr(i) +
3793 " of structure initializer");
3795 // Check to ensure that Type is not packed
3796 if (STy->isPacked())
3797 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3799 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3800 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3806 #line 1519 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3808 if (!UpRefs.empty())
3809 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3810 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3812 GEN_ERROR("Cannot make struct constant with type: '" +
3813 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3815 if (STy->getNumContainedTypes() != 0)
3816 GEN_ERROR("Illegal number of initializers for structure type");
3818 // Check to ensure that Type is not packed
3819 if (STy->isPacked())
3820 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3822 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3823 delete (yyvsp[-2].TypeVal);
3829 #line 1538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3831 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3833 GEN_ERROR("Cannot make struct constant with type: '" +
3834 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3836 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3837 GEN_ERROR("Illegal number of initializers for structure type");
3839 // Check to ensure that constants are compatible with the type initializer!
3840 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3841 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3842 GEN_ERROR("Expected type '" +
3843 STy->getElementType(i)->getDescription() +
3844 "' for element #" + utostr(i) +
3845 " of structure initializer");
3847 // Check to ensure that Type is packed
3848 if (!STy->isPacked())
3849 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3851 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3852 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3858 #line 1563 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3860 if (!UpRefs.empty())
3861 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3862 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3864 GEN_ERROR("Cannot make struct constant with type: '" +
3865 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3867 if (STy->getNumContainedTypes() != 0)
3868 GEN_ERROR("Illegal number of initializers for structure type");
3870 // Check to ensure that Type is packed
3871 if (!STy->isPacked())
3872 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3874 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3875 delete (yyvsp[-4].TypeVal);
3881 #line 1582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3883 if (!UpRefs.empty())
3884 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3885 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3887 GEN_ERROR("Cannot make null pointer constant with type: '" +
3888 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3890 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3891 delete (yyvsp[-1].TypeVal);
3897 #line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3899 if (!UpRefs.empty())
3900 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3901 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3902 delete (yyvsp[-1].TypeVal);
3908 #line 1601 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3910 if (!UpRefs.empty())
3911 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3912 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3914 GEN_ERROR("Global const reference must be a pointer type");
3916 // ConstExprs can exist in the body of a function, thus creating
3917 // GlobalValues whenever they refer to a variable. Because we are in
3918 // the context of a function, getValNonImprovising will search the functions
3919 // symbol table instead of the module symbol table for the global symbol,
3920 // which throws things all off. To get around this, we just tell
3921 // getValNonImprovising that we are at global scope here.
3923 Function *SavedCurFn = CurFun.CurrentFunction;
3924 CurFun.CurrentFunction = 0;
3926 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3929 CurFun.CurrentFunction = SavedCurFn;
3931 // If this is an initializer for a constant pointer, which is referencing a
3932 // (currently) undefined variable, create a stub now that shall be replaced
3933 // in the future with the right type of variable.
3936 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3937 const PointerType *PT = cast<PointerType>(Ty);
3939 // First check to see if the forward references value is already created!
3940 PerModuleInfo::GlobalRefsType::iterator I =
3941 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3943 if (I != CurModule.GlobalRefs.end()) {
3944 V = I->second; // Placeholder already exists, use it...
3945 (yyvsp[0].ValIDVal).destroy();
3948 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
3949 Name = (yyvsp[0].ValIDVal).Name;
3950 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
3951 GEN_ERROR("Invalid reference to global");
3953 // Create the forward referenced global.
3955 if (const FunctionType *FTy =
3956 dyn_cast<FunctionType>(PT->getElementType())) {
3957 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3958 CurModule.CurrentModule);
3960 GV = new GlobalVariable(PT->getElementType(), false,
3961 GlobalValue::ExternalLinkage, 0,
3962 Name, CurModule.CurrentModule);
3965 // Keep track of the fact that we have a forward ref to recycle it
3966 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3971 (yyval.ConstVal) = cast<GlobalValue>(V);
3972 delete (yyvsp[-1].TypeVal); // Free the type handle
3978 #line 1667 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3980 if (!UpRefs.empty())
3981 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3982 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3983 GEN_ERROR("Mismatched types for constant expression: " +
3984 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
3985 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3986 delete (yyvsp[-1].TypeVal);
3992 #line 1677 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3994 if (!UpRefs.empty())
3995 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3996 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3997 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3998 GEN_ERROR("Cannot create a null initialized value of this type");
3999 (yyval.ConstVal) = Constant::getNullValue(Ty);
4000 delete (yyvsp[-1].TypeVal);
4006 #line 1687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4007 { // integral constants
4008 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4009 GEN_ERROR("Constant value doesn't fit in type");
4010 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
4016 #line 1693 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4017 { // integral constants
4018 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4019 GEN_ERROR("Constant value doesn't fit in type");
4020 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
4026 #line 1699 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4027 { // Boolean constants
4028 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4029 (yyval.ConstVal) = ConstantInt::getTrue();
4035 #line 1704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4036 { // Boolean constants
4037 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4038 (yyval.ConstVal) = ConstantInt::getFalse();
4044 #line 1709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4045 { // Float & Double constants
4046 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4047 GEN_ERROR("Floating point constant invalid for type");
4048 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4054 #line 1717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4056 if (!UpRefs.empty())
4057 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4058 Constant *Val = (yyvsp[-3].ConstVal);
4059 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4060 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4061 GEN_ERROR("invalid cast opcode for cast from '" +
4062 Val->getType()->getDescription() + "' to '" +
4063 DestTy->getDescription() + "'");
4064 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4065 delete (yyvsp[-1].TypeVal);
4070 #line 1729 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4072 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4073 GEN_ERROR("GetElementPtr requires a pointer operand");
4076 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
4078 GEN_ERROR("Index list invalid for constant getelementptr");
4080 SmallVector<Constant*, 8> IdxVec;
4081 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4082 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4083 IdxVec.push_back(C);
4085 GEN_ERROR("Indices to constant getelementptr must be constants");
4087 delete (yyvsp[-1].ValueList);
4089 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4095 #line 1750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4097 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4098 GEN_ERROR("Select condition must be of boolean type");
4099 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4100 GEN_ERROR("Select operand types must match");
4101 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4107 #line 1758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4109 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4110 GEN_ERROR("Binary operator types must match");
4112 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4117 #line 1764 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4119 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4120 GEN_ERROR("Logical operator types must match");
4121 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4122 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4123 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4124 GEN_ERROR("Logical operator requires integral operands");
4126 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4132 #line 1775 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4134 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4135 GEN_ERROR("icmp operand types must match");
4136 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4141 #line 1780 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4143 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4144 GEN_ERROR("fcmp operand types must match");
4145 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4150 #line 1785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4152 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4153 GEN_ERROR("Invalid extractelement operands");
4154 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4160 #line 1791 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4162 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4163 GEN_ERROR("Invalid insertelement operands");
4164 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4170 #line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4172 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4173 GEN_ERROR("Invalid shufflevector operands");
4174 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4180 #line 1806 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4182 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4188 #line 1810 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4190 (yyval.ConstVector) = new std::vector<Constant*>();
4191 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4197 #line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4198 { (yyval.BoolVal) = false; ;}
4202 #line 1818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4203 { (yyval.BoolVal) = true; ;}
4207 #line 1829 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4209 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4210 CurModule.ModuleDone();
4216 #line 1834 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4218 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4219 CurModule.ModuleDone();
4225 #line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4226 { CurFun.isDeclare = false; ;}
4230 #line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4232 CurFun.FunctionDone();
4238 #line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4239 { CurFun.isDeclare = true; ;}
4243 #line 1851 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4250 #line 1854 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4257 #line 1857 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4259 // Emit an error if there are any unresolved types left.
4260 if (!CurModule.LateResolveTypes.empty()) {
4261 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4262 if (DID.Type == ValID::LocalName) {
4263 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4265 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4273 #line 1869 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4275 if (!UpRefs.empty())
4276 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4277 // Eagerly resolve types. This is not an optimization, this is a
4278 // requirement that is due to the fact that we could have this:
4280 // %list = type { %list * }
4281 // %list = type { %list * } ; repeated type decl
4283 // If types are not resolved eagerly, then the two types will not be
4284 // determined to be the same type!
4286 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4288 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4290 // If this is a named type that is not a redefinition, add it to the slot
4292 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4295 delete (yyvsp[0].TypeVal);
4301 #line 1893 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4303 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4305 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4307 // If this is a named type that is not a redefinition, add it to the slot
4309 CurModule.Types.push_back((yyvsp[0].PrimType));
4316 #line 1904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4318 /* "Externally Visible" Linkage */
4319 if ((yyvsp[0].ConstVal) == 0)
4320 GEN_ERROR("Global value initializer is not a constant");
4321 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4322 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4328 #line 1911 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4335 #line 1914 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4337 if ((yyvsp[0].ConstVal) == 0)
4338 GEN_ERROR("Global value initializer is not a constant");
4339 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4345 #line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4352 #line 1922 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4354 if (!UpRefs.empty())
4355 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4356 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4358 delete (yyvsp[0].TypeVal);
4363 #line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4371 #line 1932 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4378 #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4385 #line 1941 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4387 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4388 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4389 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4390 free((yyvsp[0].StrVal));
4392 if (AsmSoFar.empty())
4393 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4395 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4401 #line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4403 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4404 free((yyvsp[0].StrVal));
4409 #line 1958 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4411 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4412 free((yyvsp[0].StrVal));
4417 #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4419 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4420 free((yyvsp[0].StrVal));
4426 #line 1970 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4428 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4429 free((yyvsp[0].StrVal));
4435 #line 1975 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4442 #line 1984 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4444 if (!UpRefs.empty())
4445 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4446 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4447 GEN_ERROR("void typed arguments are invalid");
4448 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4449 (yyval.ArgList) = (yyvsp[-4].ArgList);
4450 (yyvsp[-4].ArgList)->push_back(E);
4456 #line 1994 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4458 if (!UpRefs.empty())
4459 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4460 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4461 GEN_ERROR("void typed arguments are invalid");
4462 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4463 (yyval.ArgList) = new ArgListType;
4464 (yyval.ArgList)->push_back(E);
4470 #line 2005 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4472 (yyval.ArgList) = (yyvsp[0].ArgList);
4478 #line 2009 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4480 (yyval.ArgList) = (yyvsp[-2].ArgList);
4481 struct ArgListEntry E;
4482 E.Ty = new PATypeHolder(Type::VoidTy);
4484 E.Attrs = FunctionType::NoAttributeSet;
4485 (yyval.ArgList)->push_back(E);
4491 #line 2018 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4493 (yyval.ArgList) = new ArgListType;
4494 struct ArgListEntry E;
4495 E.Ty = new PATypeHolder(Type::VoidTy);
4497 E.Attrs = FunctionType::NoAttributeSet;
4498 (yyval.ArgList)->push_back(E);
4504 #line 2027 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4506 (yyval.ArgList) = 0;
4512 #line 2033 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4514 UnEscapeLexed((yyvsp[-6].StrVal));
4515 std::string FunctionName((yyvsp[-6].StrVal));
4516 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4518 // Check the function result for abstractness if this is a define. We should
4519 // have no abstract types at this point
4520 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4521 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4523 std::vector<const Type*> ParamTypeList;
4524 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4525 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4526 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4527 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4528 const Type* Ty = I->Ty->get();
4529 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4530 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4531 ParamTypeList.push_back(Ty);
4532 if (Ty != Type::VoidTy)
4533 ParamAttrs.push_back(I->Attrs);
4537 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4538 if (isVarArg) ParamTypeList.pop_back();
4540 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4542 const PointerType *PFT = PointerType::get(FT);
4543 delete (yyvsp[-7].TypeVal);
4546 if (!FunctionName.empty()) {
4547 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4549 ID = ValID::createGlobalID(CurModule.Values[PFT].size());
4553 // See if this function was forward referenced. If so, recycle the object.
4554 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4555 // Move the function to the end of the list, from whereever it was
4556 // previously inserted.
4557 Fn = cast<Function>(FWRef);
4558 CurModule.CurrentModule->getFunctionList().remove(Fn);
4559 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4560 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4561 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4562 // If this is the case, either we need to be a forward decl, or it needs
4564 if (!CurFun.isDeclare && !Fn->isDeclaration())
4565 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4567 // Make sure to strip off any argument names so we can't get conflicts.
4568 if (Fn->isDeclaration())
4569 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4572 } else { // Not already defined?
4573 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4574 CurModule.CurrentModule);
4576 InsertValue(Fn, CurModule.Values);
4579 CurFun.FunctionStart(Fn);
4581 if (CurFun.isDeclare) {
4582 // If we have declaration, always overwrite linkage. This will allow us to
4583 // correctly handle cases, when pointer to function is passed as argument to
4584 // another function.
4585 Fn->setLinkage(CurFun.Linkage);
4586 Fn->setVisibility(CurFun.Visibility);
4588 Fn->setCallingConv((yyvsp[-8].UIntVal));
4589 Fn->setAlignment((yyvsp[0].UIntVal));
4590 if ((yyvsp[-1].StrVal)) {
4591 Fn->setSection((yyvsp[-1].StrVal));
4592 free((yyvsp[-1].StrVal));
4595 // Add all of the arguments we parsed to the function...
4596 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4597 if (isVarArg) { // Nuke the last entry
4598 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&&
4599 "Not a varargs marker!");
4600 delete (yyvsp[-4].ArgList)->back().Ty;
4601 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4603 Function::arg_iterator ArgIt = Fn->arg_begin();
4605 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) {
4606 delete I->Ty; // Delete the typeholder...
4607 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4613 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4620 #line 2140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4622 (yyval.FunctionVal) = CurFun.CurrentFunction;
4624 // Make sure that we keep track of the linkage type even if there was a
4625 // previous "declare".
4626 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4627 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4632 #line 2151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4634 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4640 #line 2156 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4642 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4643 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4644 (yyval.FunctionVal) = CurFun.CurrentFunction;
4645 CurFun.FunctionDone();
4651 #line 2168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4653 (yyval.BoolVal) = false;
4659 #line 2172 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4661 (yyval.BoolVal) = true;
4667 #line 2177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4668 { // A reference to a direct constant
4669 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4675 #line 2181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4677 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4683 #line 2185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4684 { // Perhaps it's an FP constant?
4685 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4691 #line 2189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4693 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4699 #line 2193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4701 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4707 #line 2197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4709 (yyval.ValIDVal) = ValID::createNull();
4715 #line 2201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4717 (yyval.ValIDVal) = ValID::createUndef();
4723 #line 2205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4724 { // A vector zero constant.
4725 (yyval.ValIDVal) = ValID::createZeroInit();
4731 #line 2209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4732 { // Nonempty unsized packed vector
4733 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4734 int NumElements = (yyvsp[-1].ConstVector)->size();
4736 PackedType* pt = PackedType::get(ETy, NumElements);
4737 PATypeHolder* PTy = new PATypeHolder(
4745 // Verify all elements are correct type!
4746 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4747 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4748 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4749 ETy->getDescription() +"' as required!\nIt is of type '" +
4750 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4753 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4754 delete PTy; delete (yyvsp[-1].ConstVector);
4760 #line 2234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4762 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4768 #line 2238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4770 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4771 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4772 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4773 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4774 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4775 free((yyvsp[-2].StrVal));
4776 free((yyvsp[0].StrVal));
4782 #line 2252 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4783 { // Is it an integer reference...?
4784 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4790 #line 2256 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4792 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4798 #line 2260 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4799 { // Is it a named reference...?
4800 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4806 #line 2264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4807 { // Is it a named reference...?
4808 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4814 #line 2276 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4816 if (!UpRefs.empty())
4817 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4818 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4819 delete (yyvsp[-1].TypeVal);
4825 #line 2285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4827 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4833 #line 2289 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4834 { // Do not allow functions with 0 basic blocks
4835 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4841 #line 2298 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4843 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4845 InsertValue((yyvsp[0].TermInstVal));
4847 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4848 InsertValue((yyvsp[-2].BasicBlockVal));
4849 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4855 #line 2309 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4857 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4858 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4859 if (CI2->getParent() == 0)
4860 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4861 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4862 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4868 #line 2318 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4870 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
4873 // Make sure to move the basic block to the correct location in the
4874 // function, instead of leaving it inserted wherever it was first
4876 Function::BasicBlockListType &BBL =
4877 CurFun.CurrentFunction->getBasicBlockList();
4878 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4884 #line 2330 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4886 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true);
4889 // Make sure to move the basic block to the correct location in the
4890 // function, instead of leaving it inserted wherever it was first
4892 Function::BasicBlockListType &BBL =
4893 CurFun.CurrentFunction->getBasicBlockList();
4894 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4900 #line 2343 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4901 { // Return with a result...
4902 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4908 #line 2347 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4909 { // Return with no result...
4910 (yyval.TermInstVal) = new ReturnInst();
4916 #line 2351 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4917 { // Unconditional Branch...
4918 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4920 (yyval.TermInstVal) = new BranchInst(tmpBB);
4925 #line 2356 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4927 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
4928 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4930 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4932 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
4934 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4939 #line 2366 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4941 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4943 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4945 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4946 (yyval.TermInstVal) = S;
4948 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4949 E = (yyvsp[-1].JumpTable)->end();
4950 for (; I != E; ++I) {
4951 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4952 S->addCase(CI, I->second);
4954 GEN_ERROR("Switch case is constant, but not a simple integer");
4956 delete (yyvsp[-1].JumpTable);
4962 #line 2385 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4964 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4966 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4968 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4969 (yyval.TermInstVal) = S;
4975 #line 2395 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4978 // Handle the short syntax
4979 const PointerType *PFTy = 0;
4980 const FunctionType *Ty = 0;
4981 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
4982 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4983 // Pull out the types of all of the arguments...
4984 std::vector<const Type*> ParamTypes;
4985 FunctionType::ParamAttrsList ParamAttrs;
4986 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
4987 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
4988 const Type *Ty = I->Val->getType();
4989 if (Ty == Type::VoidTy)
4990 GEN_ERROR("Short call syntax cannot be used with varargs");
4991 ParamTypes.push_back(Ty);
4992 ParamAttrs.push_back(I->Attrs);
4995 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
4996 PFTy = PointerType::get(Ty);
4999 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5001 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5003 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5006 // Check the arguments
5008 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5009 // Make sure no arguments is a good thing!
5010 if (Ty->getNumParams() != 0)
5011 GEN_ERROR("No arguments passed to a function that "
5012 "expects arguments");
5013 } else { // Has arguments?
5014 // Loop through FunctionType's arguments and ensure they are specified
5016 FunctionType::param_iterator I = Ty->param_begin();
5017 FunctionType::param_iterator E = Ty->param_end();
5018 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5020 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5021 if (ArgI->Val->getType() != *I)
5022 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5023 (*I)->getDescription() + "'");
5024 Args.push_back(ArgI->Val);
5027 if (Ty->isVarArg()) {
5029 for (; ArgI != ArgE; ++ArgI)
5030 Args.push_back(ArgI->Val); // push the remaining varargs
5031 } else if (I != E || ArgI != ArgE)
5032 GEN_ERROR("Invalid number of parameters detected");
5035 // Create the InvokeInst
5036 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
5037 II->setCallingConv((yyvsp[-12].UIntVal));
5038 (yyval.TermInstVal) = II;
5039 delete (yyvsp[-8].ValueRefList);
5045 #line 2461 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5047 (yyval.TermInstVal) = new UnwindInst();
5053 #line 2465 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5055 (yyval.TermInstVal) = new UnreachableInst();
5061 #line 2472 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5063 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5064 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5067 GEN_ERROR("May only switch on a constant pool value");
5069 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5071 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5076 #line 2483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5078 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5079 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5083 GEN_ERROR("May only switch on a constant pool value");
5085 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5087 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5092 #line 2496 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5094 // Is this definition named?? if so, assign the name...
5095 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5097 InsertValue((yyvsp[0].InstVal));
5098 (yyval.InstVal) = (yyvsp[0].InstVal);
5104 #line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5105 { // Used for PHI nodes
5106 if (!UpRefs.empty())
5107 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5108 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5109 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5111 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5113 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5114 delete (yyvsp[-5].TypeVal);
5119 #line 2516 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5121 (yyval.PHIList) = (yyvsp[-6].PHIList);
5122 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5124 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5126 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5131 #line 2526 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5133 if (!UpRefs.empty())
5134 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5135 // Used for call and invoke instructions
5136 (yyval.ValueRefList) = new ValueRefList();
5137 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5138 (yyval.ValueRefList)->push_back(E);
5143 #line 2534 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5145 if (!UpRefs.empty())
5146 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5147 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5148 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5149 (yyval.ValueRefList)->push_back(E);
5155 #line 2542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5156 { (yyval.ValueRefList) = new ValueRefList(); ;}
5160 #line 2545 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5161 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5165 #line 2546 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5167 (yyval.ValueList) = (yyvsp[-2].ValueList);
5168 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5174 #line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5176 (yyval.BoolVal) = true;
5182 #line 2557 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5184 (yyval.BoolVal) = false;
5190 #line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5192 if (!UpRefs.empty())
5193 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5194 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5195 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5197 "Arithmetic operator requires integer, FP, or packed operands");
5198 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5199 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5200 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5201 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5202 GEN_ERROR("U/S/FRem not supported on packed types");
5203 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5205 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5207 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5208 if ((yyval.InstVal) == 0)
5209 GEN_ERROR("binary operator returned null");
5210 delete (yyvsp[-3].TypeVal);
5215 #line 2583 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5217 if (!UpRefs.empty())
5218 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5219 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5220 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5221 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5222 GEN_ERROR("Logical operator requires integral operands");
5224 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5226 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5228 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5229 if ((yyval.InstVal) == 0)
5230 GEN_ERROR("binary operator returned null");
5231 delete (yyvsp[-3].TypeVal);
5236 #line 2600 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5238 if (!UpRefs.empty())
5239 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5240 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5241 GEN_ERROR("Packed types not supported by icmp instruction");
5242 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5244 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5246 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5247 if ((yyval.InstVal) == 0)
5248 GEN_ERROR("icmp operator returned null");
5253 #line 2613 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5255 if (!UpRefs.empty())
5256 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5257 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5258 GEN_ERROR("Packed types not supported by fcmp instruction");
5259 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5261 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5263 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5264 if ((yyval.InstVal) == 0)
5265 GEN_ERROR("fcmp operator returned null");
5270 #line 2626 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5272 if (!UpRefs.empty())
5273 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5274 Value* Val = (yyvsp[-2].ValueVal);
5275 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5276 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5277 GEN_ERROR("invalid cast opcode for cast from '" +
5278 Val->getType()->getDescription() + "' to '" +
5279 DestTy->getDescription() + "'");
5280 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5281 delete (yyvsp[0].TypeVal);
5286 #line 2638 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5288 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5289 GEN_ERROR("select condition must be boolean");
5290 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5291 GEN_ERROR("select value types should match");
5292 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5298 #line 2646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5300 if (!UpRefs.empty())
5301 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5302 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5303 delete (yyvsp[0].TypeVal);
5309 #line 2653 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5311 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5312 GEN_ERROR("Invalid extractelement operands");
5313 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5319 #line 2659 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5321 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5322 GEN_ERROR("Invalid insertelement operands");
5323 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5329 #line 2665 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5331 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5332 GEN_ERROR("Invalid shufflevector operands");
5333 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5339 #line 2671 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5341 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5342 if (!Ty->isFirstClassType())
5343 GEN_ERROR("PHI node operands must be of first class type");
5344 (yyval.InstVal) = new PHINode(Ty);
5345 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5346 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5347 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5348 GEN_ERROR("All elements of a PHI node must be of the same type");
5349 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5350 (yyvsp[0].PHIList)->pop_front();
5352 delete (yyvsp[0].PHIList); // Free the list...
5358 #line 2687 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5361 // Handle the short syntax
5362 const PointerType *PFTy = 0;
5363 const FunctionType *Ty = 0;
5364 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5365 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5366 // Pull out the types of all of the arguments...
5367 std::vector<const Type*> ParamTypes;
5368 FunctionType::ParamAttrsList ParamAttrs;
5369 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5370 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5371 const Type *Ty = I->Val->getType();
5372 if (Ty == Type::VoidTy)
5373 GEN_ERROR("Short call syntax cannot be used with varargs");
5374 ParamTypes.push_back(Ty);
5375 ParamAttrs.push_back(I->Attrs);
5378 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5379 PFTy = PointerType::get(Ty);
5382 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5385 // Check the arguments
5387 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5388 // Make sure no arguments is a good thing!
5389 if (Ty->getNumParams() != 0)
5390 GEN_ERROR("No arguments passed to a function that "
5391 "expects arguments");
5392 } else { // Has arguments?
5393 // Loop through FunctionType's arguments and ensure they are specified
5396 FunctionType::param_iterator I = Ty->param_begin();
5397 FunctionType::param_iterator E = Ty->param_end();
5398 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5400 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5401 if (ArgI->Val->getType() != *I)
5402 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5403 (*I)->getDescription() + "'");
5404 Args.push_back(ArgI->Val);
5406 if (Ty->isVarArg()) {
5408 for (; ArgI != ArgE; ++ArgI)
5409 Args.push_back(ArgI->Val); // push the remaining varargs
5410 } else if (I != E || ArgI != ArgE)
5411 GEN_ERROR("Invalid number of parameters detected");
5413 // Create the call node
5414 CallInst *CI = new CallInst(V, Args);
5415 CI->setTailCall((yyvsp[-7].BoolVal));
5416 CI->setCallingConv((yyvsp[-6].UIntVal));
5417 (yyval.InstVal) = CI;
5418 delete (yyvsp[-2].ValueRefList);
5419 delete (yyvsp[-5].TypeVal);
5425 #line 2750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5427 (yyval.InstVal) = (yyvsp[0].InstVal);
5433 #line 2755 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5435 (yyval.BoolVal) = true;
5441 #line 2759 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5443 (yyval.BoolVal) = false;
5449 #line 2766 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5451 if (!UpRefs.empty())
5452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5453 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5454 delete (yyvsp[-1].TypeVal);
5460 #line 2773 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5462 if (!UpRefs.empty())
5463 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5464 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5466 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5467 delete (yyvsp[-4].TypeVal);
5472 #line 2781 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5474 if (!UpRefs.empty())
5475 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5476 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5477 delete (yyvsp[-1].TypeVal);
5483 #line 2788 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5485 if (!UpRefs.empty())
5486 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5487 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5489 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5490 delete (yyvsp[-4].TypeVal);
5495 #line 2796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5497 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5498 GEN_ERROR("Trying to free nonpointer type " +
5499 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5500 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5506 #line 2804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5508 if (!UpRefs.empty())
5509 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5510 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5511 GEN_ERROR("Can't load from nonpointer type: " +
5512 (*(yyvsp[-1].TypeVal))->getDescription());
5513 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5514 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5515 (*(yyvsp[-1].TypeVal))->getDescription());
5516 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5518 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5519 delete (yyvsp[-1].TypeVal);
5524 #line 2818 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5526 if (!UpRefs.empty())
5527 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5528 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5530 GEN_ERROR("Can't store to a nonpointer type: " +
5531 (*(yyvsp[-1].TypeVal))->getDescription());
5532 const Type *ElTy = PT->getElementType();
5533 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5534 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5535 "' into space of type '" + ElTy->getDescription() + "'");
5537 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5539 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5540 delete (yyvsp[-1].TypeVal);
5545 #line 2835 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5547 if (!UpRefs.empty())
5548 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5549 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5550 GEN_ERROR("getelementptr insn requires pointer operand");
5552 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5553 GEN_ERROR("Invalid getelementptr indices for type '" +
5554 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5555 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5557 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5558 delete (yyvsp[-2].TypeVal);
5559 delete (yyvsp[0].ValueList);
5567 /* Line 1126 of yacc.c. */
5568 #line 5569 "llvmAsmParser.tab.c"
5574 YY_STACK_PRINT (yyss, yyssp);
5579 /* Now `shift' the result of the reduction. Determine what state
5580 that goes to, based on the state we popped back to and the rule
5581 number reduced by. */
5585 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5586 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5587 yystate = yytable[yystate];
5589 yystate = yydefgoto[yyn - YYNTOKENS];
5594 /*------------------------------------.
5595 | yyerrlab -- here on detecting error |
5596 `------------------------------------*/
5598 /* If not already recovering from an error, report this error. */
5603 yyn = yypact[yystate];
5605 if (YYPACT_NINF < yyn && yyn < YYLAST)
5607 int yytype = YYTRANSLATE (yychar);
5608 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5609 YYSIZE_T yysize = yysize0;
5611 int yysize_overflow = 0;
5613 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5614 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5618 /* This is so xgettext sees the translatable formats that are
5619 constructed on the fly. */
5620 YY_("syntax error, unexpected %s");
5621 YY_("syntax error, unexpected %s, expecting %s");
5622 YY_("syntax error, unexpected %s, expecting %s or %s");
5623 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5624 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5628 static char const yyunexpected[] = "syntax error, unexpected %s";
5629 static char const yyexpecting[] = ", expecting %s";
5630 static char const yyor[] = " or %s";
5631 char yyformat[sizeof yyunexpected
5632 + sizeof yyexpecting - 1
5633 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5634 * (sizeof yyor - 1))];
5635 char const *yyprefix = yyexpecting;
5637 /* Start YYX at -YYN if negative to avoid negative indexes in
5639 int yyxbegin = yyn < 0 ? -yyn : 0;
5641 /* Stay within bounds of both yycheck and yytname. */
5642 int yychecklim = YYLAST - yyn;
5643 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5646 yyarg[0] = yytname[yytype];
5647 yyfmt = yystpcpy (yyformat, yyunexpected);
5649 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5650 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5652 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5656 yyformat[sizeof yyunexpected - 1] = '\0';
5659 yyarg[yycount++] = yytname[yyx];
5660 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5661 yysize_overflow |= yysize1 < yysize;
5663 yyfmt = yystpcpy (yyfmt, yyprefix);
5667 yyf = YY_(yyformat);
5668 yysize1 = yysize + yystrlen (yyf);
5669 yysize_overflow |= yysize1 < yysize;
5672 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5673 yymsg = (char *) YYSTACK_ALLOC (yysize);
5676 /* Avoid sprintf, as that infringes on the user's name space.
5677 Don't have undefined behavior even if the translation
5678 produced a string with the wrong number of "%s"s. */
5681 while ((*yyp = *yyf))
5683 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5685 yyp += yytnamerr (yyp, yyarg[yyi++]);
5695 YYSTACK_FREE (yymsg);
5699 yyerror (YY_("syntax error"));
5700 goto yyexhaustedlab;
5704 #endif /* YYERROR_VERBOSE */
5705 yyerror (YY_("syntax error"));
5710 if (yyerrstatus == 3)
5712 /* If just tried and failed to reuse look-ahead token after an
5713 error, discard it. */
5715 if (yychar <= YYEOF)
5717 /* Return failure if at end of input. */
5718 if (yychar == YYEOF)
5723 yydestruct ("Error: discarding", yytoken, &yylval);
5728 /* Else will try to reuse look-ahead token after shifting the error
5733 /*---------------------------------------------------.
5734 | yyerrorlab -- error raised explicitly by YYERROR. |
5735 `---------------------------------------------------*/
5738 /* Pacify compilers like GCC when the user code never invokes
5739 YYERROR and the label yyerrorlab therefore never appears in user
5750 /*-------------------------------------------------------------.
5751 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5752 `-------------------------------------------------------------*/
5754 yyerrstatus = 3; /* Each real token shifted decrements this. */
5758 yyn = yypact[yystate];
5759 if (yyn != YYPACT_NINF)
5762 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5770 /* Pop the current state because it cannot handle the error token. */
5775 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5778 YY_STACK_PRINT (yyss, yyssp);
5787 /* Shift the error token. */
5788 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5794 /*-------------------------------------.
5795 | yyacceptlab -- YYACCEPT comes here. |
5796 `-------------------------------------*/
5801 /*-----------------------------------.
5802 | yyabortlab -- YYABORT comes here. |
5803 `-----------------------------------*/
5809 /*-------------------------------------------------.
5810 | yyexhaustedlab -- memory exhaustion comes here. |
5811 `-------------------------------------------------*/
5813 yyerror (YY_("memory exhausted"));
5819 if (yychar != YYEOF && yychar != YYEMPTY)
5820 yydestruct ("Cleanup: discarding lookahead",
5822 while (yyssp != yyss)
5824 yydestruct ("Cleanup: popping",
5825 yystos[*yyssp], yyvsp);
5830 YYSTACK_FREE (yyss);
5836 #line 2852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5839 // common code from the two 'RunVMAsmParser' functions
5840 static Module* RunParser(Module * M) {
5842 llvmAsmlineno = 1; // Reset the current line number...
5843 CurModule.CurrentModule = M;
5848 // Check to make sure the parser succeeded
5851 delete ParserResult;
5855 // Check to make sure that parsing produced a result
5859 // Reset ParserResult variable while saving its value for the result.
5860 Module *Result = ParserResult;
5866 void llvm::GenerateError(const std::string &message, int LineNo) {
5867 if (LineNo == -1) LineNo = llvmAsmlineno;
5868 // TODO: column number in exception
5870 TheParseError->setError(CurFilename, message, LineNo);
5874 int yyerror(const char *ErrorMsg) {
5876 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5877 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5878 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5879 if (yychar == YYEMPTY || yychar == 0)
5880 errMsg += "end-of-file.";
5882 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5883 GenerateError(errMsg);