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
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
138 X86_STDCALLCC_TOK = 319,
139 X86_FASTCALLCC_TOK = 320,
205 EXTRACTELEMENT = 386,
226 #define ESINT64VAL 258
227 #define EUINT64VAL 259
228 #define ESAPINTVAL 260
229 #define EUAPINTVAL 261
230 #define LOCALVAL_ID 262
231 #define GLOBALVAL_ID 263
239 #define PPC_FP128 271
243 #define GLOBALVAR 275
245 #define STRINGCONSTANT 277
246 #define ATSTRINGCONSTANT 278
247 #define PCTSTRINGCONSTANT 279
248 #define ZEROINITIALIZER 280
260 #define THREAD_LOCAL 292
262 #define DOTDOTDOT 294
268 #define APPENDING 300
269 #define DLLIMPORT 301
270 #define DLLEXPORT 302
271 #define EXTERN_WEAK 303
282 #define SIDEEFFECT 314
285 #define FASTCC_TOK 317
286 #define COLDCC_TOK 318
287 #define X86_STDCALLCC_TOK 319
288 #define X86_FASTCALLCC_TOK 320
289 #define DATALAYOUT 321
295 #define UNREACHABLE 327
338 #define GETELEMENTPTR 370
354 #define EXTRACTELEMENT 386
355 #define INSERTELEMENT 387
356 #define SHUFFLEVECTOR 388
371 #define PROTECTED 403
376 /* Copy the first part of user declarations. */
377 #line 14 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
379 #include "ParserInternals.h"
380 #include "llvm/CallingConv.h"
381 #include "llvm/InlineAsm.h"
382 #include "llvm/Instructions.h"
383 #include "llvm/Module.h"
384 #include "llvm/ValueSymbolTable.h"
385 #include "llvm/AutoUpgrade.h"
386 #include "llvm/Support/GetElementPtrTypeIterator.h"
387 #include "llvm/Support/CommandLine.h"
388 #include "llvm/ADT/SmallVector.h"
389 #include "llvm/ADT/STLExtras.h"
390 #include "llvm/Support/MathExtras.h"
391 #include "llvm/Support/Streams.h"
397 // The following is a gross hack. In order to rid the libAsmParser library of
398 // exceptions, we have to have a way of getting the yyparse function to go into
399 // an error situation. So, whenever we want an error to occur, the GenerateError
400 // function (see bottom of file) sets TriggerError. Then, at the end of each
401 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
402 // (a goto) to put YACC in error state. Furthermore, several calls to
403 // GenerateError are made from inside productions and they must simulate the
404 // previous exception behavior by exiting the production immediately. We have
405 // replaced these with the GEN_ERROR macro which calls GeneratError and then
406 // immediately invokes YYERROR. This would be so much cleaner if it was a
407 // recursive descent parser.
408 static bool TriggerError = false;
409 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
410 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
412 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
413 int yylex(); // declaration" of xxx warnings.
415 using namespace llvm;
417 static Module *ParserResult;
419 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
420 // relating to upreferences in the input stream.
422 //#define DEBUG_UPREFS 1
424 #define UR_OUT(X) cerr << X
429 #define YYERROR_VERBOSE 1
431 static GlobalVariable *CurGV;
434 // This contains info used when building the body of a function. It is
435 // destroyed when the function is completed.
437 typedef std::vector<Value *> ValueList; // Numbered defs
440 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
442 static struct PerModuleInfo {
443 Module *CurrentModule;
444 ValueList Values; // Module level numbered definitions
445 ValueList LateResolveValues;
446 std::vector<PATypeHolder> Types;
447 std::map<ValID, PATypeHolder> LateResolveTypes;
449 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
450 /// how they were referenced and on which line of the input they came from so
451 /// that we can resolve them later and print error messages as appropriate.
452 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
454 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
455 // references to global values. Global values may be referenced before they
456 // are defined, and if so, the temporary object that they represent is held
457 // here. This is used for forward references of GlobalValues.
459 typedef std::map<std::pair<const PointerType *,
460 ValID>, GlobalValue*> GlobalRefsType;
461 GlobalRefsType GlobalRefs;
464 // If we could not resolve some functions at function compilation time
465 // (calls to functions before they are defined), resolve them now... Types
466 // are resolved when the constant pool has been completely parsed.
468 ResolveDefinitions(LateResolveValues);
472 // Check to make sure that all global value forward references have been
475 if (!GlobalRefs.empty()) {
476 std::string UndefinedReferences = "Unresolved global references exist:\n";
478 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
480 UndefinedReferences += " " + I->first.first->getDescription() + " " +
481 I->first.second.getName() + "\n";
483 GenerateError(UndefinedReferences);
487 // Look for intrinsic functions and CallInst that need to be upgraded
488 for (Module::iterator FI = CurrentModule->begin(),
489 FE = CurrentModule->end(); FI != FE; )
490 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
492 Values.clear(); // Clear out function local definitions
497 // GetForwardRefForGlobal - Check to see if there is a forward reference
498 // for this global. If so, remove it from the GlobalRefs map and return it.
499 // If not, just return null.
500 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
501 // Check to see if there is a forward reference to this global variable...
502 // if there is, eliminate it and patch the reference to use the new def'n.
503 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
504 GlobalValue *Ret = 0;
505 if (I != GlobalRefs.end()) {
512 bool TypeIsUnresolved(PATypeHolder* PATy) {
513 // If it isn't abstract, its resolved
514 const Type* Ty = PATy->get();
515 if (!Ty->isAbstract())
517 // Traverse the type looking for abstract types. If it isn't abstract then
518 // we don't need to traverse that leg of the type.
519 std::vector<const Type*> WorkList, SeenList;
520 WorkList.push_back(Ty);
521 while (!WorkList.empty()) {
522 const Type* Ty = WorkList.back();
523 SeenList.push_back(Ty);
525 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
526 // Check to see if this is an unresolved type
527 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
528 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
529 for ( ; I != E; ++I) {
530 if (I->second.get() == OpTy)
533 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
534 const Type* TheTy = SeqTy->getElementType();
535 if (TheTy->isAbstract() && TheTy != Ty) {
536 std::vector<const Type*>::iterator I = SeenList.begin(),
542 WorkList.push_back(TheTy);
544 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
545 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
546 const Type* TheTy = StrTy->getElementType(i);
547 if (TheTy->isAbstract() && TheTy != Ty) {
548 std::vector<const Type*>::iterator I = SeenList.begin(),
554 WorkList.push_back(TheTy);
563 static struct PerFunctionInfo {
564 Function *CurrentFunction; // Pointer to current function being created
566 ValueList Values; // Keep track of #'d definitions
568 ValueList LateResolveValues;
569 bool isDeclare; // Is this function a forward declararation?
570 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
571 GlobalValue::VisibilityTypes Visibility;
573 /// BBForwardRefs - When we see forward references to basic blocks, keep
574 /// track of them here.
575 std::map<ValID, BasicBlock*> BBForwardRefs;
577 inline PerFunctionInfo() {
580 Linkage = GlobalValue::ExternalLinkage;
581 Visibility = GlobalValue::DefaultVisibility;
584 inline void FunctionStart(Function *M) {
589 void FunctionDone() {
590 // Any forward referenced blocks left?
591 if (!BBForwardRefs.empty()) {
592 GenerateError("Undefined reference to label " +
593 BBForwardRefs.begin()->second->getName());
597 // Resolve all forward references now.
598 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
600 Values.clear(); // Clear out function local definitions
601 BBForwardRefs.clear();
604 Linkage = GlobalValue::ExternalLinkage;
605 Visibility = GlobalValue::DefaultVisibility;
607 } CurFun; // Info for the current function...
609 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
612 //===----------------------------------------------------------------------===//
613 // Code to handle definitions of all the types
614 //===----------------------------------------------------------------------===//
616 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
617 // Things that have names or are void typed don't get slot numbers
618 if (V->hasName() || (V->getType() == Type::VoidTy))
621 // In the case of function values, we have to allow for the forward reference
622 // of basic blocks, which are included in the numbering. Consequently, we keep
623 // track of the next insertion location with NextValNum. When a BB gets
624 // inserted, it could change the size of the CurFun.Values vector.
625 if (&ValueTab == &CurFun.Values) {
626 if (ValueTab.size() <= CurFun.NextValNum)
627 ValueTab.resize(CurFun.NextValNum+1);
628 ValueTab[CurFun.NextValNum++] = V;
631 // For all other lists, its okay to just tack it on the back of the vector.
632 ValueTab.push_back(V);
635 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
637 case ValID::LocalID: // Is it a numbered definition?
638 // Module constants occupy the lowest numbered slots...
639 if (D.Num < CurModule.Types.size())
640 return CurModule.Types[D.Num];
642 case ValID::LocalName: // Is it a named definition?
643 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
644 D.destroy(); // Free old strdup'd memory...
649 GenerateError("Internal parser error: Invalid symbol type reference");
653 // If we reached here, we referenced either a symbol that we don't know about
654 // or an id number that hasn't been read yet. We may be referencing something
655 // forward, so just create an entry to be resolved later and get to it...
657 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
660 if (inFunctionScope()) {
661 if (D.Type == ValID::LocalName) {
662 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
665 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
670 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
671 if (I != CurModule.LateResolveTypes.end())
674 Type *Typ = OpaqueType::get();
675 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
679 // getExistingVal - Look up the value specified by the provided type and
680 // the provided ValID. If the value exists and has already been defined, return
681 // it. Otherwise return null.
683 static Value *getExistingVal(const Type *Ty, const ValID &D) {
684 if (isa<FunctionType>(Ty)) {
685 GenerateError("Functions are not values and "
686 "must be referenced as pointers");
691 case ValID::LocalID: { // Is it a numbered definition?
692 // Check that the number is within bounds.
693 if (D.Num >= CurFun.Values.size())
695 Value *Result = CurFun.Values[D.Num];
696 if (Ty != Result->getType()) {
697 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
698 Result->getType()->getDescription() + "' does not match "
699 "expected type, '" + Ty->getDescription() + "'");
704 case ValID::GlobalID: { // Is it a numbered definition?
705 if (D.Num >= CurModule.Values.size())
707 Value *Result = CurModule.Values[D.Num];
708 if (Ty != Result->getType()) {
709 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
710 Result->getType()->getDescription() + "' does not match "
711 "expected type, '" + Ty->getDescription() + "'");
717 case ValID::LocalName: { // Is it a named definition?
718 if (!inFunctionScope())
720 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
721 Value *N = SymTab.lookup(D.getName());
724 if (N->getType() != Ty)
727 D.destroy(); // Free old strdup'd memory...
730 case ValID::GlobalName: { // Is it a named definition?
731 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
732 Value *N = SymTab.lookup(D.getName());
735 if (N->getType() != Ty)
738 D.destroy(); // Free old strdup'd memory...
742 // Check to make sure that "Ty" is an integral type, and that our
743 // value will fit into the specified type...
744 case ValID::ConstSIntVal: // Is it a constant pool reference??
745 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
746 GenerateError("Signed integral constant '" +
747 itostr(D.ConstPool64) + "' is invalid for type '" +
748 Ty->getDescription() + "'");
751 return ConstantInt::get(Ty, D.ConstPool64, true);
753 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
754 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
755 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
756 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
757 "' is invalid or out of range");
759 } else { // This is really a signed reference. Transmogrify.
760 return ConstantInt::get(Ty, D.ConstPool64, true);
763 return ConstantInt::get(Ty, D.UConstPool64);
766 case ValID::ConstFPVal: // Is it a floating point const pool reference?
767 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
768 GenerateError("FP constant invalid for type");
771 // Lexer has no type info, so builds all float and double FP constants
772 // as double. Fix this here. Long double does not need this.
773 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
775 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
776 return ConstantFP::get(Ty, *D.ConstPoolFP);
778 case ValID::ConstNullVal: // Is it a null value?
779 if (!isa<PointerType>(Ty)) {
780 GenerateError("Cannot create a a non pointer null");
783 return ConstantPointerNull::get(cast<PointerType>(Ty));
785 case ValID::ConstUndefVal: // Is it an undef value?
786 return UndefValue::get(Ty);
788 case ValID::ConstZeroVal: // Is it a zero value?
789 return Constant::getNullValue(Ty);
791 case ValID::ConstantVal: // Fully resolved constant?
792 if (D.ConstantValue->getType() != Ty) {
793 GenerateError("Constant expression type different from required type");
796 return D.ConstantValue;
798 case ValID::InlineAsmVal: { // Inline asm expression
799 const PointerType *PTy = dyn_cast<PointerType>(Ty);
800 const FunctionType *FTy =
801 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
802 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
803 GenerateError("Invalid type for asm constraint string");
806 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
807 D.IAD->HasSideEffects);
808 D.destroy(); // Free InlineAsmDescriptor.
812 assert(0 && "Unhandled case!");
816 assert(0 && "Unhandled case!");
820 // getVal - This function is identical to getExistingVal, except that if a
821 // value is not already defined, it "improvises" by creating a placeholder var
822 // that looks and acts just like the requested variable. When the value is
823 // defined later, all uses of the placeholder variable are replaced with the
826 static Value *getVal(const Type *Ty, const ValID &ID) {
827 if (Ty == Type::LabelTy) {
828 GenerateError("Cannot use a basic block here");
832 // See if the value has already been defined.
833 Value *V = getExistingVal(Ty, ID);
835 if (TriggerError) return 0;
837 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
838 GenerateError("Invalid use of a composite type");
842 // If we reached here, we referenced either a symbol that we don't know about
843 // or an id number that hasn't been read yet. We may be referencing something
844 // forward, so just create an entry to be resolved later and get to it...
847 case ValID::GlobalName:
848 case ValID::GlobalID: {
849 const PointerType *PTy = dyn_cast<PointerType>(Ty);
851 GenerateError("Invalid type for reference to global" );
854 const Type* ElTy = PTy->getElementType();
855 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
856 V = new Function(FTy, GlobalValue::ExternalLinkage);
858 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
862 V = new Argument(Ty);
865 // Remember where this forward reference came from. FIXME, shouldn't we try
866 // to recycle these things??
867 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
870 if (inFunctionScope())
871 InsertValue(V, CurFun.LateResolveValues);
873 InsertValue(V, CurModule.LateResolveValues);
877 /// defineBBVal - This is a definition of a new basic block with the specified
878 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
879 static BasicBlock *defineBBVal(const ValID &ID) {
880 assert(inFunctionScope() && "Can't get basic block at global scope!");
884 // First, see if this was forward referenced
886 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
887 if (BBI != CurFun.BBForwardRefs.end()) {
889 // The forward declaration could have been inserted anywhere in the
890 // function: insert it into the correct place now.
891 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
892 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
894 // We're about to erase the entry, save the key so we can clean it up.
895 ValID Tmp = BBI->first;
897 // Erase the forward ref from the map as its no longer "forward"
898 CurFun.BBForwardRefs.erase(ID);
900 // The key has been removed from the map but so we don't want to leave
901 // strdup'd memory around so destroy it too.
904 // If its a numbered definition, bump the number and set the BB value.
905 if (ID.Type == ValID::LocalID) {
906 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
914 // We haven't seen this BB before and its first mention is a definition.
915 // Just create it and return it.
916 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
917 BB = new BasicBlock(Name, CurFun.CurrentFunction);
918 if (ID.Type == ValID::LocalID) {
919 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
923 ID.destroy(); // Free strdup'd memory
927 /// getBBVal - get an existing BB value or create a forward reference for it.
929 static BasicBlock *getBBVal(const ValID &ID) {
930 assert(inFunctionScope() && "Can't get basic block at global scope!");
934 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
935 if (BBI != CurFun.BBForwardRefs.end()) {
937 } if (ID.Type == ValID::LocalName) {
938 std::string Name = ID.getName();
939 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
941 if (N->getType()->getTypeID() == Type::LabelTyID)
942 BB = cast<BasicBlock>(N);
944 GenerateError("Reference to label '" + Name + "' is actually of type '"+
945 N->getType()->getDescription() + "'");
946 } else if (ID.Type == ValID::LocalID) {
947 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
948 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
949 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
951 GenerateError("Reference to label '%" + utostr(ID.Num) +
952 "' is actually of type '"+
953 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
956 GenerateError("Illegal label reference " + ID.getName());
960 // If its already been defined, return it now.
962 ID.destroy(); // Free strdup'd memory.
966 // Otherwise, this block has not been seen before, create it.
968 if (ID.Type == ValID::LocalName)
970 BB = new BasicBlock(Name, CurFun.CurrentFunction);
972 // Insert it in the forward refs map.
973 CurFun.BBForwardRefs[ID] = BB;
979 //===----------------------------------------------------------------------===//
980 // Code to handle forward references in instructions
981 //===----------------------------------------------------------------------===//
983 // This code handles the late binding needed with statements that reference
984 // values not defined yet... for example, a forward branch, or the PHI node for
987 // This keeps a table (CurFun.LateResolveValues) of all such forward references
988 // and back patchs after we are done.
991 // ResolveDefinitions - If we could not resolve some defs at parsing
992 // time (forward branches, phi functions for loops, etc...) resolve the
996 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
997 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
998 while (!LateResolvers.empty()) {
999 Value *V = LateResolvers.back();
1000 LateResolvers.pop_back();
1002 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1003 CurModule.PlaceHolderInfo.find(V);
1004 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1006 ValID &DID = PHI->second.first;
1008 Value *TheRealValue = getExistingVal(V->getType(), DID);
1012 V->replaceAllUsesWith(TheRealValue);
1014 CurModule.PlaceHolderInfo.erase(PHI);
1015 } else if (FutureLateResolvers) {
1016 // Functions have their unresolved items forwarded to the module late
1018 InsertValue(V, *FutureLateResolvers);
1020 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1021 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1022 "' of type '" + V->getType()->getDescription() + "'",
1023 PHI->second.second);
1026 GenerateError("Reference to an invalid definition: #" +
1027 itostr(DID.Num) + " of type '" +
1028 V->getType()->getDescription() + "'",
1029 PHI->second.second);
1034 LateResolvers.clear();
1037 // ResolveTypeTo - A brand new type was just declared. This means that (if
1038 // name is not null) things referencing Name can be resolved. Otherwise, things
1039 // refering to the number can be resolved. Do this now.
1041 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1044 D = ValID::createLocalName(*Name);
1046 D = ValID::createLocalID(CurModule.Types.size());
1048 std::map<ValID, PATypeHolder>::iterator I =
1049 CurModule.LateResolveTypes.find(D);
1050 if (I != CurModule.LateResolveTypes.end()) {
1051 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1052 CurModule.LateResolveTypes.erase(I);
1056 // setValueName - Set the specified value to the name given. The name may be
1057 // null potentially, in which case this is a noop. The string passed in is
1058 // assumed to be a malloc'd string buffer, and is free'd by this function.
1060 static void setValueName(Value *V, std::string *NameStr) {
1061 if (!NameStr) return;
1062 std::string Name(*NameStr); // Copy string
1063 delete NameStr; // Free old string
1065 if (V->getType() == Type::VoidTy) {
1066 GenerateError("Can't assign name '" + Name+"' to value with void type");
1070 assert(inFunctionScope() && "Must be in function scope!");
1071 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1072 if (ST.lookup(Name)) {
1073 GenerateError("Redefinition of value '" + Name + "' of type '" +
1074 V->getType()->getDescription() + "'");
1082 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1083 /// this is a declaration, otherwise it is a definition.
1084 static GlobalVariable *
1085 ParseGlobalVariable(std::string *NameStr,
1086 GlobalValue::LinkageTypes Linkage,
1087 GlobalValue::VisibilityTypes Visibility,
1088 bool isConstantGlobal, const Type *Ty,
1089 Constant *Initializer, bool IsThreadLocal) {
1090 if (isa<FunctionType>(Ty)) {
1091 GenerateError("Cannot declare global vars of function type");
1095 const PointerType *PTy = PointerType::get(Ty);
1099 Name = *NameStr; // Copy string
1100 delete NameStr; // Free old string
1103 // See if this global value was forward referenced. If so, recycle the
1106 if (!Name.empty()) {
1107 ID = ValID::createGlobalName(Name);
1109 ID = ValID::createGlobalID(CurModule.Values.size());
1112 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1113 // Move the global to the end of the list, from whereever it was
1114 // previously inserted.
1115 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1116 CurModule.CurrentModule->getGlobalList().remove(GV);
1117 CurModule.CurrentModule->getGlobalList().push_back(GV);
1118 GV->setInitializer(Initializer);
1119 GV->setLinkage(Linkage);
1120 GV->setVisibility(Visibility);
1121 GV->setConstant(isConstantGlobal);
1122 GV->setThreadLocal(IsThreadLocal);
1123 InsertValue(GV, CurModule.Values);
1127 // If this global has a name
1128 if (!Name.empty()) {
1129 // if the global we're parsing has an initializer (is a definition) and
1130 // has external linkage.
1131 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1132 // If there is already a global with external linkage with this name
1133 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1134 // If we allow this GVar to get created, it will be renamed in the
1135 // symbol table because it conflicts with an existing GVar. We can't
1136 // allow redefinition of GVars whose linking indicates that their name
1137 // must stay the same. Issue the error.
1138 GenerateError("Redefinition of global variable named '" + Name +
1139 "' of type '" + Ty->getDescription() + "'");
1144 // Otherwise there is no existing GV to use, create one now.
1145 GlobalVariable *GV =
1146 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1147 CurModule.CurrentModule, IsThreadLocal);
1148 GV->setVisibility(Visibility);
1149 InsertValue(GV, CurModule.Values);
1153 // setTypeName - Set the specified type to the name given. The name may be
1154 // null potentially, in which case this is a noop. The string passed in is
1155 // assumed to be a malloc'd string buffer, and is freed by this function.
1157 // This function returns true if the type has already been defined, but is
1158 // allowed to be redefined in the specified context. If the name is a new name
1159 // for the type plane, it is inserted and false is returned.
1160 static bool setTypeName(const Type *T, std::string *NameStr) {
1161 assert(!inFunctionScope() && "Can't give types function-local names!");
1162 if (NameStr == 0) return false;
1164 std::string Name(*NameStr); // Copy string
1165 delete NameStr; // Free old string
1167 // We don't allow assigning names to void type
1168 if (T == Type::VoidTy) {
1169 GenerateError("Can't assign name '" + Name + "' to the void type");
1173 // Set the type name, checking for conflicts as we do so.
1174 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1176 if (AlreadyExists) { // Inserting a name that is already defined???
1177 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1178 assert(Existing && "Conflict but no matching type?!");
1180 // There is only one case where this is allowed: when we are refining an
1181 // opaque type. In this case, Existing will be an opaque type.
1182 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1183 // We ARE replacing an opaque type!
1184 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1188 // Otherwise, this is an attempt to redefine a type. That's okay if
1189 // the redefinition is identical to the original. This will be so if
1190 // Existing and T point to the same Type object. In this one case we
1191 // allow the equivalent redefinition.
1192 if (Existing == T) return true; // Yes, it's equal.
1194 // Any other kind of (non-equivalent) redefinition is an error.
1195 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1196 T->getDescription() + "'");
1202 //===----------------------------------------------------------------------===//
1203 // Code for handling upreferences in type names...
1206 // TypeContains - Returns true if Ty directly contains E in it.
1208 static bool TypeContains(const Type *Ty, const Type *E) {
1209 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1210 E) != Ty->subtype_end();
1214 struct UpRefRecord {
1215 // NestingLevel - The number of nesting levels that need to be popped before
1216 // this type is resolved.
1217 unsigned NestingLevel;
1219 // LastContainedTy - This is the type at the current binding level for the
1220 // type. Every time we reduce the nesting level, this gets updated.
1221 const Type *LastContainedTy;
1223 // UpRefTy - This is the actual opaque type that the upreference is
1224 // represented with.
1225 OpaqueType *UpRefTy;
1227 UpRefRecord(unsigned NL, OpaqueType *URTy)
1228 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1232 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1233 static std::vector<UpRefRecord> UpRefs;
1235 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1236 /// called. It loops through the UpRefs vector, which is a list of the
1237 /// currently active types. For each type, if the up reference is contained in
1238 /// the newly completed type, we decrement the level count. When the level
1239 /// count reaches zero, the upreferenced type is the type that is passed in:
1240 /// thus we can complete the cycle.
1242 static PATypeHolder HandleUpRefs(const Type *ty) {
1243 // If Ty isn't abstract, or if there are no up-references in it, then there is
1244 // nothing to resolve here.
1245 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1247 PATypeHolder Ty(ty);
1248 UR_OUT("Type '" << Ty->getDescription() <<
1249 "' newly formed. Resolving upreferences.\n" <<
1250 UpRefs.size() << " upreferences active!\n");
1252 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1253 // to zero), we resolve them all together before we resolve them to Ty. At
1254 // the end of the loop, if there is anything to resolve to Ty, it will be in
1256 OpaqueType *TypeToResolve = 0;
1258 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1259 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1260 << UpRefs[i].second->getDescription() << ") = "
1261 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1262 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1263 // Decrement level of upreference
1264 unsigned Level = --UpRefs[i].NestingLevel;
1265 UpRefs[i].LastContainedTy = Ty;
1266 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1267 if (Level == 0) { // Upreference should be resolved!
1268 if (!TypeToResolve) {
1269 TypeToResolve = UpRefs[i].UpRefTy;
1271 UR_OUT(" * Resolving upreference for "
1272 << UpRefs[i].second->getDescription() << "\n";
1273 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1274 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1275 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1276 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1278 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1279 --i; // Do not skip the next element...
1284 if (TypeToResolve) {
1285 UR_OUT(" * Resolving upreference for "
1286 << UpRefs[i].second->getDescription() << "\n";
1287 std::string OldName = TypeToResolve->getDescription());
1288 TypeToResolve->refineAbstractTypeTo(Ty);
1294 //===----------------------------------------------------------------------===//
1295 // RunVMAsmParser - Define an interface to this parser
1296 //===----------------------------------------------------------------------===//
1298 static Module* RunParser(Module * M);
1300 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1302 Module *M = RunParser(new Module(LLLgetFilename()));
1309 /* Enabling traces. */
1314 /* Enabling verbose error messages. */
1315 #ifdef YYERROR_VERBOSE
1316 # undef YYERROR_VERBOSE
1317 # define YYERROR_VERBOSE 1
1319 # define YYERROR_VERBOSE 0
1322 /* Enabling the token table. */
1323 #ifndef YYTOKEN_TABLE
1324 # define YYTOKEN_TABLE 0
1327 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1328 typedef union YYSTYPE
1329 #line 945 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
1331 llvm::Module *ModuleVal;
1332 llvm::Function *FunctionVal;
1333 llvm::BasicBlock *BasicBlockVal;
1334 llvm::TerminatorInst *TermInstVal;
1335 llvm::Instruction *InstVal;
1336 llvm::Constant *ConstVal;
1338 const llvm::Type *PrimType;
1339 std::list<llvm::PATypeHolder> *TypeList;
1340 llvm::PATypeHolder *TypeVal;
1341 llvm::Value *ValueVal;
1342 std::vector<llvm::Value*> *ValueList;
1343 llvm::ArgListType *ArgList;
1344 llvm::TypeWithAttrs TypeWithAttrs;
1345 llvm::TypeWithAttrsList *TypeWithAttrsList;
1346 llvm::ParamList *ParamList;
1348 // Represent the RHS of PHI node
1349 std::list<std::pair<llvm::Value*,
1350 llvm::BasicBlock*> > *PHIList;
1351 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1352 std::vector<llvm::Constant*> *ConstVector;
1354 llvm::GlobalValue::LinkageTypes Linkage;
1355 llvm::GlobalValue::VisibilityTypes Visibility;
1356 uint16_t ParamAttrs;
1357 llvm::APInt *APIntVal;
1362 llvm::APFloat *FPVal;
1365 std::string *StrVal; // This memory must be deleted
1366 llvm::ValID ValIDVal;
1368 llvm::Instruction::BinaryOps BinaryOpVal;
1369 llvm::Instruction::TermOps TermOpVal;
1370 llvm::Instruction::MemoryOps MemOpVal;
1371 llvm::Instruction::CastOps CastOpVal;
1372 llvm::Instruction::OtherOps OtherOpVal;
1373 llvm::ICmpInst::Predicate IPredicate;
1374 llvm::FCmpInst::Predicate FPredicate;
1376 /* Line 193 of yacc.c. */
1377 #line 1378 "llvmAsmParser.tab.c"
1379 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1380 # define YYSTYPE_IS_DECLARED 1
1381 # define YYSTYPE_IS_TRIVIAL 1
1386 /* Copy the second part of user declarations. */
1389 /* Line 216 of yacc.c. */
1390 #line 1391 "llvmAsmParser.tab.c"
1397 typedef YYTYPE_UINT8 yytype_uint8;
1399 typedef unsigned char yytype_uint8;
1403 typedef YYTYPE_INT8 yytype_int8;
1404 #elif (defined __STDC__ || defined __C99__FUNC__ \
1405 || defined __cplusplus || defined _MSC_VER)
1406 typedef signed char yytype_int8;
1408 typedef short int yytype_int8;
1411 #ifdef YYTYPE_UINT16
1412 typedef YYTYPE_UINT16 yytype_uint16;
1414 typedef unsigned short int yytype_uint16;
1418 typedef YYTYPE_INT16 yytype_int16;
1420 typedef short int yytype_int16;
1424 # ifdef __SIZE_TYPE__
1425 # define YYSIZE_T __SIZE_TYPE__
1426 # elif defined size_t
1427 # define YYSIZE_T size_t
1428 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1429 || defined __cplusplus || defined _MSC_VER)
1430 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1431 # define YYSIZE_T size_t
1433 # define YYSIZE_T unsigned int
1437 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1440 # if defined YYENABLE_NLS && YYENABLE_NLS
1442 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1443 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1447 # define YY_(msgid) msgid
1451 /* Suppress unused-variable warnings by "using" E. */
1452 #if ! defined lint || defined __GNUC__
1453 # define YYUSE(e) ((void) (e))
1455 # define YYUSE(e) /* empty */
1458 /* Identity function, used to suppress warnings about constant conditions. */
1460 # define YYID(n) (n)
1462 #if (defined __STDC__ || defined __C99__FUNC__ \
1463 || defined __cplusplus || defined _MSC_VER)
1476 #if ! defined yyoverflow || YYERROR_VERBOSE
1478 /* The parser invokes alloca or malloc; define the necessary symbols. */
1480 # ifdef YYSTACK_USE_ALLOCA
1481 # if YYSTACK_USE_ALLOCA
1483 # define YYSTACK_ALLOC __builtin_alloca
1484 # elif defined __BUILTIN_VA_ARG_INCR
1485 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1487 # define YYSTACK_ALLOC __alloca
1488 # elif defined _MSC_VER
1489 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1490 # define alloca _alloca
1492 # define YYSTACK_ALLOC alloca
1493 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1494 || defined __cplusplus || defined _MSC_VER)
1495 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1497 # define _STDLIB_H 1
1504 # ifdef YYSTACK_ALLOC
1505 /* Pacify GCC's `empty if-body' warning. */
1506 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1507 # ifndef YYSTACK_ALLOC_MAXIMUM
1508 /* The OS might guarantee only one guard page at the bottom of the stack,
1509 and a page size can be as small as 4096 bytes. So we cannot safely
1510 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1511 to allow for a few compiler-allocated temporary stack slots. */
1512 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1515 # define YYSTACK_ALLOC YYMALLOC
1516 # define YYSTACK_FREE YYFREE
1517 # ifndef YYSTACK_ALLOC_MAXIMUM
1518 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1520 # if (defined __cplusplus && ! defined _STDLIB_H \
1521 && ! ((defined YYMALLOC || defined malloc) \
1522 && (defined YYFREE || defined free)))
1523 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1525 # define _STDLIB_H 1
1529 # define YYMALLOC malloc
1530 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1531 || defined __cplusplus || defined _MSC_VER)
1532 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1536 # define YYFREE free
1537 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1538 || defined __cplusplus || defined _MSC_VER)
1539 void free (void *); /* INFRINGES ON USER NAME SPACE */
1543 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1546 #if (! defined yyoverflow \
1547 && (! defined __cplusplus \
1548 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1550 /* A type that is properly aligned for any stack member. */
1557 /* The size of the maximum gap between one aligned stack and the next. */
1558 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1560 /* The size of an array large to enough to hold all stacks, each with
1562 # define YYSTACK_BYTES(N) \
1563 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1564 + YYSTACK_GAP_MAXIMUM)
1566 /* Copy COUNT objects from FROM to TO. The source and destination do
1569 # if defined __GNUC__ && 1 < __GNUC__
1570 # define YYCOPY(To, From, Count) \
1571 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1573 # define YYCOPY(To, From, Count) \
1577 for (yyi = 0; yyi < (Count); yyi++) \
1578 (To)[yyi] = (From)[yyi]; \
1584 /* Relocate STACK from its old location to the new one. The
1585 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1586 elements in the stack, and YYPTR gives the new location of the
1587 stack. Advance YYPTR to a properly aligned location for the next
1589 # define YYSTACK_RELOCATE(Stack) \
1592 YYSIZE_T yynewbytes; \
1593 YYCOPY (&yyptr->Stack, Stack, yysize); \
1594 Stack = &yyptr->Stack; \
1595 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1596 yyptr += yynewbytes / sizeof (*yyptr); \
1602 /* YYFINAL -- State number of the termination state. */
1604 /* YYLAST -- Last index in YYTABLE. */
1607 /* YYNTOKENS -- Number of terminals. */
1608 #define YYNTOKENS 163
1609 /* YYNNTS -- Number of nonterminals. */
1611 /* YYNRULES -- Number of rules. */
1612 #define YYNRULES 316
1613 /* YYNRULES -- Number of states. */
1614 #define YYNSTATES 611
1616 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1617 #define YYUNDEFTOK 2
1618 #define YYMAXUTOK 403
1620 #define YYTRANSLATE(YYX) \
1621 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1623 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1624 static const yytype_uint8 yytranslate[] =
1626 0, 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 153, 154, 151, 2, 150, 2, 2, 2, 2, 2,
1631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1632 158, 149, 159, 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, 155, 152, 157, 2, 2, 2, 2, 2, 162,
1636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1652 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1653 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1654 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1655 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1656 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1657 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1658 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1659 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1660 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1661 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1662 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1663 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1664 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1665 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1670 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1672 static const yytype_uint16 yyprhs[] =
1674 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1675 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1676 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1677 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1678 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1679 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1680 119, 121, 123, 125, 127, 129, 130, 133, 134, 136,
1681 138, 140, 141, 144, 146, 148, 150, 152, 154, 156,
1682 158, 160, 161, 163, 165, 167, 168, 170, 172, 173,
1683 175, 177, 179, 181, 182, 184, 186, 187, 189, 191,
1684 193, 195, 197, 200, 202, 204, 206, 208, 210, 212,
1685 214, 216, 218, 219, 222, 224, 226, 228, 230, 232,
1686 234, 235, 238, 239, 242, 243, 246, 247, 251, 254,
1687 255, 257, 258, 262, 264, 267, 269, 271, 273, 275,
1688 277, 279, 281, 283, 285, 288, 290, 293, 299, 305,
1689 311, 317, 321, 324, 330, 335, 338, 340, 342, 344,
1690 348, 350, 354, 356, 357, 359, 363, 368, 372, 376,
1691 381, 386, 390, 397, 403, 406, 409, 412, 415, 418,
1692 421, 424, 427, 430, 433, 436, 439, 446, 452, 461,
1693 468, 475, 483, 491, 498, 507, 516, 520, 522, 524,
1694 526, 528, 529, 532, 539, 541, 542, 544, 547, 548,
1695 552, 553, 557, 561, 565, 569, 570, 578, 579, 588,
1696 589, 598, 604, 607, 611, 613, 617, 621, 625, 629,
1697 631, 632, 638, 642, 644, 648, 650, 651, 662, 664,
1698 666, 671, 673, 675, 678, 682, 683, 685, 687, 689,
1699 691, 693, 695, 697, 699, 701, 705, 707, 713, 715,
1700 717, 719, 721, 723, 725, 728, 731, 734, 738, 741,
1701 742, 744, 747, 750, 754, 764, 774, 783, 798, 800,
1702 802, 809, 815, 818, 825, 833, 838, 843, 850, 857,
1703 858, 859, 863, 866, 868, 874, 880, 887, 894, 899,
1704 906, 911, 916, 923, 930, 933, 942, 944, 946, 947,
1705 951, 958, 962, 969, 972, 978, 986
1708 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1709 static const yytype_int16 yyrhs[] =
1711 208, 0, -1, 73, -1, 74, -1, 75, -1, 76,
1712 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81,
1713 -1, 85, -1, 86, -1, 87, -1, 82, -1, 83,
1714 -1, 84, -1, 116, -1, 117, -1, 118, -1, 119,
1715 -1, 120, -1, 121, -1, 122, -1, 123, -1, 124,
1716 -1, 125, -1, 126, -1, 127, -1, 90, -1, 91,
1717 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1718 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1719 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1720 -1, 107, -1, 108, -1, 109, -1, 96, -1, 97,
1721 -1, 98, -1, 99, -1, 26, -1, 27, -1, 11,
1722 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1723 -1, 19, -1, 22, -1, 24, -1, 171, -1, -1,
1724 171, 149, -1, -1, 20, -1, 23, -1, 176, -1,
1725 -1, 174, 149, -1, 42, -1, 44, -1, 43, -1,
1726 45, -1, 47, -1, 46, -1, 48, -1, 50, -1,
1727 -1, 146, -1, 147, -1, 148, -1, -1, 46, -1,
1728 48, -1, -1, 42, -1, 43, -1, 44, -1, 47,
1729 -1, -1, 44, -1, 42, -1, -1, 61, -1, 62,
1730 -1, 63, -1, 64, -1, 65, -1, 60, 4, -1,
1731 135, -1, 117, -1, 134, -1, 118, -1, 137, -1,
1732 138, -1, 140, -1, 141, -1, 142, -1, -1, 185,
1733 184, -1, 136, -1, 139, -1, 135, -1, 134, -1,
1734 143, -1, 144, -1, -1, 187, 186, -1, -1, 145,
1735 22, -1, -1, 53, 4, -1, -1, 150, 53, 4,
1736 -1, 34, 22, -1, -1, 191, -1, -1, 150, 194,
1737 193, -1, 191, -1, 53, 4, -1, 11, -1, 12,
1738 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
1739 -1, 49, -1, 195, -1, 196, 151, -1, 230, -1,
1740 152, 4, -1, 196, 153, 200, 154, 187, -1, 10,
1741 153, 200, 154, 187, -1, 155, 4, 156, 196, 157,
1742 -1, 158, 4, 156, 196, 159, -1, 160, 201, 161,
1743 -1, 160, 161, -1, 158, 160, 201, 161, 159, -1,
1744 158, 160, 161, 159, -1, 196, 185, -1, 196, -1,
1745 10, -1, 197, -1, 199, 150, 197, -1, 199, -1,
1746 199, 150, 39, -1, 39, -1, -1, 196, -1, 201,
1747 150, 196, -1, 196, 155, 204, 157, -1, 196, 155,
1748 157, -1, 196, 162, 22, -1, 196, 158, 204, 159,
1749 -1, 196, 160, 204, 161, -1, 196, 160, 161, -1,
1750 196, 158, 160, 204, 161, 159, -1, 196, 158, 160,
1751 161, 159, -1, 196, 40, -1, 196, 41, -1, 196,
1752 230, -1, 196, 203, -1, 196, 25, -1, 169, 3,
1753 -1, 169, 5, -1, 169, 4, -1, 169, 6, -1,
1754 11, 26, -1, 11, 27, -1, 170, 9, -1, 166,
1755 153, 202, 38, 196, 154, -1, 115, 153, 202, 241,
1756 154, -1, 129, 153, 202, 150, 202, 150, 202, 154,
1757 -1, 164, 153, 202, 150, 202, 154, -1, 165, 153,
1758 202, 150, 202, 154, -1, 88, 167, 153, 202, 150,
1759 202, 154, -1, 89, 168, 153, 202, 150, 202, 154,
1760 -1, 131, 153, 202, 150, 202, 154, -1, 132, 153,
1761 202, 150, 202, 150, 202, 154, -1, 133, 153, 202,
1762 150, 202, 150, 202, 154, -1, 204, 150, 202, -1,
1763 202, -1, 32, -1, 33, -1, 37, -1, -1, 198,
1764 230, -1, 121, 153, 207, 38, 196, 154, -1, 209,
1765 -1, -1, 210, -1, 209, 210, -1, -1, 31, 211,
1766 226, -1, -1, 30, 212, 227, -1, 58, 57, 216,
1767 -1, 173, 18, 196, -1, 173, 18, 10, -1, -1,
1768 175, 179, 206, 205, 202, 213, 193, -1, -1, 175,
1769 177, 179, 206, 205, 202, 214, 193, -1, -1, 175,
1770 178, 179, 206, 205, 196, 215, 193, -1, 175, 179,
1771 35, 182, 207, -1, 51, 217, -1, 54, 149, 218,
1772 -1, 22, -1, 52, 149, 22, -1, 66, 149, 22,
1773 -1, 155, 219, 157, -1, 219, 150, 22, -1, 22,
1774 -1, -1, 220, 150, 196, 185, 172, -1, 196, 185,
1775 172, -1, 220, -1, 220, 150, 39, -1, 39, -1,
1776 -1, 183, 198, 174, 153, 221, 154, 187, 192, 189,
1777 188, -1, 28, -1, 160, -1, 181, 179, 222, 223,
1778 -1, 29, -1, 161, -1, 233, 225, -1, 180, 179,
1779 222, -1, -1, 59, -1, 3, -1, 4, -1, 9,
1780 -1, 26, -1, 27, -1, 40, -1, 41, -1, 25,
1781 -1, 158, 204, 159, -1, 203, -1, 57, 228, 22,
1782 150, 22, -1, 7, -1, 8, -1, 171, -1, 174,
1783 -1, 230, -1, 229, -1, 196, 231, -1, 233, 234,
1784 -1, 224, 234, -1, 235, 173, 236, -1, 235, 238,
1785 -1, -1, 21, -1, 67, 232, -1, 67, 10, -1,
1786 68, 17, 231, -1, 68, 11, 231, 150, 17, 231,
1787 150, 17, 231, -1, 69, 169, 231, 150, 17, 231,
1788 155, 237, 157, -1, 69, 169, 231, 150, 17, 231,
1789 155, 157, -1, 70, 183, 198, 231, 153, 240, 154,
1790 187, 38, 17, 231, 71, 17, 231, -1, 71, -1,
1791 72, -1, 237, 169, 229, 150, 17, 231, -1, 169,
1792 229, 150, 17, 231, -1, 173, 243, -1, 196, 155,
1793 231, 150, 231, 157, -1, 239, 150, 155, 231, 150,
1794 231, 157, -1, 196, 185, 231, 185, -1, 17, 185,
1795 231, 185, -1, 240, 150, 196, 185, 231, 185, -1,
1796 240, 150, 17, 185, 231, 185, -1, -1, -1, 241,
1797 150, 232, -1, 56, 55, -1, 55, -1, 164, 196,
1798 231, 150, 231, -1, 165, 196, 231, 150, 231, -1,
1799 88, 167, 196, 231, 150, 231, -1, 89, 168, 196,
1800 231, 150, 231, -1, 166, 232, 38, 196, -1, 129,
1801 232, 150, 232, 150, 232, -1, 130, 232, 150, 196,
1802 -1, 131, 232, 150, 232, -1, 132, 232, 150, 232,
1803 150, 232, -1, 133, 232, 150, 232, 150, 232, -1,
1804 128, 239, -1, 242, 183, 198, 231, 153, 240, 154,
1805 187, -1, 245, -1, 36, -1, -1, 110, 196, 190,
1806 -1, 110, 196, 150, 11, 231, 190, -1, 111, 196,
1807 190, -1, 111, 196, 150, 11, 231, 190, -1, 112,
1808 232, -1, 244, 113, 196, 231, 190, -1, 244, 114,
1809 232, 150, 196, 231, 190, -1, 115, 196, 231, 241,
1813 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1814 static const yytype_uint16 yyrline[] =
1816 0, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105,
1817 1105, 1106, 1106, 1106, 1106, 1106, 1106, 1107, 1107, 1107,
1818 1107, 1107, 1107, 1108, 1108, 1108, 1108, 1108, 1108, 1111,
1819 1111, 1112, 1112, 1113, 1113, 1114, 1114, 1115, 1115, 1119,
1820 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1124,
1821 1124, 1125, 1125, 1126, 1127, 1132, 1133, 1133, 1133, 1133,
1822 1133, 1135, 1135, 1135, 1136, 1136, 1140, 1144, 1149, 1149,
1823 1151, 1152, 1157, 1163, 1164, 1165, 1166, 1167, 1171, 1172,
1824 1173, 1177, 1178, 1179, 1180, 1184, 1185, 1186, 1190, 1191,
1825 1192, 1193, 1194, 1198, 1199, 1200, 1203, 1204, 1205, 1206,
1826 1207, 1208, 1209, 1216, 1217, 1218, 1219, 1220, 1221, 1222,
1827 1223, 1224, 1227, 1228, 1233, 1234, 1235, 1236, 1237, 1238,
1828 1241, 1242, 1247, 1248, 1255, 1256, 1262, 1263, 1271, 1279,
1829 1280, 1285, 1286, 1287, 1292, 1305, 1305, 1305, 1305, 1305,
1830 1305, 1305, 1308, 1312, 1316, 1323, 1328, 1336, 1366, 1391,
1831 1396, 1406, 1416, 1420, 1430, 1437, 1446, 1453, 1458, 1463,
1832 1470, 1471, 1478, 1485, 1493, 1499, 1511, 1539, 1555, 1582,
1833 1610, 1636, 1656, 1682, 1702, 1714, 1721, 1787, 1797, 1807,
1834 1813, 1823, 1829, 1839, 1844, 1849, 1862, 1874, 1896, 1904,
1835 1910, 1921, 1926, 1931, 1937, 1943, 1952, 1956, 1964, 1964,
1836 1967, 1967, 1970, 1982, 2003, 2008, 2016, 2017, 2021, 2021,
1837 2025, 2025, 2028, 2031, 2055, 2066, 2066, 2077, 2076, 2086,
1838 2085, 2096, 2136, 2139, 2145, 2155, 2159, 2164, 2166, 2171,
1839 2176, 2185, 2195, 2206, 2210, 2219, 2228, 2233, 2367, 2367,
1840 2369, 2378, 2378, 2380, 2385, 2397, 2401, 2406, 2410, 2414,
1841 2418, 2422, 2426, 2430, 2434, 2438, 2463, 2467, 2477, 2481,
1842 2485, 2490, 2497, 2497, 2503, 2512, 2516, 2525, 2534, 2543,
1843 2547, 2554, 2558, 2562, 2567, 2577, 2596, 2605, 2689, 2693,
1844 2700, 2711, 2724, 2734, 2745, 2755, 2766, 2774, 2784, 2791,
1845 2794, 2795, 2802, 2806, 2811, 2827, 2844, 2858, 2872, 2884,
1846 2892, 2899, 2905, 2911, 2917, 2932, 3023, 3028, 3032, 3039,
1847 3046, 3054, 3061, 3069, 3077, 3091, 3108
1851 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1852 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1853 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1854 static const char *const yytname[] =
1856 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1857 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1858 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1859 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1860 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1861 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1862 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1863 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1864 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1865 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1866 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1867 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1868 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1869 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1870 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1871 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1872 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1873 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1874 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1875 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1876 "INSERTELEMENT", "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN",
1877 "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE",
1878 "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'",
1879 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1880 "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1881 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1882 "OptLocalName", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1883 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1884 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1885 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1886 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1887 "SectionString", "OptSection", "GlobalVarAttributes",
1888 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1889 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1890 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1891 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1892 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1893 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1894 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1895 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1896 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1897 "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
1898 "OptVolatile", "MemoryInst", 0
1903 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1905 static const yytype_uint16 yytoknum[] =
1907 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1908 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1909 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1910 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1911 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1912 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1913 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1914 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1915 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1916 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1917 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1918 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1919 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1920 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1921 395, 396, 397, 398, 399, 400, 401, 402, 403, 61,
1922 44, 42, 92, 40, 41, 91, 120, 93, 60, 62,
1927 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1928 static const yytype_uint8 yyr1[] =
1930 0, 163, 164, 164, 164, 164, 164, 164, 164, 164,
1931 164, 165, 165, 165, 165, 165, 165, 166, 166, 166,
1932 166, 166, 166, 166, 166, 166, 166, 166, 166, 167,
1933 167, 167, 167, 167, 167, 167, 167, 167, 167, 168,
1934 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1935 168, 168, 168, 168, 168, 169, 170, 170, 170, 170,
1936 170, 171, 171, 171, 172, 172, 173, 173, 174, 174,
1937 175, 175, 176, 177, 177, 177, 177, 177, 178, 178,
1938 178, 179, 179, 179, 179, 180, 180, 180, 181, 181,
1939 181, 181, 181, 182, 182, 182, 183, 183, 183, 183,
1940 183, 183, 183, 184, 184, 184, 184, 184, 184, 184,
1941 184, 184, 185, 185, 186, 186, 186, 186, 186, 186,
1942 187, 187, 188, 188, 189, 189, 190, 190, 191, 192,
1943 192, 193, 193, 194, 194, 195, 195, 195, 195, 195,
1944 195, 195, 196, 196, 196, 196, 196, 196, 196, 196,
1945 196, 196, 196, 196, 196, 197, 198, 198, 199, 199,
1946 200, 200, 200, 200, 201, 201, 202, 202, 202, 202,
1947 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
1948 202, 202, 202, 202, 202, 202, 203, 203, 203, 203,
1949 203, 203, 203, 203, 203, 203, 204, 204, 205, 205,
1950 206, 206, 207, 207, 208, 208, 209, 209, 211, 210,
1951 212, 210, 210, 210, 210, 213, 210, 214, 210, 215,
1952 210, 210, 210, 210, 216, 217, 217, 218, 219, 219,
1953 219, 220, 220, 221, 221, 221, 221, 222, 223, 223,
1954 224, 225, 225, 226, 227, 228, 228, 229, 229, 229,
1955 229, 229, 229, 229, 229, 229, 229, 229, 230, 230,
1956 230, 230, 231, 231, 232, 233, 233, 234, 235, 235,
1957 235, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1958 237, 237, 238, 239, 239, 240, 240, 240, 240, 240,
1959 241, 241, 242, 242, 243, 243, 243, 243, 243, 243,
1960 243, 243, 243, 243, 243, 243, 243, 244, 244, 245,
1961 245, 245, 245, 245, 245, 245, 245
1964 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1965 static const yytype_uint8 yyr2[] =
1967 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1968 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1969 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1970 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1971 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1972 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1973 1, 1, 1, 1, 1, 0, 2, 0, 1, 1,
1974 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1975 1, 0, 1, 1, 1, 0, 1, 1, 0, 1,
1976 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1977 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1978 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
1979 0, 2, 0, 2, 0, 2, 0, 3, 2, 0,
1980 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1981 1, 1, 1, 1, 2, 1, 2, 5, 5, 5,
1982 5, 3, 2, 5, 4, 2, 1, 1, 1, 3,
1983 1, 3, 1, 0, 1, 3, 4, 3, 3, 4,
1984 4, 3, 6, 5, 2, 2, 2, 2, 2, 2,
1985 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1986 6, 7, 7, 6, 8, 8, 3, 1, 1, 1,
1987 1, 0, 2, 6, 1, 0, 1, 2, 0, 3,
1988 0, 3, 3, 3, 3, 0, 7, 0, 8, 0,
1989 8, 5, 2, 3, 1, 3, 3, 3, 3, 1,
1990 0, 5, 3, 1, 3, 1, 0, 10, 1, 1,
1991 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1993 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1994 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1995 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
1996 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1997 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
2001 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2002 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2003 means the default is an error. */
2004 static const yytype_uint16 yydefact[] =
2006 71, 61, 68, 62, 69, 63, 210, 208, 0, 0,
2007 0, 0, 0, 0, 81, 70, 0, 71, 206, 85,
2008 88, 0, 0, 222, 0, 0, 66, 0, 72, 73,
2009 75, 74, 76, 78, 77, 79, 80, 82, 83, 84,
2010 81, 81, 201, 1, 207, 86, 87, 81, 211, 89,
2011 90, 91, 92, 81, 269, 209, 269, 0, 0, 230,
2012 223, 224, 212, 258, 259, 214, 135, 136, 137, 140,
2013 139, 138, 141, 142, 0, 0, 0, 0, 260, 261,
2014 143, 213, 145, 201, 201, 93, 200, 0, 96, 96,
2015 270, 266, 67, 241, 242, 243, 265, 225, 226, 229,
2016 0, 163, 146, 0, 0, 0, 0, 152, 164, 0,
2017 144, 163, 0, 0, 95, 94, 0, 198, 199, 0,
2018 0, 97, 98, 99, 100, 101, 0, 244, 0, 308,
2019 268, 0, 227, 162, 112, 158, 160, 0, 0, 0,
2020 0, 0, 0, 151, 0, 0, 0, 157, 0, 156,
2021 0, 221, 135, 136, 137, 140, 139, 138, 0, 0,
2022 0, 215, 102, 0, 238, 239, 240, 307, 293, 0,
2023 0, 0, 0, 96, 278, 279, 2, 3, 4, 5,
2024 6, 7, 8, 9, 10, 14, 15, 16, 11, 12,
2025 13, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2026 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
2027 0, 0, 0, 0, 0, 0, 0, 0, 267, 96,
2028 282, 0, 306, 228, 155, 0, 120, 0, 0, 154,
2029 0, 165, 120, 217, 219, 0, 202, 183, 184, 179,
2030 181, 180, 182, 185, 178, 174, 175, 0, 0, 0,
2031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2032 0, 177, 176, 131, 0, 292, 272, 0, 271, 0,
2033 0, 55, 0, 0, 29, 30, 31, 32, 33, 34,
2034 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
2035 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
2036 48, 0, 126, 126, 313, 0, 0, 304, 0, 0,
2037 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
2038 106, 105, 103, 107, 108, 109, 110, 111, 113, 161,
2039 159, 148, 149, 150, 153, 147, 131, 131, 0, 0,
2040 0, 0, 0, 0, 0, 0, 167, 197, 0, 0,
2041 0, 171, 0, 168, 0, 0, 0, 0, 216, 236,
2042 247, 248, 249, 254, 250, 251, 252, 253, 245, 0,
2043 256, 263, 262, 264, 0, 273, 0, 0, 0, 0,
2044 0, 309, 0, 311, 290, 0, 0, 0, 0, 0,
2045 0, 0, 0, 0, 0, 0, 0, 0, 117, 116,
2046 114, 115, 118, 119, 121, 218, 220, 0, 0, 0,
2047 290, 0, 0, 0, 0, 0, 166, 152, 164, 0,
2048 169, 170, 0, 0, 0, 0, 0, 133, 131, 235,
2049 112, 233, 0, 246, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 316, 0, 0, 0, 300, 301,
2051 0, 0, 0, 0, 298, 0, 126, 0, 0, 0,
2052 0, 0, 0, 0, 0, 0, 196, 173, 0, 0,
2053 0, 0, 128, 134, 132, 65, 0, 120, 0, 255,
2054 0, 0, 289, 0, 0, 126, 127, 126, 0, 0,
2055 0, 0, 0, 0, 294, 295, 289, 0, 314, 0,
2056 203, 0, 0, 187, 0, 0, 0, 0, 172, 0,
2057 0, 0, 64, 232, 234, 112, 129, 0, 0, 0,
2058 112, 112, 0, 296, 297, 310, 312, 291, 0, 0,
2059 299, 302, 303, 0, 126, 0, 0, 0, 193, 0,
2060 0, 189, 190, 186, 65, 130, 124, 257, 0, 0,
2061 0, 0, 0, 120, 283, 0, 120, 315, 191, 192,
2062 0, 0, 0, 231, 0, 122, 0, 276, 0, 0,
2063 104, 106, 112, 112, 112, 112, 0, 284, 305, 188,
2064 194, 195, 125, 0, 237, 274, 0, 275, 0, 286,
2065 285, 0, 0, 0, 123, 0, 0, 112, 112, 0,
2066 0, 0, 288, 287, 0, 281, 0, 0, 280, 0,
2070 /* YYDEFGOTO[NTERM-NUM]. */
2071 static const yytype_int16 yydefgoto[] =
2073 -1, 258, 259, 260, 284, 301, 158, 159, 78, 513,
2074 12, 79, 14, 15, 40, 41, 42, 47, 53, 116,
2075 126, 328, 224, 404, 331, 584, 565, 381, 427, 546,
2076 358, 428, 80, 160, 135, 150, 136, 137, 109, 347,
2077 370, 348, 119, 87, 151, 16, 17, 18, 20, 19,
2078 263, 336, 337, 62, 23, 60, 100, 431, 432, 127,
2079 166, 54, 95, 55, 48, 434, 371, 82, 373, 268,
2080 56, 91, 92, 218, 569, 130, 307, 522, 444, 219,
2084 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2086 #define YYPACT_NINF -541
2087 static const yytype_int16 yypact[] =
2089 658, -541, -541, -541, -541, -541, -541, -541, -12, -135,
2090 -38, -125, 106, -69, 26, -541, 29, 1762, -541, 14,
2091 88, 43, 49, -541, 45, 127, -541, 1344, -541, -541,
2092 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2093 131, 131, 73, -541, -541, -541, -541, 131, -541, -541,
2094 -541, -541, -541, 131, 201, -541, -11, 135, 215, 216,
2095 -541, -541, -541, -541, -541, 70, -541, -541, -541, -541,
2096 -541, -541, -541, -541, 245, 247, 3, 553, -541, -541,
2097 -541, -34, -541, 219, 219, 110, -541, 62, 171, 171,
2098 -541, -541, 124, -541, -541, -541, -541, -541, -541, -541,
2099 -66, 1092, -541, 108, 114, 991, 70, -541, -34, -109,
2100 -541, 1092, 62, 62, -541, -541, 1146, -541, -541, 1362,
2101 261, -541, -541, -541, -541, -541, 1418, -541, -15, 1628,
2102 -541, 260, -541, -541, -34, -541, 119, 129, 1458, 1458,
2103 147, -108, 1458, -541, 134, 1362, 1458, 70, 142, -34,
2104 118, -541, 40, 306, 307, 308, 309, 310, 172, 311,
2105 805, -541, -541, 113, -541, -541, -541, -541, -541, 266,
2106 1516, 72, 314, 171, -541, -541, -541, -541, -541, -541,
2107 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2108 -541, 313, 507, 1458, 1458, 1458, 1458, -541, -541, -541,
2109 -541, -541, -541, -541, -541, -541, -541, -541, -541, 1458,
2110 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, -541, 171,
2111 -541, 52, -541, -541, -36, 1186, -541, -94, -30, -541,
2112 163, -34, -541, -541, -34, 1146, -541, -541, -541, -541,
2113 -541, -541, -541, -541, -541, -541, -541, 313, 507, 176,
2114 178, 184, 185, 187, 1246, 1534, 1031, 302, 190, 193,
2115 198, -541, -541, 202, 200, -541, 70, 645, -541, 782,
2116 782, -541, 782, 1418, -541, -541, -541, -541, -541, -541,
2117 -541, -541, -541, -541, 1458, -541, -541, -541, -541, -541,
2118 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2119 -541, 1458, 136, 146, -541, 645, 104, 206, 207, 208,
2120 209, 210, 217, 645, 645, 328, 1418, 1458, 1458, -541,
2121 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2122 -541, 137, -541, -541, -541, 137, 202, 202, 333, 221,
2123 222, 1362, 1362, 1362, 1362, 1362, -541, -541, -64, 1071,
2124 -103, -541, -100, -541, 1362, 1362, 1362, 2, -541, 1264,
2125 -541, -541, -541, -541, -541, -541, -541, -541, 317, 1362,
2126 -541, -541, -541, -541, 227, -541, 230, 782, 645, 645,
2127 11, -541, 12, -541, -541, 782, 228, 1458, 1458, 1458,
2128 1458, 1458, 232, 234, 1458, 782, 645, 235, -541, -541,
2129 -541, -541, -541, -541, -541, -541, -541, 1458, 1362, 1362,
2130 -541, 239, 241, 243, 244, 1362, -541, 256, 805, -73,
2131 -541, -541, 248, 250, 385, 404, 423, -541, 202, -541,
2132 -34, 278, 280, -541, 413, -72, 419, 420, 288, 292,
2133 293, 782, 440, 782, 296, 297, 782, 299, -34, -541,
2134 301, 303, 782, 782, -34, 304, 318, 1458, 151, 319,
2135 321, -43, 1362, 1362, 1362, 1362, -541, -541, 295, 1362,
2136 1362, 1458, -541, -541, -541, 279, 1304, -541, 322, -541,
2137 782, 782, 1574, 782, 782, 318, -541, 318, 1458, 782,
2138 323, 1458, 1458, 1458, -541, -541, 1574, 399, -541, 645,
2139 -541, 1362, 1362, -541, 324, 305, 326, 327, -541, 325,
2140 329, 157, -541, -541, -541, -34, 81, 436, 332, 330,
2141 9, -34, 47, -541, -541, -541, -541, -541, 334, 782,
2142 -541, -541, -541, 96, 318, 336, 338, 1362, -541, 1362,
2143 1362, -541, -541, -541, 279, -541, 407, -541, 444, -6,
2144 505, 505, 1614, -541, -541, 337, -541, -541, -541, -541,
2145 339, 342, 343, -541, 459, 341, 782, -541, 943, -2,
2146 331, 348, -541, -541, 9, -34, 109, -541, 137, -541,
2147 -541, -541, -541, 442, -541, -541, 352, -541, 943, -36,
2148 -36, 505, 505, 470, -541, 486, 354, -541, -541, 782,
2149 782, 488, -36, -36, 435, -541, 782, 490, -541, 782,
2153 /* YYPGOTO[NTERM-NUM]. */
2154 static const yytype_int16 yypgoto[] =
2156 -541, 381, 382, 387, 270, 271, -170, -541, 0, -24,
2157 426, 8, -541, -541, -541, -541, 56, -541, -541, -541,
2158 -161, -541, -393, -541, -217, -541, -541, -292, 5, -541,
2159 -310, -541, -541, -26, 298, -120, -541, 411, 430, -115,
2160 -157, -235, 94, 130, 312, -541, -541, 519, -541, -541,
2161 -541, -541, -541, -541, -541, -541, -541, -541, -541, 448,
2162 -541, -541, -541, -541, -541, -541, -540, -111, -51, -179,
2163 -541, 482, -541, -541, -541, -541, -541, 46, 133, -541,
2167 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2168 positive, shift that token. If negative, reduce the rule which
2169 number is the opposite. If zero, do what YYDEFACT says.
2170 If YYTABLE_NINF, syntax error. */
2171 #define YYTABLE_NINF -206
2172 static const yytype_int16 yytable[] =
2174 11, 81, 272, 261, 161, 271, 163, 104, 13, 271,
2175 90, 383, 273, 164, 24, 335, 304, 11, 93, 25,
2176 350, 352, 441, 443, 26, 13, 405, 406, 586, 43,
2177 233, 308, 309, 310, 311, 312, 425, 475, 315, 236,
2178 21, 142, 142, -55, -55, -55, -55, 415, 596, 262,
2179 415, 108, 143, 230, 22, 426, 420, 110, 316, 111,
2180 45, 421, 46, 332, 442, 442, 237, 238, 29, 30,
2181 31, 32, 33, 34, 35, 134, 36, 415, 415, 108,
2182 28, 319, 320, 269, 131, 134, 415, 479, 468, 270,
2183 149, 132, 11, 416, 117, 118, 83, 84, 321, 322,
2184 149, 323, 324, 88, 325, 326, 327, 488, 85, 89,
2185 86, 503, 227, 228, 419, 425, 231, 110, 474, 111,
2186 234, 110, 544, 111, 27, 63, 64, 550, 551, 333,
2187 49, 50, 51, 2, 435, 52, 4, 1, 2, 397,
2188 3, 4, 5, 1, 267, 165, 3, 593, 5, 61,
2189 94, 567, 114, 377, 115, 587, 372, 97, 372, 372,
2190 -141, 372, -141, 105, 498, 317, 318, 302, 303, 267,
2191 305, 264, 37, 38, 39, 239, 240, 241, 242, 589,
2192 590, 591, 592, 306, 267, 267, 267, 267, 267, 313,
2193 314, 267, 57, 525, 372, 526, 395, 552, 58, 134,
2194 59, 553, 372, 372, 602, 603, 145, 146, 447, 149,
2195 449, 450, 451, 112, 113, 398, 399, 400, 374, 375,
2196 401, 376, 90, 101, 402, 403, 410, 411, 412, 413,
2197 414, 120, 121, 122, 123, 124, 125, 98, 99, 422,
2198 423, 424, 557, 398, 399, 400, 552, 149, 401, 102,
2199 556, 103, 402, 403, 384, 110, 86, 111, 378, 385,
2200 516, 261, 392, 393, 138, 162, 372, 372, 372, 225,
2201 139, 398, 399, 400, 372, 379, 401, 37, 38, 39,
2202 402, 403, 223, 226, 372, 372, 380, 110, 232, 111,
2203 149, 396, 267, 459, 460, 235, 382, 110, 1, 111,
2204 466, 3, 110, 5, 111, 500, 229, 262, 110, 527,
2205 111, 543, 530, 531, 532, -56, -57, -60, -59, -58,
2206 243, 265, 334, 418, 353, 271, 438, 439, 440, 341,
2207 372, 342, 372, 430, 445, 372, 576, 343, 344, 578,
2208 345, 372, 372, 354, 455, 456, 355, 504, 505, 506,
2209 507, 356, 357, 359, 509, 510, 386, 387, 388, 389,
2210 390, 267, 448, 267, 267, 267, 394, 391, 454, 372,
2211 372, 407, 372, 372, 408, 409, 433, 436, 372, 568,
2212 437, 458, 452, 446, 453, 457, 535, 536, 372, 462,
2213 485, 463, 487, 464, 465, 490, 319, 320, 469, 588,
2214 470, 494, 495, 274, 275, 276, 277, 278, 279, 280,
2215 281, 282, 283, 321, 322, 467, 323, 324, 372, 325,
2216 326, 327, 560, 471, 561, 562, 472, 473, 476, 518,
2217 519, 499, 523, 524, 477, 478, 480, 481, 528, 372,
2218 372, 482, 483, 484, 486, 511, 488, 489, 534, 491,
2219 515, 492, 442, 493, 508, 372, 521, 496, 547, 538,
2220 564, 566, 267, 582, 594, 267, 267, 267, 497, 501,
2221 521, 502, 517, 529, 537, 512, 539, 540, 555, 541,
2222 372, 372, 548, 542, -18, 549, 583, 599, 372, 372,
2223 558, 554, 559, 579, 577, 372, 580, 581, 372, 572,
2224 573, -19, 595, 600, 601, 606, 607, 609, 360, 361,
2225 215, 216, 63, 64, 362, 585, 217, 339, 129, 340,
2226 563, 545, 144, 330, 1, 2, 575, 3, 4, 5,
2227 363, 364, 365, 285, 286, 141, 44, 128, 96, 0,
2228 597, 598, 533, 461, 512, 366, 367, 338, 604, 605,
2229 0, 0, 0, 0, 0, 608, 0, 0, 610, 0,
2230 63, 64, 368, 106, 66, 67, 68, 69, 70, 71,
2231 72, 0, 1, 2, 0, 3, 4, 5, 176, 177,
2232 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2233 188, 189, 190, 247, 248, 0, 0, 0, 0, 0,
2234 0, 0, 73, 287, 288, 289, 290, 291, 292, 293,
2235 294, 295, 296, 297, 298, 299, 300, 0, 0, 0,
2236 249, 197, 570, 571, 200, 201, 202, 203, 204, 205,
2237 206, 207, 208, 0, 250, 0, 251, 252, 253, 321,
2238 322, 0, 323, 324, 0, 325, 326, 327, 360, 361,
2239 0, 0, 63, 64, 362, 0, 0, 0, -205, 0,
2240 0, 0, 0, 369, 1, 2, 0, 3, 4, 5,
2241 363, 364, 365, 0, 0, 0, -67, 1, 2, 0,
2242 3, 4, 5, 0, 0, 366, 367, 0, 6, 7,
2243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2244 0, 0, 368, 0, 0, 74, 0, 0, 75, 8,
2245 0, 76, 9, 77, 107, 0, 10, 0, 176, 177,
2246 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2247 188, 189, 190, 247, 248, 0, 0, 0, 0, 0,
2248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2250 249, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2251 206, 207, 208, 0, 250, 0, 251, 252, 253, 0,
2252 0, 0, 0, 0, 0, 360, 361, 0, 0, 63,
2253 64, 362, 0, 0, 0, 0, 110, 0, 111, 0,
2254 0, 1, 2, 369, 3, 4, 5, 363, 364, 365,
2255 0, 0, 63, 64, 0, 0, 0, 0, 0, 0,
2256 0, 0, 366, 367, 1, 2, 0, 3, 4, 5,
2257 244, 0, 0, 0, 0, 0, 0, 0, 0, 368,
2258 0, 0, 0, 0, 0, 245, 246, 0, 0, 0,
2259 0, 0, 0, 0, 0, 176, 177, 178, 179, 180,
2260 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2261 247, 248, 0, 0, 0, 0, 0, 0, 176, 177,
2262 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2263 188, 189, 190, 247, 248, 0, 0, 249, 197, 198,
2264 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2265 0, 250, 0, 251, 252, 253, 0, 0, 0, 0,
2266 249, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2267 206, 207, 208, 0, 250, 0, 251, 252, 253, 0,
2268 369, 0, 0, 0, 0, 0, 360, 361, 0, 0,
2269 0, 0, 362, 0, 0, 0, 110, 0, 111, 0,
2270 254, 0, 0, 255, 0, 256, 0, 257, 363, 364,
2271 365, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2272 0, 0, 0, 366, 367, 0, 0, 0, 0, 0,
2273 0, 0, 0, 0, 0, 0, 0, 0, 63, 64,
2274 368, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2275 1, 2, 0, 3, 4, 5, 176, 177, 178, 179,
2276 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2277 190, 247, 248, 0, 0, 0, 0, 0, 63, 64,
2278 73, 106, 152, 153, 154, 155, 156, 157, 72, 0,
2279 1, 2, 0, 3, 4, 5, 0, 0, 249, 197,
2280 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2281 208, 0, 250, 0, 251, 252, 253, 0, 63, 64,
2282 73, 106, 152, 153, 154, 155, 156, 157, 72, 0,
2283 1, 2, 0, 3, 4, 5, 0, 0, 0, 63,
2284 64, 369, 106, 66, 67, 68, 69, 70, 71, 72,
2285 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2286 73, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2287 0, 133, 0, 0, 0, 0, 0, 0, 0, 0,
2288 0, 73, 0, 74, 0, 0, 75, 0, 0, 76,
2289 0, 77, 140, 63, 64, 0, 147, 66, 67, 68,
2290 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2291 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2292 0, 0, 0, 74, 0, 0, 75, 0, 0, 76,
2293 0, 77, 351, 63, 64, 73, 106, 66, 67, 68,
2294 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2295 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2296 0, 0, 0, 74, 0, 329, 75, 0, 0, 76,
2297 0, 77, 417, 0, 0, 73, 0, 0, 0, 0,
2298 0, 0, 0, 0, 74, 0, 0, 75, 0, 0,
2299 76, 0, 77, 63, 64, 0, 106, 152, 153, 154,
2300 155, 156, 157, 72, 0, 1, 2, 148, 3, 4,
2301 5, 63, 64, 0, 106, 66, 67, 68, 69, 70,
2302 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2303 0, 0, 0, 0, 0, 73, 0, 0, 74, 0,
2304 0, 75, 0, 429, 76, 0, 77, 0, 0, 0,
2305 0, 63, 64, 73, 106, 66, 67, 68, 69, 70,
2306 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2307 0, 0, 0, 0, 0, 0, 0, 0, 74, 0,
2308 0, 75, 0, 514, 76, 0, 77, 0, 0, 0,
2309 0, 63, 64, 73, 65, 66, 67, 68, 69, 70,
2310 71, 72, 0, 1, 2, 0, 3, 4, 5, 63,
2311 64, 0, 106, 152, 153, 154, 155, 156, 157, 72,
2312 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2313 0, 0, 0, 73, 0, 0, 0, 0, 74, 0,
2314 0, 75, 0, 346, 76, 0, 77, 0, 0, 0,
2315 0, 73, 0, 0, 0, 0, 74, 0, 0, 75,
2316 0, 0, 76, 0, 77, 63, 64, 0, 147, 66,
2317 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2318 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2320 0, 0, 76, 0, 77, 63, 64, 73, 106, 66,
2321 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2322 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2324 0, 0, 76, 0, 77, 0, 0, 73, 0, 0,
2325 0, 0, 0, 0, 74, 0, 0, 75, 0, 0,
2326 76, 0, 77, 63, 64, 0, 266, 66, 67, 68,
2327 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2328 5, 63, 64, 0, 106, 152, 153, 154, 155, 156,
2329 157, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2330 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2331 74, 0, 0, 75, 0, 0, 76, 0, 77, 0,
2332 0, 63, 64, 73, 106, 66, 67, 68, 69, 70,
2333 71, 520, 0, 1, 2, 0, 3, 4, 5, 0,
2334 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2335 74, 0, 0, 75, 0, 0, 76, 0, 77, 0,
2336 0, 63, 64, 73, 106, 66, 67, 68, 69, 70,
2337 71, 574, 0, 1, 2, 0, 3, 4, 5, 0,
2338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2340 0, 0, 0, 73, 167, 0, 0, 0, 74, 0,
2341 0, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2342 0, 0, 0, 168, 169, 0, 74, 0, 0, 75,
2343 0, 0, 76, 0, 349, 170, 171, 172, 173, 174,
2344 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2345 185, 186, 187, 188, 189, 190, 191, 192, 0, 0,
2346 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2347 0, 0, 76, 0, 77, 0, 0, 0, 193, 194,
2348 195, 0, 0, 196, 197, 198, 199, 200, 201, 202,
2349 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2350 213, 214, -204, 0, 0, 0, 74, 0, 0, 75,
2351 0, 0, 76, 0, 77, 0, 0, 0, 0, 0,
2352 -67, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2353 0, 0, 6, 7, 0, 0, 0, 0, 0, 0,
2354 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 8, 0, 0, 9, 0, 0, 0,
2359 static const yytype_int16 yycheck[] =
2361 0, 27, 172, 160, 119, 11, 126, 4, 0, 11,
2362 21, 303, 173, 28, 149, 232, 195, 17, 29, 57,
2363 255, 256, 11, 11, 149, 17, 336, 337, 568, 0,
2364 145, 210, 211, 212, 213, 214, 34, 430, 217, 150,
2365 52, 150, 150, 3, 4, 5, 6, 150, 588, 160,
2366 150, 77, 161, 161, 66, 53, 159, 151, 219, 153,
2367 46, 161, 48, 157, 53, 53, 26, 27, 42, 43,
2368 44, 45, 46, 47, 48, 101, 50, 150, 150, 105,
2369 149, 117, 118, 11, 150, 111, 150, 159, 161, 17,
2370 116, 157, 92, 157, 32, 33, 40, 41, 134, 135,
2371 126, 137, 138, 47, 140, 141, 142, 150, 35, 53,
2372 37, 154, 138, 139, 349, 34, 142, 151, 428, 153,
2373 146, 151, 515, 153, 18, 7, 8, 520, 521, 159,
2374 42, 43, 44, 20, 369, 47, 23, 19, 20, 318,
2375 22, 23, 24, 19, 170, 160, 22, 38, 24, 22,
2376 161, 157, 42, 273, 44, 157, 267, 22, 269, 270,
2377 151, 272, 153, 160, 456, 113, 114, 193, 194, 195,
2378 196, 163, 146, 147, 148, 3, 4, 5, 6, 572,
2379 573, 574, 575, 209, 210, 211, 212, 213, 214, 215,
2380 216, 217, 149, 485, 305, 487, 316, 150, 149, 225,
2381 155, 154, 313, 314, 597, 598, 112, 113, 387, 235,
2382 389, 390, 391, 83, 84, 134, 135, 136, 269, 270,
2383 139, 272, 21, 153, 143, 144, 341, 342, 343, 344,
2384 345, 60, 61, 62, 63, 64, 65, 22, 22, 354,
2385 355, 356, 534, 134, 135, 136, 150, 273, 139, 4,
2386 154, 4, 143, 144, 305, 151, 37, 153, 284, 155,
2387 477, 418, 313, 314, 156, 4, 377, 378, 379, 150,
2388 156, 134, 135, 136, 385, 301, 139, 146, 147, 148,
2389 143, 144, 22, 154, 395, 396, 150, 151, 154, 153,
2390 316, 317, 318, 408, 409, 153, 150, 151, 19, 153,
2391 415, 22, 151, 24, 153, 154, 159, 418, 151, 488,
2392 153, 154, 491, 492, 493, 9, 9, 9, 9, 9,
2393 9, 55, 159, 349, 22, 11, 377, 378, 379, 153,
2394 441, 153, 443, 359, 385, 446, 553, 153, 153, 556,
2395 153, 452, 453, 153, 395, 396, 153, 462, 463, 464,
2396 465, 153, 150, 153, 469, 470, 150, 150, 150, 150,
2397 150, 387, 388, 389, 390, 391, 38, 150, 394, 480,
2398 481, 38, 483, 484, 153, 153, 59, 150, 489, 549,
2399 150, 407, 150, 155, 150, 150, 501, 502, 499, 150,
2400 441, 150, 443, 150, 150, 446, 117, 118, 150, 569,
2401 150, 452, 453, 90, 91, 92, 93, 94, 95, 96,
2402 97, 98, 99, 134, 135, 159, 137, 138, 529, 140,
2403 141, 142, 537, 38, 539, 540, 22, 4, 150, 480,
2404 481, 457, 483, 484, 154, 22, 17, 17, 489, 550,
2405 551, 153, 150, 150, 4, 471, 150, 150, 499, 150,
2406 476, 150, 53, 150, 159, 566, 482, 153, 22, 154,
2407 53, 17, 488, 4, 22, 491, 492, 493, 150, 150,
2408 496, 150, 150, 150, 150, 475, 150, 150, 529, 154,
2409 591, 592, 150, 154, 153, 155, 145, 17, 599, 600,
2410 154, 157, 154, 154, 157, 606, 154, 154, 609, 550,
2411 551, 153, 150, 17, 150, 17, 71, 17, 3, 4,
2412 129, 129, 7, 8, 9, 566, 129, 247, 92, 248,
2413 544, 516, 111, 225, 19, 20, 552, 22, 23, 24,
2414 25, 26, 27, 26, 27, 105, 17, 89, 56, -1,
2415 591, 592, 496, 410, 544, 40, 41, 235, 599, 600,
2416 -1, -1, -1, -1, -1, 606, -1, -1, 609, -1,
2417 7, 8, 57, 10, 11, 12, 13, 14, 15, 16,
2418 17, -1, 19, 20, -1, 22, 23, 24, 73, 74,
2419 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2420 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
2421 -1, -1, 49, 96, 97, 98, 99, 100, 101, 102,
2422 103, 104, 105, 106, 107, 108, 109, -1, -1, -1,
2423 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2424 125, 126, 127, -1, 129, -1, 131, 132, 133, 134,
2425 135, -1, 137, 138, -1, 140, 141, 142, 3, 4,
2426 -1, -1, 7, 8, 9, -1, -1, -1, 0, -1,
2427 -1, -1, -1, 158, 19, 20, -1, 22, 23, 24,
2428 25, 26, 27, -1, -1, -1, 18, 19, 20, -1,
2429 22, 23, 24, -1, -1, 40, 41, -1, 30, 31,
2430 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2431 -1, -1, 57, -1, -1, 152, -1, -1, 155, 51,
2432 -1, 158, 54, 160, 161, -1, 58, -1, 73, 74,
2433 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2434 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
2435 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2436 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2437 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2438 125, 126, 127, -1, 129, -1, 131, 132, 133, -1,
2439 -1, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2440 8, 9, -1, -1, -1, -1, 151, -1, 153, -1,
2441 -1, 19, 20, 158, 22, 23, 24, 25, 26, 27,
2442 -1, -1, 7, 8, -1, -1, -1, -1, -1, -1,
2443 -1, -1, 40, 41, 19, 20, -1, 22, 23, 24,
2444 25, -1, -1, -1, -1, -1, -1, -1, -1, 57,
2445 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2446 -1, -1, -1, -1, -1, 73, 74, 75, 76, 77,
2447 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2448 88, 89, -1, -1, -1, -1, -1, -1, 73, 74,
2449 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2450 85, 86, 87, 88, 89, -1, -1, 115, 116, 117,
2451 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2452 -1, 129, -1, 131, 132, 133, -1, -1, -1, -1,
2453 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2454 125, 126, 127, -1, 129, -1, 131, 132, 133, -1,
2455 158, -1, -1, -1, -1, -1, 3, 4, -1, -1,
2456 -1, -1, 9, -1, -1, -1, 151, -1, 153, -1,
2457 155, -1, -1, 158, -1, 160, -1, 162, 25, 26,
2458 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2459 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2460 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2461 57, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2462 19, 20, -1, 22, 23, 24, 73, 74, 75, 76,
2463 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2464 87, 88, 89, -1, -1, -1, -1, -1, 7, 8,
2465 49, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2466 19, 20, -1, 22, 23, 24, -1, -1, 115, 116,
2467 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2468 127, -1, 129, -1, 131, 132, 133, -1, 7, 8,
2469 49, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2470 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2471 8, 158, 10, 11, 12, 13, 14, 15, 16, 17,
2472 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2473 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2474 -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
2475 -1, 49, -1, 152, -1, -1, 155, -1, -1, 158,
2476 -1, 160, 161, 7, 8, -1, 10, 11, 12, 13,
2477 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2478 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2479 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2480 -1, 160, 161, 7, 8, 49, 10, 11, 12, 13,
2481 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2482 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2483 -1, -1, -1, 152, -1, 39, 155, -1, -1, 158,
2484 -1, 160, 161, -1, -1, 49, -1, -1, -1, -1,
2485 -1, -1, -1, -1, 152, -1, -1, 155, -1, -1,
2486 158, -1, 160, 7, 8, -1, 10, 11, 12, 13,
2487 14, 15, 16, 17, -1, 19, 20, 121, 22, 23,
2488 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2489 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2490 -1, -1, -1, -1, -1, 49, -1, -1, 152, -1,
2491 -1, 155, -1, 39, 158, -1, 160, -1, -1, -1,
2492 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2493 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2494 -1, -1, -1, -1, -1, -1, -1, -1, 152, -1,
2495 -1, 155, -1, 39, 158, -1, 160, -1, -1, -1,
2496 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2497 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2498 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2499 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2500 -1, -1, -1, 49, -1, -1, -1, -1, 152, -1,
2501 -1, 155, -1, 157, 158, -1, 160, -1, -1, -1,
2502 -1, 49, -1, -1, -1, -1, 152, -1, -1, 155,
2503 -1, -1, 158, -1, 160, 7, 8, -1, 10, 11,
2504 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2505 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2506 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2507 -1, -1, 158, -1, 160, 7, 8, 49, 10, 11,
2508 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2509 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2510 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2511 -1, -1, 158, -1, 160, -1, -1, 49, -1, -1,
2512 -1, -1, -1, -1, 152, -1, -1, 155, -1, -1,
2513 158, -1, 160, 7, 8, -1, 10, 11, 12, 13,
2514 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2515 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2516 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2517 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2518 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
2519 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2520 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2521 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2522 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
2523 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2524 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2525 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2526 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2527 -1, -1, -1, 49, 36, -1, -1, -1, 152, -1,
2528 -1, 155, -1, -1, 158, -1, 160, -1, -1, -1,
2529 -1, -1, -1, 55, 56, -1, 152, -1, -1, 155,
2530 -1, -1, 158, -1, 160, 67, 68, 69, 70, 71,
2531 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2532 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
2533 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2534 -1, -1, 158, -1, 160, -1, -1, -1, 110, 111,
2535 112, -1, -1, 115, 116, 117, 118, 119, 120, 121,
2536 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2537 132, 133, 0, -1, -1, -1, 152, -1, -1, 155,
2538 -1, -1, 158, -1, 160, -1, -1, -1, -1, -1,
2539 18, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2540 -1, -1, 30, 31, -1, -1, -1, -1, -1, -1,
2541 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2542 -1, -1, -1, 51, -1, -1, 54, -1, -1, -1,
2546 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2547 symbol of state STATE-NUM. */
2548 static const yytype_uint8 yystos[] =
2550 0, 19, 20, 22, 23, 24, 30, 31, 51, 54,
2551 58, 171, 173, 174, 175, 176, 208, 209, 210, 212,
2552 211, 52, 66, 217, 149, 57, 149, 18, 149, 42,
2553 43, 44, 45, 46, 47, 48, 50, 146, 147, 148,
2554 177, 178, 179, 0, 210, 46, 48, 180, 227, 42,
2555 43, 44, 47, 181, 224, 226, 233, 149, 149, 155,
2556 218, 22, 216, 7, 8, 10, 11, 12, 13, 14,
2557 15, 16, 17, 49, 152, 155, 158, 160, 171, 174,
2558 195, 196, 230, 179, 179, 35, 37, 206, 179, 179,
2559 21, 234, 235, 29, 161, 225, 234, 22, 22, 22,
2560 219, 153, 4, 4, 4, 160, 10, 161, 196, 201,
2561 151, 153, 206, 206, 42, 44, 182, 32, 33, 205,
2562 60, 61, 62, 63, 64, 65, 183, 222, 222, 173,
2563 238, 150, 157, 39, 196, 197, 199, 200, 156, 156,
2564 161, 201, 150, 161, 200, 205, 205, 10, 121, 196,
2565 198, 207, 11, 12, 13, 14, 15, 16, 169, 170,
2566 196, 202, 4, 198, 28, 160, 223, 36, 55, 56,
2567 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2568 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2569 87, 88, 89, 110, 111, 112, 115, 116, 117, 118,
2570 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2571 129, 130, 131, 132, 133, 164, 165, 166, 236, 242,
2572 243, 244, 245, 22, 185, 150, 154, 196, 196, 159,
2573 161, 196, 154, 202, 196, 153, 230, 26, 27, 3,
2574 4, 5, 6, 9, 25, 40, 41, 88, 89, 115,
2575 129, 131, 132, 133, 155, 158, 160, 162, 164, 165,
2576 166, 203, 230, 213, 174, 55, 10, 196, 232, 11,
2577 17, 11, 169, 183, 90, 91, 92, 93, 94, 95,
2578 96, 97, 98, 99, 167, 26, 27, 96, 97, 98,
2579 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2580 109, 168, 196, 196, 232, 196, 196, 239, 232, 232,
2581 232, 232, 232, 196, 196, 232, 183, 113, 114, 117,
2582 118, 134, 135, 137, 138, 140, 141, 142, 184, 39,
2583 197, 187, 157, 159, 159, 187, 214, 215, 207, 167,
2584 168, 153, 153, 153, 153, 153, 157, 202, 204, 160,
2585 204, 161, 204, 22, 153, 153, 153, 150, 193, 153,
2586 3, 4, 9, 25, 26, 27, 40, 41, 57, 158,
2587 203, 229, 230, 231, 231, 231, 231, 198, 196, 196,
2588 150, 190, 150, 190, 231, 155, 150, 150, 150, 150,
2589 150, 150, 231, 231, 38, 198, 196, 232, 134, 135,
2590 136, 139, 143, 144, 186, 193, 193, 38, 153, 153,
2591 202, 202, 202, 202, 202, 150, 157, 161, 196, 204,
2592 159, 161, 202, 202, 202, 34, 53, 191, 194, 39,
2593 196, 220, 221, 59, 228, 204, 150, 150, 231, 231,
2594 231, 11, 53, 11, 241, 231, 155, 232, 196, 232,
2595 232, 232, 150, 150, 196, 231, 231, 150, 196, 202,
2596 202, 241, 150, 150, 150, 150, 202, 159, 161, 150,
2597 150, 38, 22, 4, 193, 185, 150, 154, 22, 159,
2598 17, 17, 153, 150, 150, 231, 4, 231, 150, 150,
2599 231, 150, 150, 150, 231, 231, 153, 150, 190, 196,
2600 154, 150, 150, 154, 202, 202, 202, 202, 159, 202,
2601 202, 196, 171, 172, 39, 196, 187, 150, 231, 231,
2602 17, 196, 240, 231, 231, 190, 190, 232, 231, 150,
2603 232, 232, 232, 240, 231, 202, 202, 150, 154, 150,
2604 150, 154, 154, 154, 185, 191, 192, 22, 150, 155,
2605 185, 185, 150, 154, 157, 231, 154, 190, 154, 154,
2606 202, 202, 202, 172, 53, 189, 17, 157, 169, 237,
2607 117, 118, 231, 231, 17, 196, 187, 157, 187, 154,
2608 154, 154, 4, 145, 188, 231, 229, 157, 169, 185,
2609 185, 185, 185, 38, 22, 150, 229, 231, 231, 17,
2610 17, 150, 185, 185, 231, 231, 17, 71, 231, 17,
2614 #define yyerrok (yyerrstatus = 0)
2615 #define yyclearin (yychar = YYEMPTY)
2616 #define YYEMPTY (-2)
2619 #define YYACCEPT goto yyacceptlab
2620 #define YYABORT goto yyabortlab
2621 #define YYERROR goto yyerrorlab
2624 /* Like YYERROR except do call yyerror. This remains here temporarily
2625 to ease the transition to the new meaning of YYERROR, for GCC.
2626 Once GCC version 2 has supplanted version 1, this can go. */
2628 #define YYFAIL goto yyerrlab
2630 #define YYRECOVERING() (!!yyerrstatus)
2632 #define YYBACKUP(Token, Value) \
2634 if (yychar == YYEMPTY && yylen == 1) \
2638 yytoken = YYTRANSLATE (yychar); \
2644 yyerror (YY_("syntax error: cannot back up")); \
2651 #define YYERRCODE 256
2654 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2655 If N is 0, then set CURRENT to the empty location which ends
2656 the previous symbol: RHS[0] (always defined). */
2658 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2659 #ifndef YYLLOC_DEFAULT
2660 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2664 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2665 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2666 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2667 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2671 (Current).first_line = (Current).last_line = \
2672 YYRHSLOC (Rhs, 0).last_line; \
2673 (Current).first_column = (Current).last_column = \
2674 YYRHSLOC (Rhs, 0).last_column; \
2680 /* YY_LOCATION_PRINT -- Print the location on the stream.
2681 This macro was not mandated originally: define only if we know
2682 we won't break user code: when these are the locations we know. */
2684 #ifndef YY_LOCATION_PRINT
2685 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2686 # define YY_LOCATION_PRINT(File, Loc) \
2687 fprintf (File, "%d.%d-%d.%d", \
2688 (Loc).first_line, (Loc).first_column, \
2689 (Loc).last_line, (Loc).last_column)
2691 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2696 /* YYLEX -- calling `yylex' with the right arguments. */
2699 # define YYLEX yylex (YYLEX_PARAM)
2701 # define YYLEX yylex ()
2704 /* Enable debugging if requested. */
2708 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2709 # define YYFPRINTF fprintf
2712 # define YYDPRINTF(Args) \
2718 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2722 YYFPRINTF (stderr, "%s ", Title); \
2723 yy_symbol_print (stderr, \
2725 YYFPRINTF (stderr, "\n"); \
2730 /*--------------------------------.
2731 | Print this symbol on YYOUTPUT. |
2732 `--------------------------------*/
2735 #if (defined __STDC__ || defined __C99__FUNC__ \
2736 || defined __cplusplus || defined _MSC_VER)
2738 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2741 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2744 YYSTYPE const * const yyvaluep;
2750 if (yytype < YYNTOKENS)
2751 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2763 /*--------------------------------.
2764 | Print this symbol on YYOUTPUT. |
2765 `--------------------------------*/
2767 #if (defined __STDC__ || defined __C99__FUNC__ \
2768 || defined __cplusplus || defined _MSC_VER)
2770 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2773 yy_symbol_print (yyoutput, yytype, yyvaluep)
2776 YYSTYPE const * const yyvaluep;
2779 if (yytype < YYNTOKENS)
2780 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2782 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2784 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2785 YYFPRINTF (yyoutput, ")");
2788 /*------------------------------------------------------------------.
2789 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2791 `------------------------------------------------------------------*/
2793 #if (defined __STDC__ || defined __C99__FUNC__ \
2794 || defined __cplusplus || defined _MSC_VER)
2796 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2799 yy_stack_print (bottom, top)
2800 yytype_int16 *bottom;
2804 YYFPRINTF (stderr, "Stack now");
2805 for (; bottom <= top; ++bottom)
2806 YYFPRINTF (stderr, " %d", *bottom);
2807 YYFPRINTF (stderr, "\n");
2810 # define YY_STACK_PRINT(Bottom, Top) \
2813 yy_stack_print ((Bottom), (Top)); \
2817 /*------------------------------------------------.
2818 | Report that the YYRULE is going to be reduced. |
2819 `------------------------------------------------*/
2821 #if (defined __STDC__ || defined __C99__FUNC__ \
2822 || defined __cplusplus || defined _MSC_VER)
2824 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2827 yy_reduce_print (yyvsp, yyrule)
2832 int yynrhs = yyr2[yyrule];
2834 unsigned long int yylno = yyrline[yyrule];
2835 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2837 /* The symbols being reduced. */
2838 for (yyi = 0; yyi < yynrhs; yyi++)
2840 fprintf (stderr, " $%d = ", yyi + 1);
2841 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2842 &(yyvsp[(yyi + 1) - (yynrhs)])
2844 fprintf (stderr, "\n");
2848 # define YY_REDUCE_PRINT(Rule) \
2851 yy_reduce_print (yyvsp, Rule); \
2854 /* Nonzero means print parse trace. It is left uninitialized so that
2855 multiple parsers can coexist. */
2857 #else /* !YYDEBUG */
2858 # define YYDPRINTF(Args)
2859 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2860 # define YY_STACK_PRINT(Bottom, Top)
2861 # define YY_REDUCE_PRINT(Rule)
2862 #endif /* !YYDEBUG */
2865 /* YYINITDEPTH -- initial size of the parser's stacks. */
2867 # define YYINITDEPTH 200
2870 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2871 if the built-in stack extension method is used).
2873 Do not make this value too large; the results are undefined if
2874 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2875 evaluated with infinite-precision integer arithmetic. */
2878 # define YYMAXDEPTH 10000
2886 # if defined __GLIBC__ && defined _STRING_H
2887 # define yystrlen strlen
2889 /* Return the length of YYSTR. */
2890 #if (defined __STDC__ || defined __C99__FUNC__ \
2891 || defined __cplusplus || defined _MSC_VER)
2893 yystrlen (const char *yystr)
2901 for (yylen = 0; yystr[yylen]; yylen++)
2909 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2910 # define yystpcpy stpcpy
2912 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2914 #if (defined __STDC__ || defined __C99__FUNC__ \
2915 || defined __cplusplus || defined _MSC_VER)
2917 yystpcpy (char *yydest, const char *yysrc)
2920 yystpcpy (yydest, yysrc)
2926 const char *yys = yysrc;
2928 while ((*yyd++ = *yys++) != '\0')
2937 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2938 quotes and backslashes, so that it's suitable for yyerror. The
2939 heuristic is that double-quoting is unnecessary unless the string
2940 contains an apostrophe, a comma, or backslash (other than
2941 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2942 null, do not copy; instead, return the length of what the result
2945 yytnamerr (char *yyres, const char *yystr)
2950 char const *yyp = yystr;
2957 goto do_not_strip_quotes;
2961 goto do_not_strip_quotes;
2974 do_not_strip_quotes: ;
2978 return yystrlen (yystr);
2980 return yystpcpy (yyres, yystr) - yyres;
2984 /* Copy into YYRESULT an error message about the unexpected token
2985 YYCHAR while in state YYSTATE. Return the number of bytes copied,
2986 including the terminating null byte. If YYRESULT is null, do not
2987 copy anything; just return the number of bytes that would be
2988 copied. As a special case, return 0 if an ordinary "syntax error"
2989 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
2990 size calculation. */
2992 yysyntax_error (char *yyresult, int yystate, int yychar)
2994 int yyn = yypact[yystate];
2996 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3000 int yytype = YYTRANSLATE (yychar);
3001 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3002 YYSIZE_T yysize = yysize0;
3004 int yysize_overflow = 0;
3005 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3006 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3010 /* This is so xgettext sees the translatable formats that are
3011 constructed on the fly. */
3012 YY_("syntax error, unexpected %s");
3013 YY_("syntax error, unexpected %s, expecting %s");
3014 YY_("syntax error, unexpected %s, expecting %s or %s");
3015 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3016 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3020 static char const yyunexpected[] = "syntax error, unexpected %s";
3021 static char const yyexpecting[] = ", expecting %s";
3022 static char const yyor[] = " or %s";
3023 char yyformat[sizeof yyunexpected
3024 + sizeof yyexpecting - 1
3025 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3026 * (sizeof yyor - 1))];
3027 char const *yyprefix = yyexpecting;
3029 /* Start YYX at -YYN if negative to avoid negative indexes in
3031 int yyxbegin = yyn < 0 ? -yyn : 0;
3033 /* Stay within bounds of both yycheck and yytname. */
3034 int yychecklim = YYLAST - yyn + 1;
3035 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3038 yyarg[0] = yytname[yytype];
3039 yyfmt = yystpcpy (yyformat, yyunexpected);
3041 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3042 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3044 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3048 yyformat[sizeof yyunexpected - 1] = '\0';
3051 yyarg[yycount++] = yytname[yyx];
3052 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3053 yysize_overflow |= (yysize1 < yysize);
3055 yyfmt = yystpcpy (yyfmt, yyprefix);
3059 yyf = YY_(yyformat);
3060 yysize1 = yysize + yystrlen (yyf);
3061 yysize_overflow |= (yysize1 < yysize);
3064 if (yysize_overflow)
3065 return YYSIZE_MAXIMUM;
3069 /* Avoid sprintf, as that infringes on the user's name space.
3070 Don't have undefined behavior even if the translation
3071 produced a string with the wrong number of "%s"s. */
3072 char *yyp = yyresult;
3074 while ((*yyp = *yyf) != '\0')
3076 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3078 yyp += yytnamerr (yyp, yyarg[yyi++]);
3091 #endif /* YYERROR_VERBOSE */
3094 /*-----------------------------------------------.
3095 | Release the memory associated to this symbol. |
3096 `-----------------------------------------------*/
3099 #if (defined __STDC__ || defined __C99__FUNC__ \
3100 || defined __cplusplus || defined _MSC_VER)
3102 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3105 yydestruct (yymsg, yytype, yyvaluep)
3115 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3126 /* Prevent warnings from -Wmissing-prototypes. */
3128 #ifdef YYPARSE_PARAM
3129 #if defined __STDC__ || defined __cplusplus
3130 int yyparse (void *YYPARSE_PARAM);
3134 #else /* ! YYPARSE_PARAM */
3135 #if defined __STDC__ || defined __cplusplus
3140 #endif /* ! YYPARSE_PARAM */
3144 /* The look-ahead symbol. */
3147 /* The semantic value of the look-ahead symbol. */
3150 /* Number of syntax errors so far. */
3159 #ifdef YYPARSE_PARAM
3160 #if (defined __STDC__ || defined __C99__FUNC__ \
3161 || defined __cplusplus || defined _MSC_VER)
3163 yyparse (void *YYPARSE_PARAM)
3166 yyparse (YYPARSE_PARAM)
3167 void *YYPARSE_PARAM;
3169 #else /* ! YYPARSE_PARAM */
3170 #if (defined __STDC__ || defined __C99__FUNC__ \
3171 || defined __cplusplus || defined _MSC_VER)
3185 /* Number of tokens to shift before error messages enabled. */
3187 /* Look-ahead token as an internal (translated) token number. */
3190 /* Buffer for error messages, and its allocated size. */
3192 char *yymsg = yymsgbuf;
3193 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3196 /* Three stacks and their tools:
3197 `yyss': related to states,
3198 `yyvs': related to semantic values,
3199 `yyls': related to locations.
3201 Refer to the stacks thru separate pointers, to allow yyoverflow
3202 to reallocate them elsewhere. */
3204 /* The state stack. */
3205 yytype_int16 yyssa[YYINITDEPTH];
3206 yytype_int16 *yyss = yyssa;
3207 yytype_int16 *yyssp;
3209 /* The semantic value stack. */
3210 YYSTYPE yyvsa[YYINITDEPTH];
3211 YYSTYPE *yyvs = yyvsa;
3216 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3218 YYSIZE_T yystacksize = YYINITDEPTH;
3220 /* The variables used to return semantic value and location from the
3225 /* The number of symbols on the RHS of the reduced rule.
3226 Keep to zero when no symbol should be popped. */
3229 YYDPRINTF ((stderr, "Starting parse\n"));
3234 yychar = YYEMPTY; /* Cause a token to be read. */
3236 /* Initialize stack pointers.
3237 Waste one element of value and location stack
3238 so that they stay on the same level as the state stack.
3239 The wasted elements are never initialized. */
3246 /*------------------------------------------------------------.
3247 | yynewstate -- Push a new state, which is found in yystate. |
3248 `------------------------------------------------------------*/
3250 /* In all cases, when you get here, the value and location stacks
3251 have just been pushed. So pushing a state here evens the stacks. */
3257 if (yyss + yystacksize - 1 <= yyssp)
3259 /* Get the current used size of the three stacks, in elements. */
3260 YYSIZE_T yysize = yyssp - yyss + 1;
3264 /* Give user a chance to reallocate the stack. Use copies of
3265 these so that the &'s don't force the real ones into
3267 YYSTYPE *yyvs1 = yyvs;
3268 yytype_int16 *yyss1 = yyss;
3271 /* Each stack pointer address is followed by the size of the
3272 data in use in that stack, in bytes. This used to be a
3273 conditional around just the two extra args, but that might
3274 be undefined if yyoverflow is a macro. */
3275 yyoverflow (YY_("memory exhausted"),
3276 &yyss1, yysize * sizeof (*yyssp),
3277 &yyvs1, yysize * sizeof (*yyvsp),
3284 #else /* no yyoverflow */
3285 # ifndef YYSTACK_RELOCATE
3286 goto yyexhaustedlab;
3288 /* Extend the stack our own way. */
3289 if (YYMAXDEPTH <= yystacksize)
3290 goto yyexhaustedlab;
3292 if (YYMAXDEPTH < yystacksize)
3293 yystacksize = YYMAXDEPTH;
3296 yytype_int16 *yyss1 = yyss;
3297 union yyalloc *yyptr =
3298 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3300 goto yyexhaustedlab;
3301 YYSTACK_RELOCATE (yyss);
3302 YYSTACK_RELOCATE (yyvs);
3304 # undef YYSTACK_RELOCATE
3306 YYSTACK_FREE (yyss1);
3309 #endif /* no yyoverflow */
3311 yyssp = yyss + yysize - 1;
3312 yyvsp = yyvs + yysize - 1;
3315 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3316 (unsigned long int) yystacksize));
3318 if (yyss + yystacksize - 1 <= yyssp)
3322 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3331 /* Do appropriate processing given the current state. Read a
3332 look-ahead token if we need one and don't already have one. */
3334 /* First try to decide what to do without reference to look-ahead token. */
3335 yyn = yypact[yystate];
3336 if (yyn == YYPACT_NINF)
3339 /* Not known => get a look-ahead token if don't already have one. */
3341 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3342 if (yychar == YYEMPTY)
3344 YYDPRINTF ((stderr, "Reading a token: "));
3348 if (yychar <= YYEOF)
3350 yychar = yytoken = YYEOF;
3351 YYDPRINTF ((stderr, "Now at end of input.\n"));
3355 yytoken = YYTRANSLATE (yychar);
3356 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3359 /* If the proper action on seeing token YYTOKEN is to reduce or to
3360 detect an error, take that action. */
3362 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3367 if (yyn == 0 || yyn == YYTABLE_NINF)
3376 /* Count tokens shifted since error; after three, turn off error
3381 /* Shift the look-ahead token. */
3382 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3384 /* Discard the shifted token unless it is eof. */
3385 if (yychar != YYEOF)
3394 /*-----------------------------------------------------------.
3395 | yydefault -- do the default action for the current state. |
3396 `-----------------------------------------------------------*/
3398 yyn = yydefact[yystate];
3404 /*-----------------------------.
3405 | yyreduce -- Do a reduction. |
3406 `-----------------------------*/
3408 /* yyn is the number of a rule to reduce with. */
3411 /* If YYLEN is nonzero, implement the default value of the action:
3414 Otherwise, the following line sets YYVAL to garbage.
3415 This behavior is undocumented and Bison
3416 users should not rely upon it. Assigning to YYVAL
3417 unconditionally makes the parser a bit smaller, and it avoids a
3418 GCC warning that YYVAL may be used uninitialized. */
3419 yyval = yyvsp[1-yylen];
3422 YY_REDUCE_PRINT (yyn);
3426 #line 1111 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3427 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3431 #line 1111 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3432 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3436 #line 1112 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3437 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3441 #line 1112 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3442 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3446 #line 1113 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3447 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3451 #line 1113 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3452 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3456 #line 1114 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3457 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3461 #line 1114 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3462 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3466 #line 1115 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3467 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3471 #line 1115 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3472 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3476 #line 1119 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3477 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3481 #line 1119 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3482 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3486 #line 1120 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3487 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3491 #line 1120 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3492 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3496 #line 1121 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3497 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3501 #line 1121 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3502 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3506 #line 1122 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3507 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3511 #line 1122 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3512 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3516 #line 1123 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3517 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3521 #line 1123 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3522 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3526 #line 1124 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3527 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3531 #line 1124 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3532 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3536 #line 1125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3537 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3541 #line 1125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3542 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3546 #line 1126 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3547 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3551 #line 1127 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3552 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3556 #line 1136 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3557 { (yyval.StrVal) = 0; ;}
3561 #line 1140 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3563 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3569 #line 1144 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3577 #line 1152 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3585 #line 1157 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3587 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3593 #line 1163 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3594 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3598 #line 1164 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3599 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3603 #line 1165 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3604 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3608 #line 1166 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3609 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3613 #line 1167 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3614 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3618 #line 1171 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3619 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3623 #line 1172 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3624 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3628 #line 1173 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3629 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3633 #line 1177 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3634 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3638 #line 1178 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3639 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3643 #line 1179 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3644 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3648 #line 1180 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3649 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3653 #line 1184 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3654 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3658 #line 1185 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3659 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3663 #line 1186 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3664 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3668 #line 1190 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3669 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3673 #line 1191 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3674 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3678 #line 1192 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3679 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3683 #line 1193 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3684 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3688 #line 1194 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3689 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3693 #line 1198 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3694 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3698 #line 1199 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3699 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3703 #line 1200 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3704 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3708 #line 1203 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3709 { (yyval.UIntVal) = CallingConv::C; ;}
3713 #line 1204 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3714 { (yyval.UIntVal) = CallingConv::C; ;}
3718 #line 1205 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3719 { (yyval.UIntVal) = CallingConv::Fast; ;}
3723 #line 1206 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3724 { (yyval.UIntVal) = CallingConv::Cold; ;}
3728 #line 1207 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3729 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3733 #line 1208 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3734 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3738 #line 1209 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3740 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3741 GEN_ERROR("Calling conv too large");
3742 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3748 #line 1216 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3749 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3753 #line 1217 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3754 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3758 #line 1218 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3759 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3763 #line 1219 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3764 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3768 #line 1220 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3769 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3773 #line 1221 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3774 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3778 #line 1222 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3779 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3783 #line 1223 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3784 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3788 #line 1224 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3789 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3793 #line 1227 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3794 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3798 #line 1228 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3800 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3805 #line 1233 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3806 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3810 #line 1234 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3811 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3815 #line 1235 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3816 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3820 #line 1236 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3821 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3825 #line 1237 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3826 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3830 #line 1238 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3831 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3835 #line 1241 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3836 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3840 #line 1242 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3842 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3847 #line 1247 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3848 { (yyval.StrVal) = 0; ;}
3852 #line 1248 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3854 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3859 #line 1255 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3860 { (yyval.UIntVal) = 0; ;}
3864 #line 1256 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3866 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3867 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3868 GEN_ERROR("Alignment must be a power of two");
3874 #line 1262 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3875 { (yyval.UIntVal) = 0; ;}
3879 #line 1263 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3881 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3882 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3883 GEN_ERROR("Alignment must be a power of two");
3889 #line 1271 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3891 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3892 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
3893 GEN_ERROR("Invalid character in section name");
3894 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3900 #line 1279 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3901 { (yyval.StrVal) = 0; ;}
3905 #line 1280 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3906 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3910 #line 1285 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3915 #line 1286 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3920 #line 1287 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3922 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3923 delete (yyvsp[(1) - (1)].StrVal);
3929 #line 1292 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3931 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3932 GEN_ERROR("Alignment must be a power of two");
3933 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3939 #line 1308 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3941 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3947 #line 1312 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3949 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
3955 #line 1316 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3957 if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
3958 GEN_ERROR("Cannot form a pointer to a basic block");
3959 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
3960 delete (yyvsp[(1) - (2)].TypeVal);
3966 #line 1323 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3967 { // Named types are also simple types...
3968 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
3970 (yyval.TypeVal) = new PATypeHolder(tmp);
3975 #line 1328 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3976 { // Type UpReference
3977 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3978 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3979 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
3980 (yyval.TypeVal) = new PATypeHolder(OT);
3981 UR_OUT("New Upreference!\n");
3987 #line 1336 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3989 // Allow but ignore attributes on function types; this permits auto-upgrade.
3990 // FIXME: remove in LLVM 3.0.
3991 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
3992 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
3993 isa<OpaqueType>(RetTy)))
3994 GEN_ERROR("LLVM Functions cannot return aggregates");
3996 std::vector<const Type*> Params;
3997 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
3998 for (; I != E; ++I ) {
3999 const Type *Ty = I->Ty->get();
4000 Params.push_back(Ty);
4003 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4004 if (isVarArg) Params.pop_back();
4006 for (unsigned i = 0; i != Params.size(); ++i)
4007 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4008 GEN_ERROR("Function arguments must be value types!");
4012 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4013 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4014 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4015 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4021 #line 1366 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4023 // Allow but ignore attributes on function types; this permits auto-upgrade.
4024 // FIXME: remove in LLVM 3.0.
4025 std::vector<const Type*> Params;
4026 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4027 for ( ; I != E; ++I ) {
4028 const Type* Ty = I->Ty->get();
4029 Params.push_back(Ty);
4032 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4033 if (isVarArg) Params.pop_back();
4035 for (unsigned i = 0; i != Params.size(); ++i)
4036 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4037 GEN_ERROR("Function arguments must be value types!");
4041 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4042 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4043 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
4049 #line 1391 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4050 { // Sized array type?
4051 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4052 delete (yyvsp[(4) - (5)].TypeVal);
4058 #line 1396 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4060 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4061 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4062 GEN_ERROR("Unsigned result not equal to signed result");
4063 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4064 GEN_ERROR("Element type of a VectorType must be primitive");
4065 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4066 delete (yyvsp[(4) - (5)].TypeVal);
4072 #line 1406 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4073 { // Structure type?
4074 std::vector<const Type*> Elements;
4075 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4076 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4077 Elements.push_back(*I);
4079 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4080 delete (yyvsp[(2) - (3)].TypeList);
4086 #line 1416 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4087 { // Empty structure type?
4088 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4094 #line 1420 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4096 std::vector<const Type*> Elements;
4097 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4098 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4099 Elements.push_back(*I);
4101 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4102 delete (yyvsp[(3) - (5)].TypeList);
4108 #line 1430 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4109 { // Empty structure type?
4110 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4116 #line 1437 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4118 // Allow but ignore attributes on function types; this permits auto-upgrade.
4119 // FIXME: remove in LLVM 3.0.
4120 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4121 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4126 #line 1446 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4128 if (!UpRefs.empty())
4129 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4130 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
4131 GEN_ERROR("LLVM functions cannot return aggregate types");
4132 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4137 #line 1453 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4139 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4144 #line 1458 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4146 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4147 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4153 #line 1463 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4155 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4161 #line 1471 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4163 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4164 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4165 TWA.Ty = new PATypeHolder(Type::VoidTy);
4166 (yyval.TypeWithAttrsList)->push_back(TWA);
4172 #line 1478 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4174 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4175 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4176 TWA.Ty = new PATypeHolder(Type::VoidTy);
4177 (yyval.TypeWithAttrsList)->push_back(TWA);
4183 #line 1485 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4185 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4191 #line 1493 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4193 (yyval.TypeList) = new std::list<PATypeHolder>();
4194 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4195 delete (yyvsp[(1) - (1)].TypeVal);
4201 #line 1499 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4203 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4204 delete (yyvsp[(3) - (3)].TypeVal);
4210 #line 1511 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4211 { // Nonempty unsized arr
4212 if (!UpRefs.empty())
4213 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4214 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4216 GEN_ERROR("Cannot make array constant with type: '" +
4217 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4218 const Type *ETy = ATy->getElementType();
4219 int NumElements = ATy->getNumElements();
4221 // Verify that we have the correct size...
4222 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4223 GEN_ERROR("Type mismatch: constant sized array initialized with " +
4224 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4225 itostr(NumElements) + "");
4227 // Verify all elements are correct type!
4228 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4229 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4230 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4231 ETy->getDescription() +"' as required!\nIt is of type '"+
4232 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4235 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4236 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4242 #line 1539 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4244 if (!UpRefs.empty())
4245 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4246 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4248 GEN_ERROR("Cannot make array constant with type: '" +
4249 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4251 int NumElements = ATy->getNumElements();
4252 if (NumElements != -1 && NumElements != 0)
4253 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4254 " arguments, but has size of " + itostr(NumElements) +"");
4255 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4256 delete (yyvsp[(1) - (3)].TypeVal);
4262 #line 1555 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4264 if (!UpRefs.empty())
4265 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4266 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4268 GEN_ERROR("Cannot make array constant with type: '" +
4269 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4271 int NumElements = ATy->getNumElements();
4272 const Type *ETy = ATy->getElementType();
4273 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4274 GEN_ERROR("Can't build string constant of size " +
4275 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4276 " when array has size " + itostr(NumElements) + "");
4277 std::vector<Constant*> Vals;
4278 if (ETy == Type::Int8Ty) {
4279 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4280 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4282 delete (yyvsp[(3) - (3)].StrVal);
4283 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4285 delete (yyvsp[(3) - (3)].StrVal);
4286 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4287 delete (yyvsp[(1) - (3)].TypeVal);
4293 #line 1582 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4294 { // Nonempty unsized arr
4295 if (!UpRefs.empty())
4296 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4297 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4299 GEN_ERROR("Cannot make packed constant with type: '" +
4300 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4301 const Type *ETy = PTy->getElementType();
4302 int NumElements = PTy->getNumElements();
4304 // Verify that we have the correct size...
4305 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4306 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4307 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
4308 itostr(NumElements) + "");
4310 // Verify all elements are correct type!
4311 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4312 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4313 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4314 ETy->getDescription() +"' as required!\nIt is of type '"+
4315 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4318 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4319 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4325 #line 1610 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4327 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4329 GEN_ERROR("Cannot make struct constant with type: '" +
4330 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4332 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4333 GEN_ERROR("Illegal number of initializers for structure type");
4335 // Check to ensure that constants are compatible with the type initializer!
4336 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4337 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4338 GEN_ERROR("Expected type '" +
4339 STy->getElementType(i)->getDescription() +
4340 "' for element #" + utostr(i) +
4341 " of structure initializer");
4343 // Check to ensure that Type is not packed
4344 if (STy->isPacked())
4345 GEN_ERROR("Unpacked Initializer to vector type '" +
4346 STy->getDescription() + "'");
4348 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4349 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4355 #line 1636 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4357 if (!UpRefs.empty())
4358 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4359 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4361 GEN_ERROR("Cannot make struct constant with type: '" +
4362 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4364 if (STy->getNumContainedTypes() != 0)
4365 GEN_ERROR("Illegal number of initializers for structure type");
4367 // Check to ensure that Type is not packed
4368 if (STy->isPacked())
4369 GEN_ERROR("Unpacked Initializer to vector type '" +
4370 STy->getDescription() + "'");
4372 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4373 delete (yyvsp[(1) - (3)].TypeVal);
4379 #line 1656 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4381 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4383 GEN_ERROR("Cannot make struct constant with type: '" +
4384 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4386 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4387 GEN_ERROR("Illegal number of initializers for structure type");
4389 // Check to ensure that constants are compatible with the type initializer!
4390 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4391 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4392 GEN_ERROR("Expected type '" +
4393 STy->getElementType(i)->getDescription() +
4394 "' for element #" + utostr(i) +
4395 " of structure initializer");
4397 // Check to ensure that Type is packed
4398 if (!STy->isPacked())
4399 GEN_ERROR("Vector initializer to non-vector type '" +
4400 STy->getDescription() + "'");
4402 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4403 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4409 #line 1682 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4411 if (!UpRefs.empty())
4412 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4413 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4415 GEN_ERROR("Cannot make struct constant with type: '" +
4416 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4418 if (STy->getNumContainedTypes() != 0)
4419 GEN_ERROR("Illegal number of initializers for structure type");
4421 // Check to ensure that Type is packed
4422 if (!STy->isPacked())
4423 GEN_ERROR("Vector initializer to non-vector type '" +
4424 STy->getDescription() + "'");
4426 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4427 delete (yyvsp[(1) - (5)].TypeVal);
4433 #line 1702 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4435 if (!UpRefs.empty())
4436 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4437 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4439 GEN_ERROR("Cannot make null pointer constant with type: '" +
4440 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4442 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4443 delete (yyvsp[(1) - (2)].TypeVal);
4449 #line 1714 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4451 if (!UpRefs.empty())
4452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4453 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4454 delete (yyvsp[(1) - (2)].TypeVal);
4460 #line 1721 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4462 if (!UpRefs.empty())
4463 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4464 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4466 GEN_ERROR("Global const reference must be a pointer type");
4468 // ConstExprs can exist in the body of a function, thus creating
4469 // GlobalValues whenever they refer to a variable. Because we are in
4470 // the context of a function, getExistingVal will search the functions
4471 // symbol table instead of the module symbol table for the global symbol,
4472 // which throws things all off. To get around this, we just tell
4473 // getExistingVal that we are at global scope here.
4475 Function *SavedCurFn = CurFun.CurrentFunction;
4476 CurFun.CurrentFunction = 0;
4478 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4481 CurFun.CurrentFunction = SavedCurFn;
4483 // If this is an initializer for a constant pointer, which is referencing a
4484 // (currently) undefined variable, create a stub now that shall be replaced
4485 // in the future with the right type of variable.
4488 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4489 const PointerType *PT = cast<PointerType>(Ty);
4491 // First check to see if the forward references value is already created!
4492 PerModuleInfo::GlobalRefsType::iterator I =
4493 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4495 if (I != CurModule.GlobalRefs.end()) {
4496 V = I->second; // Placeholder already exists, use it...
4497 (yyvsp[(2) - (2)].ValIDVal).destroy();
4500 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4501 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4502 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4503 GEN_ERROR("Invalid reference to global");
4505 // Create the forward referenced global.
4507 if (const FunctionType *FTy =
4508 dyn_cast<FunctionType>(PT->getElementType())) {
4509 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4510 CurModule.CurrentModule);
4512 GV = new GlobalVariable(PT->getElementType(), false,
4513 GlobalValue::ExternalWeakLinkage, 0,
4514 Name, CurModule.CurrentModule);
4517 // Keep track of the fact that we have a forward ref to recycle it
4518 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4523 (yyval.ConstVal) = cast<GlobalValue>(V);
4524 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
4530 #line 1787 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4532 if (!UpRefs.empty())
4533 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4534 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4535 GEN_ERROR("Mismatched types for constant expression: " +
4536 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4537 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4538 delete (yyvsp[(1) - (2)].TypeVal);
4544 #line 1797 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4546 if (!UpRefs.empty())
4547 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4548 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4549 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4550 GEN_ERROR("Cannot create a null initialized value of this type");
4551 (yyval.ConstVal) = Constant::getNullValue(Ty);
4552 delete (yyvsp[(1) - (2)].TypeVal);
4558 #line 1807 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4559 { // integral constants
4560 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4561 GEN_ERROR("Constant value doesn't fit in type");
4562 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4568 #line 1813 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4569 { // arbitrary precision integer constants
4570 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4571 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4572 GEN_ERROR("Constant value does not fit in type");
4574 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4575 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4576 delete (yyvsp[(2) - (2)].APIntVal);
4582 #line 1823 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4583 { // integral constants
4584 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4585 GEN_ERROR("Constant value doesn't fit in type");
4586 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4592 #line 1829 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4593 { // arbitrary precision integer constants
4594 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4595 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4596 GEN_ERROR("Constant value does not fit in type");
4598 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4599 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4600 delete (yyvsp[(2) - (2)].APIntVal);
4606 #line 1839 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4607 { // Boolean constants
4608 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4609 (yyval.ConstVal) = ConstantInt::getTrue();
4615 #line 1844 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4616 { // Boolean constants
4617 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4618 (yyval.ConstVal) = ConstantInt::getFalse();
4624 #line 1849 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4625 { // Floating point constants
4626 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4627 GEN_ERROR("Floating point constant invalid for type");
4628 // Lexer has no type info, so builds all float and double FP constants
4629 // as double. Fix this here. Long double is done right.
4630 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4631 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4632 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4633 delete (yyvsp[(2) - (2)].FPVal);
4639 #line 1862 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4641 if (!UpRefs.empty())
4642 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4643 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4644 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4645 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4646 GEN_ERROR("invalid cast opcode for cast from '" +
4647 Val->getType()->getDescription() + "' to '" +
4648 DestTy->getDescription() + "'");
4649 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4650 delete (yyvsp[(5) - (6)].TypeVal);
4655 #line 1874 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4657 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4658 GEN_ERROR("GetElementPtr requires a pointer operand");
4661 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
4664 GEN_ERROR("Index list invalid for constant getelementptr");
4666 SmallVector<Constant*, 8> IdxVec;
4667 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4668 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4669 IdxVec.push_back(C);
4671 GEN_ERROR("Indices to constant getelementptr must be constants");
4673 delete (yyvsp[(4) - (5)].ValueList);
4675 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4681 #line 1896 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4683 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4684 GEN_ERROR("Select condition must be of boolean type");
4685 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4686 GEN_ERROR("Select operand types must match");
4687 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4693 #line 1904 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4695 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4696 GEN_ERROR("Binary operator types must match");
4698 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4703 #line 1910 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4705 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4706 GEN_ERROR("Logical operator types must match");
4707 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4708 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4709 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4710 GEN_ERROR("Logical operator requires integral operands");
4712 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4718 #line 1921 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4720 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4721 GEN_ERROR("icmp operand types must match");
4722 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4727 #line 1926 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4729 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4730 GEN_ERROR("fcmp operand types must match");
4731 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4736 #line 1931 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4738 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4739 GEN_ERROR("Invalid extractelement operands");
4740 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4746 #line 1937 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4748 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4749 GEN_ERROR("Invalid insertelement operands");
4750 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4756 #line 1943 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4758 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4759 GEN_ERROR("Invalid shufflevector operands");
4760 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4766 #line 1952 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4768 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4774 #line 1956 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4776 (yyval.ConstVector) = new std::vector<Constant*>();
4777 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4783 #line 1964 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4784 { (yyval.BoolVal) = false; ;}
4788 #line 1964 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4789 { (yyval.BoolVal) = true; ;}
4793 #line 1967 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4794 { (yyval.BoolVal) = true; ;}
4798 #line 1967 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4799 { (yyval.BoolVal) = false; ;}
4803 #line 1970 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4805 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4806 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
4808 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4810 GEN_ERROR("Aliases can be created only to global values");
4812 (yyval.ConstVal) = Aliasee;
4814 delete (yyvsp[(1) - (2)].TypeVal);
4819 #line 1982 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4821 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4822 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4823 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4824 GEN_ERROR("invalid cast opcode for cast from '" +
4825 Val->getType()->getDescription() + "' to '" +
4826 DestTy->getDescription() + "'");
4828 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4830 delete (yyvsp[(5) - (6)].TypeVal);
4835 #line 2003 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4837 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4838 CurModule.ModuleDone();
4844 #line 2008 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4846 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4847 CurModule.ModuleDone();
4853 #line 2021 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4854 { CurFun.isDeclare = false; ;}
4858 #line 2021 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4860 CurFun.FunctionDone();
4866 #line 2025 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4867 { CurFun.isDeclare = true; ;}
4871 #line 2025 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4878 #line 2028 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4885 #line 2031 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4887 if (!UpRefs.empty())
4888 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
4889 // Eagerly resolve types. This is not an optimization, this is a
4890 // requirement that is due to the fact that we could have this:
4892 // %list = type { %list * }
4893 // %list = type { %list * } ; repeated type decl
4895 // If types are not resolved eagerly, then the two types will not be
4896 // determined to be the same type!
4898 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
4900 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4902 // If this is a named type that is not a redefinition, add it to the slot
4904 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
4907 delete (yyvsp[(3) - (3)].TypeVal);
4913 #line 2055 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4915 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4917 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4919 // If this is a named type that is not a redefinition, add it to the slot
4921 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4928 #line 2066 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4930 /* "Externally Visible" Linkage */
4931 if ((yyvsp[(5) - (5)].ConstVal) == 0)
4932 GEN_ERROR("Global value initializer is not a constant");
4933 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), GlobalValue::ExternalLinkage,
4934 (yyvsp[(2) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal), (yyvsp[(3) - (5)].BoolVal));
4940 #line 2073 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4947 #line 2077 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4949 if ((yyvsp[(6) - (6)].ConstVal) == 0)
4950 GEN_ERROR("Global value initializer is not a constant");
4951 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));
4957 #line 2082 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4964 #line 2086 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4966 if (!UpRefs.empty())
4967 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription());
4968 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));
4970 delete (yyvsp[(6) - (6)].TypeVal);
4975 #line 2092 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4983 #line 2096 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4986 if ((yyvsp[(1) - (5)].StrVal)) {
4987 Name = *(yyvsp[(1) - (5)].StrVal);
4988 delete (yyvsp[(1) - (5)].StrVal);
4991 GEN_ERROR("Alias name cannot be empty");
4993 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
4995 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4997 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
4998 CurModule.CurrentModule);
4999 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5000 InsertValue(GA, CurModule.Values);
5003 // If there was a forward reference of this alias, resolve it now.
5007 ID = ValID::createGlobalName(Name);
5009 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5011 if (GlobalValue *FWGV =
5012 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5013 // Replace uses of the fwdref with the actual alias.
5014 FWGV->replaceAllUsesWith(GA);
5015 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5016 GV->eraseFromParent();
5018 cast<Function>(FWGV)->eraseFromParent();
5027 #line 2136 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5034 #line 2139 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5041 #line 2145 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5043 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5044 if (AsmSoFar.empty())
5045 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5047 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5048 delete (yyvsp[(1) - (1)].StrVal);
5054 #line 2155 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5056 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5057 delete (yyvsp[(3) - (3)].StrVal);
5062 #line 2159 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5064 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5065 delete (yyvsp[(3) - (3)].StrVal);
5070 #line 2166 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5072 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5073 delete (yyvsp[(3) - (3)].StrVal);
5079 #line 2171 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5081 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5082 delete (yyvsp[(1) - (1)].StrVal);
5088 #line 2176 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5095 #line 2185 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5097 if (!UpRefs.empty())
5098 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5099 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5100 GEN_ERROR("void typed arguments are invalid");
5101 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5102 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5103 (yyvsp[(1) - (5)].ArgList)->push_back(E);
5109 #line 2195 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5111 if (!UpRefs.empty())
5112 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5113 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5114 GEN_ERROR("void typed arguments are invalid");
5115 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5116 (yyval.ArgList) = new ArgListType;
5117 (yyval.ArgList)->push_back(E);
5123 #line 2206 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5125 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5131 #line 2210 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5133 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5134 struct ArgListEntry E;
5135 E.Ty = new PATypeHolder(Type::VoidTy);
5137 E.Attrs = ParamAttr::None;
5138 (yyval.ArgList)->push_back(E);
5144 #line 2219 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5146 (yyval.ArgList) = new ArgListType;
5147 struct ArgListEntry E;
5148 E.Ty = new PATypeHolder(Type::VoidTy);
5150 E.Attrs = ParamAttr::None;
5151 (yyval.ArgList)->push_back(E);
5157 #line 2228 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5159 (yyval.ArgList) = 0;
5165 #line 2234 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5167 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5168 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
5170 // Check the function result for abstractness if this is a define. We should
5171 // have no abstract types at this point
5172 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5173 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5175 std::vector<const Type*> ParamTypeList;
5176 ParamAttrsVector Attrs;
5177 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
5178 ParamAttrsWithIndex PAWI;
5180 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
5181 Attrs.push_back(PAWI);
5183 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
5185 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5186 const Type* Ty = I->Ty->get();
5187 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5188 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5189 ParamTypeList.push_back(Ty);
5190 if (Ty != Type::VoidTy)
5191 if (I->Attrs != ParamAttr::None) {
5192 ParamAttrsWithIndex PAWI;
5194 PAWI.attrs = I->Attrs;
5195 Attrs.push_back(PAWI);
5200 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5201 if (isVarArg) ParamTypeList.pop_back();
5203 const ParamAttrsList *PAL = 0;
5205 PAL = ParamAttrsList::get(Attrs);
5207 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5208 const PointerType *PFT = PointerType::get(FT);
5209 delete (yyvsp[(2) - (10)].TypeVal);
5212 if (!FunctionName.empty()) {
5213 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5215 ID = ValID::createGlobalID(CurModule.Values.size());
5219 // See if this function was forward referenced. If so, recycle the object.
5220 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5221 // Move the function to the end of the list, from whereever it was
5222 // previously inserted.
5223 Fn = cast<Function>(FWRef);
5224 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
5225 CurModule.CurrentModule->getFunctionList().remove(Fn);
5226 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5227 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5228 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5229 if (Fn->getFunctionType() != FT ) {
5230 // The existing function doesn't have the same type. This is an overload
5232 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5233 } else if (Fn->getParamAttrs() != PAL) {
5234 // The existing function doesn't have the same parameter attributes.
5235 // This is an overload error.
5236 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5237 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5238 // Neither the existing or the current function is a declaration and they
5239 // have the same name and same type. Clearly this is a redefinition.
5240 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5241 } else if (Fn->isDeclaration()) {
5242 // Make sure to strip off any argument names so we can't get conflicts.
5243 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5247 } else { // Not already defined?
5248 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5249 CurModule.CurrentModule);
5250 InsertValue(Fn, CurModule.Values);
5253 CurFun.FunctionStart(Fn);
5255 if (CurFun.isDeclare) {
5256 // If we have declaration, always overwrite linkage. This will allow us to
5257 // correctly handle cases, when pointer to function is passed as argument to
5258 // another function.
5259 Fn->setLinkage(CurFun.Linkage);
5260 Fn->setVisibility(CurFun.Visibility);
5262 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5263 Fn->setParamAttrs(PAL);
5264 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5265 if ((yyvsp[(8) - (10)].StrVal)) {
5266 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5267 delete (yyvsp[(8) - (10)].StrVal);
5269 if ((yyvsp[(10) - (10)].StrVal)) {
5270 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5271 delete (yyvsp[(10) - (10)].StrVal);
5274 // Add all of the arguments we parsed to the function...
5275 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
5276 if (isVarArg) { // Nuke the last entry
5277 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5278 "Not a varargs marker!");
5279 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5280 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
5282 Function::arg_iterator ArgIt = Fn->arg_begin();
5283 Function::arg_iterator ArgEnd = Fn->arg_end();
5285 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5286 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5287 delete I->Ty; // Delete the typeholder...
5288 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5294 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
5301 #line 2369 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5303 (yyval.FunctionVal) = CurFun.CurrentFunction;
5305 // Make sure that we keep track of the linkage type even if there was a
5306 // previous "declare".
5307 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5308 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5313 #line 2380 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5315 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5321 #line 2385 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5323 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5324 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5325 (yyval.FunctionVal) = CurFun.CurrentFunction;
5326 CurFun.FunctionDone();
5332 #line 2397 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5334 (yyval.BoolVal) = false;
5340 #line 2401 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5342 (yyval.BoolVal) = true;
5348 #line 2406 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5349 { // A reference to a direct constant
5350 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5356 #line 2410 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5358 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5364 #line 2414 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5365 { // Perhaps it's an FP constant?
5366 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5372 #line 2418 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5374 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5380 #line 2422 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5382 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5388 #line 2426 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5390 (yyval.ValIDVal) = ValID::createNull();
5396 #line 2430 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5398 (yyval.ValIDVal) = ValID::createUndef();
5404 #line 2434 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5405 { // A vector zero constant.
5406 (yyval.ValIDVal) = ValID::createZeroInit();
5412 #line 2438 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5413 { // Nonempty unsized packed vector
5414 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5415 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5417 VectorType* pt = VectorType::get(ETy, NumElements);
5418 PATypeHolder* PTy = new PATypeHolder(
5426 // Verify all elements are correct type!
5427 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5428 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5429 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5430 ETy->getDescription() +"' as required!\nIt is of type '" +
5431 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5434 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5435 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5441 #line 2463 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5443 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5449 #line 2467 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5451 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5452 delete (yyvsp[(3) - (5)].StrVal);
5453 delete (yyvsp[(5) - (5)].StrVal);
5459 #line 2477 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5460 { // Is it an integer reference...?
5461 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5467 #line 2481 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5469 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5475 #line 2485 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5476 { // Is it a named reference...?
5477 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5478 delete (yyvsp[(1) - (1)].StrVal);
5484 #line 2490 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5485 { // Is it a named reference...?
5486 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5487 delete (yyvsp[(1) - (1)].StrVal);
5493 #line 2503 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5495 if (!UpRefs.empty())
5496 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5497 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5498 delete (yyvsp[(1) - (2)].TypeVal);
5504 #line 2512 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5506 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5512 #line 2516 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5513 { // Do not allow functions with 0 basic blocks
5514 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5520 #line 2525 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5522 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5524 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5525 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5526 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5532 #line 2534 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5534 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5535 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5536 if (CI2->getParent() == 0)
5537 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5538 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5539 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5545 #line 2543 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5546 { // Empty space between instruction lists
5547 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5553 #line 2547 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5554 { // Labelled (named) basic block
5555 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5556 delete (yyvsp[(1) - (1)].StrVal);
5563 #line 2554 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5564 { // Return with a result...
5565 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5571 #line 2558 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5572 { // Return with no result...
5573 (yyval.TermInstVal) = new ReturnInst();
5579 #line 2562 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5580 { // Unconditional Branch...
5581 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5583 (yyval.TermInstVal) = new BranchInst(tmpBB);
5588 #line 2567 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5590 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5591 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5593 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5595 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5597 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5602 #line 2577 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5604 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5606 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5608 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5609 (yyval.TermInstVal) = S;
5611 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5612 E = (yyvsp[(8) - (9)].JumpTable)->end();
5613 for (; I != E; ++I) {
5614 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5615 S->addCase(CI, I->second);
5617 GEN_ERROR("Switch case is constant, but not a simple integer");
5619 delete (yyvsp[(8) - (9)].JumpTable);
5625 #line 2596 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5627 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5629 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5631 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5632 (yyval.TermInstVal) = S;
5638 #line 2606 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5641 // Handle the short syntax
5642 const PointerType *PFTy = 0;
5643 const FunctionType *Ty = 0;
5644 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5645 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5646 // Pull out the types of all of the arguments...
5647 std::vector<const Type*> ParamTypes;
5648 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5649 for (; I != E; ++I) {
5650 const Type *Ty = I->Val->getType();
5651 if (Ty == Type::VoidTy)
5652 GEN_ERROR("Short call syntax cannot be used with varargs");
5653 ParamTypes.push_back(Ty);
5655 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5656 PFTy = PointerType::get(Ty);
5659 delete (yyvsp[(3) - (14)].TypeVal);
5661 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
5663 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5665 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5668 ParamAttrsVector Attrs;
5669 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5670 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5671 Attrs.push_back(PAWI);
5674 // Check the arguments
5676 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
5677 // Make sure no arguments is a good thing!
5678 if (Ty->getNumParams() != 0)
5679 GEN_ERROR("No arguments passed to a function that "
5680 "expects arguments");
5681 } else { // Has arguments?
5682 // Loop through FunctionType's arguments and ensure they are specified
5684 FunctionType::param_iterator I = Ty->param_begin();
5685 FunctionType::param_iterator E = Ty->param_end();
5686 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5689 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5690 if (ArgI->Val->getType() != *I)
5691 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5692 (*I)->getDescription() + "'");
5693 Args.push_back(ArgI->Val);
5694 if (ArgI->Attrs != ParamAttr::None) {
5695 ParamAttrsWithIndex PAWI;
5697 PAWI.attrs = ArgI->Attrs;
5698 Attrs.push_back(PAWI);
5702 if (Ty->isVarArg()) {
5704 for (; ArgI != ArgE; ++ArgI)
5705 Args.push_back(ArgI->Val); // push the remaining varargs
5706 } else if (I != E || ArgI != ArgE)
5707 GEN_ERROR("Invalid number of parameters detected");
5710 const ParamAttrsList *PAL = 0;
5712 PAL = ParamAttrsList::get(Attrs);
5714 // Create the InvokeInst
5715 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
5716 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5717 II->setParamAttrs(PAL);
5718 (yyval.TermInstVal) = II;
5719 delete (yyvsp[(6) - (14)].ParamList);
5725 #line 2689 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5727 (yyval.TermInstVal) = new UnwindInst();
5733 #line 2693 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5735 (yyval.TermInstVal) = new UnreachableInst();
5741 #line 2700 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5743 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5744 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5747 GEN_ERROR("May only switch on a constant pool value");
5749 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5751 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5756 #line 2711 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5758 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5759 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5763 GEN_ERROR("May only switch on a constant pool value");
5765 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5767 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5772 #line 2724 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5774 // Is this definition named?? if so, assign the name...
5775 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5777 InsertValue((yyvsp[(2) - (2)].InstVal));
5778 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
5784 #line 2734 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5785 { // Used for PHI nodes
5786 if (!UpRefs.empty())
5787 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5788 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5789 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
5791 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5793 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5794 delete (yyvsp[(1) - (6)].TypeVal);
5799 #line 2745 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5801 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5802 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5804 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5806 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5811 #line 2755 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5813 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5814 if (!UpRefs.empty())
5815 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
5816 // Used for call and invoke instructions
5817 (yyval.ParamList) = new ParamList();
5818 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5819 (yyval.ParamList)->push_back(E);
5820 delete (yyvsp[(1) - (4)].TypeVal);
5826 #line 2766 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5828 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5829 // Labels are only valid in ASMs
5830 (yyval.ParamList) = new ParamList();
5831 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5832 (yyval.ParamList)->push_back(E);
5838 #line 2774 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5840 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5841 if (!UpRefs.empty())
5842 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5843 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5844 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5845 (yyval.ParamList)->push_back(E);
5846 delete (yyvsp[(3) - (6)].TypeVal);
5852 #line 2784 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5854 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5855 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5856 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5857 (yyval.ParamList)->push_back(E);
5863 #line 2791 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5864 { (yyval.ParamList) = new ParamList(); ;}
5868 #line 2794 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5869 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5873 #line 2795 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5875 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5876 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
5882 #line 2802 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5884 (yyval.BoolVal) = true;
5890 #line 2806 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5892 (yyval.BoolVal) = false;
5898 #line 2811 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5900 if (!UpRefs.empty())
5901 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5902 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5903 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
5905 "Arithmetic operator requires integer, FP, or packed operands");
5906 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5908 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5910 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5911 if ((yyval.InstVal) == 0)
5912 GEN_ERROR("binary operator returned null");
5913 delete (yyvsp[(2) - (5)].TypeVal);
5918 #line 2827 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5920 if (!UpRefs.empty())
5921 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5922 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5923 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5924 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5925 GEN_ERROR("Logical operator requires integral operands");
5927 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5929 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5931 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5932 if ((yyval.InstVal) == 0)
5933 GEN_ERROR("binary operator returned null");
5934 delete (yyvsp[(2) - (5)].TypeVal);
5939 #line 2844 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5941 if (!UpRefs.empty())
5942 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5943 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5944 GEN_ERROR("Vector types not supported by icmp instruction");
5945 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5947 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5949 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
5950 if ((yyval.InstVal) == 0)
5951 GEN_ERROR("icmp operator returned null");
5952 delete (yyvsp[(3) - (6)].TypeVal);
5957 #line 2858 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5959 if (!UpRefs.empty())
5960 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5961 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
5962 GEN_ERROR("Vector types not supported by fcmp instruction");
5963 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
5965 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5967 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
5968 if ((yyval.InstVal) == 0)
5969 GEN_ERROR("fcmp operator returned null");
5970 delete (yyvsp[(3) - (6)].TypeVal);
5975 #line 2872 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5977 if (!UpRefs.empty())
5978 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5979 Value* Val = (yyvsp[(2) - (4)].ValueVal);
5980 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
5981 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
5982 GEN_ERROR("invalid cast opcode for cast from '" +
5983 Val->getType()->getDescription() + "' to '" +
5984 DestTy->getDescription() + "'");
5985 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
5986 delete (yyvsp[(4) - (4)].TypeVal);
5991 #line 2884 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
5993 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
5994 GEN_ERROR("select condition must be boolean");
5995 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
5996 GEN_ERROR("select value types should match");
5997 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6003 #line 2892 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6005 if (!UpRefs.empty())
6006 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6007 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6008 delete (yyvsp[(4) - (4)].TypeVal);
6014 #line 2899 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6016 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6017 GEN_ERROR("Invalid extractelement operands");
6018 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6024 #line 2905 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6026 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6027 GEN_ERROR("Invalid insertelement operands");
6028 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6034 #line 2911 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6036 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6037 GEN_ERROR("Invalid shufflevector operands");
6038 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6044 #line 2917 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6046 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6047 if (!Ty->isFirstClassType())
6048 GEN_ERROR("PHI node operands must be of first class type");
6049 (yyval.InstVal) = new PHINode(Ty);
6050 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6051 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6052 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
6053 GEN_ERROR("All elements of a PHI node must be of the same type");
6054 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6055 (yyvsp[(2) - (2)].PHIList)->pop_front();
6057 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
6063 #line 2933 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6066 // Handle the short syntax
6067 const PointerType *PFTy = 0;
6068 const FunctionType *Ty = 0;
6069 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6070 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6071 // Pull out the types of all of the arguments...
6072 std::vector<const Type*> ParamTypes;
6073 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6074 for (; I != E; ++I) {
6075 const Type *Ty = I->Val->getType();
6076 if (Ty == Type::VoidTy)
6077 GEN_ERROR("Short call syntax cannot be used with varargs");
6078 ParamTypes.push_back(Ty);
6080 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6081 PFTy = PointerType::get(Ty);
6084 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
6087 // Check for call to invalid intrinsic to avoid crashing later.
6088 if (Function *theF = dyn_cast<Function>(V)) {
6089 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6090 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6091 !theF->getIntrinsicID(true))
6092 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6093 theF->getName() + "'");
6096 // Set up the ParamAttrs for the function
6097 ParamAttrsVector Attrs;
6098 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6099 ParamAttrsWithIndex PAWI;
6101 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6102 Attrs.push_back(PAWI);
6104 // Check the arguments
6106 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
6107 // Make sure no arguments is a good thing!
6108 if (Ty->getNumParams() != 0)
6109 GEN_ERROR("No arguments passed to a function that "
6110 "expects arguments");
6111 } else { // Has arguments?
6112 // Loop through FunctionType's arguments and ensure they are specified
6113 // correctly. Also, gather any parameter attributes.
6114 FunctionType::param_iterator I = Ty->param_begin();
6115 FunctionType::param_iterator E = Ty->param_end();
6116 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6119 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6120 if (ArgI->Val->getType() != *I)
6121 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6122 (*I)->getDescription() + "'");
6123 Args.push_back(ArgI->Val);
6124 if (ArgI->Attrs != ParamAttr::None) {
6125 ParamAttrsWithIndex PAWI;
6127 PAWI.attrs = ArgI->Attrs;
6128 Attrs.push_back(PAWI);
6131 if (Ty->isVarArg()) {
6133 for (; ArgI != ArgE; ++ArgI)
6134 Args.push_back(ArgI->Val); // push the remaining varargs
6135 } else if (I != E || ArgI != ArgE)
6136 GEN_ERROR("Invalid number of parameters detected");
6139 // Finish off the ParamAttrs and check them
6140 const ParamAttrsList *PAL = 0;
6142 PAL = ParamAttrsList::get(Attrs);
6144 // Create the call node
6145 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
6146 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6147 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6148 CI->setParamAttrs(PAL);
6149 (yyval.InstVal) = CI;
6150 delete (yyvsp[(6) - (8)].ParamList);
6151 delete (yyvsp[(3) - (8)].TypeVal);
6157 #line 3023 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6159 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6165 #line 3028 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6167 (yyval.BoolVal) = true;
6173 #line 3032 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6175 (yyval.BoolVal) = false;
6181 #line 3039 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6183 if (!UpRefs.empty())
6184 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6185 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6186 delete (yyvsp[(2) - (3)].TypeVal);
6192 #line 3046 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6194 if (!UpRefs.empty())
6195 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6196 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6198 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6199 delete (yyvsp[(2) - (6)].TypeVal);
6204 #line 3054 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6206 if (!UpRefs.empty())
6207 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6208 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6209 delete (yyvsp[(2) - (3)].TypeVal);
6215 #line 3061 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6217 if (!UpRefs.empty())
6218 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6219 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6221 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6222 delete (yyvsp[(2) - (6)].TypeVal);
6227 #line 3069 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6229 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6230 GEN_ERROR("Trying to free nonpointer type " +
6231 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6232 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6238 #line 3077 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6240 if (!UpRefs.empty())
6241 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6242 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6243 GEN_ERROR("Can't load from nonpointer type: " +
6244 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6245 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6246 GEN_ERROR("Can't load from pointer of non-first-class type: " +
6247 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6248 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6250 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6251 delete (yyvsp[(3) - (5)].TypeVal);
6256 #line 3091 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6258 if (!UpRefs.empty())
6259 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6260 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6262 GEN_ERROR("Can't store to a nonpointer type: " +
6263 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6264 const Type *ElTy = PT->getElementType();
6265 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6266 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6267 "' into space of type '" + ElTy->getDescription() + "'");
6269 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6271 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6272 delete (yyvsp[(5) - (7)].TypeVal);
6277 #line 3108 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6279 if (!UpRefs.empty())
6280 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6281 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6282 GEN_ERROR("getelementptr insn requires pointer operand");
6284 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
6285 GEN_ERROR("Invalid getelementptr indices for type '" +
6286 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6287 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6289 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6290 delete (yyvsp[(2) - (4)].TypeVal);
6291 delete (yyvsp[(4) - (4)].ValueList);
6296 /* Line 1267 of yacc.c. */
6297 #line 6298 "llvmAsmParser.tab.c"
6300 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6304 YY_STACK_PRINT (yyss, yyssp);
6309 /* Now `shift' the result of the reduction. Determine what state
6310 that goes to, based on the state we popped back to and the rule
6311 number reduced by. */
6315 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6316 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6317 yystate = yytable[yystate];
6319 yystate = yydefgoto[yyn - YYNTOKENS];
6324 /*------------------------------------.
6325 | yyerrlab -- here on detecting error |
6326 `------------------------------------*/
6328 /* If not already recovering from an error, report this error. */
6332 #if ! YYERROR_VERBOSE
6333 yyerror (YY_("syntax error"));
6336 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6337 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6339 YYSIZE_T yyalloc = 2 * yysize;
6340 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6341 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6342 if (yymsg != yymsgbuf)
6343 YYSTACK_FREE (yymsg);
6344 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6346 yymsg_alloc = yyalloc;
6350 yymsg_alloc = sizeof yymsgbuf;
6354 if (0 < yysize && yysize <= yymsg_alloc)
6356 (void) yysyntax_error (yymsg, yystate, yychar);
6361 yyerror (YY_("syntax error"));
6363 goto yyexhaustedlab;
6371 if (yyerrstatus == 3)
6373 /* If just tried and failed to reuse look-ahead token after an
6374 error, discard it. */
6376 if (yychar <= YYEOF)
6378 /* Return failure if at end of input. */
6379 if (yychar == YYEOF)
6384 yydestruct ("Error: discarding",
6390 /* Else will try to reuse look-ahead token after shifting the error
6395 /*---------------------------------------------------.
6396 | yyerrorlab -- error raised explicitly by YYERROR. |
6397 `---------------------------------------------------*/
6400 /* Pacify compilers like GCC when the user code never invokes
6401 YYERROR and the label yyerrorlab therefore never appears in user
6403 if (/*CONSTCOND*/ 0)
6406 /* Do not reclaim the symbols of the rule which action triggered
6410 YY_STACK_PRINT (yyss, yyssp);
6415 /*-------------------------------------------------------------.
6416 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6417 `-------------------------------------------------------------*/
6419 yyerrstatus = 3; /* Each real token shifted decrements this. */
6423 yyn = yypact[yystate];
6424 if (yyn != YYPACT_NINF)
6427 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6435 /* Pop the current state because it cannot handle the error token. */
6440 yydestruct ("Error: popping",
6441 yystos[yystate], yyvsp);
6444 YY_STACK_PRINT (yyss, yyssp);
6453 /* Shift the error token. */
6454 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6460 /*-------------------------------------.
6461 | yyacceptlab -- YYACCEPT comes here. |
6462 `-------------------------------------*/
6467 /*-----------------------------------.
6468 | yyabortlab -- YYABORT comes here. |
6469 `-----------------------------------*/
6475 /*-------------------------------------------------.
6476 | yyexhaustedlab -- memory exhaustion comes here. |
6477 `-------------------------------------------------*/
6479 yyerror (YY_("memory exhausted"));
6485 if (yychar != YYEOF && yychar != YYEMPTY)
6486 yydestruct ("Cleanup: discarding lookahead",
6488 /* Do not reclaim the symbols of the rule which action triggered
6489 this YYABORT or YYACCEPT. */
6491 YY_STACK_PRINT (yyss, yyssp);
6492 while (yyssp != yyss)
6494 yydestruct ("Cleanup: popping",
6495 yystos[*yyssp], yyvsp);
6500 YYSTACK_FREE (yyss);
6503 if (yymsg != yymsgbuf)
6504 YYSTACK_FREE (yymsg);
6506 /* Make sure YYID is used. */
6507 return YYID (yyresult);
6511 #line 3125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
6514 // common code from the two 'RunVMAsmParser' functions
6515 static Module* RunParser(Module * M) {
6516 CurModule.CurrentModule = M;
6517 // Check to make sure the parser succeeded
6520 delete ParserResult;
6524 // Emit an error if there are any unresolved types left.
6525 if (!CurModule.LateResolveTypes.empty()) {
6526 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6527 if (DID.Type == ValID::LocalName) {
6528 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6530 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6533 delete ParserResult;
6537 // Emit an error if there are any unresolved values left.
6538 if (!CurModule.LateResolveValues.empty()) {
6539 Value *V = CurModule.LateResolveValues.back();
6540 std::map<Value*, std::pair<ValID, int> >::iterator I =
6541 CurModule.PlaceHolderInfo.find(V);
6543 if (I != CurModule.PlaceHolderInfo.end()) {
6544 ValID &DID = I->second.first;
6545 if (DID.Type == ValID::LocalName) {
6546 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6548 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6551 delete ParserResult;
6556 // Check to make sure that parsing produced a result
6560 // Reset ParserResult variable while saving its value for the result.
6561 Module *Result = ParserResult;
6567 void llvm::GenerateError(const std::string &message, int LineNo) {
6568 if (LineNo == -1) LineNo = LLLgetLineNo();
6569 // TODO: column number in exception
6571 TheParseError->setError(LLLgetFilename(), message, LineNo);
6575 int yyerror(const char *ErrorMsg) {
6576 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6577 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6578 if (yychar != YYEMPTY && yychar != 0) {
6579 errMsg += " while reading token: '";
6580 errMsg += std::string(LLLgetTokenStart(),
6581 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6583 GenerateError(errMsg);