1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
85 ZEROINITIALIZER = 276,
122 X86_STDCALLCC_TOK = 313,
123 X86_FASTCALLCC_TOK = 314,
189 EXTRACTELEMENT = 380,
201 #define ESINT64VAL 258
202 #define EUINT64VAL 259
203 #define ESAPINTVAL 260
204 #define EUAPINTVAL 261
205 #define LOCALVAL_ID 262
206 #define GLOBALVAL_ID 263
215 #define GLOBALVAR 272
217 #define STRINGCONSTANT 274
218 #define ATSTRINGCONSTANT 275
219 #define ZEROINITIALIZER 276
231 #define DOTDOTDOT 288
237 #define APPENDING 294
238 #define DLLIMPORT 295
239 #define DLLEXPORT 296
240 #define EXTERN_WEAK 297
251 #define SIDEEFFECT 308
254 #define FASTCC_TOK 311
255 #define COLDCC_TOK 312
256 #define X86_STDCALLCC_TOK 313
257 #define X86_FASTCALLCC_TOK 314
258 #define DATALAYOUT 315
264 #define UNREACHABLE 321
307 #define GETELEMENTPTR 364
323 #define EXTRACTELEMENT 380
324 #define INSERTELEMENT 381
325 #define SHUFFLEVECTOR 382
336 /* Copy the first part of user declarations. */
337 #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
339 #include "ParserInternals.h"
340 #include "llvm/CallingConv.h"
341 #include "llvm/InlineAsm.h"
342 #include "llvm/Instructions.h"
343 #include "llvm/Module.h"
344 #include "llvm/ValueSymbolTable.h"
345 #include "llvm/Support/GetElementPtrTypeIterator.h"
346 #include "llvm/Support/CommandLine.h"
347 #include "llvm/ADT/SmallVector.h"
348 #include "llvm/ADT/STLExtras.h"
349 #include "llvm/Support/MathExtras.h"
350 #include "llvm/Support/Streams.h"
359 // The following is a gross hack. In order to rid the libAsmParser library of
360 // exceptions, we have to have a way of getting the yyparse function to go into
361 // an error situation. So, whenever we want an error to occur, the GenerateError
362 // function (see bottom of file) sets TriggerError. Then, at the end of each
363 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
364 // (a goto) to put YACC in error state. Furthermore, several calls to
365 // GenerateError are made from inside productions and they must simulate the
366 // previous exception behavior by exiting the production immediately. We have
367 // replaced these with the GEN_ERROR macro which calls GeneratError and then
368 // immediately invokes YYERROR. This would be so much cleaner if it was a
369 // recursive descent parser.
370 static bool TriggerError = false;
371 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
372 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
374 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
375 int yylex(); // declaration" of xxx warnings.
379 std::string CurFilename;
382 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
383 cl::Hidden, cl::init(false));
386 using namespace llvm;
388 static Module *ParserResult;
390 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
391 // relating to upreferences in the input stream.
393 //#define DEBUG_UPREFS 1
395 #define UR_OUT(X) cerr << X
400 #define YYERROR_VERBOSE 1
402 static GlobalVariable *CurGV;
405 // This contains info used when building the body of a function. It is
406 // destroyed when the function is completed.
408 typedef std::vector<Value *> ValueList; // Numbered defs
411 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
413 static struct PerModuleInfo {
414 Module *CurrentModule;
415 ValueList Values; // Module level numbered definitions
416 ValueList LateResolveValues;
417 std::vector<PATypeHolder> Types;
418 std::map<ValID, PATypeHolder> LateResolveTypes;
420 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
421 /// how they were referenced and on which line of the input they came from so
422 /// that we can resolve them later and print error messages as appropriate.
423 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
425 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
426 // references to global values. Global values may be referenced before they
427 // are defined, and if so, the temporary object that they represent is held
428 // here. This is used for forward references of GlobalValues.
430 typedef std::map<std::pair<const PointerType *,
431 ValID>, GlobalValue*> GlobalRefsType;
432 GlobalRefsType GlobalRefs;
435 // If we could not resolve some functions at function compilation time
436 // (calls to functions before they are defined), resolve them now... Types
437 // are resolved when the constant pool has been completely parsed.
439 ResolveDefinitions(LateResolveValues);
443 // Check to make sure that all global value forward references have been
446 if (!GlobalRefs.empty()) {
447 std::string UndefinedReferences = "Unresolved global references exist:\n";
449 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
451 UndefinedReferences += " " + I->first.first->getDescription() + " " +
452 I->first.second.getName() + "\n";
454 GenerateError(UndefinedReferences);
458 Values.clear(); // Clear out function local definitions
463 // GetForwardRefForGlobal - Check to see if there is a forward reference
464 // for this global. If so, remove it from the GlobalRefs map and return it.
465 // If not, just return null.
466 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
467 // Check to see if there is a forward reference to this global variable...
468 // if there is, eliminate it and patch the reference to use the new def'n.
469 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
470 GlobalValue *Ret = 0;
471 if (I != GlobalRefs.end()) {
478 bool TypeIsUnresolved(PATypeHolder* PATy) {
479 // If it isn't abstract, its resolved
480 const Type* Ty = PATy->get();
481 if (!Ty->isAbstract())
483 // Traverse the type looking for abstract types. If it isn't abstract then
484 // we don't need to traverse that leg of the type.
485 std::vector<const Type*> WorkList, SeenList;
486 WorkList.push_back(Ty);
487 while (!WorkList.empty()) {
488 const Type* Ty = WorkList.back();
489 SeenList.push_back(Ty);
491 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
492 // Check to see if this is an unresolved type
493 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
494 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
495 for ( ; I != E; ++I) {
496 if (I->second.get() == OpTy)
499 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
500 const Type* TheTy = SeqTy->getElementType();
501 if (TheTy->isAbstract() && TheTy != Ty) {
502 std::vector<const Type*>::iterator I = SeenList.begin(),
508 WorkList.push_back(TheTy);
510 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
511 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
512 const Type* TheTy = StrTy->getElementType(i);
513 if (TheTy->isAbstract() && TheTy != Ty) {
514 std::vector<const Type*>::iterator I = SeenList.begin(),
520 WorkList.push_back(TheTy);
531 static struct PerFunctionInfo {
532 Function *CurrentFunction; // Pointer to current function being created
534 ValueList Values; // Keep track of #'d definitions
536 ValueList LateResolveValues;
537 bool isDeclare; // Is this function a forward declararation?
538 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
539 GlobalValue::VisibilityTypes Visibility;
541 /// BBForwardRefs - When we see forward references to basic blocks, keep
542 /// track of them here.
543 std::map<ValID, BasicBlock*> BBForwardRefs;
545 inline PerFunctionInfo() {
548 Linkage = GlobalValue::ExternalLinkage;
549 Visibility = GlobalValue::DefaultVisibility;
552 inline void FunctionStart(Function *M) {
557 void FunctionDone() {
558 // Any forward referenced blocks left?
559 if (!BBForwardRefs.empty()) {
560 GenerateError("Undefined reference to label " +
561 BBForwardRefs.begin()->second->getName());
565 // Resolve all forward references now.
566 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
568 Values.clear(); // Clear out function local definitions
569 BBForwardRefs.clear();
572 Linkage = GlobalValue::ExternalLinkage;
573 Visibility = GlobalValue::DefaultVisibility;
575 } CurFun; // Info for the current function...
577 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
580 //===----------------------------------------------------------------------===//
581 // Code to handle definitions of all the types
582 //===----------------------------------------------------------------------===//
584 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
585 // Things that have names or are void typed don't get slot numbers
586 if (V->hasName() || (V->getType() == Type::VoidTy))
589 // In the case of function values, we have to allow for the forward reference
590 // of basic blocks, which are included in the numbering. Consequently, we keep
591 // track of the next insertion location with NextValNum. When a BB gets
592 // inserted, it could change the size of the CurFun.Values vector.
593 if (&ValueTab == &CurFun.Values) {
594 if (ValueTab.size() <= CurFun.NextValNum)
595 ValueTab.resize(CurFun.NextValNum+1);
596 ValueTab[CurFun.NextValNum++] = V;
599 // For all other lists, its okay to just tack it on the back of the vector.
600 ValueTab.push_back(V);
603 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
605 case ValID::LocalID: // Is it a numbered definition?
606 // Module constants occupy the lowest numbered slots...
607 if (D.Num < CurModule.Types.size())
608 return CurModule.Types[D.Num];
610 case ValID::LocalName: // Is it a named definition?
611 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
612 D.destroy(); // Free old strdup'd memory...
617 GenerateError("Internal parser error: Invalid symbol type reference");
621 // If we reached here, we referenced either a symbol that we don't know about
622 // or an id number that hasn't been read yet. We may be referencing something
623 // forward, so just create an entry to be resolved later and get to it...
625 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
628 if (inFunctionScope()) {
629 if (D.Type == ValID::LocalName) {
630 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
633 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
638 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
639 if (I != CurModule.LateResolveTypes.end())
642 Type *Typ = OpaqueType::get();
643 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
647 // getExistingVal - Look up the value specified by the provided type and
648 // the provided ValID. If the value exists and has already been defined, return
649 // it. Otherwise return null.
651 static Value *getExistingVal(const Type *Ty, const ValID &D) {
652 if (isa<FunctionType>(Ty)) {
653 GenerateError("Functions are not values and "
654 "must be referenced as pointers");
659 case ValID::LocalID: { // Is it a numbered definition?
660 // Check that the number is within bounds.
661 if (D.Num >= CurFun.Values.size())
663 Value *Result = CurFun.Values[D.Num];
664 if (Ty != Result->getType()) {
665 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
666 Result->getType()->getDescription() + "' does not match "
667 "expected type, '" + Ty->getDescription() + "'");
672 case ValID::GlobalID: { // Is it a numbered definition?
673 if (D.Num >= CurModule.Values.size())
675 Value *Result = CurModule.Values[D.Num];
676 if (Ty != Result->getType()) {
677 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
678 Result->getType()->getDescription() + "' does not match "
679 "expected type, '" + Ty->getDescription() + "'");
685 case ValID::LocalName: { // Is it a named definition?
686 if (!inFunctionScope())
688 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
689 Value *N = SymTab.lookup(D.Name);
692 if (N->getType() != Ty)
695 D.destroy(); // Free old strdup'd memory...
698 case ValID::GlobalName: { // Is it a named definition?
699 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
700 Value *N = SymTab.lookup(D.Name);
703 if (N->getType() != Ty)
706 D.destroy(); // Free old strdup'd memory...
710 // Check to make sure that "Ty" is an integral type, and that our
711 // value will fit into the specified type...
712 case ValID::ConstSIntVal: // Is it a constant pool reference??
713 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
714 GenerateError("Signed integral constant '" +
715 itostr(D.ConstPool64) + "' is invalid for type '" +
716 Ty->getDescription() + "'");
719 return ConstantInt::get(Ty, D.ConstPool64, true);
721 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
722 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
723 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
724 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
725 "' is invalid or out of range");
727 } else { // This is really a signed reference. Transmogrify.
728 return ConstantInt::get(Ty, D.ConstPool64, true);
731 return ConstantInt::get(Ty, D.UConstPool64);
734 case ValID::ConstFPVal: // Is it a floating point const pool reference?
735 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
736 GenerateError("FP constant invalid for type");
739 return ConstantFP::get(Ty, D.ConstPoolFP);
741 case ValID::ConstNullVal: // Is it a null value?
742 if (!isa<PointerType>(Ty)) {
743 GenerateError("Cannot create a a non pointer null");
746 return ConstantPointerNull::get(cast<PointerType>(Ty));
748 case ValID::ConstUndefVal: // Is it an undef value?
749 return UndefValue::get(Ty);
751 case ValID::ConstZeroVal: // Is it a zero value?
752 return Constant::getNullValue(Ty);
754 case ValID::ConstantVal: // Fully resolved constant?
755 if (D.ConstantValue->getType() != Ty) {
756 GenerateError("Constant expression type different from required type");
759 return D.ConstantValue;
761 case ValID::InlineAsmVal: { // Inline asm expression
762 const PointerType *PTy = dyn_cast<PointerType>(Ty);
763 const FunctionType *FTy =
764 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
765 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
766 GenerateError("Invalid type for asm constraint string");
769 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
770 D.IAD->HasSideEffects);
771 D.destroy(); // Free InlineAsmDescriptor.
775 assert(0 && "Unhandled case!");
779 assert(0 && "Unhandled case!");
783 // getVal - This function is identical to getExistingVal, except that if a
784 // value is not already defined, it "improvises" by creating a placeholder var
785 // that looks and acts just like the requested variable. When the value is
786 // defined later, all uses of the placeholder variable are replaced with the
789 static Value *getVal(const Type *Ty, const ValID &ID) {
790 if (Ty == Type::LabelTy) {
791 GenerateError("Cannot use a basic block here");
795 // See if the value has already been defined.
796 Value *V = getExistingVal(Ty, ID);
798 if (TriggerError) return 0;
800 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
801 GenerateError("Invalid use of a composite type");
805 // If we reached here, we referenced either a symbol that we don't know about
806 // or an id number that hasn't been read yet. We may be referencing something
807 // forward, so just create an entry to be resolved later and get to it...
809 V = new Argument(Ty);
811 // Remember where this forward reference came from. FIXME, shouldn't we try
812 // to recycle these things??
813 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
816 if (inFunctionScope())
817 InsertValue(V, CurFun.LateResolveValues);
819 InsertValue(V, CurModule.LateResolveValues);
823 /// defineBBVal - This is a definition of a new basic block with the specified
824 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
825 static BasicBlock *defineBBVal(const ValID &ID) {
826 assert(inFunctionScope() && "Can't get basic block at global scope!");
830 // First, see if this was forward referenced
832 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
833 if (BBI != CurFun.BBForwardRefs.end()) {
835 // The forward declaration could have been inserted anywhere in the
836 // function: insert it into the correct place now.
837 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
838 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
840 // We're about to erase the entry, save the key so we can clean it up.
841 ValID Tmp = BBI->first;
843 // Erase the forward ref from the map as its no longer "forward"
844 CurFun.BBForwardRefs.erase(ID);
846 // The key has been removed from the map but so we don't want to leave
847 // strdup'd memory around so destroy it too.
850 // If its a numbered definition, bump the number and set the BB value.
851 if (ID.Type == ValID::LocalID) {
852 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
860 // We haven't seen this BB before and its first mention is a definition.
861 // Just create it and return it.
862 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
863 BB = new BasicBlock(Name, CurFun.CurrentFunction);
864 if (ID.Type == ValID::LocalID) {
865 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
869 ID.destroy(); // Free strdup'd memory
873 /// getBBVal - get an existing BB value or create a forward reference for it.
875 static BasicBlock *getBBVal(const ValID &ID) {
876 assert(inFunctionScope() && "Can't get basic block at global scope!");
880 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
881 if (BBI != CurFun.BBForwardRefs.end()) {
883 } if (ID.Type == ValID::LocalName) {
884 std::string Name = ID.Name;
885 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
887 if (N->getType()->getTypeID() == Type::LabelTyID)
888 BB = cast<BasicBlock>(N);
890 GenerateError("Reference to label '" + Name + "' is actually of type '"+
891 N->getType()->getDescription() + "'");
892 } else if (ID.Type == ValID::LocalID) {
893 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
894 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
895 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
897 GenerateError("Reference to label '%" + utostr(ID.Num) +
898 "' is actually of type '"+
899 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
902 GenerateError("Illegal label reference " + ID.getName());
906 // If its already been defined, return it now.
908 ID.destroy(); // Free strdup'd memory.
912 // Otherwise, this block has not been seen before, create it.
914 if (ID.Type == ValID::LocalName)
916 BB = new BasicBlock(Name, CurFun.CurrentFunction);
918 // Insert it in the forward refs map.
919 CurFun.BBForwardRefs[ID] = BB;
925 //===----------------------------------------------------------------------===//
926 // Code to handle forward references in instructions
927 //===----------------------------------------------------------------------===//
929 // This code handles the late binding needed with statements that reference
930 // values not defined yet... for example, a forward branch, or the PHI node for
933 // This keeps a table (CurFun.LateResolveValues) of all such forward references
934 // and back patchs after we are done.
937 // ResolveDefinitions - If we could not resolve some defs at parsing
938 // time (forward branches, phi functions for loops, etc...) resolve the
942 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
943 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
944 while (!LateResolvers.empty()) {
945 Value *V = LateResolvers.back();
946 LateResolvers.pop_back();
948 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
949 CurModule.PlaceHolderInfo.find(V);
950 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
952 ValID &DID = PHI->second.first;
954 Value *TheRealValue = getExistingVal(V->getType(), DID);
958 V->replaceAllUsesWith(TheRealValue);
960 CurModule.PlaceHolderInfo.erase(PHI);
961 } else if (FutureLateResolvers) {
962 // Functions have their unresolved items forwarded to the module late
964 InsertValue(V, *FutureLateResolvers);
966 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
967 GenerateError("Reference to an invalid definition: '" +DID.getName()+
968 "' of type '" + V->getType()->getDescription() + "'",
972 GenerateError("Reference to an invalid definition: #" +
973 itostr(DID.Num) + " of type '" +
974 V->getType()->getDescription() + "'",
980 LateResolvers.clear();
983 // ResolveTypeTo - A brand new type was just declared. This means that (if
984 // name is not null) things referencing Name can be resolved. Otherwise, things
985 // refering to the number can be resolved. Do this now.
987 static void ResolveTypeTo(char *Name, const Type *ToTy) {
989 if (Name) D = ValID::createLocalName(Name);
990 else D = ValID::createLocalID(CurModule.Types.size());
992 std::map<ValID, PATypeHolder>::iterator I =
993 CurModule.LateResolveTypes.find(D);
994 if (I != CurModule.LateResolveTypes.end()) {
995 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
996 CurModule.LateResolveTypes.erase(I);
1000 // setValueName - Set the specified value to the name given. The name may be
1001 // null potentially, in which case this is a noop. The string passed in is
1002 // assumed to be a malloc'd string buffer, and is free'd by this function.
1004 static void setValueName(Value *V, char *NameStr) {
1005 if (!NameStr) return;
1006 std::string Name(NameStr); // Copy string
1007 free(NameStr); // Free old string
1009 if (V->getType() == Type::VoidTy) {
1010 GenerateError("Can't assign name '" + Name+"' to value with void type");
1014 assert(inFunctionScope() && "Must be in function scope!");
1015 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1016 if (ST.lookup(Name)) {
1017 GenerateError("Redefinition of value '" + Name + "' of type '" +
1018 V->getType()->getDescription() + "'");
1026 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1027 /// this is a declaration, otherwise it is a definition.
1028 static GlobalVariable *
1029 ParseGlobalVariable(char *NameStr,
1030 GlobalValue::LinkageTypes Linkage,
1031 GlobalValue::VisibilityTypes Visibility,
1032 bool isConstantGlobal, const Type *Ty,
1033 Constant *Initializer) {
1034 if (isa<FunctionType>(Ty)) {
1035 GenerateError("Cannot declare global vars of function type");
1039 const PointerType *PTy = PointerType::get(Ty);
1043 Name = NameStr; // Copy string
1044 free(NameStr); // Free old string
1047 // See if this global value was forward referenced. If so, recycle the
1050 if (!Name.empty()) {
1051 ID = ValID::createGlobalName((char*)Name.c_str());
1053 ID = ValID::createGlobalID(CurModule.Values.size());
1056 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1057 // Move the global to the end of the list, from whereever it was
1058 // previously inserted.
1059 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1060 CurModule.CurrentModule->getGlobalList().remove(GV);
1061 CurModule.CurrentModule->getGlobalList().push_back(GV);
1062 GV->setInitializer(Initializer);
1063 GV->setLinkage(Linkage);
1064 GV->setVisibility(Visibility);
1065 GV->setConstant(isConstantGlobal);
1066 InsertValue(GV, CurModule.Values);
1070 // If this global has a name
1071 if (!Name.empty()) {
1072 // if the global we're parsing has an initializer (is a definition) and
1073 // has external linkage.
1074 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1075 // If there is already a global with external linkage with this name
1076 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1077 // If we allow this GVar to get created, it will be renamed in the
1078 // symbol table because it conflicts with an existing GVar. We can't
1079 // allow redefinition of GVars whose linking indicates that their name
1080 // must stay the same. Issue the error.
1081 GenerateError("Redefinition of global variable named '" + Name +
1082 "' of type '" + Ty->getDescription() + "'");
1087 // Otherwise there is no existing GV to use, create one now.
1088 GlobalVariable *GV =
1089 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1090 CurModule.CurrentModule);
1091 GV->setVisibility(Visibility);
1092 InsertValue(GV, CurModule.Values);
1096 // setTypeName - Set the specified type to the name given. The name may be
1097 // null potentially, in which case this is a noop. The string passed in is
1098 // assumed to be a malloc'd string buffer, and is freed by this function.
1100 // This function returns true if the type has already been defined, but is
1101 // allowed to be redefined in the specified context. If the name is a new name
1102 // for the type plane, it is inserted and false is returned.
1103 static bool setTypeName(const Type *T, char *NameStr) {
1104 assert(!inFunctionScope() && "Can't give types function-local names!");
1105 if (NameStr == 0) return false;
1107 std::string Name(NameStr); // Copy string
1108 free(NameStr); // Free old string
1110 // We don't allow assigning names to void type
1111 if (T == Type::VoidTy) {
1112 GenerateError("Can't assign name '" + Name + "' to the void type");
1116 // Set the type name, checking for conflicts as we do so.
1117 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1119 if (AlreadyExists) { // Inserting a name that is already defined???
1120 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1121 assert(Existing && "Conflict but no matching type?!");
1123 // There is only one case where this is allowed: when we are refining an
1124 // opaque type. In this case, Existing will be an opaque type.
1125 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1126 // We ARE replacing an opaque type!
1127 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1131 // Otherwise, this is an attempt to redefine a type. That's okay if
1132 // the redefinition is identical to the original. This will be so if
1133 // Existing and T point to the same Type object. In this one case we
1134 // allow the equivalent redefinition.
1135 if (Existing == T) return true; // Yes, it's equal.
1137 // Any other kind of (non-equivalent) redefinition is an error.
1138 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1139 T->getDescription() + "'");
1145 //===----------------------------------------------------------------------===//
1146 // Code for handling upreferences in type names...
1149 // TypeContains - Returns true if Ty directly contains E in it.
1151 static bool TypeContains(const Type *Ty, const Type *E) {
1152 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1153 E) != Ty->subtype_end();
1157 struct UpRefRecord {
1158 // NestingLevel - The number of nesting levels that need to be popped before
1159 // this type is resolved.
1160 unsigned NestingLevel;
1162 // LastContainedTy - This is the type at the current binding level for the
1163 // type. Every time we reduce the nesting level, this gets updated.
1164 const Type *LastContainedTy;
1166 // UpRefTy - This is the actual opaque type that the upreference is
1167 // represented with.
1168 OpaqueType *UpRefTy;
1170 UpRefRecord(unsigned NL, OpaqueType *URTy)
1171 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1175 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1176 static std::vector<UpRefRecord> UpRefs;
1178 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1179 /// called. It loops through the UpRefs vector, which is a list of the
1180 /// currently active types. For each type, if the up reference is contained in
1181 /// the newly completed type, we decrement the level count. When the level
1182 /// count reaches zero, the upreferenced type is the type that is passed in:
1183 /// thus we can complete the cycle.
1185 static PATypeHolder HandleUpRefs(const Type *ty) {
1186 // If Ty isn't abstract, or if there are no up-references in it, then there is
1187 // nothing to resolve here.
1188 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1190 PATypeHolder Ty(ty);
1191 UR_OUT("Type '" << Ty->getDescription() <<
1192 "' newly formed. Resolving upreferences.\n" <<
1193 UpRefs.size() << " upreferences active!\n");
1195 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1196 // to zero), we resolve them all together before we resolve them to Ty. At
1197 // the end of the loop, if there is anything to resolve to Ty, it will be in
1199 OpaqueType *TypeToResolve = 0;
1201 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1202 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1203 << UpRefs[i].second->getDescription() << ") = "
1204 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1205 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1206 // Decrement level of upreference
1207 unsigned Level = --UpRefs[i].NestingLevel;
1208 UpRefs[i].LastContainedTy = Ty;
1209 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1210 if (Level == 0) { // Upreference should be resolved!
1211 if (!TypeToResolve) {
1212 TypeToResolve = UpRefs[i].UpRefTy;
1214 UR_OUT(" * Resolving upreference for "
1215 << UpRefs[i].second->getDescription() << "\n";
1216 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1217 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1218 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1219 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1221 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1222 --i; // Do not skip the next element...
1227 if (TypeToResolve) {
1228 UR_OUT(" * Resolving upreference for "
1229 << UpRefs[i].second->getDescription() << "\n";
1230 std::string OldName = TypeToResolve->getDescription());
1231 TypeToResolve->refineAbstractTypeTo(Ty);
1237 //===----------------------------------------------------------------------===//
1238 // RunVMAsmParser - Define an interface to this parser
1239 //===----------------------------------------------------------------------===//
1241 static Module* RunParser(Module * M);
1243 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1246 CurFilename = Filename;
1247 return RunParser(new Module(CurFilename));
1250 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1251 set_scan_string(AsmString);
1253 CurFilename = "from_memory";
1255 return RunParser(new Module (CurFilename));
1257 return RunParser(M);
1263 /* Enabling traces. */
1268 /* Enabling verbose error messages. */
1269 #ifdef YYERROR_VERBOSE
1270 # undef YYERROR_VERBOSE
1271 # define YYERROR_VERBOSE 1
1273 # define YYERROR_VERBOSE 0
1276 /* Enabling the token table. */
1277 #ifndef YYTOKEN_TABLE
1278 # define YYTOKEN_TABLE 0
1281 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1282 #line 939 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
1283 typedef union YYSTYPE {
1284 llvm::Module *ModuleVal;
1285 llvm::Function *FunctionVal;
1286 llvm::BasicBlock *BasicBlockVal;
1287 llvm::TerminatorInst *TermInstVal;
1288 llvm::Instruction *InstVal;
1289 llvm::Constant *ConstVal;
1291 const llvm::Type *PrimType;
1292 std::list<llvm::PATypeHolder> *TypeList;
1293 llvm::PATypeHolder *TypeVal;
1294 llvm::Value *ValueVal;
1295 std::vector<llvm::Value*> *ValueList;
1296 llvm::ArgListType *ArgList;
1297 llvm::TypeWithAttrs TypeWithAttrs;
1298 llvm::TypeWithAttrsList *TypeWithAttrsList;
1299 llvm::ValueRefList *ValueRefList;
1301 // Represent the RHS of PHI node
1302 std::list<std::pair<llvm::Value*,
1303 llvm::BasicBlock*> > *PHIList;
1304 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1305 std::vector<llvm::Constant*> *ConstVector;
1307 llvm::GlobalValue::LinkageTypes Linkage;
1308 llvm::GlobalValue::VisibilityTypes Visibility;
1309 llvm::FunctionType::ParameterAttributes ParamAttrs;
1310 llvm::APInt *APIntVal;
1318 char *StrVal; // This memory is strdup'd!
1319 llvm::ValID ValIDVal; // strdup'd memory maybe!
1321 llvm::Instruction::BinaryOps BinaryOpVal;
1322 llvm::Instruction::TermOps TermOpVal;
1323 llvm::Instruction::MemoryOps MemOpVal;
1324 llvm::Instruction::CastOps CastOpVal;
1325 llvm::Instruction::OtherOps OtherOpVal;
1326 llvm::ICmpInst::Predicate IPredicate;
1327 llvm::FCmpInst::Predicate FPredicate;
1329 /* Line 196 of yacc.c. */
1330 #line 1331 "llvmAsmParser.tab.c"
1331 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1332 # define YYSTYPE_IS_DECLARED 1
1333 # define YYSTYPE_IS_TRIVIAL 1
1338 /* Copy the second part of user declarations. */
1341 /* Line 219 of yacc.c. */
1342 #line 1343 "llvmAsmParser.tab.c"
1344 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1345 # define YYSIZE_T __SIZE_TYPE__
1347 #if ! defined (YYSIZE_T) && defined (size_t)
1348 # define YYSIZE_T size_t
1350 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1351 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1352 # define YYSIZE_T size_t
1354 #if ! defined (YYSIZE_T)
1355 # define YYSIZE_T unsigned int
1361 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1362 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1366 # define YY_(msgid) msgid
1370 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1372 /* The parser invokes alloca or malloc; define the necessary symbols. */
1374 # ifdef YYSTACK_USE_ALLOCA
1375 # if YYSTACK_USE_ALLOCA
1377 # define YYSTACK_ALLOC __builtin_alloca
1379 # define YYSTACK_ALLOC alloca
1380 # if defined (__STDC__) || defined (__cplusplus)
1381 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1382 # define YYINCLUDED_STDLIB_H
1388 # ifdef YYSTACK_ALLOC
1389 /* Pacify GCC's `empty if-body' warning. */
1390 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1391 # ifndef YYSTACK_ALLOC_MAXIMUM
1392 /* The OS might guarantee only one guard page at the bottom of the stack,
1393 and a page size can be as small as 4096 bytes. So we cannot safely
1394 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1395 to allow for a few compiler-allocated temporary stack slots. */
1396 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1399 # define YYSTACK_ALLOC YYMALLOC
1400 # define YYSTACK_FREE YYFREE
1401 # ifndef YYSTACK_ALLOC_MAXIMUM
1402 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1408 # define YYMALLOC malloc
1409 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1410 && (defined (__STDC__) || defined (__cplusplus)))
1411 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1415 # define YYFREE free
1416 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1417 && (defined (__STDC__) || defined (__cplusplus)))
1418 void free (void *); /* INFRINGES ON USER NAME SPACE */
1425 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1428 #if (! defined (yyoverflow) \
1429 && (! defined (__cplusplus) \
1430 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1432 /* A type that is properly aligned for any stack member. */
1439 /* The size of the maximum gap between one aligned stack and the next. */
1440 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1442 /* The size of an array large to enough to hold all stacks, each with
1444 # define YYSTACK_BYTES(N) \
1445 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1446 + YYSTACK_GAP_MAXIMUM)
1448 /* Copy COUNT objects from FROM to TO. The source and destination do
1451 # if defined (__GNUC__) && 1 < __GNUC__
1452 # define YYCOPY(To, From, Count) \
1453 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1455 # define YYCOPY(To, From, Count) \
1459 for (yyi = 0; yyi < (Count); yyi++) \
1460 (To)[yyi] = (From)[yyi]; \
1466 /* Relocate STACK from its old location to the new one. The
1467 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1468 elements in the stack, and YYPTR gives the new location of the
1469 stack. Advance YYPTR to a properly aligned location for the next
1471 # define YYSTACK_RELOCATE(Stack) \
1474 YYSIZE_T yynewbytes; \
1475 YYCOPY (&yyptr->Stack, Stack, yysize); \
1476 Stack = &yyptr->Stack; \
1477 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1478 yyptr += yynewbytes / sizeof (*yyptr); \
1484 #if defined (__STDC__) || defined (__cplusplus)
1485 typedef signed char yysigned_char;
1487 typedef short int yysigned_char;
1490 /* YYFINAL -- State number of the termination state. */
1492 /* YYLAST -- Last index in YYTABLE. */
1495 /* YYNTOKENS -- Number of terminals. */
1496 #define YYNTOKENS 148
1497 /* YYNNTS -- Number of nonterminals. */
1499 /* YYNRULES -- Number of rules. */
1500 #define YYNRULES 286
1501 /* YYNRULES -- Number of states. */
1502 #define YYNSTATES 559
1504 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1505 #define YYUNDEFTOK 2
1506 #define YYMAXUTOK 388
1508 #define YYTRANSLATE(YYX) \
1509 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1511 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1512 static const unsigned char yytranslate[] =
1514 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1518 138, 139, 136, 2, 135, 2, 2, 2, 2, 2,
1519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1520 143, 134, 144, 2, 2, 2, 2, 2, 2, 2,
1521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1523 2, 140, 137, 142, 2, 2, 2, 2, 2, 147,
1524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1526 141, 2, 2, 145, 2, 146, 2, 2, 2, 2,
1527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1539 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1540 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1541 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1542 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1543 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1544 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1545 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1546 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1547 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1548 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1549 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1550 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1551 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1552 125, 126, 127, 128, 129, 130, 131, 132, 133
1556 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1558 static const unsigned short int yyprhs[] =
1560 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1561 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1562 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1563 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1564 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1565 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1566 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1567 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1568 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1569 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1570 195, 197, 199, 200, 203, 204, 207, 208, 212, 215,
1571 216, 218, 219, 223, 225, 228, 230, 232, 234, 236,
1572 238, 240, 243, 245, 248, 254, 260, 266, 272, 276,
1573 279, 285, 290, 293, 295, 297, 299, 303, 305, 309,
1574 311, 312, 314, 318, 323, 327, 331, 336, 341, 345,
1575 352, 358, 361, 364, 367, 370, 373, 376, 379, 382,
1576 385, 388, 391, 394, 401, 407, 416, 423, 430, 438,
1577 446, 453, 462, 471, 475, 477, 479, 481, 483, 484,
1578 486, 489, 490, 494, 495, 499, 503, 507, 511, 512,
1579 519, 520, 528, 529, 537, 540, 544, 546, 550, 554,
1580 558, 562, 564, 565, 571, 575, 577, 581, 583, 584,
1581 594, 596, 598, 603, 605, 607, 610, 614, 615, 617,
1582 619, 621, 623, 625, 627, 629, 631, 633, 637, 639,
1583 645, 647, 649, 651, 653, 655, 657, 660, 663, 666,
1584 670, 673, 674, 676, 679, 682, 686, 696, 706, 715,
1585 730, 732, 734, 741, 747, 750, 757, 765, 769, 775,
1586 776, 777, 781, 784, 786, 792, 798, 805, 812, 817,
1587 824, 829, 834, 841, 848, 851, 860, 862, 864, 865,
1588 869, 876, 880, 887, 890, 895, 902
1591 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1592 static const short int yyrhs[] =
1594 188, 0, -1, 67, -1, 68, -1, 69, -1, 70,
1595 -1, 71, -1, 72, -1, 73, -1, 74, -1, 75,
1596 -1, 79, -1, 80, -1, 81, -1, 76, -1, 77,
1597 -1, 78, -1, 110, -1, 111, -1, 112, -1, 113,
1598 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
1599 -1, 119, -1, 120, -1, 121, -1, 84, -1, 85,
1600 -1, 86, -1, 87, -1, 88, -1, 89, -1, 90,
1601 -1, 91, -1, 92, -1, 93, -1, 94, -1, 95,
1602 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1603 -1, 101, -1, 102, -1, 103, -1, 90, -1, 91,
1604 -1, 92, -1, 93, -1, 22, -1, 23, -1, 11,
1605 -1, 12, -1, 13, -1, 16, -1, 19, -1, 156,
1606 -1, -1, 156, 134, -1, -1, 17, -1, 20, -1,
1607 159, 134, -1, -1, 36, -1, 38, -1, 37, -1,
1608 39, -1, 41, -1, 40, -1, 42, -1, 44, -1,
1609 -1, 133, -1, -1, 40, -1, 42, -1, -1, 36,
1610 -1, 37, -1, 38, -1, 41, -1, -1, 55, -1,
1611 56, -1, 57, -1, 58, -1, 59, -1, 54, 4,
1612 -1, 111, -1, 112, -1, 129, -1, 130, -1, -1,
1613 168, 167, -1, 128, -1, 131, -1, 167, -1, -1,
1614 170, 169, -1, -1, 47, 4, -1, -1, 135, 47,
1615 4, -1, 30, 19, -1, -1, 173, -1, -1, 135,
1616 176, 175, -1, 173, -1, 47, 4, -1, 11, -1,
1617 12, -1, 13, -1, 14, -1, 43, -1, 177, -1,
1618 178, 136, -1, 210, -1, 137, 4, -1, 178, 138,
1619 182, 139, 170, -1, 10, 138, 182, 139, 170, -1,
1620 140, 4, 141, 178, 142, -1, 143, 4, 141, 178,
1621 144, -1, 145, 183, 146, -1, 145, 146, -1, 143,
1622 145, 183, 146, 144, -1, 143, 145, 146, 144, -1,
1623 178, 168, -1, 178, -1, 10, -1, 179, -1, 181,
1624 135, 179, -1, 181, -1, 181, 135, 33, -1, 33,
1625 -1, -1, 178, -1, 183, 135, 178, -1, 178, 140,
1626 186, 142, -1, 178, 140, 142, -1, 178, 147, 19,
1627 -1, 178, 143, 186, 144, -1, 178, 145, 186, 146,
1628 -1, 178, 145, 146, -1, 178, 143, 145, 186, 146,
1629 144, -1, 178, 143, 145, 146, 144, -1, 178, 34,
1630 -1, 178, 35, -1, 178, 210, -1, 178, 185, -1,
1631 178, 21, -1, 154, 3, -1, 154, 5, -1, 154,
1632 4, -1, 154, 6, -1, 11, 22, -1, 11, 23,
1633 -1, 155, 9, -1, 151, 138, 184, 32, 178, 139,
1634 -1, 109, 138, 184, 221, 139, -1, 123, 138, 184,
1635 135, 184, 135, 184, 139, -1, 149, 138, 184, 135,
1636 184, 139, -1, 150, 138, 184, 135, 184, 139, -1,
1637 82, 152, 138, 184, 135, 184, 139, -1, 83, 153,
1638 138, 184, 135, 184, 139, -1, 125, 138, 184, 135,
1639 184, 139, -1, 126, 138, 184, 135, 184, 135, 184,
1640 139, -1, 127, 138, 184, 135, 184, 135, 184, 139,
1641 -1, 186, 135, 184, -1, 184, -1, 28, -1, 29,
1642 -1, 189, -1, -1, 190, -1, 189, 190, -1, -1,
1643 27, 191, 206, -1, -1, 26, 192, 207, -1, 52,
1644 51, 196, -1, 158, 15, 178, -1, 158, 15, 10,
1645 -1, -1, 160, 163, 187, 184, 193, 175, -1, -1,
1646 160, 161, 163, 187, 184, 194, 175, -1, -1, 160,
1647 162, 163, 187, 178, 195, 175, -1, 45, 197, -1,
1648 48, 134, 198, -1, 19, -1, 46, 134, 19, -1,
1649 60, 134, 19, -1, 140, 199, 142, -1, 199, 135,
1650 19, -1, 19, -1, -1, 200, 135, 178, 168, 157,
1651 -1, 178, 168, 157, -1, 200, -1, 200, 135, 33,
1652 -1, 33, -1, -1, 166, 180, 159, 138, 201, 139,
1653 170, 174, 171, -1, 24, -1, 145, -1, 165, 163,
1654 202, 203, -1, 25, -1, 146, -1, 213, 205, -1,
1655 164, 163, 202, -1, -1, 53, -1, 3, -1, 4,
1656 -1, 9, -1, 22, -1, 23, -1, 34, -1, 35,
1657 -1, 21, -1, 143, 186, 144, -1, 185, -1, 51,
1658 208, 19, 135, 19, -1, 7, -1, 8, -1, 156,
1659 -1, 159, -1, 210, -1, 209, -1, 178, 211, -1,
1660 213, 214, -1, 204, 214, -1, 215, 158, 216, -1,
1661 215, 218, -1, -1, 18, -1, 61, 212, -1, 61,
1662 10, -1, 62, 14, 211, -1, 62, 11, 211, 135,
1663 14, 211, 135, 14, 211, -1, 63, 154, 211, 135,
1664 14, 211, 140, 217, 142, -1, 63, 154, 211, 135,
1665 14, 211, 140, 142, -1, 64, 166, 180, 211, 138,
1666 220, 139, 170, 32, 14, 211, 65, 14, 211, -1,
1667 65, -1, 66, -1, 217, 154, 209, 135, 14, 211,
1668 -1, 154, 209, 135, 14, 211, -1, 158, 223, -1,
1669 178, 140, 211, 135, 211, 142, -1, 219, 135, 140,
1670 211, 135, 211, 142, -1, 178, 211, 168, -1, 220,
1671 135, 178, 211, 168, -1, -1, -1, 221, 135, 212,
1672 -1, 50, 49, -1, 49, -1, 149, 178, 211, 135,
1673 211, -1, 150, 178, 211, 135, 211, -1, 82, 152,
1674 178, 211, 135, 211, -1, 83, 153, 178, 211, 135,
1675 211, -1, 151, 212, 32, 178, -1, 123, 212, 135,
1676 212, 135, 212, -1, 124, 212, 135, 178, -1, 125,
1677 212, 135, 212, -1, 126, 212, 135, 212, 135, 212,
1678 -1, 127, 212, 135, 212, 135, 212, -1, 122, 219,
1679 -1, 222, 166, 180, 211, 138, 220, 139, 170, -1,
1680 225, -1, 31, -1, -1, 104, 178, 172, -1, 104,
1681 178, 135, 11, 211, 172, -1, 105, 178, 172, -1,
1682 105, 178, 135, 11, 211, 172, -1, 106, 212, -1,
1683 224, 107, 178, 211, -1, 224, 108, 212, 135, 178,
1684 211, -1, 109, 178, 211, 221, -1
1687 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1688 static const unsigned short int yyrline[] =
1690 0, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
1691 1093, 1094, 1094, 1094, 1094, 1094, 1094, 1095, 1095, 1095,
1692 1095, 1095, 1095, 1096, 1096, 1096, 1096, 1096, 1096, 1099,
1693 1099, 1100, 1100, 1101, 1101, 1102, 1102, 1103, 1103, 1107,
1694 1107, 1108, 1108, 1109, 1109, 1110, 1110, 1111, 1111, 1112,
1695 1112, 1113, 1113, 1114, 1115, 1120, 1121, 1121, 1123, 1123,
1696 1124, 1124, 1128, 1132, 1137, 1137, 1139, 1143, 1149, 1150,
1697 1151, 1152, 1153, 1157, 1158, 1159, 1163, 1164, 1168, 1169,
1698 1170, 1174, 1175, 1176, 1177, 1178, 1181, 1182, 1183, 1184,
1699 1185, 1186, 1187, 1194, 1195, 1196, 1197, 1200, 1201, 1206,
1700 1207, 1208, 1211, 1212, 1219, 1220, 1226, 1227, 1235, 1243,
1701 1244, 1249, 1250, 1251, 1256, 1269, 1269, 1269, 1269, 1272,
1702 1276, 1280, 1287, 1292, 1300, 1319, 1338, 1343, 1355, 1365,
1703 1369, 1379, 1386, 1393, 1400, 1405, 1410, 1417, 1418, 1425,
1704 1432, 1440, 1446, 1458, 1486, 1502, 1531, 1559, 1584, 1603,
1705 1629, 1649, 1661, 1668, 1734, 1744, 1754, 1760, 1770, 1776,
1706 1786, 1791, 1796, 1804, 1816, 1838, 1846, 1852, 1863, 1868,
1707 1873, 1879, 1885, 1894, 1898, 1906, 1906, 1917, 1922, 1930,
1708 1931, 1935, 1935, 1939, 1939, 1942, 1945, 1969, 1980, 1980,
1709 1990, 1990, 1998, 1998, 2008, 2011, 2017, 2030, 2034, 2039,
1710 2041, 2046, 2051, 2060, 2070, 2081, 2085, 2094, 2103, 2108,
1711 2220, 2220, 2222, 2231, 2231, 2233, 2238, 2250, 2254, 2259,
1712 2263, 2267, 2271, 2275, 2279, 2283, 2287, 2291, 2316, 2320,
1713 2334, 2338, 2342, 2346, 2352, 2352, 2358, 2367, 2371, 2380,
1714 2389, 2398, 2402, 2407, 2411, 2415, 2420, 2430, 2449, 2458,
1715 2527, 2531, 2538, 2549, 2562, 2572, 2583, 2593, 2602, 2611,
1716 2614, 2615, 2622, 2626, 2631, 2652, 2669, 2683, 2697, 2709,
1717 2717, 2724, 2730, 2736, 2742, 2757, 2821, 2826, 2830, 2837,
1718 2844, 2852, 2859, 2867, 2875, 2889, 2906
1722 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1723 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1724 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1725 static const char *const yytname[] =
1727 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1728 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1729 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1730 "STRINGCONSTANT", "ATSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1731 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1732 "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK",
1733 "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT",
1734 "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE",
1735 "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT",
1736 "CC_TOK", "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1737 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1738 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1739 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1740 "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT",
1741 "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO",
1742 "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1743 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1744 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1745 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1746 "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "NOUNWIND", "DEFAULT",
1747 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1748 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1749 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1750 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1751 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1752 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1753 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1754 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1755 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1756 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1757 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1758 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1759 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1760 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1761 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1762 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1763 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1764 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1765 "OptVolatile", "MemoryInst", 0
1770 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1772 static const unsigned short int yytoknum[] =
1774 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1775 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1776 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1777 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1778 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1779 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1780 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1781 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1782 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1783 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1784 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1785 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1786 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1787 385, 386, 387, 388, 61, 44, 42, 92, 40, 41,
1788 91, 120, 93, 60, 62, 123, 125, 99
1792 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1793 static const unsigned char yyr1[] =
1795 0, 148, 149, 149, 149, 149, 149, 149, 149, 149,
1796 149, 150, 150, 150, 150, 150, 150, 151, 151, 151,
1797 151, 151, 151, 151, 151, 151, 151, 151, 151, 152,
1798 152, 152, 152, 152, 152, 152, 152, 152, 152, 153,
1799 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
1800 153, 153, 153, 153, 153, 154, 155, 155, 156, 156,
1801 157, 157, 158, 158, 159, 159, 160, 160, 161, 161,
1802 161, 161, 161, 162, 162, 162, 163, 163, 164, 164,
1803 164, 165, 165, 165, 165, 165, 166, 166, 166, 166,
1804 166, 166, 166, 167, 167, 167, 167, 168, 168, 169,
1805 169, 169, 170, 170, 171, 171, 172, 172, 173, 174,
1806 174, 175, 175, 176, 176, 177, 177, 177, 177, 178,
1807 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
1808 178, 178, 179, 180, 180, 181, 181, 182, 182, 182,
1809 182, 183, 183, 184, 184, 184, 184, 184, 184, 184,
1810 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1811 184, 184, 184, 185, 185, 185, 185, 185, 185, 185,
1812 185, 185, 185, 186, 186, 187, 187, 188, 188, 189,
1813 189, 191, 190, 192, 190, 190, 190, 190, 193, 190,
1814 194, 190, 195, 190, 190, 190, 196, 197, 197, 198,
1815 199, 199, 199, 200, 200, 201, 201, 201, 201, 202,
1816 203, 203, 204, 205, 205, 206, 207, 208, 208, 209,
1817 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1818 210, 210, 210, 210, 211, 211, 212, 213, 213, 214,
1819 215, 215, 215, 216, 216, 216, 216, 216, 216, 216,
1820 216, 216, 217, 217, 218, 219, 219, 220, 220, 220,
1821 221, 221, 222, 222, 223, 223, 223, 223, 223, 223,
1822 223, 223, 223, 223, 223, 223, 223, 224, 224, 225,
1823 225, 225, 225, 225, 225, 225, 225
1826 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1827 static const unsigned char yyr2[] =
1829 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1830 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1831 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1832 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1833 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1834 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1835 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1836 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1837 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1838 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1839 1, 1, 0, 2, 0, 2, 0, 3, 2, 0,
1840 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1841 1, 2, 1, 2, 5, 5, 5, 5, 3, 2,
1842 5, 4, 2, 1, 1, 1, 3, 1, 3, 1,
1843 0, 1, 3, 4, 3, 3, 4, 4, 3, 6,
1844 5, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1845 2, 2, 2, 6, 5, 8, 6, 6, 7, 7,
1846 6, 8, 8, 3, 1, 1, 1, 1, 0, 1,
1847 2, 0, 3, 0, 3, 3, 3, 3, 0, 6,
1848 0, 7, 0, 7, 2, 3, 1, 3, 3, 3,
1849 3, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1850 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1851 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1852 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
1853 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
1854 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1855 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1856 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1860 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1861 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1862 means the default is an error. */
1863 static const unsigned short int yydefact[] =
1865 67, 58, 64, 59, 65, 183, 181, 0, 0, 0,
1866 0, 0, 0, 76, 0, 67, 179, 78, 81, 0,
1867 0, 194, 0, 0, 62, 0, 66, 68, 70, 69,
1868 71, 73, 72, 74, 75, 77, 76, 76, 0, 1,
1869 180, 79, 80, 76, 184, 82, 83, 84, 85, 76,
1870 241, 182, 241, 0, 0, 202, 195, 196, 185, 230,
1871 231, 187, 115, 116, 117, 118, 119, 0, 0, 0,
1872 0, 232, 233, 120, 186, 122, 0, 0, 175, 176,
1873 0, 86, 86, 242, 238, 63, 213, 214, 215, 237,
1874 197, 198, 201, 0, 140, 123, 0, 0, 0, 0,
1875 129, 141, 0, 121, 140, 0, 0, 115, 116, 117,
1876 0, 0, 0, 188, 0, 87, 88, 89, 90, 91,
1877 0, 216, 0, 278, 240, 0, 199, 139, 97, 135,
1878 137, 0, 0, 0, 0, 0, 0, 128, 0, 190,
1879 192, 160, 161, 156, 158, 157, 159, 162, 155, 151,
1880 152, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1881 14, 15, 16, 11, 12, 13, 0, 0, 0, 17,
1882 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1883 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1884 0, 0, 154, 153, 111, 92, 134, 133, 0, 210,
1885 211, 212, 277, 263, 0, 0, 0, 0, 86, 250,
1886 251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1887 0, 0, 0, 0, 0, 0, 239, 86, 254, 0,
1888 276, 200, 132, 0, 102, 0, 0, 131, 0, 142,
1889 102, 111, 111, 29, 30, 31, 32, 33, 34, 35,
1890 36, 37, 38, 0, 53, 54, 49, 50, 51, 52,
1891 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1892 0, 0, 0, 0, 0, 0, 144, 174, 0, 0,
1893 0, 148, 0, 145, 0, 0, 0, 0, 189, 0,
1894 262, 244, 0, 243, 0, 0, 55, 0, 0, 0,
1895 0, 106, 106, 283, 0, 0, 274, 0, 0, 0,
1896 0, 0, 0, 0, 0, 0, 0, 0, 93, 94,
1897 95, 96, 98, 138, 136, 125, 126, 127, 130, 124,
1898 191, 193, 0, 0, 260, 0, 0, 0, 0, 0,
1899 143, 129, 141, 0, 146, 147, 0, 0, 0, 0,
1900 0, 113, 111, 208, 219, 220, 221, 226, 222, 223,
1901 224, 225, 217, 0, 228, 235, 234, 236, 0, 245,
1902 0, 0, 0, 0, 0, 279, 0, 281, 260, 0,
1903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1904 0, 0, 99, 100, 101, 103, 0, 0, 0, 0,
1905 0, 0, 0, 173, 150, 0, 0, 0, 0, 108,
1906 114, 112, 207, 97, 205, 0, 218, 0, 0, 0,
1907 0, 0, 0, 0, 0, 0, 0, 286, 0, 0,
1908 0, 270, 271, 0, 0, 0, 0, 268, 0, 284,
1909 0, 0, 0, 0, 164, 0, 0, 0, 0, 149,
1910 0, 0, 0, 61, 0, 102, 0, 227, 0, 0,
1911 259, 0, 0, 106, 107, 106, 0, 0, 0, 0,
1912 0, 264, 265, 259, 0, 0, 0, 261, 0, 170,
1913 0, 0, 166, 167, 163, 60, 204, 206, 97, 109,
1914 0, 0, 0, 0, 0, 266, 267, 0, 280, 282,
1915 0, 0, 269, 272, 273, 0, 285, 168, 169, 0,
1916 0, 0, 61, 110, 104, 229, 0, 0, 97, 0,
1917 102, 255, 0, 102, 165, 171, 172, 203, 0, 209,
1918 0, 248, 0, 0, 257, 0, 0, 256, 275, 105,
1919 246, 0, 247, 0, 97, 0, 0, 0, 258, 0,
1920 0, 0, 0, 253, 0, 0, 252, 0, 249
1923 /* YYDEFGOTO[NTERM-NUM]. */
1924 static const short int yydefgoto[] =
1926 -1, 189, 190, 191, 253, 270, 110, 111, 71, 486,
1927 11, 72, 13, 36, 37, 38, 43, 49, 120, 322,
1928 232, 395, 325, 529, 375, 351, 514, 288, 352, 73,
1929 112, 129, 198, 130, 131, 102, 277, 364, 278, 80,
1930 14, 15, 16, 18, 17, 194, 241, 242, 58, 21,
1931 56, 93, 414, 415, 121, 201, 50, 88, 51, 44,
1932 417, 365, 75, 367, 293, 52, 84, 85, 226, 533,
1933 124, 306, 494, 398, 227, 228, 229, 230
1936 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1938 #define YYPACT_NINF -428
1939 static const short int yypact[] =
1941 262, -428, -428, -428, -428, -428, -428, -26, -85, 60,
1942 5, 50, 9, 282, 135, 406, -428, 203, 191, 32,
1943 74, -428, 73, 134, -428, 1106, -428, -428, -428, -428,
1944 -428, -428, -428, -428, -428, -428, 87, 87, 150, -428,
1945 -428, -428, -428, 87, -428, -428, -428, -428, -428, 87,
1946 208, -428, 1, 228, 234, 248, -428, -428, -428, -428,
1947 -428, 130, -428, -428, -428, -428, -428, 276, 280, 4,
1948 111, -428, -428, -428, -57, -428, 150, 150, -428, -428,
1949 1143, 311, 311, -428, -428, 118, -428, -428, -428, -428,
1950 -428, -428, -428, -6, 40, -428, 144, 146, 908, 130,
1951 -428, -57, -68, -428, 40, 1143, 1157, 39, 281, 285,
1952 232, 286, 738, -428, 292, -428, -428, -428, -428, -428,
1953 1191, -428, -7, 1314, -428, 278, -428, -428, -57, -428,
1954 166, 163, 1157, 1157, 159, -36, 1157, -428, 165, -428,
1955 -57, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1956 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1957 -428, -428, -428, -428, -428, -428, 255, 594, 167, -428,
1958 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1959 -428, 170, 171, 173, 175, 497, 1207, 945, 296, 187,
1960 196, 197, -428, -428, 192, -428, 130, -57, 213, -428,
1961 -428, -428, -428, -428, 287, 1228, 247, 338, 311, -428,
1962 -428, 255, 594, 1157, 1157, 1157, 1157, 1157, 1157, 1157,
1963 1157, 1157, 1157, 1157, 1157, 1157, -428, 311, -428, 152,
1964 -428, -428, -43, 1003, -428, -41, -103, -428, 206, -57,
1965 -428, 192, 192, -428, -428, -428, -428, -428, -428, -428,
1966 -428, -428, -428, 214, -428, -428, -428, -428, -428, -428,
1967 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1968 216, 1143, 1143, 1143, 1143, 1143, -428, -428, 17, 987,
1969 -18, -428, -33, -428, 1143, 1143, 1143, 8, -428, 217,
1970 -428, 130, 592, -428, 717, 717, -428, 717, 1191, 1157,
1971 1157, 106, 114, -428, 592, 31, 236, 239, 240, 241,
1972 242, 243, 592, 592, 347, 1191, 1157, 1157, -428, -428,
1973 -428, -428, -428, -428, -428, -40, -428, -428, -428, -40,
1974 -428, -428, 1143, 1143, -428, 245, 246, 252, 256, 1143,
1975 -428, 238, 738, -31, -428, -428, 257, 259, 351, 371,
1976 393, -428, 192, 1050, -428, -428, -428, -428, -428, -428,
1977 -428, -428, 346, 1143, -428, -428, -428, -428, 265, -428,
1978 267, 717, 592, 592, 16, -428, 19, -428, -428, 717,
1979 263, 1157, 1157, 1157, 1157, 1157, 269, 272, 1157, 717,
1980 592, 273, -428, -428, -428, -428, 275, 283, -32, 1143,
1981 1143, 1143, 1143, -428, -428, 290, 1143, 1143, 1157, -428,
1982 -428, -428, -428, -57, 289, 288, -428, 398, 13, 415,
1983 417, 297, 302, 303, 717, 435, 717, 305, 306, 717,
1984 307, -57, -428, 308, 312, 717, 717, -57, 310, -428,
1985 1157, 1143, 1143, 1157, -428, 315, 313, 320, 321, -428,
1986 322, 324, 22, 21, 1088, -428, 325, -428, 717, 717,
1987 1157, 717, 717, 329, -428, 329, 717, 330, 1157, 1157,
1988 1157, -428, -428, 1157, 592, 327, 328, -428, 1143, -428,
1989 1143, 1143, -428, -428, -428, -428, -428, -428, -57, 34,
1990 440, 333, 331, 592, 72, -428, -428, 422, -428, -428,
1991 336, 717, -428, -428, -428, 75, -428, -428, -428, 340,
1992 343, 344, 21, -428, 423, -428, 461, -1, -428, 1157,
1993 -428, -428, 345, -428, -428, -428, -428, -428, 481, -428,
1994 717, -428, 866, 2, -43, 592, 44, -428, -40, -428,
1995 -428, 353, -428, 866, -428, 472, 475, 357, -43, 717,
1996 717, 479, 429, -428, 717, 482, -428, 717, -428
1999 /* YYPGOTO[NTERM-NUM]. */
2000 static const short int yypgoto[] =
2002 -428, 374, 375, 376, 291, 294, -205, -428, 0, -12,
2003 416, 14, -428, -428, -428, 57, -428, -428, -150, -313,
2004 -404, -428, -237, -428, -295, 26, -428, -210, -428, -428,
2005 -24, 270, -223, -428, 414, 421, -69, -108, -181, 189,
2006 -428, -428, 505, -428, -428, -428, -428, -428, -428, -428,
2007 -428, -428, -428, -428, 439, -428, -428, -428, -428, -428,
2008 -428, -427, -73, 101, -197, -428, 470, -428, -428, -428,
2009 -428, -428, 51, 145, -428, -428, -428, -428
2012 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2013 positive, shift that token. If negative, reduce the rule which
2014 number is the opposite. If zero, do what YYDEFACT says.
2015 If YYTABLE_NINF, syntax error. */
2016 #define YYTABLE_NINF -179
2017 static const short int yytable[] =
2019 10, 74, 297, 329, 192, 280, 282, 377, 97, 453,
2020 296, 113, 394, 296, 12, 10, 394, 199, 303, 83,
2021 19, 307, 308, 309, 310, 311, 86, 424, 314, 12,
2022 426, 330, 331, 103, 20, 104, 139, 1, 349, 193,
2023 3, 327, -55, -55, -55, -55, 101, 59, 60, 22,
2024 99, 62, 63, 64, 65, 350, 1, 2, 298, 3,
2025 4, 141, 142, 425, 349, 25, 425, 136, 318, 319,
2026 128, 318, 319, 127, 101, 371, 545, 315, 137, 103,
2027 128, 104, 140, 66, 512, 10, 320, 321, 392, 320,
2028 321, 393, 389, 76, 77, 103, 197, 104, 343, 136,
2029 81, 326, 339, 443, 339, 541, 82, 444, 235, 236,
2030 238, 23, 239, 345, 534, 405, 547, 339, 59, 60,
2031 391, 99, 62, 63, 64, 65, 344, 1, 2, 125,
2032 3, 4, 318, 319, 1, 39, 126, 3, 200, 24,
2033 548, 531, 411, 26, 542, 318, 319, 87, 339, 98,
2034 320, 321, 339, 57, 66, 318, 319, 457, 103, 340,
2035 104, 484, 392, 320, 321, 393, 53, 103, 498, 104,
2036 499, 379, 392, 320, 321, 393, 394, 67, 78, 79,
2037 68, 292, 418, 69, 430, 70, 432, 433, 434, 301,
2038 302, 292, 304, 305, 292, 292, 292, 292, 292, 312,
2039 313, 292, 334, 335, 336, 337, 338, 519, 54, 128,
2040 519, 520, 289, 55, 523, 346, 347, 348, 489, 366,
2041 35, 366, 366, 394, 366, 394, 83, 45, 46, 47,
2042 2, 366, 48, 4, 192, 143, 144, 145, 146, 366,
2043 366, 374, 103, 41, 104, 42, 477, 90, 67, 376,
2044 103, 68, 104, 91, 69, 342, 70, 100, 294, 316,
2045 317, 295, -178, 396, 397, 105, 106, 92, 94, 193,
2046 403, 502, 503, 504, 197, 372, 373, -63, 1, 2,
2047 95, 3, 4, 536, 96, 132, 538, 133, 5, 6,
2048 -56, 197, 390, 292, -57, 147, 195, 231, 366, 366,
2049 366, 233, 234, 237, 240, 271, 366, 7, 272, 273,
2050 8, 274, 532, 275, 9, 283, 366, 366, 27, 28,
2051 29, 30, 31, 32, 33, 284, 34, 287, 543, 413,
2052 445, 446, 447, 448, 285, 286, 290, 450, 451, 243,
2053 244, 245, 246, 247, 248, 249, 250, 251, 252, 296,
2054 328, 366, 332, 366, 333, 353, 366, 292, 431, 292,
2055 292, 292, 366, 366, 437, 114, 115, 116, 117, 118,
2056 119, 380, 475, 476, 381, 382, 383, 384, 385, 388,
2057 399, 400, 404, 408, 452, 366, 366, 401, 366, 366,
2058 409, 402, 406, 366, 407, 368, 369, 410, 370, 416,
2059 419, 366, 420, 429, 435, 378, -177, 436, 440, 509,
2060 441, 510, 511, 386, 387, 35, 474, 456, 442, 292,
2061 366, -63, 1, 2, 454, 3, 4, 455, 366, 458,
2062 488, 459, 5, 6, 449, 460, 493, 461, 462, 464,
2063 443, 466, 468, 469, 292, 292, 292, 470, 473, 493,
2064 478, 7, 479, 485, 8, 480, 481, 366, 9, 515,
2065 490, 482, 366, 483, 497, 501, 507, 508, 516, 425,
2066 528, 517, 421, 422, 423, 530, 366, 366, 521, 524,
2067 428, 366, 525, 526, 366, 539, 549, 537, 546, 550,
2068 438, 439, 551, 554, 555, 535, 557, 223, 224, 225,
2069 527, 123, 299, 324, 59, 60, 300, 99, 107, 108,
2070 109, 65, 485, 1, 2, 513, 3, 4, 138, 135,
2071 40, 122, 89, 427, 505, 463, 0, 465, 0, 0,
2072 467, 0, 0, 0, 0, 0, 471, 472, 0, 0,
2073 66, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 491,
2075 492, 0, 495, 496, 0, 0, 0, 500, 0, 0,
2076 0, 0, 0, 0, 0, 506, 0, 0, 0, 0,
2077 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2078 0, 0, 0, 0, 518, 354, 355, 0, 0, 59,
2079 60, 356, 522, 0, 0, 0, 0, 0, 1, 2,
2080 0, 3, 4, 357, 358, 359, 254, 255, 0, 0,
2081 0, 0, 0, 0, 0, 0, 360, 361, 0, 0,
2082 0, 540, 0, 0, 67, 0, 544, 68, 0, 276,
2083 69, 0, 70, 362, 0, 0, 0, 0, 0, 0,
2084 552, 553, 0, 0, 0, 556, 0, 0, 558, 151,
2085 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
2086 162, 163, 164, 165, 166, 167, 0, 0, 0, 0,
2087 0, 0, 0, 0, 256, 257, 258, 259, 260, 261,
2088 262, 263, 264, 265, 266, 267, 268, 269, 0, 0,
2089 0, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2090 177, 178, 179, 180, 0, 181, 0, 182, 183, 184,
2091 354, 355, 0, 0, 59, 60, 356, 0, 103, 0,
2092 104, 0, 0, 1, 2, 363, 3, 4, 357, 358,
2093 359, 0, 0, 0, 0, 59, 60, 0, 0, 0,
2094 0, 360, 361, 0, 1, 2, 0, 3, 4, 148,
2095 0, 0, 0, 0, 0, 0, 0, 0, 362, 0,
2096 0, 0, 149, 150, 0, 0, 0, 0, 0, 0,
2097 0, 0, 0, 0, 151, 152, 153, 154, 155, 156,
2098 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2099 167, 0, 0, 0, 0, 151, 152, 153, 154, 155,
2100 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2101 166, 167, 0, 0, 0, 0, 168, 169, 170, 171,
2102 172, 173, 174, 175, 176, 177, 178, 179, 180, 0,
2103 181, 0, 182, 183, 184, 0, 0, 168, 169, 170,
2104 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
2105 363, 181, 0, 182, 183, 184, 0, 0, 0, 354,
2106 355, 0, 0, 0, 103, 356, 104, 0, 185, 0,
2107 0, 186, 0, 187, 0, 188, 0, 357, 358, 359,
2108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2109 360, 361, 0, 0, 0, 0, 0, 0, 0, 0,
2110 0, 0, 0, 0, 0, 59, 60, 362, 99, 62,
2111 63, 64, 65, 0, 1, 2, 0, 3, 4, 0,
2112 0, 0, 0, 151, 152, 153, 154, 155, 156, 157,
2113 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2114 0, 66, 59, 60, 0, 99, 107, 108, 109, 65,
2115 0, 1, 2, 0, 3, 4, 0, 0, 0, 0,
2116 0, 0, 0, 0, 0, 168, 169, 170, 171, 172,
2117 173, 174, 175, 176, 177, 178, 179, 180, 66, 181,
2118 0, 182, 183, 184, 59, 60, 0, 99, 107, 108,
2119 109, 65, 0, 1, 2, 0, 3, 4, 0, 363,
2120 59, 60, 0, 99, 62, 63, 64, 65, 0, 1,
2121 2, 0, 3, 4, 0, 0, 0, 0, 0, 0,
2122 66, 0, 0, 0, 0, 0, 323, 0, 0, 0,
2123 0, 0, 0, 0, 0, 67, 66, 0, 68, 0,
2124 0, 69, 0, 70, 134, 0, 0, 59, 60, 0,
2125 99, 62, 63, 64, 65, 0, 1, 2, 0, 3,
2126 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2127 0, 0, 67, 412, 0, 68, 0, 0, 69, 0,
2128 70, 281, 0, 66, 0, 59, 60, 0, 99, 62,
2129 63, 64, 65, 0, 1, 2, 0, 3, 4, 0,
2130 0, 0, 0, 59, 60, 0, 61, 62, 63, 64,
2131 65, 487, 1, 2, 67, 3, 4, 68, 0, 0,
2132 69, 66, 70, 341, 0, 0, 0, 0, 0, 0,
2133 67, 0, 0, 68, 0, 0, 69, 0, 70, 66,
2134 59, 60, 0, 99, 107, 108, 109, 65, 0, 1,
2135 2, 0, 3, 4, 59, 60, 0, 99, 62, 63,
2136 64, 65, 0, 1, 2, 0, 3, 4, 0, 0,
2137 0, 0, 0, 0, 0, 0, 66, 67, 0, 0,
2138 68, 0, 0, 69, 0, 70, 0, 0, 59, 60,
2139 66, 196, 62, 63, 64, 65, 0, 1, 2, 0,
2140 3, 4, 0, 0, 59, 60, 0, 99, 107, 108,
2141 109, 65, 0, 1, 2, 67, 3, 4, 68, 0,
2142 0, 69, 0, 70, 66, 59, 60, 0, 291, 62,
2143 63, 64, 65, 67, 1, 2, 68, 3, 4, 69,
2144 66, 70, 0, 0, 0, 0, 0, 0, 0, 0,
2145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2146 0, 66, 0, 0, 0, 0, 0, 0, 0, 0,
2147 67, 0, 0, 68, 0, 0, 69, 0, 70, 0,
2148 0, 0, 0, 0, 67, 0, 0, 68, 0, 0,
2149 69, 0, 70, 0, 0, 0, 0, 0, 0, 0,
2150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2151 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
2152 0, 68, 0, 0, 69, 0, 70, 0, 0, 0,
2153 0, 0, 0, 0, 67, 202, 0, 68, 0, 0,
2154 69, 0, 279, 0, 0, 0, 0, 0, 0, 0,
2155 0, 0, 0, 203, 204, 67, 0, 0, 68, 0,
2156 0, 69, 0, 70, 0, 205, 206, 207, 208, 209,
2157 210, 151, 152, 153, 154, 155, 156, 157, 158, 159,
2158 160, 161, 162, 163, 164, 165, 211, 212, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2160 0, 0, 0, 0, 0, 0, 0, 0, 213, 214,
2161 215, 0, 0, 216, 169, 170, 171, 172, 173, 174,
2162 175, 176, 177, 178, 179, 180, 217, 218, 219, 220,
2166 static const short int yycheck[] =
2168 0, 25, 207, 240, 112, 186, 187, 302, 4, 413,
2169 11, 80, 325, 11, 0, 15, 329, 24, 215, 18,
2170 46, 218, 219, 220, 221, 222, 25, 11, 225, 15,
2171 11, 241, 242, 136, 60, 138, 105, 16, 30, 112,
2172 19, 144, 3, 4, 5, 6, 70, 7, 8, 134,
2173 10, 11, 12, 13, 14, 47, 16, 17, 208, 19,
2174 20, 22, 23, 47, 30, 15, 47, 135, 111, 112,
2175 94, 111, 112, 33, 98, 298, 32, 227, 146, 136,
2176 104, 138, 106, 43, 488, 85, 129, 130, 128, 129,
2177 130, 131, 315, 36, 37, 136, 120, 138, 279, 135,
2178 43, 142, 135, 135, 135, 532, 49, 139, 132, 133,
2179 146, 51, 136, 146, 518, 146, 543, 135, 7, 8,
2180 317, 10, 11, 12, 13, 14, 144, 16, 17, 135,
2181 19, 20, 111, 112, 16, 0, 142, 19, 145, 134,
2182 544, 142, 352, 134, 142, 111, 112, 146, 135, 145,
2183 129, 130, 135, 19, 43, 111, 112, 144, 136, 142,
2184 138, 139, 128, 129, 130, 131, 134, 136, 463, 138,
2185 465, 140, 128, 129, 130, 131, 489, 137, 28, 29,
2186 140, 205, 363, 143, 381, 145, 383, 384, 385, 213,
2187 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
2188 224, 225, 271, 272, 273, 274, 275, 135, 134, 233,
2189 135, 139, 198, 140, 139, 284, 285, 286, 455, 292,
2190 133, 294, 295, 536, 297, 538, 18, 36, 37, 38,
2191 17, 304, 41, 20, 342, 3, 4, 5, 6, 312,
2192 313, 135, 136, 40, 138, 42, 443, 19, 137, 135,
2193 136, 140, 138, 19, 143, 279, 145, 146, 11, 107,
2194 108, 14, 0, 332, 333, 76, 77, 19, 138, 342,
2195 339, 468, 469, 470, 298, 299, 300, 15, 16, 17,
2196 4, 19, 20, 520, 4, 141, 523, 141, 26, 27,
2197 9, 315, 316, 317, 9, 9, 4, 19, 371, 372,
2198 373, 135, 139, 144, 139, 138, 379, 45, 138, 138,
2199 48, 138, 517, 138, 52, 19, 389, 390, 36, 37,
2200 38, 39, 40, 41, 42, 138, 44, 135, 533, 353,
2201 399, 400, 401, 402, 138, 138, 49, 406, 407, 84,
2202 85, 86, 87, 88, 89, 90, 91, 92, 93, 11,
2203 144, 424, 138, 426, 138, 138, 429, 381, 382, 383,
2204 384, 385, 435, 436, 388, 54, 55, 56, 57, 58,
2205 59, 135, 441, 442, 135, 135, 135, 135, 135, 32,
2206 135, 135, 144, 32, 408, 458, 459, 135, 461, 462,
2207 19, 135, 135, 466, 135, 294, 295, 4, 297, 53,
2208 135, 474, 135, 140, 135, 304, 0, 135, 135, 478,
2209 135, 480, 481, 312, 313, 133, 440, 19, 135, 443,
2210 493, 15, 16, 17, 135, 19, 20, 139, 501, 14,
2211 454, 14, 26, 27, 144, 138, 460, 135, 135, 4,
2212 135, 135, 135, 135, 468, 469, 470, 135, 138, 473,
2213 135, 45, 139, 453, 48, 135, 135, 530, 52, 19,
2214 135, 139, 535, 139, 135, 135, 139, 139, 135, 47,
2215 47, 140, 371, 372, 373, 14, 549, 550, 142, 139,
2216 379, 554, 139, 139, 557, 4, 14, 142, 135, 14,
2217 389, 390, 135, 14, 65, 519, 14, 123, 123, 123,
2218 512, 85, 211, 233, 7, 8, 212, 10, 11, 12,
2219 13, 14, 512, 16, 17, 489, 19, 20, 104, 98,
2220 15, 82, 52, 378, 473, 424, -1, 426, -1, -1,
2221 429, -1, -1, -1, -1, -1, 435, 436, -1, -1,
2222 43, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2223 -1, -1, -1, -1, -1, -1, -1, -1, -1, 458,
2224 459, -1, 461, 462, -1, -1, -1, 466, -1, -1,
2225 -1, -1, -1, -1, -1, 474, -1, -1, -1, -1,
2226 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2227 -1, -1, -1, -1, 493, 3, 4, -1, -1, 7,
2228 8, 9, 501, -1, -1, -1, -1, -1, 16, 17,
2229 -1, 19, 20, 21, 22, 23, 22, 23, -1, -1,
2230 -1, -1, -1, -1, -1, -1, 34, 35, -1, -1,
2231 -1, 530, -1, -1, 137, -1, 535, 140, -1, 142,
2232 143, -1, 145, 51, -1, -1, -1, -1, -1, -1,
2233 549, 550, -1, -1, -1, 554, -1, -1, 557, 67,
2234 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2235 78, 79, 80, 81, 82, 83, -1, -1, -1, -1,
2236 -1, -1, -1, -1, 90, 91, 92, 93, 94, 95,
2237 96, 97, 98, 99, 100, 101, 102, 103, -1, -1,
2238 -1, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2239 118, 119, 120, 121, -1, 123, -1, 125, 126, 127,
2240 3, 4, -1, -1, 7, 8, 9, -1, 136, -1,
2241 138, -1, -1, 16, 17, 143, 19, 20, 21, 22,
2242 23, -1, -1, -1, -1, 7, 8, -1, -1, -1,
2243 -1, 34, 35, -1, 16, 17, -1, 19, 20, 21,
2244 -1, -1, -1, -1, -1, -1, -1, -1, 51, -1,
2245 -1, -1, 34, 35, -1, -1, -1, -1, -1, -1,
2246 -1, -1, -1, -1, 67, 68, 69, 70, 71, 72,
2247 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2248 83, -1, -1, -1, -1, 67, 68, 69, 70, 71,
2249 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2250 82, 83, -1, -1, -1, -1, 109, 110, 111, 112,
2251 113, 114, 115, 116, 117, 118, 119, 120, 121, -1,
2252 123, -1, 125, 126, 127, -1, -1, 109, 110, 111,
2253 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2254 143, 123, -1, 125, 126, 127, -1, -1, -1, 3,
2255 4, -1, -1, -1, 136, 9, 138, -1, 140, -1,
2256 -1, 143, -1, 145, -1, 147, -1, 21, 22, 23,
2257 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2258 34, 35, -1, -1, -1, -1, -1, -1, -1, -1,
2259 -1, -1, -1, -1, -1, 7, 8, 51, 10, 11,
2260 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2261 -1, -1, -1, 67, 68, 69, 70, 71, 72, 73,
2262 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2263 -1, 43, 7, 8, -1, 10, 11, 12, 13, 14,
2264 -1, 16, 17, -1, 19, 20, -1, -1, -1, -1,
2265 -1, -1, -1, -1, -1, 109, 110, 111, 112, 113,
2266 114, 115, 116, 117, 118, 119, 120, 121, 43, 123,
2267 -1, 125, 126, 127, 7, 8, -1, 10, 11, 12,
2268 13, 14, -1, 16, 17, -1, 19, 20, -1, 143,
2269 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2270 17, -1, 19, 20, -1, -1, -1, -1, -1, -1,
2271 43, -1, -1, -1, -1, -1, 33, -1, -1, -1,
2272 -1, -1, -1, -1, -1, 137, 43, -1, 140, -1,
2273 -1, 143, -1, 145, 146, -1, -1, 7, 8, -1,
2274 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2275 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2276 -1, -1, 137, 33, -1, 140, -1, -1, 143, -1,
2277 145, 146, -1, 43, -1, 7, 8, -1, 10, 11,
2278 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2279 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2280 14, 33, 16, 17, 137, 19, 20, 140, -1, -1,
2281 143, 43, 145, 146, -1, -1, -1, -1, -1, -1,
2282 137, -1, -1, 140, -1, -1, 143, -1, 145, 43,
2283 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2284 17, -1, 19, 20, 7, 8, -1, 10, 11, 12,
2285 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2286 -1, -1, -1, -1, -1, -1, 43, 137, -1, -1,
2287 140, -1, -1, 143, -1, 145, -1, -1, 7, 8,
2288 43, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2289 19, 20, -1, -1, 7, 8, -1, 10, 11, 12,
2290 13, 14, -1, 16, 17, 137, 19, 20, 140, -1,
2291 -1, 143, -1, 145, 43, 7, 8, -1, 10, 11,
2292 12, 13, 14, 137, 16, 17, 140, 19, 20, 143,
2293 43, 145, -1, -1, -1, -1, -1, -1, -1, -1,
2294 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2295 -1, 43, -1, -1, -1, -1, -1, -1, -1, -1,
2296 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2297 -1, -1, -1, -1, 137, -1, -1, 140, -1, -1,
2298 143, -1, 145, -1, -1, -1, -1, -1, -1, -1,
2299 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2300 -1, -1, -1, -1, -1, -1, -1, -1, 137, -1,
2301 -1, 140, -1, -1, 143, -1, 145, -1, -1, -1,
2302 -1, -1, -1, -1, 137, 31, -1, 140, -1, -1,
2303 143, -1, 145, -1, -1, -1, -1, -1, -1, -1,
2304 -1, -1, -1, 49, 50, 137, -1, -1, 140, -1,
2305 -1, 143, -1, 145, -1, 61, 62, 63, 64, 65,
2306 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2307 76, 77, 78, 79, 80, 81, 82, 83, -1, -1,
2308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2309 -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
2310 106, -1, -1, 109, 110, 111, 112, 113, 114, 115,
2311 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2315 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2316 symbol of state STATE-NUM. */
2317 static const unsigned char yystos[] =
2319 0, 16, 17, 19, 20, 26, 27, 45, 48, 52,
2320 156, 158, 159, 160, 188, 189, 190, 192, 191, 46,
2321 60, 197, 134, 51, 134, 15, 134, 36, 37, 38,
2322 39, 40, 41, 42, 44, 133, 161, 162, 163, 0,
2323 190, 40, 42, 164, 207, 36, 37, 38, 41, 165,
2324 204, 206, 213, 134, 134, 140, 198, 19, 196, 7,
2325 8, 10, 11, 12, 13, 14, 43, 137, 140, 143,
2326 145, 156, 159, 177, 178, 210, 163, 163, 28, 29,
2327 187, 163, 163, 18, 214, 215, 25, 146, 205, 214,
2328 19, 19, 19, 199, 138, 4, 4, 4, 145, 10,
2329 146, 178, 183, 136, 138, 187, 187, 11, 12, 13,
2330 154, 155, 178, 184, 54, 55, 56, 57, 58, 59,
2331 166, 202, 202, 158, 218, 135, 142, 33, 178, 179,
2332 181, 182, 141, 141, 146, 183, 135, 146, 182, 184,
2333 178, 22, 23, 3, 4, 5, 6, 9, 21, 34,
2334 35, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2335 76, 77, 78, 79, 80, 81, 82, 83, 109, 110,
2336 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2337 121, 123, 125, 126, 127, 140, 143, 145, 147, 149,
2338 150, 151, 185, 210, 193, 4, 10, 178, 180, 24,
2339 145, 203, 31, 49, 50, 61, 62, 63, 64, 65,
2340 66, 82, 83, 104, 105, 106, 109, 122, 123, 124,
2341 125, 126, 127, 149, 150, 151, 216, 222, 223, 224,
2342 225, 19, 168, 135, 139, 178, 178, 144, 146, 178,
2343 139, 194, 195, 84, 85, 86, 87, 88, 89, 90,
2344 91, 92, 93, 152, 22, 23, 90, 91, 92, 93,
2345 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2346 153, 138, 138, 138, 138, 138, 142, 184, 186, 145,
2347 186, 146, 186, 19, 138, 138, 138, 135, 175, 159,
2348 49, 10, 178, 212, 11, 14, 11, 154, 166, 152,
2349 153, 178, 178, 212, 178, 178, 219, 212, 212, 212,
2350 212, 212, 178, 178, 212, 166, 107, 108, 111, 112,
2351 129, 130, 167, 33, 179, 170, 142, 144, 144, 170,
2352 175, 175, 138, 138, 184, 184, 184, 184, 184, 135,
2353 142, 146, 178, 186, 144, 146, 184, 184, 184, 30,
2354 47, 173, 176, 138, 3, 4, 9, 21, 22, 23,
2355 34, 35, 51, 143, 185, 209, 210, 211, 211, 211,
2356 211, 180, 178, 178, 135, 172, 135, 172, 211, 140,
2357 135, 135, 135, 135, 135, 135, 211, 211, 32, 180,
2358 178, 212, 128, 131, 167, 169, 184, 184, 221, 135,
2359 135, 135, 135, 184, 144, 146, 135, 135, 32, 19,
2360 4, 175, 33, 178, 200, 201, 53, 208, 186, 135,
2361 135, 211, 211, 211, 11, 47, 11, 221, 211, 140,
2362 212, 178, 212, 212, 212, 135, 135, 178, 211, 211,
2363 135, 135, 135, 135, 139, 184, 184, 184, 184, 144,
2364 184, 184, 178, 168, 135, 139, 19, 144, 14, 14,
2365 138, 135, 135, 211, 4, 211, 135, 211, 135, 135,
2366 135, 211, 211, 138, 178, 184, 184, 212, 135, 139,
2367 135, 135, 139, 139, 139, 156, 157, 33, 178, 170,
2368 135, 211, 211, 178, 220, 211, 211, 135, 172, 172,
2369 211, 135, 212, 212, 212, 220, 211, 139, 139, 184,
2370 184, 184, 168, 173, 174, 19, 135, 140, 211, 135,
2371 139, 142, 211, 139, 139, 139, 139, 157, 47, 171,
2372 14, 142, 154, 217, 168, 178, 170, 142, 170, 4,
2373 211, 209, 142, 154, 211, 32, 135, 209, 168, 14,
2374 14, 135, 211, 211, 14, 65, 211, 14, 211
2377 #define yyerrok (yyerrstatus = 0)
2378 #define yyclearin (yychar = YYEMPTY)
2379 #define YYEMPTY (-2)
2382 #define YYACCEPT goto yyacceptlab
2383 #define YYABORT goto yyabortlab
2384 #define YYERROR goto yyerrorlab
2387 /* Like YYERROR except do call yyerror. This remains here temporarily
2388 to ease the transition to the new meaning of YYERROR, for GCC.
2389 Once GCC version 2 has supplanted version 1, this can go. */
2391 #define YYFAIL goto yyerrlab
2393 #define YYRECOVERING() (!!yyerrstatus)
2395 #define YYBACKUP(Token, Value) \
2397 if (yychar == YYEMPTY && yylen == 1) \
2401 yytoken = YYTRANSLATE (yychar); \
2407 yyerror (YY_("syntax error: cannot back up")); \
2414 #define YYERRCODE 256
2417 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2418 If N is 0, then set CURRENT to the empty location which ends
2419 the previous symbol: RHS[0] (always defined). */
2421 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2422 #ifndef YYLLOC_DEFAULT
2423 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2427 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2428 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2429 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2430 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2434 (Current).first_line = (Current).last_line = \
2435 YYRHSLOC (Rhs, 0).last_line; \
2436 (Current).first_column = (Current).last_column = \
2437 YYRHSLOC (Rhs, 0).last_column; \
2443 /* YY_LOCATION_PRINT -- Print the location on the stream.
2444 This macro was not mandated originally: define only if we know
2445 we won't break user code: when these are the locations we know. */
2447 #ifndef YY_LOCATION_PRINT
2448 # if YYLTYPE_IS_TRIVIAL
2449 # define YY_LOCATION_PRINT(File, Loc) \
2450 fprintf (File, "%d.%d-%d.%d", \
2451 (Loc).first_line, (Loc).first_column, \
2452 (Loc).last_line, (Loc).last_column)
2454 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2459 /* YYLEX -- calling `yylex' with the right arguments. */
2462 # define YYLEX yylex (YYLEX_PARAM)
2464 # define YYLEX yylex ()
2467 /* Enable debugging if requested. */
2471 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2472 # define YYFPRINTF fprintf
2475 # define YYDPRINTF(Args) \
2481 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2485 YYFPRINTF (stderr, "%s ", Title); \
2486 yysymprint (stderr, \
2488 YYFPRINTF (stderr, "\n"); \
2492 /*------------------------------------------------------------------.
2493 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2495 `------------------------------------------------------------------*/
2497 #if defined (__STDC__) || defined (__cplusplus)
2499 yy_stack_print (short int *bottom, short int *top)
2502 yy_stack_print (bottom, top)
2507 YYFPRINTF (stderr, "Stack now");
2508 for (/* Nothing. */; bottom <= top; ++bottom)
2509 YYFPRINTF (stderr, " %d", *bottom);
2510 YYFPRINTF (stderr, "\n");
2513 # define YY_STACK_PRINT(Bottom, Top) \
2516 yy_stack_print ((Bottom), (Top)); \
2520 /*------------------------------------------------.
2521 | Report that the YYRULE is going to be reduced. |
2522 `------------------------------------------------*/
2524 #if defined (__STDC__) || defined (__cplusplus)
2526 yy_reduce_print (int yyrule)
2529 yy_reduce_print (yyrule)
2534 unsigned long int yylno = yyrline[yyrule];
2535 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2537 /* Print the symbols being reduced, and their result. */
2538 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2539 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2540 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2543 # define YY_REDUCE_PRINT(Rule) \
2546 yy_reduce_print (Rule); \
2549 /* Nonzero means print parse trace. It is left uninitialized so that
2550 multiple parsers can coexist. */
2552 #else /* !YYDEBUG */
2553 # define YYDPRINTF(Args)
2554 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2555 # define YY_STACK_PRINT(Bottom, Top)
2556 # define YY_REDUCE_PRINT(Rule)
2557 #endif /* !YYDEBUG */
2560 /* YYINITDEPTH -- initial size of the parser's stacks. */
2562 # define YYINITDEPTH 200
2565 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2566 if the built-in stack extension method is used).
2568 Do not make this value too large; the results are undefined if
2569 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2570 evaluated with infinite-precision integer arithmetic. */
2573 # define YYMAXDEPTH 10000
2581 # if defined (__GLIBC__) && defined (_STRING_H)
2582 # define yystrlen strlen
2584 /* Return the length of YYSTR. */
2586 # if defined (__STDC__) || defined (__cplusplus)
2587 yystrlen (const char *yystr)
2593 const char *yys = yystr;
2595 while (*yys++ != '\0')
2598 return yys - yystr - 1;
2604 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2605 # define yystpcpy stpcpy
2607 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2610 # if defined (__STDC__) || defined (__cplusplus)
2611 yystpcpy (char *yydest, const char *yysrc)
2613 yystpcpy (yydest, yysrc)
2619 const char *yys = yysrc;
2621 while ((*yyd++ = *yys++) != '\0')
2630 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2631 quotes and backslashes, so that it's suitable for yyerror. The
2632 heuristic is that double-quoting is unnecessary unless the string
2633 contains an apostrophe, a comma, or backslash (other than
2634 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2635 null, do not copy; instead, return the length of what the result
2638 yytnamerr (char *yyres, const char *yystr)
2643 char const *yyp = yystr;
2650 goto do_not_strip_quotes;
2654 goto do_not_strip_quotes;
2667 do_not_strip_quotes: ;
2671 return yystrlen (yystr);
2673 return yystpcpy (yyres, yystr) - yyres;
2677 #endif /* YYERROR_VERBOSE */
2682 /*--------------------------------.
2683 | Print this symbol on YYOUTPUT. |
2684 `--------------------------------*/
2686 #if defined (__STDC__) || defined (__cplusplus)
2688 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2691 yysymprint (yyoutput, yytype, yyvaluep)
2697 /* Pacify ``unused variable'' warnings. */
2700 if (yytype < YYNTOKENS)
2701 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2703 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2707 if (yytype < YYNTOKENS)
2708 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2715 YYFPRINTF (yyoutput, ")");
2718 #endif /* ! YYDEBUG */
2719 /*-----------------------------------------------.
2720 | Release the memory associated to this symbol. |
2721 `-----------------------------------------------*/
2723 #if defined (__STDC__) || defined (__cplusplus)
2725 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2728 yydestruct (yymsg, yytype, yyvaluep)
2734 /* Pacify ``unused variable'' warnings. */
2739 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2750 /* Prevent warnings from -Wmissing-prototypes. */
2752 #ifdef YYPARSE_PARAM
2753 # if defined (__STDC__) || defined (__cplusplus)
2754 int yyparse (void *YYPARSE_PARAM);
2758 #else /* ! YYPARSE_PARAM */
2759 #if defined (__STDC__) || defined (__cplusplus)
2764 #endif /* ! YYPARSE_PARAM */
2768 /* The look-ahead symbol. */
2771 /* The semantic value of the look-ahead symbol. */
2774 /* Number of syntax errors so far. */
2783 #ifdef YYPARSE_PARAM
2784 # if defined (__STDC__) || defined (__cplusplus)
2785 int yyparse (void *YYPARSE_PARAM)
2787 int yyparse (YYPARSE_PARAM)
2788 void *YYPARSE_PARAM;
2790 #else /* ! YYPARSE_PARAM */
2791 #if defined (__STDC__) || defined (__cplusplus)
2805 /* Number of tokens to shift before error messages enabled. */
2807 /* Look-ahead token as an internal (translated) token number. */
2810 /* Three stacks and their tools:
2811 `yyss': related to states,
2812 `yyvs': related to semantic values,
2813 `yyls': related to locations.
2815 Refer to the stacks thru separate pointers, to allow yyoverflow
2816 to reallocate them elsewhere. */
2818 /* The state stack. */
2819 short int yyssa[YYINITDEPTH];
2820 short int *yyss = yyssa;
2823 /* The semantic value stack. */
2824 YYSTYPE yyvsa[YYINITDEPTH];
2825 YYSTYPE *yyvs = yyvsa;
2830 #define YYPOPSTACK (yyvsp--, yyssp--)
2832 YYSIZE_T yystacksize = YYINITDEPTH;
2834 /* The variables used to return semantic value and location from the
2839 /* When reducing, the number of symbols on the RHS of the reduced
2843 YYDPRINTF ((stderr, "Starting parse\n"));
2848 yychar = YYEMPTY; /* Cause a token to be read. */
2850 /* Initialize stack pointers.
2851 Waste one element of value and location stack
2852 so that they stay on the same level as the state stack.
2853 The wasted elements are never initialized. */
2860 /*------------------------------------------------------------.
2861 | yynewstate -- Push a new state, which is found in yystate. |
2862 `------------------------------------------------------------*/
2864 /* In all cases, when you get here, the value and location stacks
2865 have just been pushed. so pushing a state here evens the stacks.
2872 if (yyss + yystacksize - 1 <= yyssp)
2874 /* Get the current used size of the three stacks, in elements. */
2875 YYSIZE_T yysize = yyssp - yyss + 1;
2879 /* Give user a chance to reallocate the stack. Use copies of
2880 these so that the &'s don't force the real ones into
2882 YYSTYPE *yyvs1 = yyvs;
2883 short int *yyss1 = yyss;
2886 /* Each stack pointer address is followed by the size of the
2887 data in use in that stack, in bytes. This used to be a
2888 conditional around just the two extra args, but that might
2889 be undefined if yyoverflow is a macro. */
2890 yyoverflow (YY_("memory exhausted"),
2891 &yyss1, yysize * sizeof (*yyssp),
2892 &yyvs1, yysize * sizeof (*yyvsp),
2899 #else /* no yyoverflow */
2900 # ifndef YYSTACK_RELOCATE
2901 goto yyexhaustedlab;
2903 /* Extend the stack our own way. */
2904 if (YYMAXDEPTH <= yystacksize)
2905 goto yyexhaustedlab;
2907 if (YYMAXDEPTH < yystacksize)
2908 yystacksize = YYMAXDEPTH;
2911 short int *yyss1 = yyss;
2912 union yyalloc *yyptr =
2913 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2915 goto yyexhaustedlab;
2916 YYSTACK_RELOCATE (yyss);
2917 YYSTACK_RELOCATE (yyvs);
2919 # undef YYSTACK_RELOCATE
2921 YYSTACK_FREE (yyss1);
2924 #endif /* no yyoverflow */
2926 yyssp = yyss + yysize - 1;
2927 yyvsp = yyvs + yysize - 1;
2930 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2931 (unsigned long int) yystacksize));
2933 if (yyss + yystacksize - 1 <= yyssp)
2937 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2946 /* Do appropriate processing given the current state. */
2947 /* Read a look-ahead token if we need one and don't already have one. */
2950 /* First try to decide what to do without reference to look-ahead token. */
2952 yyn = yypact[yystate];
2953 if (yyn == YYPACT_NINF)
2956 /* Not known => get a look-ahead token if don't already have one. */
2958 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2959 if (yychar == YYEMPTY)
2961 YYDPRINTF ((stderr, "Reading a token: "));
2965 if (yychar <= YYEOF)
2967 yychar = yytoken = YYEOF;
2968 YYDPRINTF ((stderr, "Now at end of input.\n"));
2972 yytoken = YYTRANSLATE (yychar);
2973 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2976 /* If the proper action on seeing token YYTOKEN is to reduce or to
2977 detect an error, take that action. */
2979 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2984 if (yyn == 0 || yyn == YYTABLE_NINF)
2993 /* Shift the look-ahead token. */
2994 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2996 /* Discard the token being shifted unless it is eof. */
2997 if (yychar != YYEOF)
3003 /* Count tokens shifted since error; after three, turn off error
3012 /*-----------------------------------------------------------.
3013 | yydefault -- do the default action for the current state. |
3014 `-----------------------------------------------------------*/
3016 yyn = yydefact[yystate];
3022 /*-----------------------------.
3023 | yyreduce -- Do a reduction. |
3024 `-----------------------------*/
3026 /* yyn is the number of a rule to reduce with. */
3029 /* If YYLEN is nonzero, implement the default value of the action:
3032 Otherwise, the following line sets YYVAL to garbage.
3033 This behavior is undocumented and Bison
3034 users should not rely upon it. Assigning to YYVAL
3035 unconditionally makes the parser a bit smaller, and it avoids a
3036 GCC warning that YYVAL may be used uninitialized. */
3037 yyval = yyvsp[1-yylen];
3040 YY_REDUCE_PRINT (yyn);
3044 #line 1099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3045 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3049 #line 1099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3050 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3054 #line 1100 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3055 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3059 #line 1100 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3060 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3064 #line 1101 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3065 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3069 #line 1101 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3070 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3074 #line 1102 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3075 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3079 #line 1102 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3080 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3084 #line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3085 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3089 #line 1103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3090 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3094 #line 1107 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3095 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3099 #line 1107 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3100 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3104 #line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3105 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3109 #line 1108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3110 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3114 #line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3115 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3119 #line 1109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3120 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3124 #line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3125 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3129 #line 1110 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3130 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3134 #line 1111 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3135 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3139 #line 1111 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3140 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3144 #line 1112 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3145 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3149 #line 1112 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3150 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3154 #line 1113 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3155 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3159 #line 1113 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3160 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3164 #line 1114 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3165 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3169 #line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3170 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3174 #line 1124 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3175 { (yyval.StrVal) = 0; ;}
3179 #line 1128 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3181 (yyval.StrVal) = (yyvsp[-1].StrVal);
3187 #line 1132 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3195 #line 1139 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3197 (yyval.StrVal) = (yyvsp[-1].StrVal);
3203 #line 1143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3211 #line 1149 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3212 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3216 #line 1150 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3217 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3221 #line 1151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3222 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3226 #line 1152 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3227 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3231 #line 1153 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3232 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3236 #line 1157 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3237 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3241 #line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3242 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3246 #line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3247 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3251 #line 1163 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3252 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3256 #line 1164 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3257 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3261 #line 1168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3262 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3266 #line 1169 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3267 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3271 #line 1170 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3272 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3276 #line 1174 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3277 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3281 #line 1175 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3282 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3286 #line 1176 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3287 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3291 #line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3292 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3296 #line 1178 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3297 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3301 #line 1181 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3302 { (yyval.UIntVal) = CallingConv::C; ;}
3306 #line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3307 { (yyval.UIntVal) = CallingConv::C; ;}
3311 #line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3312 { (yyval.UIntVal) = CallingConv::Fast; ;}
3316 #line 1184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3317 { (yyval.UIntVal) = CallingConv::Cold; ;}
3321 #line 1185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3322 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3326 #line 1186 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3327 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3331 #line 1187 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3333 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3334 GEN_ERROR("Calling conv too large");
3335 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3341 #line 1194 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3342 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3346 #line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3347 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3351 #line 1196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3352 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
3356 #line 1197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3357 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
3361 #line 1200 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3362 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3366 #line 1201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3368 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3373 #line 1206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3374 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3378 #line 1207 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3379 { (yyval.ParamAttrs) = FunctionType::NoUnwindAttribute; ;}
3383 #line 1211 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3384 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3388 #line 1212 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3390 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3395 #line 1219 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3396 { (yyval.UIntVal) = 0; ;}
3400 #line 1220 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3402 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3403 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3404 GEN_ERROR("Alignment must be a power of two");
3410 #line 1226 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3411 { (yyval.UIntVal) = 0; ;}
3415 #line 1227 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3417 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3418 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3419 GEN_ERROR("Alignment must be a power of two");
3425 #line 1235 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3427 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3428 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3429 GEN_ERROR("Invalid character in section name");
3430 (yyval.StrVal) = (yyvsp[0].StrVal);
3436 #line 1243 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3437 { (yyval.StrVal) = 0; ;}
3441 #line 1244 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3442 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3446 #line 1249 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3451 #line 1250 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3456 #line 1251 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3458 CurGV->setSection((yyvsp[0].StrVal));
3459 free((yyvsp[0].StrVal));
3465 #line 1256 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3467 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3468 GEN_ERROR("Alignment must be a power of two");
3469 CurGV->setAlignment((yyvsp[0].UInt64Val));
3475 #line 1272 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3477 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3483 #line 1276 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3485 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3491 #line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3493 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3494 GEN_ERROR("Cannot form a pointer to a basic block");
3495 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3496 delete (yyvsp[-1].TypeVal);
3502 #line 1287 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3503 { // Named types are also simple types...
3504 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3506 (yyval.TypeVal) = new PATypeHolder(tmp);
3511 #line 1292 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3512 { // Type UpReference
3513 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3514 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3515 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3516 (yyval.TypeVal) = new PATypeHolder(OT);
3517 UR_OUT("New Upreference!\n");
3523 #line 1300 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3525 std::vector<const Type*> Params;
3526 std::vector<FunctionType::ParameterAttributes> Attrs;
3527 Attrs.push_back((yyvsp[0].ParamAttrs));
3528 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3529 const Type *Ty = I->Ty->get();
3530 Params.push_back(Ty);
3531 if (Ty != Type::VoidTy)
3532 Attrs.push_back(I->Attrs);
3534 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3535 if (isVarArg) Params.pop_back();
3537 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3538 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3539 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3540 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3546 #line 1319 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3548 std::vector<const Type*> Params;
3549 std::vector<FunctionType::ParameterAttributes> Attrs;
3550 Attrs.push_back((yyvsp[0].ParamAttrs));
3551 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3552 const Type* Ty = I->Ty->get();
3553 Params.push_back(Ty);
3554 if (Ty != Type::VoidTy)
3555 Attrs.push_back(I->Attrs);
3557 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3558 if (isVarArg) Params.pop_back();
3560 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3561 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3562 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3568 #line 1338 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3569 { // Sized array type?
3570 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3571 delete (yyvsp[-1].TypeVal);
3577 #line 1343 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3579 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3580 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3581 GEN_ERROR("Unsigned result not equal to signed result");
3582 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3583 GEN_ERROR("Element type of a VectorType must be primitive");
3584 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3585 GEN_ERROR("Vector length should be a power of 2");
3586 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3587 delete (yyvsp[-1].TypeVal);
3593 #line 1355 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3594 { // Structure type?
3595 std::vector<const Type*> Elements;
3596 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3597 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3598 Elements.push_back(*I);
3600 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3601 delete (yyvsp[-1].TypeList);
3607 #line 1365 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3608 { // Empty structure type?
3609 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3615 #line 1369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3617 std::vector<const Type*> Elements;
3618 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3619 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3620 Elements.push_back(*I);
3622 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3623 delete (yyvsp[-2].TypeList);
3629 #line 1379 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3630 { // Empty structure type?
3631 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3637 #line 1386 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3639 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3640 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3645 #line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3647 if (!UpRefs.empty())
3648 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3649 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3650 GEN_ERROR("LLVM functions cannot return aggregate types");
3651 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3656 #line 1400 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3658 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3663 #line 1405 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3665 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3666 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3672 #line 1410 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3674 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3680 #line 1418 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3682 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3683 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3684 TWA.Ty = new PATypeHolder(Type::VoidTy);
3685 (yyval.TypeWithAttrsList)->push_back(TWA);
3691 #line 1425 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3693 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3694 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3695 TWA.Ty = new PATypeHolder(Type::VoidTy);
3696 (yyval.TypeWithAttrsList)->push_back(TWA);
3702 #line 1432 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3704 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3710 #line 1440 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3712 (yyval.TypeList) = new std::list<PATypeHolder>();
3713 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal));
3714 delete (yyvsp[0].TypeVal);
3720 #line 1446 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3722 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal));
3723 delete (yyvsp[0].TypeVal);
3729 #line 1458 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3730 { // Nonempty unsized arr
3731 if (!UpRefs.empty())
3732 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3733 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3735 GEN_ERROR("Cannot make array constant with type: '" +
3736 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3737 const Type *ETy = ATy->getElementType();
3738 int NumElements = ATy->getNumElements();
3740 // Verify that we have the correct size...
3741 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3742 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3743 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3744 itostr(NumElements) + "");
3746 // Verify all elements are correct type!
3747 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3748 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3749 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3750 ETy->getDescription() +"' as required!\nIt is of type '"+
3751 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3754 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3755 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3761 #line 1486 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3763 if (!UpRefs.empty())
3764 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3765 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3767 GEN_ERROR("Cannot make array constant with type: '" +
3768 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3770 int NumElements = ATy->getNumElements();
3771 if (NumElements != -1 && NumElements != 0)
3772 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3773 " arguments, but has size of " + itostr(NumElements) +"");
3774 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3775 delete (yyvsp[-2].TypeVal);
3781 #line 1502 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3783 if (!UpRefs.empty())
3784 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3785 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3787 GEN_ERROR("Cannot make array constant with type: '" +
3788 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3790 int NumElements = ATy->getNumElements();
3791 const Type *ETy = ATy->getElementType();
3792 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3793 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3794 GEN_ERROR("Can't build string constant of size " +
3795 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3796 " when array has size " + itostr(NumElements) + "");
3797 std::vector<Constant*> Vals;
3798 if (ETy == Type::Int8Ty) {
3799 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3800 C != (unsigned char*)EndStr; ++C)
3801 Vals.push_back(ConstantInt::get(ETy, *C));
3803 free((yyvsp[0].StrVal));
3804 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3806 free((yyvsp[0].StrVal));
3807 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3808 delete (yyvsp[-2].TypeVal);
3814 #line 1531 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3815 { // Nonempty unsized arr
3816 if (!UpRefs.empty())
3817 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3818 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3820 GEN_ERROR("Cannot make packed constant with type: '" +
3821 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3822 const Type *ETy = PTy->getElementType();
3823 int NumElements = PTy->getNumElements();
3825 // Verify that we have the correct size...
3826 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3827 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3828 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3829 itostr(NumElements) + "");
3831 // Verify all elements are correct type!
3832 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3833 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3834 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3835 ETy->getDescription() +"' as required!\nIt is of type '"+
3836 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3839 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3840 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3846 #line 1559 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3848 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3850 GEN_ERROR("Cannot make struct constant with type: '" +
3851 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3853 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3854 GEN_ERROR("Illegal number of initializers for structure type");
3856 // Check to ensure that constants are compatible with the type initializer!
3857 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3858 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3859 GEN_ERROR("Expected type '" +
3860 STy->getElementType(i)->getDescription() +
3861 "' for element #" + utostr(i) +
3862 " of structure initializer");
3864 // Check to ensure that Type is not packed
3865 if (STy->isPacked())
3866 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3868 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3869 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3875 #line 1584 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3877 if (!UpRefs.empty())
3878 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3879 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3881 GEN_ERROR("Cannot make struct constant with type: '" +
3882 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3884 if (STy->getNumContainedTypes() != 0)
3885 GEN_ERROR("Illegal number of initializers for structure type");
3887 // Check to ensure that Type is not packed
3888 if (STy->isPacked())
3889 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3891 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3892 delete (yyvsp[-2].TypeVal);
3898 #line 1603 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3900 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3902 GEN_ERROR("Cannot make struct constant with type: '" +
3903 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3905 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3906 GEN_ERROR("Illegal number of initializers for structure type");
3908 // Check to ensure that constants are compatible with the type initializer!
3909 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3910 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3911 GEN_ERROR("Expected type '" +
3912 STy->getElementType(i)->getDescription() +
3913 "' for element #" + utostr(i) +
3914 " of structure initializer");
3916 // Check to ensure that Type is packed
3917 if (!STy->isPacked())
3918 GEN_ERROR("Vector initializer to non-vector type '" +
3919 STy->getDescription() + "'");
3921 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3922 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3928 #line 1629 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3930 if (!UpRefs.empty())
3931 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3932 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3934 GEN_ERROR("Cannot make struct constant with type: '" +
3935 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3937 if (STy->getNumContainedTypes() != 0)
3938 GEN_ERROR("Illegal number of initializers for structure type");
3940 // Check to ensure that Type is packed
3941 if (!STy->isPacked())
3942 GEN_ERROR("Vector initializer to non-vector type '" +
3943 STy->getDescription() + "'");
3945 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3946 delete (yyvsp[-4].TypeVal);
3952 #line 1649 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3954 if (!UpRefs.empty())
3955 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3956 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3958 GEN_ERROR("Cannot make null pointer constant with type: '" +
3959 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3961 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3962 delete (yyvsp[-1].TypeVal);
3968 #line 1661 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3970 if (!UpRefs.empty())
3971 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3972 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3973 delete (yyvsp[-1].TypeVal);
3979 #line 1668 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
3981 if (!UpRefs.empty())
3982 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3983 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3985 GEN_ERROR("Global const reference must be a pointer type");
3987 // ConstExprs can exist in the body of a function, thus creating
3988 // GlobalValues whenever they refer to a variable. Because we are in
3989 // the context of a function, getExistingVal will search the functions
3990 // symbol table instead of the module symbol table for the global symbol,
3991 // which throws things all off. To get around this, we just tell
3992 // getExistingVal that we are at global scope here.
3994 Function *SavedCurFn = CurFun.CurrentFunction;
3995 CurFun.CurrentFunction = 0;
3997 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
4000 CurFun.CurrentFunction = SavedCurFn;
4002 // If this is an initializer for a constant pointer, which is referencing a
4003 // (currently) undefined variable, create a stub now that shall be replaced
4004 // in the future with the right type of variable.
4007 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4008 const PointerType *PT = cast<PointerType>(Ty);
4010 // First check to see if the forward references value is already created!
4011 PerModuleInfo::GlobalRefsType::iterator I =
4012 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
4014 if (I != CurModule.GlobalRefs.end()) {
4015 V = I->second; // Placeholder already exists, use it...
4016 (yyvsp[0].ValIDVal).destroy();
4019 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4020 Name = (yyvsp[0].ValIDVal).Name;
4021 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4022 GEN_ERROR("Invalid reference to global");
4024 // Create the forward referenced global.
4026 if (const FunctionType *FTy =
4027 dyn_cast<FunctionType>(PT->getElementType())) {
4028 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
4029 CurModule.CurrentModule);
4031 GV = new GlobalVariable(PT->getElementType(), false,
4032 GlobalValue::ExternalLinkage, 0,
4033 Name, CurModule.CurrentModule);
4036 // Keep track of the fact that we have a forward ref to recycle it
4037 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4042 (yyval.ConstVal) = cast<GlobalValue>(V);
4043 delete (yyvsp[-1].TypeVal); // Free the type handle
4049 #line 1734 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4051 if (!UpRefs.empty())
4052 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4053 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4054 GEN_ERROR("Mismatched types for constant expression: " +
4055 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4056 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4057 delete (yyvsp[-1].TypeVal);
4063 #line 1744 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4065 if (!UpRefs.empty())
4066 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4067 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4068 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4069 GEN_ERROR("Cannot create a null initialized value of this type");
4070 (yyval.ConstVal) = Constant::getNullValue(Ty);
4071 delete (yyvsp[-1].TypeVal);
4077 #line 1754 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4078 { // integral constants
4079 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4080 GEN_ERROR("Constant value doesn't fit in type");
4081 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4087 #line 1760 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4088 { // arbitrary precision integer constants
4089 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4090 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4091 GEN_ERROR("Constant value does not fit in type");
4093 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4094 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4095 delete (yyvsp[0].APIntVal);
4101 #line 1770 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4102 { // integral constants
4103 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4104 GEN_ERROR("Constant value doesn't fit in type");
4105 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4111 #line 1776 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4112 { // arbitrary precision integer constants
4113 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4114 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4115 GEN_ERROR("Constant value does not fit in type");
4117 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4118 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4119 delete (yyvsp[0].APIntVal);
4125 #line 1786 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4126 { // Boolean constants
4127 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4128 (yyval.ConstVal) = ConstantInt::getTrue();
4134 #line 1791 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4135 { // Boolean constants
4136 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4137 (yyval.ConstVal) = ConstantInt::getFalse();
4143 #line 1796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4144 { // Float & Double constants
4145 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4146 GEN_ERROR("Floating point constant invalid for type");
4147 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4153 #line 1804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4155 if (!UpRefs.empty())
4156 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4157 Constant *Val = (yyvsp[-3].ConstVal);
4158 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4159 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4160 GEN_ERROR("invalid cast opcode for cast from '" +
4161 Val->getType()->getDescription() + "' to '" +
4162 DestTy->getDescription() + "'");
4163 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4164 delete (yyvsp[-1].TypeVal);
4169 #line 1816 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4171 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4172 GEN_ERROR("GetElementPtr requires a pointer operand");
4175 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4178 GEN_ERROR("Index list invalid for constant getelementptr");
4180 SmallVector<Constant*, 8> IdxVec;
4181 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4182 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4183 IdxVec.push_back(C);
4185 GEN_ERROR("Indices to constant getelementptr must be constants");
4187 delete (yyvsp[-1].ValueList);
4189 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4195 #line 1838 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4197 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4198 GEN_ERROR("Select condition must be of boolean type");
4199 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4200 GEN_ERROR("Select operand types must match");
4201 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4207 #line 1846 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4209 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4210 GEN_ERROR("Binary operator types must match");
4212 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4217 #line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4219 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4220 GEN_ERROR("Logical operator types must match");
4221 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4222 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4223 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4224 GEN_ERROR("Logical operator requires integral operands");
4226 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4232 #line 1863 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4234 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4235 GEN_ERROR("icmp operand types must match");
4236 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4241 #line 1868 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4243 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4244 GEN_ERROR("fcmp operand types must match");
4245 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4250 #line 1873 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4252 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4253 GEN_ERROR("Invalid extractelement operands");
4254 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4260 #line 1879 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4262 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4263 GEN_ERROR("Invalid insertelement operands");
4264 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4270 #line 1885 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4272 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4273 GEN_ERROR("Invalid shufflevector operands");
4274 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4280 #line 1894 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4282 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4288 #line 1898 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4290 (yyval.ConstVector) = new std::vector<Constant*>();
4291 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4297 #line 1906 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4298 { (yyval.BoolVal) = false; ;}
4302 #line 1906 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4303 { (yyval.BoolVal) = true; ;}
4307 #line 1917 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4309 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4310 CurModule.ModuleDone();
4316 #line 1922 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4318 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4319 CurModule.ModuleDone();
4325 #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4326 { CurFun.isDeclare = false; ;}
4330 #line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4332 CurFun.FunctionDone();
4338 #line 1939 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4339 { CurFun.isDeclare = true; ;}
4343 #line 1939 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4350 #line 1942 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4357 #line 1945 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4359 if (!UpRefs.empty())
4360 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4361 // Eagerly resolve types. This is not an optimization, this is a
4362 // requirement that is due to the fact that we could have this:
4364 // %list = type { %list * }
4365 // %list = type { %list * } ; repeated type decl
4367 // If types are not resolved eagerly, then the two types will not be
4368 // determined to be the same type!
4370 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4372 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4374 // If this is a named type that is not a redefinition, add it to the slot
4376 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4379 delete (yyvsp[0].TypeVal);
4385 #line 1969 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4387 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4389 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4391 // If this is a named type that is not a redefinition, add it to the slot
4393 CurModule.Types.push_back((yyvsp[0].PrimType));
4400 #line 1980 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4402 /* "Externally Visible" Linkage */
4403 if ((yyvsp[0].ConstVal) == 0)
4404 GEN_ERROR("Global value initializer is not a constant");
4405 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4406 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4412 #line 1987 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4419 #line 1990 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4421 if ((yyvsp[0].ConstVal) == 0)
4422 GEN_ERROR("Global value initializer is not a constant");
4423 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4429 #line 1995 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4436 #line 1998 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4438 if (!UpRefs.empty())
4439 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4440 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4442 delete (yyvsp[0].TypeVal);
4447 #line 2004 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4455 #line 2008 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4462 #line 2011 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4469 #line 2017 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4471 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4472 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4473 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4474 free((yyvsp[0].StrVal));
4476 if (AsmSoFar.empty())
4477 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4479 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4485 #line 2030 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4487 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4488 free((yyvsp[0].StrVal));
4493 #line 2034 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4495 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4496 free((yyvsp[0].StrVal));
4501 #line 2041 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4503 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4504 free((yyvsp[0].StrVal));
4510 #line 2046 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4512 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4513 free((yyvsp[0].StrVal));
4519 #line 2051 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4526 #line 2060 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4528 if (!UpRefs.empty())
4529 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4530 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4531 GEN_ERROR("void typed arguments are invalid");
4532 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4533 (yyval.ArgList) = (yyvsp[-4].ArgList);
4534 (yyvsp[-4].ArgList)->push_back(E);
4540 #line 2070 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4542 if (!UpRefs.empty())
4543 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4544 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4545 GEN_ERROR("void typed arguments are invalid");
4546 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4547 (yyval.ArgList) = new ArgListType;
4548 (yyval.ArgList)->push_back(E);
4554 #line 2081 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4556 (yyval.ArgList) = (yyvsp[0].ArgList);
4562 #line 2085 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4564 (yyval.ArgList) = (yyvsp[-2].ArgList);
4565 struct ArgListEntry E;
4566 E.Ty = new PATypeHolder(Type::VoidTy);
4568 E.Attrs = FunctionType::NoAttributeSet;
4569 (yyval.ArgList)->push_back(E);
4575 #line 2094 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4577 (yyval.ArgList) = new ArgListType;
4578 struct ArgListEntry E;
4579 E.Ty = new PATypeHolder(Type::VoidTy);
4581 E.Attrs = FunctionType::NoAttributeSet;
4582 (yyval.ArgList)->push_back(E);
4588 #line 2103 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4590 (yyval.ArgList) = 0;
4596 #line 2109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4598 UnEscapeLexed((yyvsp[-6].StrVal));
4599 std::string FunctionName((yyvsp[-6].StrVal));
4600 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4602 // Check the function result for abstractness if this is a define. We should
4603 // have no abstract types at this point
4604 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4605 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4607 std::vector<const Type*> ParamTypeList;
4608 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4609 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4610 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4611 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4612 const Type* Ty = I->Ty->get();
4613 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4614 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4615 ParamTypeList.push_back(Ty);
4616 if (Ty != Type::VoidTy)
4617 ParamAttrs.push_back(I->Attrs);
4621 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4622 if (isVarArg) ParamTypeList.pop_back();
4624 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4626 const PointerType *PFT = PointerType::get(FT);
4627 delete (yyvsp[-7].TypeVal);
4630 if (!FunctionName.empty()) {
4631 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4633 ID = ValID::createGlobalID(CurModule.Values.size());
4637 // See if this function was forward referenced. If so, recycle the object.
4638 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4639 // Move the function to the end of the list, from whereever it was
4640 // previously inserted.
4641 Fn = cast<Function>(FWRef);
4642 CurModule.CurrentModule->getFunctionList().remove(Fn);
4643 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4644 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4645 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4646 if (Fn->getFunctionType() != FT ) {
4647 // The existing function doesn't have the same type. This is an overload
4649 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4650 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4651 // Neither the existing or the current function is a declaration and they
4652 // have the same name and same type. Clearly this is a redefinition.
4653 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4654 } if (Fn->isDeclaration()) {
4655 // Make sure to strip off any argument names so we can't get conflicts.
4656 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4660 } else { // Not already defined?
4661 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4662 CurModule.CurrentModule);
4664 InsertValue(Fn, CurModule.Values);
4667 CurFun.FunctionStart(Fn);
4669 if (CurFun.isDeclare) {
4670 // If we have declaration, always overwrite linkage. This will allow us to
4671 // correctly handle cases, when pointer to function is passed as argument to
4672 // another function.
4673 Fn->setLinkage(CurFun.Linkage);
4674 Fn->setVisibility(CurFun.Visibility);
4676 Fn->setCallingConv((yyvsp[-8].UIntVal));
4677 Fn->setAlignment((yyvsp[0].UIntVal));
4678 if ((yyvsp[-1].StrVal)) {
4679 Fn->setSection((yyvsp[-1].StrVal));
4680 free((yyvsp[-1].StrVal));
4683 // Add all of the arguments we parsed to the function...
4684 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4685 if (isVarArg) { // Nuke the last entry
4686 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4687 "Not a varargs marker!");
4688 delete (yyvsp[-4].ArgList)->back().Ty;
4689 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4691 Function::arg_iterator ArgIt = Fn->arg_begin();
4692 Function::arg_iterator ArgEnd = Fn->arg_end();
4694 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4695 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4696 delete I->Ty; // Delete the typeholder...
4697 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4703 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4710 #line 2222 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4712 (yyval.FunctionVal) = CurFun.CurrentFunction;
4714 // Make sure that we keep track of the linkage type even if there was a
4715 // previous "declare".
4716 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4717 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4722 #line 2233 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4724 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4730 #line 2238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4732 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4733 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4734 (yyval.FunctionVal) = CurFun.CurrentFunction;
4735 CurFun.FunctionDone();
4741 #line 2250 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4743 (yyval.BoolVal) = false;
4749 #line 2254 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4751 (yyval.BoolVal) = true;
4757 #line 2259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4758 { // A reference to a direct constant
4759 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4765 #line 2263 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4767 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4773 #line 2267 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4774 { // Perhaps it's an FP constant?
4775 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4781 #line 2271 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4783 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4789 #line 2275 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4791 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4797 #line 2279 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4799 (yyval.ValIDVal) = ValID::createNull();
4805 #line 2283 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4807 (yyval.ValIDVal) = ValID::createUndef();
4813 #line 2287 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4814 { // A vector zero constant.
4815 (yyval.ValIDVal) = ValID::createZeroInit();
4821 #line 2291 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4822 { // Nonempty unsized packed vector
4823 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4824 int NumElements = (yyvsp[-1].ConstVector)->size();
4826 VectorType* pt = VectorType::get(ETy, NumElements);
4827 PATypeHolder* PTy = new PATypeHolder(
4835 // Verify all elements are correct type!
4836 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4837 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4838 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4839 ETy->getDescription() +"' as required!\nIt is of type '" +
4840 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4843 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
4844 delete PTy; delete (yyvsp[-1].ConstVector);
4850 #line 2316 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4852 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4858 #line 2320 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4860 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4861 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4862 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4863 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4864 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4865 free((yyvsp[-2].StrVal));
4866 free((yyvsp[0].StrVal));
4872 #line 2334 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4873 { // Is it an integer reference...?
4874 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4880 #line 2338 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4882 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4888 #line 2342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4889 { // Is it a named reference...?
4890 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4896 #line 2346 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4897 { // Is it a named reference...?
4898 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4904 #line 2358 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4906 if (!UpRefs.empty())
4907 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4908 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4909 delete (yyvsp[-1].TypeVal);
4915 #line 2367 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4917 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4923 #line 2371 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4924 { // Do not allow functions with 0 basic blocks
4925 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4931 #line 2380 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4933 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4935 InsertValue((yyvsp[0].TermInstVal));
4936 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4937 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4943 #line 2389 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4945 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4946 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4947 if (CI2->getParent() == 0)
4948 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4949 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4950 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4956 #line 2398 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4957 { // Empty space between instruction lists
4958 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4964 #line 2402 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4965 { // Labelled (named) basic block
4966 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal)));
4972 #line 2407 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4973 { // Return with a result...
4974 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4980 #line 2411 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4981 { // Return with no result...
4982 (yyval.TermInstVal) = new ReturnInst();
4988 #line 2415 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4989 { // Unconditional Branch...
4990 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4992 (yyval.TermInstVal) = new BranchInst(tmpBB);
4997 #line 2420 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
4999 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
5000 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
5002 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5004 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5006 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5011 #line 2430 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5013 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5015 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5017 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5018 (yyval.TermInstVal) = S;
5020 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5021 E = (yyvsp[-1].JumpTable)->end();
5022 for (; I != E; ++I) {
5023 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5024 S->addCase(CI, I->second);
5026 GEN_ERROR("Switch case is constant, but not a simple integer");
5028 delete (yyvsp[-1].JumpTable);
5034 #line 2449 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5036 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5038 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5040 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5041 (yyval.TermInstVal) = S;
5047 #line 2459 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5050 // Handle the short syntax
5051 const PointerType *PFTy = 0;
5052 const FunctionType *Ty = 0;
5053 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5054 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5055 // Pull out the types of all of the arguments...
5056 std::vector<const Type*> ParamTypes;
5057 FunctionType::ParamAttrsList ParamAttrs;
5058 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5059 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
5060 const Type *Ty = I->Val->getType();
5061 if (Ty == Type::VoidTy)
5062 GEN_ERROR("Short call syntax cannot be used with varargs");
5063 ParamTypes.push_back(Ty);
5064 ParamAttrs.push_back(I->Attrs);
5067 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5068 PFTy = PointerType::get(Ty);
5071 delete (yyvsp[-11].TypeVal);
5073 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5075 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5077 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5080 // Check the arguments
5082 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5083 // Make sure no arguments is a good thing!
5084 if (Ty->getNumParams() != 0)
5085 GEN_ERROR("No arguments passed to a function that "
5086 "expects arguments");
5087 } else { // Has arguments?
5088 // Loop through FunctionType's arguments and ensure they are specified
5090 FunctionType::param_iterator I = Ty->param_begin();
5091 FunctionType::param_iterator E = Ty->param_end();
5092 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5094 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5095 if (ArgI->Val->getType() != *I)
5096 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5097 (*I)->getDescription() + "'");
5098 Args.push_back(ArgI->Val);
5101 if (Ty->isVarArg()) {
5103 for (; ArgI != ArgE; ++ArgI)
5104 Args.push_back(ArgI->Val); // push the remaining varargs
5105 } else if (I != E || ArgI != ArgE)
5106 GEN_ERROR("Invalid number of parameters detected");
5109 // Create the InvokeInst
5110 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5111 II->setCallingConv((yyvsp[-12].UIntVal));
5112 (yyval.TermInstVal) = II;
5113 delete (yyvsp[-8].ValueRefList);
5119 #line 2527 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5121 (yyval.TermInstVal) = new UnwindInst();
5127 #line 2531 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5129 (yyval.TermInstVal) = new UnreachableInst();
5135 #line 2538 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5137 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5138 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5141 GEN_ERROR("May only switch on a constant pool value");
5143 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5145 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5150 #line 2549 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5152 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5153 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5157 GEN_ERROR("May only switch on a constant pool value");
5159 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5161 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5166 #line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5168 // Is this definition named?? if so, assign the name...
5169 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5171 InsertValue((yyvsp[0].InstVal));
5172 (yyval.InstVal) = (yyvsp[0].InstVal);
5178 #line 2572 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5179 { // Used for PHI nodes
5180 if (!UpRefs.empty())
5181 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5182 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5183 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5185 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5187 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5188 delete (yyvsp[-5].TypeVal);
5193 #line 2583 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5195 (yyval.PHIList) = (yyvsp[-6].PHIList);
5196 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5198 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5200 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5205 #line 2593 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5207 if (!UpRefs.empty())
5208 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5209 // Used for call and invoke instructions
5210 (yyval.ValueRefList) = new ValueRefList();
5211 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5212 (yyval.ValueRefList)->push_back(E);
5213 delete (yyvsp[-2].TypeVal);
5218 #line 2602 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5220 if (!UpRefs.empty())
5221 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5222 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5223 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5224 (yyval.ValueRefList)->push_back(E);
5225 delete (yyvsp[-2].TypeVal);
5231 #line 2611 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5232 { (yyval.ValueRefList) = new ValueRefList(); ;}
5236 #line 2614 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5237 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5241 #line 2615 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5243 (yyval.ValueList) = (yyvsp[-2].ValueList);
5244 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5250 #line 2622 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5252 (yyval.BoolVal) = true;
5258 #line 2626 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5260 (yyval.BoolVal) = false;
5266 #line 2631 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5268 if (!UpRefs.empty())
5269 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5270 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5271 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5273 "Arithmetic operator requires integer, FP, or packed operands");
5274 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5275 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5276 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5277 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5278 GEN_ERROR("Remainder not supported on vector types");
5279 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5281 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5283 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5284 if ((yyval.InstVal) == 0)
5285 GEN_ERROR("binary operator returned null");
5286 delete (yyvsp[-3].TypeVal);
5291 #line 2652 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5293 if (!UpRefs.empty())
5294 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5295 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5296 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5297 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5298 GEN_ERROR("Logical operator requires integral operands");
5300 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5302 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5304 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5305 if ((yyval.InstVal) == 0)
5306 GEN_ERROR("binary operator returned null");
5307 delete (yyvsp[-3].TypeVal);
5312 #line 2669 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5314 if (!UpRefs.empty())
5315 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5316 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5317 GEN_ERROR("Vector types not supported by icmp instruction");
5318 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5320 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5322 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5323 if ((yyval.InstVal) == 0)
5324 GEN_ERROR("icmp operator returned null");
5325 delete (yyvsp[-3].TypeVal);
5330 #line 2683 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5332 if (!UpRefs.empty())
5333 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5334 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5335 GEN_ERROR("Vector types not supported by fcmp instruction");
5336 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5338 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5340 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5341 if ((yyval.InstVal) == 0)
5342 GEN_ERROR("fcmp operator returned null");
5343 delete (yyvsp[-3].TypeVal);
5348 #line 2697 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5350 if (!UpRefs.empty())
5351 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5352 Value* Val = (yyvsp[-2].ValueVal);
5353 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5354 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5355 GEN_ERROR("invalid cast opcode for cast from '" +
5356 Val->getType()->getDescription() + "' to '" +
5357 DestTy->getDescription() + "'");
5358 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5359 delete (yyvsp[0].TypeVal);
5364 #line 2709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5366 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5367 GEN_ERROR("select condition must be boolean");
5368 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5369 GEN_ERROR("select value types should match");
5370 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5376 #line 2717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5378 if (!UpRefs.empty())
5379 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5380 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5381 delete (yyvsp[0].TypeVal);
5387 #line 2724 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5389 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5390 GEN_ERROR("Invalid extractelement operands");
5391 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5397 #line 2730 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5399 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5400 GEN_ERROR("Invalid insertelement operands");
5401 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5407 #line 2736 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5409 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5410 GEN_ERROR("Invalid shufflevector operands");
5411 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5417 #line 2742 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5419 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5420 if (!Ty->isFirstClassType())
5421 GEN_ERROR("PHI node operands must be of first class type");
5422 (yyval.InstVal) = new PHINode(Ty);
5423 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5424 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5425 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5426 GEN_ERROR("All elements of a PHI node must be of the same type");
5427 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5428 (yyvsp[0].PHIList)->pop_front();
5430 delete (yyvsp[0].PHIList); // Free the list...
5436 #line 2758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5439 // Handle the short syntax
5440 const PointerType *PFTy = 0;
5441 const FunctionType *Ty = 0;
5442 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5443 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5444 // Pull out the types of all of the arguments...
5445 std::vector<const Type*> ParamTypes;
5446 FunctionType::ParamAttrsList ParamAttrs;
5447 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5448 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5449 const Type *Ty = I->Val->getType();
5450 if (Ty == Type::VoidTy)
5451 GEN_ERROR("Short call syntax cannot be used with varargs");
5452 ParamTypes.push_back(Ty);
5453 ParamAttrs.push_back(I->Attrs);
5456 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5457 PFTy = PointerType::get(Ty);
5460 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5463 // Check the arguments
5465 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5466 // Make sure no arguments is a good thing!
5467 if (Ty->getNumParams() != 0)
5468 GEN_ERROR("No arguments passed to a function that "
5469 "expects arguments");
5470 } else { // Has arguments?
5471 // Loop through FunctionType's arguments and ensure they are specified
5474 FunctionType::param_iterator I = Ty->param_begin();
5475 FunctionType::param_iterator E = Ty->param_end();
5476 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5478 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5479 if (ArgI->Val->getType() != *I)
5480 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5481 (*I)->getDescription() + "'");
5482 Args.push_back(ArgI->Val);
5484 if (Ty->isVarArg()) {
5486 for (; ArgI != ArgE; ++ArgI)
5487 Args.push_back(ArgI->Val); // push the remaining varargs
5488 } else if (I != E || ArgI != ArgE)
5489 GEN_ERROR("Invalid number of parameters detected");
5491 // Create the call node
5492 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5493 CI->setTailCall((yyvsp[-7].BoolVal));
5494 CI->setCallingConv((yyvsp[-6].UIntVal));
5495 (yyval.InstVal) = CI;
5496 delete (yyvsp[-2].ValueRefList);
5497 delete (yyvsp[-5].TypeVal);
5503 #line 2821 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5505 (yyval.InstVal) = (yyvsp[0].InstVal);
5511 #line 2826 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5513 (yyval.BoolVal) = true;
5519 #line 2830 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5521 (yyval.BoolVal) = false;
5527 #line 2837 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5529 if (!UpRefs.empty())
5530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5531 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5532 delete (yyvsp[-1].TypeVal);
5538 #line 2844 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5540 if (!UpRefs.empty())
5541 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5542 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5544 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5545 delete (yyvsp[-4].TypeVal);
5550 #line 2852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5552 if (!UpRefs.empty())
5553 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5554 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5555 delete (yyvsp[-1].TypeVal);
5561 #line 2859 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5563 if (!UpRefs.empty())
5564 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5565 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5567 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5568 delete (yyvsp[-4].TypeVal);
5573 #line 2867 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5575 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5576 GEN_ERROR("Trying to free nonpointer type " +
5577 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5578 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5584 #line 2875 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5586 if (!UpRefs.empty())
5587 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5588 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5589 GEN_ERROR("Can't load from nonpointer type: " +
5590 (*(yyvsp[-1].TypeVal))->getDescription());
5591 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5592 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5593 (*(yyvsp[-1].TypeVal))->getDescription());
5594 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5596 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5597 delete (yyvsp[-1].TypeVal);
5602 #line 2889 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5604 if (!UpRefs.empty())
5605 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5606 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5608 GEN_ERROR("Can't store to a nonpointer type: " +
5609 (*(yyvsp[-1].TypeVal))->getDescription());
5610 const Type *ElTy = PT->getElementType();
5611 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5612 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5613 "' into space of type '" + ElTy->getDescription() + "'");
5615 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5617 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5618 delete (yyvsp[-1].TypeVal);
5623 #line 2906 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5625 if (!UpRefs.empty())
5626 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5627 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5628 GEN_ERROR("getelementptr insn requires pointer operand");
5630 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5631 GEN_ERROR("Invalid getelementptr indices for type '" +
5632 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5633 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5635 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5636 delete (yyvsp[-2].TypeVal);
5637 delete (yyvsp[0].ValueList);
5645 /* Line 1126 of yacc.c. */
5646 #line 5647 "llvmAsmParser.tab.c"
5652 YY_STACK_PRINT (yyss, yyssp);
5657 /* Now `shift' the result of the reduction. Determine what state
5658 that goes to, based on the state we popped back to and the rule
5659 number reduced by. */
5663 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5664 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5665 yystate = yytable[yystate];
5667 yystate = yydefgoto[yyn - YYNTOKENS];
5672 /*------------------------------------.
5673 | yyerrlab -- here on detecting error |
5674 `------------------------------------*/
5676 /* If not already recovering from an error, report this error. */
5681 yyn = yypact[yystate];
5683 if (YYPACT_NINF < yyn && yyn < YYLAST)
5685 int yytype = YYTRANSLATE (yychar);
5686 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5687 YYSIZE_T yysize = yysize0;
5689 int yysize_overflow = 0;
5691 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5692 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5696 /* This is so xgettext sees the translatable formats that are
5697 constructed on the fly. */
5698 YY_("syntax error, unexpected %s");
5699 YY_("syntax error, unexpected %s, expecting %s");
5700 YY_("syntax error, unexpected %s, expecting %s or %s");
5701 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5702 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5706 static char const yyunexpected[] = "syntax error, unexpected %s";
5707 static char const yyexpecting[] = ", expecting %s";
5708 static char const yyor[] = " or %s";
5709 char yyformat[sizeof yyunexpected
5710 + sizeof yyexpecting - 1
5711 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5712 * (sizeof yyor - 1))];
5713 char const *yyprefix = yyexpecting;
5715 /* Start YYX at -YYN if negative to avoid negative indexes in
5717 int yyxbegin = yyn < 0 ? -yyn : 0;
5719 /* Stay within bounds of both yycheck and yytname. */
5720 int yychecklim = YYLAST - yyn;
5721 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5724 yyarg[0] = yytname[yytype];
5725 yyfmt = yystpcpy (yyformat, yyunexpected);
5727 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5728 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5730 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5734 yyformat[sizeof yyunexpected - 1] = '\0';
5737 yyarg[yycount++] = yytname[yyx];
5738 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5739 yysize_overflow |= yysize1 < yysize;
5741 yyfmt = yystpcpy (yyfmt, yyprefix);
5745 yyf = YY_(yyformat);
5746 yysize1 = yysize + yystrlen (yyf);
5747 yysize_overflow |= yysize1 < yysize;
5750 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5751 yymsg = (char *) YYSTACK_ALLOC (yysize);
5754 /* Avoid sprintf, as that infringes on the user's name space.
5755 Don't have undefined behavior even if the translation
5756 produced a string with the wrong number of "%s"s. */
5759 while ((*yyp = *yyf))
5761 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5763 yyp += yytnamerr (yyp, yyarg[yyi++]);
5773 YYSTACK_FREE (yymsg);
5777 yyerror (YY_("syntax error"));
5778 goto yyexhaustedlab;
5782 #endif /* YYERROR_VERBOSE */
5783 yyerror (YY_("syntax error"));
5788 if (yyerrstatus == 3)
5790 /* If just tried and failed to reuse look-ahead token after an
5791 error, discard it. */
5793 if (yychar <= YYEOF)
5795 /* Return failure if at end of input. */
5796 if (yychar == YYEOF)
5801 yydestruct ("Error: discarding", yytoken, &yylval);
5806 /* Else will try to reuse look-ahead token after shifting the error
5811 /*---------------------------------------------------.
5812 | yyerrorlab -- error raised explicitly by YYERROR. |
5813 `---------------------------------------------------*/
5816 /* Pacify compilers like GCC when the user code never invokes
5817 YYERROR and the label yyerrorlab therefore never appears in user
5828 /*-------------------------------------------------------------.
5829 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5830 `-------------------------------------------------------------*/
5832 yyerrstatus = 3; /* Each real token shifted decrements this. */
5836 yyn = yypact[yystate];
5837 if (yyn != YYPACT_NINF)
5840 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5848 /* Pop the current state because it cannot handle the error token. */
5853 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5856 YY_STACK_PRINT (yyss, yyssp);
5865 /* Shift the error token. */
5866 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5872 /*-------------------------------------.
5873 | yyacceptlab -- YYACCEPT comes here. |
5874 `-------------------------------------*/
5879 /*-----------------------------------.
5880 | yyabortlab -- YYABORT comes here. |
5881 `-----------------------------------*/
5887 /*-------------------------------------------------.
5888 | yyexhaustedlab -- memory exhaustion comes here. |
5889 `-------------------------------------------------*/
5891 yyerror (YY_("memory exhausted"));
5897 if (yychar != YYEOF && yychar != YYEMPTY)
5898 yydestruct ("Cleanup: discarding lookahead",
5900 while (yyssp != yyss)
5902 yydestruct ("Cleanup: popping",
5903 yystos[*yyssp], yyvsp);
5908 YYSTACK_FREE (yyss);
5914 #line 2923 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
5917 // common code from the two 'RunVMAsmParser' functions
5918 static Module* RunParser(Module * M) {
5920 llvmAsmlineno = 1; // Reset the current line number...
5921 CurModule.CurrentModule = M;
5926 // Check to make sure the parser succeeded
5929 delete ParserResult;
5933 // Emit an error if there are any unresolved types left.
5934 if (!CurModule.LateResolveTypes.empty()) {
5935 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5936 if (DID.Type == ValID::LocalName) {
5937 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5939 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5942 delete ParserResult;
5946 // Emit an error if there are any unresolved values left.
5947 if (!CurModule.LateResolveValues.empty()) {
5948 Value *V = CurModule.LateResolveValues.back();
5949 std::map<Value*, std::pair<ValID, int> >::iterator I =
5950 CurModule.PlaceHolderInfo.find(V);
5952 if (I != CurModule.PlaceHolderInfo.end()) {
5953 ValID &DID = I->second.first;
5954 if (DID.Type == ValID::LocalName) {
5955 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5957 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5960 delete ParserResult;
5965 // Check to make sure that parsing produced a result
5969 // Reset ParserResult variable while saving its value for the result.
5970 Module *Result = ParserResult;
5976 void llvm::GenerateError(const std::string &message, int LineNo) {
5977 if (LineNo == -1) LineNo = llvmAsmlineno;
5978 // TODO: column number in exception
5980 TheParseError->setError(CurFilename, message, LineNo);
5984 int yyerror(const char *ErrorMsg) {
5986 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5987 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5988 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5989 if (yychar != YYEMPTY && yychar != 0)
5990 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5992 GenerateError(errMsg);