1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse llvmAsmparse
51 #define yylex llvmAsmlex
52 #define yyerror llvmAsmerror
53 #define yylval llvmAsmlval
54 #define yychar llvmAsmchar
55 #define yydebug llvmAsmdebug
56 #define yynerrs llvmAsmnerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
82 ATSTRINGCONSTANT = 275,
83 PCTSTRINGCONSTANT = 276,
84 ZEROINITIALIZER = 277,
123 X86_STDCALLCC_TOK = 316,
124 X86_FASTCALLCC_TOK = 317,
190 EXTRACTELEMENT = 383,
207 #define ESINT64VAL 258
208 #define EUINT64VAL 259
209 #define ESAPINTVAL 260
210 #define EUAPINTVAL 261
211 #define LOCALVAL_ID 262
212 #define GLOBALVAL_ID 263
221 #define GLOBALVAR 272
223 #define STRINGCONSTANT 274
224 #define ATSTRINGCONSTANT 275
225 #define PCTSTRINGCONSTANT 276
226 #define ZEROINITIALIZER 277
238 #define THREAD_LOCAL 289
240 #define DOTDOTDOT 291
246 #define APPENDING 297
247 #define DLLIMPORT 298
248 #define DLLEXPORT 299
249 #define EXTERN_WEAK 300
260 #define SIDEEFFECT 311
263 #define FASTCC_TOK 314
264 #define COLDCC_TOK 315
265 #define X86_STDCALLCC_TOK 316
266 #define X86_FASTCALLCC_TOK 317
267 #define DATALAYOUT 318
273 #define UNREACHABLE 324
316 #define GETELEMENTPTR 367
332 #define EXTRACTELEMENT 383
333 #define INSERTELEMENT 384
334 #define SHUFFLEVECTOR 385
346 #define PROTECTED 397
351 /* Copy the first part of user declarations. */
352 #line 14 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
354 #include "ParserInternals.h"
355 #include "llvm/CallingConv.h"
356 #include "llvm/InlineAsm.h"
357 #include "llvm/Instructions.h"
358 #include "llvm/Module.h"
359 #include "llvm/ValueSymbolTable.h"
360 #include "llvm/Support/GetElementPtrTypeIterator.h"
361 #include "llvm/Support/CommandLine.h"
362 #include "llvm/ADT/SmallVector.h"
363 #include "llvm/ADT/STLExtras.h"
364 #include "llvm/Support/MathExtras.h"
365 #include "llvm/Support/Streams.h"
374 // The following is a gross hack. In order to rid the libAsmParser library of
375 // exceptions, we have to have a way of getting the yyparse function to go into
376 // an error situation. So, whenever we want an error to occur, the GenerateError
377 // function (see bottom of file) sets TriggerError. Then, at the end of each
378 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
379 // (a goto) to put YACC in error state. Furthermore, several calls to
380 // GenerateError are made from inside productions and they must simulate the
381 // previous exception behavior by exiting the production immediately. We have
382 // replaced these with the GEN_ERROR macro which calls GeneratError and then
383 // immediately invokes YYERROR. This would be so much cleaner if it was a
384 // recursive descent parser.
385 static bool TriggerError = false;
386 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
387 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
389 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
390 int yylex(); // declaration" of xxx warnings.
394 std::string CurFilename;
397 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
398 cl::Hidden, cl::init(false));
401 using namespace llvm;
403 static Module *ParserResult;
405 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
406 // relating to upreferences in the input stream.
408 //#define DEBUG_UPREFS 1
410 #define UR_OUT(X) cerr << X
415 #define YYERROR_VERBOSE 1
417 static GlobalVariable *CurGV;
420 // This contains info used when building the body of a function. It is
421 // destroyed when the function is completed.
423 typedef std::vector<Value *> ValueList; // Numbered defs
426 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
428 static struct PerModuleInfo {
429 Module *CurrentModule;
430 ValueList Values; // Module level numbered definitions
431 ValueList LateResolveValues;
432 std::vector<PATypeHolder> Types;
433 std::map<ValID, PATypeHolder> LateResolveTypes;
435 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
436 /// how they were referenced and on which line of the input they came from so
437 /// that we can resolve them later and print error messages as appropriate.
438 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
440 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
441 // references to global values. Global values may be referenced before they
442 // are defined, and if so, the temporary object that they represent is held
443 // here. This is used for forward references of GlobalValues.
445 typedef std::map<std::pair<const PointerType *,
446 ValID>, GlobalValue*> GlobalRefsType;
447 GlobalRefsType GlobalRefs;
450 // If we could not resolve some functions at function compilation time
451 // (calls to functions before they are defined), resolve them now... Types
452 // are resolved when the constant pool has been completely parsed.
454 ResolveDefinitions(LateResolveValues);
458 // Check to make sure that all global value forward references have been
461 if (!GlobalRefs.empty()) {
462 std::string UndefinedReferences = "Unresolved global references exist:\n";
464 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
466 UndefinedReferences += " " + I->first.first->getDescription() + " " +
467 I->first.second.getName() + "\n";
469 GenerateError(UndefinedReferences);
473 Values.clear(); // Clear out function local definitions
478 // GetForwardRefForGlobal - Check to see if there is a forward reference
479 // for this global. If so, remove it from the GlobalRefs map and return it.
480 // If not, just return null.
481 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
482 // Check to see if there is a forward reference to this global variable...
483 // if there is, eliminate it and patch the reference to use the new def'n.
484 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
485 GlobalValue *Ret = 0;
486 if (I != GlobalRefs.end()) {
493 bool TypeIsUnresolved(PATypeHolder* PATy) {
494 // If it isn't abstract, its resolved
495 const Type* Ty = PATy->get();
496 if (!Ty->isAbstract())
498 // Traverse the type looking for abstract types. If it isn't abstract then
499 // we don't need to traverse that leg of the type.
500 std::vector<const Type*> WorkList, SeenList;
501 WorkList.push_back(Ty);
502 while (!WorkList.empty()) {
503 const Type* Ty = WorkList.back();
504 SeenList.push_back(Ty);
506 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
507 // Check to see if this is an unresolved type
508 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
509 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
510 for ( ; I != E; ++I) {
511 if (I->second.get() == OpTy)
514 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
515 const Type* TheTy = SeqTy->getElementType();
516 if (TheTy->isAbstract() && TheTy != Ty) {
517 std::vector<const Type*>::iterator I = SeenList.begin(),
523 WorkList.push_back(TheTy);
525 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
526 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
527 const Type* TheTy = StrTy->getElementType(i);
528 if (TheTy->isAbstract() && TheTy != Ty) {
529 std::vector<const Type*>::iterator I = SeenList.begin(),
535 WorkList.push_back(TheTy);
544 static struct PerFunctionInfo {
545 Function *CurrentFunction; // Pointer to current function being created
547 ValueList Values; // Keep track of #'d definitions
549 ValueList LateResolveValues;
550 bool isDeclare; // Is this function a forward declararation?
551 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
552 GlobalValue::VisibilityTypes Visibility;
554 /// BBForwardRefs - When we see forward references to basic blocks, keep
555 /// track of them here.
556 std::map<ValID, BasicBlock*> BBForwardRefs;
558 inline PerFunctionInfo() {
561 Linkage = GlobalValue::ExternalLinkage;
562 Visibility = GlobalValue::DefaultVisibility;
565 inline void FunctionStart(Function *M) {
570 void FunctionDone() {
571 // Any forward referenced blocks left?
572 if (!BBForwardRefs.empty()) {
573 GenerateError("Undefined reference to label " +
574 BBForwardRefs.begin()->second->getName());
578 // Resolve all forward references now.
579 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
581 Values.clear(); // Clear out function local definitions
582 BBForwardRefs.clear();
585 Linkage = GlobalValue::ExternalLinkage;
586 Visibility = GlobalValue::DefaultVisibility;
588 } CurFun; // Info for the current function...
590 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
593 //===----------------------------------------------------------------------===//
594 // Code to handle definitions of all the types
595 //===----------------------------------------------------------------------===//
597 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
598 // Things that have names or are void typed don't get slot numbers
599 if (V->hasName() || (V->getType() == Type::VoidTy))
602 // In the case of function values, we have to allow for the forward reference
603 // of basic blocks, which are included in the numbering. Consequently, we keep
604 // track of the next insertion location with NextValNum. When a BB gets
605 // inserted, it could change the size of the CurFun.Values vector.
606 if (&ValueTab == &CurFun.Values) {
607 if (ValueTab.size() <= CurFun.NextValNum)
608 ValueTab.resize(CurFun.NextValNum+1);
609 ValueTab[CurFun.NextValNum++] = V;
612 // For all other lists, its okay to just tack it on the back of the vector.
613 ValueTab.push_back(V);
616 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
618 case ValID::LocalID: // Is it a numbered definition?
619 // Module constants occupy the lowest numbered slots...
620 if (D.Num < CurModule.Types.size())
621 return CurModule.Types[D.Num];
623 case ValID::LocalName: // Is it a named definition?
624 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
625 D.destroy(); // Free old strdup'd memory...
630 GenerateError("Internal parser error: Invalid symbol type reference");
634 // If we reached here, we referenced either a symbol that we don't know about
635 // or an id number that hasn't been read yet. We may be referencing something
636 // forward, so just create an entry to be resolved later and get to it...
638 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
641 if (inFunctionScope()) {
642 if (D.Type == ValID::LocalName) {
643 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
646 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
651 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
652 if (I != CurModule.LateResolveTypes.end())
655 Type *Typ = OpaqueType::get();
656 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
660 // getExistingVal - Look up the value specified by the provided type and
661 // the provided ValID. If the value exists and has already been defined, return
662 // it. Otherwise return null.
664 static Value *getExistingVal(const Type *Ty, const ValID &D) {
665 if (isa<FunctionType>(Ty)) {
666 GenerateError("Functions are not values and "
667 "must be referenced as pointers");
672 case ValID::LocalID: { // Is it a numbered definition?
673 // Check that the number is within bounds.
674 if (D.Num >= CurFun.Values.size())
676 Value *Result = CurFun.Values[D.Num];
677 if (Ty != Result->getType()) {
678 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
679 Result->getType()->getDescription() + "' does not match "
680 "expected type, '" + Ty->getDescription() + "'");
685 case ValID::GlobalID: { // Is it a numbered definition?
686 if (D.Num >= CurModule.Values.size())
688 Value *Result = CurModule.Values[D.Num];
689 if (Ty != Result->getType()) {
690 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
691 Result->getType()->getDescription() + "' does not match "
692 "expected type, '" + Ty->getDescription() + "'");
698 case ValID::LocalName: { // Is it a named definition?
699 if (!inFunctionScope())
701 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
702 Value *N = SymTab.lookup(D.getName());
705 if (N->getType() != Ty)
708 D.destroy(); // Free old strdup'd memory...
711 case ValID::GlobalName: { // Is it a named definition?
712 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
713 Value *N = SymTab.lookup(D.getName());
716 if (N->getType() != Ty)
719 D.destroy(); // Free old strdup'd memory...
723 // Check to make sure that "Ty" is an integral type, and that our
724 // value will fit into the specified type...
725 case ValID::ConstSIntVal: // Is it a constant pool reference??
726 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
727 GenerateError("Signed integral constant '" +
728 itostr(D.ConstPool64) + "' is invalid for type '" +
729 Ty->getDescription() + "'");
732 return ConstantInt::get(Ty, D.ConstPool64, true);
734 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
735 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
736 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
737 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
738 "' is invalid or out of range");
740 } else { // This is really a signed reference. Transmogrify.
741 return ConstantInt::get(Ty, D.ConstPool64, true);
744 return ConstantInt::get(Ty, D.UConstPool64);
747 case ValID::ConstFPVal: // Is it a floating point const pool reference?
748 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
749 GenerateError("FP constant invalid for type");
752 return ConstantFP::get(Ty, D.ConstPoolFP);
754 case ValID::ConstNullVal: // Is it a null value?
755 if (!isa<PointerType>(Ty)) {
756 GenerateError("Cannot create a a non pointer null");
759 return ConstantPointerNull::get(cast<PointerType>(Ty));
761 case ValID::ConstUndefVal: // Is it an undef value?
762 return UndefValue::get(Ty);
764 case ValID::ConstZeroVal: // Is it a zero value?
765 return Constant::getNullValue(Ty);
767 case ValID::ConstantVal: // Fully resolved constant?
768 if (D.ConstantValue->getType() != Ty) {
769 GenerateError("Constant expression type different from required type");
772 return D.ConstantValue;
774 case ValID::InlineAsmVal: { // Inline asm expression
775 const PointerType *PTy = dyn_cast<PointerType>(Ty);
776 const FunctionType *FTy =
777 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
778 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
779 GenerateError("Invalid type for asm constraint string");
782 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
783 D.IAD->HasSideEffects);
784 D.destroy(); // Free InlineAsmDescriptor.
788 assert(0 && "Unhandled case!");
792 assert(0 && "Unhandled case!");
796 // getVal - This function is identical to getExistingVal, except that if a
797 // value is not already defined, it "improvises" by creating a placeholder var
798 // that looks and acts just like the requested variable. When the value is
799 // defined later, all uses of the placeholder variable are replaced with the
802 static Value *getVal(const Type *Ty, const ValID &ID) {
803 if (Ty == Type::LabelTy) {
804 GenerateError("Cannot use a basic block here");
808 // See if the value has already been defined.
809 Value *V = getExistingVal(Ty, ID);
811 if (TriggerError) return 0;
813 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
814 GenerateError("Invalid use of a composite type");
818 // If we reached here, we referenced either a symbol that we don't know about
819 // or an id number that hasn't been read yet. We may be referencing something
820 // forward, so just create an entry to be resolved later and get to it...
823 case ValID::GlobalName:
824 case ValID::GlobalID: {
825 const PointerType *PTy = dyn_cast<PointerType>(Ty);
827 GenerateError("Invalid type for reference to global" );
830 const Type* ElTy = PTy->getElementType();
831 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
832 V = new Function(FTy, GlobalValue::ExternalLinkage);
834 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
838 V = new Argument(Ty);
841 // Remember where this forward reference came from. FIXME, shouldn't we try
842 // to recycle these things??
843 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
846 if (inFunctionScope())
847 InsertValue(V, CurFun.LateResolveValues);
849 InsertValue(V, CurModule.LateResolveValues);
853 /// defineBBVal - This is a definition of a new basic block with the specified
854 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
855 static BasicBlock *defineBBVal(const ValID &ID) {
856 assert(inFunctionScope() && "Can't get basic block at global scope!");
860 // First, see if this was forward referenced
862 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
863 if (BBI != CurFun.BBForwardRefs.end()) {
865 // The forward declaration could have been inserted anywhere in the
866 // function: insert it into the correct place now.
867 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
868 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
870 // We're about to erase the entry, save the key so we can clean it up.
871 ValID Tmp = BBI->first;
873 // Erase the forward ref from the map as its no longer "forward"
874 CurFun.BBForwardRefs.erase(ID);
876 // The key has been removed from the map but so we don't want to leave
877 // strdup'd memory around so destroy it too.
880 // If its a numbered definition, bump the number and set the BB value.
881 if (ID.Type == ValID::LocalID) {
882 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
890 // We haven't seen this BB before and its first mention is a definition.
891 // Just create it and return it.
892 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
893 BB = new BasicBlock(Name, CurFun.CurrentFunction);
894 if (ID.Type == ValID::LocalID) {
895 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
899 ID.destroy(); // Free strdup'd memory
903 /// getBBVal - get an existing BB value or create a forward reference for it.
905 static BasicBlock *getBBVal(const ValID &ID) {
906 assert(inFunctionScope() && "Can't get basic block at global scope!");
910 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
911 if (BBI != CurFun.BBForwardRefs.end()) {
913 } if (ID.Type == ValID::LocalName) {
914 std::string Name = ID.getName();
915 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
917 if (N->getType()->getTypeID() == Type::LabelTyID)
918 BB = cast<BasicBlock>(N);
920 GenerateError("Reference to label '" + Name + "' is actually of type '"+
921 N->getType()->getDescription() + "'");
922 } else if (ID.Type == ValID::LocalID) {
923 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
924 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
925 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
927 GenerateError("Reference to label '%" + utostr(ID.Num) +
928 "' is actually of type '"+
929 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
932 GenerateError("Illegal label reference " + ID.getName());
936 // If its already been defined, return it now.
938 ID.destroy(); // Free strdup'd memory.
942 // Otherwise, this block has not been seen before, create it.
944 if (ID.Type == ValID::LocalName)
946 BB = new BasicBlock(Name, CurFun.CurrentFunction);
948 // Insert it in the forward refs map.
949 CurFun.BBForwardRefs[ID] = BB;
955 //===----------------------------------------------------------------------===//
956 // Code to handle forward references in instructions
957 //===----------------------------------------------------------------------===//
959 // This code handles the late binding needed with statements that reference
960 // values not defined yet... for example, a forward branch, or the PHI node for
963 // This keeps a table (CurFun.LateResolveValues) of all such forward references
964 // and back patchs after we are done.
967 // ResolveDefinitions - If we could not resolve some defs at parsing
968 // time (forward branches, phi functions for loops, etc...) resolve the
972 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
973 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
974 while (!LateResolvers.empty()) {
975 Value *V = LateResolvers.back();
976 LateResolvers.pop_back();
978 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
979 CurModule.PlaceHolderInfo.find(V);
980 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
982 ValID &DID = PHI->second.first;
984 Value *TheRealValue = getExistingVal(V->getType(), DID);
988 V->replaceAllUsesWith(TheRealValue);
990 CurModule.PlaceHolderInfo.erase(PHI);
991 } else if (FutureLateResolvers) {
992 // Functions have their unresolved items forwarded to the module late
994 InsertValue(V, *FutureLateResolvers);
996 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
997 GenerateError("Reference to an invalid definition: '" +DID.getName()+
998 "' of type '" + V->getType()->getDescription() + "'",
1002 GenerateError("Reference to an invalid definition: #" +
1003 itostr(DID.Num) + " of type '" +
1004 V->getType()->getDescription() + "'",
1005 PHI->second.second);
1010 LateResolvers.clear();
1013 // ResolveTypeTo - A brand new type was just declared. This means that (if
1014 // name is not null) things referencing Name can be resolved. Otherwise, things
1015 // refering to the number can be resolved. Do this now.
1017 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1020 D = ValID::createLocalName(*Name);
1022 D = ValID::createLocalID(CurModule.Types.size());
1024 std::map<ValID, PATypeHolder>::iterator I =
1025 CurModule.LateResolveTypes.find(D);
1026 if (I != CurModule.LateResolveTypes.end()) {
1027 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1028 CurModule.LateResolveTypes.erase(I);
1032 // setValueName - Set the specified value to the name given. The name may be
1033 // null potentially, in which case this is a noop. The string passed in is
1034 // assumed to be a malloc'd string buffer, and is free'd by this function.
1036 static void setValueName(Value *V, std::string *NameStr) {
1037 if (!NameStr) return;
1038 std::string Name(*NameStr); // Copy string
1039 delete NameStr; // Free old string
1041 if (V->getType() == Type::VoidTy) {
1042 GenerateError("Can't assign name '" + Name+"' to value with void type");
1046 assert(inFunctionScope() && "Must be in function scope!");
1047 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1048 if (ST.lookup(Name)) {
1049 GenerateError("Redefinition of value '" + Name + "' of type '" +
1050 V->getType()->getDescription() + "'");
1058 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1059 /// this is a declaration, otherwise it is a definition.
1060 static GlobalVariable *
1061 ParseGlobalVariable(std::string *NameStr,
1062 GlobalValue::LinkageTypes Linkage,
1063 GlobalValue::VisibilityTypes Visibility,
1064 bool isConstantGlobal, const Type *Ty,
1065 Constant *Initializer, bool IsThreadLocal) {
1066 if (isa<FunctionType>(Ty)) {
1067 GenerateError("Cannot declare global vars of function type");
1071 const PointerType *PTy = PointerType::get(Ty);
1075 Name = *NameStr; // Copy string
1076 delete NameStr; // Free old string
1079 // See if this global value was forward referenced. If so, recycle the
1082 if (!Name.empty()) {
1083 ID = ValID::createGlobalName(Name);
1085 ID = ValID::createGlobalID(CurModule.Values.size());
1088 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1089 // Move the global to the end of the list, from whereever it was
1090 // previously inserted.
1091 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1092 CurModule.CurrentModule->getGlobalList().remove(GV);
1093 CurModule.CurrentModule->getGlobalList().push_back(GV);
1094 GV->setInitializer(Initializer);
1095 GV->setLinkage(Linkage);
1096 GV->setVisibility(Visibility);
1097 GV->setConstant(isConstantGlobal);
1098 GV->setThreadLocal(IsThreadLocal);
1099 InsertValue(GV, CurModule.Values);
1103 // If this global has a name
1104 if (!Name.empty()) {
1105 // if the global we're parsing has an initializer (is a definition) and
1106 // has external linkage.
1107 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1108 // If there is already a global with external linkage with this name
1109 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1110 // If we allow this GVar to get created, it will be renamed in the
1111 // symbol table because it conflicts with an existing GVar. We can't
1112 // allow redefinition of GVars whose linking indicates that their name
1113 // must stay the same. Issue the error.
1114 GenerateError("Redefinition of global variable named '" + Name +
1115 "' of type '" + Ty->getDescription() + "'");
1120 // Otherwise there is no existing GV to use, create one now.
1121 GlobalVariable *GV =
1122 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1123 CurModule.CurrentModule, IsThreadLocal);
1124 GV->setVisibility(Visibility);
1125 InsertValue(GV, CurModule.Values);
1129 // setTypeName - Set the specified type to the name given. The name may be
1130 // null potentially, in which case this is a noop. The string passed in is
1131 // assumed to be a malloc'd string buffer, and is freed by this function.
1133 // This function returns true if the type has already been defined, but is
1134 // allowed to be redefined in the specified context. If the name is a new name
1135 // for the type plane, it is inserted and false is returned.
1136 static bool setTypeName(const Type *T, std::string *NameStr) {
1137 assert(!inFunctionScope() && "Can't give types function-local names!");
1138 if (NameStr == 0) return false;
1140 std::string Name(*NameStr); // Copy string
1141 delete NameStr; // Free old string
1143 // We don't allow assigning names to void type
1144 if (T == Type::VoidTy) {
1145 GenerateError("Can't assign name '" + Name + "' to the void type");
1149 // Set the type name, checking for conflicts as we do so.
1150 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1152 if (AlreadyExists) { // Inserting a name that is already defined???
1153 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1154 assert(Existing && "Conflict but no matching type?!");
1156 // There is only one case where this is allowed: when we are refining an
1157 // opaque type. In this case, Existing will be an opaque type.
1158 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1159 // We ARE replacing an opaque type!
1160 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1164 // Otherwise, this is an attempt to redefine a type. That's okay if
1165 // the redefinition is identical to the original. This will be so if
1166 // Existing and T point to the same Type object. In this one case we
1167 // allow the equivalent redefinition.
1168 if (Existing == T) return true; // Yes, it's equal.
1170 // Any other kind of (non-equivalent) redefinition is an error.
1171 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1172 T->getDescription() + "'");
1178 //===----------------------------------------------------------------------===//
1179 // Code for handling upreferences in type names...
1182 // TypeContains - Returns true if Ty directly contains E in it.
1184 static bool TypeContains(const Type *Ty, const Type *E) {
1185 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1186 E) != Ty->subtype_end();
1190 struct UpRefRecord {
1191 // NestingLevel - The number of nesting levels that need to be popped before
1192 // this type is resolved.
1193 unsigned NestingLevel;
1195 // LastContainedTy - This is the type at the current binding level for the
1196 // type. Every time we reduce the nesting level, this gets updated.
1197 const Type *LastContainedTy;
1199 // UpRefTy - This is the actual opaque type that the upreference is
1200 // represented with.
1201 OpaqueType *UpRefTy;
1203 UpRefRecord(unsigned NL, OpaqueType *URTy)
1204 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1208 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1209 static std::vector<UpRefRecord> UpRefs;
1211 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1212 /// called. It loops through the UpRefs vector, which is a list of the
1213 /// currently active types. For each type, if the up reference is contained in
1214 /// the newly completed type, we decrement the level count. When the level
1215 /// count reaches zero, the upreferenced type is the type that is passed in:
1216 /// thus we can complete the cycle.
1218 static PATypeHolder HandleUpRefs(const Type *ty) {
1219 // If Ty isn't abstract, or if there are no up-references in it, then there is
1220 // nothing to resolve here.
1221 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1223 PATypeHolder Ty(ty);
1224 UR_OUT("Type '" << Ty->getDescription() <<
1225 "' newly formed. Resolving upreferences.\n" <<
1226 UpRefs.size() << " upreferences active!\n");
1228 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1229 // to zero), we resolve them all together before we resolve them to Ty. At
1230 // the end of the loop, if there is anything to resolve to Ty, it will be in
1232 OpaqueType *TypeToResolve = 0;
1234 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1235 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1236 << UpRefs[i].second->getDescription() << ") = "
1237 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1238 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1239 // Decrement level of upreference
1240 unsigned Level = --UpRefs[i].NestingLevel;
1241 UpRefs[i].LastContainedTy = Ty;
1242 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1243 if (Level == 0) { // Upreference should be resolved!
1244 if (!TypeToResolve) {
1245 TypeToResolve = UpRefs[i].UpRefTy;
1247 UR_OUT(" * Resolving upreference for "
1248 << UpRefs[i].second->getDescription() << "\n";
1249 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1250 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1251 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1252 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1254 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1255 --i; // Do not skip the next element...
1260 if (TypeToResolve) {
1261 UR_OUT(" * Resolving upreference for "
1262 << UpRefs[i].second->getDescription() << "\n";
1263 std::string OldName = TypeToResolve->getDescription());
1264 TypeToResolve->refineAbstractTypeTo(Ty);
1270 //===----------------------------------------------------------------------===//
1271 // RunVMAsmParser - Define an interface to this parser
1272 //===----------------------------------------------------------------------===//
1274 static Module* RunParser(Module * M);
1276 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1279 CurFilename = Filename;
1280 return RunParser(new Module(CurFilename));
1283 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1284 set_scan_string(AsmString);
1286 CurFilename = "from_memory";
1288 return RunParser(new Module (CurFilename));
1290 return RunParser(M);
1296 /* Enabling traces. */
1301 /* Enabling verbose error messages. */
1302 #ifdef YYERROR_VERBOSE
1303 # undef YYERROR_VERBOSE
1304 # define YYERROR_VERBOSE 1
1306 # define YYERROR_VERBOSE 0
1309 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1310 #line 957 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
1311 typedef union YYSTYPE {
1312 llvm::Module *ModuleVal;
1313 llvm::Function *FunctionVal;
1314 llvm::BasicBlock *BasicBlockVal;
1315 llvm::TerminatorInst *TermInstVal;
1316 llvm::Instruction *InstVal;
1317 llvm::Constant *ConstVal;
1319 const llvm::Type *PrimType;
1320 std::list<llvm::PATypeHolder> *TypeList;
1321 llvm::PATypeHolder *TypeVal;
1322 llvm::Value *ValueVal;
1323 std::vector<llvm::Value*> *ValueList;
1324 llvm::ArgListType *ArgList;
1325 llvm::TypeWithAttrs TypeWithAttrs;
1326 llvm::TypeWithAttrsList *TypeWithAttrsList;
1327 llvm::ValueRefList *ValueRefList;
1329 // Represent the RHS of PHI node
1330 std::list<std::pair<llvm::Value*,
1331 llvm::BasicBlock*> > *PHIList;
1332 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1333 std::vector<llvm::Constant*> *ConstVector;
1335 llvm::GlobalValue::LinkageTypes Linkage;
1336 llvm::GlobalValue::VisibilityTypes Visibility;
1337 uint16_t ParamAttrs;
1338 llvm::APInt *APIntVal;
1346 std::string *StrVal; // This memory must be deleted
1347 llvm::ValID ValIDVal;
1349 llvm::Instruction::BinaryOps BinaryOpVal;
1350 llvm::Instruction::TermOps TermOpVal;
1351 llvm::Instruction::MemoryOps MemOpVal;
1352 llvm::Instruction::CastOps CastOpVal;
1353 llvm::Instruction::OtherOps OtherOpVal;
1354 llvm::ICmpInst::Predicate IPredicate;
1355 llvm::FCmpInst::Predicate FPredicate;
1357 /* Line 191 of yacc.c. */
1358 #line 1359 "llvmAsmParser.tab.c"
1359 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1360 # define YYSTYPE_IS_DECLARED 1
1361 # define YYSTYPE_IS_TRIVIAL 1
1366 /* Copy the second part of user declarations. */
1369 /* Line 214 of yacc.c. */
1370 #line 1371 "llvmAsmParser.tab.c"
1372 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1374 /* The parser invokes alloca or malloc; define the necessary symbols. */
1376 # ifdef YYSTACK_USE_ALLOCA
1377 # if YYSTACK_USE_ALLOCA
1378 # define YYSTACK_ALLOC alloca
1381 # if defined (alloca) || defined (_ALLOCA_H)
1382 # define YYSTACK_ALLOC alloca
1385 # define YYSTACK_ALLOC __builtin_alloca
1390 # ifdef YYSTACK_ALLOC
1391 /* Pacify GCC's `empty if-body' warning. */
1392 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1394 # if defined (__STDC__) || defined (__cplusplus)
1395 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1396 # define YYSIZE_T size_t
1398 # define YYSTACK_ALLOC malloc
1399 # define YYSTACK_FREE free
1401 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1404 #if (! defined (yyoverflow) \
1405 && (! defined (__cplusplus) \
1406 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1408 /* A type that is properly aligned for any stack member. */
1415 /* The size of the maximum gap between one aligned stack and the next. */
1416 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1418 /* The size of an array large to enough to hold all stacks, each with
1420 # define YYSTACK_BYTES(N) \
1421 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
1422 + YYSTACK_GAP_MAXIMUM)
1424 /* Copy COUNT objects from FROM to TO. The source and destination do
1427 # if defined (__GNUC__) && 1 < __GNUC__
1428 # define YYCOPY(To, From, Count) \
1429 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1431 # define YYCOPY(To, From, Count) \
1434 register YYSIZE_T yyi; \
1435 for (yyi = 0; yyi < (Count); yyi++) \
1436 (To)[yyi] = (From)[yyi]; \
1442 /* Relocate STACK from its old location to the new one. The
1443 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1444 elements in the stack, and YYPTR gives the new location of the
1445 stack. Advance YYPTR to a properly aligned location for the next
1447 # define YYSTACK_RELOCATE(Stack) \
1450 YYSIZE_T yynewbytes; \
1451 YYCOPY (&yyptr->Stack, Stack, yysize); \
1452 Stack = &yyptr->Stack; \
1453 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1454 yyptr += yynewbytes / sizeof (*yyptr); \
1460 #if defined (__STDC__) || defined (__cplusplus)
1461 typedef signed char yysigned_char;
1463 typedef short yysigned_char;
1466 /* YYFINAL -- State number of the termination state. */
1468 /* YYLAST -- Last index in YYTABLE. */
1471 /* YYNTOKENS -- Number of terminals. */
1472 #define YYNTOKENS 157
1473 /* YYNNTS -- Number of nonterminals. */
1475 /* YYNRULES -- Number of rules. */
1476 #define YYNRULES 304
1477 /* YYNRULES -- Number of states. */
1478 #define YYNSTATES 588
1480 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1481 #define YYUNDEFTOK 2
1482 #define YYMAXUTOK 397
1484 #define YYTRANSLATE(YYX) \
1485 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1487 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1488 static const unsigned char yytranslate[] =
1490 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 147, 148, 145, 2, 144, 2, 2, 2, 2, 2,
1495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1496 152, 143, 153, 2, 2, 2, 2, 2, 2, 2,
1497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1499 2, 149, 146, 151, 2, 2, 2, 2, 2, 156,
1500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1502 150, 2, 2, 154, 2, 155, 2, 2, 2, 2,
1503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1515 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1516 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1517 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1518 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1519 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1520 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1521 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1522 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1523 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1524 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1525 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1526 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1527 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1528 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1529 135, 136, 137, 138, 139, 140, 141, 142
1533 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1535 static const unsigned short yyprhs[] =
1537 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1538 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1539 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1540 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1541 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1542 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1543 119, 121, 123, 124, 127, 128, 130, 132, 134, 135,
1544 138, 140, 142, 144, 146, 148, 150, 152, 154, 155,
1545 157, 159, 161, 162, 164, 166, 167, 169, 171, 173,
1546 175, 176, 178, 180, 181, 183, 185, 187, 189, 191,
1547 194, 196, 198, 200, 202, 204, 206, 208, 210, 212,
1548 213, 216, 218, 220, 222, 224, 225, 228, 229, 232,
1549 233, 237, 240, 241, 243, 244, 248, 250, 253, 255,
1550 257, 259, 261, 263, 265, 268, 270, 273, 279, 285,
1551 291, 297, 301, 304, 310, 315, 318, 320, 322, 324,
1552 328, 330, 334, 336, 337, 339, 343, 348, 352, 356,
1553 361, 366, 370, 377, 383, 386, 389, 392, 395, 398,
1554 401, 404, 407, 410, 413, 416, 419, 426, 432, 441,
1555 448, 455, 463, 471, 478, 487, 496, 500, 502, 504,
1556 506, 508, 509, 512, 519, 521, 522, 524, 527, 528,
1557 532, 533, 537, 541, 545, 549, 550, 558, 559, 568,
1558 569, 578, 584, 587, 591, 593, 597, 601, 605, 609,
1559 611, 612, 618, 622, 624, 628, 630, 631, 641, 643,
1560 645, 650, 652, 654, 657, 661, 662, 664, 666, 668,
1561 670, 672, 674, 676, 678, 680, 684, 686, 692, 694,
1562 696, 698, 700, 702, 704, 707, 710, 713, 717, 720,
1563 721, 723, 726, 729, 733, 743, 753, 762, 777, 779,
1564 781, 788, 794, 797, 804, 812, 816, 822, 823, 824,
1565 828, 831, 833, 839, 845, 852, 859, 864, 871, 876,
1566 881, 888, 895, 898, 907, 909, 911, 912, 916, 923,
1567 927, 934, 937, 943, 951
1570 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1571 static const short yyrhs[] =
1573 201, 0, -1, 70, -1, 71, -1, 72, -1, 73,
1574 -1, 74, -1, 75, -1, 76, -1, 77, -1, 78,
1575 -1, 82, -1, 83, -1, 84, -1, 79, -1, 80,
1576 -1, 81, -1, 113, -1, 114, -1, 115, -1, 116,
1577 -1, 117, -1, 118, -1, 119, -1, 120, -1, 121,
1578 -1, 122, -1, 123, -1, 124, -1, 87, -1, 88,
1579 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1580 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1581 -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
1582 -1, 104, -1, 105, -1, 106, -1, 93, -1, 94,
1583 -1, 95, -1, 96, -1, 23, -1, 24, -1, 11,
1584 -1, 12, -1, 13, -1, 16, -1, 19, -1, 21,
1585 -1, 165, -1, -1, 165, 143, -1, -1, 17, -1,
1586 20, -1, 170, -1, -1, 168, 143, -1, 39, -1,
1587 41, -1, 40, -1, 42, -1, 44, -1, 43, -1,
1588 45, -1, 47, -1, -1, 140, -1, 141, -1, 142,
1589 -1, -1, 43, -1, 45, -1, -1, 39, -1, 40,
1590 -1, 41, -1, 44, -1, -1, 41, -1, 39, -1,
1591 -1, 58, -1, 59, -1, 60, -1, 61, -1, 62,
1592 -1, 57, 4, -1, 132, -1, 114, -1, 131, -1,
1593 115, -1, 134, -1, 135, -1, 137, -1, 138, -1,
1594 139, -1, -1, 179, 178, -1, 133, -1, 136, -1,
1595 132, -1, 131, -1, -1, 181, 180, -1, -1, 50,
1596 4, -1, -1, 144, 50, 4, -1, 31, 19, -1,
1597 -1, 184, -1, -1, 144, 187, 186, -1, 184, -1,
1598 50, 4, -1, 11, -1, 12, -1, 13, -1, 14,
1599 -1, 46, -1, 188, -1, 189, 145, -1, 223, -1,
1600 146, 4, -1, 189, 147, 193, 148, 181, -1, 10,
1601 147, 193, 148, 181, -1, 149, 4, 150, 189, 151,
1602 -1, 152, 4, 150, 189, 153, -1, 154, 194, 155,
1603 -1, 154, 155, -1, 152, 154, 194, 155, 153, -1,
1604 152, 154, 155, 153, -1, 189, 179, -1, 189, -1,
1605 10, -1, 190, -1, 192, 144, 190, -1, 192, -1,
1606 192, 144, 36, -1, 36, -1, -1, 189, -1, 194,
1607 144, 189, -1, 189, 149, 197, 151, -1, 189, 149,
1608 151, -1, 189, 156, 19, -1, 189, 152, 197, 153,
1609 -1, 189, 154, 197, 155, -1, 189, 154, 155, -1,
1610 189, 152, 154, 197, 155, 153, -1, 189, 152, 154,
1611 155, 153, -1, 189, 37, -1, 189, 38, -1, 189,
1612 223, -1, 189, 196, -1, 189, 22, -1, 163, 3,
1613 -1, 163, 5, -1, 163, 4, -1, 163, 6, -1,
1614 11, 23, -1, 11, 24, -1, 164, 9, -1, 160,
1615 147, 195, 35, 189, 148, -1, 112, 147, 195, 234,
1616 148, -1, 126, 147, 195, 144, 195, 144, 195, 148,
1617 -1, 158, 147, 195, 144, 195, 148, -1, 159, 147,
1618 195, 144, 195, 148, -1, 85, 161, 147, 195, 144,
1619 195, 148, -1, 86, 162, 147, 195, 144, 195, 148,
1620 -1, 128, 147, 195, 144, 195, 148, -1, 129, 147,
1621 195, 144, 195, 144, 195, 148, -1, 130, 147, 195,
1622 144, 195, 144, 195, 148, -1, 197, 144, 195, -1,
1623 195, -1, 29, -1, 30, -1, 34, -1, -1, 191,
1624 223, -1, 118, 147, 200, 35, 189, 148, -1, 202,
1625 -1, -1, 203, -1, 202, 203, -1, -1, 28, 204,
1626 219, -1, -1, 27, 205, 220, -1, 55, 54, 209,
1627 -1, 167, 15, 189, -1, 167, 15, 10, -1, -1,
1628 169, 173, 199, 198, 195, 206, 186, -1, -1, 169,
1629 171, 173, 199, 198, 195, 207, 186, -1, -1, 169,
1630 172, 173, 199, 198, 189, 208, 186, -1, 169, 173,
1631 32, 176, 200, -1, 48, 210, -1, 51, 143, 211,
1632 -1, 19, -1, 49, 143, 19, -1, 63, 143, 19,
1633 -1, 149, 212, 151, -1, 212, 144, 19, -1, 19,
1634 -1, -1, 213, 144, 189, 179, 166, -1, 189, 179,
1635 166, -1, 213, -1, 213, 144, 36, -1, 36, -1,
1636 -1, 177, 191, 168, 147, 214, 148, 181, 185, 182,
1637 -1, 25, -1, 154, -1, 175, 173, 215, 216, -1,
1638 26, -1, 155, -1, 226, 218, -1, 174, 173, 215,
1639 -1, -1, 56, -1, 3, -1, 4, -1, 9, -1,
1640 23, -1, 24, -1, 37, -1, 38, -1, 22, -1,
1641 152, 197, 153, -1, 196, -1, 54, 221, 19, 144,
1642 19, -1, 7, -1, 8, -1, 165, -1, 168, -1,
1643 223, -1, 222, -1, 189, 224, -1, 226, 227, -1,
1644 217, 227, -1, 228, 167, 229, -1, 228, 231, -1,
1645 -1, 18, -1, 64, 225, -1, 64, 10, -1, 65,
1646 14, 224, -1, 65, 11, 224, 144, 14, 224, 144,
1647 14, 224, -1, 66, 163, 224, 144, 14, 224, 149,
1648 230, 151, -1, 66, 163, 224, 144, 14, 224, 149,
1649 151, -1, 67, 177, 191, 224, 147, 233, 148, 181,
1650 35, 14, 224, 68, 14, 224, -1, 68, -1, 69,
1651 -1, 230, 163, 222, 144, 14, 224, -1, 163, 222,
1652 144, 14, 224, -1, 167, 236, -1, 189, 149, 224,
1653 144, 224, 151, -1, 232, 144, 149, 224, 144, 224,
1654 151, -1, 189, 224, 179, -1, 233, 144, 189, 224,
1655 179, -1, -1, -1, 234, 144, 225, -1, 53, 52,
1656 -1, 52, -1, 158, 189, 224, 144, 224, -1, 159,
1657 189, 224, 144, 224, -1, 85, 161, 189, 224, 144,
1658 224, -1, 86, 162, 189, 224, 144, 224, -1, 160,
1659 225, 35, 189, -1, 126, 225, 144, 225, 144, 225,
1660 -1, 127, 225, 144, 189, -1, 128, 225, 144, 225,
1661 -1, 129, 225, 144, 225, 144, 225, -1, 130, 225,
1662 144, 225, 144, 225, -1, 125, 232, -1, 235, 177,
1663 191, 224, 147, 233, 148, 181, -1, 238, -1, 33,
1664 -1, -1, 107, 189, 183, -1, 107, 189, 144, 11,
1665 224, 183, -1, 108, 189, 183, -1, 108, 189, 144,
1666 11, 224, 183, -1, 109, 225, -1, 237, 110, 189,
1667 224, 183, -1, 237, 111, 225, 144, 189, 224, 183,
1668 -1, 112, 189, 224, 234, -1
1671 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1672 static const unsigned short yyrline[] =
1674 0, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
1675 1116, 1117, 1117, 1117, 1117, 1117, 1117, 1118, 1118, 1118,
1676 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1122,
1677 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1130,
1678 1130, 1131, 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135,
1679 1135, 1136, 1136, 1137, 1138, 1143, 1144, 1144, 1146, 1146,
1680 1146, 1147, 1147, 1151, 1155, 1160, 1160, 1162, 1163, 1168,
1681 1174, 1175, 1176, 1177, 1178, 1182, 1183, 1184, 1188, 1189,
1682 1190, 1191, 1195, 1196, 1197, 1201, 1202, 1203, 1204, 1205,
1683 1209, 1210, 1211, 1214, 1215, 1216, 1217, 1218, 1219, 1220,
1684 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1238,
1685 1239, 1244, 1245, 1246, 1247, 1250, 1251, 1258, 1259, 1265,
1686 1266, 1274, 1282, 1283, 1288, 1289, 1290, 1295, 1308, 1308,
1687 1308, 1308, 1311, 1315, 1319, 1326, 1331, 1339, 1369, 1400,
1688 1405, 1417, 1427, 1431, 1441, 1448, 1455, 1462, 1467, 1472,
1689 1479, 1480, 1487, 1494, 1502, 1508, 1520, 1548, 1564, 1591,
1690 1619, 1645, 1665, 1691, 1711, 1723, 1730, 1796, 1806, 1816,
1691 1822, 1832, 1838, 1848, 1853, 1858, 1866, 1878, 1900, 1908,
1692 1914, 1925, 1930, 1935, 1941, 1947, 1956, 1960, 1968, 1968,
1693 1971, 1971, 1974, 1985, 2006, 2011, 2019, 2020, 2024, 2024,
1694 2028, 2028, 2031, 2034, 2058, 2069, 2069, 2080, 2079, 2089,
1695 2088, 2099, 2118, 2121, 2127, 2137, 2141, 2146, 2148, 2153,
1696 2158, 2167, 2177, 2188, 2192, 2201, 2210, 2215, 2336, 2336,
1697 2338, 2347, 2347, 2349, 2354, 2366, 2370, 2375, 2379, 2383,
1698 2387, 2391, 2395, 2399, 2403, 2407, 2432, 2436, 2446, 2450,
1699 2454, 2459, 2466, 2466, 2472, 2481, 2485, 2494, 2503, 2512,
1700 2516, 2523, 2527, 2531, 2536, 2546, 2565, 2574, 2654, 2658,
1701 2665, 2676, 2689, 2699, 2710, 2720, 2729, 2738, 2741, 2742,
1702 2749, 2753, 2758, 2779, 2796, 2810, 2824, 2836, 2844, 2851,
1703 2857, 2863, 2869, 2884, 2969, 2974, 2978, 2985, 2992, 3000,
1704 3007, 3015, 3023, 3037, 3054
1708 #if YYDEBUG || YYERROR_VERBOSE
1709 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1710 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1711 static const char *const yytname[] =
1713 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1714 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1715 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1716 "STRINGCONSTANT", "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT",
1717 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1718 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "ALIAS",
1719 "VOLATILE", "THREAD_LOCAL", "TO", "DOTDOTDOT", "NULL_TOK", "UNDEF",
1720 "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT",
1721 "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE", "ALIGN",
1722 "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK",
1723 "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1724 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1725 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1726 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1727 "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT",
1728 "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO",
1729 "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1730 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1731 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1732 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1733 "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1734 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "DEFAULT", "HIDDEN", "PROTECTED",
1735 "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'",
1736 "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps",
1737 "CastOps", "IPredicates", "FPredicates", "IntType", "FPType",
1738 "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1739 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1740 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1741 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1742 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign",
1743 "SectionString", "OptSection", "GlobalVarAttributes",
1744 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1745 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1746 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1747 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1748 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1749 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1750 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1751 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1752 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1753 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1754 "OptVolatile", "MemoryInst", 0
1759 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1761 static const unsigned short yytoknum[] =
1763 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1764 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1765 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1766 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1767 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1768 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1769 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1770 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1771 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1772 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1773 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1774 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1775 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1776 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1777 395, 396, 397, 61, 44, 42, 92, 40, 41, 91,
1778 120, 93, 60, 62, 123, 125, 99
1782 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1783 static const unsigned char yyr1[] =
1785 0, 157, 158, 158, 158, 158, 158, 158, 158, 158,
1786 158, 159, 159, 159, 159, 159, 159, 160, 160, 160,
1787 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1788 161, 161, 161, 161, 161, 161, 161, 161, 161, 162,
1789 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
1790 162, 162, 162, 162, 162, 163, 164, 164, 165, 165,
1791 165, 166, 166, 167, 167, 168, 168, 169, 169, 170,
1792 171, 171, 171, 171, 171, 172, 172, 172, 173, 173,
1793 173, 173, 174, 174, 174, 175, 175, 175, 175, 175,
1794 176, 176, 176, 177, 177, 177, 177, 177, 177, 177,
1795 178, 178, 178, 178, 178, 178, 178, 178, 178, 179,
1796 179, 180, 180, 180, 180, 181, 181, 182, 182, 183,
1797 183, 184, 185, 185, 186, 186, 187, 187, 188, 188,
1798 188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
1799 189, 189, 189, 189, 189, 190, 191, 191, 192, 192,
1800 193, 193, 193, 193, 194, 194, 195, 195, 195, 195,
1801 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1802 195, 195, 195, 195, 195, 195, 196, 196, 196, 196,
1803 196, 196, 196, 196, 196, 196, 197, 197, 198, 198,
1804 199, 199, 200, 200, 201, 201, 202, 202, 204, 203,
1805 205, 203, 203, 203, 203, 206, 203, 207, 203, 208,
1806 203, 203, 203, 203, 209, 210, 210, 211, 212, 212,
1807 212, 213, 213, 214, 214, 214, 214, 215, 216, 216,
1808 217, 218, 218, 219, 220, 221, 221, 222, 222, 222,
1809 222, 222, 222, 222, 222, 222, 222, 222, 223, 223,
1810 223, 223, 224, 224, 225, 226, 226, 227, 228, 228,
1811 228, 229, 229, 229, 229, 229, 229, 229, 229, 229,
1812 230, 230, 231, 232, 232, 233, 233, 233, 234, 234,
1813 235, 235, 236, 236, 236, 236, 236, 236, 236, 236,
1814 236, 236, 236, 236, 236, 237, 237, 238, 238, 238,
1815 238, 238, 238, 238, 238
1818 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1819 static const unsigned char yyr2[] =
1821 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1822 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1823 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1825 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1826 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1827 1, 1, 0, 2, 0, 1, 1, 1, 0, 2,
1828 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
1829 1, 1, 0, 1, 1, 0, 1, 1, 1, 1,
1830 0, 1, 1, 0, 1, 1, 1, 1, 1, 2,
1831 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1832 2, 1, 1, 1, 1, 0, 2, 0, 2, 0,
1833 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1834 1, 1, 1, 1, 2, 1, 2, 5, 5, 5,
1835 5, 3, 2, 5, 4, 2, 1, 1, 1, 3,
1836 1, 3, 1, 0, 1, 3, 4, 3, 3, 4,
1837 4, 3, 6, 5, 2, 2, 2, 2, 2, 2,
1838 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1839 6, 7, 7, 6, 8, 8, 3, 1, 1, 1,
1840 1, 0, 2, 6, 1, 0, 1, 2, 0, 3,
1841 0, 3, 3, 3, 3, 0, 7, 0, 8, 0,
1842 8, 5, 2, 3, 1, 3, 3, 3, 3, 1,
1843 0, 5, 3, 1, 3, 1, 0, 9, 1, 1,
1844 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1845 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1846 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1847 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1848 6, 5, 2, 6, 7, 3, 5, 0, 0, 3,
1849 2, 1, 5, 5, 6, 6, 4, 6, 4, 4,
1850 6, 6, 2, 8, 1, 1, 0, 3, 6, 3,
1854 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1855 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1856 means the default is an error. */
1857 static const unsigned short yydefact[] =
1859 68, 58, 65, 59, 66, 60, 200, 198, 0, 0,
1860 0, 0, 0, 0, 78, 67, 0, 68, 196, 82,
1861 85, 0, 0, 212, 0, 0, 63, 0, 69, 70,
1862 72, 71, 73, 75, 74, 76, 77, 79, 80, 81,
1863 78, 78, 191, 1, 197, 83, 84, 78, 201, 86,
1864 87, 88, 89, 78, 259, 199, 259, 0, 0, 220,
1865 213, 214, 202, 248, 249, 204, 128, 129, 130, 131,
1866 132, 0, 0, 0, 0, 250, 251, 133, 203, 135,
1867 191, 191, 90, 190, 0, 93, 93, 260, 256, 64,
1868 231, 232, 233, 255, 215, 216, 219, 0, 153, 136,
1869 0, 0, 0, 0, 142, 154, 0, 134, 153, 0,
1870 0, 92, 91, 0, 188, 189, 0, 0, 94, 95,
1871 96, 97, 98, 0, 234, 0, 296, 258, 0, 217,
1872 152, 109, 148, 150, 0, 0, 0, 0, 0, 0,
1873 141, 0, 0, 0, 147, 0, 146, 0, 211, 128,
1874 129, 130, 0, 0, 0, 205, 99, 0, 228, 229,
1875 230, 295, 281, 0, 0, 0, 0, 93, 268, 269,
1876 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
1877 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
1878 0, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1879 26, 27, 28, 0, 0, 0, 0, 0, 0, 0,
1880 0, 0, 257, 93, 272, 0, 294, 218, 145, 0,
1881 115, 0, 0, 144, 0, 155, 115, 207, 209, 0,
1882 192, 173, 174, 169, 171, 170, 172, 175, 168, 164,
1883 165, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1884 0, 0, 0, 0, 0, 167, 166, 124, 0, 280,
1885 262, 0, 261, 0, 0, 55, 0, 0, 29, 30,
1886 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
1887 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
1888 44, 45, 46, 47, 48, 0, 119, 119, 301, 0,
1889 0, 292, 0, 0, 0, 0, 0, 0, 0, 0,
1890 0, 0, 0, 101, 103, 102, 100, 104, 105, 106,
1891 107, 108, 110, 151, 149, 138, 139, 140, 143, 137,
1892 124, 124, 0, 0, 0, 0, 0, 0, 0, 0,
1893 157, 187, 0, 0, 0, 161, 0, 158, 0, 0,
1894 0, 0, 206, 226, 237, 238, 239, 244, 240, 241,
1895 242, 243, 235, 0, 246, 253, 252, 254, 0, 263,
1896 0, 0, 0, 0, 0, 297, 0, 299, 278, 0,
1897 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1898 0, 0, 114, 113, 111, 112, 116, 208, 210, 0,
1899 0, 0, 278, 0, 0, 0, 0, 0, 156, 142,
1900 154, 0, 159, 160, 0, 0, 0, 0, 0, 126,
1901 124, 225, 109, 223, 0, 236, 0, 0, 0, 0,
1902 0, 0, 0, 0, 0, 0, 304, 0, 0, 0,
1903 288, 289, 0, 0, 0, 0, 286, 0, 119, 0,
1904 0, 0, 0, 0, 0, 0, 0, 0, 186, 163,
1905 0, 0, 0, 0, 121, 127, 125, 62, 0, 115,
1906 0, 245, 0, 0, 277, 0, 0, 119, 120, 119,
1907 0, 0, 0, 0, 0, 0, 282, 283, 277, 0,
1908 302, 0, 193, 0, 0, 177, 0, 0, 0, 0,
1909 162, 0, 0, 0, 61, 222, 224, 109, 122, 0,
1910 0, 0, 0, 0, 284, 285, 298, 300, 279, 0,
1911 0, 287, 290, 291, 0, 119, 0, 0, 0, 183,
1912 0, 0, 179, 180, 176, 62, 123, 117, 247, 0,
1913 0, 109, 0, 115, 273, 0, 115, 303, 181, 182,
1914 0, 0, 0, 221, 0, 227, 0, 266, 0, 0,
1915 275, 0, 0, 274, 293, 178, 184, 185, 118, 264,
1916 0, 265, 0, 109, 0, 0, 0, 276, 0, 0,
1917 0, 0, 271, 0, 0, 270, 0, 267
1920 /* YYDEFGOTO[NTERM-NUM]. */
1921 static const short yydefgoto[] =
1923 -1, 252, 253, 254, 278, 295, 152, 153, 75, 505,
1924 12, 76, 14, 15, 40, 41, 42, 47, 53, 113,
1925 123, 322, 218, 396, 325, 555, 375, 419, 537, 352,
1926 420, 77, 154, 132, 147, 133, 134, 106, 341, 364,
1927 342, 116, 84, 148, 16, 17, 18, 20, 19, 257,
1928 330, 331, 62, 23, 60, 97, 423, 424, 124, 160,
1929 54, 92, 55, 48, 426, 365, 79, 367, 262, 56,
1930 88, 89, 212, 559, 127, 301, 513, 436, 213, 214,
1934 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1936 #define YYPACT_NINF -522
1937 static const short yypact[] =
1939 40, -522, -522, -522, -522, -522, -522, -522, -24, -105,
1940 -4, -80, 60, -32, 461, -522, 134, 1386, -522, 153,
1941 150, 1, 15, -522, 16, 130, -522, 1208, -522, -522,
1942 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
1943 126, 126, 239, -522, -522, -522, -522, 126, -522, -522,
1944 -522, -522, -522, 126, 158, -522, -7, 168, 183, 194,
1945 -522, -522, -522, -522, -522, 45, -522, -522, -522, -522,
1946 -522, 212, 226, 6, 198, -522, -522, -522, 127, -522,
1947 204, 204, 248, -522, 218, 113, 113, -522, -522, 135,
1948 -522, -522, -522, -522, -522, -522, -522, -44, 1006, -522,
1949 101, 107, 371, 45, -522, 127, -103, -522, 1006, 218,
1950 218, -522, -522, 1043, -522, -522, 1223, 259, -522, -522,
1951 -522, -522, -522, 1274, -522, -13, 1423, -522, 269, -522,
1952 -522, 127, -522, 162, 146, 1305, 1305, 144, -101, 1305,
1953 -522, 159, 1223, 1305, 45, 161, 127, 85, -522, 41,
1954 301, 302, 250, 304, 782, -522, -522, 79, -522, -522,
1955 -522, -522, -522, 263, 1320, 193, 305, 113, -522, -522,
1956 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
1957 -522, -522, -522, -522, -522, 133, 456, 1305, 1305, 1305,
1958 1305, -522, -522, -522, -522, -522, -522, -522, -522, -522,
1959 -522, -522, -522, 1305, 1305, 1305, 1305, 1305, 1305, 1305,
1960 1305, 1305, -522, 113, -522, 165, -522, -522, 519, 1060,
1961 -522, -18, -33, -522, 166, 127, -522, -522, 127, 1043,
1962 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
1963 -522, 133, 456, 171, 174, 175, 177, 178, 1111, 1371,
1964 579, 307, 181, 182, 184, -522, -522, 186, 187, -522,
1965 45, 623, -522, 757, 757, -522, 757, 1274, -522, -522,
1966 -522, -522, -522, -522, -522, -522, -522, -522, 1305, -522,
1967 -522, -522, -522, -522, -522, -522, -522, -522, -522, -522,
1968 -522, -522, -522, -522, -522, 1305, 98, 114, -522, 623,
1969 -64, 195, 196, 201, 202, 210, 216, 623, 623, 303,
1970 1274, 1305, 1305, -522, -522, -522, -522, -522, -522, -522,
1971 -522, -522, -522, -522, -522, 104, -522, -522, -522, 104,
1972 186, 186, 313, 190, 214, 1223, 1223, 1223, 1223, 1223,
1973 -522, -522, -36, 962, -111, -522, -78, -522, 1223, 1223,
1974 1223, 3, -522, 1126, -522, -522, -522, -522, -522, -522,
1975 -522, -522, 308, 1223, -522, -522, -522, -522, 219, -522,
1976 221, 757, 623, 623, 20, -522, 21, -522, -522, 757,
1977 225, 1305, 1305, 1305, 1305, 1305, 224, 227, 1305, 757,
1978 623, 231, -522, -522, -522, -522, -522, -522, -522, 1305,
1979 1223, 1223, -522, 233, 242, 245, 249, 1223, -522, 217,
1980 782, -65, -522, -522, 256, 257, 359, 386, 402, -522,
1981 186, -522, 127, 265, 264, -522, 394, -75, 400, 401,
1982 271, 275, 276, 757, 418, 757, 282, 285, 757, 289,
1983 127, -522, 290, 296, 757, 757, 127, 294, 300, 1305,
1984 -29, 306, 309, -50, 1223, 1223, 1223, 1223, -522, -522,
1985 292, 1223, 1223, 1305, -522, -522, -522, 293, 1157, -522,
1986 311, -522, 757, 757, 1305, 757, 757, 300, -522, 300,
1987 1305, 757, 312, 1305, 1305, 1305, -522, -522, 1305, 397,
1988 -522, 623, -522, 1223, 1223, -522, 316, 315, 317, 320,
1989 -522, 318, 321, 117, -522, -522, -522, 127, -1, 430,
1990 324, 322, 623, -8, -522, -522, -522, -522, -522, 314,
1991 757, -522, -522, -522, -5, 300, 329, 330, 1223, -522,
1992 1223, 1223, -522, -522, -522, 293, -522, 431, -522, 437,
1993 2, -522, 1305, -522, -522, 332, -522, -522, -522, -522,
1994 336, 337, 338, -522, 448, -522, 757, -522, 917, 4,
1995 519, 623, 14, -522, 104, -522, -522, -522, -522, -522,
1996 343, -522, 917, -522, 474, 475, 346, 519, 757, 757,
1997 477, 426, -522, 757, 481, -522, 757, -522
2000 /* YYPGOTO[NTERM-NUM]. */
2001 static const short yypgoto[] =
2003 -522, 370, 372, 373, 266, 255, -164, -522, 0, -25,
2004 420, 9, -522, -522, -522, -522, 33, -522, -522, -522,
2005 -151, -522, -404, -522, -223, -522, -291, 5, -522, -295,
2006 -522, -522, -26, 295, -115, -522, 403, 410, -58, -150,
2007 -221, 173, 222, 286, -522, -522, 501, -522, -522, -522,
2008 -522, -522, -522, -522, -522, -522, -522, -522, 433, -522,
2009 -522, -522, -522, -522, -522, -521, -140, 103, -184, -522,
2010 465, -522, -522, -522, -522, -522, 34, 122, -522, -522,
2014 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2015 positive, shift that token. If negative, reduce the rule which
2016 number is the opposite. If zero, do what YYDEFACT says.
2017 If YYTABLE_NINF, syntax error. */
2018 #define YYTABLE_NINF -196
2019 static const short yytable[] =
2021 11, 78, 266, 329, 255, 298, 377, 230, 157, 13,
2022 101, 87, 158, 265, 256, 265, 267, 11, 467, 90,
2023 302, 303, 304, 305, 306, 21, 13, 309, 344, 346,
2024 417, 433, 435, 407, 417, 397, 398, 570, 24, 22,
2025 -195, 139, 412, 139, -55, -55, -55, -55, 105, 574,
2026 25, 576, 140, 418, 224, -64, 1, 2, 155, 3,
2027 4, 5, 310, 26, 231, 232, 407, 6, 7, 407,
2028 434, 434, 131, 80, 81, 27, 105, 413, 471, 407,
2029 85, 107, 131, 108, 227, 379, 86, 146, 8, 11,
2030 460, 9, 63, 64, 480, 10, 2, 146, 495, 4,
2031 128, 1, 2, 535, 3, 4, 5, 129, 407, 221,
2032 222, 28, 107, 225, 108, 408, 107, 228, 108, 492,
2033 327, 366, 411, 366, 366, 466, 366, 107, 391, 108,
2034 392, 393, 394, 326, 43, 395, 542, 560, 261, 542,
2035 543, 159, 427, 546, 57, 392, 393, 394, 91, 61,
2036 395, 1, 371, 557, 3, 571, 5, 490, 58, 366,
2037 102, 296, 297, 261, 299, 59, 258, 366, 366, 577,
2038 117, 118, 119, 120, 121, 122, 87, 300, 261, 261,
2039 261, 261, 261, 307, 308, 261, 516, 94, 517, 49,
2040 50, 51, 98, 131, 52, 389, 45, 439, 46, 441,
2041 442, 443, 95, 146, 263, 63, 64, 264, 103, 66,
2042 67, 68, 69, 96, 1, 2, 99, 3, 4, 5,
2043 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
2044 100, 366, 366, 366, 547, 392, 393, 394, 83, 366,
2045 395, 146, 374, 107, 70, 108, 508, 114, 115, 366,
2046 366, 135, 372, 233, 234, 235, 236, 136, 376, 107,
2047 255, 108, 107, 156, 108, 534, 37, 38, 39, 373,
2048 256, 82, 107, 83, 108, 311, 312, 402, 403, 404,
2049 405, 406, 142, 143, 146, 390, 261, 111, 217, 112,
2050 414, 415, 416, 366, 220, 366, 518, 223, 366, 521,
2051 522, 523, 109, 110, 366, 366, 219, 226, 229, 1,
2052 -56, -57, 3, 237, 5, 259, 265, 410, 335, 328,
2053 562, 336, 337, 564, 338, 339, 347, 422, 348, 349,
2054 351, 350, 366, 366, 353, 366, 366, 400, 388, 380,
2055 381, 366, 451, 452, 71, 382, 383, 72, 399, 458,
2056 73, 366, 74, 104, 384, 261, 440, 261, 261, 261,
2057 385, 401, 446, 428, 425, 429, 368, 369, 444, 370,
2058 459, 445, 366, 450, 438, 449, 558, 454, 63, 64,
2059 366, 103, 66, 67, 68, 69, 455, 1, 2, 456,
2060 3, 4, 5, 457, 463, 572, 496, 497, 498, 499,
2061 461, 462, 378, 501, 502, 464, 465, 313, 314, 468,
2062 386, 387, 469, 470, 472, 473, 366, 70, 474, 475,
2063 476, 366, 478, 491, 315, 316, 480, 317, 318, 481,
2064 319, 320, 321, 483, 484, 526, 527, 503, 366, 366,
2065 485, 488, 507, 366, 489, 500, 366, 434, 512, 538,
2066 493, 556, 568, 494, 261, 509, 520, 261, 261, 261,
2067 528, 530, 512, 529, 531, 544, 532, 504, 539, 533,
2068 550, 540, 551, 552, 430, 431, 432, 548, 549, 279,
2069 280, 554, 437, 563, 565, 566, 567, 575, 578, 579,
2070 580, 583, 447, 448, 584, 586, 209, 334, 210, 211,
2071 29, 30, 31, 32, 33, 34, 35, 333, 36, 126,
2072 553, 141, 138, 536, 324, 332, 561, 71, 44, 125,
2073 72, 93, 524, 73, 453, 74, 137, 0, 0, 0,
2074 0, 0, 0, 0, 0, 504, 477, 0, 479, 0,
2075 0, 482, 0, 0, 0, 0, 0, 486, 487, 281,
2076 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
2077 292, 293, 294, 0, 0, 0, 0, 0, 0, 0,
2078 0, 0, 0, 0, 0, 510, 511, 0, 514, 515,
2079 0, 0, 0, 0, 519, 0, 63, 64, 0, 103,
2080 149, 150, 151, 69, 525, 1, 2, 0, 3, 4,
2081 5, 37, 38, 39, 0, 0, 0, 0, 0, 0,
2082 0, 0, 0, 0, 0, 541, 0, 0, 0, 0,
2083 0, 0, 0, 545, 0, 70, 354, 355, 0, 0,
2084 63, 64, 356, 313, 314, 0, 0, 0, 0, 1,
2085 2, 0, 3, 4, 5, 357, 358, 359, 0, 0,
2086 315, 316, 0, 317, 318, 0, 319, 320, 321, 569,
2087 360, 361, 0, 0, 573, 0, 0, 0, 0, 0,
2088 0, 0, 0, 0, 0, 0, 0, 362, 0, 0,
2089 0, 581, 582, 0, 0, 0, 585, 0, 0, 587,
2090 0, 0, 0, 170, 171, 172, 173, 174, 175, 176,
2091 177, 178, 179, 180, 181, 182, 183, 184, 241, 242,
2092 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2093 0, 0, 0, 0, 0, 71, 0, 0, 72, 0,
2094 0, 73, 0, 74, 345, 243, 191, 192, 193, 194,
2095 195, 196, 197, 198, 199, 200, 201, 202, 0, 244,
2096 0, 245, 246, 247, 0, 0, 0, 0, 0, 0,
2097 354, 355, 0, 0, 63, 64, 356, 0, 107, 0,
2098 108, 0, 0, 1, 2, 363, 3, 4, 5, 357,
2099 358, 359, 0, 0, 0, 0, 0, 0, 0, 63,
2100 64, 0, 0, 0, 360, 361, 0, 0, 1, 2,
2101 0, 3, 4, 5, 238, 0, 0, 0, 0, 0,
2102 0, 362, 0, 0, 0, 0, 0, 0, 0, 239,
2103 240, 0, 0, 0, 0, 0, 0, 170, 171, 172,
2104 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2105 183, 184, 241, 242, 0, 0, 0, 0, 0, 0,
2106 0, 0, 170, 171, 172, 173, 174, 175, 176, 177,
2107 178, 179, 180, 181, 182, 183, 184, 241, 242, 243,
2108 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2109 201, 202, 0, 244, 0, 245, 246, 247, 0, 0,
2110 0, 0, 0, 0, 243, 191, 192, 193, 194, 195,
2111 196, 197, 198, 199, 200, 201, 202, 0, 244, 363,
2112 245, 246, 247, 0, 0, 0, 0, 0, 0, 0,
2113 354, 355, 0, 0, 0, 0, 356, 107, 0, 108,
2114 0, 248, 0, 0, 249, 0, 250, 0, 251, 357,
2115 358, 359, 0, 0, 0, 0, 0, 0, 0, 0,
2116 0, 0, 0, 0, 360, 361, 0, 0, 0, 0,
2117 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
2118 64, 362, 103, 149, 150, 151, 69, 0, 1, 2,
2119 0, 3, 4, 5, 0, 0, 0, 170, 171, 172,
2120 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2121 183, 184, 241, 242, 0, 0, 0, 0, 70, 0,
2122 0, 0, 0, 63, 64, 0, 103, 66, 67, 68,
2123 69, 0, 1, 2, 0, 3, 4, 5, 0, 243,
2124 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2125 201, 202, 130, 244, 0, 245, 246, 247, 0, 0,
2126 63, 64, 70, 144, 66, 67, 68, 69, 0, 1,
2127 2, 0, 3, 4, 5, 0, 0, 63, 64, 363,
2128 103, 66, 67, 68, 69, 0, 1, 2, 0, 3,
2129 4, 5, 0, 0, 0, 0, 0, 0, 0, 70,
2130 0, 0, 0, 0, 0, 0, 323, 0, 0, 0,
2131 0, 0, 0, 0, 0, 0, 70, 0, 71, 0,
2132 0, 72, 0, 0, 73, 0, 74, 409, 63, 64,
2133 0, 103, 149, 150, 151, 69, 0, 1, 2, 0,
2134 3, 4, 5, 63, 64, 0, 103, 66, 67, 68,
2135 69, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2136 0, 0, 71, 0, 0, 72, 0, 70, 73, 0,
2137 74, 145, 421, 0, 63, 64, 0, 103, 66, 67,
2138 68, 69, 70, 1, 2, 0, 3, 4, 5, 0,
2139 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
2140 0, 0, 72, 506, 0, 73, 0, 74, 0, 0,
2141 0, 0, 0, 70, 0, 0, 71, 0, 0, 72,
2142 0, 0, 73, 0, 74, 63, 64, 0, 65, 66,
2143 67, 68, 69, 0, 1, 2, 0, 3, 4, 5,
2144 63, 64, 0, 103, 149, 150, 151, 69, 0, 1,
2145 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2146 0, 0, 0, 0, 70, 0, 0, 71, 0, 0,
2147 72, 0, 340, 73, 0, 74, 0, 0, 0, 70,
2148 0, 0, 71, 0, 0, 72, 0, 0, 73, 0,
2149 74, 63, 64, 0, 144, 66, 67, 68, 69, 0,
2150 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2151 0, 0, 0, 71, 0, 0, 72, 0, 0, 73,
2152 0, 74, 63, 64, 0, 103, 66, 67, 68, 69,
2153 70, 1, 2, 0, 3, 4, 5, 63, 64, 0,
2154 260, 66, 67, 68, 69, 0, 1, 2, 0, 3,
2155 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2156 0, 70, 0, 0, 71, 0, 0, 72, 0, 0,
2157 73, 0, 74, 0, 0, 0, 70, 0, 0, 71,
2158 0, 0, 72, 0, 0, 73, 0, 74, 63, 64,
2159 0, 103, 149, 150, 151, 69, -194, 1, 2, 0,
2160 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2161 0, -64, 1, 2, 0, 3, 4, 5, 0, 0,
2162 0, 0, 0, 6, 7, 0, 0, 70, 0, 0,
2163 71, 0, 0, 72, 0, 0, 73, 0, 74, 0,
2164 0, 0, 0, 0, 8, 0, 0, 9, 0, 0,
2165 0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
2166 0, 71, 0, 0, 72, 0, 161, 73, 0, 74,
2167 0, 0, 0, 0, 0, 0, 71, 0, 0, 72,
2168 0, 0, 73, 0, 74, 162, 163, 0, 0, 0,
2169 0, 0, 0, 0, 0, 0, 0, 164, 165, 166,
2170 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2171 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2172 0, 0, 0, 0, 0, 0, 0, 71, 0, 0,
2173 72, 0, 0, 73, 0, 343, 0, 0, 0, 0,
2174 187, 188, 189, 0, 0, 190, 191, 192, 193, 194,
2175 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
2179 static const short yycheck[] =
2181 0, 27, 166, 226, 154, 189, 297, 147, 123, 0,
2182 4, 18, 25, 11, 154, 11, 167, 17, 422, 26,
2183 204, 205, 206, 207, 208, 49, 17, 211, 249, 250,
2184 31, 11, 11, 144, 31, 330, 331, 558, 143, 63,
2185 0, 144, 153, 144, 3, 4, 5, 6, 74, 35,
2186 54, 572, 155, 50, 155, 15, 16, 17, 116, 19,
2187 20, 21, 213, 143, 23, 24, 144, 27, 28, 144,
2188 50, 50, 98, 40, 41, 15, 102, 155, 153, 144,
2189 47, 145, 108, 147, 142, 149, 53, 113, 48, 89,
2190 155, 51, 7, 8, 144, 55, 17, 123, 148, 20,
2191 144, 16, 17, 507, 19, 20, 21, 151, 144, 135,
2192 136, 143, 145, 139, 147, 151, 145, 143, 147, 148,
2193 153, 261, 343, 263, 264, 420, 266, 145, 312, 147,
2194 131, 132, 133, 151, 0, 136, 144, 541, 164, 144,
2195 148, 154, 363, 148, 143, 131, 132, 133, 155, 19,
2196 136, 16, 267, 151, 19, 151, 21, 448, 143, 299,
2197 154, 187, 188, 189, 190, 149, 157, 307, 308, 573,
2198 57, 58, 59, 60, 61, 62, 18, 203, 204, 205,
2199 206, 207, 208, 209, 210, 211, 477, 19, 479, 39,
2200 40, 41, 147, 219, 44, 310, 43, 381, 45, 383,
2201 384, 385, 19, 229, 11, 7, 8, 14, 10, 11,
2202 12, 13, 14, 19, 16, 17, 4, 19, 20, 21,
2203 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2204 4, 371, 372, 373, 525, 131, 132, 133, 34, 379,
2205 136, 267, 144, 145, 46, 147, 469, 29, 30, 389,
2206 390, 150, 278, 3, 4, 5, 6, 150, 144, 145,
2207 410, 147, 145, 4, 147, 148, 140, 141, 142, 295,
2208 410, 32, 145, 34, 147, 110, 111, 335, 336, 337,
2209 338, 339, 109, 110, 310, 311, 312, 39, 19, 41,
2210 348, 349, 350, 433, 148, 435, 480, 153, 438, 483,
2211 484, 485, 80, 81, 444, 445, 144, 148, 147, 16,
2212 9, 9, 19, 9, 21, 52, 11, 343, 147, 153,
2213 543, 147, 147, 546, 147, 147, 19, 353, 147, 147,
2214 144, 147, 472, 473, 147, 475, 476, 147, 35, 144,
2215 144, 481, 400, 401, 146, 144, 144, 149, 35, 407,
2216 152, 491, 154, 155, 144, 381, 382, 383, 384, 385,
2217 144, 147, 388, 144, 56, 144, 263, 264, 144, 266,
2218 153, 144, 512, 399, 149, 144, 540, 144, 7, 8,
2219 520, 10, 11, 12, 13, 14, 144, 16, 17, 144,
2220 19, 20, 21, 144, 35, 559, 454, 455, 456, 457,
2221 144, 144, 299, 461, 462, 19, 4, 114, 115, 144,
2222 307, 308, 148, 19, 14, 14, 556, 46, 147, 144,
2223 144, 561, 4, 449, 131, 132, 144, 134, 135, 144,
2224 137, 138, 139, 144, 144, 493, 494, 463, 578, 579,
2225 144, 147, 468, 583, 144, 153, 586, 50, 474, 19,
2226 144, 14, 4, 144, 480, 144, 144, 483, 484, 485,
2227 144, 144, 488, 148, 144, 151, 148, 467, 144, 148,
2228 528, 149, 530, 531, 371, 372, 373, 148, 148, 23,
2229 24, 50, 379, 151, 148, 148, 148, 144, 14, 14,
2230 144, 14, 389, 390, 68, 14, 126, 242, 126, 126,
2231 39, 40, 41, 42, 43, 44, 45, 241, 47, 89,
2232 535, 108, 102, 508, 219, 229, 542, 146, 17, 86,
2233 149, 56, 488, 152, 402, 154, 155, -1, -1, -1,
2234 -1, -1, -1, -1, -1, 535, 433, -1, 435, -1,
2235 -1, 438, -1, -1, -1, -1, -1, 444, 445, 93,
2236 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2237 104, 105, 106, -1, -1, -1, -1, -1, -1, -1,
2238 -1, -1, -1, -1, -1, 472, 473, -1, 475, 476,
2239 -1, -1, -1, -1, 481, -1, 7, 8, -1, 10,
2240 11, 12, 13, 14, 491, 16, 17, -1, 19, 20,
2241 21, 140, 141, 142, -1, -1, -1, -1, -1, -1,
2242 -1, -1, -1, -1, -1, 512, -1, -1, -1, -1,
2243 -1, -1, -1, 520, -1, 46, 3, 4, -1, -1,
2244 7, 8, 9, 114, 115, -1, -1, -1, -1, 16,
2245 17, -1, 19, 20, 21, 22, 23, 24, -1, -1,
2246 131, 132, -1, 134, 135, -1, 137, 138, 139, 556,
2247 37, 38, -1, -1, 561, -1, -1, -1, -1, -1,
2248 -1, -1, -1, -1, -1, -1, -1, 54, -1, -1,
2249 -1, 578, 579, -1, -1, -1, 583, -1, -1, 586,
2250 -1, -1, -1, 70, 71, 72, 73, 74, 75, 76,
2251 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2252 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2253 -1, -1, -1, -1, -1, 146, -1, -1, 149, -1,
2254 -1, 152, -1, 154, 155, 112, 113, 114, 115, 116,
2255 117, 118, 119, 120, 121, 122, 123, 124, -1, 126,
2256 -1, 128, 129, 130, -1, -1, -1, -1, -1, -1,
2257 3, 4, -1, -1, 7, 8, 9, -1, 145, -1,
2258 147, -1, -1, 16, 17, 152, 19, 20, 21, 22,
2259 23, 24, -1, -1, -1, -1, -1, -1, -1, 7,
2260 8, -1, -1, -1, 37, 38, -1, -1, 16, 17,
2261 -1, 19, 20, 21, 22, -1, -1, -1, -1, -1,
2262 -1, 54, -1, -1, -1, -1, -1, -1, -1, 37,
2263 38, -1, -1, -1, -1, -1, -1, 70, 71, 72,
2264 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2265 83, 84, 85, 86, -1, -1, -1, -1, -1, -1,
2266 -1, -1, 70, 71, 72, 73, 74, 75, 76, 77,
2267 78, 79, 80, 81, 82, 83, 84, 85, 86, 112,
2268 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2269 123, 124, -1, 126, -1, 128, 129, 130, -1, -1,
2270 -1, -1, -1, -1, 112, 113, 114, 115, 116, 117,
2271 118, 119, 120, 121, 122, 123, 124, -1, 126, 152,
2272 128, 129, 130, -1, -1, -1, -1, -1, -1, -1,
2273 3, 4, -1, -1, -1, -1, 9, 145, -1, 147,
2274 -1, 149, -1, -1, 152, -1, 154, -1, 156, 22,
2275 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2276 -1, -1, -1, -1, 37, 38, -1, -1, -1, -1,
2277 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2278 8, 54, 10, 11, 12, 13, 14, -1, 16, 17,
2279 -1, 19, 20, 21, -1, -1, -1, 70, 71, 72,
2280 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2281 83, 84, 85, 86, -1, -1, -1, -1, 46, -1,
2282 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2283 14, -1, 16, 17, -1, 19, 20, 21, -1, 112,
2284 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2285 123, 124, 36, 126, -1, 128, 129, 130, -1, -1,
2286 7, 8, 46, 10, 11, 12, 13, 14, -1, 16,
2287 17, -1, 19, 20, 21, -1, -1, 7, 8, 152,
2288 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2289 20, 21, -1, -1, -1, -1, -1, -1, -1, 46,
2290 -1, -1, -1, -1, -1, -1, 36, -1, -1, -1,
2291 -1, -1, -1, -1, -1, -1, 46, -1, 146, -1,
2292 -1, 149, -1, -1, 152, -1, 154, 155, 7, 8,
2293 -1, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2294 19, 20, 21, 7, 8, -1, 10, 11, 12, 13,
2295 14, -1, 16, 17, -1, 19, 20, 21, -1, -1,
2296 -1, -1, 146, -1, -1, 149, -1, 46, 152, -1,
2297 154, 118, 36, -1, 7, 8, -1, 10, 11, 12,
2298 13, 14, 46, 16, 17, -1, 19, 20, 21, -1,
2299 -1, -1, -1, -1, -1, -1, -1, -1, -1, 146,
2300 -1, -1, 149, 36, -1, 152, -1, 154, -1, -1,
2301 -1, -1, -1, 46, -1, -1, 146, -1, -1, 149,
2302 -1, -1, 152, -1, 154, 7, 8, -1, 10, 11,
2303 12, 13, 14, -1, 16, 17, -1, 19, 20, 21,
2304 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2305 17, -1, 19, 20, 21, -1, -1, -1, -1, -1,
2306 -1, -1, -1, -1, 46, -1, -1, 146, -1, -1,
2307 149, -1, 151, 152, -1, 154, -1, -1, -1, 46,
2308 -1, -1, 146, -1, -1, 149, -1, -1, 152, -1,
2309 154, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2310 16, 17, -1, 19, 20, 21, -1, -1, -1, -1,
2311 -1, -1, -1, 146, -1, -1, 149, -1, -1, 152,
2312 -1, 154, 7, 8, -1, 10, 11, 12, 13, 14,
2313 46, 16, 17, -1, 19, 20, 21, 7, 8, -1,
2314 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2315 20, 21, -1, -1, -1, -1, -1, -1, -1, -1,
2316 -1, 46, -1, -1, 146, -1, -1, 149, -1, -1,
2317 152, -1, 154, -1, -1, -1, 46, -1, -1, 146,
2318 -1, -1, 149, -1, -1, 152, -1, 154, 7, 8,
2319 -1, 10, 11, 12, 13, 14, 0, 16, 17, -1,
2320 19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
2321 -1, 15, 16, 17, -1, 19, 20, 21, -1, -1,
2322 -1, -1, -1, 27, 28, -1, -1, 46, -1, -1,
2323 146, -1, -1, 149, -1, -1, 152, -1, 154, -1,
2324 -1, -1, -1, -1, 48, -1, -1, 51, -1, -1,
2325 -1, 55, -1, -1, -1, -1, -1, -1, -1, -1,
2326 -1, 146, -1, -1, 149, -1, 33, 152, -1, 154,
2327 -1, -1, -1, -1, -1, -1, 146, -1, -1, 149,
2328 -1, -1, 152, -1, 154, 52, 53, -1, -1, -1,
2329 -1, -1, -1, -1, -1, -1, -1, 64, 65, 66,
2330 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2331 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2332 -1, -1, -1, -1, -1, -1, -1, 146, -1, -1,
2333 149, -1, -1, 152, -1, 154, -1, -1, -1, -1,
2334 107, 108, 109, -1, -1, 112, 113, 114, 115, 116,
2335 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2339 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2340 symbol of state STATE-NUM. */
2341 static const unsigned char yystos[] =
2343 0, 16, 17, 19, 20, 21, 27, 28, 48, 51,
2344 55, 165, 167, 168, 169, 170, 201, 202, 203, 205,
2345 204, 49, 63, 210, 143, 54, 143, 15, 143, 39,
2346 40, 41, 42, 43, 44, 45, 47, 140, 141, 142,
2347 171, 172, 173, 0, 203, 43, 45, 174, 220, 39,
2348 40, 41, 44, 175, 217, 219, 226, 143, 143, 149,
2349 211, 19, 209, 7, 8, 10, 11, 12, 13, 14,
2350 46, 146, 149, 152, 154, 165, 168, 188, 189, 223,
2351 173, 173, 32, 34, 199, 173, 173, 18, 227, 228,
2352 26, 155, 218, 227, 19, 19, 19, 212, 147, 4,
2353 4, 4, 154, 10, 155, 189, 194, 145, 147, 199,
2354 199, 39, 41, 176, 29, 30, 198, 57, 58, 59,
2355 60, 61, 62, 177, 215, 215, 167, 231, 144, 151,
2356 36, 189, 190, 192, 193, 150, 150, 155, 194, 144,
2357 155, 193, 198, 198, 10, 118, 189, 191, 200, 11,
2358 12, 13, 163, 164, 189, 195, 4, 191, 25, 154,
2359 216, 33, 52, 53, 64, 65, 66, 67, 68, 69,
2360 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2361 80, 81, 82, 83, 84, 85, 86, 107, 108, 109,
2362 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2363 122, 123, 124, 125, 126, 127, 128, 129, 130, 158,
2364 159, 160, 229, 235, 236, 237, 238, 19, 179, 144,
2365 148, 189, 189, 153, 155, 189, 148, 195, 189, 147,
2366 223, 23, 24, 3, 4, 5, 6, 9, 22, 37,
2367 38, 85, 86, 112, 126, 128, 129, 130, 149, 152,
2368 154, 156, 158, 159, 160, 196, 223, 206, 168, 52,
2369 10, 189, 225, 11, 14, 11, 163, 177, 87, 88,
2370 89, 90, 91, 92, 93, 94, 95, 96, 161, 23,
2371 24, 93, 94, 95, 96, 97, 98, 99, 100, 101,
2372 102, 103, 104, 105, 106, 162, 189, 189, 225, 189,
2373 189, 232, 225, 225, 225, 225, 225, 189, 189, 225,
2374 177, 110, 111, 114, 115, 131, 132, 134, 135, 137,
2375 138, 139, 178, 36, 190, 181, 151, 153, 153, 181,
2376 207, 208, 200, 161, 162, 147, 147, 147, 147, 147,
2377 151, 195, 197, 154, 197, 155, 197, 19, 147, 147,
2378 147, 144, 186, 147, 3, 4, 9, 22, 23, 24,
2379 37, 38, 54, 152, 196, 222, 223, 224, 224, 224,
2380 224, 191, 189, 189, 144, 183, 144, 183, 224, 149,
2381 144, 144, 144, 144, 144, 144, 224, 224, 35, 191,
2382 189, 225, 131, 132, 133, 136, 180, 186, 186, 35,
2383 147, 147, 195, 195, 195, 195, 195, 144, 151, 155,
2384 189, 197, 153, 155, 195, 195, 195, 31, 50, 184,
2385 187, 36, 189, 213, 214, 56, 221, 197, 144, 144,
2386 224, 224, 224, 11, 50, 11, 234, 224, 149, 225,
2387 189, 225, 225, 225, 144, 144, 189, 224, 224, 144,
2388 189, 195, 195, 234, 144, 144, 144, 144, 195, 153,
2389 155, 144, 144, 35, 19, 4, 186, 179, 144, 148,
2390 19, 153, 14, 14, 147, 144, 144, 224, 4, 224,
2391 144, 144, 224, 144, 144, 144, 224, 224, 147, 144,
2392 183, 189, 148, 144, 144, 148, 195, 195, 195, 195,
2393 153, 195, 195, 189, 165, 166, 36, 189, 181, 144,
2394 224, 224, 189, 233, 224, 224, 183, 183, 225, 224,
2395 144, 225, 225, 225, 233, 224, 195, 195, 144, 148,
2396 144, 144, 148, 148, 148, 179, 184, 185, 19, 144,
2397 149, 224, 144, 148, 151, 224, 148, 183, 148, 148,
2398 195, 195, 195, 166, 50, 182, 14, 151, 163, 230,
2399 179, 189, 181, 151, 181, 148, 148, 148, 4, 224,
2400 222, 151, 163, 224, 35, 144, 222, 179, 14, 14,
2401 144, 224, 224, 14, 68, 224, 14, 224
2404 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2405 # define YYSIZE_T __SIZE_TYPE__
2407 #if ! defined (YYSIZE_T) && defined (size_t)
2408 # define YYSIZE_T size_t
2410 #if ! defined (YYSIZE_T)
2411 # if defined (__STDC__) || defined (__cplusplus)
2412 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2413 # define YYSIZE_T size_t
2416 #if ! defined (YYSIZE_T)
2417 # define YYSIZE_T unsigned int
2420 #define yyerrok (yyerrstatus = 0)
2421 #define yyclearin (yychar = YYEMPTY)
2422 #define YYEMPTY (-2)
2425 #define YYACCEPT goto yyacceptlab
2426 #define YYABORT goto yyabortlab
2427 #define YYERROR goto yyerrorlab
2430 /* Like YYERROR except do call yyerror. This remains here temporarily
2431 to ease the transition to the new meaning of YYERROR, for GCC.
2432 Once GCC version 2 has supplanted version 1, this can go. */
2434 #define YYFAIL goto yyerrlab
2436 #define YYRECOVERING() (!!yyerrstatus)
2438 #define YYBACKUP(Token, Value) \
2440 if (yychar == YYEMPTY && yylen == 1) \
2444 yytoken = YYTRANSLATE (yychar); \
2450 yyerror ("syntax error: cannot back up");\
2456 #define YYERRCODE 256
2458 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
2461 #ifndef YYLLOC_DEFAULT
2462 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2463 ((Current).first_line = (Rhs)[1].first_line, \
2464 (Current).first_column = (Rhs)[1].first_column, \
2465 (Current).last_line = (Rhs)[N].last_line, \
2466 (Current).last_column = (Rhs)[N].last_column)
2469 /* YYLEX -- calling `yylex' with the right arguments. */
2472 # define YYLEX yylex (YYLEX_PARAM)
2474 # define YYLEX yylex ()
2477 /* Enable debugging if requested. */
2481 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2482 # define YYFPRINTF fprintf
2485 # define YYDPRINTF(Args) \
2491 # define YYDSYMPRINT(Args) \
2497 # define YYDSYMPRINTF(Title, Token, Value, Location) \
2501 YYFPRINTF (stderr, "%s ", Title); \
2502 yysymprint (stderr, \
2504 YYFPRINTF (stderr, "\n"); \
2508 /*------------------------------------------------------------------.
2509 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2511 `------------------------------------------------------------------*/
2513 #if defined (__STDC__) || defined (__cplusplus)
2515 yy_stack_print (short *bottom, short *top)
2518 yy_stack_print (bottom, top)
2523 YYFPRINTF (stderr, "Stack now");
2524 for (/* Nothing. */; bottom <= top; ++bottom)
2525 YYFPRINTF (stderr, " %d", *bottom);
2526 YYFPRINTF (stderr, "\n");
2529 # define YY_STACK_PRINT(Bottom, Top) \
2532 yy_stack_print ((Bottom), (Top)); \
2536 /*------------------------------------------------.
2537 | Report that the YYRULE is going to be reduced. |
2538 `------------------------------------------------*/
2540 #if defined (__STDC__) || defined (__cplusplus)
2542 yy_reduce_print (int yyrule)
2545 yy_reduce_print (yyrule)
2550 unsigned int yylno = yyrline[yyrule];
2551 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
2553 /* Print the symbols being reduced, and their result. */
2554 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2555 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
2556 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
2559 # define YY_REDUCE_PRINT(Rule) \
2562 yy_reduce_print (Rule); \
2565 /* Nonzero means print parse trace. It is left uninitialized so that
2566 multiple parsers can coexist. */
2568 #else /* !YYDEBUG */
2569 # define YYDPRINTF(Args)
2570 # define YYDSYMPRINT(Args)
2571 # define YYDSYMPRINTF(Title, Token, Value, Location)
2572 # define YY_STACK_PRINT(Bottom, Top)
2573 # define YY_REDUCE_PRINT(Rule)
2574 #endif /* !YYDEBUG */
2577 /* YYINITDEPTH -- initial size of the parser's stacks. */
2579 # define YYINITDEPTH 200
2582 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2583 if the built-in stack extension method is used).
2585 Do not make this value too large; the results are undefined if
2586 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
2587 evaluated with infinite-precision integer arithmetic. */
2589 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
2594 # define YYMAXDEPTH 10000
2602 # if defined (__GLIBC__) && defined (_STRING_H)
2603 # define yystrlen strlen
2605 /* Return the length of YYSTR. */
2607 # if defined (__STDC__) || defined (__cplusplus)
2608 yystrlen (const char *yystr)
2614 register const char *yys = yystr;
2616 while (*yys++ != '\0')
2619 return yys - yystr - 1;
2625 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2626 # define yystpcpy stpcpy
2628 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2631 # if defined (__STDC__) || defined (__cplusplus)
2632 yystpcpy (char *yydest, const char *yysrc)
2634 yystpcpy (yydest, yysrc)
2639 register char *yyd = yydest;
2640 register const char *yys = yysrc;
2642 while ((*yyd++ = *yys++) != '\0')
2650 #endif /* !YYERROR_VERBOSE */
2655 /*--------------------------------.
2656 | Print this symbol on YYOUTPUT. |
2657 `--------------------------------*/
2659 #if defined (__STDC__) || defined (__cplusplus)
2661 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2664 yysymprint (yyoutput, yytype, yyvaluep)
2670 /* Pacify ``unused variable'' warnings. */
2673 if (yytype < YYNTOKENS)
2675 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2677 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2681 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2688 YYFPRINTF (yyoutput, ")");
2691 #endif /* ! YYDEBUG */
2692 /*-----------------------------------------------.
2693 | Release the memory associated to this symbol. |
2694 `-----------------------------------------------*/
2696 #if defined (__STDC__) || defined (__cplusplus)
2698 yydestruct (int yytype, YYSTYPE *yyvaluep)
2701 yydestruct (yytype, yyvaluep)
2706 /* Pacify ``unused variable'' warnings. */
2718 /* Prevent warnings from -Wmissing-prototypes. */
2720 #ifdef YYPARSE_PARAM
2721 # if defined (__STDC__) || defined (__cplusplus)
2722 int yyparse (void *YYPARSE_PARAM);
2726 #else /* ! YYPARSE_PARAM */
2727 #if defined (__STDC__) || defined (__cplusplus)
2732 #endif /* ! YYPARSE_PARAM */
2736 /* The lookahead symbol. */
2739 /* The semantic value of the lookahead symbol. */
2742 /* Number of syntax errors so far. */
2751 #ifdef YYPARSE_PARAM
2752 # if defined (__STDC__) || defined (__cplusplus)
2753 int yyparse (void *YYPARSE_PARAM)
2755 int yyparse (YYPARSE_PARAM)
2756 void *YYPARSE_PARAM;
2758 #else /* ! YYPARSE_PARAM */
2759 #if defined (__STDC__) || defined (__cplusplus)
2770 register int yystate;
2773 /* Number of tokens to shift before error messages enabled. */
2775 /* Lookahead token as an internal (translated) token number. */
2778 /* Three stacks and their tools:
2779 `yyss': related to states,
2780 `yyvs': related to semantic values,
2781 `yyls': related to locations.
2783 Refer to the stacks thru separate pointers, to allow yyoverflow
2784 to reallocate them elsewhere. */
2786 /* The state stack. */
2787 short yyssa[YYINITDEPTH];
2788 short *yyss = yyssa;
2789 register short *yyssp;
2791 /* The semantic value stack. */
2792 YYSTYPE yyvsa[YYINITDEPTH];
2793 YYSTYPE *yyvs = yyvsa;
2794 register YYSTYPE *yyvsp;
2798 #define YYPOPSTACK (yyvsp--, yyssp--)
2800 YYSIZE_T yystacksize = YYINITDEPTH;
2802 /* The variables used to return semantic value and location from the
2807 /* When reducing, the number of symbols on the RHS of the reduced
2811 YYDPRINTF ((stderr, "Starting parse\n"));
2816 yychar = YYEMPTY; /* Cause a token to be read. */
2818 /* Initialize stack pointers.
2819 Waste one element of value and location stack
2820 so that they stay on the same level as the state stack.
2821 The wasted elements are never initialized. */
2828 /*------------------------------------------------------------.
2829 | yynewstate -- Push a new state, which is found in yystate. |
2830 `------------------------------------------------------------*/
2832 /* In all cases, when you get here, the value and location stacks
2833 have just been pushed. so pushing a state here evens the stacks.
2840 if (yyss + yystacksize - 1 <= yyssp)
2842 /* Get the current used size of the three stacks, in elements. */
2843 YYSIZE_T yysize = yyssp - yyss + 1;
2847 /* Give user a chance to reallocate the stack. Use copies of
2848 these so that the &'s don't force the real ones into
2850 YYSTYPE *yyvs1 = yyvs;
2851 short *yyss1 = yyss;
2854 /* Each stack pointer address is followed by the size of the
2855 data in use in that stack, in bytes. This used to be a
2856 conditional around just the two extra args, but that might
2857 be undefined if yyoverflow is a macro. */
2858 yyoverflow ("parser stack overflow",
2859 &yyss1, yysize * sizeof (*yyssp),
2860 &yyvs1, yysize * sizeof (*yyvsp),
2867 #else /* no yyoverflow */
2868 # ifndef YYSTACK_RELOCATE
2871 /* Extend the stack our own way. */
2872 if (YYMAXDEPTH <= yystacksize)
2875 if (YYMAXDEPTH < yystacksize)
2876 yystacksize = YYMAXDEPTH;
2879 short *yyss1 = yyss;
2880 union yyalloc *yyptr =
2881 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2884 YYSTACK_RELOCATE (yyss);
2885 YYSTACK_RELOCATE (yyvs);
2887 # undef YYSTACK_RELOCATE
2889 YYSTACK_FREE (yyss1);
2892 #endif /* no yyoverflow */
2894 yyssp = yyss + yysize - 1;
2895 yyvsp = yyvs + yysize - 1;
2898 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2899 (unsigned long int) yystacksize));
2901 if (yyss + yystacksize - 1 <= yyssp)
2905 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2914 /* Do appropriate processing given the current state. */
2915 /* Read a lookahead token if we need one and don't already have one. */
2918 /* First try to decide what to do without reference to lookahead token. */
2920 yyn = yypact[yystate];
2921 if (yyn == YYPACT_NINF)
2924 /* Not known => get a lookahead token if don't already have one. */
2926 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2927 if (yychar == YYEMPTY)
2929 YYDPRINTF ((stderr, "Reading a token: "));
2933 if (yychar <= YYEOF)
2935 yychar = yytoken = YYEOF;
2936 YYDPRINTF ((stderr, "Now at end of input.\n"));
2940 yytoken = YYTRANSLATE (yychar);
2941 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
2944 /* If the proper action on seeing token YYTOKEN is to reduce or to
2945 detect an error, take that action. */
2947 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2952 if (yyn == 0 || yyn == YYTABLE_NINF)
2961 /* Shift the lookahead token. */
2962 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
2964 /* Discard the token being shifted unless it is eof. */
2965 if (yychar != YYEOF)
2971 /* Count tokens shifted since error; after three, turn off error
2980 /*-----------------------------------------------------------.
2981 | yydefault -- do the default action for the current state. |
2982 `-----------------------------------------------------------*/
2984 yyn = yydefact[yystate];
2990 /*-----------------------------.
2991 | yyreduce -- Do a reduction. |
2992 `-----------------------------*/
2994 /* yyn is the number of a rule to reduce with. */
2997 /* If YYLEN is nonzero, implement the default value of the action:
3000 Otherwise, the following line sets YYVAL to garbage.
3001 This behavior is undocumented and Bison
3002 users should not rely upon it. Assigning to YYVAL
3003 unconditionally makes the parser a bit smaller, and it avoids a
3004 GCC warning that YYVAL may be used uninitialized. */
3005 yyval = yyvsp[1-yylen];
3008 YY_REDUCE_PRINT (yyn);
3012 #line 1122 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3013 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;}
3017 #line 1122 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3018 { yyval.IPredicate = ICmpInst::ICMP_NE; ;}
3022 #line 1123 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3023 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;}
3027 #line 1123 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3028 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;}
3032 #line 1124 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3033 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;}
3037 #line 1124 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3038 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;}
3042 #line 1125 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3043 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;}
3047 #line 1125 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3048 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;}
3052 #line 1126 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3053 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;}
3057 #line 1126 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3058 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;}
3062 #line 1130 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3063 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;}
3067 #line 1130 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3068 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;}
3072 #line 1131 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3073 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;}
3077 #line 1131 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3078 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;}
3082 #line 1132 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3083 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;}
3087 #line 1132 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3088 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;}
3092 #line 1133 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3093 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;}
3097 #line 1133 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3098 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;}
3102 #line 1134 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3103 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;}
3107 #line 1134 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3108 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;}
3112 #line 1135 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3113 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;}
3117 #line 1135 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3118 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;}
3122 #line 1136 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3123 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;}
3127 #line 1136 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3128 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;}
3132 #line 1137 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3133 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;}
3137 #line 1138 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3138 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;}
3142 #line 1147 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3143 { yyval.StrVal = 0; ;}
3147 #line 1151 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3149 yyval.StrVal = yyvsp[-1].StrVal;
3155 #line 1155 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3163 #line 1163 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3171 #line 1168 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3173 yyval.StrVal = yyvsp[-1].StrVal;
3179 #line 1174 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3180 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
3184 #line 1175 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3185 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
3189 #line 1176 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3190 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
3194 #line 1177 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3195 { yyval.Linkage = GlobalValue::AppendingLinkage; ;}
3199 #line 1178 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3200 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
3204 #line 1182 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3205 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
3209 #line 1183 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3210 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
3214 #line 1184 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3215 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3219 #line 1188 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3220 { yyval.Visibility = GlobalValue::DefaultVisibility; ;}
3224 #line 1189 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3225 { yyval.Visibility = GlobalValue::DefaultVisibility; ;}
3229 #line 1190 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3230 { yyval.Visibility = GlobalValue::HiddenVisibility; ;}
3234 #line 1191 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3235 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;}
3239 #line 1195 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3240 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3244 #line 1196 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3245 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
3249 #line 1197 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3250 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
3254 #line 1201 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3255 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3259 #line 1202 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3260 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
3264 #line 1203 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3265 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
3269 #line 1204 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3270 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
3274 #line 1205 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3275 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
3279 #line 1209 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3280 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
3284 #line 1210 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3285 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
3289 #line 1211 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3290 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
3294 #line 1214 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3295 { yyval.UIntVal = CallingConv::C; ;}
3299 #line 1215 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3300 { yyval.UIntVal = CallingConv::C; ;}
3304 #line 1216 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3305 { yyval.UIntVal = CallingConv::Fast; ;}
3309 #line 1217 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3310 { yyval.UIntVal = CallingConv::Cold; ;}
3314 #line 1218 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3315 { yyval.UIntVal = CallingConv::X86_StdCall; ;}
3319 #line 1219 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3320 { yyval.UIntVal = CallingConv::X86_FastCall; ;}
3324 #line 1220 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3326 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
3327 GEN_ERROR("Calling conv too large");
3328 yyval.UIntVal = yyvsp[0].UInt64Val;
3334 #line 1227 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3335 { yyval.ParamAttrs = ParamAttr::ZExt; ;}
3339 #line 1228 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3340 { yyval.ParamAttrs = ParamAttr::ZExt; ;}
3344 #line 1229 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3345 { yyval.ParamAttrs = ParamAttr::SExt; ;}
3349 #line 1230 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3350 { yyval.ParamAttrs = ParamAttr::SExt; ;}
3354 #line 1231 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3355 { yyval.ParamAttrs = ParamAttr::InReg; ;}
3359 #line 1232 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3360 { yyval.ParamAttrs = ParamAttr::StructRet; ;}
3364 #line 1233 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3365 { yyval.ParamAttrs = ParamAttr::NoAlias; ;}
3369 #line 1234 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3370 { yyval.ParamAttrs = ParamAttr::ByVal; ;}
3374 #line 1235 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3375 { yyval.ParamAttrs = ParamAttr::Nest; ;}
3379 #line 1238 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3380 { yyval.ParamAttrs = ParamAttr::None; ;}
3384 #line 1239 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3386 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
3391 #line 1244 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3392 { yyval.ParamAttrs = ParamAttr::NoReturn; ;}
3396 #line 1245 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3397 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;}
3401 #line 1246 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3402 { yyval.ParamAttrs = ParamAttr::ZExt; ;}
3406 #line 1247 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3407 { yyval.ParamAttrs = ParamAttr::SExt; ;}
3411 #line 1250 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3412 { yyval.ParamAttrs = ParamAttr::None; ;}
3416 #line 1251 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3418 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
3423 #line 1258 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3424 { yyval.UIntVal = 0; ;}
3428 #line 1259 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3430 yyval.UIntVal = yyvsp[0].UInt64Val;
3431 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
3432 GEN_ERROR("Alignment must be a power of two");
3438 #line 1265 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3439 { yyval.UIntVal = 0; ;}
3443 #line 1266 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3445 yyval.UIntVal = yyvsp[0].UInt64Val;
3446 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
3447 GEN_ERROR("Alignment must be a power of two");
3453 #line 1274 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3455 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
3456 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
3457 GEN_ERROR("Invalid character in section name");
3458 yyval.StrVal = yyvsp[0].StrVal;
3464 #line 1282 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3465 { yyval.StrVal = 0; ;}
3469 #line 1283 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3470 { yyval.StrVal = yyvsp[0].StrVal; ;}
3474 #line 1288 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3479 #line 1289 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3484 #line 1290 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3486 CurGV->setSection(*yyvsp[0].StrVal);
3487 delete yyvsp[0].StrVal;
3493 #line 1295 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3495 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
3496 GEN_ERROR("Alignment must be a power of two");
3497 CurGV->setAlignment(yyvsp[0].UInt64Val);
3503 #line 1311 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3505 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
3511 #line 1315 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3513 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
3519 #line 1319 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3521 if (*yyvsp[-1].TypeVal == Type::LabelTy)
3522 GEN_ERROR("Cannot form a pointer to a basic block");
3523 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
3524 delete yyvsp[-1].TypeVal;
3530 #line 1326 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3531 { // Named types are also simple types...
3532 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
3534 yyval.TypeVal = new PATypeHolder(tmp);
3539 #line 1331 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3540 { // Type UpReference
3541 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
3542 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3543 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3544 yyval.TypeVal = new PATypeHolder(OT);
3545 UR_OUT("New Upreference!\n");
3551 #line 1339 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3553 std::vector<const Type*> Params;
3554 ParamAttrsVector Attrs;
3555 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3556 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3560 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3561 for (; I != E; ++I, ++index) {
3562 const Type *Ty = I->Ty->get();
3563 Params.push_back(Ty);
3564 if (Ty != Type::VoidTy)
3565 if (I->Attrs != ParamAttr::None) {
3566 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3570 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3571 if (isVarArg) Params.pop_back();
3573 ParamAttrsList *ActualAttrs = 0;
3575 ActualAttrs = ParamAttrsList::get(Attrs);
3576 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3577 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3578 delete yyvsp[-4].TypeVal; // Delete the return type handle
3579 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3585 #line 1369 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3587 std::vector<const Type*> Params;
3588 ParamAttrsVector Attrs;
3589 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3590 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3593 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3595 for ( ; I != E; ++I, ++index) {
3596 const Type* Ty = I->Ty->get();
3597 Params.push_back(Ty);
3598 if (Ty != Type::VoidTy)
3599 if (I->Attrs != ParamAttr::None) {
3600 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3604 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3605 if (isVarArg) Params.pop_back();
3607 ParamAttrsList *ActualAttrs = 0;
3609 ActualAttrs = ParamAttrsList::get(Attrs);
3611 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3612 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3613 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3619 #line 1400 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3620 { // Sized array type?
3621 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3622 delete yyvsp[-1].TypeVal;
3628 #line 1405 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3630 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3631 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3632 GEN_ERROR("Unsigned result not equal to signed result");
3633 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3634 GEN_ERROR("Element type of a VectorType must be primitive");
3635 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3636 GEN_ERROR("Vector length should be a power of 2");
3637 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3638 delete yyvsp[-1].TypeVal;
3644 #line 1417 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3645 { // Structure type?
3646 std::vector<const Type*> Elements;
3647 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3648 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3649 Elements.push_back(*I);
3651 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3652 delete yyvsp[-1].TypeList;
3658 #line 1427 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3659 { // Empty structure type?
3660 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3666 #line 1431 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3668 std::vector<const Type*> Elements;
3669 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3670 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3671 Elements.push_back(*I);
3673 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3674 delete yyvsp[-2].TypeList;
3680 #line 1441 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3681 { // Empty structure type?
3682 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3688 #line 1448 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3690 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3691 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3696 #line 1455 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3698 if (!UpRefs.empty())
3699 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3700 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3701 GEN_ERROR("LLVM functions cannot return aggregate types");
3702 yyval.TypeVal = yyvsp[0].TypeVal;
3707 #line 1462 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3709 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3714 #line 1467 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3716 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3717 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3723 #line 1472 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3725 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3731 #line 1480 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3733 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3734 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3735 TWA.Ty = new PATypeHolder(Type::VoidTy);
3736 yyval.TypeWithAttrsList->push_back(TWA);
3742 #line 1487 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3744 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3745 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3746 TWA.Ty = new PATypeHolder(Type::VoidTy);
3747 yyval.TypeWithAttrsList->push_back(TWA);
3753 #line 1494 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3755 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3761 #line 1502 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3763 yyval.TypeList = new std::list<PATypeHolder>();
3764 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3765 delete yyvsp[0].TypeVal;
3771 #line 1508 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3773 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3774 delete yyvsp[0].TypeVal;
3780 #line 1520 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3781 { // Nonempty unsized arr
3782 if (!UpRefs.empty())
3783 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3784 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3786 GEN_ERROR("Cannot make array constant with type: '" +
3787 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3788 const Type *ETy = ATy->getElementType();
3789 int NumElements = ATy->getNumElements();
3791 // Verify that we have the correct size...
3792 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3793 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3794 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3795 itostr(NumElements) + "");
3797 // Verify all elements are correct type!
3798 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3799 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3800 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3801 ETy->getDescription() +"' as required!\nIt is of type '"+
3802 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3805 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3806 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3812 #line 1548 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3814 if (!UpRefs.empty())
3815 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3816 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3818 GEN_ERROR("Cannot make array constant with type: '" +
3819 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3821 int NumElements = ATy->getNumElements();
3822 if (NumElements != -1 && NumElements != 0)
3823 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3824 " arguments, but has size of " + itostr(NumElements) +"");
3825 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3826 delete yyvsp[-2].TypeVal;
3832 #line 1564 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3834 if (!UpRefs.empty())
3835 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3836 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3838 GEN_ERROR("Cannot make array constant with type: '" +
3839 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3841 int NumElements = ATy->getNumElements();
3842 const Type *ETy = ATy->getElementType();
3843 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3844 GEN_ERROR("Can't build string constant of size " +
3845 itostr((int)(yyvsp[0].StrVal->length())) +
3846 " when array has size " + itostr(NumElements) + "");
3847 std::vector<Constant*> Vals;
3848 if (ETy == Type::Int8Ty) {
3849 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3850 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3852 delete yyvsp[0].StrVal;
3853 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3855 delete yyvsp[0].StrVal;
3856 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3857 delete yyvsp[-2].TypeVal;
3863 #line 1591 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3864 { // Nonempty unsized arr
3865 if (!UpRefs.empty())
3866 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3867 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3869 GEN_ERROR("Cannot make packed constant with type: '" +
3870 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3871 const Type *ETy = PTy->getElementType();
3872 int NumElements = PTy->getNumElements();
3874 // Verify that we have the correct size...
3875 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3876 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3877 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3878 itostr(NumElements) + "");
3880 // Verify all elements are correct type!
3881 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3882 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3883 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3884 ETy->getDescription() +"' as required!\nIt is of type '"+
3885 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3888 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3889 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3895 #line 1619 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3897 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3899 GEN_ERROR("Cannot make struct constant with type: '" +
3900 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3902 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3903 GEN_ERROR("Illegal number of initializers for structure type");
3905 // Check to ensure that constants are compatible with the type initializer!
3906 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3907 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3908 GEN_ERROR("Expected type '" +
3909 STy->getElementType(i)->getDescription() +
3910 "' for element #" + utostr(i) +
3911 " of structure initializer");
3913 // Check to ensure that Type is not packed
3914 if (STy->isPacked())
3915 GEN_ERROR("Unpacked Initializer to vector type '" +
3916 STy->getDescription() + "'");
3918 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3919 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3925 #line 1645 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3927 if (!UpRefs.empty())
3928 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3929 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3931 GEN_ERROR("Cannot make struct constant with type: '" +
3932 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3934 if (STy->getNumContainedTypes() != 0)
3935 GEN_ERROR("Illegal number of initializers for structure type");
3937 // Check to ensure that Type is not packed
3938 if (STy->isPacked())
3939 GEN_ERROR("Unpacked Initializer to vector type '" +
3940 STy->getDescription() + "'");
3942 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3943 delete yyvsp[-2].TypeVal;
3949 #line 1665 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3951 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3953 GEN_ERROR("Cannot make struct constant with type: '" +
3954 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3956 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3957 GEN_ERROR("Illegal number of initializers for structure type");
3959 // Check to ensure that constants are compatible with the type initializer!
3960 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3961 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3962 GEN_ERROR("Expected type '" +
3963 STy->getElementType(i)->getDescription() +
3964 "' for element #" + utostr(i) +
3965 " of structure initializer");
3967 // Check to ensure that Type is packed
3968 if (!STy->isPacked())
3969 GEN_ERROR("Vector initializer to non-vector type '" +
3970 STy->getDescription() + "'");
3972 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3973 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3979 #line 1691 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
3981 if (!UpRefs.empty())
3982 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3983 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3985 GEN_ERROR("Cannot make struct constant with type: '" +
3986 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3988 if (STy->getNumContainedTypes() != 0)
3989 GEN_ERROR("Illegal number of initializers for structure type");
3991 // Check to ensure that Type is packed
3992 if (!STy->isPacked())
3993 GEN_ERROR("Vector initializer to non-vector type '" +
3994 STy->getDescription() + "'");
3996 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3997 delete yyvsp[-4].TypeVal;
4003 #line 1711 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4005 if (!UpRefs.empty())
4006 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4007 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
4009 GEN_ERROR("Cannot make null pointer constant with type: '" +
4010 (*yyvsp[-1].TypeVal)->getDescription() + "'");
4012 yyval.ConstVal = ConstantPointerNull::get(PTy);
4013 delete yyvsp[-1].TypeVal;
4019 #line 1723 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4021 if (!UpRefs.empty())
4022 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4023 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
4024 delete yyvsp[-1].TypeVal;
4030 #line 1730 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4032 if (!UpRefs.empty())
4033 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4034 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
4036 GEN_ERROR("Global const reference must be a pointer type");
4038 // ConstExprs can exist in the body of a function, thus creating
4039 // GlobalValues whenever they refer to a variable. Because we are in
4040 // the context of a function, getExistingVal will search the functions
4041 // symbol table instead of the module symbol table for the global symbol,
4042 // which throws things all off. To get around this, we just tell
4043 // getExistingVal that we are at global scope here.
4045 Function *SavedCurFn = CurFun.CurrentFunction;
4046 CurFun.CurrentFunction = 0;
4048 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
4051 CurFun.CurrentFunction = SavedCurFn;
4053 // If this is an initializer for a constant pointer, which is referencing a
4054 // (currently) undefined variable, create a stub now that shall be replaced
4055 // in the future with the right type of variable.
4058 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4059 const PointerType *PT = cast<PointerType>(Ty);
4061 // First check to see if the forward references value is already created!
4062 PerModuleInfo::GlobalRefsType::iterator I =
4063 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
4065 if (I != CurModule.GlobalRefs.end()) {
4066 V = I->second; // Placeholder already exists, use it...
4067 yyvsp[0].ValIDVal.destroy();
4070 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
4071 Name = yyvsp[0].ValIDVal.getName();
4072 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
4073 GEN_ERROR("Invalid reference to global");
4075 // Create the forward referenced global.
4077 if (const FunctionType *FTy =
4078 dyn_cast<FunctionType>(PT->getElementType())) {
4079 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4080 CurModule.CurrentModule);
4082 GV = new GlobalVariable(PT->getElementType(), false,
4083 GlobalValue::ExternalWeakLinkage, 0,
4084 Name, CurModule.CurrentModule);
4087 // Keep track of the fact that we have a forward ref to recycle it
4088 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
4093 yyval.ConstVal = cast<GlobalValue>(V);
4094 delete yyvsp[-1].TypeVal; // Free the type handle
4100 #line 1796 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4102 if (!UpRefs.empty())
4103 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4104 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
4105 GEN_ERROR("Mismatched types for constant expression: " +
4106 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
4107 yyval.ConstVal = yyvsp[0].ConstVal;
4108 delete yyvsp[-1].TypeVal;
4114 #line 1806 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4116 if (!UpRefs.empty())
4117 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4118 const Type *Ty = yyvsp[-1].TypeVal->get();
4119 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4120 GEN_ERROR("Cannot create a null initialized value of this type");
4121 yyval.ConstVal = Constant::getNullValue(Ty);
4122 delete yyvsp[-1].TypeVal;
4128 #line 1816 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4129 { // integral constants
4130 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
4131 GEN_ERROR("Constant value doesn't fit in type");
4132 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
4138 #line 1822 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4139 { // arbitrary precision integer constants
4140 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
4141 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
4142 GEN_ERROR("Constant value does not fit in type");
4144 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
4145 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
4146 delete yyvsp[0].APIntVal;
4152 #line 1832 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4153 { // integral constants
4154 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
4155 GEN_ERROR("Constant value doesn't fit in type");
4156 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
4162 #line 1838 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4163 { // arbitrary precision integer constants
4164 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
4165 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
4166 GEN_ERROR("Constant value does not fit in type");
4168 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
4169 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
4170 delete yyvsp[0].APIntVal;
4176 #line 1848 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4177 { // Boolean constants
4178 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
4179 yyval.ConstVal = ConstantInt::getTrue();
4185 #line 1853 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4186 { // Boolean constants
4187 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
4188 yyval.ConstVal = ConstantInt::getFalse();
4194 #line 1858 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4195 { // Float & Double constants
4196 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
4197 GEN_ERROR("Floating point constant invalid for type");
4198 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
4204 #line 1866 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4206 if (!UpRefs.empty())
4207 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4208 Constant *Val = yyvsp[-3].ConstVal;
4209 const Type *DestTy = yyvsp[-1].TypeVal->get();
4210 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
4211 GEN_ERROR("invalid cast opcode for cast from '" +
4212 Val->getType()->getDescription() + "' to '" +
4213 DestTy->getDescription() + "'");
4214 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
4215 delete yyvsp[-1].TypeVal;
4220 #line 1878 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4222 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
4223 GEN_ERROR("GetElementPtr requires a pointer operand");
4226 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), &(*yyvsp[-1].ValueList)[0], yyvsp[-1].ValueList->size(),
4229 GEN_ERROR("Index list invalid for constant getelementptr");
4231 SmallVector<Constant*, 8> IdxVec;
4232 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
4233 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
4234 IdxVec.push_back(C);
4236 GEN_ERROR("Indices to constant getelementptr must be constants");
4238 delete yyvsp[-1].ValueList;
4240 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
4246 #line 1900 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4248 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
4249 GEN_ERROR("Select condition must be of boolean type");
4250 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4251 GEN_ERROR("Select operand types must match");
4252 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4258 #line 1908 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4260 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4261 GEN_ERROR("Binary operator types must match");
4263 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4268 #line 1914 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4270 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4271 GEN_ERROR("Logical operator types must match");
4272 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
4273 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
4274 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
4275 GEN_ERROR("Logical operator requires integral operands");
4277 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4283 #line 1925 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4285 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4286 GEN_ERROR("icmp operand types must match");
4287 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4292 #line 1930 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4294 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
4295 GEN_ERROR("fcmp operand types must match");
4296 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4301 #line 1935 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4303 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4304 GEN_ERROR("Invalid extractelement operands");
4305 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4311 #line 1941 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4313 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4314 GEN_ERROR("Invalid insertelement operands");
4315 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4321 #line 1947 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4323 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
4324 GEN_ERROR("Invalid shufflevector operands");
4325 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
4331 #line 1956 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4333 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
4339 #line 1960 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4341 yyval.ConstVector = new std::vector<Constant*>();
4342 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
4348 #line 1968 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4349 { yyval.BoolVal = false; ;}
4353 #line 1968 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4354 { yyval.BoolVal = true; ;}
4358 #line 1971 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4359 { yyval.BoolVal = true; ;}
4363 #line 1971 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4364 { yyval.BoolVal = false; ;}
4368 #line 1974 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4370 const Type* VTy = yyvsp[-1].TypeVal->get();
4371 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
4372 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4374 GEN_ERROR("Aliases can be created only to global values");
4376 yyval.ConstVal = Aliasee;
4378 delete yyvsp[-1].TypeVal;
4383 #line 1985 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4385 Constant *Val = yyvsp[-3].ConstVal;
4386 const Type *DestTy = yyvsp[-1].TypeVal->get();
4387 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
4388 GEN_ERROR("invalid cast opcode for cast from '" +
4389 Val->getType()->getDescription() + "' to '" +
4390 DestTy->getDescription() + "'");
4392 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
4394 delete yyvsp[-1].TypeVal;
4399 #line 2006 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4401 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
4402 CurModule.ModuleDone();
4408 #line 2011 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4410 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
4411 CurModule.ModuleDone();
4417 #line 2024 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4418 { CurFun.isDeclare = false; ;}
4422 #line 2024 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4424 CurFun.FunctionDone();
4430 #line 2028 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4431 { CurFun.isDeclare = true; ;}
4435 #line 2028 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4442 #line 2031 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4449 #line 2034 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4451 if (!UpRefs.empty())
4452 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4453 // Eagerly resolve types. This is not an optimization, this is a
4454 // requirement that is due to the fact that we could have this:
4456 // %list = type { %list * }
4457 // %list = type { %list * } ; repeated type decl
4459 // If types are not resolved eagerly, then the two types will not be
4460 // determined to be the same type!
4462 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
4464 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
4466 // If this is a named type that is not a redefinition, add it to the slot
4468 CurModule.Types.push_back(*yyvsp[0].TypeVal);
4471 delete yyvsp[0].TypeVal;
4477 #line 2058 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4479 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
4481 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
4483 // If this is a named type that is not a redefinition, add it to the slot
4485 CurModule.Types.push_back(yyvsp[0].PrimType);
4492 #line 2069 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4494 /* "Externally Visible" Linkage */
4495 if (yyvsp[0].ConstVal == 0)
4496 GEN_ERROR("Global value initializer is not a constant");
4497 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
4498 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
4504 #line 2076 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4511 #line 2080 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4513 if (yyvsp[0].ConstVal == 0)
4514 GEN_ERROR("Global value initializer is not a constant");
4515 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
4521 #line 2085 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4528 #line 2089 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4530 if (!UpRefs.empty())
4531 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4532 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
4534 delete yyvsp[0].TypeVal;
4539 #line 2095 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4547 #line 2099 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4550 if (yyvsp[-4].StrVal) {
4551 Name = *yyvsp[-4].StrVal;
4552 delete yyvsp[-4].StrVal;
4555 GEN_ERROR("Alias name cannot be empty");
4557 Constant* Aliasee = yyvsp[0].ConstVal;
4559 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4561 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
4562 CurModule.CurrentModule);
4563 GA->setVisibility(yyvsp[-3].Visibility);
4564 InsertValue(GA, CurModule.Values);
4570 #line 2118 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4577 #line 2121 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4584 #line 2127 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4586 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4587 if (AsmSoFar.empty())
4588 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
4590 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
4591 delete yyvsp[0].StrVal;
4597 #line 2137 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4599 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
4600 delete yyvsp[0].StrVal;
4605 #line 2141 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4607 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
4608 delete yyvsp[0].StrVal;
4613 #line 2148 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4615 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4616 delete yyvsp[0].StrVal;
4622 #line 2153 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4624 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4625 delete yyvsp[0].StrVal;
4631 #line 2158 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4638 #line 2167 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4640 if (!UpRefs.empty())
4641 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4642 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4643 GEN_ERROR("void typed arguments are invalid");
4644 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4645 yyval.ArgList = yyvsp[-4].ArgList;
4646 yyvsp[-4].ArgList->push_back(E);
4652 #line 2177 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4654 if (!UpRefs.empty())
4655 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4656 if (*yyvsp[-2].TypeVal == Type::VoidTy)
4657 GEN_ERROR("void typed arguments are invalid");
4658 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4659 yyval.ArgList = new ArgListType;
4660 yyval.ArgList->push_back(E);
4666 #line 2188 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4668 yyval.ArgList = yyvsp[0].ArgList;
4674 #line 2192 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4676 yyval.ArgList = yyvsp[-2].ArgList;
4677 struct ArgListEntry E;
4678 E.Ty = new PATypeHolder(Type::VoidTy);
4680 E.Attrs = ParamAttr::None;
4681 yyval.ArgList->push_back(E);
4687 #line 2201 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4689 yyval.ArgList = new ArgListType;
4690 struct ArgListEntry E;
4691 E.Ty = new PATypeHolder(Type::VoidTy);
4693 E.Attrs = ParamAttr::None;
4694 yyval.ArgList->push_back(E);
4700 #line 2210 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4708 #line 2216 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4710 std::string FunctionName(*yyvsp[-6].StrVal);
4711 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4713 // Check the function result for abstractness if this is a define. We should
4714 // have no abstract types at this point
4715 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4716 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4718 std::vector<const Type*> ParamTypeList;
4719 ParamAttrsVector Attrs;
4720 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4721 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4722 Attrs.push_back(PAWI);
4724 if (yyvsp[-4].ArgList) { // If there are arguments...
4726 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4727 const Type* Ty = I->Ty->get();
4728 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4729 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4730 ParamTypeList.push_back(Ty);
4731 if (Ty != Type::VoidTy)
4732 if (I->Attrs != ParamAttr::None) {
4733 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4734 Attrs.push_back(PAWI);
4739 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4740 if (isVarArg) ParamTypeList.pop_back();
4742 ParamAttrsList *PAL = 0;
4744 PAL = ParamAttrsList::get(Attrs);
4746 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4747 const PointerType *PFT = PointerType::get(FT);
4748 delete yyvsp[-7].TypeVal;
4751 if (!FunctionName.empty()) {
4752 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4754 ID = ValID::createGlobalID(CurModule.Values.size());
4758 // See if this function was forward referenced. If so, recycle the object.
4759 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4760 // Move the function to the end of the list, from whereever it was
4761 // previously inserted.
4762 Fn = cast<Function>(FWRef);
4763 CurModule.CurrentModule->getFunctionList().remove(Fn);
4764 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4765 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4766 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4767 if (Fn->getFunctionType() != FT) {
4768 // The existing function doesn't have the same type. This is an overload
4770 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4771 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4772 // Neither the existing or the current function is a declaration and they
4773 // have the same name and same type. Clearly this is a redefinition.
4774 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4775 } if (Fn->isDeclaration()) {
4776 // Make sure to strip off any argument names so we can't get conflicts.
4777 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4781 } else { // Not already defined?
4782 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4783 CurModule.CurrentModule);
4785 InsertValue(Fn, CurModule.Values);
4788 CurFun.FunctionStart(Fn);
4790 if (CurFun.isDeclare) {
4791 // If we have declaration, always overwrite linkage. This will allow us to
4792 // correctly handle cases, when pointer to function is passed as argument to
4793 // another function.
4794 Fn->setLinkage(CurFun.Linkage);
4795 Fn->setVisibility(CurFun.Visibility);
4797 Fn->setCallingConv(yyvsp[-8].UIntVal);
4798 Fn->setAlignment(yyvsp[0].UIntVal);
4799 if (yyvsp[-1].StrVal) {
4800 Fn->setSection(*yyvsp[-1].StrVal);
4801 delete yyvsp[-1].StrVal;
4804 // Add all of the arguments we parsed to the function...
4805 if (yyvsp[-4].ArgList) { // Is null if empty...
4806 if (isVarArg) { // Nuke the last entry
4807 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4808 "Not a varargs marker!");
4809 delete yyvsp[-4].ArgList->back().Ty;
4810 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4812 Function::arg_iterator ArgIt = Fn->arg_begin();
4813 Function::arg_iterator ArgEnd = Fn->arg_end();
4815 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4816 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4817 delete I->Ty; // Delete the typeholder...
4818 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4824 delete yyvsp[-4].ArgList; // We're now done with the argument list
4831 #line 2338 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4833 yyval.FunctionVal = CurFun.CurrentFunction;
4835 // Make sure that we keep track of the linkage type even if there was a
4836 // previous "declare".
4837 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4838 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4843 #line 2349 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4845 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4851 #line 2354 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4853 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4854 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4855 yyval.FunctionVal = CurFun.CurrentFunction;
4856 CurFun.FunctionDone();
4862 #line 2366 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4864 yyval.BoolVal = false;
4870 #line 2370 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4872 yyval.BoolVal = true;
4878 #line 2375 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4879 { // A reference to a direct constant
4880 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4886 #line 2379 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4888 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4894 #line 2383 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4895 { // Perhaps it's an FP constant?
4896 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4902 #line 2387 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4904 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4910 #line 2391 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4912 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4918 #line 2395 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4920 yyval.ValIDVal = ValID::createNull();
4926 #line 2399 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4928 yyval.ValIDVal = ValID::createUndef();
4934 #line 2403 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4935 { // A vector zero constant.
4936 yyval.ValIDVal = ValID::createZeroInit();
4942 #line 2407 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4943 { // Nonempty unsized packed vector
4944 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4945 int NumElements = yyvsp[-1].ConstVector->size();
4947 VectorType* pt = VectorType::get(ETy, NumElements);
4948 PATypeHolder* PTy = new PATypeHolder(
4956 // Verify all elements are correct type!
4957 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4958 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4959 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4960 ETy->getDescription() +"' as required!\nIt is of type '" +
4961 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4964 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4965 delete PTy; delete yyvsp[-1].ConstVector;
4971 #line 2432 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4973 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4979 #line 2436 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4981 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4982 delete yyvsp[-2].StrVal;
4983 delete yyvsp[0].StrVal;
4989 #line 2446 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4990 { // Is it an integer reference...?
4991 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4997 #line 2450 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
4999 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
5005 #line 2454 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5006 { // Is it a named reference...?
5007 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
5008 delete yyvsp[0].StrVal;
5014 #line 2459 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5015 { // Is it a named reference...?
5016 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
5017 delete yyvsp[0].StrVal;
5023 #line 2472 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5025 if (!UpRefs.empty())
5026 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5027 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
5028 delete yyvsp[-1].TypeVal;
5034 #line 2481 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5036 yyval.FunctionVal = yyvsp[-1].FunctionVal;
5042 #line 2485 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5043 { // Do not allow functions with 0 basic blocks
5044 yyval.FunctionVal = yyvsp[-1].FunctionVal;
5050 #line 2494 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5052 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
5054 InsertValue(yyvsp[0].TermInstVal);
5055 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
5056 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
5062 #line 2503 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5064 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
5065 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5066 if (CI2->getParent() == 0)
5067 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
5068 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
5069 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
5075 #line 2512 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5076 { // Empty space between instruction lists
5077 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5083 #line 2516 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5084 { // Labelled (named) basic block
5085 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
5086 delete yyvsp[0].StrVal;
5093 #line 2523 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5094 { // Return with a result...
5095 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
5101 #line 2527 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5102 { // Return with no result...
5103 yyval.TermInstVal = new ReturnInst();
5109 #line 2531 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5110 { // Unconditional Branch...
5111 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5113 yyval.TermInstVal = new BranchInst(tmpBB);
5118 #line 2536 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5120 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
5121 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
5123 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
5125 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
5127 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5132 #line 2546 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5134 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
5136 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
5138 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
5139 yyval.TermInstVal = S;
5141 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
5142 E = yyvsp[-1].JumpTable->end();
5143 for (; I != E; ++I) {
5144 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5145 S->addCase(CI, I->second);
5147 GEN_ERROR("Switch case is constant, but not a simple integer");
5149 delete yyvsp[-1].JumpTable;
5155 #line 2565 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5157 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
5159 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
5161 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5162 yyval.TermInstVal = S;
5168 #line 2575 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5171 // Handle the short syntax
5172 const PointerType *PFTy = 0;
5173 const FunctionType *Ty = 0;
5174 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
5175 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5176 // Pull out the types of all of the arguments...
5177 std::vector<const Type*> ParamTypes;
5178 ParamAttrsVector Attrs;
5179 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
5180 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
5181 Attrs.push_back(PAWI);
5183 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
5185 for (; I != E; ++I, ++index) {
5186 const Type *Ty = I->Val->getType();
5187 if (Ty == Type::VoidTy)
5188 GEN_ERROR("Short call syntax cannot be used with varargs");
5189 ParamTypes.push_back(Ty);
5190 if (I->Attrs != ParamAttr::None) {
5191 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5192 Attrs.push_back(PAWI);
5196 ParamAttrsList *PAL = 0;
5198 PAL = ParamAttrsList::get(Attrs);
5199 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
5200 PFTy = PointerType::get(Ty);
5203 delete yyvsp[-11].TypeVal;
5205 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
5207 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
5209 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
5212 // Check the arguments
5214 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
5215 // Make sure no arguments is a good thing!
5216 if (Ty->getNumParams() != 0)
5217 GEN_ERROR("No arguments passed to a function that "
5218 "expects arguments");
5219 } else { // Has arguments?
5220 // Loop through FunctionType's arguments and ensure they are specified
5222 FunctionType::param_iterator I = Ty->param_begin();
5223 FunctionType::param_iterator E = Ty->param_end();
5224 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
5226 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5227 if (ArgI->Val->getType() != *I)
5228 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5229 (*I)->getDescription() + "'");
5230 Args.push_back(ArgI->Val);
5233 if (Ty->isVarArg()) {
5235 for (; ArgI != ArgE; ++ArgI)
5236 Args.push_back(ArgI->Val); // push the remaining varargs
5237 } else if (I != E || ArgI != ArgE)
5238 GEN_ERROR("Invalid number of parameters detected");
5241 // Create the InvokeInst
5242 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5243 II->setCallingConv(yyvsp[-12].UIntVal);
5244 yyval.TermInstVal = II;
5245 delete yyvsp[-8].ValueRefList;
5251 #line 2654 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5253 yyval.TermInstVal = new UnwindInst();
5259 #line 2658 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5261 yyval.TermInstVal = new UnreachableInst();
5267 #line 2665 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5269 yyval.JumpTable = yyvsp[-5].JumpTable;
5270 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
5273 GEN_ERROR("May only switch on a constant pool value");
5275 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5277 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
5282 #line 2676 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5284 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
5285 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
5289 GEN_ERROR("May only switch on a constant pool value");
5291 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
5293 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
5298 #line 2689 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5300 // Is this definition named?? if so, assign the name...
5301 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
5303 InsertValue(yyvsp[0].InstVal);
5304 yyval.InstVal = yyvsp[0].InstVal;
5310 #line 2699 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5311 { // Used for PHI nodes
5312 if (!UpRefs.empty())
5313 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
5314 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
5315 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
5317 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
5319 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
5320 delete yyvsp[-5].TypeVal;
5325 #line 2710 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5327 yyval.PHIList = yyvsp[-6].PHIList;
5328 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
5330 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
5332 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
5337 #line 2720 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5339 if (!UpRefs.empty())
5340 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5341 // Used for call and invoke instructions
5342 yyval.ValueRefList = new ValueRefList();
5343 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
5344 yyval.ValueRefList->push_back(E);
5345 delete yyvsp[-2].TypeVal;
5350 #line 2729 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5352 if (!UpRefs.empty())
5353 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5354 yyval.ValueRefList = yyvsp[-4].ValueRefList;
5355 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
5356 yyval.ValueRefList->push_back(E);
5357 delete yyvsp[-2].TypeVal;
5363 #line 2738 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5364 { yyval.ValueRefList = new ValueRefList(); ;}
5368 #line 2741 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5369 { yyval.ValueList = new std::vector<Value*>(); ;}
5373 #line 2742 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5375 yyval.ValueList = yyvsp[-2].ValueList;
5376 yyval.ValueList->push_back(yyvsp[0].ValueVal);
5382 #line 2749 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5384 yyval.BoolVal = true;
5390 #line 2753 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5392 yyval.BoolVal = false;
5398 #line 2758 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5400 if (!UpRefs.empty())
5401 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5402 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
5403 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5405 "Arithmetic operator requires integer, FP, or packed operands");
5406 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
5407 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
5408 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
5409 yyvsp[-4].BinaryOpVal == Instruction::FRem))
5410 GEN_ERROR("Remainder not supported on vector types");
5411 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5413 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5415 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
5416 if (yyval.InstVal == 0)
5417 GEN_ERROR("binary operator returned null");
5418 delete yyvsp[-3].TypeVal;
5423 #line 2779 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5425 if (!UpRefs.empty())
5426 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5427 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
5428 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
5429 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
5430 GEN_ERROR("Logical operator requires integral operands");
5432 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5434 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5436 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
5437 if (yyval.InstVal == 0)
5438 GEN_ERROR("binary operator returned null");
5439 delete yyvsp[-3].TypeVal;
5444 #line 2796 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5446 if (!UpRefs.empty())
5447 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5448 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5449 GEN_ERROR("Vector types not supported by icmp instruction");
5450 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5452 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5454 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
5455 if (yyval.InstVal == 0)
5456 GEN_ERROR("icmp operator returned null");
5457 delete yyvsp[-3].TypeVal;
5462 #line 2810 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5464 if (!UpRefs.empty())
5465 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
5466 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
5467 GEN_ERROR("Vector types not supported by fcmp instruction");
5468 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
5470 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
5472 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
5473 if (yyval.InstVal == 0)
5474 GEN_ERROR("fcmp operator returned null");
5475 delete yyvsp[-3].TypeVal;
5480 #line 2824 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5482 if (!UpRefs.empty())
5483 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
5484 Value* Val = yyvsp[-2].ValueVal;
5485 const Type* DestTy = yyvsp[0].TypeVal->get();
5486 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
5487 GEN_ERROR("invalid cast opcode for cast from '" +
5488 Val->getType()->getDescription() + "' to '" +
5489 DestTy->getDescription() + "'");
5490 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
5491 delete yyvsp[0].TypeVal;
5496 #line 2836 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5498 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
5499 GEN_ERROR("select condition must be boolean");
5500 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
5501 GEN_ERROR("select value types should match");
5502 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5508 #line 2844 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5510 if (!UpRefs.empty())
5511 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
5512 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
5513 delete yyvsp[0].TypeVal;
5519 #line 2851 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5521 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5522 GEN_ERROR("Invalid extractelement operands");
5523 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5529 #line 2857 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5531 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5532 GEN_ERROR("Invalid insertelement operands");
5533 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5539 #line 2863 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5541 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5542 GEN_ERROR("Invalid shufflevector operands");
5543 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5549 #line 2869 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5551 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
5552 if (!Ty->isFirstClassType())
5553 GEN_ERROR("PHI node operands must be of first class type");
5554 yyval.InstVal = new PHINode(Ty);
5555 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
5556 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
5557 if (yyvsp[0].PHIList->front().first->getType() != Ty)
5558 GEN_ERROR("All elements of a PHI node must be of the same type");
5559 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
5560 yyvsp[0].PHIList->pop_front();
5562 delete yyvsp[0].PHIList; // Free the list...
5568 #line 2885 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5571 // Handle the short syntax
5572 const PointerType *PFTy = 0;
5573 const FunctionType *Ty = 0;
5574 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
5575 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5576 // Pull out the types of all of the arguments...
5577 std::vector<const Type*> ParamTypes;
5578 ParamAttrsVector Attrs;
5579 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
5580 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
5581 Attrs.push_back(PAWI);
5584 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
5585 for (; I != E; ++I, ++index) {
5586 const Type *Ty = I->Val->getType();
5587 if (Ty == Type::VoidTy)
5588 GEN_ERROR("Short call syntax cannot be used with varargs");
5589 ParamTypes.push_back(Ty);
5590 if (I->Attrs != ParamAttr::None) {
5591 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5592 Attrs.push_back(PAWI);
5596 ParamAttrsList *PAL = 0;
5598 PAL = ParamAttrsList::get(Attrs);
5600 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
5601 PFTy = PointerType::get(Ty);
5604 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
5607 // Check for call to invalid intrinsic to avoid crashing later.
5608 if (Function *theF = dyn_cast<Function>(V)) {
5609 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5610 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5611 !theF->getIntrinsicID(true))
5612 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5613 theF->getName() + "'");
5616 // Check the arguments
5618 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
5619 // Make sure no arguments is a good thing!
5620 if (Ty->getNumParams() != 0)
5621 GEN_ERROR("No arguments passed to a function that "
5622 "expects arguments");
5623 } else { // Has arguments?
5624 // Loop through FunctionType's arguments and ensure they are specified
5627 FunctionType::param_iterator I = Ty->param_begin();
5628 FunctionType::param_iterator E = Ty->param_end();
5629 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
5631 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5632 if (ArgI->Val->getType() != *I)
5633 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5634 (*I)->getDescription() + "'");
5635 Args.push_back(ArgI->Val);
5637 if (Ty->isVarArg()) {
5639 for (; ArgI != ArgE; ++ArgI)
5640 Args.push_back(ArgI->Val); // push the remaining varargs
5641 } else if (I != E || ArgI != ArgE)
5642 GEN_ERROR("Invalid number of parameters detected");
5644 // Create the call node
5645 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
5646 CI->setTailCall(yyvsp[-7].BoolVal);
5647 CI->setCallingConv(yyvsp[-6].UIntVal);
5649 delete yyvsp[-2].ValueRefList;
5650 delete yyvsp[-5].TypeVal;
5656 #line 2969 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5658 yyval.InstVal = yyvsp[0].InstVal;
5664 #line 2974 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5666 yyval.BoolVal = true;
5672 #line 2978 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5674 yyval.BoolVal = false;
5680 #line 2985 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5682 if (!UpRefs.empty())
5683 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5684 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5685 delete yyvsp[-1].TypeVal;
5691 #line 2992 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5693 if (!UpRefs.empty())
5694 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5695 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5697 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5698 delete yyvsp[-4].TypeVal;
5703 #line 3000 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5705 if (!UpRefs.empty())
5706 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5707 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5708 delete yyvsp[-1].TypeVal;
5714 #line 3007 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5716 if (!UpRefs.empty())
5717 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5718 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
5720 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5721 delete yyvsp[-4].TypeVal;
5726 #line 3015 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5728 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5729 GEN_ERROR("Trying to free nonpointer type " +
5730 yyvsp[0].ValueVal->getType()->getDescription() + "");
5731 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5737 #line 3023 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5739 if (!UpRefs.empty())
5740 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5741 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5742 GEN_ERROR("Can't load from nonpointer type: " +
5743 (*yyvsp[-2].TypeVal)->getDescription());
5744 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5745 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5746 (*yyvsp[-2].TypeVal)->getDescription());
5747 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5749 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5750 delete yyvsp[-2].TypeVal;
5755 #line 3037 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5757 if (!UpRefs.empty())
5758 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5759 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5761 GEN_ERROR("Can't store to a nonpointer type: " +
5762 (*yyvsp[-2].TypeVal)->getDescription());
5763 const Type *ElTy = PT->getElementType();
5764 if (ElTy != yyvsp[-4].ValueVal->getType())
5765 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5766 "' into space of type '" + ElTy->getDescription() + "'");
5768 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5770 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5771 delete yyvsp[-2].TypeVal;
5776 #line 3054 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
5778 if (!UpRefs.empty())
5779 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5780 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5781 GEN_ERROR("getelementptr insn requires pointer operand");
5783 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size(), true))
5784 GEN_ERROR("Invalid getelementptr indices for type '" +
5785 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5786 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5788 yyval.InstVal = new GetElementPtrInst(tmpVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size());
5789 delete yyvsp[-2].TypeVal;
5790 delete yyvsp[0].ValueList;
5797 /* Line 993 of yacc.c. */
5798 #line 5799 "llvmAsmParser.tab.c"
5804 YY_STACK_PRINT (yyss, yyssp);
5809 /* Now `shift' the result of the reduction. Determine what state
5810 that goes to, based on the state we popped back to and the rule
5811 number reduced by. */
5815 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5816 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5817 yystate = yytable[yystate];
5819 yystate = yydefgoto[yyn - YYNTOKENS];
5824 /*------------------------------------.
5825 | yyerrlab -- here on detecting error |
5826 `------------------------------------*/
5828 /* If not already recovering from an error, report this error. */
5833 yyn = yypact[yystate];
5835 if (YYPACT_NINF < yyn && yyn < YYLAST)
5837 YYSIZE_T yysize = 0;
5838 int yytype = YYTRANSLATE (yychar);
5839 const char* yyprefix;
5843 /* Start YYX at -YYN if negative to avoid negative indexes in
5845 int yyxbegin = yyn < 0 ? -yyn : 0;
5847 /* Stay within bounds of both yycheck and yytname. */
5848 int yychecklim = YYLAST - yyn;
5849 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5852 yyprefix = ", expecting ";
5853 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5854 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5856 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
5864 yysize += (sizeof ("syntax error, unexpected ")
5865 + yystrlen (yytname[yytype]));
5866 yymsg = (char *) YYSTACK_ALLOC (yysize);
5869 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
5870 yyp = yystpcpy (yyp, yytname[yytype]);
5874 yyprefix = ", expecting ";
5875 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5876 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5878 yyp = yystpcpy (yyp, yyprefix);
5879 yyp = yystpcpy (yyp, yytname[yyx]);
5884 YYSTACK_FREE (yymsg);
5887 yyerror ("syntax error; also virtual memory exhausted");
5890 #endif /* YYERROR_VERBOSE */
5891 yyerror ("syntax error");
5896 if (yyerrstatus == 3)
5898 /* If just tried and failed to reuse lookahead token after an
5899 error, discard it. */
5901 if (yychar <= YYEOF)
5903 /* If at end of input, pop the error token,
5904 then the rest of the stack, then return failure. */
5905 if (yychar == YYEOF)
5911 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
5912 yydestruct (yystos[*yyssp], yyvsp);
5917 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
5918 yydestruct (yytoken, &yylval);
5924 /* Else will try to reuse lookahead token after shifting the error
5929 /*---------------------------------------------------.
5930 | yyerrorlab -- error raised explicitly by YYERROR. |
5931 `---------------------------------------------------*/
5935 /* Pacify GCC when the user code never invokes YYERROR and the label
5936 yyerrorlab therefore never appears in user code. */
5947 /*-------------------------------------------------------------.
5948 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5949 `-------------------------------------------------------------*/
5951 yyerrstatus = 3; /* Each real token shifted decrements this. */
5955 yyn = yypact[yystate];
5956 if (yyn != YYPACT_NINF)
5959 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5967 /* Pop the current state because it cannot handle the error token. */
5971 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
5972 yydestruct (yystos[yystate], yyvsp);
5975 YY_STACK_PRINT (yyss, yyssp);
5981 YYDPRINTF ((stderr, "Shifting error token, "));
5990 /*-------------------------------------.
5991 | yyacceptlab -- YYACCEPT comes here. |
5992 `-------------------------------------*/
5997 /*-----------------------------------.
5998 | yyabortlab -- YYABORT comes here. |
5999 `-----------------------------------*/
6005 /*----------------------------------------------.
6006 | yyoverflowlab -- parser overflow comes here. |
6007 `----------------------------------------------*/
6009 yyerror ("parser stack overflow");
6017 YYSTACK_FREE (yyss);
6023 #line 3071 "/users/dag/projects/cascade/llvm.modified/lib/AsmParser/llvmAsmParser.y"
6026 // common code from the two 'RunVMAsmParser' functions
6027 static Module* RunParser(Module * M) {
6029 llvmAsmlineno = 1; // Reset the current line number...
6030 CurModule.CurrentModule = M;
6035 // Check to make sure the parser succeeded
6038 delete ParserResult;
6042 // Emit an error if there are any unresolved types left.
6043 if (!CurModule.LateResolveTypes.empty()) {
6044 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6045 if (DID.Type == ValID::LocalName) {
6046 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6048 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6051 delete ParserResult;
6055 // Emit an error if there are any unresolved values left.
6056 if (!CurModule.LateResolveValues.empty()) {
6057 Value *V = CurModule.LateResolveValues.back();
6058 std::map<Value*, std::pair<ValID, int> >::iterator I =
6059 CurModule.PlaceHolderInfo.find(V);
6061 if (I != CurModule.PlaceHolderInfo.end()) {
6062 ValID &DID = I->second.first;
6063 if (DID.Type == ValID::LocalName) {
6064 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6066 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6069 delete ParserResult;
6074 // Check to make sure that parsing produced a result
6078 // Reset ParserResult variable while saving its value for the result.
6079 Module *Result = ParserResult;
6085 void llvm::GenerateError(const std::string &message, int LineNo) {
6086 if (LineNo == -1) LineNo = llvmAsmlineno;
6087 // TODO: column number in exception
6089 TheParseError->setError(CurFilename, message, LineNo);
6093 int yyerror(const char *ErrorMsg) {
6095 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6096 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6097 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6098 if (yychar != YYEMPTY && yychar != 0)
6099 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6101 GenerateError(errMsg);