1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
85 ZEROINITIALIZER = 276,
122 X86_STDCALLCC_TOK = 313,
123 X86_FASTCALLCC_TOK = 314,
189 EXTRACTELEMENT = 380,
201 #define ESINT64VAL 258
202 #define EUINT64VAL 259
203 #define ESAPINTVAL 260
204 #define EUAPINTVAL 261
205 #define LOCALVAL_ID 262
206 #define GLOBALVAL_ID 263
215 #define GLOBALVAR 272
217 #define STRINGCONSTANT 274
218 #define ATSTRINGCONSTANT 275
219 #define ZEROINITIALIZER 276
231 #define DOTDOTDOT 288
237 #define APPENDING 294
238 #define DLLIMPORT 295
239 #define DLLEXPORT 296
240 #define EXTERN_WEAK 297
251 #define SIDEEFFECT 308
254 #define FASTCC_TOK 311
255 #define COLDCC_TOK 312
256 #define X86_STDCALLCC_TOK 313
257 #define X86_FASTCALLCC_TOK 314
258 #define DATALAYOUT 315
264 #define UNREACHABLE 321
307 #define GETELEMENTPTR 364
323 #define EXTRACTELEMENT 380
324 #define INSERTELEMENT 381
325 #define SHUFFLEVECTOR 382
336 /* Copy the first part of user declarations. */
337 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
339 #include "ParserInternals.h"
340 #include "llvm/CallingConv.h"
341 #include "llvm/InlineAsm.h"
342 #include "llvm/Instructions.h"
343 #include "llvm/Module.h"
344 #include "llvm/ValueSymbolTable.h"
345 #include "llvm/Support/GetElementPtrTypeIterator.h"
346 #include "llvm/Support/CommandLine.h"
347 #include "llvm/ADT/SmallVector.h"
348 #include "llvm/ADT/STLExtras.h"
349 #include "llvm/Support/MathExtras.h"
350 #include "llvm/Support/Streams.h"
359 // The following is a gross hack. In order to rid the libAsmParser library of
360 // exceptions, we have to have a way of getting the yyparse function to go into
361 // an error situation. So, whenever we want an error to occur, the GenerateError
362 // function (see bottom of file) sets TriggerError. Then, at the end of each
363 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
364 // (a goto) to put YACC in error state. Furthermore, several calls to
365 // GenerateError are made from inside productions and they must simulate the
366 // previous exception behavior by exiting the production immediately. We have
367 // replaced these with the GEN_ERROR macro which calls GeneratError and then
368 // immediately invokes YYERROR. This would be so much cleaner if it was a
369 // recursive descent parser.
370 static bool TriggerError = false;
371 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
372 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
374 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
375 int yylex(); // declaration" of xxx warnings.
379 std::string CurFilename;
382 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
383 cl::Hidden, cl::init(false));
386 using namespace llvm;
388 static Module *ParserResult;
390 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
391 // relating to upreferences in the input stream.
393 //#define DEBUG_UPREFS 1
395 #define UR_OUT(X) cerr << X
400 #define YYERROR_VERBOSE 1
402 static GlobalVariable *CurGV;
405 // This contains info used when building the body of a function. It is
406 // destroyed when the function is completed.
408 typedef std::vector<Value *> ValueList; // Numbered defs
411 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
413 static struct PerModuleInfo {
414 Module *CurrentModule;
415 ValueList Values; // Module level numbered definitions
416 ValueList LateResolveValues;
417 std::vector<PATypeHolder> Types;
418 std::map<ValID, PATypeHolder> LateResolveTypes;
420 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
421 /// how they were referenced and on which line of the input they came from so
422 /// that we can resolve them later and print error messages as appropriate.
423 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
425 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
426 // references to global values. Global values may be referenced before they
427 // are defined, and if so, the temporary object that they represent is held
428 // here. This is used for forward references of GlobalValues.
430 typedef std::map<std::pair<const PointerType *,
431 ValID>, GlobalValue*> GlobalRefsType;
432 GlobalRefsType GlobalRefs;
435 // If we could not resolve some functions at function compilation time
436 // (calls to functions before they are defined), resolve them now... Types
437 // are resolved when the constant pool has been completely parsed.
439 ResolveDefinitions(LateResolveValues);
443 // Check to make sure that all global value forward references have been
446 if (!GlobalRefs.empty()) {
447 std::string UndefinedReferences = "Unresolved global references exist:\n";
449 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
451 UndefinedReferences += " " + I->first.first->getDescription() + " " +
452 I->first.second.getName() + "\n";
454 GenerateError(UndefinedReferences);
458 Values.clear(); // Clear out function local definitions
463 // GetForwardRefForGlobal - Check to see if there is a forward reference
464 // for this global. If so, remove it from the GlobalRefs map and return it.
465 // If not, just return null.
466 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
467 // Check to see if there is a forward reference to this global variable...
468 // if there is, eliminate it and patch the reference to use the new def'n.
469 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
470 GlobalValue *Ret = 0;
471 if (I != GlobalRefs.end()) {
478 bool TypeIsUnresolved(PATypeHolder* PATy) {
479 // If it isn't abstract, its resolved
480 const Type* Ty = PATy->get();
481 if (!Ty->isAbstract())
483 // Traverse the type looking for abstract types. If it isn't abstract then
484 // we don't need to traverse that leg of the type.
485 std::vector<const Type*> WorkList, SeenList;
486 WorkList.push_back(Ty);
487 while (!WorkList.empty()) {
488 const Type* Ty = WorkList.back();
489 SeenList.push_back(Ty);
491 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
492 // Check to see if this is an unresolved type
493 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
494 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
495 for ( ; I != E; ++I) {
496 if (I->second.get() == OpTy)
499 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
500 const Type* TheTy = SeqTy->getElementType();
501 if (TheTy->isAbstract() && TheTy != Ty) {
502 std::vector<const Type*>::iterator I = SeenList.begin(),
508 WorkList.push_back(TheTy);
510 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
511 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
512 const Type* TheTy = StrTy->getElementType(i);
513 if (TheTy->isAbstract() && TheTy != Ty) {
514 std::vector<const Type*>::iterator I = SeenList.begin(),
520 WorkList.push_back(TheTy);
529 static struct PerFunctionInfo {
530 Function *CurrentFunction; // Pointer to current function being created
532 ValueList Values; // Keep track of #'d definitions
534 ValueList LateResolveValues;
535 bool isDeclare; // Is this function a forward declararation?
536 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
537 GlobalValue::VisibilityTypes Visibility;
539 /// BBForwardRefs - When we see forward references to basic blocks, keep
540 /// track of them here.
541 std::map<ValID, BasicBlock*> BBForwardRefs;
543 inline PerFunctionInfo() {
546 Linkage = GlobalValue::ExternalLinkage;
547 Visibility = GlobalValue::DefaultVisibility;
550 inline void FunctionStart(Function *M) {
555 void FunctionDone() {
556 // Any forward referenced blocks left?
557 if (!BBForwardRefs.empty()) {
558 GenerateError("Undefined reference to label " +
559 BBForwardRefs.begin()->second->getName());
563 // Resolve all forward references now.
564 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
566 Values.clear(); // Clear out function local definitions
567 BBForwardRefs.clear();
570 Linkage = GlobalValue::ExternalLinkage;
571 Visibility = GlobalValue::DefaultVisibility;
573 } CurFun; // Info for the current function...
575 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
578 //===----------------------------------------------------------------------===//
579 // Code to handle definitions of all the types
580 //===----------------------------------------------------------------------===//
582 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
583 // Things that have names or are void typed don't get slot numbers
584 if (V->hasName() || (V->getType() == Type::VoidTy))
587 // In the case of function values, we have to allow for the forward reference
588 // of basic blocks, which are included in the numbering. Consequently, we keep
589 // track of the next insertion location with NextValNum. When a BB gets
590 // inserted, it could change the size of the CurFun.Values vector.
591 if (&ValueTab == &CurFun.Values) {
592 if (ValueTab.size() <= CurFun.NextValNum)
593 ValueTab.resize(CurFun.NextValNum+1);
594 ValueTab[CurFun.NextValNum++] = V;
597 // For all other lists, its okay to just tack it on the back of the vector.
598 ValueTab.push_back(V);
601 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
603 case ValID::LocalID: // Is it a numbered definition?
604 // Module constants occupy the lowest numbered slots...
605 if (D.Num < CurModule.Types.size())
606 return CurModule.Types[D.Num];
608 case ValID::LocalName: // Is it a named definition?
609 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
610 D.destroy(); // Free old strdup'd memory...
615 GenerateError("Internal parser error: Invalid symbol type reference");
619 // If we reached here, we referenced either a symbol that we don't know about
620 // or an id number that hasn't been read yet. We may be referencing something
621 // forward, so just create an entry to be resolved later and get to it...
623 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
626 if (inFunctionScope()) {
627 if (D.Type == ValID::LocalName) {
628 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
631 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
636 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
637 if (I != CurModule.LateResolveTypes.end())
640 Type *Typ = OpaqueType::get();
641 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
645 // getExistingVal - Look up the value specified by the provided type and
646 // the provided ValID. If the value exists and has already been defined, return
647 // it. Otherwise return null.
649 static Value *getExistingVal(const Type *Ty, const ValID &D) {
650 if (isa<FunctionType>(Ty)) {
651 GenerateError("Functions are not values and "
652 "must be referenced as pointers");
657 case ValID::LocalID: { // Is it a numbered definition?
658 // Check that the number is within bounds.
659 if (D.Num >= CurFun.Values.size())
661 Value *Result = CurFun.Values[D.Num];
662 if (Ty != Result->getType()) {
663 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
664 Result->getType()->getDescription() + "' does not match "
665 "expected type, '" + Ty->getDescription() + "'");
670 case ValID::GlobalID: { // Is it a numbered definition?
671 if (D.Num >= CurModule.Values.size())
673 Value *Result = CurModule.Values[D.Num];
674 if (Ty != Result->getType()) {
675 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
676 Result->getType()->getDescription() + "' does not match "
677 "expected type, '" + Ty->getDescription() + "'");
683 case ValID::LocalName: { // Is it a named definition?
684 if (!inFunctionScope())
686 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
687 Value *N = SymTab.lookup(D.Name);
690 if (N->getType() != Ty)
693 D.destroy(); // Free old strdup'd memory...
696 case ValID::GlobalName: { // Is it a named definition?
697 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
698 Value *N = SymTab.lookup(D.Name);
701 if (N->getType() != Ty)
704 D.destroy(); // Free old strdup'd memory...
708 // Check to make sure that "Ty" is an integral type, and that our
709 // value will fit into the specified type...
710 case ValID::ConstSIntVal: // Is it a constant pool reference??
711 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
712 GenerateError("Signed integral constant '" +
713 itostr(D.ConstPool64) + "' is invalid for type '" +
714 Ty->getDescription() + "'");
717 return ConstantInt::get(Ty, D.ConstPool64, true);
719 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
720 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
721 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
722 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
723 "' is invalid or out of range");
725 } else { // This is really a signed reference. Transmogrify.
726 return ConstantInt::get(Ty, D.ConstPool64, true);
729 return ConstantInt::get(Ty, D.UConstPool64);
732 case ValID::ConstFPVal: // Is it a floating point const pool reference?
733 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
734 GenerateError("FP constant invalid for type");
737 return ConstantFP::get(Ty, D.ConstPoolFP);
739 case ValID::ConstNullVal: // Is it a null value?
740 if (!isa<PointerType>(Ty)) {
741 GenerateError("Cannot create a a non pointer null");
744 return ConstantPointerNull::get(cast<PointerType>(Ty));
746 case ValID::ConstUndefVal: // Is it an undef value?
747 return UndefValue::get(Ty);
749 case ValID::ConstZeroVal: // Is it a zero value?
750 return Constant::getNullValue(Ty);
752 case ValID::ConstantVal: // Fully resolved constant?
753 if (D.ConstantValue->getType() != Ty) {
754 GenerateError("Constant expression type different from required type");
757 return D.ConstantValue;
759 case ValID::InlineAsmVal: { // Inline asm expression
760 const PointerType *PTy = dyn_cast<PointerType>(Ty);
761 const FunctionType *FTy =
762 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
763 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
764 GenerateError("Invalid type for asm constraint string");
767 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
768 D.IAD->HasSideEffects);
769 D.destroy(); // Free InlineAsmDescriptor.
773 assert(0 && "Unhandled case!");
777 assert(0 && "Unhandled case!");
781 // getVal - This function is identical to getExistingVal, except that if a
782 // value is not already defined, it "improvises" by creating a placeholder var
783 // that looks and acts just like the requested variable. When the value is
784 // defined later, all uses of the placeholder variable are replaced with the
787 static Value *getVal(const Type *Ty, const ValID &ID) {
788 if (Ty == Type::LabelTy) {
789 GenerateError("Cannot use a basic block here");
793 // See if the value has already been defined.
794 Value *V = getExistingVal(Ty, ID);
796 if (TriggerError) return 0;
798 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
799 GenerateError("Invalid use of a composite type");
803 // If we reached here, we referenced either a symbol that we don't know about
804 // or an id number that hasn't been read yet. We may be referencing something
805 // forward, so just create an entry to be resolved later and get to it...
807 V = new Argument(Ty);
809 // Remember where this forward reference came from. FIXME, shouldn't we try
810 // to recycle these things??
811 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
814 if (inFunctionScope())
815 InsertValue(V, CurFun.LateResolveValues);
817 InsertValue(V, CurModule.LateResolveValues);
821 /// defineBBVal - This is a definition of a new basic block with the specified
822 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
823 static BasicBlock *defineBBVal(const ValID &ID) {
824 assert(inFunctionScope() && "Can't get basic block at global scope!");
828 // First, see if this was forward referenced
830 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
831 if (BBI != CurFun.BBForwardRefs.end()) {
833 // The forward declaration could have been inserted anywhere in the
834 // function: insert it into the correct place now.
835 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
836 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
838 // We're about to erase the entry, save the key so we can clean it up.
839 ValID Tmp = BBI->first;
841 // Erase the forward ref from the map as its no longer "forward"
842 CurFun.BBForwardRefs.erase(ID);
844 // The key has been removed from the map but so we don't want to leave
845 // strdup'd memory around so destroy it too.
848 // If its a numbered definition, bump the number and set the BB value.
849 if (ID.Type == ValID::LocalID) {
850 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
858 // We haven't seen this BB before and its first mention is a definition.
859 // Just create it and return it.
860 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
861 BB = new BasicBlock(Name, CurFun.CurrentFunction);
862 if (ID.Type == ValID::LocalID) {
863 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
867 ID.destroy(); // Free strdup'd memory
871 /// getBBVal - get an existing BB value or create a forward reference for it.
873 static BasicBlock *getBBVal(const ValID &ID) {
874 assert(inFunctionScope() && "Can't get basic block at global scope!");
878 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
879 if (BBI != CurFun.BBForwardRefs.end()) {
881 } if (ID.Type == ValID::LocalName) {
882 std::string Name = ID.Name;
883 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
885 if (N->getType()->getTypeID() == Type::LabelTyID)
886 BB = cast<BasicBlock>(N);
888 GenerateError("Reference to label '" + Name + "' is actually of type '"+
889 N->getType()->getDescription() + "'");
890 } else if (ID.Type == ValID::LocalID) {
891 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
892 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
893 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
895 GenerateError("Reference to label '%" + utostr(ID.Num) +
896 "' is actually of type '"+
897 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
900 GenerateError("Illegal label reference " + ID.getName());
904 // If its already been defined, return it now.
906 ID.destroy(); // Free strdup'd memory.
910 // Otherwise, this block has not been seen before, create it.
912 if (ID.Type == ValID::LocalName)
914 BB = new BasicBlock(Name, CurFun.CurrentFunction);
916 // Insert it in the forward refs map.
917 CurFun.BBForwardRefs[ID] = BB;
923 //===----------------------------------------------------------------------===//
924 // Code to handle forward references in instructions
925 //===----------------------------------------------------------------------===//
927 // This code handles the late binding needed with statements that reference
928 // values not defined yet... for example, a forward branch, or the PHI node for
931 // This keeps a table (CurFun.LateResolveValues) of all such forward references
932 // and back patchs after we are done.
935 // ResolveDefinitions - If we could not resolve some defs at parsing
936 // time (forward branches, phi functions for loops, etc...) resolve the
940 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
941 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
942 while (!LateResolvers.empty()) {
943 Value *V = LateResolvers.back();
944 LateResolvers.pop_back();
946 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
947 CurModule.PlaceHolderInfo.find(V);
948 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
950 ValID &DID = PHI->second.first;
952 Value *TheRealValue = getExistingVal(V->getType(), DID);
956 V->replaceAllUsesWith(TheRealValue);
958 CurModule.PlaceHolderInfo.erase(PHI);
959 } else if (FutureLateResolvers) {
960 // Functions have their unresolved items forwarded to the module late
962 InsertValue(V, *FutureLateResolvers);
964 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
965 GenerateError("Reference to an invalid definition: '" +DID.getName()+
966 "' of type '" + V->getType()->getDescription() + "'",
970 GenerateError("Reference to an invalid definition: #" +
971 itostr(DID.Num) + " of type '" +
972 V->getType()->getDescription() + "'",
978 LateResolvers.clear();
981 // ResolveTypeTo - A brand new type was just declared. This means that (if
982 // name is not null) things referencing Name can be resolved. Otherwise, things
983 // refering to the number can be resolved. Do this now.
985 static void ResolveTypeTo(char *Name, const Type *ToTy) {
987 if (Name) D = ValID::createLocalName(Name);
988 else D = ValID::createLocalID(CurModule.Types.size());
990 std::map<ValID, PATypeHolder>::iterator I =
991 CurModule.LateResolveTypes.find(D);
992 if (I != CurModule.LateResolveTypes.end()) {
993 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
994 CurModule.LateResolveTypes.erase(I);
998 // setValueName - Set the specified value to the name given. The name may be
999 // null potentially, in which case this is a noop. The string passed in is
1000 // assumed to be a malloc'd string buffer, and is free'd by this function.
1002 static void setValueName(Value *V, char *NameStr) {
1003 if (!NameStr) return;
1004 std::string Name(NameStr); // Copy string
1005 free(NameStr); // Free old string
1007 if (V->getType() == Type::VoidTy) {
1008 GenerateError("Can't assign name '" + Name+"' to value with void type");
1012 assert(inFunctionScope() && "Must be in function scope!");
1013 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1014 if (ST.lookup(Name)) {
1015 GenerateError("Redefinition of value '" + Name + "' of type '" +
1016 V->getType()->getDescription() + "'");
1024 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1025 /// this is a declaration, otherwise it is a definition.
1026 static GlobalVariable *
1027 ParseGlobalVariable(char *NameStr,
1028 GlobalValue::LinkageTypes Linkage,
1029 GlobalValue::VisibilityTypes Visibility,
1030 bool isConstantGlobal, const Type *Ty,
1031 Constant *Initializer) {
1032 if (isa<FunctionType>(Ty)) {
1033 GenerateError("Cannot declare global vars of function type");
1037 const PointerType *PTy = PointerType::get(Ty);
1041 Name = NameStr; // Copy string
1042 free(NameStr); // Free old string
1045 // See if this global value was forward referenced. If so, recycle the
1048 if (!Name.empty()) {
1049 ID = ValID::createGlobalName((char*)Name.c_str());
1051 ID = ValID::createGlobalID(CurModule.Values.size());
1054 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1055 // Move the global to the end of the list, from whereever it was
1056 // previously inserted.
1057 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1058 CurModule.CurrentModule->getGlobalList().remove(GV);
1059 CurModule.CurrentModule->getGlobalList().push_back(GV);
1060 GV->setInitializer(Initializer);
1061 GV->setLinkage(Linkage);
1062 GV->setVisibility(Visibility);
1063 GV->setConstant(isConstantGlobal);
1064 InsertValue(GV, CurModule.Values);
1068 // If this global has a name
1069 if (!Name.empty()) {
1070 // if the global we're parsing has an initializer (is a definition) and
1071 // has external linkage.
1072 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1073 // If there is already a global with external linkage with this name
1074 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1075 // If we allow this GVar to get created, it will be renamed in the
1076 // symbol table because it conflicts with an existing GVar. We can't
1077 // allow redefinition of GVars whose linking indicates that their name
1078 // must stay the same. Issue the error.
1079 GenerateError("Redefinition of global variable named '" + Name +
1080 "' of type '" + Ty->getDescription() + "'");
1085 // Otherwise there is no existing GV to use, create one now.
1086 GlobalVariable *GV =
1087 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1088 CurModule.CurrentModule);
1089 GV->setVisibility(Visibility);
1090 InsertValue(GV, CurModule.Values);
1094 // setTypeName - Set the specified type to the name given. The name may be
1095 // null potentially, in which case this is a noop. The string passed in is
1096 // assumed to be a malloc'd string buffer, and is freed by this function.
1098 // This function returns true if the type has already been defined, but is
1099 // allowed to be redefined in the specified context. If the name is a new name
1100 // for the type plane, it is inserted and false is returned.
1101 static bool setTypeName(const Type *T, char *NameStr) {
1102 assert(!inFunctionScope() && "Can't give types function-local names!");
1103 if (NameStr == 0) return false;
1105 std::string Name(NameStr); // Copy string
1106 free(NameStr); // Free old string
1108 // We don't allow assigning names to void type
1109 if (T == Type::VoidTy) {
1110 GenerateError("Can't assign name '" + Name + "' to the void type");
1114 // Set the type name, checking for conflicts as we do so.
1115 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1117 if (AlreadyExists) { // Inserting a name that is already defined???
1118 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1119 assert(Existing && "Conflict but no matching type?!");
1121 // There is only one case where this is allowed: when we are refining an
1122 // opaque type. In this case, Existing will be an opaque type.
1123 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1124 // We ARE replacing an opaque type!
1125 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1129 // Otherwise, this is an attempt to redefine a type. That's okay if
1130 // the redefinition is identical to the original. This will be so if
1131 // Existing and T point to the same Type object. In this one case we
1132 // allow the equivalent redefinition.
1133 if (Existing == T) return true; // Yes, it's equal.
1135 // Any other kind of (non-equivalent) redefinition is an error.
1136 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1137 T->getDescription() + "'");
1143 //===----------------------------------------------------------------------===//
1144 // Code for handling upreferences in type names...
1147 // TypeContains - Returns true if Ty directly contains E in it.
1149 static bool TypeContains(const Type *Ty, const Type *E) {
1150 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1151 E) != Ty->subtype_end();
1155 struct UpRefRecord {
1156 // NestingLevel - The number of nesting levels that need to be popped before
1157 // this type is resolved.
1158 unsigned NestingLevel;
1160 // LastContainedTy - This is the type at the current binding level for the
1161 // type. Every time we reduce the nesting level, this gets updated.
1162 const Type *LastContainedTy;
1164 // UpRefTy - This is the actual opaque type that the upreference is
1165 // represented with.
1166 OpaqueType *UpRefTy;
1168 UpRefRecord(unsigned NL, OpaqueType *URTy)
1169 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1173 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1174 static std::vector<UpRefRecord> UpRefs;
1176 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1177 /// called. It loops through the UpRefs vector, which is a list of the
1178 /// currently active types. For each type, if the up reference is contained in
1179 /// the newly completed type, we decrement the level count. When the level
1180 /// count reaches zero, the upreferenced type is the type that is passed in:
1181 /// thus we can complete the cycle.
1183 static PATypeHolder HandleUpRefs(const Type *ty) {
1184 // If Ty isn't abstract, or if there are no up-references in it, then there is
1185 // nothing to resolve here.
1186 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1188 PATypeHolder Ty(ty);
1189 UR_OUT("Type '" << Ty->getDescription() <<
1190 "' newly formed. Resolving upreferences.\n" <<
1191 UpRefs.size() << " upreferences active!\n");
1193 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1194 // to zero), we resolve them all together before we resolve them to Ty. At
1195 // the end of the loop, if there is anything to resolve to Ty, it will be in
1197 OpaqueType *TypeToResolve = 0;
1199 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1200 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1201 << UpRefs[i].second->getDescription() << ") = "
1202 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1203 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1204 // Decrement level of upreference
1205 unsigned Level = --UpRefs[i].NestingLevel;
1206 UpRefs[i].LastContainedTy = Ty;
1207 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1208 if (Level == 0) { // Upreference should be resolved!
1209 if (!TypeToResolve) {
1210 TypeToResolve = UpRefs[i].UpRefTy;
1212 UR_OUT(" * Resolving upreference for "
1213 << UpRefs[i].second->getDescription() << "\n";
1214 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1215 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1216 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1217 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1219 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1220 --i; // Do not skip the next element...
1225 if (TypeToResolve) {
1226 UR_OUT(" * Resolving upreference for "
1227 << UpRefs[i].second->getDescription() << "\n";
1228 std::string OldName = TypeToResolve->getDescription());
1229 TypeToResolve->refineAbstractTypeTo(Ty);
1235 //===----------------------------------------------------------------------===//
1236 // RunVMAsmParser - Define an interface to this parser
1237 //===----------------------------------------------------------------------===//
1239 static Module* RunParser(Module * M);
1241 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1244 CurFilename = Filename;
1245 return RunParser(new Module(CurFilename));
1248 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1249 set_scan_string(AsmString);
1251 CurFilename = "from_memory";
1253 return RunParser(new Module (CurFilename));
1255 return RunParser(M);
1261 /* Enabling traces. */
1266 /* Enabling verbose error messages. */
1267 #ifdef YYERROR_VERBOSE
1268 # undef YYERROR_VERBOSE
1269 # define YYERROR_VERBOSE 1
1271 # define YYERROR_VERBOSE 0
1274 /* Enabling the token table. */
1275 #ifndef YYTOKEN_TABLE
1276 # define YYTOKEN_TABLE 0
1279 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1280 #line 937 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1281 typedef union YYSTYPE {
1282 llvm::Module *ModuleVal;
1283 llvm::Function *FunctionVal;
1284 llvm::BasicBlock *BasicBlockVal;
1285 llvm::TerminatorInst *TermInstVal;
1286 llvm::Instruction *InstVal;
1287 llvm::Constant *ConstVal;
1289 const llvm::Type *PrimType;
1290 std::list<llvm::PATypeHolder> *TypeList;
1291 llvm::PATypeHolder *TypeVal;
1292 llvm::Value *ValueVal;
1293 std::vector<llvm::Value*> *ValueList;
1294 llvm::ArgListType *ArgList;
1295 llvm::TypeWithAttrs TypeWithAttrs;
1296 llvm::TypeWithAttrsList *TypeWithAttrsList;
1297 llvm::ValueRefList *ValueRefList;
1299 // Represent the RHS of PHI node
1300 std::list<std::pair<llvm::Value*,
1301 llvm::BasicBlock*> > *PHIList;
1302 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1303 std::vector<llvm::Constant*> *ConstVector;
1305 llvm::GlobalValue::LinkageTypes Linkage;
1306 llvm::GlobalValue::VisibilityTypes Visibility;
1307 uint16_t ParamAttrs;
1308 llvm::APInt *APIntVal;
1316 char *StrVal; // This memory is strdup'd!
1317 llvm::ValID ValIDVal; // strdup'd memory maybe!
1319 llvm::Instruction::BinaryOps BinaryOpVal;
1320 llvm::Instruction::TermOps TermOpVal;
1321 llvm::Instruction::MemoryOps MemOpVal;
1322 llvm::Instruction::CastOps CastOpVal;
1323 llvm::Instruction::OtherOps OtherOpVal;
1324 llvm::ICmpInst::Predicate IPredicate;
1325 llvm::FCmpInst::Predicate FPredicate;
1327 /* Line 196 of yacc.c. */
1328 #line 1329 "llvmAsmParser.tab.c"
1329 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1330 # define YYSTYPE_IS_DECLARED 1
1331 # define YYSTYPE_IS_TRIVIAL 1
1336 /* Copy the second part of user declarations. */
1339 /* Line 219 of yacc.c. */
1340 #line 1341 "llvmAsmParser.tab.c"
1342 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1343 # define YYSIZE_T __SIZE_TYPE__
1345 #if ! defined (YYSIZE_T) && defined (size_t)
1346 # define YYSIZE_T size_t
1348 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1349 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1350 # define YYSIZE_T size_t
1352 #if ! defined (YYSIZE_T)
1353 # define YYSIZE_T unsigned int
1359 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1360 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1364 # define YY_(msgid) msgid
1368 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1370 /* The parser invokes alloca or malloc; define the necessary symbols. */
1372 # ifdef YYSTACK_USE_ALLOCA
1373 # if YYSTACK_USE_ALLOCA
1375 # define YYSTACK_ALLOC __builtin_alloca
1377 # define YYSTACK_ALLOC alloca
1378 # if defined (__STDC__) || defined (__cplusplus)
1379 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1380 # define YYINCLUDED_STDLIB_H
1386 # ifdef YYSTACK_ALLOC
1387 /* Pacify GCC's `empty if-body' warning. */
1388 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1389 # ifndef YYSTACK_ALLOC_MAXIMUM
1390 /* The OS might guarantee only one guard page at the bottom of the stack,
1391 and a page size can be as small as 4096 bytes. So we cannot safely
1392 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1393 to allow for a few compiler-allocated temporary stack slots. */
1394 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1397 # define YYSTACK_ALLOC YYMALLOC
1398 # define YYSTACK_FREE YYFREE
1399 # ifndef YYSTACK_ALLOC_MAXIMUM
1400 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1406 # define YYMALLOC malloc
1407 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1408 && (defined (__STDC__) || defined (__cplusplus)))
1409 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1413 # define YYFREE free
1414 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1415 && (defined (__STDC__) || defined (__cplusplus)))
1416 void free (void *); /* INFRINGES ON USER NAME SPACE */
1423 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1426 #if (! defined (yyoverflow) \
1427 && (! defined (__cplusplus) \
1428 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1430 /* A type that is properly aligned for any stack member. */
1437 /* The size of the maximum gap between one aligned stack and the next. */
1438 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1440 /* The size of an array large to enough to hold all stacks, each with
1442 # define YYSTACK_BYTES(N) \
1443 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1444 + YYSTACK_GAP_MAXIMUM)
1446 /* Copy COUNT objects from FROM to TO. The source and destination do
1449 # if defined (__GNUC__) && 1 < __GNUC__
1450 # define YYCOPY(To, From, Count) \
1451 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1453 # define YYCOPY(To, From, Count) \
1457 for (yyi = 0; yyi < (Count); yyi++) \
1458 (To)[yyi] = (From)[yyi]; \
1464 /* Relocate STACK from its old location to the new one. The
1465 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1466 elements in the stack, and YYPTR gives the new location of the
1467 stack. Advance YYPTR to a properly aligned location for the next
1469 # define YYSTACK_RELOCATE(Stack) \
1472 YYSIZE_T yynewbytes; \
1473 YYCOPY (&yyptr->Stack, Stack, yysize); \
1474 Stack = &yyptr->Stack; \
1475 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1476 yyptr += yynewbytes / sizeof (*yyptr); \
1482 #if defined (__STDC__) || defined (__cplusplus)
1483 typedef signed char yysigned_char;
1485 typedef short int yysigned_char;
1488 /* YYFINAL -- State number of the termination state. */
1490 /* YYLAST -- Last index in YYTABLE. */
1493 /* YYNTOKENS -- Number of terminals. */
1494 #define YYNTOKENS 148
1495 /* YYNNTS -- Number of nonterminals. */
1497 /* YYNRULES -- Number of rules. */
1498 #define YYNRULES 286
1499 /* YYNRULES -- Number of states. */
1500 #define YYNSTATES 559
1502 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1503 #define YYUNDEFTOK 2
1504 #define YYMAXUTOK 388
1506 #define YYTRANSLATE(YYX) \
1507 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1509 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1510 static const unsigned char yytranslate[] =
1512 0, 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, 2, 2, 2, 2,
1516 138, 139, 136, 2, 135, 2, 2, 2, 2, 2,
1517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1518 143, 134, 144, 2, 2, 2, 2, 2, 2, 2,
1519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1521 2, 140, 137, 142, 2, 2, 2, 2, 2, 147,
1522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1524 141, 2, 2, 145, 2, 146, 2, 2, 2, 2,
1525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1537 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1538 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1539 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1540 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1541 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1542 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1543 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1544 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1545 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1546 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1547 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1548 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1549 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1550 125, 126, 127, 128, 129, 130, 131, 132, 133
1554 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1556 static const unsigned short int yyprhs[] =
1558 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1559 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1560 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1561 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1562 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1563 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1564 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1565 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1566 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1567 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1568 195, 197, 199, 200, 203, 204, 207, 208, 212, 215,
1569 216, 218, 219, 223, 225, 228, 230, 232, 234, 236,
1570 238, 240, 243, 245, 248, 254, 260, 266, 272, 276,
1571 279, 285, 290, 293, 295, 297, 299, 303, 305, 309,
1572 311, 312, 314, 318, 323, 327, 331, 336, 341, 345,
1573 352, 358, 361, 364, 367, 370, 373, 376, 379, 382,
1574 385, 388, 391, 394, 401, 407, 416, 423, 430, 438,
1575 446, 453, 462, 471, 475, 477, 479, 481, 483, 484,
1576 486, 489, 490, 494, 495, 499, 503, 507, 511, 512,
1577 519, 520, 528, 529, 537, 540, 544, 546, 550, 554,
1578 558, 562, 564, 565, 571, 575, 577, 581, 583, 584,
1579 594, 596, 598, 603, 605, 607, 610, 614, 615, 617,
1580 619, 621, 623, 625, 627, 629, 631, 633, 637, 639,
1581 645, 647, 649, 651, 653, 655, 657, 660, 663, 666,
1582 670, 673, 674, 676, 679, 682, 686, 696, 706, 715,
1583 730, 732, 734, 741, 747, 750, 757, 765, 769, 775,
1584 776, 777, 781, 784, 786, 792, 798, 805, 812, 817,
1585 824, 829, 834, 841, 848, 851, 860, 862, 864, 865,
1586 869, 876, 880, 887, 890, 895, 902
1589 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1590 static const short int yyrhs[] =
1592 188, 0, -1, 67, -1, 68, -1, 69, -1, 70,
1593 -1, 71, -1, 72, -1, 73, -1, 74, -1, 75,
1594 -1, 79, -1, 80, -1, 81, -1, 76, -1, 77,
1595 -1, 78, -1, 110, -1, 111, -1, 112, -1, 113,
1596 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
1597 -1, 119, -1, 120, -1, 121, -1, 84, -1, 85,
1598 -1, 86, -1, 87, -1, 88, -1, 89, -1, 90,
1599 -1, 91, -1, 92, -1, 93, -1, 94, -1, 95,
1600 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1601 -1, 101, -1, 102, -1, 103, -1, 90, -1, 91,
1602 -1, 92, -1, 93, -1, 22, -1, 23, -1, 11,
1603 -1, 12, -1, 13, -1, 16, -1, 19, -1, 156,
1604 -1, -1, 156, 134, -1, -1, 17, -1, 20, -1,
1605 159, 134, -1, -1, 36, -1, 38, -1, 37, -1,
1606 39, -1, 41, -1, 40, -1, 42, -1, 44, -1,
1607 -1, 133, -1, -1, 40, -1, 42, -1, -1, 36,
1608 -1, 37, -1, 38, -1, 41, -1, -1, 55, -1,
1609 56, -1, 57, -1, 58, -1, 59, -1, 54, 4,
1610 -1, 111, -1, 112, -1, 129, -1, 130, -1, -1,
1611 168, 167, -1, 128, -1, 131, -1, 167, -1, -1,
1612 170, 169, -1, -1, 47, 4, -1, -1, 135, 47,
1613 4, -1, 30, 19, -1, -1, 173, -1, -1, 135,
1614 176, 175, -1, 173, -1, 47, 4, -1, 11, -1,
1615 12, -1, 13, -1, 14, -1, 43, -1, 177, -1,
1616 178, 136, -1, 210, -1, 137, 4, -1, 178, 138,
1617 182, 139, 170, -1, 10, 138, 182, 139, 170, -1,
1618 140, 4, 141, 178, 142, -1, 143, 4, 141, 178,
1619 144, -1, 145, 183, 146, -1, 145, 146, -1, 143,
1620 145, 183, 146, 144, -1, 143, 145, 146, 144, -1,
1621 178, 168, -1, 178, -1, 10, -1, 179, -1, 181,
1622 135, 179, -1, 181, -1, 181, 135, 33, -1, 33,
1623 -1, -1, 178, -1, 183, 135, 178, -1, 178, 140,
1624 186, 142, -1, 178, 140, 142, -1, 178, 147, 19,
1625 -1, 178, 143, 186, 144, -1, 178, 145, 186, 146,
1626 -1, 178, 145, 146, -1, 178, 143, 145, 186, 146,
1627 144, -1, 178, 143, 145, 146, 144, -1, 178, 34,
1628 -1, 178, 35, -1, 178, 210, -1, 178, 185, -1,
1629 178, 21, -1, 154, 3, -1, 154, 5, -1, 154,
1630 4, -1, 154, 6, -1, 11, 22, -1, 11, 23,
1631 -1, 155, 9, -1, 151, 138, 184, 32, 178, 139,
1632 -1, 109, 138, 184, 221, 139, -1, 123, 138, 184,
1633 135, 184, 135, 184, 139, -1, 149, 138, 184, 135,
1634 184, 139, -1, 150, 138, 184, 135, 184, 139, -1,
1635 82, 152, 138, 184, 135, 184, 139, -1, 83, 153,
1636 138, 184, 135, 184, 139, -1, 125, 138, 184, 135,
1637 184, 139, -1, 126, 138, 184, 135, 184, 135, 184,
1638 139, -1, 127, 138, 184, 135, 184, 135, 184, 139,
1639 -1, 186, 135, 184, -1, 184, -1, 28, -1, 29,
1640 -1, 189, -1, -1, 190, -1, 189, 190, -1, -1,
1641 27, 191, 206, -1, -1, 26, 192, 207, -1, 52,
1642 51, 196, -1, 158, 15, 178, -1, 158, 15, 10,
1643 -1, -1, 160, 163, 187, 184, 193, 175, -1, -1,
1644 160, 161, 163, 187, 184, 194, 175, -1, -1, 160,
1645 162, 163, 187, 178, 195, 175, -1, 45, 197, -1,
1646 48, 134, 198, -1, 19, -1, 46, 134, 19, -1,
1647 60, 134, 19, -1, 140, 199, 142, -1, 199, 135,
1648 19, -1, 19, -1, -1, 200, 135, 178, 168, 157,
1649 -1, 178, 168, 157, -1, 200, -1, 200, 135, 33,
1650 -1, 33, -1, -1, 166, 180, 159, 138, 201, 139,
1651 170, 174, 171, -1, 24, -1, 145, -1, 165, 163,
1652 202, 203, -1, 25, -1, 146, -1, 213, 205, -1,
1653 164, 163, 202, -1, -1, 53, -1, 3, -1, 4,
1654 -1, 9, -1, 22, -1, 23, -1, 34, -1, 35,
1655 -1, 21, -1, 143, 186, 144, -1, 185, -1, 51,
1656 208, 19, 135, 19, -1, 7, -1, 8, -1, 156,
1657 -1, 159, -1, 210, -1, 209, -1, 178, 211, -1,
1658 213, 214, -1, 204, 214, -1, 215, 158, 216, -1,
1659 215, 218, -1, -1, 18, -1, 61, 212, -1, 61,
1660 10, -1, 62, 14, 211, -1, 62, 11, 211, 135,
1661 14, 211, 135, 14, 211, -1, 63, 154, 211, 135,
1662 14, 211, 140, 217, 142, -1, 63, 154, 211, 135,
1663 14, 211, 140, 142, -1, 64, 166, 180, 211, 138,
1664 220, 139, 170, 32, 14, 211, 65, 14, 211, -1,
1665 65, -1, 66, -1, 217, 154, 209, 135, 14, 211,
1666 -1, 154, 209, 135, 14, 211, -1, 158, 223, -1,
1667 178, 140, 211, 135, 211, 142, -1, 219, 135, 140,
1668 211, 135, 211, 142, -1, 178, 211, 168, -1, 220,
1669 135, 178, 211, 168, -1, -1, -1, 221, 135, 212,
1670 -1, 50, 49, -1, 49, -1, 149, 178, 211, 135,
1671 211, -1, 150, 178, 211, 135, 211, -1, 82, 152,
1672 178, 211, 135, 211, -1, 83, 153, 178, 211, 135,
1673 211, -1, 151, 212, 32, 178, -1, 123, 212, 135,
1674 212, 135, 212, -1, 124, 212, 135, 178, -1, 125,
1675 212, 135, 212, -1, 126, 212, 135, 212, 135, 212,
1676 -1, 127, 212, 135, 212, 135, 212, -1, 122, 219,
1677 -1, 222, 166, 180, 211, 138, 220, 139, 170, -1,
1678 225, -1, 31, -1, -1, 104, 178, 172, -1, 104,
1679 178, 135, 11, 211, 172, -1, 105, 178, 172, -1,
1680 105, 178, 135, 11, 211, 172, -1, 106, 212, -1,
1681 224, 107, 178, 211, -1, 224, 108, 212, 135, 178,
1682 211, -1, 109, 178, 211, 221, -1
1685 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1686 static const unsigned short int yyrline[] =
1688 0, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1091,
1689 1091, 1092, 1092, 1092, 1092, 1092, 1092, 1093, 1093, 1093,
1690 1093, 1093, 1093, 1094, 1094, 1094, 1094, 1094, 1094, 1097,
1691 1097, 1098, 1098, 1099, 1099, 1100, 1100, 1101, 1101, 1105,
1692 1105, 1106, 1106, 1107, 1107, 1108, 1108, 1109, 1109, 1110,
1693 1110, 1111, 1111, 1112, 1113, 1118, 1119, 1119, 1121, 1121,
1694 1122, 1122, 1126, 1130, 1135, 1135, 1137, 1141, 1147, 1148,
1695 1149, 1150, 1151, 1155, 1156, 1157, 1161, 1162, 1166, 1167,
1696 1168, 1172, 1173, 1174, 1175, 1176, 1179, 1180, 1181, 1182,
1697 1183, 1184, 1185, 1192, 1193, 1194, 1195, 1198, 1199, 1204,
1698 1205, 1206, 1209, 1210, 1217, 1218, 1224, 1225, 1233, 1241,
1699 1242, 1247, 1248, 1249, 1254, 1267, 1267, 1267, 1267, 1270,
1700 1274, 1278, 1285, 1290, 1298, 1324, 1351, 1356, 1368, 1378,
1701 1382, 1392, 1399, 1406, 1413, 1418, 1423, 1430, 1431, 1438,
1702 1445, 1453, 1459, 1471, 1499, 1515, 1544, 1572, 1597, 1616,
1703 1642, 1662, 1674, 1681, 1747, 1757, 1767, 1773, 1783, 1789,
1704 1799, 1804, 1809, 1817, 1829, 1851, 1859, 1865, 1876, 1881,
1705 1886, 1892, 1898, 1907, 1911, 1919, 1919, 1930, 1935, 1943,
1706 1944, 1948, 1948, 1952, 1952, 1955, 1958, 1982, 1993, 1993,
1707 2003, 2003, 2011, 2011, 2021, 2024, 2030, 2043, 2047, 2052,
1708 2054, 2059, 2064, 2073, 2083, 2094, 2098, 2107, 2116, 2121,
1709 2240, 2240, 2242, 2251, 2251, 2253, 2258, 2270, 2274, 2279,
1710 2283, 2287, 2291, 2295, 2299, 2303, 2307, 2311, 2336, 2340,
1711 2354, 2358, 2362, 2366, 2372, 2372, 2378, 2387, 2391, 2400,
1712 2409, 2418, 2422, 2427, 2431, 2435, 2440, 2450, 2469, 2478,
1713 2554, 2558, 2565, 2576, 2589, 2599, 2610, 2620, 2629, 2638,
1714 2641, 2642, 2649, 2653, 2658, 2679, 2696, 2710, 2724, 2736,
1715 2744, 2751, 2757, 2763, 2769, 2784, 2856, 2861, 2865, 2872,
1716 2879, 2887, 2894, 2902, 2910, 2924, 2941
1720 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1721 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1722 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1723 static const char *const yytname[] =
1725 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1726 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1727 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1728 "STRINGCONSTANT", "ATSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1729 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1730 "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK",
1731 "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT",
1732 "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE",
1733 "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT",
1734 "CC_TOK", "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1735 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1736 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1737 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1738 "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT",
1739 "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO",
1740 "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1741 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1742 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1743 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1744 "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "NOUNWIND", "DEFAULT",
1745 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1746 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1747 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1748 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1749 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1750 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1751 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1752 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1753 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1754 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1755 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1756 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1757 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1758 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1759 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1760 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1761 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1762 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1763 "OptVolatile", "MemoryInst", 0
1768 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1770 static const unsigned short int yytoknum[] =
1772 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1773 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1774 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1775 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1776 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1777 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1778 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1779 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1780 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1781 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1782 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1783 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1784 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1785 385, 386, 387, 388, 61, 44, 42, 92, 40, 41,
1786 91, 120, 93, 60, 62, 123, 125, 99
1790 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1791 static const unsigned char yyr1[] =
1793 0, 148, 149, 149, 149, 149, 149, 149, 149, 149,
1794 149, 150, 150, 150, 150, 150, 150, 151, 151, 151,
1795 151, 151, 151, 151, 151, 151, 151, 151, 151, 152,
1796 152, 152, 152, 152, 152, 152, 152, 152, 152, 153,
1797 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
1798 153, 153, 153, 153, 153, 154, 155, 155, 156, 156,
1799 157, 157, 158, 158, 159, 159, 160, 160, 161, 161,
1800 161, 161, 161, 162, 162, 162, 163, 163, 164, 164,
1801 164, 165, 165, 165, 165, 165, 166, 166, 166, 166,
1802 166, 166, 166, 167, 167, 167, 167, 168, 168, 169,
1803 169, 169, 170, 170, 171, 171, 172, 172, 173, 174,
1804 174, 175, 175, 176, 176, 177, 177, 177, 177, 178,
1805 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
1806 178, 178, 179, 180, 180, 181, 181, 182, 182, 182,
1807 182, 183, 183, 184, 184, 184, 184, 184, 184, 184,
1808 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1809 184, 184, 184, 185, 185, 185, 185, 185, 185, 185,
1810 185, 185, 185, 186, 186, 187, 187, 188, 188, 189,
1811 189, 191, 190, 192, 190, 190, 190, 190, 193, 190,
1812 194, 190, 195, 190, 190, 190, 196, 197, 197, 198,
1813 199, 199, 199, 200, 200, 201, 201, 201, 201, 202,
1814 203, 203, 204, 205, 205, 206, 207, 208, 208, 209,
1815 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1816 210, 210, 210, 210, 211, 211, 212, 213, 213, 214,
1817 215, 215, 215, 216, 216, 216, 216, 216, 216, 216,
1818 216, 216, 217, 217, 218, 219, 219, 220, 220, 220,
1819 221, 221, 222, 222, 223, 223, 223, 223, 223, 223,
1820 223, 223, 223, 223, 223, 223, 223, 224, 224, 225,
1821 225, 225, 225, 225, 225, 225, 225
1824 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1825 static const unsigned char yyr2[] =
1827 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1828 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1829 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1830 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1831 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1832 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1833 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1834 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1835 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1836 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1837 1, 1, 0, 2, 0, 2, 0, 3, 2, 0,
1838 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1839 1, 2, 1, 2, 5, 5, 5, 5, 3, 2,
1840 5, 4, 2, 1, 1, 1, 3, 1, 3, 1,
1841 0, 1, 3, 4, 3, 3, 4, 4, 3, 6,
1842 5, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1843 2, 2, 2, 6, 5, 8, 6, 6, 7, 7,
1844 6, 8, 8, 3, 1, 1, 1, 1, 0, 1,
1845 2, 0, 3, 0, 3, 3, 3, 3, 0, 6,
1846 0, 7, 0, 7, 2, 3, 1, 3, 3, 3,
1847 3, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1848 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1849 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1850 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
1851 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
1852 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1853 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1854 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1858 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1859 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1860 means the default is an error. */
1861 static const unsigned short int yydefact[] =
1863 67, 58, 64, 59, 65, 183, 181, 0, 0, 0,
1864 0, 0, 0, 76, 0, 67, 179, 78, 81, 0,
1865 0, 194, 0, 0, 62, 0, 66, 68, 70, 69,
1866 71, 73, 72, 74, 75, 77, 76, 76, 0, 1,
1867 180, 79, 80, 76, 184, 82, 83, 84, 85, 76,
1868 241, 182, 241, 0, 0, 202, 195, 196, 185, 230,
1869 231, 187, 115, 116, 117, 118, 119, 0, 0, 0,
1870 0, 232, 233, 120, 186, 122, 0, 0, 175, 176,
1871 0, 86, 86, 242, 238, 63, 213, 214, 215, 237,
1872 197, 198, 201, 0, 140, 123, 0, 0, 0, 0,
1873 129, 141, 0, 121, 140, 0, 0, 115, 116, 117,
1874 0, 0, 0, 188, 0, 87, 88, 89, 90, 91,
1875 0, 216, 0, 278, 240, 0, 199, 139, 97, 135,
1876 137, 0, 0, 0, 0, 0, 0, 128, 0, 190,
1877 192, 160, 161, 156, 158, 157, 159, 162, 155, 151,
1878 152, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1879 14, 15, 16, 11, 12, 13, 0, 0, 0, 17,
1880 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1881 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1882 0, 0, 154, 153, 111, 92, 134, 133, 0, 210,
1883 211, 212, 277, 263, 0, 0, 0, 0, 86, 250,
1884 251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1885 0, 0, 0, 0, 0, 0, 239, 86, 254, 0,
1886 276, 200, 132, 0, 102, 0, 0, 131, 0, 142,
1887 102, 111, 111, 29, 30, 31, 32, 33, 34, 35,
1888 36, 37, 38, 0, 53, 54, 49, 50, 51, 52,
1889 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1890 0, 0, 0, 0, 0, 0, 144, 174, 0, 0,
1891 0, 148, 0, 145, 0, 0, 0, 0, 189, 0,
1892 262, 244, 0, 243, 0, 0, 55, 0, 0, 0,
1893 0, 106, 106, 283, 0, 0, 274, 0, 0, 0,
1894 0, 0, 0, 0, 0, 0, 0, 0, 93, 94,
1895 95, 96, 98, 138, 136, 125, 126, 127, 130, 124,
1896 191, 193, 0, 0, 260, 0, 0, 0, 0, 0,
1897 143, 129, 141, 0, 146, 147, 0, 0, 0, 0,
1898 0, 113, 111, 208, 219, 220, 221, 226, 222, 223,
1899 224, 225, 217, 0, 228, 235, 234, 236, 0, 245,
1900 0, 0, 0, 0, 0, 279, 0, 281, 260, 0,
1901 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1902 0, 0, 99, 100, 101, 103, 0, 0, 0, 0,
1903 0, 0, 0, 173, 150, 0, 0, 0, 0, 108,
1904 114, 112, 207, 97, 205, 0, 218, 0, 0, 0,
1905 0, 0, 0, 0, 0, 0, 0, 286, 0, 0,
1906 0, 270, 271, 0, 0, 0, 0, 268, 0, 284,
1907 0, 0, 0, 0, 164, 0, 0, 0, 0, 149,
1908 0, 0, 0, 61, 0, 102, 0, 227, 0, 0,
1909 259, 0, 0, 106, 107, 106, 0, 0, 0, 0,
1910 0, 264, 265, 259, 0, 0, 0, 261, 0, 170,
1911 0, 0, 166, 167, 163, 60, 204, 206, 97, 109,
1912 0, 0, 0, 0, 0, 266, 267, 0, 280, 282,
1913 0, 0, 269, 272, 273, 0, 285, 168, 169, 0,
1914 0, 0, 61, 110, 104, 229, 0, 0, 97, 0,
1915 102, 255, 0, 102, 165, 171, 172, 203, 0, 209,
1916 0, 248, 0, 0, 257, 0, 0, 256, 275, 105,
1917 246, 0, 247, 0, 97, 0, 0, 0, 258, 0,
1918 0, 0, 0, 253, 0, 0, 252, 0, 249
1921 /* YYDEFGOTO[NTERM-NUM]. */
1922 static const short int yydefgoto[] =
1924 -1, 189, 190, 191, 253, 270, 110, 111, 71, 486,
1925 11, 72, 13, 36, 37, 38, 43, 49, 120, 322,
1926 232, 395, 325, 529, 375, 351, 514, 288, 352, 73,
1927 112, 129, 198, 130, 131, 102, 277, 364, 278, 80,
1928 14, 15, 16, 18, 17, 194, 241, 242, 58, 21,
1929 56, 93, 414, 415, 121, 201, 50, 88, 51, 44,
1930 417, 365, 75, 367, 293, 52, 84, 85, 226, 533,
1931 124, 306, 494, 398, 227, 228, 229, 230
1934 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1936 #define YYPACT_NINF -428
1937 static const short int yypact[] =
1939 262, -428, -428, -428, -428, -428, -428, -26, -85, 60,
1940 5, 50, 9, 282, 135, 406, -428, 203, 191, 32,
1941 74, -428, 73, 134, -428, 1106, -428, -428, -428, -428,
1942 -428, -428, -428, -428, -428, -428, 87, 87, 150, -428,
1943 -428, -428, -428, 87, -428, -428, -428, -428, -428, 87,
1944 208, -428, 1, 228, 234, 248, -428, -428, -428, -428,
1945 -428, 130, -428, -428, -428, -428, -428, 276, 280, 4,
1946 111, -428, -428, -428, -57, -428, 150, 150, -428, -428,
1947 1143, 311, 311, -428, -428, 118, -428, -428, -428, -428,
1948 -428, -428, -428, -6, 40, -428, 144, 146, 908, 130,
1949 -428, -57, -68, -428, 40, 1143, 1157, 39, 281, 285,
1950 232, 286, 738, -428, 292, -428, -428, -428, -428, -428,
1951 1191, -428, -7, 1314, -428, 278, -428, -428, -57, -428,
1952 166, 163, 1157, 1157, 159, -36, 1157, -428, 165, -428,
1953 -57, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1954 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1955 -428, -428, -428, -428, -428, -428, 255, 594, 167, -428,
1956 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1957 -428, 170, 171, 173, 175, 497, 1207, 945, 296, 187,
1958 196, 197, -428, -428, 192, -428, 130, -57, 213, -428,
1959 -428, -428, -428, -428, 287, 1228, 247, 338, 311, -428,
1960 -428, 255, 594, 1157, 1157, 1157, 1157, 1157, 1157, 1157,
1961 1157, 1157, 1157, 1157, 1157, 1157, -428, 311, -428, 152,
1962 -428, -428, -43, 1003, -428, -41, -103, -428, 206, -57,
1963 -428, 192, 192, -428, -428, -428, -428, -428, -428, -428,
1964 -428, -428, -428, 214, -428, -428, -428, -428, -428, -428,
1965 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1966 216, 1143, 1143, 1143, 1143, 1143, -428, -428, 17, 987,
1967 -18, -428, -33, -428, 1143, 1143, 1143, 8, -428, 217,
1968 -428, 130, 592, -428, 717, 717, -428, 717, 1191, 1157,
1969 1157, 106, 114, -428, 592, 31, 236, 239, 240, 241,
1970 242, 243, 592, 592, 347, 1191, 1157, 1157, -428, -428,
1971 -428, -428, -428, -428, -428, -40, -428, -428, -428, -40,
1972 -428, -428, 1143, 1143, -428, 245, 246, 252, 256, 1143,
1973 -428, 238, 738, -31, -428, -428, 257, 259, 351, 371,
1974 393, -428, 192, 1050, -428, -428, -428, -428, -428, -428,
1975 -428, -428, 346, 1143, -428, -428, -428, -428, 265, -428,
1976 267, 717, 592, 592, 16, -428, 19, -428, -428, 717,
1977 263, 1157, 1157, 1157, 1157, 1157, 269, 272, 1157, 717,
1978 592, 273, -428, -428, -428, -428, 275, 283, -32, 1143,
1979 1143, 1143, 1143, -428, -428, 290, 1143, 1143, 1157, -428,
1980 -428, -428, -428, -57, 289, 288, -428, 398, 13, 415,
1981 417, 297, 302, 303, 717, 435, 717, 305, 306, 717,
1982 307, -57, -428, 308, 312, 717, 717, -57, 310, -428,
1983 1157, 1143, 1143, 1157, -428, 315, 313, 320, 321, -428,
1984 322, 324, 22, 21, 1088, -428, 325, -428, 717, 717,
1985 1157, 717, 717, 329, -428, 329, 717, 330, 1157, 1157,
1986 1157, -428, -428, 1157, 592, 327, 328, -428, 1143, -428,
1987 1143, 1143, -428, -428, -428, -428, -428, -428, -57, 34,
1988 440, 333, 331, 592, 72, -428, -428, 422, -428, -428,
1989 336, 717, -428, -428, -428, 75, -428, -428, -428, 340,
1990 343, 344, 21, -428, 423, -428, 461, -1, -428, 1157,
1991 -428, -428, 345, -428, -428, -428, -428, -428, 481, -428,
1992 717, -428, 866, 2, -43, 592, 44, -428, -40, -428,
1993 -428, 353, -428, 866, -428, 472, 475, 357, -43, 717,
1994 717, 479, 429, -428, 717, 482, -428, 717, -428
1997 /* YYPGOTO[NTERM-NUM]. */
1998 static const short int yypgoto[] =
2000 -428, 374, 375, 376, 291, 294, -205, -428, 0, -12,
2001 416, 14, -428, -428, -428, 57, -428, -428, -150, -313,
2002 -404, -428, -237, -428, -295, 26, -428, -210, -428, -428,
2003 -24, 270, -223, -428, 414, 421, -69, -108, -181, 189,
2004 -428, -428, 505, -428, -428, -428, -428, -428, -428, -428,
2005 -428, -428, -428, -428, 439, -428, -428, -428, -428, -428,
2006 -428, -427, -73, 101, -197, -428, 470, -428, -428, -428,
2007 -428, -428, 51, 145, -428, -428, -428, -428
2010 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2011 positive, shift that token. If negative, reduce the rule which
2012 number is the opposite. If zero, do what YYDEFACT says.
2013 If YYTABLE_NINF, syntax error. */
2014 #define YYTABLE_NINF -179
2015 static const short int yytable[] =
2017 10, 74, 297, 329, 192, 280, 282, 377, 97, 453,
2018 296, 113, 394, 296, 12, 10, 394, 199, 303, 83,
2019 19, 307, 308, 309, 310, 311, 86, 424, 314, 12,
2020 426, 330, 331, 103, 20, 104, 139, 1, 349, 193,
2021 3, 327, -55, -55, -55, -55, 101, 59, 60, 22,
2022 99, 62, 63, 64, 65, 350, 1, 2, 298, 3,
2023 4, 141, 142, 425, 349, 25, 425, 136, 318, 319,
2024 128, 318, 319, 127, 101, 371, 545, 315, 137, 103,
2025 128, 104, 140, 66, 512, 10, 320, 321, 392, 320,
2026 321, 393, 389, 76, 77, 103, 197, 104, 343, 136,
2027 81, 326, 339, 443, 339, 541, 82, 444, 235, 236,
2028 238, 23, 239, 345, 534, 405, 547, 339, 59, 60,
2029 391, 99, 62, 63, 64, 65, 344, 1, 2, 125,
2030 3, 4, 318, 319, 1, 39, 126, 3, 200, 24,
2031 548, 531, 411, 26, 542, 318, 319, 87, 339, 98,
2032 320, 321, 339, 57, 66, 318, 319, 457, 103, 340,
2033 104, 484, 392, 320, 321, 393, 53, 103, 498, 104,
2034 499, 379, 392, 320, 321, 393, 394, 67, 78, 79,
2035 68, 292, 418, 69, 430, 70, 432, 433, 434, 301,
2036 302, 292, 304, 305, 292, 292, 292, 292, 292, 312,
2037 313, 292, 334, 335, 336, 337, 338, 519, 54, 128,
2038 519, 520, 289, 55, 523, 346, 347, 348, 489, 366,
2039 35, 366, 366, 394, 366, 394, 83, 45, 46, 47,
2040 2, 366, 48, 4, 192, 143, 144, 145, 146, 366,
2041 366, 374, 103, 41, 104, 42, 477, 90, 67, 376,
2042 103, 68, 104, 91, 69, 342, 70, 100, 294, 316,
2043 317, 295, -178, 396, 397, 105, 106, 92, 94, 193,
2044 403, 502, 503, 504, 197, 372, 373, -63, 1, 2,
2045 95, 3, 4, 536, 96, 132, 538, 133, 5, 6,
2046 -56, 197, 390, 292, -57, 147, 195, 231, 366, 366,
2047 366, 233, 234, 237, 240, 271, 366, 7, 272, 273,
2048 8, 274, 532, 275, 9, 283, 366, 366, 27, 28,
2049 29, 30, 31, 32, 33, 284, 34, 287, 543, 413,
2050 445, 446, 447, 448, 285, 286, 290, 450, 451, 243,
2051 244, 245, 246, 247, 248, 249, 250, 251, 252, 296,
2052 328, 366, 332, 366, 333, 353, 366, 292, 431, 292,
2053 292, 292, 366, 366, 437, 114, 115, 116, 117, 118,
2054 119, 380, 475, 476, 381, 382, 383, 384, 385, 388,
2055 399, 400, 404, 408, 452, 366, 366, 401, 366, 366,
2056 409, 402, 406, 366, 407, 368, 369, 410, 370, 416,
2057 419, 366, 420, 429, 435, 378, -177, 436, 440, 509,
2058 441, 510, 511, 386, 387, 35, 474, 456, 442, 292,
2059 366, -63, 1, 2, 454, 3, 4, 455, 366, 458,
2060 488, 459, 5, 6, 449, 460, 493, 461, 462, 464,
2061 443, 466, 468, 469, 292, 292, 292, 470, 473, 493,
2062 478, 7, 479, 485, 8, 480, 481, 366, 9, 515,
2063 490, 482, 366, 483, 497, 501, 507, 508, 516, 425,
2064 528, 517, 421, 422, 423, 530, 366, 366, 521, 524,
2065 428, 366, 525, 526, 366, 539, 549, 537, 546, 550,
2066 438, 439, 551, 554, 555, 535, 557, 223, 224, 225,
2067 527, 123, 299, 324, 59, 60, 300, 99, 107, 108,
2068 109, 65, 485, 1, 2, 513, 3, 4, 138, 135,
2069 40, 122, 89, 427, 505, 463, 0, 465, 0, 0,
2070 467, 0, 0, 0, 0, 0, 471, 472, 0, 0,
2071 66, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2072 0, 0, 0, 0, 0, 0, 0, 0, 0, 491,
2073 492, 0, 495, 496, 0, 0, 0, 500, 0, 0,
2074 0, 0, 0, 0, 0, 506, 0, 0, 0, 0,
2075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2076 0, 0, 0, 0, 518, 354, 355, 0, 0, 59,
2077 60, 356, 522, 0, 0, 0, 0, 0, 1, 2,
2078 0, 3, 4, 357, 358, 359, 254, 255, 0, 0,
2079 0, 0, 0, 0, 0, 0, 360, 361, 0, 0,
2080 0, 540, 0, 0, 67, 0, 544, 68, 0, 276,
2081 69, 0, 70, 362, 0, 0, 0, 0, 0, 0,
2082 552, 553, 0, 0, 0, 556, 0, 0, 558, 151,
2083 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
2084 162, 163, 164, 165, 166, 167, 0, 0, 0, 0,
2085 0, 0, 0, 0, 256, 257, 258, 259, 260, 261,
2086 262, 263, 264, 265, 266, 267, 268, 269, 0, 0,
2087 0, 168, 169, 170, 171, 172, 173, 174, 175, 176,
2088 177, 178, 179, 180, 0, 181, 0, 182, 183, 184,
2089 354, 355, 0, 0, 59, 60, 356, 0, 103, 0,
2090 104, 0, 0, 1, 2, 363, 3, 4, 357, 358,
2091 359, 0, 0, 0, 0, 59, 60, 0, 0, 0,
2092 0, 360, 361, 0, 1, 2, 0, 3, 4, 148,
2093 0, 0, 0, 0, 0, 0, 0, 0, 362, 0,
2094 0, 0, 149, 150, 0, 0, 0, 0, 0, 0,
2095 0, 0, 0, 0, 151, 152, 153, 154, 155, 156,
2096 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2097 167, 0, 0, 0, 0, 151, 152, 153, 154, 155,
2098 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2099 166, 167, 0, 0, 0, 0, 168, 169, 170, 171,
2100 172, 173, 174, 175, 176, 177, 178, 179, 180, 0,
2101 181, 0, 182, 183, 184, 0, 0, 168, 169, 170,
2102 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
2103 363, 181, 0, 182, 183, 184, 0, 0, 0, 354,
2104 355, 0, 0, 0, 103, 356, 104, 0, 185, 0,
2105 0, 186, 0, 187, 0, 188, 0, 357, 358, 359,
2106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 360, 361, 0, 0, 0, 0, 0, 0, 0, 0,
2108 0, 0, 0, 0, 0, 59, 60, 362, 99, 62,
2109 63, 64, 65, 0, 1, 2, 0, 3, 4, 0,
2110 0, 0, 0, 151, 152, 153, 154, 155, 156, 157,
2111 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2112 0, 66, 59, 60, 0, 99, 107, 108, 109, 65,
2113 0, 1, 2, 0, 3, 4, 0, 0, 0, 0,
2114 0, 0, 0, 0, 0, 168, 169, 170, 171, 172,
2115 173, 174, 175, 176, 177, 178, 179, 180, 66, 181,
2116 0, 182, 183, 184, 59, 60, 0, 99, 107, 108,
2117 109, 65, 0, 1, 2, 0, 3, 4, 0, 363,
2118 59, 60, 0, 99, 62, 63, 64, 65, 0, 1,
2119 2, 0, 3, 4, 0, 0, 0, 0, 0, 0,
2120 66, 0, 0, 0, 0, 0, 323, 0, 0, 0,
2121 0, 0, 0, 0, 0, 67, 66, 0, 68, 0,
2122 0, 69, 0, 70, 134, 0, 0, 59, 60, 0,
2123 99, 62, 63, 64, 65, 0, 1, 2, 0, 3,
2124 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2125 0, 0, 67, 412, 0, 68, 0, 0, 69, 0,
2126 70, 281, 0, 66, 0, 59, 60, 0, 99, 62,
2127 63, 64, 65, 0, 1, 2, 0, 3, 4, 0,
2128 0, 0, 0, 59, 60, 0, 61, 62, 63, 64,
2129 65, 487, 1, 2, 67, 3, 4, 68, 0, 0,
2130 69, 66, 70, 341, 0, 0, 0, 0, 0, 0,
2131 67, 0, 0, 68, 0, 0, 69, 0, 70, 66,
2132 59, 60, 0, 99, 107, 108, 109, 65, 0, 1,
2133 2, 0, 3, 4, 59, 60, 0, 99, 62, 63,
2134 64, 65, 0, 1, 2, 0, 3, 4, 0, 0,
2135 0, 0, 0, 0, 0, 0, 66, 67, 0, 0,
2136 68, 0, 0, 69, 0, 70, 0, 0, 59, 60,
2137 66, 196, 62, 63, 64, 65, 0, 1, 2, 0,
2138 3, 4, 0, 0, 59, 60, 0, 99, 107, 108,
2139 109, 65, 0, 1, 2, 67, 3, 4, 68, 0,
2140 0, 69, 0, 70, 66, 59, 60, 0, 291, 62,
2141 63, 64, 65, 67, 1, 2, 68, 3, 4, 69,
2142 66, 70, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 0, 66, 0, 0, 0, 0, 0, 0, 0, 0,
2145 67, 0, 0, 68, 0, 0, 69, 0, 70, 0,
2146 0, 0, 0, 0, 67, 0, 0, 68, 0, 0,
2147 69, 0, 70, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2149 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
2150 0, 68, 0, 0, 69, 0, 70, 0, 0, 0,
2151 0, 0, 0, 0, 67, 202, 0, 68, 0, 0,
2152 69, 0, 279, 0, 0, 0, 0, 0, 0, 0,
2153 0, 0, 0, 203, 204, 67, 0, 0, 68, 0,
2154 0, 69, 0, 70, 0, 205, 206, 207, 208, 209,
2155 210, 151, 152, 153, 154, 155, 156, 157, 158, 159,
2156 160, 161, 162, 163, 164, 165, 211, 212, 0, 0,
2157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2158 0, 0, 0, 0, 0, 0, 0, 0, 213, 214,
2159 215, 0, 0, 216, 169, 170, 171, 172, 173, 174,
2160 175, 176, 177, 178, 179, 180, 217, 218, 219, 220,
2164 static const short int yycheck[] =
2166 0, 25, 207, 240, 112, 186, 187, 302, 4, 413,
2167 11, 80, 325, 11, 0, 15, 329, 24, 215, 18,
2168 46, 218, 219, 220, 221, 222, 25, 11, 225, 15,
2169 11, 241, 242, 136, 60, 138, 105, 16, 30, 112,
2170 19, 144, 3, 4, 5, 6, 70, 7, 8, 134,
2171 10, 11, 12, 13, 14, 47, 16, 17, 208, 19,
2172 20, 22, 23, 47, 30, 15, 47, 135, 111, 112,
2173 94, 111, 112, 33, 98, 298, 32, 227, 146, 136,
2174 104, 138, 106, 43, 488, 85, 129, 130, 128, 129,
2175 130, 131, 315, 36, 37, 136, 120, 138, 279, 135,
2176 43, 142, 135, 135, 135, 532, 49, 139, 132, 133,
2177 146, 51, 136, 146, 518, 146, 543, 135, 7, 8,
2178 317, 10, 11, 12, 13, 14, 144, 16, 17, 135,
2179 19, 20, 111, 112, 16, 0, 142, 19, 145, 134,
2180 544, 142, 352, 134, 142, 111, 112, 146, 135, 145,
2181 129, 130, 135, 19, 43, 111, 112, 144, 136, 142,
2182 138, 139, 128, 129, 130, 131, 134, 136, 463, 138,
2183 465, 140, 128, 129, 130, 131, 489, 137, 28, 29,
2184 140, 205, 363, 143, 381, 145, 383, 384, 385, 213,
2185 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
2186 224, 225, 271, 272, 273, 274, 275, 135, 134, 233,
2187 135, 139, 198, 140, 139, 284, 285, 286, 455, 292,
2188 133, 294, 295, 536, 297, 538, 18, 36, 37, 38,
2189 17, 304, 41, 20, 342, 3, 4, 5, 6, 312,
2190 313, 135, 136, 40, 138, 42, 443, 19, 137, 135,
2191 136, 140, 138, 19, 143, 279, 145, 146, 11, 107,
2192 108, 14, 0, 332, 333, 76, 77, 19, 138, 342,
2193 339, 468, 469, 470, 298, 299, 300, 15, 16, 17,
2194 4, 19, 20, 520, 4, 141, 523, 141, 26, 27,
2195 9, 315, 316, 317, 9, 9, 4, 19, 371, 372,
2196 373, 135, 139, 144, 139, 138, 379, 45, 138, 138,
2197 48, 138, 517, 138, 52, 19, 389, 390, 36, 37,
2198 38, 39, 40, 41, 42, 138, 44, 135, 533, 353,
2199 399, 400, 401, 402, 138, 138, 49, 406, 407, 84,
2200 85, 86, 87, 88, 89, 90, 91, 92, 93, 11,
2201 144, 424, 138, 426, 138, 138, 429, 381, 382, 383,
2202 384, 385, 435, 436, 388, 54, 55, 56, 57, 58,
2203 59, 135, 441, 442, 135, 135, 135, 135, 135, 32,
2204 135, 135, 144, 32, 408, 458, 459, 135, 461, 462,
2205 19, 135, 135, 466, 135, 294, 295, 4, 297, 53,
2206 135, 474, 135, 140, 135, 304, 0, 135, 135, 478,
2207 135, 480, 481, 312, 313, 133, 440, 19, 135, 443,
2208 493, 15, 16, 17, 135, 19, 20, 139, 501, 14,
2209 454, 14, 26, 27, 144, 138, 460, 135, 135, 4,
2210 135, 135, 135, 135, 468, 469, 470, 135, 138, 473,
2211 135, 45, 139, 453, 48, 135, 135, 530, 52, 19,
2212 135, 139, 535, 139, 135, 135, 139, 139, 135, 47,
2213 47, 140, 371, 372, 373, 14, 549, 550, 142, 139,
2214 379, 554, 139, 139, 557, 4, 14, 142, 135, 14,
2215 389, 390, 135, 14, 65, 519, 14, 123, 123, 123,
2216 512, 85, 211, 233, 7, 8, 212, 10, 11, 12,
2217 13, 14, 512, 16, 17, 489, 19, 20, 104, 98,
2218 15, 82, 52, 378, 473, 424, -1, 426, -1, -1,
2219 429, -1, -1, -1, -1, -1, 435, 436, -1, -1,
2220 43, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2221 -1, -1, -1, -1, -1, -1, -1, -1, -1, 458,
2222 459, -1, 461, 462, -1, -1, -1, 466, -1, -1,
2223 -1, -1, -1, -1, -1, 474, -1, -1, -1, -1,
2224 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2225 -1, -1, -1, -1, 493, 3, 4, -1, -1, 7,
2226 8, 9, 501, -1, -1, -1, -1, -1, 16, 17,
2227 -1, 19, 20, 21, 22, 23, 22, 23, -1, -1,
2228 -1, -1, -1, -1, -1, -1, 34, 35, -1, -1,
2229 -1, 530, -1, -1, 137, -1, 535, 140, -1, 142,
2230 143, -1, 145, 51, -1, -1, -1, -1, -1, -1,
2231 549, 550, -1, -1, -1, 554, -1, -1, 557, 67,
2232 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2233 78, 79, 80, 81, 82, 83, -1, -1, -1, -1,
2234 -1, -1, -1, -1, 90, 91, 92, 93, 94, 95,
2235 96, 97, 98, 99, 100, 101, 102, 103, -1, -1,
2236 -1, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2237 118, 119, 120, 121, -1, 123, -1, 125, 126, 127,
2238 3, 4, -1, -1, 7, 8, 9, -1, 136, -1,
2239 138, -1, -1, 16, 17, 143, 19, 20, 21, 22,
2240 23, -1, -1, -1, -1, 7, 8, -1, -1, -1,
2241 -1, 34, 35, -1, 16, 17, -1, 19, 20, 21,
2242 -1, -1, -1, -1, -1, -1, -1, -1, 51, -1,
2243 -1, -1, 34, 35, -1, -1, -1, -1, -1, -1,
2244 -1, -1, -1, -1, 67, 68, 69, 70, 71, 72,
2245 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2246 83, -1, -1, -1, -1, 67, 68, 69, 70, 71,
2247 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2248 82, 83, -1, -1, -1, -1, 109, 110, 111, 112,
2249 113, 114, 115, 116, 117, 118, 119, 120, 121, -1,
2250 123, -1, 125, 126, 127, -1, -1, 109, 110, 111,
2251 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2252 143, 123, -1, 125, 126, 127, -1, -1, -1, 3,
2253 4, -1, -1, -1, 136, 9, 138, -1, 140, -1,
2254 -1, 143, -1, 145, -1, 147, -1, 21, 22, 23,
2255 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2256 34, 35, -1, -1, -1, -1, -1, -1, -1, -1,
2257 -1, -1, -1, -1, -1, 7, 8, 51, 10, 11,
2258 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2259 -1, -1, -1, 67, 68, 69, 70, 71, 72, 73,
2260 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2261 -1, 43, 7, 8, -1, 10, 11, 12, 13, 14,
2262 -1, 16, 17, -1, 19, 20, -1, -1, -1, -1,
2263 -1, -1, -1, -1, -1, 109, 110, 111, 112, 113,
2264 114, 115, 116, 117, 118, 119, 120, 121, 43, 123,
2265 -1, 125, 126, 127, 7, 8, -1, 10, 11, 12,
2266 13, 14, -1, 16, 17, -1, 19, 20, -1, 143,
2267 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2268 17, -1, 19, 20, -1, -1, -1, -1, -1, -1,
2269 43, -1, -1, -1, -1, -1, 33, -1, -1, -1,
2270 -1, -1, -1, -1, -1, 137, 43, -1, 140, -1,
2271 -1, 143, -1, 145, 146, -1, -1, 7, 8, -1,
2272 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2273 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2274 -1, -1, 137, 33, -1, 140, -1, -1, 143, -1,
2275 145, 146, -1, 43, -1, 7, 8, -1, 10, 11,
2276 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2277 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2278 14, 33, 16, 17, 137, 19, 20, 140, -1, -1,
2279 143, 43, 145, 146, -1, -1, -1, -1, -1, -1,
2280 137, -1, -1, 140, -1, -1, 143, -1, 145, 43,
2281 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2282 17, -1, 19, 20, 7, 8, -1, 10, 11, 12,
2283 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2284 -1, -1, -1, -1, -1, -1, 43, 137, -1, -1,
2285 140, -1, -1, 143, -1, 145, -1, -1, 7, 8,
2286 43, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2287 19, 20, -1, -1, 7, 8, -1, 10, 11, 12,
2288 13, 14, -1, 16, 17, 137, 19, 20, 140, -1,
2289 -1, 143, -1, 145, 43, 7, 8, -1, 10, 11,
2290 12, 13, 14, 137, 16, 17, 140, 19, 20, 143,
2291 43, 145, -1, -1, -1, -1, -1, -1, -1, -1,
2292 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2293 -1, 43, -1, -1, -1, -1, -1, -1, -1, -1,
2294 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2295 -1, -1, -1, -1, 137, -1, -1, 140, -1, -1,
2296 143, -1, 145, -1, -1, -1, -1, -1, -1, -1,
2297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2298 -1, -1, -1, -1, -1, -1, -1, -1, 137, -1,
2299 -1, 140, -1, -1, 143, -1, 145, -1, -1, -1,
2300 -1, -1, -1, -1, 137, 31, -1, 140, -1, -1,
2301 143, -1, 145, -1, -1, -1, -1, -1, -1, -1,
2302 -1, -1, -1, 49, 50, 137, -1, -1, 140, -1,
2303 -1, 143, -1, 145, -1, 61, 62, 63, 64, 65,
2304 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2305 76, 77, 78, 79, 80, 81, 82, 83, -1, -1,
2306 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2307 -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
2308 106, -1, -1, 109, 110, 111, 112, 113, 114, 115,
2309 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2313 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2314 symbol of state STATE-NUM. */
2315 static const unsigned char yystos[] =
2317 0, 16, 17, 19, 20, 26, 27, 45, 48, 52,
2318 156, 158, 159, 160, 188, 189, 190, 192, 191, 46,
2319 60, 197, 134, 51, 134, 15, 134, 36, 37, 38,
2320 39, 40, 41, 42, 44, 133, 161, 162, 163, 0,
2321 190, 40, 42, 164, 207, 36, 37, 38, 41, 165,
2322 204, 206, 213, 134, 134, 140, 198, 19, 196, 7,
2323 8, 10, 11, 12, 13, 14, 43, 137, 140, 143,
2324 145, 156, 159, 177, 178, 210, 163, 163, 28, 29,
2325 187, 163, 163, 18, 214, 215, 25, 146, 205, 214,
2326 19, 19, 19, 199, 138, 4, 4, 4, 145, 10,
2327 146, 178, 183, 136, 138, 187, 187, 11, 12, 13,
2328 154, 155, 178, 184, 54, 55, 56, 57, 58, 59,
2329 166, 202, 202, 158, 218, 135, 142, 33, 178, 179,
2330 181, 182, 141, 141, 146, 183, 135, 146, 182, 184,
2331 178, 22, 23, 3, 4, 5, 6, 9, 21, 34,
2332 35, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2333 76, 77, 78, 79, 80, 81, 82, 83, 109, 110,
2334 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2335 121, 123, 125, 126, 127, 140, 143, 145, 147, 149,
2336 150, 151, 185, 210, 193, 4, 10, 178, 180, 24,
2337 145, 203, 31, 49, 50, 61, 62, 63, 64, 65,
2338 66, 82, 83, 104, 105, 106, 109, 122, 123, 124,
2339 125, 126, 127, 149, 150, 151, 216, 222, 223, 224,
2340 225, 19, 168, 135, 139, 178, 178, 144, 146, 178,
2341 139, 194, 195, 84, 85, 86, 87, 88, 89, 90,
2342 91, 92, 93, 152, 22, 23, 90, 91, 92, 93,
2343 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2344 153, 138, 138, 138, 138, 138, 142, 184, 186, 145,
2345 186, 146, 186, 19, 138, 138, 138, 135, 175, 159,
2346 49, 10, 178, 212, 11, 14, 11, 154, 166, 152,
2347 153, 178, 178, 212, 178, 178, 219, 212, 212, 212,
2348 212, 212, 178, 178, 212, 166, 107, 108, 111, 112,
2349 129, 130, 167, 33, 179, 170, 142, 144, 144, 170,
2350 175, 175, 138, 138, 184, 184, 184, 184, 184, 135,
2351 142, 146, 178, 186, 144, 146, 184, 184, 184, 30,
2352 47, 173, 176, 138, 3, 4, 9, 21, 22, 23,
2353 34, 35, 51, 143, 185, 209, 210, 211, 211, 211,
2354 211, 180, 178, 178, 135, 172, 135, 172, 211, 140,
2355 135, 135, 135, 135, 135, 135, 211, 211, 32, 180,
2356 178, 212, 128, 131, 167, 169, 184, 184, 221, 135,
2357 135, 135, 135, 184, 144, 146, 135, 135, 32, 19,
2358 4, 175, 33, 178, 200, 201, 53, 208, 186, 135,
2359 135, 211, 211, 211, 11, 47, 11, 221, 211, 140,
2360 212, 178, 212, 212, 212, 135, 135, 178, 211, 211,
2361 135, 135, 135, 135, 139, 184, 184, 184, 184, 144,
2362 184, 184, 178, 168, 135, 139, 19, 144, 14, 14,
2363 138, 135, 135, 211, 4, 211, 135, 211, 135, 135,
2364 135, 211, 211, 138, 178, 184, 184, 212, 135, 139,
2365 135, 135, 139, 139, 139, 156, 157, 33, 178, 170,
2366 135, 211, 211, 178, 220, 211, 211, 135, 172, 172,
2367 211, 135, 212, 212, 212, 220, 211, 139, 139, 184,
2368 184, 184, 168, 173, 174, 19, 135, 140, 211, 135,
2369 139, 142, 211, 139, 139, 139, 139, 157, 47, 171,
2370 14, 142, 154, 217, 168, 178, 170, 142, 170, 4,
2371 211, 209, 142, 154, 211, 32, 135, 209, 168, 14,
2372 14, 135, 211, 211, 14, 65, 211, 14, 211
2375 #define yyerrok (yyerrstatus = 0)
2376 #define yyclearin (yychar = YYEMPTY)
2377 #define YYEMPTY (-2)
2380 #define YYACCEPT goto yyacceptlab
2381 #define YYABORT goto yyabortlab
2382 #define YYERROR goto yyerrorlab
2385 /* Like YYERROR except do call yyerror. This remains here temporarily
2386 to ease the transition to the new meaning of YYERROR, for GCC.
2387 Once GCC version 2 has supplanted version 1, this can go. */
2389 #define YYFAIL goto yyerrlab
2391 #define YYRECOVERING() (!!yyerrstatus)
2393 #define YYBACKUP(Token, Value) \
2395 if (yychar == YYEMPTY && yylen == 1) \
2399 yytoken = YYTRANSLATE (yychar); \
2405 yyerror (YY_("syntax error: cannot back up")); \
2412 #define YYERRCODE 256
2415 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2416 If N is 0, then set CURRENT to the empty location which ends
2417 the previous symbol: RHS[0] (always defined). */
2419 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2420 #ifndef YYLLOC_DEFAULT
2421 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2425 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2426 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2427 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2428 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2432 (Current).first_line = (Current).last_line = \
2433 YYRHSLOC (Rhs, 0).last_line; \
2434 (Current).first_column = (Current).last_column = \
2435 YYRHSLOC (Rhs, 0).last_column; \
2441 /* YY_LOCATION_PRINT -- Print the location on the stream.
2442 This macro was not mandated originally: define only if we know
2443 we won't break user code: when these are the locations we know. */
2445 #ifndef YY_LOCATION_PRINT
2446 # if YYLTYPE_IS_TRIVIAL
2447 # define YY_LOCATION_PRINT(File, Loc) \
2448 fprintf (File, "%d.%d-%d.%d", \
2449 (Loc).first_line, (Loc).first_column, \
2450 (Loc).last_line, (Loc).last_column)
2452 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2457 /* YYLEX -- calling `yylex' with the right arguments. */
2460 # define YYLEX yylex (YYLEX_PARAM)
2462 # define YYLEX yylex ()
2465 /* Enable debugging if requested. */
2469 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2470 # define YYFPRINTF fprintf
2473 # define YYDPRINTF(Args) \
2479 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2483 YYFPRINTF (stderr, "%s ", Title); \
2484 yysymprint (stderr, \
2486 YYFPRINTF (stderr, "\n"); \
2490 /*------------------------------------------------------------------.
2491 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2493 `------------------------------------------------------------------*/
2495 #if defined (__STDC__) || defined (__cplusplus)
2497 yy_stack_print (short int *bottom, short int *top)
2500 yy_stack_print (bottom, top)
2505 YYFPRINTF (stderr, "Stack now");
2506 for (/* Nothing. */; bottom <= top; ++bottom)
2507 YYFPRINTF (stderr, " %d", *bottom);
2508 YYFPRINTF (stderr, "\n");
2511 # define YY_STACK_PRINT(Bottom, Top) \
2514 yy_stack_print ((Bottom), (Top)); \
2518 /*------------------------------------------------.
2519 | Report that the YYRULE is going to be reduced. |
2520 `------------------------------------------------*/
2522 #if defined (__STDC__) || defined (__cplusplus)
2524 yy_reduce_print (int yyrule)
2527 yy_reduce_print (yyrule)
2532 unsigned long int yylno = yyrline[yyrule];
2533 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2535 /* Print the symbols being reduced, and their result. */
2536 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2537 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2538 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2541 # define YY_REDUCE_PRINT(Rule) \
2544 yy_reduce_print (Rule); \
2547 /* Nonzero means print parse trace. It is left uninitialized so that
2548 multiple parsers can coexist. */
2550 #else /* !YYDEBUG */
2551 # define YYDPRINTF(Args)
2552 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2553 # define YY_STACK_PRINT(Bottom, Top)
2554 # define YY_REDUCE_PRINT(Rule)
2555 #endif /* !YYDEBUG */
2558 /* YYINITDEPTH -- initial size of the parser's stacks. */
2560 # define YYINITDEPTH 200
2563 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2564 if the built-in stack extension method is used).
2566 Do not make this value too large; the results are undefined if
2567 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2568 evaluated with infinite-precision integer arithmetic. */
2571 # define YYMAXDEPTH 10000
2579 # if defined (__GLIBC__) && defined (_STRING_H)
2580 # define yystrlen strlen
2582 /* Return the length of YYSTR. */
2584 # if defined (__STDC__) || defined (__cplusplus)
2585 yystrlen (const char *yystr)
2591 const char *yys = yystr;
2593 while (*yys++ != '\0')
2596 return yys - yystr - 1;
2602 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2603 # define yystpcpy stpcpy
2605 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2608 # if defined (__STDC__) || defined (__cplusplus)
2609 yystpcpy (char *yydest, const char *yysrc)
2611 yystpcpy (yydest, yysrc)
2617 const char *yys = yysrc;
2619 while ((*yyd++ = *yys++) != '\0')
2628 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2629 quotes and backslashes, so that it's suitable for yyerror. The
2630 heuristic is that double-quoting is unnecessary unless the string
2631 contains an apostrophe, a comma, or backslash (other than
2632 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2633 null, do not copy; instead, return the length of what the result
2636 yytnamerr (char *yyres, const char *yystr)
2641 char const *yyp = yystr;
2648 goto do_not_strip_quotes;
2652 goto do_not_strip_quotes;
2665 do_not_strip_quotes: ;
2669 return yystrlen (yystr);
2671 return yystpcpy (yyres, yystr) - yyres;
2675 #endif /* YYERROR_VERBOSE */
2680 /*--------------------------------.
2681 | Print this symbol on YYOUTPUT. |
2682 `--------------------------------*/
2684 #if defined (__STDC__) || defined (__cplusplus)
2686 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2689 yysymprint (yyoutput, yytype, yyvaluep)
2695 /* Pacify ``unused variable'' warnings. */
2698 if (yytype < YYNTOKENS)
2699 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2701 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2705 if (yytype < YYNTOKENS)
2706 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2713 YYFPRINTF (yyoutput, ")");
2716 #endif /* ! YYDEBUG */
2717 /*-----------------------------------------------.
2718 | Release the memory associated to this symbol. |
2719 `-----------------------------------------------*/
2721 #if defined (__STDC__) || defined (__cplusplus)
2723 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2726 yydestruct (yymsg, yytype, yyvaluep)
2732 /* Pacify ``unused variable'' warnings. */
2737 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2748 /* Prevent warnings from -Wmissing-prototypes. */
2750 #ifdef YYPARSE_PARAM
2751 # if defined (__STDC__) || defined (__cplusplus)
2752 int yyparse (void *YYPARSE_PARAM);
2756 #else /* ! YYPARSE_PARAM */
2757 #if defined (__STDC__) || defined (__cplusplus)
2762 #endif /* ! YYPARSE_PARAM */
2766 /* The look-ahead symbol. */
2769 /* The semantic value of the look-ahead symbol. */
2772 /* Number of syntax errors so far. */
2781 #ifdef YYPARSE_PARAM
2782 # if defined (__STDC__) || defined (__cplusplus)
2783 int yyparse (void *YYPARSE_PARAM)
2785 int yyparse (YYPARSE_PARAM)
2786 void *YYPARSE_PARAM;
2788 #else /* ! YYPARSE_PARAM */
2789 #if defined (__STDC__) || defined (__cplusplus)
2803 /* Number of tokens to shift before error messages enabled. */
2805 /* Look-ahead token as an internal (translated) token number. */
2808 /* Three stacks and their tools:
2809 `yyss': related to states,
2810 `yyvs': related to semantic values,
2811 `yyls': related to locations.
2813 Refer to the stacks thru separate pointers, to allow yyoverflow
2814 to reallocate them elsewhere. */
2816 /* The state stack. */
2817 short int yyssa[YYINITDEPTH];
2818 short int *yyss = yyssa;
2821 /* The semantic value stack. */
2822 YYSTYPE yyvsa[YYINITDEPTH];
2823 YYSTYPE *yyvs = yyvsa;
2828 #define YYPOPSTACK (yyvsp--, yyssp--)
2830 YYSIZE_T yystacksize = YYINITDEPTH;
2832 /* The variables used to return semantic value and location from the
2837 /* When reducing, the number of symbols on the RHS of the reduced
2841 YYDPRINTF ((stderr, "Starting parse\n"));
2846 yychar = YYEMPTY; /* Cause a token to be read. */
2848 /* Initialize stack pointers.
2849 Waste one element of value and location stack
2850 so that they stay on the same level as the state stack.
2851 The wasted elements are never initialized. */
2858 /*------------------------------------------------------------.
2859 | yynewstate -- Push a new state, which is found in yystate. |
2860 `------------------------------------------------------------*/
2862 /* In all cases, when you get here, the value and location stacks
2863 have just been pushed. so pushing a state here evens the stacks.
2870 if (yyss + yystacksize - 1 <= yyssp)
2872 /* Get the current used size of the three stacks, in elements. */
2873 YYSIZE_T yysize = yyssp - yyss + 1;
2877 /* Give user a chance to reallocate the stack. Use copies of
2878 these so that the &'s don't force the real ones into
2880 YYSTYPE *yyvs1 = yyvs;
2881 short int *yyss1 = yyss;
2884 /* Each stack pointer address is followed by the size of the
2885 data in use in that stack, in bytes. This used to be a
2886 conditional around just the two extra args, but that might
2887 be undefined if yyoverflow is a macro. */
2888 yyoverflow (YY_("memory exhausted"),
2889 &yyss1, yysize * sizeof (*yyssp),
2890 &yyvs1, yysize * sizeof (*yyvsp),
2897 #else /* no yyoverflow */
2898 # ifndef YYSTACK_RELOCATE
2899 goto yyexhaustedlab;
2901 /* Extend the stack our own way. */
2902 if (YYMAXDEPTH <= yystacksize)
2903 goto yyexhaustedlab;
2905 if (YYMAXDEPTH < yystacksize)
2906 yystacksize = YYMAXDEPTH;
2909 short int *yyss1 = yyss;
2910 union yyalloc *yyptr =
2911 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2913 goto yyexhaustedlab;
2914 YYSTACK_RELOCATE (yyss);
2915 YYSTACK_RELOCATE (yyvs);
2917 # undef YYSTACK_RELOCATE
2919 YYSTACK_FREE (yyss1);
2922 #endif /* no yyoverflow */
2924 yyssp = yyss + yysize - 1;
2925 yyvsp = yyvs + yysize - 1;
2928 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2929 (unsigned long int) yystacksize));
2931 if (yyss + yystacksize - 1 <= yyssp)
2935 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2944 /* Do appropriate processing given the current state. */
2945 /* Read a look-ahead token if we need one and don't already have one. */
2948 /* First try to decide what to do without reference to look-ahead token. */
2950 yyn = yypact[yystate];
2951 if (yyn == YYPACT_NINF)
2954 /* Not known => get a look-ahead token if don't already have one. */
2956 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2957 if (yychar == YYEMPTY)
2959 YYDPRINTF ((stderr, "Reading a token: "));
2963 if (yychar <= YYEOF)
2965 yychar = yytoken = YYEOF;
2966 YYDPRINTF ((stderr, "Now at end of input.\n"));
2970 yytoken = YYTRANSLATE (yychar);
2971 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2974 /* If the proper action on seeing token YYTOKEN is to reduce or to
2975 detect an error, take that action. */
2977 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2982 if (yyn == 0 || yyn == YYTABLE_NINF)
2991 /* Shift the look-ahead token. */
2992 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2994 /* Discard the token being shifted unless it is eof. */
2995 if (yychar != YYEOF)
3001 /* Count tokens shifted since error; after three, turn off error
3010 /*-----------------------------------------------------------.
3011 | yydefault -- do the default action for the current state. |
3012 `-----------------------------------------------------------*/
3014 yyn = yydefact[yystate];
3020 /*-----------------------------.
3021 | yyreduce -- Do a reduction. |
3022 `-----------------------------*/
3024 /* yyn is the number of a rule to reduce with. */
3027 /* If YYLEN is nonzero, implement the default value of the action:
3030 Otherwise, the following line sets YYVAL to garbage.
3031 This behavior is undocumented and Bison
3032 users should not rely upon it. Assigning to YYVAL
3033 unconditionally makes the parser a bit smaller, and it avoids a
3034 GCC warning that YYVAL may be used uninitialized. */
3035 yyval = yyvsp[1-yylen];
3038 YY_REDUCE_PRINT (yyn);
3042 #line 1097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3043 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3047 #line 1097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3048 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3052 #line 1098 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3053 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3057 #line 1098 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3058 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3062 #line 1099 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3063 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3067 #line 1099 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3068 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3072 #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3073 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3077 #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3078 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3082 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3083 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3087 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3088 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3092 #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3093 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3097 #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3098 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3102 #line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3103 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3107 #line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3108 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3112 #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3113 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3117 #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3118 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3122 #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3123 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3127 #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3128 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3132 #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3133 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3137 #line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3138 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3142 #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3143 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3147 #line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3148 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3152 #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3153 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3157 #line 1111 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3158 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3162 #line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3163 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3167 #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3168 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3172 #line 1122 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3173 { (yyval.StrVal) = 0; ;}
3177 #line 1126 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3179 (yyval.StrVal) = (yyvsp[-1].StrVal);
3185 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3193 #line 1137 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3195 (yyval.StrVal) = (yyvsp[-1].StrVal);
3201 #line 1141 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3209 #line 1147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3210 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3214 #line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3215 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3219 #line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3220 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3224 #line 1150 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3225 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3229 #line 1151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3230 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3234 #line 1155 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3235 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3239 #line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3240 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3244 #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3245 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3249 #line 1161 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3250 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3254 #line 1162 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3255 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3259 #line 1166 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3260 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3264 #line 1167 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3265 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3269 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3270 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3274 #line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3275 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3279 #line 1173 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3280 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3284 #line 1174 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3285 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3289 #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3290 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3294 #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3295 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3299 #line 1179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3300 { (yyval.UIntVal) = CallingConv::C; ;}
3304 #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3305 { (yyval.UIntVal) = CallingConv::C; ;}
3309 #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3310 { (yyval.UIntVal) = CallingConv::Fast; ;}
3314 #line 1182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3315 { (yyval.UIntVal) = CallingConv::Cold; ;}
3319 #line 1183 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3320 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3324 #line 1184 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3325 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3329 #line 1185 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3331 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3332 GEN_ERROR("Calling conv too large");
3333 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3339 #line 1192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3340 { (yyval.ParamAttrs) = ZExtAttribute; ;}
3344 #line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3345 { (yyval.ParamAttrs) = SExtAttribute; ;}
3349 #line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3350 { (yyval.ParamAttrs) = InRegAttribute; ;}
3354 #line 1195 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3355 { (yyval.ParamAttrs) = StructRetAttribute; ;}
3359 #line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3360 { (yyval.ParamAttrs) = NoAttributeSet; ;}
3364 #line 1199 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3366 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3371 #line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3372 { (yyval.ParamAttrs) = NoReturnAttribute; ;}
3376 #line 1205 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3377 { (yyval.ParamAttrs) = NoUnwindAttribute; ;}
3381 #line 1209 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3382 { (yyval.ParamAttrs) = NoAttributeSet; ;}
3386 #line 1210 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3388 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3393 #line 1217 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3394 { (yyval.UIntVal) = 0; ;}
3398 #line 1218 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3400 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3401 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3402 GEN_ERROR("Alignment must be a power of two");
3408 #line 1224 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3409 { (yyval.UIntVal) = 0; ;}
3413 #line 1225 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3415 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3416 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3417 GEN_ERROR("Alignment must be a power of two");
3423 #line 1233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3425 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3426 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3427 GEN_ERROR("Invalid character in section name");
3428 (yyval.StrVal) = (yyvsp[0].StrVal);
3434 #line 1241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3435 { (yyval.StrVal) = 0; ;}
3439 #line 1242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3440 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3444 #line 1247 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3449 #line 1248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3454 #line 1249 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3456 CurGV->setSection((yyvsp[0].StrVal));
3457 free((yyvsp[0].StrVal));
3463 #line 1254 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3465 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3466 GEN_ERROR("Alignment must be a power of two");
3467 CurGV->setAlignment((yyvsp[0].UInt64Val));
3473 #line 1270 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3475 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3481 #line 1274 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3483 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3489 #line 1278 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3491 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3492 GEN_ERROR("Cannot form a pointer to a basic block");
3493 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3494 delete (yyvsp[-1].TypeVal);
3500 #line 1285 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3501 { // Named types are also simple types...
3502 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3504 (yyval.TypeVal) = new PATypeHolder(tmp);
3509 #line 1290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3510 { // Type UpReference
3511 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3512 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3513 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3514 (yyval.TypeVal) = new PATypeHolder(OT);
3515 UR_OUT("New Upreference!\n");
3521 #line 1298 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3523 std::vector<const Type*> Params;
3524 ParamAttrsList Attrs;
3525 if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
3526 Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
3528 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3529 for (; I != E; ++I, ++index) {
3530 const Type *Ty = I->Ty->get();
3531 Params.push_back(Ty);
3532 if (Ty != Type::VoidTy)
3533 if (I->Attrs != NoAttributeSet)
3534 Attrs.addAttributes(index, I->Attrs);
3536 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3537 if (isVarArg) Params.pop_back();
3539 ParamAttrsList *ActualAttrs = 0;
3541 ActualAttrs = new ParamAttrsList(Attrs);
3542 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, ActualAttrs);
3543 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3544 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3545 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3551 #line 1324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3553 std::vector<const Type*> Params;
3554 ParamAttrsList Attrs;
3555 if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
3556 Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
3557 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3559 for ( ; I != E; ++I, ++index) {
3560 const Type* Ty = I->Ty->get();
3561 Params.push_back(Ty);
3562 if (Ty != Type::VoidTy)
3563 if (I->Attrs != NoAttributeSet)
3564 Attrs.addAttributes(index, I->Attrs);
3566 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3567 if (isVarArg) Params.pop_back();
3569 ParamAttrsList *ActualAttrs = 0;
3571 ActualAttrs = new ParamAttrsList(Attrs);
3573 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, ActualAttrs);
3574 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3575 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3581 #line 1351 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3582 { // Sized array type?
3583 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3584 delete (yyvsp[-1].TypeVal);
3590 #line 1356 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3592 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3593 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3594 GEN_ERROR("Unsigned result not equal to signed result");
3595 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3596 GEN_ERROR("Element type of a VectorType must be primitive");
3597 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3598 GEN_ERROR("Vector length should be a power of 2");
3599 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3600 delete (yyvsp[-1].TypeVal);
3606 #line 1368 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3607 { // Structure type?
3608 std::vector<const Type*> Elements;
3609 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3610 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3611 Elements.push_back(*I);
3613 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3614 delete (yyvsp[-1].TypeList);
3620 #line 1378 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3621 { // Empty structure type?
3622 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3628 #line 1382 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3630 std::vector<const Type*> Elements;
3631 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3632 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3633 Elements.push_back(*I);
3635 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3636 delete (yyvsp[-2].TypeList);
3642 #line 1392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3643 { // Empty structure type?
3644 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3650 #line 1399 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3652 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3653 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3658 #line 1406 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3660 if (!UpRefs.empty())
3661 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3662 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3663 GEN_ERROR("LLVM functions cannot return aggregate types");
3664 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3669 #line 1413 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3671 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3676 #line 1418 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3678 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3679 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3685 #line 1423 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3687 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3693 #line 1431 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3695 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3696 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
3697 TWA.Ty = new PATypeHolder(Type::VoidTy);
3698 (yyval.TypeWithAttrsList)->push_back(TWA);
3704 #line 1438 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3706 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3707 TypeWithAttrs TWA; TWA.Attrs = NoAttributeSet;
3708 TWA.Ty = new PATypeHolder(Type::VoidTy);
3709 (yyval.TypeWithAttrsList)->push_back(TWA);
3715 #line 1445 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3717 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3723 #line 1453 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3725 (yyval.TypeList) = new std::list<PATypeHolder>();
3726 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal));
3727 delete (yyvsp[0].TypeVal);
3733 #line 1459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3735 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal));
3736 delete (yyvsp[0].TypeVal);
3742 #line 1471 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3743 { // Nonempty unsized arr
3744 if (!UpRefs.empty())
3745 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3746 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3748 GEN_ERROR("Cannot make array constant with type: '" +
3749 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3750 const Type *ETy = ATy->getElementType();
3751 int NumElements = ATy->getNumElements();
3753 // Verify that we have the correct size...
3754 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3755 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3756 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3757 itostr(NumElements) + "");
3759 // Verify all elements are correct type!
3760 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3761 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3762 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3763 ETy->getDescription() +"' as required!\nIt is of type '"+
3764 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3767 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3768 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3774 #line 1499 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3776 if (!UpRefs.empty())
3777 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3778 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3780 GEN_ERROR("Cannot make array constant with type: '" +
3781 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3783 int NumElements = ATy->getNumElements();
3784 if (NumElements != -1 && NumElements != 0)
3785 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3786 " arguments, but has size of " + itostr(NumElements) +"");
3787 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3788 delete (yyvsp[-2].TypeVal);
3794 #line 1515 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3796 if (!UpRefs.empty())
3797 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3798 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3800 GEN_ERROR("Cannot make array constant with type: '" +
3801 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3803 int NumElements = ATy->getNumElements();
3804 const Type *ETy = ATy->getElementType();
3805 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3806 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3807 GEN_ERROR("Can't build string constant of size " +
3808 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3809 " when array has size " + itostr(NumElements) + "");
3810 std::vector<Constant*> Vals;
3811 if (ETy == Type::Int8Ty) {
3812 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3813 C != (unsigned char*)EndStr; ++C)
3814 Vals.push_back(ConstantInt::get(ETy, *C));
3816 free((yyvsp[0].StrVal));
3817 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3819 free((yyvsp[0].StrVal));
3820 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3821 delete (yyvsp[-2].TypeVal);
3827 #line 1544 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3828 { // Nonempty unsized arr
3829 if (!UpRefs.empty())
3830 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3831 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3833 GEN_ERROR("Cannot make packed constant with type: '" +
3834 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3835 const Type *ETy = PTy->getElementType();
3836 int NumElements = PTy->getNumElements();
3838 // Verify that we have the correct size...
3839 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3840 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3841 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3842 itostr(NumElements) + "");
3844 // Verify all elements are correct type!
3845 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3846 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3847 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3848 ETy->getDescription() +"' as required!\nIt is of type '"+
3849 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3852 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3853 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3859 #line 1572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3861 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3863 GEN_ERROR("Cannot make struct constant with type: '" +
3864 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3866 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3867 GEN_ERROR("Illegal number of initializers for structure type");
3869 // Check to ensure that constants are compatible with the type initializer!
3870 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3871 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3872 GEN_ERROR("Expected type '" +
3873 STy->getElementType(i)->getDescription() +
3874 "' for element #" + utostr(i) +
3875 " of structure initializer");
3877 // Check to ensure that Type is not packed
3878 if (STy->isPacked())
3879 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3881 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3882 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3888 #line 1597 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3890 if (!UpRefs.empty())
3891 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3892 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3894 GEN_ERROR("Cannot make struct constant with type: '" +
3895 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3897 if (STy->getNumContainedTypes() != 0)
3898 GEN_ERROR("Illegal number of initializers for structure type");
3900 // Check to ensure that Type is not packed
3901 if (STy->isPacked())
3902 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3904 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3905 delete (yyvsp[-2].TypeVal);
3911 #line 1616 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3913 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3915 GEN_ERROR("Cannot make struct constant with type: '" +
3916 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3918 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3919 GEN_ERROR("Illegal number of initializers for structure type");
3921 // Check to ensure that constants are compatible with the type initializer!
3922 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3923 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3924 GEN_ERROR("Expected type '" +
3925 STy->getElementType(i)->getDescription() +
3926 "' for element #" + utostr(i) +
3927 " of structure initializer");
3929 // Check to ensure that Type is packed
3930 if (!STy->isPacked())
3931 GEN_ERROR("Vector initializer to non-vector type '" +
3932 STy->getDescription() + "'");
3934 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3935 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3941 #line 1642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3943 if (!UpRefs.empty())
3944 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3945 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3947 GEN_ERROR("Cannot make struct constant with type: '" +
3948 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3950 if (STy->getNumContainedTypes() != 0)
3951 GEN_ERROR("Illegal number of initializers for structure type");
3953 // Check to ensure that Type is packed
3954 if (!STy->isPacked())
3955 GEN_ERROR("Vector initializer to non-vector type '" +
3956 STy->getDescription() + "'");
3958 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3959 delete (yyvsp[-4].TypeVal);
3965 #line 1662 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3967 if (!UpRefs.empty())
3968 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3969 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3971 GEN_ERROR("Cannot make null pointer constant with type: '" +
3972 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3974 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3975 delete (yyvsp[-1].TypeVal);
3981 #line 1674 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3983 if (!UpRefs.empty())
3984 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3985 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3986 delete (yyvsp[-1].TypeVal);
3992 #line 1681 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3994 if (!UpRefs.empty())
3995 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3996 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3998 GEN_ERROR("Global const reference must be a pointer type");
4000 // ConstExprs can exist in the body of a function, thus creating
4001 // GlobalValues whenever they refer to a variable. Because we are in
4002 // the context of a function, getExistingVal will search the functions
4003 // symbol table instead of the module symbol table for the global symbol,
4004 // which throws things all off. To get around this, we just tell
4005 // getExistingVal that we are at global scope here.
4007 Function *SavedCurFn = CurFun.CurrentFunction;
4008 CurFun.CurrentFunction = 0;
4010 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
4013 CurFun.CurrentFunction = SavedCurFn;
4015 // If this is an initializer for a constant pointer, which is referencing a
4016 // (currently) undefined variable, create a stub now that shall be replaced
4017 // in the future with the right type of variable.
4020 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4021 const PointerType *PT = cast<PointerType>(Ty);
4023 // First check to see if the forward references value is already created!
4024 PerModuleInfo::GlobalRefsType::iterator I =
4025 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
4027 if (I != CurModule.GlobalRefs.end()) {
4028 V = I->second; // Placeholder already exists, use it...
4029 (yyvsp[0].ValIDVal).destroy();
4032 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4033 Name = (yyvsp[0].ValIDVal).Name;
4034 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4035 GEN_ERROR("Invalid reference to global");
4037 // Create the forward referenced global.
4039 if (const FunctionType *FTy =
4040 dyn_cast<FunctionType>(PT->getElementType())) {
4041 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
4042 CurModule.CurrentModule);
4044 GV = new GlobalVariable(PT->getElementType(), false,
4045 GlobalValue::ExternalLinkage, 0,
4046 Name, CurModule.CurrentModule);
4049 // Keep track of the fact that we have a forward ref to recycle it
4050 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4055 (yyval.ConstVal) = cast<GlobalValue>(V);
4056 delete (yyvsp[-1].TypeVal); // Free the type handle
4062 #line 1747 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4064 if (!UpRefs.empty())
4065 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4066 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4067 GEN_ERROR("Mismatched types for constant expression: " +
4068 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4069 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4070 delete (yyvsp[-1].TypeVal);
4076 #line 1757 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4078 if (!UpRefs.empty())
4079 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4080 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4081 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4082 GEN_ERROR("Cannot create a null initialized value of this type");
4083 (yyval.ConstVal) = Constant::getNullValue(Ty);
4084 delete (yyvsp[-1].TypeVal);
4090 #line 1767 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4091 { // integral constants
4092 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4093 GEN_ERROR("Constant value doesn't fit in type");
4094 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4100 #line 1773 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4101 { // arbitrary precision integer constants
4102 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4103 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4104 GEN_ERROR("Constant value does not fit in type");
4106 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4107 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4108 delete (yyvsp[0].APIntVal);
4114 #line 1783 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4115 { // integral constants
4116 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4117 GEN_ERROR("Constant value doesn't fit in type");
4118 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4124 #line 1789 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4125 { // arbitrary precision integer constants
4126 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4127 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4128 GEN_ERROR("Constant value does not fit in type");
4130 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4131 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4132 delete (yyvsp[0].APIntVal);
4138 #line 1799 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4139 { // Boolean constants
4140 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4141 (yyval.ConstVal) = ConstantInt::getTrue();
4147 #line 1804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4148 { // Boolean constants
4149 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4150 (yyval.ConstVal) = ConstantInt::getFalse();
4156 #line 1809 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4157 { // Float & Double constants
4158 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4159 GEN_ERROR("Floating point constant invalid for type");
4160 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4166 #line 1817 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4168 if (!UpRefs.empty())
4169 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4170 Constant *Val = (yyvsp[-3].ConstVal);
4171 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4172 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4173 GEN_ERROR("invalid cast opcode for cast from '" +
4174 Val->getType()->getDescription() + "' to '" +
4175 DestTy->getDescription() + "'");
4176 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4177 delete (yyvsp[-1].TypeVal);
4182 #line 1829 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4184 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4185 GEN_ERROR("GetElementPtr requires a pointer operand");
4188 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4191 GEN_ERROR("Index list invalid for constant getelementptr");
4193 SmallVector<Constant*, 8> IdxVec;
4194 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4195 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4196 IdxVec.push_back(C);
4198 GEN_ERROR("Indices to constant getelementptr must be constants");
4200 delete (yyvsp[-1].ValueList);
4202 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4208 #line 1851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4210 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4211 GEN_ERROR("Select condition must be of boolean type");
4212 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4213 GEN_ERROR("Select operand types must match");
4214 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4220 #line 1859 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4222 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4223 GEN_ERROR("Binary operator types must match");
4225 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4230 #line 1865 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4232 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4233 GEN_ERROR("Logical operator types must match");
4234 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4235 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4236 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4237 GEN_ERROR("Logical operator requires integral operands");
4239 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4245 #line 1876 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4247 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4248 GEN_ERROR("icmp operand types must match");
4249 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4254 #line 1881 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4256 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4257 GEN_ERROR("fcmp operand types must match");
4258 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4263 #line 1886 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4265 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4266 GEN_ERROR("Invalid extractelement operands");
4267 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4273 #line 1892 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4275 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4276 GEN_ERROR("Invalid insertelement operands");
4277 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4283 #line 1898 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4285 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4286 GEN_ERROR("Invalid shufflevector operands");
4287 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4293 #line 1907 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4295 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4301 #line 1911 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4303 (yyval.ConstVector) = new std::vector<Constant*>();
4304 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4310 #line 1919 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4311 { (yyval.BoolVal) = false; ;}
4315 #line 1919 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4316 { (yyval.BoolVal) = true; ;}
4320 #line 1930 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4322 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4323 CurModule.ModuleDone();
4329 #line 1935 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4331 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4332 CurModule.ModuleDone();
4338 #line 1948 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4339 { CurFun.isDeclare = false; ;}
4343 #line 1948 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4345 CurFun.FunctionDone();
4351 #line 1952 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4352 { CurFun.isDeclare = true; ;}
4356 #line 1952 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4363 #line 1955 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4370 #line 1958 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4372 if (!UpRefs.empty())
4373 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4374 // Eagerly resolve types. This is not an optimization, this is a
4375 // requirement that is due to the fact that we could have this:
4377 // %list = type { %list * }
4378 // %list = type { %list * } ; repeated type decl
4380 // If types are not resolved eagerly, then the two types will not be
4381 // determined to be the same type!
4383 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4385 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4387 // If this is a named type that is not a redefinition, add it to the slot
4389 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4392 delete (yyvsp[0].TypeVal);
4398 #line 1982 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4400 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4402 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4404 // If this is a named type that is not a redefinition, add it to the slot
4406 CurModule.Types.push_back((yyvsp[0].PrimType));
4413 #line 1993 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4415 /* "Externally Visible" Linkage */
4416 if ((yyvsp[0].ConstVal) == 0)
4417 GEN_ERROR("Global value initializer is not a constant");
4418 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4419 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4425 #line 2000 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4432 #line 2003 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4434 if ((yyvsp[0].ConstVal) == 0)
4435 GEN_ERROR("Global value initializer is not a constant");
4436 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4442 #line 2008 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4449 #line 2011 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4451 if (!UpRefs.empty())
4452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4453 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4455 delete (yyvsp[0].TypeVal);
4460 #line 2017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4468 #line 2021 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4475 #line 2024 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4482 #line 2030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4484 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4485 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4486 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4487 free((yyvsp[0].StrVal));
4489 if (AsmSoFar.empty())
4490 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4492 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4498 #line 2043 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4500 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4501 free((yyvsp[0].StrVal));
4506 #line 2047 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4508 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4509 free((yyvsp[0].StrVal));
4514 #line 2054 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4516 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4517 free((yyvsp[0].StrVal));
4523 #line 2059 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4525 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4526 free((yyvsp[0].StrVal));
4532 #line 2064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4539 #line 2073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4541 if (!UpRefs.empty())
4542 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4543 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4544 GEN_ERROR("void typed arguments are invalid");
4545 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4546 (yyval.ArgList) = (yyvsp[-4].ArgList);
4547 (yyvsp[-4].ArgList)->push_back(E);
4553 #line 2083 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4555 if (!UpRefs.empty())
4556 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4557 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4558 GEN_ERROR("void typed arguments are invalid");
4559 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4560 (yyval.ArgList) = new ArgListType;
4561 (yyval.ArgList)->push_back(E);
4567 #line 2094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4569 (yyval.ArgList) = (yyvsp[0].ArgList);
4575 #line 2098 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4577 (yyval.ArgList) = (yyvsp[-2].ArgList);
4578 struct ArgListEntry E;
4579 E.Ty = new PATypeHolder(Type::VoidTy);
4581 E.Attrs = NoAttributeSet;
4582 (yyval.ArgList)->push_back(E);
4588 #line 2107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4590 (yyval.ArgList) = new ArgListType;
4591 struct ArgListEntry E;
4592 E.Ty = new PATypeHolder(Type::VoidTy);
4594 E.Attrs = NoAttributeSet;
4595 (yyval.ArgList)->push_back(E);
4601 #line 2116 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4603 (yyval.ArgList) = 0;
4609 #line 2122 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4611 UnEscapeLexed((yyvsp[-6].StrVal));
4612 std::string FunctionName((yyvsp[-6].StrVal));
4613 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4615 // Check the function result for abstractness if this is a define. We should
4616 // have no abstract types at this point
4617 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4618 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4620 std::vector<const Type*> ParamTypeList;
4621 ParamAttrsList ParamAttrs;
4622 if ((yyvsp[-2].ParamAttrs) != NoAttributeSet)
4623 ParamAttrs.addAttributes(0, (yyvsp[-2].ParamAttrs));
4624 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4626 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++index) {
4627 const Type* Ty = I->Ty->get();
4628 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4629 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4630 ParamTypeList.push_back(Ty);
4631 if (Ty != Type::VoidTy)
4632 if (I->Attrs != NoAttributeSet)
4633 ParamAttrs.addAttributes(index, I->Attrs);
4637 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4638 if (isVarArg) ParamTypeList.pop_back();
4640 ParamAttrsList *ActualAttrs = 0;
4641 if (!ParamAttrs.empty())
4642 ActualAttrs = new ParamAttrsList(ParamAttrs);
4644 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4646 const PointerType *PFT = PointerType::get(FT);
4647 delete (yyvsp[-7].TypeVal);
4650 if (!FunctionName.empty()) {
4651 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4653 ID = ValID::createGlobalID(CurModule.Values.size());
4657 // See if this function was forward referenced. If so, recycle the object.
4658 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4659 // Move the function to the end of the list, from whereever it was
4660 // previously inserted.
4661 Fn = cast<Function>(FWRef);
4662 CurModule.CurrentModule->getFunctionList().remove(Fn);
4663 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4664 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4665 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4666 if (Fn->getFunctionType() != FT ) {
4667 // The existing function doesn't have the same type. This is an overload
4669 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4670 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4671 // Neither the existing or the current function is a declaration and they
4672 // have the same name and same type. Clearly this is a redefinition.
4673 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4674 } if (Fn->isDeclaration()) {
4675 // Make sure to strip off any argument names so we can't get conflicts.
4676 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4680 } else { // Not already defined?
4681 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4682 CurModule.CurrentModule);
4684 InsertValue(Fn, CurModule.Values);
4687 CurFun.FunctionStart(Fn);
4689 if (CurFun.isDeclare) {
4690 // If we have declaration, always overwrite linkage. This will allow us to
4691 // correctly handle cases, when pointer to function is passed as argument to
4692 // another function.
4693 Fn->setLinkage(CurFun.Linkage);
4694 Fn->setVisibility(CurFun.Visibility);
4696 Fn->setCallingConv((yyvsp[-8].UIntVal));
4697 Fn->setAlignment((yyvsp[0].UIntVal));
4698 if ((yyvsp[-1].StrVal)) {
4699 Fn->setSection((yyvsp[-1].StrVal));
4700 free((yyvsp[-1].StrVal));
4703 // Add all of the arguments we parsed to the function...
4704 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4705 if (isVarArg) { // Nuke the last entry
4706 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4707 "Not a varargs marker!");
4708 delete (yyvsp[-4].ArgList)->back().Ty;
4709 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4711 Function::arg_iterator ArgIt = Fn->arg_begin();
4712 Function::arg_iterator ArgEnd = Fn->arg_end();
4714 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4715 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4716 delete I->Ty; // Delete the typeholder...
4717 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4723 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4730 #line 2242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4732 (yyval.FunctionVal) = CurFun.CurrentFunction;
4734 // Make sure that we keep track of the linkage type even if there was a
4735 // previous "declare".
4736 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4737 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4742 #line 2253 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4744 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4750 #line 2258 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4752 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4753 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4754 (yyval.FunctionVal) = CurFun.CurrentFunction;
4755 CurFun.FunctionDone();
4761 #line 2270 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4763 (yyval.BoolVal) = false;
4769 #line 2274 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4771 (yyval.BoolVal) = true;
4777 #line 2279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4778 { // A reference to a direct constant
4779 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4785 #line 2283 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4787 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4793 #line 2287 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4794 { // Perhaps it's an FP constant?
4795 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4801 #line 2291 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4803 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4809 #line 2295 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4811 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4817 #line 2299 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4819 (yyval.ValIDVal) = ValID::createNull();
4825 #line 2303 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4827 (yyval.ValIDVal) = ValID::createUndef();
4833 #line 2307 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4834 { // A vector zero constant.
4835 (yyval.ValIDVal) = ValID::createZeroInit();
4841 #line 2311 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4842 { // Nonempty unsized packed vector
4843 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4844 int NumElements = (yyvsp[-1].ConstVector)->size();
4846 VectorType* pt = VectorType::get(ETy, NumElements);
4847 PATypeHolder* PTy = new PATypeHolder(
4855 // Verify all elements are correct type!
4856 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4857 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4858 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4859 ETy->getDescription() +"' as required!\nIt is of type '" +
4860 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4863 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
4864 delete PTy; delete (yyvsp[-1].ConstVector);
4870 #line 2336 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4872 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4878 #line 2340 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4880 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4881 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4882 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4883 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4884 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4885 free((yyvsp[-2].StrVal));
4886 free((yyvsp[0].StrVal));
4892 #line 2354 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4893 { // Is it an integer reference...?
4894 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4900 #line 2358 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4902 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4908 #line 2362 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4909 { // Is it a named reference...?
4910 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4916 #line 2366 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4917 { // Is it a named reference...?
4918 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4924 #line 2378 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4926 if (!UpRefs.empty())
4927 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4928 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4929 delete (yyvsp[-1].TypeVal);
4935 #line 2387 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4937 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4943 #line 2391 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4944 { // Do not allow functions with 0 basic blocks
4945 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4951 #line 2400 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4953 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4955 InsertValue((yyvsp[0].TermInstVal));
4956 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4957 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4963 #line 2409 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4965 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4966 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4967 if (CI2->getParent() == 0)
4968 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4969 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4970 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4976 #line 2418 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4977 { // Empty space between instruction lists
4978 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4984 #line 2422 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4985 { // Labelled (named) basic block
4986 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal)));
4992 #line 2427 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4993 { // Return with a result...
4994 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
5000 #line 2431 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5001 { // Return with no result...
5002 (yyval.TermInstVal) = new ReturnInst();
5008 #line 2435 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5009 { // Unconditional Branch...
5010 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5012 (yyval.TermInstVal) = new BranchInst(tmpBB);
5017 #line 2440 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5019 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
5020 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
5022 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5024 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5026 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5031 #line 2450 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5033 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5035 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5037 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5038 (yyval.TermInstVal) = S;
5040 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5041 E = (yyvsp[-1].JumpTable)->end();
5042 for (; I != E; ++I) {
5043 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5044 S->addCase(CI, I->second);
5046 GEN_ERROR("Switch case is constant, but not a simple integer");
5048 delete (yyvsp[-1].JumpTable);
5054 #line 2469 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5056 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5058 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5060 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5061 (yyval.TermInstVal) = S;
5067 #line 2479 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5070 // Handle the short syntax
5071 const PointerType *PFTy = 0;
5072 const FunctionType *Ty = 0;
5073 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5074 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5075 // Pull out the types of all of the arguments...
5076 std::vector<const Type*> ParamTypes;
5077 ParamAttrsList ParamAttrs;
5078 if ((yyvsp[-6].ParamAttrs) != NoAttributeSet)
5079 ParamAttrs.addAttributes(0, (yyvsp[-6].ParamAttrs));
5080 ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end();
5082 for (; I != E; ++I, ++index) {
5083 const Type *Ty = I->Val->getType();
5084 if (Ty == Type::VoidTy)
5085 GEN_ERROR("Short call syntax cannot be used with varargs");
5086 ParamTypes.push_back(Ty);
5087 if (I->Attrs != NoAttributeSet)
5088 ParamAttrs.addAttributes(index, I->Attrs);
5091 ParamAttrsList *Attrs = 0;
5092 if (!ParamAttrs.empty())
5093 Attrs = new ParamAttrsList(ParamAttrs);
5094 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, Attrs);
5095 PFTy = PointerType::get(Ty);
5098 delete (yyvsp[-11].TypeVal);
5100 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5102 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5104 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5107 // Check the arguments
5109 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5110 // Make sure no arguments is a good thing!
5111 if (Ty->getNumParams() != 0)
5112 GEN_ERROR("No arguments passed to a function that "
5113 "expects arguments");
5114 } else { // Has arguments?
5115 // Loop through FunctionType's arguments and ensure they are specified
5117 FunctionType::param_iterator I = Ty->param_begin();
5118 FunctionType::param_iterator E = Ty->param_end();
5119 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5121 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5122 if (ArgI->Val->getType() != *I)
5123 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5124 (*I)->getDescription() + "'");
5125 Args.push_back(ArgI->Val);
5128 if (Ty->isVarArg()) {
5130 for (; ArgI != ArgE; ++ArgI)
5131 Args.push_back(ArgI->Val); // push the remaining varargs
5132 } else if (I != E || ArgI != ArgE)
5133 GEN_ERROR("Invalid number of parameters detected");
5136 // Create the InvokeInst
5137 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5138 II->setCallingConv((yyvsp[-12].UIntVal));
5139 (yyval.TermInstVal) = II;
5140 delete (yyvsp[-8].ValueRefList);
5146 #line 2554 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5148 (yyval.TermInstVal) = new UnwindInst();
5154 #line 2558 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5156 (yyval.TermInstVal) = new UnreachableInst();
5162 #line 2565 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5164 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5165 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5168 GEN_ERROR("May only switch on a constant pool value");
5170 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5172 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5177 #line 2576 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5179 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5180 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5184 GEN_ERROR("May only switch on a constant pool value");
5186 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5188 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5193 #line 2589 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5195 // Is this definition named?? if so, assign the name...
5196 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5198 InsertValue((yyvsp[0].InstVal));
5199 (yyval.InstVal) = (yyvsp[0].InstVal);
5205 #line 2599 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5206 { // Used for PHI nodes
5207 if (!UpRefs.empty())
5208 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5209 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5210 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5212 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5214 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5215 delete (yyvsp[-5].TypeVal);
5220 #line 2610 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5222 (yyval.PHIList) = (yyvsp[-6].PHIList);
5223 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5225 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5227 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5232 #line 2620 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5234 if (!UpRefs.empty())
5235 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5236 // Used for call and invoke instructions
5237 (yyval.ValueRefList) = new ValueRefList();
5238 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5239 (yyval.ValueRefList)->push_back(E);
5240 delete (yyvsp[-2].TypeVal);
5245 #line 2629 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5247 if (!UpRefs.empty())
5248 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5249 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5250 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5251 (yyval.ValueRefList)->push_back(E);
5252 delete (yyvsp[-2].TypeVal);
5258 #line 2638 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5259 { (yyval.ValueRefList) = new ValueRefList(); ;}
5263 #line 2641 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5264 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5268 #line 2642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5270 (yyval.ValueList) = (yyvsp[-2].ValueList);
5271 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5277 #line 2649 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5279 (yyval.BoolVal) = true;
5285 #line 2653 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5287 (yyval.BoolVal) = false;
5293 #line 2658 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5295 if (!UpRefs.empty())
5296 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5297 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5298 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5300 "Arithmetic operator requires integer, FP, or packed operands");
5301 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5302 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5303 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5304 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5305 GEN_ERROR("Remainder not supported on vector types");
5306 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5308 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5310 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5311 if ((yyval.InstVal) == 0)
5312 GEN_ERROR("binary operator returned null");
5313 delete (yyvsp[-3].TypeVal);
5318 #line 2679 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5320 if (!UpRefs.empty())
5321 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5322 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5323 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5324 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5325 GEN_ERROR("Logical operator requires integral operands");
5327 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5329 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5331 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5332 if ((yyval.InstVal) == 0)
5333 GEN_ERROR("binary operator returned null");
5334 delete (yyvsp[-3].TypeVal);
5339 #line 2696 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5341 if (!UpRefs.empty())
5342 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5343 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5344 GEN_ERROR("Vector types not supported by icmp instruction");
5345 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5347 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5349 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5350 if ((yyval.InstVal) == 0)
5351 GEN_ERROR("icmp operator returned null");
5352 delete (yyvsp[-3].TypeVal);
5357 #line 2710 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5359 if (!UpRefs.empty())
5360 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5361 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5362 GEN_ERROR("Vector types not supported by fcmp instruction");
5363 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5365 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5367 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5368 if ((yyval.InstVal) == 0)
5369 GEN_ERROR("fcmp operator returned null");
5370 delete (yyvsp[-3].TypeVal);
5375 #line 2724 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5377 if (!UpRefs.empty())
5378 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5379 Value* Val = (yyvsp[-2].ValueVal);
5380 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5381 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5382 GEN_ERROR("invalid cast opcode for cast from '" +
5383 Val->getType()->getDescription() + "' to '" +
5384 DestTy->getDescription() + "'");
5385 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5386 delete (yyvsp[0].TypeVal);
5391 #line 2736 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5393 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5394 GEN_ERROR("select condition must be boolean");
5395 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5396 GEN_ERROR("select value types should match");
5397 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5403 #line 2744 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5405 if (!UpRefs.empty())
5406 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5407 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5408 delete (yyvsp[0].TypeVal);
5414 #line 2751 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5416 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5417 GEN_ERROR("Invalid extractelement operands");
5418 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5424 #line 2757 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5426 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5427 GEN_ERROR("Invalid insertelement operands");
5428 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5434 #line 2763 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5436 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5437 GEN_ERROR("Invalid shufflevector operands");
5438 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5444 #line 2769 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5446 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5447 if (!Ty->isFirstClassType())
5448 GEN_ERROR("PHI node operands must be of first class type");
5449 (yyval.InstVal) = new PHINode(Ty);
5450 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5451 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5452 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5453 GEN_ERROR("All elements of a PHI node must be of the same type");
5454 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5455 (yyvsp[0].PHIList)->pop_front();
5457 delete (yyvsp[0].PHIList); // Free the list...
5463 #line 2785 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5466 // Handle the short syntax
5467 const PointerType *PFTy = 0;
5468 const FunctionType *Ty = 0;
5469 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5470 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5471 // Pull out the types of all of the arguments...
5472 std::vector<const Type*> ParamTypes;
5473 ParamAttrsList ParamAttrs;
5474 if ((yyvsp[0].ParamAttrs) != NoAttributeSet)
5475 ParamAttrs.addAttributes(0, (yyvsp[0].ParamAttrs));
5477 ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end();
5478 for (; I != E; ++I, ++index) {
5479 const Type *Ty = I->Val->getType();
5480 if (Ty == Type::VoidTy)
5481 GEN_ERROR("Short call syntax cannot be used with varargs");
5482 ParamTypes.push_back(Ty);
5483 if (I->Attrs != NoAttributeSet)
5484 ParamAttrs.addAttributes(index, I->Attrs);
5487 ParamAttrsList *Attrs = 0;
5488 if (!ParamAttrs.empty())
5489 Attrs = new ParamAttrsList(ParamAttrs);
5491 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, Attrs);
5492 PFTy = PointerType::get(Ty);
5495 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5498 // Check the arguments
5500 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5501 // Make sure no arguments is a good thing!
5502 if (Ty->getNumParams() != 0)
5503 GEN_ERROR("No arguments passed to a function that "
5504 "expects arguments");
5505 } else { // Has arguments?
5506 // Loop through FunctionType's arguments and ensure they are specified
5509 FunctionType::param_iterator I = Ty->param_begin();
5510 FunctionType::param_iterator E = Ty->param_end();
5511 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5513 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5514 if (ArgI->Val->getType() != *I)
5515 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5516 (*I)->getDescription() + "'");
5517 Args.push_back(ArgI->Val);
5519 if (Ty->isVarArg()) {
5521 for (; ArgI != ArgE; ++ArgI)
5522 Args.push_back(ArgI->Val); // push the remaining varargs
5523 } else if (I != E || ArgI != ArgE)
5524 GEN_ERROR("Invalid number of parameters detected");
5526 // Create the call node
5527 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5528 CI->setTailCall((yyvsp[-7].BoolVal));
5529 CI->setCallingConv((yyvsp[-6].UIntVal));
5530 (yyval.InstVal) = CI;
5531 delete (yyvsp[-2].ValueRefList);
5532 delete (yyvsp[-5].TypeVal);
5538 #line 2856 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5540 (yyval.InstVal) = (yyvsp[0].InstVal);
5546 #line 2861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5548 (yyval.BoolVal) = true;
5554 #line 2865 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5556 (yyval.BoolVal) = false;
5562 #line 2872 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5564 if (!UpRefs.empty())
5565 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5566 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5567 delete (yyvsp[-1].TypeVal);
5573 #line 2879 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5575 if (!UpRefs.empty())
5576 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5577 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5579 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5580 delete (yyvsp[-4].TypeVal);
5585 #line 2887 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5587 if (!UpRefs.empty())
5588 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5589 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5590 delete (yyvsp[-1].TypeVal);
5596 #line 2894 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5598 if (!UpRefs.empty())
5599 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5600 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5602 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5603 delete (yyvsp[-4].TypeVal);
5608 #line 2902 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5610 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5611 GEN_ERROR("Trying to free nonpointer type " +
5612 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5613 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5619 #line 2910 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5621 if (!UpRefs.empty())
5622 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5623 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5624 GEN_ERROR("Can't load from nonpointer type: " +
5625 (*(yyvsp[-1].TypeVal))->getDescription());
5626 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5627 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5628 (*(yyvsp[-1].TypeVal))->getDescription());
5629 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5631 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5632 delete (yyvsp[-1].TypeVal);
5637 #line 2924 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5639 if (!UpRefs.empty())
5640 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5641 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5643 GEN_ERROR("Can't store to a nonpointer type: " +
5644 (*(yyvsp[-1].TypeVal))->getDescription());
5645 const Type *ElTy = PT->getElementType();
5646 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5647 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5648 "' into space of type '" + ElTy->getDescription() + "'");
5650 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5652 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5653 delete (yyvsp[-1].TypeVal);
5658 #line 2941 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5660 if (!UpRefs.empty())
5661 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5662 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5663 GEN_ERROR("getelementptr insn requires pointer operand");
5665 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5666 GEN_ERROR("Invalid getelementptr indices for type '" +
5667 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5668 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5670 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5671 delete (yyvsp[-2].TypeVal);
5672 delete (yyvsp[0].ValueList);
5680 /* Line 1126 of yacc.c. */
5681 #line 5682 "llvmAsmParser.tab.c"
5687 YY_STACK_PRINT (yyss, yyssp);
5692 /* Now `shift' the result of the reduction. Determine what state
5693 that goes to, based on the state we popped back to and the rule
5694 number reduced by. */
5698 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5699 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5700 yystate = yytable[yystate];
5702 yystate = yydefgoto[yyn - YYNTOKENS];
5707 /*------------------------------------.
5708 | yyerrlab -- here on detecting error |
5709 `------------------------------------*/
5711 /* If not already recovering from an error, report this error. */
5716 yyn = yypact[yystate];
5718 if (YYPACT_NINF < yyn && yyn < YYLAST)
5720 int yytype = YYTRANSLATE (yychar);
5721 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5722 YYSIZE_T yysize = yysize0;
5724 int yysize_overflow = 0;
5726 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5727 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5731 /* This is so xgettext sees the translatable formats that are
5732 constructed on the fly. */
5733 YY_("syntax error, unexpected %s");
5734 YY_("syntax error, unexpected %s, expecting %s");
5735 YY_("syntax error, unexpected %s, expecting %s or %s");
5736 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5737 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5741 static char const yyunexpected[] = "syntax error, unexpected %s";
5742 static char const yyexpecting[] = ", expecting %s";
5743 static char const yyor[] = " or %s";
5744 char yyformat[sizeof yyunexpected
5745 + sizeof yyexpecting - 1
5746 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5747 * (sizeof yyor - 1))];
5748 char const *yyprefix = yyexpecting;
5750 /* Start YYX at -YYN if negative to avoid negative indexes in
5752 int yyxbegin = yyn < 0 ? -yyn : 0;
5754 /* Stay within bounds of both yycheck and yytname. */
5755 int yychecklim = YYLAST - yyn;
5756 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5759 yyarg[0] = yytname[yytype];
5760 yyfmt = yystpcpy (yyformat, yyunexpected);
5762 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5763 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5765 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5769 yyformat[sizeof yyunexpected - 1] = '\0';
5772 yyarg[yycount++] = yytname[yyx];
5773 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5774 yysize_overflow |= yysize1 < yysize;
5776 yyfmt = yystpcpy (yyfmt, yyprefix);
5780 yyf = YY_(yyformat);
5781 yysize1 = yysize + yystrlen (yyf);
5782 yysize_overflow |= yysize1 < yysize;
5785 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5786 yymsg = (char *) YYSTACK_ALLOC (yysize);
5789 /* Avoid sprintf, as that infringes on the user's name space.
5790 Don't have undefined behavior even if the translation
5791 produced a string with the wrong number of "%s"s. */
5794 while ((*yyp = *yyf))
5796 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5798 yyp += yytnamerr (yyp, yyarg[yyi++]);
5808 YYSTACK_FREE (yymsg);
5812 yyerror (YY_("syntax error"));
5813 goto yyexhaustedlab;
5817 #endif /* YYERROR_VERBOSE */
5818 yyerror (YY_("syntax error"));
5823 if (yyerrstatus == 3)
5825 /* If just tried and failed to reuse look-ahead token after an
5826 error, discard it. */
5828 if (yychar <= YYEOF)
5830 /* Return failure if at end of input. */
5831 if (yychar == YYEOF)
5836 yydestruct ("Error: discarding", yytoken, &yylval);
5841 /* Else will try to reuse look-ahead token after shifting the error
5846 /*---------------------------------------------------.
5847 | yyerrorlab -- error raised explicitly by YYERROR. |
5848 `---------------------------------------------------*/
5851 /* Pacify compilers like GCC when the user code never invokes
5852 YYERROR and the label yyerrorlab therefore never appears in user
5863 /*-------------------------------------------------------------.
5864 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5865 `-------------------------------------------------------------*/
5867 yyerrstatus = 3; /* Each real token shifted decrements this. */
5871 yyn = yypact[yystate];
5872 if (yyn != YYPACT_NINF)
5875 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5883 /* Pop the current state because it cannot handle the error token. */
5888 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5891 YY_STACK_PRINT (yyss, yyssp);
5900 /* Shift the error token. */
5901 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5907 /*-------------------------------------.
5908 | yyacceptlab -- YYACCEPT comes here. |
5909 `-------------------------------------*/
5914 /*-----------------------------------.
5915 | yyabortlab -- YYABORT comes here. |
5916 `-----------------------------------*/
5922 /*-------------------------------------------------.
5923 | yyexhaustedlab -- memory exhaustion comes here. |
5924 `-------------------------------------------------*/
5926 yyerror (YY_("memory exhausted"));
5932 if (yychar != YYEOF && yychar != YYEMPTY)
5933 yydestruct ("Cleanup: discarding lookahead",
5935 while (yyssp != yyss)
5937 yydestruct ("Cleanup: popping",
5938 yystos[*yyssp], yyvsp);
5943 YYSTACK_FREE (yyss);
5949 #line 2958 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5952 // common code from the two 'RunVMAsmParser' functions
5953 static Module* RunParser(Module * M) {
5955 llvmAsmlineno = 1; // Reset the current line number...
5956 CurModule.CurrentModule = M;
5961 // Check to make sure the parser succeeded
5964 delete ParserResult;
5968 // Emit an error if there are any unresolved types left.
5969 if (!CurModule.LateResolveTypes.empty()) {
5970 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5971 if (DID.Type == ValID::LocalName) {
5972 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5974 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5977 delete ParserResult;
5981 // Emit an error if there are any unresolved values left.
5982 if (!CurModule.LateResolveValues.empty()) {
5983 Value *V = CurModule.LateResolveValues.back();
5984 std::map<Value*, std::pair<ValID, int> >::iterator I =
5985 CurModule.PlaceHolderInfo.find(V);
5987 if (I != CurModule.PlaceHolderInfo.end()) {
5988 ValID &DID = I->second.first;
5989 if (DID.Type == ValID::LocalName) {
5990 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5992 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5995 delete ParserResult;
6000 // Check to make sure that parsing produced a result
6004 // Reset ParserResult variable while saving its value for the result.
6005 Module *Result = ParserResult;
6011 void llvm::GenerateError(const std::string &message, int LineNo) {
6012 if (LineNo == -1) LineNo = llvmAsmlineno;
6013 // TODO: column number in exception
6015 TheParseError->setError(CurFilename, message, LineNo);
6019 int yyerror(const char *ErrorMsg) {
6021 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6022 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6023 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6024 if (yychar != YYEMPTY && yychar != 0)
6025 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6027 GenerateError(errMsg);