1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse llvmAsmparse
63 #define yylex llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval llvmAsmlval
66 #define yychar llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
94 ATSTRINGCONSTANT = 275,
95 ZEROINITIALIZER = 276,
134 X86_STDCALLCC_TOK = 315,
135 X86_FASTCALLCC_TOK = 316,
201 EXTRACTELEMENT = 382,
214 #define ESINT64VAL 258
215 #define EUINT64VAL 259
216 #define ESAPINTVAL 260
217 #define EUAPINTVAL 261
218 #define LOCALVAL_ID 262
219 #define GLOBALVAL_ID 263
228 #define GLOBALVAR 272
230 #define STRINGCONSTANT 274
231 #define ATSTRINGCONSTANT 275
232 #define ZEROINITIALIZER 276
244 #define THREAD_LOCAL 288
246 #define DOTDOTDOT 290
252 #define APPENDING 296
253 #define DLLIMPORT 297
254 #define DLLEXPORT 298
255 #define EXTERN_WEAK 299
266 #define SIDEEFFECT 310
269 #define FASTCC_TOK 313
270 #define COLDCC_TOK 314
271 #define X86_STDCALLCC_TOK 315
272 #define X86_FASTCALLCC_TOK 316
273 #define DATALAYOUT 317
279 #define UNREACHABLE 323
322 #define GETELEMENTPTR 366
338 #define EXTRACTELEMENT 382
339 #define INSERTELEMENT 383
340 #define SHUFFLEVECTOR 384
347 #define PROTECTED 391
352 /* Copy the first part of user declarations. */
353 #line 14 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
355 #include "ParserInternals.h"
356 #include "llvm/CallingConv.h"
357 #include "llvm/InlineAsm.h"
358 #include "llvm/Instructions.h"
359 #include "llvm/Module.h"
360 #include "llvm/ValueSymbolTable.h"
361 #include "llvm/Support/GetElementPtrTypeIterator.h"
362 #include "llvm/Support/CommandLine.h"
363 #include "llvm/ADT/SmallVector.h"
364 #include "llvm/ADT/STLExtras.h"
365 #include "llvm/Support/MathExtras.h"
366 #include "llvm/Support/Streams.h"
375 // The following is a gross hack. In order to rid the libAsmParser library of
376 // exceptions, we have to have a way of getting the yyparse function to go into
377 // an error situation. So, whenever we want an error to occur, the GenerateError
378 // function (see bottom of file) sets TriggerError. Then, at the end of each
379 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
380 // (a goto) to put YACC in error state. Furthermore, several calls to
381 // GenerateError are made from inside productions and they must simulate the
382 // previous exception behavior by exiting the production immediately. We have
383 // replaced these with the GEN_ERROR macro which calls GeneratError and then
384 // immediately invokes YYERROR. This would be so much cleaner if it was a
385 // recursive descent parser.
386 static bool TriggerError = false;
387 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
388 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
390 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
391 int yylex(); // declaration" of xxx warnings.
395 std::string CurFilename;
398 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
399 cl::Hidden, cl::init(false));
402 using namespace llvm;
404 static Module *ParserResult;
406 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
407 // relating to upreferences in the input stream.
409 //#define DEBUG_UPREFS 1
411 #define UR_OUT(X) cerr << X
416 #define YYERROR_VERBOSE 1
418 static GlobalVariable *CurGV;
421 // This contains info used when building the body of a function. It is
422 // destroyed when the function is completed.
424 typedef std::vector<Value *> ValueList; // Numbered defs
427 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
429 static struct PerModuleInfo {
430 Module *CurrentModule;
431 ValueList Values; // Module level numbered definitions
432 ValueList LateResolveValues;
433 std::vector<PATypeHolder> Types;
434 std::map<ValID, PATypeHolder> LateResolveTypes;
436 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
437 /// how they were referenced and on which line of the input they came from so
438 /// that we can resolve them later and print error messages as appropriate.
439 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
441 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
442 // references to global values. Global values may be referenced before they
443 // are defined, and if so, the temporary object that they represent is held
444 // here. This is used for forward references of GlobalValues.
446 typedef std::map<std::pair<const PointerType *,
447 ValID>, GlobalValue*> GlobalRefsType;
448 GlobalRefsType GlobalRefs;
451 // If we could not resolve some functions at function compilation time
452 // (calls to functions before they are defined), resolve them now... Types
453 // are resolved when the constant pool has been completely parsed.
455 ResolveDefinitions(LateResolveValues);
459 // Check to make sure that all global value forward references have been
462 if (!GlobalRefs.empty()) {
463 std::string UndefinedReferences = "Unresolved global references exist:\n";
465 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
467 UndefinedReferences += " " + I->first.first->getDescription() + " " +
468 I->first.second.getName() + "\n";
470 GenerateError(UndefinedReferences);
474 Values.clear(); // Clear out function local definitions
479 // GetForwardRefForGlobal - Check to see if there is a forward reference
480 // for this global. If so, remove it from the GlobalRefs map and return it.
481 // If not, just return null.
482 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
483 // Check to see if there is a forward reference to this global variable...
484 // if there is, eliminate it and patch the reference to use the new def'n.
485 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
486 GlobalValue *Ret = 0;
487 if (I != GlobalRefs.end()) {
494 bool TypeIsUnresolved(PATypeHolder* PATy) {
495 // If it isn't abstract, its resolved
496 const Type* Ty = PATy->get();
497 if (!Ty->isAbstract())
499 // Traverse the type looking for abstract types. If it isn't abstract then
500 // we don't need to traverse that leg of the type.
501 std::vector<const Type*> WorkList, SeenList;
502 WorkList.push_back(Ty);
503 while (!WorkList.empty()) {
504 const Type* Ty = WorkList.back();
505 SeenList.push_back(Ty);
507 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
508 // Check to see if this is an unresolved type
509 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
510 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
511 for ( ; I != E; ++I) {
512 if (I->second.get() == OpTy)
515 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
516 const Type* TheTy = SeqTy->getElementType();
517 if (TheTy->isAbstract() && TheTy != Ty) {
518 std::vector<const Type*>::iterator I = SeenList.begin(),
524 WorkList.push_back(TheTy);
526 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
527 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
528 const Type* TheTy = StrTy->getElementType(i);
529 if (TheTy->isAbstract() && TheTy != Ty) {
530 std::vector<const Type*>::iterator I = SeenList.begin(),
536 WorkList.push_back(TheTy);
545 static struct PerFunctionInfo {
546 Function *CurrentFunction; // Pointer to current function being created
548 ValueList Values; // Keep track of #'d definitions
550 ValueList LateResolveValues;
551 bool isDeclare; // Is this function a forward declararation?
552 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
553 GlobalValue::VisibilityTypes Visibility;
555 /// BBForwardRefs - When we see forward references to basic blocks, keep
556 /// track of them here.
557 std::map<ValID, BasicBlock*> BBForwardRefs;
559 inline PerFunctionInfo() {
562 Linkage = GlobalValue::ExternalLinkage;
563 Visibility = GlobalValue::DefaultVisibility;
566 inline void FunctionStart(Function *M) {
571 void FunctionDone() {
572 // Any forward referenced blocks left?
573 if (!BBForwardRefs.empty()) {
574 GenerateError("Undefined reference to label " +
575 BBForwardRefs.begin()->second->getName());
579 // Resolve all forward references now.
580 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
582 Values.clear(); // Clear out function local definitions
583 BBForwardRefs.clear();
586 Linkage = GlobalValue::ExternalLinkage;
587 Visibility = GlobalValue::DefaultVisibility;
589 } CurFun; // Info for the current function...
591 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
594 //===----------------------------------------------------------------------===//
595 // Code to handle definitions of all the types
596 //===----------------------------------------------------------------------===//
598 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
599 // Things that have names or are void typed don't get slot numbers
600 if (V->hasName() || (V->getType() == Type::VoidTy))
603 // In the case of function values, we have to allow for the forward reference
604 // of basic blocks, which are included in the numbering. Consequently, we keep
605 // track of the next insertion location with NextValNum. When a BB gets
606 // inserted, it could change the size of the CurFun.Values vector.
607 if (&ValueTab == &CurFun.Values) {
608 if (ValueTab.size() <= CurFun.NextValNum)
609 ValueTab.resize(CurFun.NextValNum+1);
610 ValueTab[CurFun.NextValNum++] = V;
613 // For all other lists, its okay to just tack it on the back of the vector.
614 ValueTab.push_back(V);
617 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
619 case ValID::LocalID: // Is it a numbered definition?
620 // Module constants occupy the lowest numbered slots...
621 if (D.Num < CurModule.Types.size())
622 return CurModule.Types[D.Num];
624 case ValID::LocalName: // Is it a named definition?
625 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
626 D.destroy(); // Free old strdup'd memory...
631 GenerateError("Internal parser error: Invalid symbol type reference");
635 // If we reached here, we referenced either a symbol that we don't know about
636 // or an id number that hasn't been read yet. We may be referencing something
637 // forward, so just create an entry to be resolved later and get to it...
639 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
642 if (inFunctionScope()) {
643 if (D.Type == ValID::LocalName) {
644 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
647 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
652 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
653 if (I != CurModule.LateResolveTypes.end())
656 Type *Typ = OpaqueType::get();
657 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
661 // getExistingVal - Look up the value specified by the provided type and
662 // the provided ValID. If the value exists and has already been defined, return
663 // it. Otherwise return null.
665 static Value *getExistingVal(const Type *Ty, const ValID &D) {
666 if (isa<FunctionType>(Ty)) {
667 GenerateError("Functions are not values and "
668 "must be referenced as pointers");
673 case ValID::LocalID: { // Is it a numbered definition?
674 // Check that the number is within bounds.
675 if (D.Num >= CurFun.Values.size())
677 Value *Result = CurFun.Values[D.Num];
678 if (Ty != Result->getType()) {
679 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
680 Result->getType()->getDescription() + "' does not match "
681 "expected type, '" + Ty->getDescription() + "'");
686 case ValID::GlobalID: { // Is it a numbered definition?
687 if (D.Num >= CurModule.Values.size())
689 Value *Result = CurModule.Values[D.Num];
690 if (Ty != Result->getType()) {
691 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
692 Result->getType()->getDescription() + "' does not match "
693 "expected type, '" + Ty->getDescription() + "'");
699 case ValID::LocalName: { // Is it a named definition?
700 if (!inFunctionScope())
702 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
703 Value *N = SymTab.lookup(D.Name);
706 if (N->getType() != Ty)
709 D.destroy(); // Free old strdup'd memory...
712 case ValID::GlobalName: { // Is it a named definition?
713 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
714 Value *N = SymTab.lookup(D.Name);
717 if (N->getType() != Ty)
720 D.destroy(); // Free old strdup'd memory...
724 // Check to make sure that "Ty" is an integral type, and that our
725 // value will fit into the specified type...
726 case ValID::ConstSIntVal: // Is it a constant pool reference??
727 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
728 GenerateError("Signed integral constant '" +
729 itostr(D.ConstPool64) + "' is invalid for type '" +
730 Ty->getDescription() + "'");
733 return ConstantInt::get(Ty, D.ConstPool64, true);
735 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
736 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
737 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
738 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
739 "' is invalid or out of range");
741 } else { // This is really a signed reference. Transmogrify.
742 return ConstantInt::get(Ty, D.ConstPool64, true);
745 return ConstantInt::get(Ty, D.UConstPool64);
748 case ValID::ConstFPVal: // Is it a floating point const pool reference?
749 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
750 GenerateError("FP constant invalid for type");
753 return ConstantFP::get(Ty, D.ConstPoolFP);
755 case ValID::ConstNullVal: // Is it a null value?
756 if (!isa<PointerType>(Ty)) {
757 GenerateError("Cannot create a a non pointer null");
760 return ConstantPointerNull::get(cast<PointerType>(Ty));
762 case ValID::ConstUndefVal: // Is it an undef value?
763 return UndefValue::get(Ty);
765 case ValID::ConstZeroVal: // Is it a zero value?
766 return Constant::getNullValue(Ty);
768 case ValID::ConstantVal: // Fully resolved constant?
769 if (D.ConstantValue->getType() != Ty) {
770 GenerateError("Constant expression type different from required type");
773 return D.ConstantValue;
775 case ValID::InlineAsmVal: { // Inline asm expression
776 const PointerType *PTy = dyn_cast<PointerType>(Ty);
777 const FunctionType *FTy =
778 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
779 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
780 GenerateError("Invalid type for asm constraint string");
783 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
784 D.IAD->HasSideEffects);
785 D.destroy(); // Free InlineAsmDescriptor.
789 assert(0 && "Unhandled case!");
793 assert(0 && "Unhandled case!");
797 // getVal - This function is identical to getExistingVal, except that if a
798 // value is not already defined, it "improvises" by creating a placeholder var
799 // that looks and acts just like the requested variable. When the value is
800 // defined later, all uses of the placeholder variable are replaced with the
803 static Value *getVal(const Type *Ty, const ValID &ID) {
804 if (Ty == Type::LabelTy) {
805 GenerateError("Cannot use a basic block here");
809 // See if the value has already been defined.
810 Value *V = getExistingVal(Ty, ID);
812 if (TriggerError) return 0;
814 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
815 GenerateError("Invalid use of a composite type");
819 // If we reached here, we referenced either a symbol that we don't know about
820 // or an id number that hasn't been read yet. We may be referencing something
821 // forward, so just create an entry to be resolved later and get to it...
824 case ValID::GlobalName:
825 case ValID::GlobalID: {
826 const PointerType *PTy = dyn_cast<PointerType>(Ty);
828 GenerateError("Invalid type for reference to global" );
831 const Type* ElTy = PTy->getElementType();
832 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
833 V = new Function(FTy, GlobalValue::ExternalLinkage);
835 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
839 V = new Argument(Ty);
842 // Remember where this forward reference came from. FIXME, shouldn't we try
843 // to recycle these things??
844 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
847 if (inFunctionScope())
848 InsertValue(V, CurFun.LateResolveValues);
850 InsertValue(V, CurModule.LateResolveValues);
854 /// defineBBVal - This is a definition of a new basic block with the specified
855 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
856 static BasicBlock *defineBBVal(const ValID &ID) {
857 assert(inFunctionScope() && "Can't get basic block at global scope!");
861 // First, see if this was forward referenced
863 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
864 if (BBI != CurFun.BBForwardRefs.end()) {
866 // The forward declaration could have been inserted anywhere in the
867 // function: insert it into the correct place now.
868 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
869 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
871 // We're about to erase the entry, save the key so we can clean it up.
872 ValID Tmp = BBI->first;
874 // Erase the forward ref from the map as its no longer "forward"
875 CurFun.BBForwardRefs.erase(ID);
877 // The key has been removed from the map but so we don't want to leave
878 // strdup'd memory around so destroy it too.
881 // If its a numbered definition, bump the number and set the BB value.
882 if (ID.Type == ValID::LocalID) {
883 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
891 // We haven't seen this BB before and its first mention is a definition.
892 // Just create it and return it.
893 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
894 BB = new BasicBlock(Name, CurFun.CurrentFunction);
895 if (ID.Type == ValID::LocalID) {
896 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
900 ID.destroy(); // Free strdup'd memory
904 /// getBBVal - get an existing BB value or create a forward reference for it.
906 static BasicBlock *getBBVal(const ValID &ID) {
907 assert(inFunctionScope() && "Can't get basic block at global scope!");
911 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
912 if (BBI != CurFun.BBForwardRefs.end()) {
914 } if (ID.Type == ValID::LocalName) {
915 std::string Name = ID.Name;
916 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
918 if (N->getType()->getTypeID() == Type::LabelTyID)
919 BB = cast<BasicBlock>(N);
921 GenerateError("Reference to label '" + Name + "' is actually of type '"+
922 N->getType()->getDescription() + "'");
923 } else if (ID.Type == ValID::LocalID) {
924 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
925 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
926 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
928 GenerateError("Reference to label '%" + utostr(ID.Num) +
929 "' is actually of type '"+
930 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
933 GenerateError("Illegal label reference " + ID.getName());
937 // If its already been defined, return it now.
939 ID.destroy(); // Free strdup'd memory.
943 // Otherwise, this block has not been seen before, create it.
945 if (ID.Type == ValID::LocalName)
947 BB = new BasicBlock(Name, CurFun.CurrentFunction);
949 // Insert it in the forward refs map.
950 CurFun.BBForwardRefs[ID] = BB;
956 //===----------------------------------------------------------------------===//
957 // Code to handle forward references in instructions
958 //===----------------------------------------------------------------------===//
960 // This code handles the late binding needed with statements that reference
961 // values not defined yet... for example, a forward branch, or the PHI node for
964 // This keeps a table (CurFun.LateResolveValues) of all such forward references
965 // and back patchs after we are done.
968 // ResolveDefinitions - If we could not resolve some defs at parsing
969 // time (forward branches, phi functions for loops, etc...) resolve the
973 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
974 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
975 while (!LateResolvers.empty()) {
976 Value *V = LateResolvers.back();
977 LateResolvers.pop_back();
979 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
980 CurModule.PlaceHolderInfo.find(V);
981 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
983 ValID &DID = PHI->second.first;
985 Value *TheRealValue = getExistingVal(V->getType(), DID);
989 V->replaceAllUsesWith(TheRealValue);
991 CurModule.PlaceHolderInfo.erase(PHI);
992 } else if (FutureLateResolvers) {
993 // Functions have their unresolved items forwarded to the module late
995 InsertValue(V, *FutureLateResolvers);
997 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
998 GenerateError("Reference to an invalid definition: '" +DID.getName()+
999 "' of type '" + V->getType()->getDescription() + "'",
1000 PHI->second.second);
1003 GenerateError("Reference to an invalid definition: #" +
1004 itostr(DID.Num) + " of type '" +
1005 V->getType()->getDescription() + "'",
1006 PHI->second.second);
1011 LateResolvers.clear();
1014 // ResolveTypeTo - A brand new type was just declared. This means that (if
1015 // name is not null) things referencing Name can be resolved. Otherwise, things
1016 // refering to the number can be resolved. Do this now.
1018 static void ResolveTypeTo(char *Name, const Type *ToTy) {
1020 if (Name) D = ValID::createLocalName(Name);
1021 else D = ValID::createLocalID(CurModule.Types.size());
1023 std::map<ValID, PATypeHolder>::iterator I =
1024 CurModule.LateResolveTypes.find(D);
1025 if (I != CurModule.LateResolveTypes.end()) {
1026 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1027 CurModule.LateResolveTypes.erase(I);
1031 // setValueName - Set the specified value to the name given. The name may be
1032 // null potentially, in which case this is a noop. The string passed in is
1033 // assumed to be a malloc'd string buffer, and is free'd by this function.
1035 static void setValueName(Value *V, char *NameStr) {
1036 if (!NameStr) return;
1037 std::string Name(NameStr); // Copy string
1038 free(NameStr); // Free old string
1040 if (V->getType() == Type::VoidTy) {
1041 GenerateError("Can't assign name '" + Name+"' to value with void type");
1045 assert(inFunctionScope() && "Must be in function scope!");
1046 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1047 if (ST.lookup(Name)) {
1048 GenerateError("Redefinition of value '" + Name + "' of type '" +
1049 V->getType()->getDescription() + "'");
1057 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1058 /// this is a declaration, otherwise it is a definition.
1059 static GlobalVariable *
1060 ParseGlobalVariable(char *NameStr,
1061 GlobalValue::LinkageTypes Linkage,
1062 GlobalValue::VisibilityTypes Visibility,
1063 bool isConstantGlobal, const Type *Ty,
1064 Constant *Initializer, bool IsThreadLocal) {
1065 if (isa<FunctionType>(Ty)) {
1066 GenerateError("Cannot declare global vars of function type");
1070 const PointerType *PTy = PointerType::get(Ty);
1074 Name = NameStr; // Copy string
1075 free(NameStr); // Free old string
1078 // See if this global value was forward referenced. If so, recycle the
1081 if (!Name.empty()) {
1082 ID = ValID::createGlobalName((char*)Name.c_str());
1084 ID = ValID::createGlobalID(CurModule.Values.size());
1087 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1088 // Move the global to the end of the list, from whereever it was
1089 // previously inserted.
1090 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1091 CurModule.CurrentModule->getGlobalList().remove(GV);
1092 CurModule.CurrentModule->getGlobalList().push_back(GV);
1093 GV->setInitializer(Initializer);
1094 GV->setLinkage(Linkage);
1095 GV->setVisibility(Visibility);
1096 GV->setConstant(isConstantGlobal);
1097 GV->setThreadLocal(IsThreadLocal);
1098 InsertValue(GV, CurModule.Values);
1102 // If this global has a name
1103 if (!Name.empty()) {
1104 // if the global we're parsing has an initializer (is a definition) and
1105 // has external linkage.
1106 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1107 // If there is already a global with external linkage with this name
1108 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1109 // If we allow this GVar to get created, it will be renamed in the
1110 // symbol table because it conflicts with an existing GVar. We can't
1111 // allow redefinition of GVars whose linking indicates that their name
1112 // must stay the same. Issue the error.
1113 GenerateError("Redefinition of global variable named '" + Name +
1114 "' of type '" + Ty->getDescription() + "'");
1119 // Otherwise there is no existing GV to use, create one now.
1120 GlobalVariable *GV =
1121 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1122 CurModule.CurrentModule, IsThreadLocal);
1123 GV->setVisibility(Visibility);
1124 InsertValue(GV, CurModule.Values);
1128 // setTypeName - Set the specified type to the name given. The name may be
1129 // null potentially, in which case this is a noop. The string passed in is
1130 // assumed to be a malloc'd string buffer, and is freed by this function.
1132 // This function returns true if the type has already been defined, but is
1133 // allowed to be redefined in the specified context. If the name is a new name
1134 // for the type plane, it is inserted and false is returned.
1135 static bool setTypeName(const Type *T, char *NameStr) {
1136 assert(!inFunctionScope() && "Can't give types function-local names!");
1137 if (NameStr == 0) return false;
1139 std::string Name(NameStr); // Copy string
1140 free(NameStr); // Free old string
1142 // We don't allow assigning names to void type
1143 if (T == Type::VoidTy) {
1144 GenerateError("Can't assign name '" + Name + "' to the void type");
1148 // Set the type name, checking for conflicts as we do so.
1149 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1151 if (AlreadyExists) { // Inserting a name that is already defined???
1152 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1153 assert(Existing && "Conflict but no matching type?!");
1155 // There is only one case where this is allowed: when we are refining an
1156 // opaque type. In this case, Existing will be an opaque type.
1157 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1158 // We ARE replacing an opaque type!
1159 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1163 // Otherwise, this is an attempt to redefine a type. That's okay if
1164 // the redefinition is identical to the original. This will be so if
1165 // Existing and T point to the same Type object. In this one case we
1166 // allow the equivalent redefinition.
1167 if (Existing == T) return true; // Yes, it's equal.
1169 // Any other kind of (non-equivalent) redefinition is an error.
1170 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1171 T->getDescription() + "'");
1177 //===----------------------------------------------------------------------===//
1178 // Code for handling upreferences in type names...
1181 // TypeContains - Returns true if Ty directly contains E in it.
1183 static bool TypeContains(const Type *Ty, const Type *E) {
1184 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1185 E) != Ty->subtype_end();
1189 struct UpRefRecord {
1190 // NestingLevel - The number of nesting levels that need to be popped before
1191 // this type is resolved.
1192 unsigned NestingLevel;
1194 // LastContainedTy - This is the type at the current binding level for the
1195 // type. Every time we reduce the nesting level, this gets updated.
1196 const Type *LastContainedTy;
1198 // UpRefTy - This is the actual opaque type that the upreference is
1199 // represented with.
1200 OpaqueType *UpRefTy;
1202 UpRefRecord(unsigned NL, OpaqueType *URTy)
1203 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1207 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1208 static std::vector<UpRefRecord> UpRefs;
1210 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1211 /// called. It loops through the UpRefs vector, which is a list of the
1212 /// currently active types. For each type, if the up reference is contained in
1213 /// the newly completed type, we decrement the level count. When the level
1214 /// count reaches zero, the upreferenced type is the type that is passed in:
1215 /// thus we can complete the cycle.
1217 static PATypeHolder HandleUpRefs(const Type *ty) {
1218 // If Ty isn't abstract, or if there are no up-references in it, then there is
1219 // nothing to resolve here.
1220 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1222 PATypeHolder Ty(ty);
1223 UR_OUT("Type '" << Ty->getDescription() <<
1224 "' newly formed. Resolving upreferences.\n" <<
1225 UpRefs.size() << " upreferences active!\n");
1227 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1228 // to zero), we resolve them all together before we resolve them to Ty. At
1229 // the end of the loop, if there is anything to resolve to Ty, it will be in
1231 OpaqueType *TypeToResolve = 0;
1233 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1234 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1235 << UpRefs[i].second->getDescription() << ") = "
1236 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1237 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1238 // Decrement level of upreference
1239 unsigned Level = --UpRefs[i].NestingLevel;
1240 UpRefs[i].LastContainedTy = Ty;
1241 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1242 if (Level == 0) { // Upreference should be resolved!
1243 if (!TypeToResolve) {
1244 TypeToResolve = UpRefs[i].UpRefTy;
1246 UR_OUT(" * Resolving upreference for "
1247 << UpRefs[i].second->getDescription() << "\n";
1248 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1249 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1250 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1251 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1253 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1254 --i; // Do not skip the next element...
1259 if (TypeToResolve) {
1260 UR_OUT(" * Resolving upreference for "
1261 << UpRefs[i].second->getDescription() << "\n";
1262 std::string OldName = TypeToResolve->getDescription());
1263 TypeToResolve->refineAbstractTypeTo(Ty);
1269 //===----------------------------------------------------------------------===//
1270 // RunVMAsmParser - Define an interface to this parser
1271 //===----------------------------------------------------------------------===//
1273 static Module* RunParser(Module * M);
1275 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1278 CurFilename = Filename;
1279 return RunParser(new Module(CurFilename));
1282 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1283 set_scan_string(AsmString);
1285 CurFilename = "from_memory";
1287 return RunParser(new Module (CurFilename));
1289 return RunParser(M);
1295 /* Enabling traces. */
1300 /* Enabling verbose error messages. */
1301 #ifdef YYERROR_VERBOSE
1302 # undef YYERROR_VERBOSE
1303 # define YYERROR_VERBOSE 1
1305 # define YYERROR_VERBOSE 0
1308 /* Enabling the token table. */
1309 #ifndef YYTOKEN_TABLE
1310 # define YYTOKEN_TABLE 0
1313 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1314 typedef union YYSTYPE
1315 #line 955 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
1317 llvm::Module *ModuleVal;
1318 llvm::Function *FunctionVal;
1319 llvm::BasicBlock *BasicBlockVal;
1320 llvm::TerminatorInst *TermInstVal;
1321 llvm::Instruction *InstVal;
1322 llvm::Constant *ConstVal;
1324 const llvm::Type *PrimType;
1325 std::list<llvm::PATypeHolder> *TypeList;
1326 llvm::PATypeHolder *TypeVal;
1327 llvm::Value *ValueVal;
1328 std::vector<llvm::Value*> *ValueList;
1329 llvm::ArgListType *ArgList;
1330 llvm::TypeWithAttrs TypeWithAttrs;
1331 llvm::TypeWithAttrsList *TypeWithAttrsList;
1332 llvm::ValueRefList *ValueRefList;
1334 // Represent the RHS of PHI node
1335 std::list<std::pair<llvm::Value*,
1336 llvm::BasicBlock*> > *PHIList;
1337 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1338 std::vector<llvm::Constant*> *ConstVector;
1340 llvm::GlobalValue::LinkageTypes Linkage;
1341 llvm::GlobalValue::VisibilityTypes Visibility;
1342 uint16_t ParamAttrs;
1343 llvm::APInt *APIntVal;
1351 char *StrVal; // This memory is strdup'd!
1352 llvm::ValID ValIDVal; // strdup'd memory maybe!
1354 llvm::Instruction::BinaryOps BinaryOpVal;
1355 llvm::Instruction::TermOps TermOpVal;
1356 llvm::Instruction::MemoryOps MemOpVal;
1357 llvm::Instruction::CastOps CastOpVal;
1358 llvm::Instruction::OtherOps OtherOpVal;
1359 llvm::ICmpInst::Predicate IPredicate;
1360 llvm::FCmpInst::Predicate FPredicate;
1362 /* Line 187 of yacc.c. */
1363 #line 1364 "llvmAsmParser.tab.c"
1365 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1366 # define YYSTYPE_IS_DECLARED 1
1367 # define YYSTYPE_IS_TRIVIAL 1
1372 /* Copy the second part of user declarations. */
1375 /* Line 216 of yacc.c. */
1376 #line 1377 "llvmAsmParser.tab.c"
1383 typedef YYTYPE_UINT8 yytype_uint8;
1385 typedef unsigned char yytype_uint8;
1389 typedef YYTYPE_INT8 yytype_int8;
1390 #elif (defined __STDC__ || defined __C99__FUNC__ \
1391 || defined __cplusplus || defined _MSC_VER)
1392 typedef signed char yytype_int8;
1394 typedef short int yytype_int8;
1397 #ifdef YYTYPE_UINT16
1398 typedef YYTYPE_UINT16 yytype_uint16;
1400 typedef unsigned short int yytype_uint16;
1404 typedef YYTYPE_INT16 yytype_int16;
1406 typedef short int yytype_int16;
1410 # ifdef __SIZE_TYPE__
1411 # define YYSIZE_T __SIZE_TYPE__
1412 # elif defined size_t
1413 # define YYSIZE_T size_t
1414 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1415 || defined __cplusplus || defined _MSC_VER)
1416 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1417 # define YYSIZE_T size_t
1419 # define YYSIZE_T unsigned int
1423 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1428 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1429 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1433 # define YY_(msgid) msgid
1437 /* Suppress unused-variable warnings by "using" E. */
1438 #if ! defined lint || defined __GNUC__
1439 # define YYUSE(e) ((void) (e))
1441 # define YYUSE(e) /* empty */
1444 /* Identity function, used to suppress warnings about constant conditions. */
1446 # define YYID(n) (n)
1448 #if (defined __STDC__ || defined __C99__FUNC__ \
1449 || defined __cplusplus || defined _MSC_VER)
1462 #if ! defined yyoverflow || YYERROR_VERBOSE
1464 /* The parser invokes alloca or malloc; define the necessary symbols. */
1466 # ifdef YYSTACK_USE_ALLOCA
1467 # if YYSTACK_USE_ALLOCA
1469 # define YYSTACK_ALLOC __builtin_alloca
1470 # elif defined __BUILTIN_VA_ARG_INCR
1471 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1473 # define YYSTACK_ALLOC __alloca
1474 # elif defined _MSC_VER
1475 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1476 # define alloca _alloca
1478 # define YYSTACK_ALLOC alloca
1479 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1480 || defined __cplusplus || defined _MSC_VER)
1481 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1483 # define _STDLIB_H 1
1490 # ifdef YYSTACK_ALLOC
1491 /* Pacify GCC's `empty if-body' warning. */
1492 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1493 # ifndef YYSTACK_ALLOC_MAXIMUM
1494 /* The OS might guarantee only one guard page at the bottom of the stack,
1495 and a page size can be as small as 4096 bytes. So we cannot safely
1496 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1497 to allow for a few compiler-allocated temporary stack slots. */
1498 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1501 # define YYSTACK_ALLOC YYMALLOC
1502 # define YYSTACK_FREE YYFREE
1503 # ifndef YYSTACK_ALLOC_MAXIMUM
1504 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1506 # if (defined __cplusplus && ! defined _STDLIB_H \
1507 && ! ((defined YYMALLOC || defined malloc) \
1508 && (defined YYFREE || defined free)))
1509 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1511 # define _STDLIB_H 1
1515 # define YYMALLOC malloc
1516 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1517 || defined __cplusplus || defined _MSC_VER)
1518 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1522 # define YYFREE free
1523 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1524 || defined __cplusplus || defined _MSC_VER)
1525 void free (void *); /* INFRINGES ON USER NAME SPACE */
1529 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1532 #if (! defined yyoverflow \
1533 && (! defined __cplusplus \
1534 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1536 /* A type that is properly aligned for any stack member. */
1543 /* The size of the maximum gap between one aligned stack and the next. */
1544 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1546 /* The size of an array large to enough to hold all stacks, each with
1548 # define YYSTACK_BYTES(N) \
1549 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1550 + YYSTACK_GAP_MAXIMUM)
1552 /* Copy COUNT objects from FROM to TO. The source and destination do
1555 # if defined __GNUC__ && 1 < __GNUC__
1556 # define YYCOPY(To, From, Count) \
1557 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1559 # define YYCOPY(To, From, Count) \
1563 for (yyi = 0; yyi < (Count); yyi++) \
1564 (To)[yyi] = (From)[yyi]; \
1570 /* Relocate STACK from its old location to the new one. The
1571 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1572 elements in the stack, and YYPTR gives the new location of the
1573 stack. Advance YYPTR to a properly aligned location for the next
1575 # define YYSTACK_RELOCATE(Stack) \
1578 YYSIZE_T yynewbytes; \
1579 YYCOPY (&yyptr->Stack, Stack, yysize); \
1580 Stack = &yyptr->Stack; \
1581 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1582 yyptr += yynewbytes / sizeof (*yyptr); \
1588 /* YYFINAL -- State number of the termination state. */
1590 /* YYLAST -- Last index in YYTABLE. */
1593 /* YYNTOKENS -- Number of terminals. */
1594 #define YYNTOKENS 151
1595 /* YYNNTS -- Number of nonterminals. */
1597 /* YYNRULES -- Number of rules. */
1598 #define YYNRULES 297
1599 /* YYNRULES -- Number of states. */
1600 #define YYNSTATES 581
1602 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1603 #define YYUNDEFTOK 2
1604 #define YYMAXUTOK 391
1606 #define YYTRANSLATE(YYX) \
1607 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1609 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1610 static const yytype_uint8 yytranslate[] =
1612 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1616 141, 142, 139, 2, 138, 2, 2, 2, 2, 2,
1617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1618 146, 137, 147, 2, 2, 2, 2, 2, 2, 2,
1619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1621 2, 143, 140, 145, 2, 2, 2, 2, 2, 150,
1622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1624 144, 2, 2, 148, 2, 149, 2, 2, 2, 2,
1625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1637 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1638 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1639 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1640 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1641 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1642 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1643 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1644 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1645 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1646 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1647 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1648 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1649 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1650 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1655 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1657 static const yytype_uint16 yyprhs[] =
1659 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1660 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1661 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1662 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1663 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1664 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1665 119, 121, 122, 125, 126, 128, 130, 132, 133, 136,
1666 138, 140, 142, 144, 146, 148, 150, 152, 153, 155,
1667 157, 159, 160, 162, 164, 165, 167, 169, 171, 173,
1668 174, 176, 178, 179, 181, 183, 185, 187, 189, 192,
1669 194, 196, 198, 200, 201, 204, 206, 208, 210, 211,
1670 214, 215, 218, 219, 223, 226, 227, 229, 230, 234,
1671 236, 239, 241, 243, 245, 247, 249, 251, 254, 256,
1672 259, 265, 271, 277, 283, 287, 290, 296, 301, 304,
1673 306, 308, 310, 314, 316, 320, 322, 323, 325, 329,
1674 334, 338, 342, 347, 352, 356, 363, 369, 372, 375,
1675 378, 381, 384, 387, 390, 393, 396, 399, 402, 405,
1676 412, 418, 427, 434, 441, 449, 457, 464, 473, 482,
1677 486, 488, 490, 492, 494, 495, 498, 505, 507, 508,
1678 510, 513, 514, 518, 519, 523, 527, 531, 535, 536,
1679 544, 545, 554, 555, 564, 570, 573, 577, 579, 583,
1680 587, 591, 595, 597, 598, 604, 608, 610, 614, 616,
1681 617, 627, 629, 631, 636, 638, 640, 643, 647, 648,
1682 650, 652, 654, 656, 658, 660, 662, 664, 666, 670,
1683 672, 678, 680, 682, 684, 686, 688, 690, 693, 696,
1684 699, 703, 706, 707, 709, 712, 715, 719, 729, 739,
1685 748, 763, 765, 767, 774, 780, 783, 790, 798, 802,
1686 808, 809, 810, 814, 817, 819, 825, 831, 838, 845,
1687 850, 857, 862, 867, 874, 881, 884, 893, 895, 897,
1688 898, 902, 909, 913, 920, 923, 929, 937
1691 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1692 static const yytype_int16 yyrhs[] =
1694 195, 0, -1, 69, -1, 70, -1, 71, -1, 72,
1695 -1, 73, -1, 74, -1, 75, -1, 76, -1, 77,
1696 -1, 81, -1, 82, -1, 83, -1, 78, -1, 79,
1697 -1, 80, -1, 112, -1, 113, -1, 114, -1, 115,
1698 -1, 116, -1, 117, -1, 118, -1, 119, -1, 120,
1699 -1, 121, -1, 122, -1, 123, -1, 86, -1, 87,
1700 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1701 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1702 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1703 -1, 103, -1, 104, -1, 105, -1, 92, -1, 93,
1704 -1, 94, -1, 95, -1, 22, -1, 23, -1, 11,
1705 -1, 12, -1, 13, -1, 16, -1, 19, -1, 159,
1706 -1, -1, 159, 137, -1, -1, 17, -1, 20, -1,
1707 164, -1, -1, 162, 137, -1, 38, -1, 40, -1,
1708 39, -1, 41, -1, 43, -1, 42, -1, 44, -1,
1709 46, -1, -1, 134, -1, 135, -1, 136, -1, -1,
1710 42, -1, 44, -1, -1, 38, -1, 39, -1, 40,
1711 -1, 43, -1, -1, 40, -1, 38, -1, -1, 57,
1712 -1, 58, -1, 59, -1, 60, -1, 61, -1, 56,
1713 4, -1, 113, -1, 114, -1, 131, -1, 132, -1,
1714 -1, 173, 172, -1, 130, -1, 133, -1, 172, -1,
1715 -1, 175, 174, -1, -1, 49, 4, -1, -1, 138,
1716 49, 4, -1, 30, 19, -1, -1, 178, -1, -1,
1717 138, 181, 180, -1, 178, -1, 49, 4, -1, 11,
1718 -1, 12, -1, 13, -1, 14, -1, 45, -1, 182,
1719 -1, 183, 139, -1, 217, -1, 140, 4, -1, 183,
1720 141, 187, 142, 175, -1, 10, 141, 187, 142, 175,
1721 -1, 143, 4, 144, 183, 145, -1, 146, 4, 144,
1722 183, 147, -1, 148, 188, 149, -1, 148, 149, -1,
1723 146, 148, 188, 149, 147, -1, 146, 148, 149, 147,
1724 -1, 183, 173, -1, 183, -1, 10, -1, 184, -1,
1725 186, 138, 184, -1, 186, -1, 186, 138, 35, -1,
1726 35, -1, -1, 183, -1, 188, 138, 183, -1, 183,
1727 143, 191, 145, -1, 183, 143, 145, -1, 183, 150,
1728 19, -1, 183, 146, 191, 147, -1, 183, 148, 191,
1729 149, -1, 183, 148, 149, -1, 183, 146, 148, 191,
1730 149, 147, -1, 183, 146, 148, 149, 147, -1, 183,
1731 36, -1, 183, 37, -1, 183, 217, -1, 183, 190,
1732 -1, 183, 21, -1, 157, 3, -1, 157, 5, -1,
1733 157, 4, -1, 157, 6, -1, 11, 22, -1, 11,
1734 23, -1, 158, 9, -1, 154, 141, 189, 34, 183,
1735 142, -1, 111, 141, 189, 228, 142, -1, 125, 141,
1736 189, 138, 189, 138, 189, 142, -1, 152, 141, 189,
1737 138, 189, 142, -1, 153, 141, 189, 138, 189, 142,
1738 -1, 84, 155, 141, 189, 138, 189, 142, -1, 85,
1739 156, 141, 189, 138, 189, 142, -1, 127, 141, 189,
1740 138, 189, 142, -1, 128, 141, 189, 138, 189, 138,
1741 189, 142, -1, 129, 141, 189, 138, 189, 138, 189,
1742 142, -1, 191, 138, 189, -1, 189, -1, 28, -1,
1743 29, -1, 33, -1, -1, 185, 217, -1, 117, 141,
1744 194, 34, 183, 142, -1, 196, -1, -1, 197, -1,
1745 196, 197, -1, -1, 27, 198, 213, -1, -1, 26,
1746 199, 214, -1, 54, 53, 203, -1, 161, 15, 183,
1747 -1, 161, 15, 10, -1, -1, 163, 167, 193, 192,
1748 189, 200, 180, -1, -1, 163, 165, 167, 193, 192,
1749 189, 201, 180, -1, -1, 163, 166, 167, 193, 192,
1750 183, 202, 180, -1, 163, 167, 31, 170, 194, -1,
1751 47, 204, -1, 50, 137, 205, -1, 19, -1, 48,
1752 137, 19, -1, 62, 137, 19, -1, 143, 206, 145,
1753 -1, 206, 138, 19, -1, 19, -1, -1, 207, 138,
1754 183, 173, 160, -1, 183, 173, 160, -1, 207, -1,
1755 207, 138, 35, -1, 35, -1, -1, 171, 185, 162,
1756 141, 208, 142, 175, 179, 176, -1, 24, -1, 148,
1757 -1, 169, 167, 209, 210, -1, 25, -1, 149, -1,
1758 220, 212, -1, 168, 167, 209, -1, -1, 55, -1,
1759 3, -1, 4, -1, 9, -1, 22, -1, 23, -1,
1760 36, -1, 37, -1, 21, -1, 146, 191, 147, -1,
1761 190, -1, 53, 215, 19, 138, 19, -1, 7, -1,
1762 8, -1, 159, -1, 162, -1, 217, -1, 216, -1,
1763 183, 218, -1, 220, 221, -1, 211, 221, -1, 222,
1764 161, 223, -1, 222, 225, -1, -1, 18, -1, 63,
1765 219, -1, 63, 10, -1, 64, 14, 218, -1, 64,
1766 11, 218, 138, 14, 218, 138, 14, 218, -1, 65,
1767 157, 218, 138, 14, 218, 143, 224, 145, -1, 65,
1768 157, 218, 138, 14, 218, 143, 145, -1, 66, 171,
1769 185, 218, 141, 227, 142, 175, 34, 14, 218, 67,
1770 14, 218, -1, 67, -1, 68, -1, 224, 157, 216,
1771 138, 14, 218, -1, 157, 216, 138, 14, 218, -1,
1772 161, 230, -1, 183, 143, 218, 138, 218, 145, -1,
1773 226, 138, 143, 218, 138, 218, 145, -1, 183, 218,
1774 173, -1, 227, 138, 183, 218, 173, -1, -1, -1,
1775 228, 138, 219, -1, 52, 51, -1, 51, -1, 152,
1776 183, 218, 138, 218, -1, 153, 183, 218, 138, 218,
1777 -1, 84, 155, 183, 218, 138, 218, -1, 85, 156,
1778 183, 218, 138, 218, -1, 154, 219, 34, 183, -1,
1779 125, 219, 138, 219, 138, 219, -1, 126, 219, 138,
1780 183, -1, 127, 219, 138, 219, -1, 128, 219, 138,
1781 219, 138, 219, -1, 129, 219, 138, 219, 138, 219,
1782 -1, 124, 226, -1, 229, 171, 185, 218, 141, 227,
1783 142, 175, -1, 232, -1, 32, -1, -1, 106, 183,
1784 177, -1, 106, 183, 138, 11, 218, 177, -1, 107,
1785 183, 177, -1, 107, 183, 138, 11, 218, 177, -1,
1786 108, 219, -1, 231, 109, 183, 218, 177, -1, 231,
1787 110, 219, 138, 183, 218, 177, -1, 111, 183, 218,
1791 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1792 static const yytype_uint16 yyrline[] =
1794 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1795 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1796 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117,
1797 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1798 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1799 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1141, 1141,
1800 1142, 1142, 1146, 1150, 1155, 1155, 1157, 1158, 1163, 1169,
1801 1170, 1171, 1172, 1173, 1177, 1178, 1179, 1183, 1184, 1185,
1802 1186, 1190, 1191, 1192, 1196, 1197, 1198, 1199, 1200, 1204,
1803 1205, 1206, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1222,
1804 1223, 1224, 1225, 1228, 1229, 1234, 1235, 1236, 1239, 1240,
1805 1247, 1248, 1254, 1255, 1263, 1271, 1272, 1277, 1278, 1279,
1806 1284, 1297, 1297, 1297, 1297, 1300, 1304, 1308, 1315, 1320,
1807 1328, 1358, 1389, 1394, 1406, 1416, 1420, 1430, 1437, 1444,
1808 1451, 1456, 1461, 1468, 1469, 1476, 1483, 1491, 1497, 1509,
1809 1537, 1553, 1582, 1610, 1636, 1656, 1682, 1702, 1714, 1721,
1810 1787, 1797, 1807, 1813, 1823, 1829, 1839, 1844, 1849, 1857,
1811 1869, 1891, 1899, 1905, 1916, 1921, 1926, 1932, 1938, 1947,
1812 1951, 1959, 1959, 1962, 1962, 1965, 1976, 1997, 2002, 2010,
1813 2011, 2015, 2015, 2019, 2019, 2022, 2025, 2049, 2060, 2060,
1814 2071, 2070, 2080, 2079, 2090, 2105, 2108, 2114, 2127, 2131,
1815 2136, 2138, 2143, 2148, 2157, 2167, 2178, 2182, 2191, 2200,
1816 2205, 2327, 2327, 2329, 2338, 2338, 2340, 2345, 2357, 2361,
1817 2366, 2370, 2374, 2378, 2382, 2386, 2390, 2394, 2398, 2423,
1818 2427, 2441, 2445, 2449, 2453, 2459, 2459, 2465, 2474, 2478,
1819 2487, 2496, 2505, 2509, 2514, 2518, 2522, 2527, 2537, 2556,
1820 2565, 2645, 2649, 2656, 2667, 2680, 2690, 2701, 2711, 2720,
1821 2729, 2732, 2733, 2740, 2744, 2749, 2770, 2787, 2801, 2815,
1822 2827, 2835, 2842, 2848, 2854, 2860, 2875, 2960, 2965, 2969,
1823 2976, 2983, 2991, 2998, 3006, 3014, 3028, 3045
1827 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1828 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1829 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1830 static const char *const yytname[] =
1832 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1833 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1834 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1835 "STRINGCONSTANT", "ATSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1836 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1837 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1838 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1839 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1840 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1841 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1842 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1843 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1844 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1845 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1846 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1847 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1848 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1849 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1850 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1851 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET",
1852 "NOUNWIND", "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'",
1853 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1854 "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1855 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1856 "OptLocalName", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1857 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1858 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1859 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1860 "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString",
1861 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1862 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1863 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1864 "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition",
1865 "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition",
1866 "LibrariesDefinition", "LibList", "ArgListH", "ArgList",
1867 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1868 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1869 "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock",
1870 "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1871 "ValueRefList", "IndexList", "OptTailCall", "InstVal", "OptVolatile",
1877 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1879 static const yytype_uint16 yytoknum[] =
1881 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1882 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1883 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1884 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1885 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1886 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1887 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1888 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1889 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1890 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1891 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1892 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1893 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1894 385, 386, 387, 388, 389, 390, 391, 61, 44, 42,
1895 92, 40, 41, 91, 120, 93, 60, 62, 123, 125,
1900 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1901 static const yytype_uint8 yyr1[] =
1903 0, 151, 152, 152, 152, 152, 152, 152, 152, 152,
1904 152, 153, 153, 153, 153, 153, 153, 154, 154, 154,
1905 154, 154, 154, 154, 154, 154, 154, 154, 154, 155,
1906 155, 155, 155, 155, 155, 155, 155, 155, 155, 156,
1907 156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1908 156, 156, 156, 156, 156, 157, 158, 158, 159, 159,
1909 160, 160, 161, 161, 162, 162, 163, 163, 164, 165,
1910 165, 165, 165, 165, 166, 166, 166, 167, 167, 167,
1911 167, 168, 168, 168, 169, 169, 169, 169, 169, 170,
1912 170, 170, 171, 171, 171, 171, 171, 171, 171, 172,
1913 172, 172, 172, 173, 173, 174, 174, 174, 175, 175,
1914 176, 176, 177, 177, 178, 179, 179, 180, 180, 181,
1915 181, 182, 182, 182, 182, 183, 183, 183, 183, 183,
1916 183, 183, 183, 183, 183, 183, 183, 183, 184, 185,
1917 185, 186, 186, 187, 187, 187, 187, 188, 188, 189,
1918 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
1919 189, 189, 189, 189, 189, 189, 189, 189, 189, 190,
1920 190, 190, 190, 190, 190, 190, 190, 190, 190, 191,
1921 191, 192, 192, 193, 193, 194, 194, 195, 195, 196,
1922 196, 198, 197, 199, 197, 197, 197, 197, 200, 197,
1923 201, 197, 202, 197, 197, 197, 197, 203, 204, 204,
1924 205, 206, 206, 206, 207, 207, 208, 208, 208, 208,
1925 209, 210, 210, 211, 212, 212, 213, 214, 215, 215,
1926 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
1927 216, 217, 217, 217, 217, 218, 218, 219, 220, 220,
1928 221, 222, 222, 222, 223, 223, 223, 223, 223, 223,
1929 223, 223, 223, 224, 224, 225, 226, 226, 227, 227,
1930 227, 228, 228, 229, 229, 230, 230, 230, 230, 230,
1931 230, 230, 230, 230, 230, 230, 230, 230, 231, 231,
1932 232, 232, 232, 232, 232, 232, 232, 232
1935 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1936 static const yytype_uint8 yyr2[] =
1938 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1939 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1940 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1941 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1942 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1943 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1944 1, 0, 2, 0, 1, 1, 1, 0, 2, 1,
1945 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
1946 1, 0, 1, 1, 0, 1, 1, 1, 1, 0,
1947 1, 1, 0, 1, 1, 1, 1, 1, 2, 1,
1948 1, 1, 1, 0, 2, 1, 1, 1, 0, 2,
1949 0, 2, 0, 3, 2, 0, 1, 0, 3, 1,
1950 2, 1, 1, 1, 1, 1, 1, 2, 1, 2,
1951 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
1952 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
1953 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
1954 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
1955 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
1956 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
1957 2, 0, 3, 0, 3, 3, 3, 3, 0, 7,
1958 0, 8, 0, 8, 5, 2, 3, 1, 3, 3,
1959 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
1960 9, 1, 1, 4, 1, 1, 2, 3, 0, 1,
1961 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1962 5, 1, 1, 1, 1, 1, 1, 2, 2, 2,
1963 3, 2, 0, 1, 2, 2, 3, 9, 9, 8,
1964 14, 1, 1, 6, 5, 2, 6, 7, 3, 5,
1965 0, 0, 3, 2, 1, 5, 5, 6, 6, 4,
1966 6, 4, 4, 6, 6, 2, 8, 1, 1, 0,
1967 3, 6, 3, 6, 2, 5, 7, 4
1970 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1971 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1972 means the default is an error. */
1973 static const yytype_uint16 yydefact[] =
1975 67, 58, 64, 59, 65, 193, 191, 0, 0, 0,
1976 0, 0, 0, 77, 66, 0, 67, 189, 81, 84,
1977 0, 0, 205, 0, 0, 62, 0, 68, 69, 71,
1978 70, 72, 74, 73, 75, 76, 78, 79, 80, 77,
1979 77, 184, 1, 190, 82, 83, 77, 194, 85, 86,
1980 87, 88, 77, 252, 192, 252, 0, 0, 213, 206,
1981 207, 195, 241, 242, 197, 121, 122, 123, 124, 125,
1982 0, 0, 0, 0, 243, 244, 126, 196, 128, 184,
1983 184, 89, 183, 0, 92, 92, 253, 249, 63, 224,
1984 225, 226, 248, 208, 209, 212, 0, 146, 129, 0,
1985 0, 0, 0, 135, 147, 0, 127, 146, 0, 0,
1986 91, 90, 0, 181, 182, 0, 0, 93, 94, 95,
1987 96, 97, 0, 227, 0, 289, 251, 0, 210, 145,
1988 103, 141, 143, 0, 0, 0, 0, 0, 0, 134,
1989 0, 0, 0, 140, 0, 139, 0, 204, 121, 122,
1990 123, 0, 0, 0, 198, 98, 0, 221, 222, 223,
1991 288, 274, 0, 0, 0, 0, 92, 261, 262, 2,
1992 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
1993 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
1994 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1995 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
1996 0, 250, 92, 265, 0, 287, 211, 138, 0, 108,
1997 0, 0, 137, 0, 148, 108, 200, 202, 0, 185,
1998 166, 167, 162, 164, 163, 165, 168, 161, 157, 158,
1999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2000 0, 0, 0, 0, 160, 159, 117, 0, 273, 255,
2001 0, 254, 0, 0, 55, 0, 0, 29, 30, 31,
2002 32, 33, 34, 35, 36, 37, 38, 0, 53, 54,
2003 49, 50, 51, 52, 39, 40, 41, 42, 43, 44,
2004 45, 46, 47, 48, 0, 112, 112, 294, 0, 0,
2005 285, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2006 0, 0, 99, 100, 101, 102, 104, 144, 142, 131,
2007 132, 133, 136, 130, 117, 117, 0, 0, 0, 0,
2008 0, 0, 0, 0, 150, 180, 0, 0, 0, 154,
2009 0, 151, 0, 0, 0, 0, 199, 219, 230, 231,
2010 232, 237, 233, 234, 235, 236, 228, 0, 239, 246,
2011 245, 247, 0, 256, 0, 0, 0, 0, 0, 290,
2012 0, 292, 271, 0, 0, 0, 0, 0, 0, 0,
2013 0, 0, 0, 0, 0, 0, 105, 106, 107, 109,
2014 201, 203, 0, 0, 0, 271, 0, 0, 0, 0,
2015 0, 149, 135, 147, 0, 152, 153, 0, 0, 0,
2016 0, 0, 119, 117, 218, 103, 216, 0, 229, 0,
2017 0, 0, 0, 0, 0, 0, 0, 0, 0, 297,
2018 0, 0, 0, 281, 282, 0, 0, 0, 0, 279,
2019 0, 112, 0, 0, 0, 0, 0, 0, 0, 0,
2020 0, 179, 156, 0, 0, 0, 0, 114, 120, 118,
2021 61, 0, 108, 0, 238, 0, 0, 270, 0, 0,
2022 112, 113, 112, 0, 0, 0, 0, 0, 0, 275,
2023 276, 270, 0, 295, 0, 186, 0, 0, 170, 0,
2024 0, 0, 0, 155, 0, 0, 0, 60, 215, 217,
2025 103, 115, 0, 0, 0, 0, 0, 277, 278, 291,
2026 293, 272, 0, 0, 280, 283, 284, 0, 112, 0,
2027 0, 0, 176, 0, 0, 172, 173, 169, 61, 116,
2028 110, 240, 0, 0, 103, 0, 108, 266, 0, 108,
2029 296, 174, 175, 0, 0, 0, 214, 0, 220, 0,
2030 259, 0, 0, 268, 0, 0, 267, 286, 171, 177,
2031 178, 111, 257, 0, 258, 0, 103, 0, 0, 0,
2032 269, 0, 0, 0, 0, 264, 0, 0, 263, 0,
2036 /* YYDEFGOTO[NTERM-NUM]. */
2037 static const yytype_int16 yydefgoto[] =
2039 -1, 251, 252, 253, 277, 294, 151, 152, 74, 498,
2040 11, 75, 13, 14, 39, 40, 41, 46, 52, 112,
2041 122, 316, 217, 389, 319, 548, 369, 412, 530, 346,
2042 413, 76, 153, 131, 146, 132, 133, 105, 335, 358,
2043 336, 115, 83, 147, 15, 16, 17, 19, 18, 256,
2044 324, 325, 61, 22, 59, 96, 416, 417, 123, 159,
2045 53, 91, 54, 47, 419, 359, 78, 361, 261, 55,
2046 87, 88, 211, 552, 126, 300, 506, 429, 212, 213,
2050 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2052 #define YYPACT_NINF -460
2053 static const yytype_int16 yypact[] =
2055 30, -460, -460, -460, -460, -460, -460, -4, -118, 45,
2056 -108, 70, 36, 432, -460, 151, 558, -460, 148, 200,
2057 49, 71, -460, 82, 150, -460, 1184, -460, -460, -460,
2058 -460, -460, -460, -460, -460, -460, -460, -460, -460, 189,
2059 189, 250, -460, -460, -460, -460, 189, -460, -460, -460,
2060 -460, -460, 189, 196, -460, -14, 239, 248, 277, -460,
2061 -460, -460, -460, -460, 129, -460, -460, -460, -460, -460,
2062 307, 313, 4, 368, -460, -460, -460, 192, -460, 295,
2063 295, 294, -460, 26, 163, 163, -460, -460, 155, -460,
2064 -460, -460, -460, -460, -460, -460, -114, 54, -460, 194,
2065 195, 932, 129, -460, 192, -117, -460, 54, 26, 26,
2066 -460, -460, 1028, -460, -460, 1198, 336, -460, -460, -460,
2067 -460, -460, 1225, -460, -6, 1362, -460, 322, -460, -460,
2068 192, -460, 204, 201, 1240, 1240, 197, -55, 1240, -460,
2069 205, 1198, 1240, 129, 207, 192, 88, -460, 97, 337,
2070 340, 274, 346, 757, -460, -460, 184, -460, -460, -460,
2071 -460, -460, 305, 1261, 251, 349, 163, -460, -460, -460,
2072 -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,
2073 -460, -460, -460, -460, 395, 443, 1240, 1240, 1240, 1240,
2074 -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,
2075 -460, -460, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
2076 1240, -460, 163, -460, 137, -460, -460, -80, 120, -460,
2077 31, 109, -460, 215, 192, -460, -460, 192, 1028, -460,
2078 -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,
2079 395, 443, 222, 227, 228, 231, 232, 1042, 1276, 973,
2080 358, 242, 245, 249, -460, -460, 253, 252, -460, 129,
2081 607, -460, 735, 735, -460, 735, 1225, -460, -460, -460,
2082 -460, -460, -460, -460, -460, -460, -460, 1240, -460, -460,
2083 -460, -460, -460, -460, -460, -460, -460, -460, -460, -460,
2084 -460, -460, -460, -460, 1240, 152, 156, -460, 607, 118,
2085 254, 258, 259, 260, 261, 262, 607, 607, 361, 1225,
2086 1240, 1240, -460, -460, -460, -460, -460, -460, -460, 99,
2087 -460, -460, -460, 99, 253, 253, 367, 263, 264, 1198,
2088 1198, 1198, 1198, 1198, -460, -460, -85, 1012, 3, -460,
2089 -27, -460, 1198, 1198, 1198, 29, -460, 1082, -460, -460,
2090 -460, -460, -460, -460, -460, -460, 351, 1198, -460, -460,
2091 -460, -460, 269, -460, 270, 735, 607, 607, 14, -460,
2092 32, -460, -460, 735, 266, 1240, 1240, 1240, 1240, 1240,
2093 273, 276, 1240, 735, 607, 278, -460, -460, -460, -460,
2094 -460, -460, 1240, 1198, 1198, -460, 284, 285, 286, 289,
2095 1198, -460, 265, 757, 9, -460, -460, 290, 291, 396,
2096 415, 431, -460, 253, -460, 192, 300, 297, -460, 422,
2097 7, 429, 430, 304, 308, 309, 735, 445, 735, 312,
2098 316, 735, 317, 192, -460, 321, 326, 735, 735, 192,
2099 327, 329, 1240, 94, 339, 353, -63, 1198, 1198, 1198,
2100 1198, -460, -460, 350, 1198, 1198, 1240, -460, -460, -460,
2101 74, 1118, -460, 355, -460, 735, 735, 1240, 735, 735,
2102 329, -460, 329, 1240, 735, 360, 1240, 1240, 1240, -460,
2103 -460, 1240, 447, -460, 607, -460, 1198, 1198, -460, 362,
2104 357, 363, 364, -460, 365, 370, 179, -460, -460, -460,
2105 192, 85, 484, 366, 372, 607, -24, -460, -460, -460,
2106 -460, -460, 373, 735, -460, -460, -460, 6, 329, 371,
2107 377, 1198, -460, 1198, 1198, -460, -460, -460, 74, -460,
2108 456, -460, 492, 1, -460, 1240, -460, -460, 375, -460,
2109 -460, -460, -460, 379, 381, 383, -460, 505, -460, 735,
2110 -460, 888, 11, -80, 607, 141, -460, 99, -460, -460,
2111 -460, -460, -460, 388, -460, 888, -460, 515, 516, 393,
2112 -80, 735, 735, 518, 482, -460, 735, 536, -460, 735,
2116 /* YYPGOTO[NTERM-NUM]. */
2117 static const yytype_int16 yypgoto[] =
2119 -460, 426, 427, 428, 314, 315, -163, -460, 0, 27,
2120 469, 10, -460, -460, -460, -460, 236, -460, -460, -460,
2121 -143, -306, -409, -460, -220, -460, -281, 58, -460, -297,
2122 -460, -460, -25, 342, -113, -460, 462, 470, -29, -150,
2123 -208, 198, 257, 335, -460, -460, 556, -460, -460, -460,
2124 -460, -460, -460, -460, -460, -460, -460, -460, 491, -460,
2125 -460, -460, -460, -460, -460, -459, -139, 96, -168, -460,
2126 524, -460, -460, -460, -460, -460, 100, 187, -460, -460,
2130 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2131 positive, shift that token. If negative, reduce the rule which
2132 number is the opposite. If zero, do what YYDEFACT says.
2133 If YYTABLE_NINF, syntax error. */
2134 #define YYTABLE_NINF -189
2135 static const yytype_int16 yytable[] =
2137 10, 77, 265, 254, 86, 323, 460, 229, 100, 156,
2138 12, 89, 264, 388, 255, 371, 10, 388, 157, 23,
2139 297, 138, 264, 266, 127, 426, 12, 390, 391, 25,
2140 -188, 128, 139, 312, 313, 301, 302, 303, 304, 305,
2141 338, 340, 308, 428, 20, -63, 1, 2, 104, 3,
2142 4, 314, 315, 400, 113, 114, 5, 6, 21, 410,
2143 401, 62, 63, 427, 102, 65, 66, 67, 68, 309,
2144 1, 2, 130, 3, 4, 473, 104, 7, 411, 488,
2145 8, 427, 130, 138, 9, 26, 154, 145, 10, 129,
2146 1, 528, 563, 3, 223, 62, 63, 145, 24, 69,
2147 -55, -55, -55, -55, 1, 2, 569, 3, 4, 220,
2148 221, 400, 226, 224, 535, 410, 459, 227, 536, 230,
2149 231, 360, 406, 360, 360, 553, 360, 62, 63, 404,
2150 102, 65, 66, 67, 68, 90, 1, 2, 260, 3,
2151 4, 400, 158, 385, 535, 400, 550, 400, 539, 420,
2152 405, 42, 101, 365, 464, 317, 564, 570, 453, 360,
2153 483, 295, 296, 260, 298, 69, 257, 360, 360, 60,
2154 106, 1, 107, 27, 3, 567, 320, 299, 260, 260,
2155 260, 260, 260, 306, 307, 260, 56, 312, 313, 509,
2156 44, 510, 45, 130, 70, 388, 383, 71, 312, 313,
2157 72, 2, 73, 145, 4, 314, 315, 432, 57, 434,
2158 435, 436, 312, 313, 86, 386, 314, 315, 387, 116,
2159 117, 118, 119, 120, 121, 58, 360, 360, 360, 386,
2160 314, 315, 387, 106, 360, 107, 485, 540, 48, 49,
2161 50, 145, 501, 51, 360, 360, 310, 311, 106, 388,
2162 107, 388, 366, 254, 312, 313, 321, 106, 93, 107,
2163 70, 373, 262, 71, 255, 263, 72, 94, 73, 367,
2164 97, 386, 314, 315, 387, 79, 80, 232, 233, 234,
2165 235, 81, 84, 82, 145, 384, 260, 360, 85, 360,
2166 368, 106, 360, 107, 370, 106, 95, 107, 360, 360,
2167 395, 396, 397, 398, 399, 511, 141, 142, 514, 515,
2168 516, 98, 403, 407, 408, 409, 555, 99, 106, 557,
2169 107, 527, 415, 36, 37, 38, 360, 360, 82, 360,
2170 360, 106, 110, 107, 111, 360, 108, 109, 134, 135,
2171 155, 216, 218, 219, 222, 360, -56, 225, 228, -57,
2172 260, 433, 260, 260, 260, 236, 258, 439, 362, 363,
2173 264, 364, 322, 329, 444, 445, 360, 443, 330, 331,
2174 551, 451, 332, 333, 360, 62, 63, 341, 102, 65,
2175 66, 67, 68, 342, 1, 2, 343, 3, 4, 565,
2176 344, 345, 374, 347, 372, 382, 375, 376, 377, 378,
2177 379, 392, 380, 381, 393, 394, 418, 421, 422, 431,
2178 360, 437, 452, 69, 438, 360, 442, 484, 489, 490,
2179 491, 492, 447, 448, 449, 494, 495, 450, 454, 455,
2180 456, 496, 360, 360, 457, 458, 500, 360, 461, 462,
2181 360, 463, 505, 465, 466, 467, 468, 469, 260, 471,
2182 473, 260, 260, 260, 474, 476, 505, 519, 520, 477,
2183 497, 423, 424, 425, 478, 278, 279, 482, 481, 430,
2184 28, 29, 30, 31, 32, 33, 34, 486, 35, 440,
2185 441, 267, 268, 269, 270, 271, 272, 273, 274, 275,
2186 276, 487, 543, 502, 544, 545, 427, 493, 513, 522,
2187 521, 523, 524, 531, 532, 547, 549, 525, 70, 561,
2188 554, 71, 526, 541, 72, 533, 73, 103, 537, 542,
2189 556, 558, 470, 559, 472, 560, 568, 475, 497, 571,
2190 572, 573, 576, 479, 480, 280, 281, 282, 283, 284,
2191 285, 286, 287, 288, 289, 290, 291, 292, 293, 577,
2192 579, 208, 209, 210, 327, 546, 328, 125, -187, 529,
2193 318, 503, 504, 326, 507, 508, 36, 37, 38, 140,
2194 512, 137, 43, -63, 1, 2, 124, 3, 4, 92,
2195 518, 517, 446, 0, 5, 6, 0, 0, 0, 0,
2196 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2197 0, 534, 0, 0, 0, 7, 0, 0, 8, 538,
2198 348, 349, 9, 0, 62, 63, 350, 0, 0, 0,
2199 0, 0, 0, 1, 2, 0, 3, 4, 351, 352,
2200 353, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2201 0, 0, 0, 354, 355, 562, 0, 0, 0, 0,
2202 566, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2203 356, 0, 0, 0, 0, 0, 0, 574, 575, 0,
2204 0, 0, 578, 0, 0, 580, 169, 170, 171, 172,
2205 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2206 183, 240, 241, 0, 0, 0, 0, 0, 0, 0,
2207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2208 0, 0, 0, 0, 0, 0, 0, 0, 242, 190,
2209 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2210 201, 0, 243, 0, 244, 245, 246, 0, 348, 349,
2211 0, 0, 62, 63, 350, 0, 106, 0, 107, 0,
2212 0, 1, 2, 357, 3, 4, 351, 352, 353, 0,
2213 0, 0, 0, 0, 62, 63, 0, 0, 0, 0,
2214 0, 354, 355, 1, 2, 0, 3, 4, 237, 0,
2215 0, 0, 0, 0, 0, 0, 0, 0, 356, 0,
2216 0, 0, 0, 238, 239, 0, 0, 0, 0, 0,
2217 0, 0, 0, 0, 169, 170, 171, 172, 173, 174,
2218 175, 176, 177, 178, 179, 180, 181, 182, 183, 240,
2219 241, 0, 0, 0, 0, 0, 169, 170, 171, 172,
2220 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2221 183, 240, 241, 0, 0, 0, 242, 190, 191, 192,
2222 193, 194, 195, 196, 197, 198, 199, 200, 201, 0,
2223 243, 0, 244, 245, 246, 0, 0, 0, 242, 190,
2224 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2225 201, 357, 243, 0, 244, 245, 246, 0, 0, 0,
2226 0, 348, 349, 0, 0, 0, 106, 350, 107, 0,
2227 247, 0, 0, 248, 0, 249, 0, 250, 0, 351,
2228 352, 353, 0, 0, 0, 0, 0, 0, 0, 0,
2229 0, 0, 0, 0, 354, 355, 0, 0, 0, 0,
2230 0, 0, 0, 0, 0, 0, 0, 0, 0, 62,
2231 63, 356, 102, 65, 66, 67, 68, 0, 1, 2,
2232 0, 3, 4, 0, 0, 0, 0, 169, 170, 171,
2233 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
2234 182, 183, 240, 241, 0, 0, 0, 69, 0, 0,
2235 62, 63, 0, 102, 148, 149, 150, 68, 0, 1,
2236 2, 0, 3, 4, 0, 0, 0, 0, 0, 242,
2237 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
2238 200, 201, 0, 243, 0, 244, 245, 246, 69, 62,
2239 63, 0, 102, 148, 149, 150, 68, 0, 1, 2,
2240 0, 3, 4, 0, 357, 62, 63, 0, 143, 65,
2241 66, 67, 68, 0, 1, 2, 0, 3, 4, 62,
2242 63, 0, 102, 148, 149, 150, 68, 69, 1, 2,
2243 0, 3, 4, 0, 0, 0, 0, 0, 0, 0,
2244 0, 0, 70, 69, 0, 71, 0, 0, 72, 0,
2245 73, 136, 0, 0, 0, 0, 0, 69, 0, 62,
2246 63, 0, 102, 65, 66, 67, 68, 0, 1, 2,
2247 0, 3, 4, 0, 0, 0, 0, 0, 0, 0,
2248 0, 0, 0, 70, 0, 0, 71, 414, 0, 72,
2249 0, 73, 339, 0, 0, 62, 63, 69, 102, 65,
2250 66, 67, 68, 0, 1, 2, 0, 3, 4, 0,
2251 0, 0, 0, 0, 0, 144, 0, 0, 0, 0,
2252 0, 0, 70, 499, 0, 71, 0, 0, 72, 0,
2253 73, 402, 0, 69, 0, 0, 0, 0, 70, 0,
2254 0, 71, 0, 0, 72, 0, 73, 0, 0, 0,
2255 0, 0, 70, 0, 0, 71, 0, 334, 72, 0,
2256 73, 62, 63, 0, 64, 65, 66, 67, 68, 0,
2257 1, 2, 0, 3, 4, 62, 63, 0, 102, 148,
2258 149, 150, 68, 0, 1, 2, 0, 3, 4, 0,
2259 0, 0, 70, 0, 0, 71, 0, 0, 72, 69,
2260 73, 0, 62, 63, 0, 143, 65, 66, 67, 68,
2261 0, 1, 2, 69, 3, 4, 0, 62, 63, 0,
2262 102, 65, 66, 67, 68, 0, 1, 2, 70, 3,
2263 4, 71, 0, 0, 72, 0, 73, 0, 62, 63,
2264 69, 259, 65, 66, 67, 68, 0, 1, 2, 0,
2265 3, 4, 0, 62, 63, 69, 102, 148, 149, 150,
2266 68, 0, 1, 2, 0, 3, 4, 0, 0, 0,
2267 0, 0, 0, 0, 0, 0, 69, 0, 0, 0,
2268 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2269 0, 69, 0, 0, 70, 0, 0, 71, 0, 0,
2270 72, 0, 73, 0, 0, 0, 0, 0, 70, 0,
2271 0, 71, 0, 0, 72, 0, 73, 0, 0, 0,
2272 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2273 0, 0, 0, 0, 0, 70, 0, 0, 71, 0,
2274 0, 72, 0, 73, 0, 0, 0, 0, 0, 0,
2275 70, 0, 0, 71, 0, 0, 72, 0, 73, 0,
2276 0, 0, 0, 0, 160, 0, 0, 0, 0, 0,
2277 0, 70, 0, 0, 71, 0, 0, 72, 0, 73,
2278 0, 0, 0, 161, 162, 0, 70, 0, 0, 71,
2279 0, 0, 72, 0, 337, 163, 164, 165, 166, 167,
2280 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2281 178, 179, 180, 181, 182, 183, 184, 185, 0, 0,
2282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2283 0, 0, 0, 0, 0, 0, 0, 0, 186, 187,
2284 188, 0, 0, 189, 190, 191, 192, 193, 194, 195,
2285 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2289 static const yytype_int16 yycheck[] =
2291 0, 26, 165, 153, 18, 225, 415, 146, 4, 122,
2292 0, 25, 11, 319, 153, 296, 16, 323, 24, 137,
2293 188, 138, 11, 166, 138, 11, 16, 324, 325, 137,
2294 0, 145, 149, 113, 114, 203, 204, 205, 206, 207,
2295 248, 249, 210, 11, 48, 15, 16, 17, 73, 19,
2296 20, 131, 132, 138, 28, 29, 26, 27, 62, 30,
2297 145, 7, 8, 49, 10, 11, 12, 13, 14, 212,
2298 16, 17, 97, 19, 20, 138, 101, 47, 49, 142,
2299 50, 49, 107, 138, 54, 15, 115, 112, 88, 35,
2300 16, 500, 551, 19, 149, 7, 8, 122, 53, 45,
2301 3, 4, 5, 6, 16, 17, 565, 19, 20, 134,
2302 135, 138, 141, 138, 138, 30, 413, 142, 142, 22,
2303 23, 260, 149, 262, 263, 534, 265, 7, 8, 337,
2304 10, 11, 12, 13, 14, 149, 16, 17, 163, 19,
2305 20, 138, 148, 311, 138, 138, 145, 138, 142, 357,
2306 147, 0, 148, 266, 147, 35, 145, 566, 149, 298,
2307 441, 186, 187, 188, 189, 45, 156, 306, 307, 19,
2308 139, 16, 141, 137, 19, 34, 145, 202, 203, 204,
2309 205, 206, 207, 208, 209, 210, 137, 113, 114, 470,
2310 42, 472, 44, 218, 140, 501, 309, 143, 113, 114,
2311 146, 17, 148, 228, 20, 131, 132, 375, 137, 377,
2312 378, 379, 113, 114, 18, 130, 131, 132, 133, 56,
2313 57, 58, 59, 60, 61, 143, 365, 366, 367, 130,
2314 131, 132, 133, 139, 373, 141, 142, 518, 38, 39,
2315 40, 266, 462, 43, 383, 384, 109, 110, 139, 555,
2316 141, 557, 277, 403, 113, 114, 147, 139, 19, 141,
2317 140, 143, 11, 143, 403, 14, 146, 19, 148, 294,
2318 141, 130, 131, 132, 133, 39, 40, 3, 4, 5,
2319 6, 31, 46, 33, 309, 310, 311, 426, 52, 428,
2320 138, 139, 431, 141, 138, 139, 19, 141, 437, 438,
2321 329, 330, 331, 332, 333, 473, 108, 109, 476, 477,
2322 478, 4, 337, 342, 343, 344, 536, 4, 139, 539,
2323 141, 142, 347, 134, 135, 136, 465, 466, 33, 468,
2324 469, 139, 38, 141, 40, 474, 79, 80, 144, 144,
2325 4, 19, 138, 142, 147, 484, 9, 142, 141, 9,
2326 375, 376, 377, 378, 379, 9, 51, 382, 262, 263,
2327 11, 265, 147, 141, 393, 394, 505, 392, 141, 141,
2328 533, 400, 141, 141, 513, 7, 8, 19, 10, 11,
2329 12, 13, 14, 141, 16, 17, 141, 19, 20, 552,
2330 141, 138, 138, 141, 298, 34, 138, 138, 138, 138,
2331 138, 34, 306, 307, 141, 141, 55, 138, 138, 143,
2332 549, 138, 147, 45, 138, 554, 138, 442, 447, 448,
2333 449, 450, 138, 138, 138, 454, 455, 138, 138, 138,
2334 34, 456, 571, 572, 19, 4, 461, 576, 138, 142,
2335 579, 19, 467, 14, 14, 141, 138, 138, 473, 4,
2336 138, 476, 477, 478, 138, 138, 481, 486, 487, 138,
2337 460, 365, 366, 367, 138, 22, 23, 138, 141, 373,
2338 38, 39, 40, 41, 42, 43, 44, 138, 46, 383,
2339 384, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2340 95, 138, 521, 138, 523, 524, 49, 147, 138, 142,
2341 138, 138, 138, 19, 138, 49, 14, 142, 140, 4,
2342 535, 143, 142, 142, 146, 143, 148, 149, 145, 142,
2343 145, 142, 426, 142, 428, 142, 138, 431, 528, 14,
2344 14, 138, 14, 437, 438, 92, 93, 94, 95, 96,
2345 97, 98, 99, 100, 101, 102, 103, 104, 105, 67,
2346 14, 125, 125, 125, 240, 528, 241, 88, 0, 501,
2347 218, 465, 466, 228, 468, 469, 134, 135, 136, 107,
2348 474, 101, 16, 15, 16, 17, 85, 19, 20, 55,
2349 484, 481, 395, -1, 26, 27, -1, -1, -1, -1,
2350 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2351 -1, 505, -1, -1, -1, 47, -1, -1, 50, 513,
2352 3, 4, 54, -1, 7, 8, 9, -1, -1, -1,
2353 -1, -1, -1, 16, 17, -1, 19, 20, 21, 22,
2354 23, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2355 -1, -1, -1, 36, 37, 549, -1, -1, -1, -1,
2356 554, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2357 53, -1, -1, -1, -1, -1, -1, 571, 572, -1,
2358 -1, -1, 576, -1, -1, 579, 69, 70, 71, 72,
2359 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2360 83, 84, 85, -1, -1, -1, -1, -1, -1, -1,
2361 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2362 -1, -1, -1, -1, -1, -1, -1, -1, 111, 112,
2363 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2364 123, -1, 125, -1, 127, 128, 129, -1, 3, 4,
2365 -1, -1, 7, 8, 9, -1, 139, -1, 141, -1,
2366 -1, 16, 17, 146, 19, 20, 21, 22, 23, -1,
2367 -1, -1, -1, -1, 7, 8, -1, -1, -1, -1,
2368 -1, 36, 37, 16, 17, -1, 19, 20, 21, -1,
2369 -1, -1, -1, -1, -1, -1, -1, -1, 53, -1,
2370 -1, -1, -1, 36, 37, -1, -1, -1, -1, -1,
2371 -1, -1, -1, -1, 69, 70, 71, 72, 73, 74,
2372 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2373 85, -1, -1, -1, -1, -1, 69, 70, 71, 72,
2374 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2375 83, 84, 85, -1, -1, -1, 111, 112, 113, 114,
2376 115, 116, 117, 118, 119, 120, 121, 122, 123, -1,
2377 125, -1, 127, 128, 129, -1, -1, -1, 111, 112,
2378 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2379 123, 146, 125, -1, 127, 128, 129, -1, -1, -1,
2380 -1, 3, 4, -1, -1, -1, 139, 9, 141, -1,
2381 143, -1, -1, 146, -1, 148, -1, 150, -1, 21,
2382 22, 23, -1, -1, -1, -1, -1, -1, -1, -1,
2383 -1, -1, -1, -1, 36, 37, -1, -1, -1, -1,
2384 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2385 8, 53, 10, 11, 12, 13, 14, -1, 16, 17,
2386 -1, 19, 20, -1, -1, -1, -1, 69, 70, 71,
2387 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2388 82, 83, 84, 85, -1, -1, -1, 45, -1, -1,
2389 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2390 17, -1, 19, 20, -1, -1, -1, -1, -1, 111,
2391 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2392 122, 123, -1, 125, -1, 127, 128, 129, 45, 7,
2393 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2394 -1, 19, 20, -1, 146, 7, 8, -1, 10, 11,
2395 12, 13, 14, -1, 16, 17, -1, 19, 20, 7,
2396 8, -1, 10, 11, 12, 13, 14, 45, 16, 17,
2397 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2398 -1, -1, 140, 45, -1, 143, -1, -1, 146, -1,
2399 148, 149, -1, -1, -1, -1, -1, 45, -1, 7,
2400 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2401 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2402 -1, -1, -1, 140, -1, -1, 143, 35, -1, 146,
2403 -1, 148, 149, -1, -1, 7, 8, 45, 10, 11,
2404 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2405 -1, -1, -1, -1, -1, 117, -1, -1, -1, -1,
2406 -1, -1, 140, 35, -1, 143, -1, -1, 146, -1,
2407 148, 149, -1, 45, -1, -1, -1, -1, 140, -1,
2408 -1, 143, -1, -1, 146, -1, 148, -1, -1, -1,
2409 -1, -1, 140, -1, -1, 143, -1, 145, 146, -1,
2410 148, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2411 16, 17, -1, 19, 20, 7, 8, -1, 10, 11,
2412 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2413 -1, -1, 140, -1, -1, 143, -1, -1, 146, 45,
2414 148, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2415 -1, 16, 17, 45, 19, 20, -1, 7, 8, -1,
2416 10, 11, 12, 13, 14, -1, 16, 17, 140, 19,
2417 20, 143, -1, -1, 146, -1, 148, -1, 7, 8,
2418 45, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2419 19, 20, -1, 7, 8, 45, 10, 11, 12, 13,
2420 14, -1, 16, 17, -1, 19, 20, -1, -1, -1,
2421 -1, -1, -1, -1, -1, -1, 45, -1, -1, -1,
2422 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2423 -1, 45, -1, -1, 140, -1, -1, 143, -1, -1,
2424 146, -1, 148, -1, -1, -1, -1, -1, 140, -1,
2425 -1, 143, -1, -1, 146, -1, 148, -1, -1, -1,
2426 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2427 -1, -1, -1, -1, -1, 140, -1, -1, 143, -1,
2428 -1, 146, -1, 148, -1, -1, -1, -1, -1, -1,
2429 140, -1, -1, 143, -1, -1, 146, -1, 148, -1,
2430 -1, -1, -1, -1, 32, -1, -1, -1, -1, -1,
2431 -1, 140, -1, -1, 143, -1, -1, 146, -1, 148,
2432 -1, -1, -1, 51, 52, -1, 140, -1, -1, 143,
2433 -1, -1, 146, -1, 148, 63, 64, 65, 66, 67,
2434 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2435 78, 79, 80, 81, 82, 83, 84, 85, -1, -1,
2436 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2437 -1, -1, -1, -1, -1, -1, -1, -1, 106, 107,
2438 108, -1, -1, 111, 112, 113, 114, 115, 116, 117,
2439 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2443 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2444 symbol of state STATE-NUM. */
2445 static const yytype_uint8 yystos[] =
2447 0, 16, 17, 19, 20, 26, 27, 47, 50, 54,
2448 159, 161, 162, 163, 164, 195, 196, 197, 199, 198,
2449 48, 62, 204, 137, 53, 137, 15, 137, 38, 39,
2450 40, 41, 42, 43, 44, 46, 134, 135, 136, 165,
2451 166, 167, 0, 197, 42, 44, 168, 214, 38, 39,
2452 40, 43, 169, 211, 213, 220, 137, 137, 143, 205,
2453 19, 203, 7, 8, 10, 11, 12, 13, 14, 45,
2454 140, 143, 146, 148, 159, 162, 182, 183, 217, 167,
2455 167, 31, 33, 193, 167, 167, 18, 221, 222, 25,
2456 149, 212, 221, 19, 19, 19, 206, 141, 4, 4,
2457 4, 148, 10, 149, 183, 188, 139, 141, 193, 193,
2458 38, 40, 170, 28, 29, 192, 56, 57, 58, 59,
2459 60, 61, 171, 209, 209, 161, 225, 138, 145, 35,
2460 183, 184, 186, 187, 144, 144, 149, 188, 138, 149,
2461 187, 192, 192, 10, 117, 183, 185, 194, 11, 12,
2462 13, 157, 158, 183, 189, 4, 185, 24, 148, 210,
2463 32, 51, 52, 63, 64, 65, 66, 67, 68, 69,
2464 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2465 80, 81, 82, 83, 84, 85, 106, 107, 108, 111,
2466 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2467 122, 123, 124, 125, 126, 127, 128, 129, 152, 153,
2468 154, 223, 229, 230, 231, 232, 19, 173, 138, 142,
2469 183, 183, 147, 149, 183, 142, 189, 183, 141, 217,
2470 22, 23, 3, 4, 5, 6, 9, 21, 36, 37,
2471 84, 85, 111, 125, 127, 128, 129, 143, 146, 148,
2472 150, 152, 153, 154, 190, 217, 200, 162, 51, 10,
2473 183, 219, 11, 14, 11, 157, 171, 86, 87, 88,
2474 89, 90, 91, 92, 93, 94, 95, 155, 22, 23,
2475 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
2476 102, 103, 104, 105, 156, 183, 183, 219, 183, 183,
2477 226, 219, 219, 219, 219, 219, 183, 183, 219, 171,
2478 109, 110, 113, 114, 131, 132, 172, 35, 184, 175,
2479 145, 147, 147, 175, 201, 202, 194, 155, 156, 141,
2480 141, 141, 141, 141, 145, 189, 191, 148, 191, 149,
2481 191, 19, 141, 141, 141, 138, 180, 141, 3, 4,
2482 9, 21, 22, 23, 36, 37, 53, 146, 190, 216,
2483 217, 218, 218, 218, 218, 185, 183, 183, 138, 177,
2484 138, 177, 218, 143, 138, 138, 138, 138, 138, 138,
2485 218, 218, 34, 185, 183, 219, 130, 133, 172, 174,
2486 180, 180, 34, 141, 141, 189, 189, 189, 189, 189,
2487 138, 145, 149, 183, 191, 147, 149, 189, 189, 189,
2488 30, 49, 178, 181, 35, 183, 207, 208, 55, 215,
2489 191, 138, 138, 218, 218, 218, 11, 49, 11, 228,
2490 218, 143, 219, 183, 219, 219, 219, 138, 138, 183,
2491 218, 218, 138, 183, 189, 189, 228, 138, 138, 138,
2492 138, 189, 147, 149, 138, 138, 34, 19, 4, 180,
2493 173, 138, 142, 19, 147, 14, 14, 141, 138, 138,
2494 218, 4, 218, 138, 138, 218, 138, 138, 138, 218,
2495 218, 141, 138, 177, 183, 142, 138, 138, 142, 189,
2496 189, 189, 189, 147, 189, 189, 183, 159, 160, 35,
2497 183, 175, 138, 218, 218, 183, 227, 218, 218, 177,
2498 177, 219, 218, 138, 219, 219, 219, 227, 218, 189,
2499 189, 138, 142, 138, 138, 142, 142, 142, 173, 178,
2500 179, 19, 138, 143, 218, 138, 142, 145, 218, 142,
2501 177, 142, 142, 189, 189, 189, 160, 49, 176, 14,
2502 145, 157, 224, 173, 183, 175, 145, 175, 142, 142,
2503 142, 4, 218, 216, 145, 157, 218, 34, 138, 216,
2504 173, 14, 14, 138, 218, 218, 14, 67, 218, 14,
2508 #define yyerrok (yyerrstatus = 0)
2509 #define yyclearin (yychar = YYEMPTY)
2510 #define YYEMPTY (-2)
2513 #define YYACCEPT goto yyacceptlab
2514 #define YYABORT goto yyabortlab
2515 #define YYERROR goto yyerrorlab
2518 /* Like YYERROR except do call yyerror. This remains here temporarily
2519 to ease the transition to the new meaning of YYERROR, for GCC.
2520 Once GCC version 2 has supplanted version 1, this can go. */
2522 #define YYFAIL goto yyerrlab
2524 #define YYRECOVERING() (!!yyerrstatus)
2526 #define YYBACKUP(Token, Value) \
2528 if (yychar == YYEMPTY && yylen == 1) \
2532 yytoken = YYTRANSLATE (yychar); \
2538 yyerror (YY_("syntax error: cannot back up")); \
2545 #define YYERRCODE 256
2548 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2549 If N is 0, then set CURRENT to the empty location which ends
2550 the previous symbol: RHS[0] (always defined). */
2552 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2553 #ifndef YYLLOC_DEFAULT
2554 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2558 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2559 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2560 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2561 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2565 (Current).first_line = (Current).last_line = \
2566 YYRHSLOC (Rhs, 0).last_line; \
2567 (Current).first_column = (Current).last_column = \
2568 YYRHSLOC (Rhs, 0).last_column; \
2574 /* YY_LOCATION_PRINT -- Print the location on the stream.
2575 This macro was not mandated originally: define only if we know
2576 we won't break user code: when these are the locations we know. */
2578 #ifndef YY_LOCATION_PRINT
2579 # if YYLTYPE_IS_TRIVIAL
2580 # define YY_LOCATION_PRINT(File, Loc) \
2581 fprintf (File, "%d.%d-%d.%d", \
2582 (Loc).first_line, (Loc).first_column, \
2583 (Loc).last_line, (Loc).last_column)
2585 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2590 /* YYLEX -- calling `yylex' with the right arguments. */
2593 # define YYLEX yylex (YYLEX_PARAM)
2595 # define YYLEX yylex ()
2598 /* Enable debugging if requested. */
2602 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2603 # define YYFPRINTF fprintf
2606 # define YYDPRINTF(Args) \
2612 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2616 YYFPRINTF (stderr, "%s ", Title); \
2617 yy_symbol_print (stderr, \
2619 YYFPRINTF (stderr, "\n"); \
2624 /*--------------------------------.
2625 | Print this symbol on YYOUTPUT. |
2626 `--------------------------------*/
2629 #if (defined __STDC__ || defined __C99__FUNC__ \
2630 || defined __cplusplus || defined _MSC_VER)
2632 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2635 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2638 YYSTYPE const * const yyvaluep;
2644 if (yytype < YYNTOKENS)
2645 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2657 /*--------------------------------.
2658 | Print this symbol on YYOUTPUT. |
2659 `--------------------------------*/
2661 #if (defined __STDC__ || defined __C99__FUNC__ \
2662 || defined __cplusplus || defined _MSC_VER)
2664 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2667 yy_symbol_print (yyoutput, yytype, yyvaluep)
2670 YYSTYPE const * const yyvaluep;
2673 if (yytype < YYNTOKENS)
2674 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2676 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2678 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2679 YYFPRINTF (yyoutput, ")");
2682 /*------------------------------------------------------------------.
2683 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2685 `------------------------------------------------------------------*/
2687 #if (defined __STDC__ || defined __C99__FUNC__ \
2688 || defined __cplusplus || defined _MSC_VER)
2690 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2693 yy_stack_print (bottom, top)
2694 yytype_int16 *bottom;
2698 YYFPRINTF (stderr, "Stack now");
2699 for (; bottom <= top; ++bottom)
2700 YYFPRINTF (stderr, " %d", *bottom);
2701 YYFPRINTF (stderr, "\n");
2704 # define YY_STACK_PRINT(Bottom, Top) \
2707 yy_stack_print ((Bottom), (Top)); \
2711 /*------------------------------------------------.
2712 | Report that the YYRULE is going to be reduced. |
2713 `------------------------------------------------*/
2715 #if (defined __STDC__ || defined __C99__FUNC__ \
2716 || defined __cplusplus || defined _MSC_VER)
2718 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2721 yy_reduce_print (yyvsp, yyrule)
2726 int yynrhs = yyr2[yyrule];
2728 unsigned long int yylno = yyrline[yyrule];
2729 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2731 /* The symbols being reduced. */
2732 for (yyi = 0; yyi < yynrhs; yyi++)
2734 fprintf (stderr, " $%d = ", yyi + 1);
2735 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2736 &(yyvsp[(yyi + 1) - (yynrhs)])
2738 fprintf (stderr, "\n");
2742 # define YY_REDUCE_PRINT(Rule) \
2745 yy_reduce_print (yyvsp, Rule); \
2748 /* Nonzero means print parse trace. It is left uninitialized so that
2749 multiple parsers can coexist. */
2751 #else /* !YYDEBUG */
2752 # define YYDPRINTF(Args)
2753 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2754 # define YY_STACK_PRINT(Bottom, Top)
2755 # define YY_REDUCE_PRINT(Rule)
2756 #endif /* !YYDEBUG */
2759 /* YYINITDEPTH -- initial size of the parser's stacks. */
2761 # define YYINITDEPTH 200
2764 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2765 if the built-in stack extension method is used).
2767 Do not make this value too large; the results are undefined if
2768 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2769 evaluated with infinite-precision integer arithmetic. */
2772 # define YYMAXDEPTH 10000
2780 # if defined __GLIBC__ && defined _STRING_H
2781 # define yystrlen strlen
2783 /* Return the length of YYSTR. */
2784 #if (defined __STDC__ || defined __C99__FUNC__ \
2785 || defined __cplusplus || defined _MSC_VER)
2787 yystrlen (const char *yystr)
2795 for (yylen = 0; yystr[yylen]; yylen++)
2803 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2804 # define yystpcpy stpcpy
2806 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2808 #if (defined __STDC__ || defined __C99__FUNC__ \
2809 || defined __cplusplus || defined _MSC_VER)
2811 yystpcpy (char *yydest, const char *yysrc)
2814 yystpcpy (yydest, yysrc)
2820 const char *yys = yysrc;
2822 while ((*yyd++ = *yys++) != '\0')
2831 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2832 quotes and backslashes, so that it's suitable for yyerror. The
2833 heuristic is that double-quoting is unnecessary unless the string
2834 contains an apostrophe, a comma, or backslash (other than
2835 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2836 null, do not copy; instead, return the length of what the result
2839 yytnamerr (char *yyres, const char *yystr)
2844 char const *yyp = yystr;
2851 goto do_not_strip_quotes;
2855 goto do_not_strip_quotes;
2868 do_not_strip_quotes: ;
2872 return yystrlen (yystr);
2874 return yystpcpy (yyres, yystr) - yyres;
2878 /* Copy into YYRESULT an error message about the unexpected token
2879 YYCHAR while in state YYSTATE. Return the number of bytes copied,
2880 including the terminating null byte. If YYRESULT is null, do not
2881 copy anything; just return the number of bytes that would be
2882 copied. As a special case, return 0 if an ordinary "syntax error"
2883 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
2884 size calculation. */
2886 yysyntax_error (char *yyresult, int yystate, int yychar)
2888 int yyn = yypact[yystate];
2890 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
2894 int yytype = YYTRANSLATE (yychar);
2895 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2896 YYSIZE_T yysize = yysize0;
2898 int yysize_overflow = 0;
2899 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2900 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2904 /* This is so xgettext sees the translatable formats that are
2905 constructed on the fly. */
2906 YY_("syntax error, unexpected %s");
2907 YY_("syntax error, unexpected %s, expecting %s");
2908 YY_("syntax error, unexpected %s, expecting %s or %s");
2909 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2910 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2914 static char const yyunexpected[] = "syntax error, unexpected %s";
2915 static char const yyexpecting[] = ", expecting %s";
2916 static char const yyor[] = " or %s";
2917 char yyformat[sizeof yyunexpected
2918 + sizeof yyexpecting - 1
2919 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2920 * (sizeof yyor - 1))];
2921 char const *yyprefix = yyexpecting;
2923 /* Start YYX at -YYN if negative to avoid negative indexes in
2925 int yyxbegin = yyn < 0 ? -yyn : 0;
2927 /* Stay within bounds of both yycheck and yytname. */
2928 int yychecklim = YYLAST - yyn + 1;
2929 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2932 yyarg[0] = yytname[yytype];
2933 yyfmt = yystpcpy (yyformat, yyunexpected);
2935 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2936 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2938 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2942 yyformat[sizeof yyunexpected - 1] = '\0';
2945 yyarg[yycount++] = yytname[yyx];
2946 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2947 yysize_overflow |= (yysize1 < yysize);
2949 yyfmt = yystpcpy (yyfmt, yyprefix);
2953 yyf = YY_(yyformat);
2954 yysize1 = yysize + yystrlen (yyf);
2955 yysize_overflow |= (yysize1 < yysize);
2958 if (yysize_overflow)
2959 return YYSIZE_MAXIMUM;
2963 /* Avoid sprintf, as that infringes on the user's name space.
2964 Don't have undefined behavior even if the translation
2965 produced a string with the wrong number of "%s"s. */
2966 char *yyp = yyresult;
2968 while ((*yyp = *yyf) != '\0')
2970 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2972 yyp += yytnamerr (yyp, yyarg[yyi++]);
2985 #endif /* YYERROR_VERBOSE */
2988 /*-----------------------------------------------.
2989 | Release the memory associated to this symbol. |
2990 `-----------------------------------------------*/
2993 #if (defined __STDC__ || defined __C99__FUNC__ \
2994 || defined __cplusplus || defined _MSC_VER)
2996 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2999 yydestruct (yymsg, yytype, yyvaluep)
3009 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3020 /* Prevent warnings from -Wmissing-prototypes. */
3022 #ifdef YYPARSE_PARAM
3023 #if defined __STDC__ || defined __cplusplus
3024 int yyparse (void *YYPARSE_PARAM);
3028 #else /* ! YYPARSE_PARAM */
3029 #if defined __STDC__ || defined __cplusplus
3034 #endif /* ! YYPARSE_PARAM */
3038 /* The look-ahead symbol. */
3041 /* The semantic value of the look-ahead symbol. */
3044 /* Number of syntax errors so far. */
3053 #ifdef YYPARSE_PARAM
3054 #if (defined __STDC__ || defined __C99__FUNC__ \
3055 || defined __cplusplus || defined _MSC_VER)
3057 yyparse (void *YYPARSE_PARAM)
3060 yyparse (YYPARSE_PARAM)
3061 void *YYPARSE_PARAM;
3063 #else /* ! YYPARSE_PARAM */
3064 #if (defined __STDC__ || defined __C99__FUNC__ \
3065 || defined __cplusplus || defined _MSC_VER)
3079 /* Number of tokens to shift before error messages enabled. */
3081 /* Look-ahead token as an internal (translated) token number. */
3084 /* Buffer for error messages, and its allocated size. */
3086 char *yymsg = yymsgbuf;
3087 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3090 /* Three stacks and their tools:
3091 `yyss': related to states,
3092 `yyvs': related to semantic values,
3093 `yyls': related to locations.
3095 Refer to the stacks thru separate pointers, to allow yyoverflow
3096 to reallocate them elsewhere. */
3098 /* The state stack. */
3099 yytype_int16 yyssa[YYINITDEPTH];
3100 yytype_int16 *yyss = yyssa;
3101 yytype_int16 *yyssp;
3103 /* The semantic value stack. */
3104 YYSTYPE yyvsa[YYINITDEPTH];
3105 YYSTYPE *yyvs = yyvsa;
3110 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3112 YYSIZE_T yystacksize = YYINITDEPTH;
3114 /* The variables used to return semantic value and location from the
3119 /* The number of symbols on the RHS of the reduced rule.
3120 Keep to zero when no symbol should be popped. */
3123 YYDPRINTF ((stderr, "Starting parse\n"));
3128 yychar = YYEMPTY; /* Cause a token to be read. */
3130 /* Initialize stack pointers.
3131 Waste one element of value and location stack
3132 so that they stay on the same level as the state stack.
3133 The wasted elements are never initialized. */
3140 /*------------------------------------------------------------.
3141 | yynewstate -- Push a new state, which is found in yystate. |
3142 `------------------------------------------------------------*/
3144 /* In all cases, when you get here, the value and location stacks
3145 have just been pushed. So pushing a state here evens the stacks. */
3151 if (yyss + yystacksize - 1 <= yyssp)
3153 /* Get the current used size of the three stacks, in elements. */
3154 YYSIZE_T yysize = yyssp - yyss + 1;
3158 /* Give user a chance to reallocate the stack. Use copies of
3159 these so that the &'s don't force the real ones into
3161 YYSTYPE *yyvs1 = yyvs;
3162 yytype_int16 *yyss1 = yyss;
3165 /* Each stack pointer address is followed by the size of the
3166 data in use in that stack, in bytes. This used to be a
3167 conditional around just the two extra args, but that might
3168 be undefined if yyoverflow is a macro. */
3169 yyoverflow (YY_("memory exhausted"),
3170 &yyss1, yysize * sizeof (*yyssp),
3171 &yyvs1, yysize * sizeof (*yyvsp),
3178 #else /* no yyoverflow */
3179 # ifndef YYSTACK_RELOCATE
3180 goto yyexhaustedlab;
3182 /* Extend the stack our own way. */
3183 if (YYMAXDEPTH <= yystacksize)
3184 goto yyexhaustedlab;
3186 if (YYMAXDEPTH < yystacksize)
3187 yystacksize = YYMAXDEPTH;
3190 yytype_int16 *yyss1 = yyss;
3191 union yyalloc *yyptr =
3192 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3194 goto yyexhaustedlab;
3195 YYSTACK_RELOCATE (yyss);
3196 YYSTACK_RELOCATE (yyvs);
3198 # undef YYSTACK_RELOCATE
3200 YYSTACK_FREE (yyss1);
3203 #endif /* no yyoverflow */
3205 yyssp = yyss + yysize - 1;
3206 yyvsp = yyvs + yysize - 1;
3209 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3210 (unsigned long int) yystacksize));
3212 if (yyss + yystacksize - 1 <= yyssp)
3216 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3225 /* Do appropriate processing given the current state. Read a
3226 look-ahead token if we need one and don't already have one. */
3228 /* First try to decide what to do without reference to look-ahead token. */
3229 yyn = yypact[yystate];
3230 if (yyn == YYPACT_NINF)
3233 /* Not known => get a look-ahead token if don't already have one. */
3235 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3236 if (yychar == YYEMPTY)
3238 YYDPRINTF ((stderr, "Reading a token: "));
3242 if (yychar <= YYEOF)
3244 yychar = yytoken = YYEOF;
3245 YYDPRINTF ((stderr, "Now at end of input.\n"));
3249 yytoken = YYTRANSLATE (yychar);
3250 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3253 /* If the proper action on seeing token YYTOKEN is to reduce or to
3254 detect an error, take that action. */
3256 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3261 if (yyn == 0 || yyn == YYTABLE_NINF)
3270 /* Count tokens shifted since error; after three, turn off error
3275 /* Shift the look-ahead token. */
3276 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3278 /* Discard the shifted token unless it is eof. */
3279 if (yychar != YYEOF)
3288 /*-----------------------------------------------------------.
3289 | yydefault -- do the default action for the current state. |
3290 `-----------------------------------------------------------*/
3292 yyn = yydefact[yystate];
3298 /*-----------------------------.
3299 | yyreduce -- Do a reduction. |
3300 `-----------------------------*/
3302 /* yyn is the number of a rule to reduce with. */
3305 /* If YYLEN is nonzero, implement the default value of the action:
3308 Otherwise, the following line sets YYVAL to garbage.
3309 This behavior is undocumented and Bison
3310 users should not rely upon it. Assigning to YYVAL
3311 unconditionally makes the parser a bit smaller, and it avoids a
3312 GCC warning that YYVAL may be used uninitialized. */
3313 yyval = yyvsp[1-yylen];
3316 YY_REDUCE_PRINT (yyn);
3320 #line 1117 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3321 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3325 #line 1117 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3326 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3330 #line 1118 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3331 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3335 #line 1118 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3336 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3340 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3341 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3345 #line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3346 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3350 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3351 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3355 #line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3356 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3360 #line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3361 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3365 #line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3366 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3370 #line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3371 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3375 #line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3376 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3380 #line 1126 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3381 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3385 #line 1126 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3386 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3390 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3391 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3395 #line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3396 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3400 #line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3401 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3405 #line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3406 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3410 #line 1129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3411 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3415 #line 1129 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3416 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3420 #line 1130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3421 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3425 #line 1130 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3426 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3430 #line 1131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3431 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3435 #line 1131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3436 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3440 #line 1132 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3441 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3445 #line 1133 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3446 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3450 #line 1142 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3451 { (yyval.StrVal) = 0; ;}
3455 #line 1146 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3457 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3463 #line 1150 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3471 #line 1158 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3479 #line 1163 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3481 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3487 #line 1169 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3488 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3492 #line 1170 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3493 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3497 #line 1171 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3498 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3502 #line 1172 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3503 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3507 #line 1173 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3508 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3512 #line 1177 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3513 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3517 #line 1178 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3518 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3522 #line 1179 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3523 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3527 #line 1183 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3528 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3532 #line 1184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3533 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3537 #line 1185 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3538 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3542 #line 1186 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3543 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3547 #line 1190 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3548 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3552 #line 1191 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3553 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3557 #line 1192 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3558 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3562 #line 1196 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3563 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3567 #line 1197 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3568 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3572 #line 1198 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3573 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3577 #line 1199 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3578 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3582 #line 1200 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3583 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3587 #line 1204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3588 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3592 #line 1205 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3593 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3597 #line 1206 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3598 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3602 #line 1209 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3603 { (yyval.UIntVal) = CallingConv::C; ;}
3607 #line 1210 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3608 { (yyval.UIntVal) = CallingConv::C; ;}
3612 #line 1211 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3613 { (yyval.UIntVal) = CallingConv::Fast; ;}
3617 #line 1212 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3618 { (yyval.UIntVal) = CallingConv::Cold; ;}
3622 #line 1213 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3623 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3627 #line 1214 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3628 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3632 #line 1215 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3634 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3635 GEN_ERROR("Calling conv too large");
3636 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3642 #line 1222 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3643 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3647 #line 1223 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3648 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3652 #line 1224 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3653 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3657 #line 1225 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3658 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3662 #line 1228 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3663 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3667 #line 1229 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3669 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3674 #line 1234 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3675 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3679 #line 1235 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3680 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3684 #line 1239 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3685 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3689 #line 1240 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3691 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3696 #line 1247 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3697 { (yyval.UIntVal) = 0; ;}
3701 #line 1248 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3703 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3704 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3705 GEN_ERROR("Alignment must be a power of two");
3711 #line 1254 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3712 { (yyval.UIntVal) = 0; ;}
3716 #line 1255 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3718 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3719 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3720 GEN_ERROR("Alignment must be a power of two");
3726 #line 1263 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3728 for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i)
3729 if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\')
3730 GEN_ERROR("Invalid character in section name");
3731 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3737 #line 1271 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3738 { (yyval.StrVal) = 0; ;}
3742 #line 1272 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3743 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3747 #line 1277 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3752 #line 1278 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3757 #line 1279 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3759 CurGV->setSection((yyvsp[(1) - (1)].StrVal));
3760 free((yyvsp[(1) - (1)].StrVal));
3766 #line 1284 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3768 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3769 GEN_ERROR("Alignment must be a power of two");
3770 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3776 #line 1300 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3778 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3784 #line 1304 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3786 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
3792 #line 1308 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3794 if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
3795 GEN_ERROR("Cannot form a pointer to a basic block");
3796 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
3797 delete (yyvsp[(1) - (2)].TypeVal);
3803 #line 1315 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3804 { // Named types are also simple types...
3805 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
3807 (yyval.TypeVal) = new PATypeHolder(tmp);
3812 #line 1320 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3813 { // Type UpReference
3814 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3815 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3816 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
3817 (yyval.TypeVal) = new PATypeHolder(OT);
3818 UR_OUT("New Upreference!\n");
3824 #line 1328 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3826 std::vector<const Type*> Params;
3827 ParamAttrsVector Attrs;
3828 if ((yyvsp[(5) - (5)].ParamAttrs) != ParamAttr::None) {
3829 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[(5) - (5)].ParamAttrs);
3833 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
3834 for (; I != E; ++I, ++index) {
3835 const Type *Ty = I->Ty->get();
3836 Params.push_back(Ty);
3837 if (Ty != Type::VoidTy)
3838 if (I->Attrs != ParamAttr::None) {
3839 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3843 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3844 if (isVarArg) Params.pop_back();
3846 ParamAttrsList *ActualAttrs = 0;
3848 ActualAttrs = ParamAttrsList::get(Attrs);
3849 FunctionType *FT = FunctionType::get(*(yyvsp[(1) - (5)].TypeVal), Params, isVarArg, ActualAttrs);
3850 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3851 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
3852 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3858 #line 1358 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3860 std::vector<const Type*> Params;
3861 ParamAttrsVector Attrs;
3862 if ((yyvsp[(5) - (5)].ParamAttrs) != ParamAttr::None) {
3863 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[(5) - (5)].ParamAttrs);
3866 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
3868 for ( ; I != E; ++I, ++index) {
3869 const Type* Ty = I->Ty->get();
3870 Params.push_back(Ty);
3871 if (Ty != Type::VoidTy)
3872 if (I->Attrs != ParamAttr::None) {
3873 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3877 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3878 if (isVarArg) Params.pop_back();
3880 ParamAttrsList *ActualAttrs = 0;
3882 ActualAttrs = ParamAttrsList::get(Attrs);
3884 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg, ActualAttrs);
3885 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3886 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3892 #line 1389 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3893 { // Sized array type?
3894 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
3895 delete (yyvsp[(4) - (5)].TypeVal);
3901 #line 1394 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3903 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
3904 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
3905 GEN_ERROR("Unsigned result not equal to signed result");
3906 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3907 GEN_ERROR("Element type of a VectorType must be primitive");
3908 if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val)))
3909 GEN_ERROR("Vector length should be a power of 2");
3910 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
3911 delete (yyvsp[(4) - (5)].TypeVal);
3917 #line 1406 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3918 { // Structure type?
3919 std::vector<const Type*> Elements;
3920 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
3921 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
3922 Elements.push_back(*I);
3924 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3925 delete (yyvsp[(2) - (3)].TypeList);
3931 #line 1416 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3932 { // Empty structure type?
3933 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3939 #line 1420 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3941 std::vector<const Type*> Elements;
3942 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
3943 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
3944 Elements.push_back(*I);
3946 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3947 delete (yyvsp[(3) - (5)].TypeList);
3953 #line 1430 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3954 { // Empty structure type?
3955 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3961 #line 1437 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3963 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
3964 (yyval.TypeWithAttrs).Attrs = (yyvsp[(2) - (2)].ParamAttrs);
3969 #line 1444 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3971 if (!UpRefs.empty())
3972 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
3973 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
3974 GEN_ERROR("LLVM functions cannot return aggregate types");
3975 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
3980 #line 1451 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3982 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3987 #line 1456 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3989 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3990 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
3996 #line 1461 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3998 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4004 #line 1469 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4006 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4007 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4008 TWA.Ty = new PATypeHolder(Type::VoidTy);
4009 (yyval.TypeWithAttrsList)->push_back(TWA);
4015 #line 1476 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4017 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4018 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4019 TWA.Ty = new PATypeHolder(Type::VoidTy);
4020 (yyval.TypeWithAttrsList)->push_back(TWA);
4026 #line 1483 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4028 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4034 #line 1491 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4036 (yyval.TypeList) = new std::list<PATypeHolder>();
4037 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4038 delete (yyvsp[(1) - (1)].TypeVal);
4044 #line 1497 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4046 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4047 delete (yyvsp[(3) - (3)].TypeVal);
4053 #line 1509 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4054 { // Nonempty unsized arr
4055 if (!UpRefs.empty())
4056 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4057 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4059 GEN_ERROR("Cannot make array constant with type: '" +
4060 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4061 const Type *ETy = ATy->getElementType();
4062 int NumElements = ATy->getNumElements();
4064 // Verify that we have the correct size...
4065 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4066 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4067 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4068 itostr(NumElements) + "");
4070 // Verify all elements are correct type!
4071 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4072 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4073 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4074 ETy->getDescription() +"' as required!\nIt is of type '"+
4075 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4078 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4079 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4085 #line 1537 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4087 if (!UpRefs.empty())
4088 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4089 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4091 GEN_ERROR("Cannot make array constant with type: '" +
4092 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4094 int NumElements = ATy->getNumElements();
4095 if (NumElements != -1 && NumElements != 0)
4096 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4097 " arguments, but has size of " + itostr(NumElements) +"");
4098 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4099 delete (yyvsp[(1) - (3)].TypeVal);
4105 #line 1553 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4107 if (!UpRefs.empty())
4108 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4109 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4111 GEN_ERROR("Cannot make array constant with type: '" +
4112 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4114 int NumElements = ATy->getNumElements();
4115 const Type *ETy = ATy->getElementType();
4116 char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true);
4117 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal)))
4118 GEN_ERROR("Can't build string constant of size " +
4119 itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) +
4120 " when array has size " + itostr(NumElements) + "");
4121 std::vector<Constant*> Vals;
4122 if (ETy == Type::Int8Ty) {
4123 for (unsigned char *C = (unsigned char *)(yyvsp[(3) - (3)].StrVal);
4124 C != (unsigned char*)EndStr; ++C)
4125 Vals.push_back(ConstantInt::get(ETy, *C));
4127 free((yyvsp[(3) - (3)].StrVal));
4128 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4130 free((yyvsp[(3) - (3)].StrVal));
4131 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4132 delete (yyvsp[(1) - (3)].TypeVal);
4138 #line 1582 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4139 { // Nonempty unsized arr
4140 if (!UpRefs.empty())
4141 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4142 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4144 GEN_ERROR("Cannot make packed constant with type: '" +
4145 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4146 const Type *ETy = PTy->getElementType();
4147 int NumElements = PTy->getNumElements();
4149 // Verify that we have the correct size...
4150 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4151 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4152 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4153 itostr(NumElements) + "");
4155 // Verify all elements are correct type!
4156 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4157 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4158 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4159 ETy->getDescription() +"' as required!\nIt is of type '"+
4160 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4163 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4164 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4170 #line 1610 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4172 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4174 GEN_ERROR("Cannot make struct constant with type: '" +
4175 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4177 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4178 GEN_ERROR("Illegal number of initializers for structure type");
4180 // Check to ensure that constants are compatible with the type initializer!
4181 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4182 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4183 GEN_ERROR("Expected type '" +
4184 STy->getElementType(i)->getDescription() +
4185 "' for element #" + utostr(i) +
4186 " of structure initializer");
4188 // Check to ensure that Type is not packed
4189 if (STy->isPacked())
4190 GEN_ERROR("Unpacked Initializer to vector type '" +
4191 STy->getDescription() + "'");
4193 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4194 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4200 #line 1636 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4202 if (!UpRefs.empty())
4203 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4204 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4206 GEN_ERROR("Cannot make struct constant with type: '" +
4207 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4209 if (STy->getNumContainedTypes() != 0)
4210 GEN_ERROR("Illegal number of initializers for structure type");
4212 // Check to ensure that Type is not packed
4213 if (STy->isPacked())
4214 GEN_ERROR("Unpacked Initializer to vector type '" +
4215 STy->getDescription() + "'");
4217 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4218 delete (yyvsp[(1) - (3)].TypeVal);
4224 #line 1656 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4226 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4228 GEN_ERROR("Cannot make struct constant with type: '" +
4229 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4231 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4232 GEN_ERROR("Illegal number of initializers for structure type");
4234 // Check to ensure that constants are compatible with the type initializer!
4235 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4236 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4237 GEN_ERROR("Expected type '" +
4238 STy->getElementType(i)->getDescription() +
4239 "' for element #" + utostr(i) +
4240 " of structure initializer");
4242 // Check to ensure that Type is packed
4243 if (!STy->isPacked())
4244 GEN_ERROR("Vector initializer to non-vector type '" +
4245 STy->getDescription() + "'");
4247 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4248 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4254 #line 1682 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4256 if (!UpRefs.empty())
4257 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4258 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4260 GEN_ERROR("Cannot make struct constant with type: '" +
4261 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4263 if (STy->getNumContainedTypes() != 0)
4264 GEN_ERROR("Illegal number of initializers for structure type");
4266 // Check to ensure that Type is packed
4267 if (!STy->isPacked())
4268 GEN_ERROR("Vector initializer to non-vector type '" +
4269 STy->getDescription() + "'");
4271 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4272 delete (yyvsp[(1) - (5)].TypeVal);
4278 #line 1702 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4280 if (!UpRefs.empty())
4281 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4282 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4284 GEN_ERROR("Cannot make null pointer constant with type: '" +
4285 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4287 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4288 delete (yyvsp[(1) - (2)].TypeVal);
4294 #line 1714 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4296 if (!UpRefs.empty())
4297 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4298 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4299 delete (yyvsp[(1) - (2)].TypeVal);
4305 #line 1721 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4307 if (!UpRefs.empty())
4308 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4309 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4311 GEN_ERROR("Global const reference must be a pointer type");
4313 // ConstExprs can exist in the body of a function, thus creating
4314 // GlobalValues whenever they refer to a variable. Because we are in
4315 // the context of a function, getExistingVal will search the functions
4316 // symbol table instead of the module symbol table for the global symbol,
4317 // which throws things all off. To get around this, we just tell
4318 // getExistingVal that we are at global scope here.
4320 Function *SavedCurFn = CurFun.CurrentFunction;
4321 CurFun.CurrentFunction = 0;
4323 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4326 CurFun.CurrentFunction = SavedCurFn;
4328 // If this is an initializer for a constant pointer, which is referencing a
4329 // (currently) undefined variable, create a stub now that shall be replaced
4330 // in the future with the right type of variable.
4333 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4334 const PointerType *PT = cast<PointerType>(Ty);
4336 // First check to see if the forward references value is already created!
4337 PerModuleInfo::GlobalRefsType::iterator I =
4338 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4340 if (I != CurModule.GlobalRefs.end()) {
4341 V = I->second; // Placeholder already exists, use it...
4342 (yyvsp[(2) - (2)].ValIDVal).destroy();
4345 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4346 Name = (yyvsp[(2) - (2)].ValIDVal).Name;
4347 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4348 GEN_ERROR("Invalid reference to global");
4350 // Create the forward referenced global.
4352 if (const FunctionType *FTy =
4353 dyn_cast<FunctionType>(PT->getElementType())) {
4354 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4355 CurModule.CurrentModule);
4357 GV = new GlobalVariable(PT->getElementType(), false,
4358 GlobalValue::ExternalWeakLinkage, 0,
4359 Name, CurModule.CurrentModule);
4362 // Keep track of the fact that we have a forward ref to recycle it
4363 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4368 (yyval.ConstVal) = cast<GlobalValue>(V);
4369 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4375 #line 1787 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4377 if (!UpRefs.empty())
4378 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4379 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4380 GEN_ERROR("Mismatched types for constant expression: " +
4381 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4382 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4383 delete (yyvsp[(1) - (2)].TypeVal);
4389 #line 1797 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4391 if (!UpRefs.empty())
4392 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4393 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4394 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4395 GEN_ERROR("Cannot create a null initialized value of this type");
4396 (yyval.ConstVal) = Constant::getNullValue(Ty);
4397 delete (yyvsp[(1) - (2)].TypeVal);
4403 #line 1807 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4404 { // integral constants
4405 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4406 GEN_ERROR("Constant value doesn't fit in type");
4407 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4413 #line 1813 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4414 { // arbitrary precision integer constants
4415 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4416 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4417 GEN_ERROR("Constant value does not fit in type");
4419 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4420 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4421 delete (yyvsp[(2) - (2)].APIntVal);
4427 #line 1823 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4428 { // integral constants
4429 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4430 GEN_ERROR("Constant value doesn't fit in type");
4431 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4437 #line 1829 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4438 { // arbitrary precision integer constants
4439 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4440 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4441 GEN_ERROR("Constant value does not fit in type");
4443 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4444 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4445 delete (yyvsp[(2) - (2)].APIntVal);
4451 #line 1839 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4452 { // Boolean constants
4453 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4454 (yyval.ConstVal) = ConstantInt::getTrue();
4460 #line 1844 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4461 { // Boolean constants
4462 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4463 (yyval.ConstVal) = ConstantInt::getFalse();
4469 #line 1849 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4470 { // Float & Double constants
4471 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)))
4472 GEN_ERROR("Floating point constant invalid for type");
4473 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal));
4479 #line 1857 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4481 if (!UpRefs.empty())
4482 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4483 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4484 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4485 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4486 GEN_ERROR("invalid cast opcode for cast from '" +
4487 Val->getType()->getDescription() + "' to '" +
4488 DestTy->getDescription() + "'");
4489 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4490 delete (yyvsp[(5) - (6)].TypeVal);
4495 #line 1869 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4497 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4498 GEN_ERROR("GetElementPtr requires a pointer operand");
4501 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), &(*(yyvsp[(4) - (5)].ValueList))[0], (yyvsp[(4) - (5)].ValueList)->size(),
4504 GEN_ERROR("Index list invalid for constant getelementptr");
4506 SmallVector<Constant*, 8> IdxVec;
4507 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4508 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4509 IdxVec.push_back(C);
4511 GEN_ERROR("Indices to constant getelementptr must be constants");
4513 delete (yyvsp[(4) - (5)].ValueList);
4515 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4521 #line 1891 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4523 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4524 GEN_ERROR("Select condition must be of boolean type");
4525 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4526 GEN_ERROR("Select operand types must match");
4527 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4533 #line 1899 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4535 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4536 GEN_ERROR("Binary operator types must match");
4538 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4543 #line 1905 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4545 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4546 GEN_ERROR("Logical operator types must match");
4547 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4548 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4549 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4550 GEN_ERROR("Logical operator requires integral operands");
4552 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4558 #line 1916 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4560 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4561 GEN_ERROR("icmp operand types must match");
4562 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4567 #line 1921 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4569 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4570 GEN_ERROR("fcmp operand types must match");
4571 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4576 #line 1926 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4578 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4579 GEN_ERROR("Invalid extractelement operands");
4580 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4586 #line 1932 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4588 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4589 GEN_ERROR("Invalid insertelement operands");
4590 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4596 #line 1938 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4598 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4599 GEN_ERROR("Invalid shufflevector operands");
4600 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4606 #line 1947 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4608 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4614 #line 1951 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4616 (yyval.ConstVector) = new std::vector<Constant*>();
4617 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4623 #line 1959 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4624 { (yyval.BoolVal) = false; ;}
4628 #line 1959 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4629 { (yyval.BoolVal) = true; ;}
4633 #line 1962 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4634 { (yyval.BoolVal) = true; ;}
4638 #line 1962 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4639 { (yyval.BoolVal) = false; ;}
4643 #line 1965 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4645 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4646 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4647 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4649 GEN_ERROR("Aliases can be created only to global values");
4651 (yyval.ConstVal) = Aliasee;
4653 delete (yyvsp[(1) - (2)].TypeVal);
4658 #line 1976 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4660 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4661 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4662 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4663 GEN_ERROR("invalid cast opcode for cast from '" +
4664 Val->getType()->getDescription() + "' to '" +
4665 DestTy->getDescription() + "'");
4667 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4669 delete (yyvsp[(5) - (6)].TypeVal);
4674 #line 1997 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4676 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4677 CurModule.ModuleDone();
4683 #line 2002 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4685 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4686 CurModule.ModuleDone();
4692 #line 2015 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4693 { CurFun.isDeclare = false; ;}
4697 #line 2015 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4699 CurFun.FunctionDone();
4705 #line 2019 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4706 { CurFun.isDeclare = true; ;}
4710 #line 2019 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4717 #line 2022 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4724 #line 2025 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4726 if (!UpRefs.empty())
4727 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4728 // Eagerly resolve types. This is not an optimization, this is a
4729 // requirement that is due to the fact that we could have this:
4731 // %list = type { %list * }
4732 // %list = type { %list * } ; repeated type decl
4734 // If types are not resolved eagerly, then the two types will not be
4735 // determined to be the same type!
4737 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4739 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4741 // If this is a named type that is not a redefinition, add it to the slot
4743 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4746 delete (yyvsp[(3) - (3)].TypeVal);
4752 #line 2049 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4754 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4756 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4758 // If this is a named type that is not a redefinition, add it to the slot
4760 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4767 #line 2060 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4769 /* "Externally Visible" Linkage */
4770 if ((yyvsp[(5) - (5)].ConstVal) == 0)
4771 GEN_ERROR("Global value initializer is not a constant");
4772 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), GlobalValue::ExternalLinkage,
4773 (yyvsp[(2) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal), (yyvsp[(3) - (5)].BoolVal));
4779 #line 2067 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4786 #line 2071 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4788 if ((yyvsp[(6) - (6)].ConstVal) == 0)
4789 GEN_ERROR("Global value initializer is not a constant");
4790 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), (yyvsp[(6) - (6)].ConstVal)->getType(), (yyvsp[(6) - (6)].ConstVal), (yyvsp[(4) - (6)].BoolVal));
4796 #line 2076 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4803 #line 2080 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4805 if (!UpRefs.empty())
4806 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription());
4807 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), *(yyvsp[(6) - (6)].TypeVal), 0, (yyvsp[(4) - (6)].BoolVal));
4809 delete (yyvsp[(6) - (6)].TypeVal);
4814 #line 2086 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4822 #line 2090 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4824 std::string Name((yyvsp[(1) - (5)].StrVal));
4826 GEN_ERROR("Alias name cannot be empty");
4828 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
4830 GEN_ERROR(std::string("Invalid aliasee for alias: ") + (yyvsp[(1) - (5)].StrVal));
4832 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
4833 CurModule.CurrentModule);
4834 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
4835 InsertValue(GA, CurModule.Values);
4841 #line 2105 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4848 #line 2108 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4855 #line 2114 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4857 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4858 char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true);
4859 std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr);
4860 free((yyvsp[(1) - (1)].StrVal));
4862 if (AsmSoFar.empty())
4863 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4865 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4871 #line 2127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4873 CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal));
4874 free((yyvsp[(3) - (3)].StrVal));
4879 #line 2131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4881 CurModule.CurrentModule->setDataLayout((yyvsp[(3) - (3)].StrVal));
4882 free((yyvsp[(3) - (3)].StrVal));
4887 #line 2138 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4889 CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal));
4890 free((yyvsp[(3) - (3)].StrVal));
4896 #line 2143 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4898 CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal));
4899 free((yyvsp[(1) - (1)].StrVal));
4905 #line 2148 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4912 #line 2157 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4914 if (!UpRefs.empty())
4915 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
4916 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
4917 GEN_ERROR("void typed arguments are invalid");
4918 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
4919 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
4920 (yyvsp[(1) - (5)].ArgList)->push_back(E);
4926 #line 2167 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4928 if (!UpRefs.empty())
4929 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4930 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
4931 GEN_ERROR("void typed arguments are invalid");
4932 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
4933 (yyval.ArgList) = new ArgListType;
4934 (yyval.ArgList)->push_back(E);
4940 #line 2178 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4942 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
4948 #line 2182 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4950 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
4951 struct ArgListEntry E;
4952 E.Ty = new PATypeHolder(Type::VoidTy);
4954 E.Attrs = ParamAttr::None;
4955 (yyval.ArgList)->push_back(E);
4961 #line 2191 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4963 (yyval.ArgList) = new ArgListType;
4964 struct ArgListEntry E;
4965 E.Ty = new PATypeHolder(Type::VoidTy);
4967 E.Attrs = ParamAttr::None;
4968 (yyval.ArgList)->push_back(E);
4974 #line 2200 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4976 (yyval.ArgList) = 0;
4982 #line 2206 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4984 UnEscapeLexed((yyvsp[(3) - (9)].StrVal));
4985 std::string FunctionName((yyvsp[(3) - (9)].StrVal));
4986 free((yyvsp[(3) - (9)].StrVal)); // Free strdup'd memory!
4988 // Check the function result for abstractness if this is a define. We should
4989 // have no abstract types at this point
4990 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (9)].TypeVal)))
4991 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (9)].TypeVal)->get()->getDescription());
4993 std::vector<const Type*> ParamTypeList;
4994 ParamAttrsVector Attrs;
4995 if ((yyvsp[(7) - (9)].ParamAttrs) != ParamAttr::None) {
4996 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(7) - (9)].ParamAttrs);
4997 Attrs.push_back(PAWI);
4999 if ((yyvsp[(5) - (9)].ArgList)) { // If there are arguments...
5001 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin(); I != (yyvsp[(5) - (9)].ArgList)->end(); ++I, ++index) {
5002 const Type* Ty = I->Ty->get();
5003 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5004 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5005 ParamTypeList.push_back(Ty);
5006 if (Ty != Type::VoidTy)
5007 if (I->Attrs != ParamAttr::None) {
5008 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5009 Attrs.push_back(PAWI);
5014 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5015 if (isVarArg) ParamTypeList.pop_back();
5017 ParamAttrsList *PAL = 0;
5019 PAL = ParamAttrsList::get(Attrs);
5021 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (9)].TypeVal), ParamTypeList, isVarArg, PAL);
5022 const PointerType *PFT = PointerType::get(FT);
5023 delete (yyvsp[(2) - (9)].TypeVal);
5026 if (!FunctionName.empty()) {
5027 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5029 ID = ValID::createGlobalID(CurModule.Values.size());
5033 // See if this function was forward referenced. If so, recycle the object.
5034 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5035 // Move the function to the end of the list, from whereever it was
5036 // previously inserted.
5037 Fn = cast<Function>(FWRef);
5038 CurModule.CurrentModule->getFunctionList().remove(Fn);
5039 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5040 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5041 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5042 if (Fn->getFunctionType() != FT) {
5043 // The existing function doesn't have the same type. This is an overload
5045 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5046 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5047 // Neither the existing or the current function is a declaration and they
5048 // have the same name and same type. Clearly this is a redefinition.
5049 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5050 } if (Fn->isDeclaration()) {
5051 // Make sure to strip off any argument names so we can't get conflicts.
5052 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5056 } else { // Not already defined?
5057 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5058 CurModule.CurrentModule);
5060 InsertValue(Fn, CurModule.Values);
5063 CurFun.FunctionStart(Fn);
5065 if (CurFun.isDeclare) {
5066 // If we have declaration, always overwrite linkage. This will allow us to
5067 // correctly handle cases, when pointer to function is passed as argument to
5068 // another function.
5069 Fn->setLinkage(CurFun.Linkage);
5070 Fn->setVisibility(CurFun.Visibility);
5072 Fn->setCallingConv((yyvsp[(1) - (9)].UIntVal));
5073 Fn->setAlignment((yyvsp[(9) - (9)].UIntVal));
5074 if ((yyvsp[(8) - (9)].StrVal)) {
5075 Fn->setSection((yyvsp[(8) - (9)].StrVal));
5076 free((yyvsp[(8) - (9)].StrVal));
5079 // Add all of the arguments we parsed to the function...
5080 if ((yyvsp[(5) - (9)].ArgList)) { // Is null if empty...
5081 if (isVarArg) { // Nuke the last entry
5082 assert((yyvsp[(5) - (9)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (9)].ArgList)->back().Name == 0 &&
5083 "Not a varargs marker!");
5084 delete (yyvsp[(5) - (9)].ArgList)->back().Ty;
5085 (yyvsp[(5) - (9)].ArgList)->pop_back(); // Delete the last entry
5087 Function::arg_iterator ArgIt = Fn->arg_begin();
5088 Function::arg_iterator ArgEnd = Fn->arg_end();
5090 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin();
5091 I != (yyvsp[(5) - (9)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5092 delete I->Ty; // Delete the typeholder...
5093 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5099 delete (yyvsp[(5) - (9)].ArgList); // We're now done with the argument list
5106 #line 2329 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5108 (yyval.FunctionVal) = CurFun.CurrentFunction;
5110 // Make sure that we keep track of the linkage type even if there was a
5111 // previous "declare".
5112 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5113 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5118 #line 2340 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5120 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5126 #line 2345 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5128 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5129 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5130 (yyval.FunctionVal) = CurFun.CurrentFunction;
5131 CurFun.FunctionDone();
5137 #line 2357 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5139 (yyval.BoolVal) = false;
5145 #line 2361 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5147 (yyval.BoolVal) = true;
5153 #line 2366 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5154 { // A reference to a direct constant
5155 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5161 #line 2370 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5163 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5169 #line 2374 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5170 { // Perhaps it's an FP constant?
5171 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5177 #line 2378 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5179 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5185 #line 2382 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5187 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5193 #line 2386 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5195 (yyval.ValIDVal) = ValID::createNull();
5201 #line 2390 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5203 (yyval.ValIDVal) = ValID::createUndef();
5209 #line 2394 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5210 { // A vector zero constant.
5211 (yyval.ValIDVal) = ValID::createZeroInit();
5217 #line 2398 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5218 { // Nonempty unsized packed vector
5219 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5220 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5222 VectorType* pt = VectorType::get(ETy, NumElements);
5223 PATypeHolder* PTy = new PATypeHolder(
5231 // Verify all elements are correct type!
5232 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5233 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5234 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5235 ETy->getDescription() +"' as required!\nIt is of type '" +
5236 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5239 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5240 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5246 #line 2423 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5248 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5254 #line 2427 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5256 char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true);
5257 std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End);
5258 End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true);
5259 std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End);
5260 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal));
5261 free((yyvsp[(3) - (5)].StrVal));
5262 free((yyvsp[(5) - (5)].StrVal));
5268 #line 2441 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5269 { // Is it an integer reference...?
5270 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5276 #line 2445 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5278 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5284 #line 2449 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5285 { // Is it a named reference...?
5286 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[(1) - (1)].StrVal));
5292 #line 2453 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5293 { // Is it a named reference...?
5294 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[(1) - (1)].StrVal));
5300 #line 2465 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5302 if (!UpRefs.empty())
5303 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5304 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5305 delete (yyvsp[(1) - (2)].TypeVal);
5311 #line 2474 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5313 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5319 #line 2478 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5320 { // Do not allow functions with 0 basic blocks
5321 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5327 #line 2487 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5329 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5331 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5332 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5333 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5339 #line 2496 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5341 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5342 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5343 if (CI2->getParent() == 0)
5344 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5345 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5346 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5352 #line 2505 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5353 { // Empty space between instruction lists
5354 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5360 #line 2509 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5361 { // Labelled (named) basic block
5362 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[(1) - (1)].StrVal)));
5368 #line 2514 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5369 { // Return with a result...
5370 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5376 #line 2518 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5377 { // Return with no result...
5378 (yyval.TermInstVal) = new ReturnInst();
5384 #line 2522 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5385 { // Unconditional Branch...
5386 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5388 (yyval.TermInstVal) = new BranchInst(tmpBB);
5393 #line 2527 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5395 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5396 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5398 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5400 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5402 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5407 #line 2537 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5409 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5411 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5413 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5414 (yyval.TermInstVal) = S;
5416 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5417 E = (yyvsp[(8) - (9)].JumpTable)->end();
5418 for (; I != E; ++I) {
5419 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5420 S->addCase(CI, I->second);
5422 GEN_ERROR("Switch case is constant, but not a simple integer");
5424 delete (yyvsp[(8) - (9)].JumpTable);
5430 #line 2556 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5432 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5434 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5436 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5437 (yyval.TermInstVal) = S;
5443 #line 2566 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5446 // Handle the short syntax
5447 const PointerType *PFTy = 0;
5448 const FunctionType *Ty = 0;
5449 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5450 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5451 // Pull out the types of all of the arguments...
5452 std::vector<const Type*> ParamTypes;
5453 ParamAttrsVector Attrs;
5454 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5455 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = 8;
5456 Attrs.push_back(PAWI);
5458 ValueRefList::iterator I = (yyvsp[(6) - (14)].ValueRefList)->begin(), E = (yyvsp[(6) - (14)].ValueRefList)->end();
5460 for (; I != E; ++I, ++index) {
5461 const Type *Ty = I->Val->getType();
5462 if (Ty == Type::VoidTy)
5463 GEN_ERROR("Short call syntax cannot be used with varargs");
5464 ParamTypes.push_back(Ty);
5465 if (I->Attrs != ParamAttr::None) {
5466 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5467 Attrs.push_back(PAWI);
5471 ParamAttrsList *PAL = 0;
5473 PAL = ParamAttrsList::get(Attrs);
5474 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false, PAL);
5475 PFTy = PointerType::get(Ty);
5478 delete (yyvsp[(3) - (14)].TypeVal);
5480 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5482 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5484 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5487 // Check the arguments
5489 if ((yyvsp[(6) - (14)].ValueRefList)->empty()) { // Has no arguments?
5490 // Make sure no arguments is a good thing!
5491 if (Ty->getNumParams() != 0)
5492 GEN_ERROR("No arguments passed to a function that "
5493 "expects arguments");
5494 } else { // Has arguments?
5495 // Loop through FunctionType's arguments and ensure they are specified
5497 FunctionType::param_iterator I = Ty->param_begin();
5498 FunctionType::param_iterator E = Ty->param_end();
5499 ValueRefList::iterator ArgI = (yyvsp[(6) - (14)].ValueRefList)->begin(), ArgE = (yyvsp[(6) - (14)].ValueRefList)->end();
5501 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5502 if (ArgI->Val->getType() != *I)
5503 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5504 (*I)->getDescription() + "'");
5505 Args.push_back(ArgI->Val);
5508 if (Ty->isVarArg()) {
5510 for (; ArgI != ArgE; ++ArgI)
5511 Args.push_back(ArgI->Val); // push the remaining varargs
5512 } else if (I != E || ArgI != ArgE)
5513 GEN_ERROR("Invalid number of parameters detected");
5516 // Create the InvokeInst
5517 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5518 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5519 (yyval.TermInstVal) = II;
5520 delete (yyvsp[(6) - (14)].ValueRefList);
5526 #line 2645 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5528 (yyval.TermInstVal) = new UnwindInst();
5534 #line 2649 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5536 (yyval.TermInstVal) = new UnreachableInst();
5542 #line 2656 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5544 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5545 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5548 GEN_ERROR("May only switch on a constant pool value");
5550 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5552 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5557 #line 2667 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5559 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5560 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5564 GEN_ERROR("May only switch on a constant pool value");
5566 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5568 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5573 #line 2680 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5575 // Is this definition named?? if so, assign the name...
5576 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5578 InsertValue((yyvsp[(2) - (2)].InstVal));
5579 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5585 #line 2690 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5586 { // Used for PHI nodes
5587 if (!UpRefs.empty())
5588 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5589 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5590 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5592 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5594 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5595 delete (yyvsp[(1) - (6)].TypeVal);
5600 #line 2701 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5602 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5603 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5605 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5607 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5612 #line 2711 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5614 if (!UpRefs.empty())
5615 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5616 // Used for call and invoke instructions
5617 (yyval.ValueRefList) = new ValueRefList();
5618 ValueRefListEntry E; E.Attrs = (yyvsp[(3) - (3)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (3)].TypeVal)->get(), (yyvsp[(2) - (3)].ValIDVal));
5619 (yyval.ValueRefList)->push_back(E);
5620 delete (yyvsp[(1) - (3)].TypeVal);
5625 #line 2720 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5627 if (!UpRefs.empty())
5628 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5629 (yyval.ValueRefList) = (yyvsp[(1) - (5)].ValueRefList);
5630 ValueRefListEntry E; E.Attrs = (yyvsp[(5) - (5)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (5)].TypeVal)->get(), (yyvsp[(4) - (5)].ValIDVal));
5631 (yyval.ValueRefList)->push_back(E);
5632 delete (yyvsp[(3) - (5)].TypeVal);
5638 #line 2729 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5639 { (yyval.ValueRefList) = new ValueRefList(); ;}
5643 #line 2732 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5644 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5648 #line 2733 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5650 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5651 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5657 #line 2740 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5659 (yyval.BoolVal) = true;
5665 #line 2744 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5667 (yyval.BoolVal) = false;
5673 #line 2749 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5675 if (!UpRefs.empty())
5676 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5677 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5678 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5680 "Arithmetic operator requires integer, FP, or packed operands");
5681 if (isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()) &&
5682 ((yyvsp[(1) - (5)].BinaryOpVal) == Instruction::URem ||
5683 (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::SRem ||
5684 (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::FRem))
5685 GEN_ERROR("Remainder not supported on vector types");
5686 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5688 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5690 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5691 if ((yyval.InstVal) == 0)
5692 GEN_ERROR("binary operator returned null");
5693 delete (yyvsp[(2) - (5)].TypeVal);
5698 #line 2770 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5700 if (!UpRefs.empty())
5701 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5702 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5703 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5704 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5705 GEN_ERROR("Logical operator requires integral operands");
5707 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5709 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5711 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5712 if ((yyval.InstVal) == 0)
5713 GEN_ERROR("binary operator returned null");
5714 delete (yyvsp[(2) - (5)].TypeVal);
5719 #line 2787 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5721 if (!UpRefs.empty())
5722 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5723 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5724 GEN_ERROR("Vector types not supported by icmp instruction");
5725 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5727 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5729 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
5730 if ((yyval.InstVal) == 0)
5731 GEN_ERROR("icmp operator returned null");
5732 delete (yyvsp[(3) - (6)].TypeVal);
5737 #line 2801 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5739 if (!UpRefs.empty())
5740 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5741 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5742 GEN_ERROR("Vector types not supported by fcmp instruction");
5743 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5745 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5747 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
5748 if ((yyval.InstVal) == 0)
5749 GEN_ERROR("fcmp operator returned null");
5750 delete (yyvsp[(3) - (6)].TypeVal);
5755 #line 2815 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5757 if (!UpRefs.empty())
5758 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5759 Value* Val = (yyvsp[(2) - (4)].ValueVal);
5760 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
5761 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
5762 GEN_ERROR("invalid cast opcode for cast from '" +
5763 Val->getType()->getDescription() + "' to '" +
5764 DestTy->getDescription() + "'");
5765 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
5766 delete (yyvsp[(4) - (4)].TypeVal);
5771 #line 2827 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5773 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
5774 GEN_ERROR("select condition must be boolean");
5775 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
5776 GEN_ERROR("select value types should match");
5777 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5783 #line 2835 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5785 if (!UpRefs.empty())
5786 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5787 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
5788 delete (yyvsp[(4) - (4)].TypeVal);
5794 #line 2842 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5796 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
5797 GEN_ERROR("Invalid extractelement operands");
5798 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
5804 #line 2848 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5806 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
5807 GEN_ERROR("Invalid insertelement operands");
5808 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5814 #line 2854 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5816 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
5817 GEN_ERROR("Invalid shufflevector operands");
5818 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
5824 #line 2860 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5826 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
5827 if (!Ty->isFirstClassType())
5828 GEN_ERROR("PHI node operands must be of first class type");
5829 (yyval.InstVal) = new PHINode(Ty);
5830 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
5831 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
5832 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
5833 GEN_ERROR("All elements of a PHI node must be of the same type");
5834 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
5835 (yyvsp[(2) - (2)].PHIList)->pop_front();
5837 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
5843 #line 2876 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5846 // Handle the short syntax
5847 const PointerType *PFTy = 0;
5848 const FunctionType *Ty = 0;
5849 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
5850 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5851 // Pull out the types of all of the arguments...
5852 std::vector<const Type*> ParamTypes;
5853 ParamAttrsVector Attrs;
5854 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
5855 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
5856 Attrs.push_back(PAWI);
5859 ValueRefList::iterator I = (yyvsp[(6) - (8)].ValueRefList)->begin(), E = (yyvsp[(6) - (8)].ValueRefList)->end();
5860 for (; I != E; ++I, ++index) {
5861 const Type *Ty = I->Val->getType();
5862 if (Ty == Type::VoidTy)
5863 GEN_ERROR("Short call syntax cannot be used with varargs");
5864 ParamTypes.push_back(Ty);
5865 if (I->Attrs != ParamAttr::None) {
5866 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5867 Attrs.push_back(PAWI);
5871 ParamAttrsList *PAL = 0;
5873 PAL = ParamAttrsList::get(Attrs);
5875 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false, PAL);
5876 PFTy = PointerType::get(Ty);
5879 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
5882 // Check for call to invalid intrinsic to avoid crashing later.
5883 if (Function *theF = dyn_cast<Function>(V)) {
5884 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5885 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5886 !theF->getIntrinsicID(true))
5887 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5888 theF->getName() + "'");
5891 // Check the arguments
5893 if ((yyvsp[(6) - (8)].ValueRefList)->empty()) { // Has no arguments?
5894 // Make sure no arguments is a good thing!
5895 if (Ty->getNumParams() != 0)
5896 GEN_ERROR("No arguments passed to a function that "
5897 "expects arguments");
5898 } else { // Has arguments?
5899 // Loop through FunctionType's arguments and ensure they are specified
5902 FunctionType::param_iterator I = Ty->param_begin();
5903 FunctionType::param_iterator E = Ty->param_end();
5904 ValueRefList::iterator ArgI = (yyvsp[(6) - (8)].ValueRefList)->begin(), ArgE = (yyvsp[(6) - (8)].ValueRefList)->end();
5906 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5907 if (ArgI->Val->getType() != *I)
5908 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5909 (*I)->getDescription() + "'");
5910 Args.push_back(ArgI->Val);
5912 if (Ty->isVarArg()) {
5914 for (; ArgI != ArgE; ++ArgI)
5915 Args.push_back(ArgI->Val); // push the remaining varargs
5916 } else if (I != E || ArgI != ArgE)
5917 GEN_ERROR("Invalid number of parameters detected");
5919 // Create the call node
5920 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5921 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
5922 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
5923 (yyval.InstVal) = CI;
5924 delete (yyvsp[(6) - (8)].ValueRefList);
5925 delete (yyvsp[(3) - (8)].TypeVal);
5931 #line 2960 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5933 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
5939 #line 2965 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5941 (yyval.BoolVal) = true;
5947 #line 2969 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5949 (yyval.BoolVal) = false;
5955 #line 2976 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5957 if (!UpRefs.empty())
5958 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
5959 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
5960 delete (yyvsp[(2) - (3)].TypeVal);
5966 #line 2983 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5968 if (!UpRefs.empty())
5969 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
5970 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
5972 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
5973 delete (yyvsp[(2) - (6)].TypeVal);
5978 #line 2991 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5980 if (!UpRefs.empty())
5981 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
5982 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
5983 delete (yyvsp[(2) - (3)].TypeVal);
5989 #line 2998 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5991 if (!UpRefs.empty())
5992 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
5993 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
5995 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
5996 delete (yyvsp[(2) - (6)].TypeVal);
6001 #line 3006 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6003 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6004 GEN_ERROR("Trying to free nonpointer type " +
6005 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6006 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6012 #line 3014 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6014 if (!UpRefs.empty())
6015 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6016 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6017 GEN_ERROR("Can't load from nonpointer type: " +
6018 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6019 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6020 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6021 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6022 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6024 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6025 delete (yyvsp[(3) - (5)].TypeVal);
6030 #line 3028 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6032 if (!UpRefs.empty())
6033 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6034 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6036 GEN_ERROR("Can't store to a nonpointer type: " +
6037 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6038 const Type *ElTy = PT->getElementType();
6039 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6040 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6041 "' into space of type '" + ElTy->getDescription() + "'");
6043 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6045 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6046 delete (yyvsp[(5) - (7)].TypeVal);
6051 #line 3045 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6053 if (!UpRefs.empty())
6054 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6055 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6056 GEN_ERROR("getelementptr insn requires pointer operand");
6058 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), &(*(yyvsp[(4) - (4)].ValueList))[0], (yyvsp[(4) - (4)].ValueList)->size(), true))
6059 GEN_ERROR("Invalid getelementptr indices for type '" +
6060 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6061 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6063 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[(4) - (4)].ValueList))[0], (yyvsp[(4) - (4)].ValueList)->size());
6064 delete (yyvsp[(2) - (4)].TypeVal);
6065 delete (yyvsp[(4) - (4)].ValueList);
6070 /* Line 1267 of yacc.c. */
6071 #line 6072 "llvmAsmParser.tab.c"
6074 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6078 YY_STACK_PRINT (yyss, yyssp);
6083 /* Now `shift' the result of the reduction. Determine what state
6084 that goes to, based on the state we popped back to and the rule
6085 number reduced by. */
6089 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6090 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6091 yystate = yytable[yystate];
6093 yystate = yydefgoto[yyn - YYNTOKENS];
6098 /*------------------------------------.
6099 | yyerrlab -- here on detecting error |
6100 `------------------------------------*/
6102 /* If not already recovering from an error, report this error. */
6106 #if ! YYERROR_VERBOSE
6107 yyerror (YY_("syntax error"));
6110 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6111 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6113 YYSIZE_T yyalloc = 2 * yysize;
6114 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6115 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6116 if (yymsg != yymsgbuf)
6117 YYSTACK_FREE (yymsg);
6118 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6120 yymsg_alloc = yyalloc;
6124 yymsg_alloc = sizeof yymsgbuf;
6128 if (0 < yysize && yysize <= yymsg_alloc)
6130 (void) yysyntax_error (yymsg, yystate, yychar);
6135 yyerror (YY_("syntax error"));
6137 goto yyexhaustedlab;
6145 if (yyerrstatus == 3)
6147 /* If just tried and failed to reuse look-ahead token after an
6148 error, discard it. */
6150 if (yychar <= YYEOF)
6152 /* Return failure if at end of input. */
6153 if (yychar == YYEOF)
6158 yydestruct ("Error: discarding",
6164 /* Else will try to reuse look-ahead token after shifting the error
6169 /*---------------------------------------------------.
6170 | yyerrorlab -- error raised explicitly by YYERROR. |
6171 `---------------------------------------------------*/
6174 /* Pacify compilers like GCC when the user code never invokes
6175 YYERROR and the label yyerrorlab therefore never appears in user
6177 if (/*CONSTCOND*/ 0)
6180 /* Do not reclaim the symbols of the rule which action triggered
6184 YY_STACK_PRINT (yyss, yyssp);
6189 /*-------------------------------------------------------------.
6190 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6191 `-------------------------------------------------------------*/
6193 yyerrstatus = 3; /* Each real token shifted decrements this. */
6197 yyn = yypact[yystate];
6198 if (yyn != YYPACT_NINF)
6201 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6209 /* Pop the current state because it cannot handle the error token. */
6214 yydestruct ("Error: popping",
6215 yystos[yystate], yyvsp);
6218 YY_STACK_PRINT (yyss, yyssp);
6227 /* Shift the error token. */
6228 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6234 /*-------------------------------------.
6235 | yyacceptlab -- YYACCEPT comes here. |
6236 `-------------------------------------*/
6241 /*-----------------------------------.
6242 | yyabortlab -- YYABORT comes here. |
6243 `-----------------------------------*/
6249 /*-------------------------------------------------.
6250 | yyexhaustedlab -- memory exhaustion comes here. |
6251 `-------------------------------------------------*/
6253 yyerror (YY_("memory exhausted"));
6259 if (yychar != YYEOF && yychar != YYEMPTY)
6260 yydestruct ("Cleanup: discarding lookahead",
6262 /* Do not reclaim the symbols of the rule which action triggered
6263 this YYABORT or YYACCEPT. */
6265 YY_STACK_PRINT (yyss, yyssp);
6266 while (yyssp != yyss)
6268 yydestruct ("Cleanup: popping",
6269 yystos[*yyssp], yyvsp);
6274 YYSTACK_FREE (yyss);
6277 if (yymsg != yymsgbuf)
6278 YYSTACK_FREE (yymsg);
6280 /* Make sure YYID is used. */
6281 return YYID (yyresult);
6285 #line 3062 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
6288 // common code from the two 'RunVMAsmParser' functions
6289 static Module* RunParser(Module * M) {
6291 llvmAsmlineno = 1; // Reset the current line number...
6292 CurModule.CurrentModule = M;
6297 // Check to make sure the parser succeeded
6300 delete ParserResult;
6304 // Emit an error if there are any unresolved types left.
6305 if (!CurModule.LateResolveTypes.empty()) {
6306 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6307 if (DID.Type == ValID::LocalName) {
6308 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6310 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6313 delete ParserResult;
6317 // Emit an error if there are any unresolved values left.
6318 if (!CurModule.LateResolveValues.empty()) {
6319 Value *V = CurModule.LateResolveValues.back();
6320 std::map<Value*, std::pair<ValID, int> >::iterator I =
6321 CurModule.PlaceHolderInfo.find(V);
6323 if (I != CurModule.PlaceHolderInfo.end()) {
6324 ValID &DID = I->second.first;
6325 if (DID.Type == ValID::LocalName) {
6326 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6328 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6331 delete ParserResult;
6336 // Check to make sure that parsing produced a result
6340 // Reset ParserResult variable while saving its value for the result.
6341 Module *Result = ParserResult;
6347 void llvm::GenerateError(const std::string &message, int LineNo) {
6348 if (LineNo == -1) LineNo = llvmAsmlineno;
6349 // TODO: column number in exception
6351 TheParseError->setError(CurFilename, message, LineNo);
6355 int yyerror(const char *ErrorMsg) {
6357 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6358 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6359 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6360 if (yychar != YYEMPTY && yychar != 0)
6361 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6363 GenerateError(errMsg);