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
86 ZEROINITIALIZER = 277,
129 X86_STDCALLCC_TOK = 320,
130 X86_FASTCALLCC_TOK = 321,
196 EXTRACTELEMENT = 387,
203 #define ESINT64VAL 258
204 #define EUINT64VAL 259
220 #define STRINGCONSTANT 275
221 #define IMPLEMENTATION 276
222 #define ZEROINITIALIZER 277
234 #define DOTDOTDOT 289
240 #define APPENDING 295
241 #define DLLIMPORT 296
242 #define DLLEXPORT 297
243 #define EXTERN_WEAK 298
250 #define POINTERSIZE 305
259 #define SIDEEFFECT 314
262 #define CSRETCC_TOK 317
263 #define FASTCC_TOK 318
264 #define COLDCC_TOK 319
265 #define X86_STDCALLCC_TOK 320
266 #define X86_FASTCALLCC_TOK 321
267 #define DATALAYOUT 322
273 #define UNREACHABLE 328
313 #define GETELEMENTPTR 368
332 #define EXTRACTELEMENT 387
333 #define INSERTELEMENT 388
334 #define SHUFFLEVECTOR 389
340 /* Copy the first part of user declarations. */
341 #line 14 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
343 #include "ParserInternals.h"
344 #include "llvm/CallingConv.h"
345 #include "llvm/InlineAsm.h"
346 #include "llvm/Instructions.h"
347 #include "llvm/Module.h"
348 #include "llvm/SymbolTable.h"
349 #include "llvm/Support/GetElementPtrTypeIterator.h"
350 #include "llvm/Support/CommandLine.h"
351 #include "llvm/ADT/STLExtras.h"
352 #include "llvm/Support/MathExtras.h"
353 #include "llvm/Support/Streams.h"
361 // The following is a gross hack. In order to rid the libAsmParser library of
362 // exceptions, we have to have a way of getting the yyparse function to go into
363 // an error situation. So, whenever we want an error to occur, the GenerateError
364 // function (see bottom of file) sets TriggerError. Then, at the end of each
365 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
366 // (a goto) to put YACC in error state. Furthermore, several calls to
367 // GenerateError are made from inside productions and they must simulate the
368 // previous exception behavior by exiting the production immediately. We have
369 // replaced these with the GEN_ERROR macro which calls GeneratError and then
370 // immediately invokes YYERROR. This would be so much cleaner if it was a
371 // recursive descent parser.
372 static bool TriggerError = false;
373 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
374 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
376 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
377 int yylex(); // declaration" of xxx warnings.
381 std::string CurFilename;
384 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
385 cl::Hidden, cl::init(false));
388 using namespace llvm;
390 static Module *ParserResult;
392 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
393 // relating to upreferences in the input stream.
395 //#define DEBUG_UPREFS 1
397 #define UR_OUT(X) cerr << X
402 #define YYERROR_VERBOSE 1
404 static GlobalVariable *CurGV;
407 // This contains info used when building the body of a function. It is
408 // destroyed when the function is completed.
410 typedef std::vector<Value *> ValueList; // Numbered defs
413 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
414 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
416 static struct PerModuleInfo {
417 Module *CurrentModule;
418 std::map<const Type *, ValueList> Values; // Module level numbered definitions
419 std::map<const Type *,ValueList> LateResolveValues;
420 std::vector<PATypeHolder> Types;
421 std::map<ValID, PATypeHolder> LateResolveTypes;
423 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
424 /// how they were referenced and on which line of the input they came from so
425 /// that we can resolve them later and print error messages as appropriate.
426 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
428 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
429 // references to global values. Global values may be referenced before they
430 // are defined, and if so, the temporary object that they represent is held
431 // here. This is used for forward references of GlobalValues.
433 typedef std::map<std::pair<const PointerType *,
434 ValID>, GlobalValue*> GlobalRefsType;
435 GlobalRefsType GlobalRefs;
438 // If we could not resolve some functions at function compilation time
439 // (calls to functions before they are defined), resolve them now... Types
440 // are resolved when the constant pool has been completely parsed.
442 ResolveDefinitions(LateResolveValues);
446 // Check to make sure that all global value forward references have been
449 if (!GlobalRefs.empty()) {
450 std::string UndefinedReferences = "Unresolved global references exist:\n";
452 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
454 UndefinedReferences += " " + I->first.first->getDescription() + " " +
455 I->first.second.getName() + "\n";
457 GenerateError(UndefinedReferences);
461 Values.clear(); // Clear out function local definitions
466 // GetForwardRefForGlobal - Check to see if there is a forward reference
467 // for this global. If so, remove it from the GlobalRefs map and return it.
468 // If not, just return null.
469 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
470 // Check to see if there is a forward reference to this global variable...
471 // if there is, eliminate it and patch the reference to use the new def'n.
472 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
473 GlobalValue *Ret = 0;
474 if (I != GlobalRefs.end()) {
481 bool TypeIsUnresolved(PATypeHolder* PATy) {
482 // If it isn't abstract, its resolved
483 const Type* Ty = PATy->get();
484 if (!Ty->isAbstract())
486 // Traverse the type looking for abstract types. If it isn't abstract then
487 // we don't need to traverse that leg of the type.
488 std::vector<const Type*> WorkList, SeenList;
489 WorkList.push_back(Ty);
490 while (!WorkList.empty()) {
491 const Type* Ty = WorkList.back();
492 SeenList.push_back(Ty);
494 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
495 // Check to see if this is an unresolved type
496 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
497 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
498 for ( ; I != E; ++I) {
499 if (I->second.get() == OpTy)
502 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
503 const Type* TheTy = SeqTy->getElementType();
504 if (TheTy->isAbstract() && TheTy != Ty) {
505 std::vector<const Type*>::iterator I = SeenList.begin(),
511 WorkList.push_back(TheTy);
513 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
514 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
515 const Type* TheTy = StrTy->getElementType(i);
516 if (TheTy->isAbstract() && TheTy != Ty) {
517 std::vector<const Type*>::iterator I = SeenList.begin(),
523 WorkList.push_back(TheTy);
534 static struct PerFunctionInfo {
535 Function *CurrentFunction; // Pointer to current function being created
537 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
538 std::map<const Type*, ValueList> LateResolveValues;
539 bool isDeclare; // Is this function a forward declararation?
540 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
542 /// BBForwardRefs - When we see forward references to basic blocks, keep
543 /// track of them here.
544 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
545 std::vector<BasicBlock*> NumberedBlocks;
548 inline PerFunctionInfo() {
551 Linkage = GlobalValue::ExternalLinkage;
554 inline void FunctionStart(Function *M) {
559 void FunctionDone() {
560 NumberedBlocks.clear();
562 // Any forward referenced blocks left?
563 if (!BBForwardRefs.empty()) {
564 GenerateError("Undefined reference to label " +
565 BBForwardRefs.begin()->first->getName());
569 // Resolve all forward references now.
570 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
572 Values.clear(); // Clear out function local definitions
575 Linkage = GlobalValue::ExternalLinkage;
577 } CurFun; // Info for the current function...
579 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
582 //===----------------------------------------------------------------------===//
583 // Code to handle definitions of all the types
584 //===----------------------------------------------------------------------===//
586 static int InsertValue(Value *V,
587 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
588 if (V->hasName()) return -1; // Is this a numbered definition?
590 // Yes, insert the value into the value table...
591 ValueList &List = ValueTab[V->getType()];
593 return List.size()-1;
596 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
598 case ValID::NumberVal: // Is it a numbered definition?
599 // Module constants occupy the lowest numbered slots...
600 if ((unsigned)D.Num < CurModule.Types.size())
601 return CurModule.Types[(unsigned)D.Num];
603 case ValID::NameVal: // Is it a named definition?
604 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
605 D.destroy(); // Free old strdup'd memory...
610 GenerateError("Internal parser error: Invalid symbol type reference!");
614 // If we reached here, we referenced either a symbol that we don't know about
615 // or an id number that hasn't been read yet. We may be referencing something
616 // forward, so just create an entry to be resolved later and get to it...
618 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
621 if (inFunctionScope()) {
622 if (D.Type == ValID::NameVal) {
623 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
626 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
631 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
632 if (I != CurModule.LateResolveTypes.end())
635 Type *Typ = OpaqueType::get();
636 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
640 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
641 SymbolTable &SymTab =
642 inFunctionScope() ? CurFun.CurrentFunction->getValueSymbolTable() :
643 CurModule.CurrentModule->getValueSymbolTable();
644 return SymTab.lookup(Ty, Name);
647 // getValNonImprovising - Look up the value specified by the provided type and
648 // the provided ValID. If the value exists and has already been defined, return
649 // it. Otherwise return null.
651 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
652 if (isa<FunctionType>(Ty)) {
653 GenerateError("Functions are not values and "
654 "must be referenced as pointers");
659 case ValID::NumberVal: { // Is it a numbered definition?
660 unsigned Num = (unsigned)D.Num;
662 // Module constants occupy the lowest numbered slots...
663 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
664 if (VI != CurModule.Values.end()) {
665 if (Num < VI->second.size())
666 return VI->second[Num];
667 Num -= VI->second.size();
670 // Make sure that our type is within bounds
671 VI = CurFun.Values.find(Ty);
672 if (VI == CurFun.Values.end()) return 0;
674 // Check that the number is within bounds...
675 if (VI->second.size() <= Num) return 0;
677 return VI->second[Num];
680 case ValID::NameVal: { // Is it a named definition?
681 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
682 if (N == 0) return 0;
684 D.destroy(); // Free old strdup'd memory...
688 // Check to make sure that "Ty" is an integral type, and that our
689 // value will fit into the specified type...
690 case ValID::ConstSIntVal: // Is it a constant pool reference??
691 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
692 GenerateError("Signed integral constant '" +
693 itostr(D.ConstPool64) + "' is invalid for type '" +
694 Ty->getDescription() + "'!");
697 return ConstantInt::get(Ty, D.ConstPool64);
699 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
700 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
701 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
702 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
703 "' is invalid or out of range!");
705 } else { // This is really a signed reference. Transmogrify.
706 return ConstantInt::get(Ty, D.ConstPool64);
709 return ConstantInt::get(Ty, D.UConstPool64);
712 case ValID::ConstFPVal: // Is it a floating point const pool reference?
713 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
714 GenerateError("FP constant invalid for type!!");
717 return ConstantFP::get(Ty, D.ConstPoolFP);
719 case ValID::ConstNullVal: // Is it a null value?
720 if (!isa<PointerType>(Ty)) {
721 GenerateError("Cannot create a a non pointer null!");
724 return ConstantPointerNull::get(cast<PointerType>(Ty));
726 case ValID::ConstUndefVal: // Is it an undef value?
727 return UndefValue::get(Ty);
729 case ValID::ConstZeroVal: // Is it a zero value?
730 return Constant::getNullValue(Ty);
732 case ValID::ConstantVal: // Fully resolved constant?
733 if (D.ConstantValue->getType() != Ty) {
734 GenerateError("Constant expression type different from required type!");
737 return D.ConstantValue;
739 case ValID::InlineAsmVal: { // Inline asm expression
740 const PointerType *PTy = dyn_cast<PointerType>(Ty);
741 const FunctionType *FTy =
742 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
743 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
744 GenerateError("Invalid type for asm constraint string!");
747 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
748 D.IAD->HasSideEffects);
749 D.destroy(); // Free InlineAsmDescriptor.
753 assert(0 && "Unhandled case!");
757 assert(0 && "Unhandled case!");
761 // getVal - This function is identical to getValNonImprovising, except that if a
762 // value is not already defined, it "improvises" by creating a placeholder var
763 // that looks and acts just like the requested variable. When the value is
764 // defined later, all uses of the placeholder variable are replaced with the
767 static Value *getVal(const Type *Ty, const ValID &ID) {
768 if (Ty == Type::LabelTy) {
769 GenerateError("Cannot use a basic block here");
773 // See if the value has already been defined.
774 Value *V = getValNonImprovising(Ty, ID);
776 if (TriggerError) return 0;
778 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
779 GenerateError("Invalid use of a composite type!");
783 // If we reached here, we referenced either a symbol that we don't know about
784 // or an id number that hasn't been read yet. We may be referencing something
785 // forward, so just create an entry to be resolved later and get to it...
787 V = new Argument(Ty);
789 // Remember where this forward reference came from. FIXME, shouldn't we try
790 // to recycle these things??
791 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
794 if (inFunctionScope())
795 InsertValue(V, CurFun.LateResolveValues);
797 InsertValue(V, CurModule.LateResolveValues);
801 /// getBBVal - This is used for two purposes:
802 /// * If isDefinition is true, a new basic block with the specified ID is being
804 /// * If isDefinition is true, this is a reference to a basic block, which may
805 /// or may not be a forward reference.
807 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
808 assert(inFunctionScope() && "Can't get basic block at global scope!");
814 GenerateError("Illegal label reference " + ID.getName());
816 case ValID::NumberVal: // Is it a numbered definition?
817 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
818 CurFun.NumberedBlocks.resize(ID.Num+1);
819 BB = CurFun.NumberedBlocks[ID.Num];
821 case ValID::NameVal: // Is it a named definition?
823 if (Value *N = CurFun.CurrentFunction->
824 getValueSymbolTable().lookup(Type::LabelTy, Name))
825 BB = cast<BasicBlock>(N);
829 // See if the block has already been defined.
831 // If this is the definition of the block, make sure the existing value was
832 // just a forward reference. If it was a forward reference, there will be
833 // an entry for it in the PlaceHolderInfo map.
834 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
835 // The existing value was a definition, not a forward reference.
836 GenerateError("Redefinition of label " + ID.getName());
840 ID.destroy(); // Free strdup'd memory.
844 // Otherwise this block has not been seen before.
845 BB = new BasicBlock("", CurFun.CurrentFunction);
846 if (ID.Type == ValID::NameVal) {
847 BB->setName(ID.Name);
849 CurFun.NumberedBlocks[ID.Num] = BB;
852 // If this is not a definition, keep track of it so we can use it as a forward
855 // Remember where this forward reference came from.
856 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
858 // The forward declaration could have been inserted anywhere in the
859 // function: insert it into the correct place now.
860 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
861 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
868 //===----------------------------------------------------------------------===//
869 // Code to handle forward references in instructions
870 //===----------------------------------------------------------------------===//
872 // This code handles the late binding needed with statements that reference
873 // values not defined yet... for example, a forward branch, or the PHI node for
876 // This keeps a table (CurFun.LateResolveValues) of all such forward references
877 // and back patchs after we are done.
880 // ResolveDefinitions - If we could not resolve some defs at parsing
881 // time (forward branches, phi functions for loops, etc...) resolve the
885 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
886 std::map<const Type*,ValueList> *FutureLateResolvers) {
887 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
888 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
889 E = LateResolvers.end(); LRI != E; ++LRI) {
890 ValueList &List = LRI->second;
891 while (!List.empty()) {
892 Value *V = List.back();
895 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
896 CurModule.PlaceHolderInfo.find(V);
897 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
899 ValID &DID = PHI->second.first;
901 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
905 V->replaceAllUsesWith(TheRealValue);
907 CurModule.PlaceHolderInfo.erase(PHI);
908 } else if (FutureLateResolvers) {
909 // Functions have their unresolved items forwarded to the module late
911 InsertValue(V, *FutureLateResolvers);
913 if (DID.Type == ValID::NameVal) {
914 GenerateError("Reference to an invalid definition: '" +DID.getName()+
915 "' of type '" + V->getType()->getDescription() + "'",
919 GenerateError("Reference to an invalid definition: #" +
920 itostr(DID.Num) + " of type '" +
921 V->getType()->getDescription() + "'",
929 LateResolvers.clear();
932 // ResolveTypeTo - A brand new type was just declared. This means that (if
933 // name is not null) things referencing Name can be resolved. Otherwise, things
934 // refering to the number can be resolved. Do this now.
936 static void ResolveTypeTo(char *Name, const Type *ToTy) {
938 if (Name) D = ValID::create(Name);
939 else D = ValID::create((int)CurModule.Types.size());
941 std::map<ValID, PATypeHolder>::iterator I =
942 CurModule.LateResolveTypes.find(D);
943 if (I != CurModule.LateResolveTypes.end()) {
944 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
945 CurModule.LateResolveTypes.erase(I);
949 // setValueName - Set the specified value to the name given. The name may be
950 // null potentially, in which case this is a noop. The string passed in is
951 // assumed to be a malloc'd string buffer, and is free'd by this function.
953 static void setValueName(Value *V, char *NameStr) {
955 std::string Name(NameStr); // Copy string
956 free(NameStr); // Free old string
958 if (V->getType() == Type::VoidTy) {
959 GenerateError("Can't assign name '" + Name+"' to value with void type!");
963 assert(inFunctionScope() && "Must be in function scope!");
964 SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
965 if (ST.lookup(V->getType(), Name)) {
966 GenerateError("Redefinition of value '" + Name + "' of type '" +
967 V->getType()->getDescription() + "'!");
976 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
977 /// this is a declaration, otherwise it is a definition.
978 static GlobalVariable *
979 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
980 bool isConstantGlobal, const Type *Ty,
981 Constant *Initializer) {
982 if (isa<FunctionType>(Ty)) {
983 GenerateError("Cannot declare global vars of function type!");
987 const PointerType *PTy = PointerType::get(Ty);
991 Name = NameStr; // Copy string
992 free(NameStr); // Free old string
995 // See if this global value was forward referenced. If so, recycle the
999 ID = ValID::create((char*)Name.c_str());
1001 ID = ValID::create((int)CurModule.Values[PTy].size());
1004 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1005 // Move the global to the end of the list, from whereever it was
1006 // previously inserted.
1007 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1008 CurModule.CurrentModule->getGlobalList().remove(GV);
1009 CurModule.CurrentModule->getGlobalList().push_back(GV);
1010 GV->setInitializer(Initializer);
1011 GV->setLinkage(Linkage);
1012 GV->setConstant(isConstantGlobal);
1013 InsertValue(GV, CurModule.Values);
1017 // If this global has a name, check to see if there is already a definition
1018 // of this global in the module. If so, it is an error.
1019 if (!Name.empty()) {
1020 // We are a simple redefinition of a value, check to see if it is defined
1021 // the same as the old one.
1022 if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
1023 GenerateError("Redefinition of global variable named '" + Name +
1024 "' of type '" + Ty->getDescription() + "'!");
1029 // Otherwise there is no existing GV to use, create one now.
1030 GlobalVariable *GV =
1031 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1032 CurModule.CurrentModule);
1033 InsertValue(GV, CurModule.Values);
1037 // setTypeName - Set the specified type to the name given. The name may be
1038 // null potentially, in which case this is a noop. The string passed in is
1039 // assumed to be a malloc'd string buffer, and is freed by this function.
1041 // This function returns true if the type has already been defined, but is
1042 // allowed to be redefined in the specified context. If the name is a new name
1043 // for the type plane, it is inserted and false is returned.
1044 static bool setTypeName(const Type *T, char *NameStr) {
1045 assert(!inFunctionScope() && "Can't give types function-local names!");
1046 if (NameStr == 0) return false;
1048 std::string Name(NameStr); // Copy string
1049 free(NameStr); // Free old string
1051 // We don't allow assigning names to void type
1052 if (T == Type::VoidTy) {
1053 GenerateError("Can't assign name '" + Name + "' to the void type!");
1057 // Set the type name, checking for conflicts as we do so.
1058 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1060 if (AlreadyExists) { // Inserting a name that is already defined???
1061 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1062 assert(Existing && "Conflict but no matching type?");
1064 // There is only one case where this is allowed: when we are refining an
1065 // opaque type. In this case, Existing will be an opaque type.
1066 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1067 // We ARE replacing an opaque type!
1068 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1072 // Otherwise, this is an attempt to redefine a type. That's okay if
1073 // the redefinition is identical to the original. This will be so if
1074 // Existing and T point to the same Type object. In this one case we
1075 // allow the equivalent redefinition.
1076 if (Existing == T) return true; // Yes, it's equal.
1078 // Any other kind of (non-equivalent) redefinition is an error.
1079 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1080 T->getDescription() + "'!");
1086 //===----------------------------------------------------------------------===//
1087 // Code for handling upreferences in type names...
1090 // TypeContains - Returns true if Ty directly contains E in it.
1092 static bool TypeContains(const Type *Ty, const Type *E) {
1093 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1094 E) != Ty->subtype_end();
1098 struct UpRefRecord {
1099 // NestingLevel - The number of nesting levels that need to be popped before
1100 // this type is resolved.
1101 unsigned NestingLevel;
1103 // LastContainedTy - This is the type at the current binding level for the
1104 // type. Every time we reduce the nesting level, this gets updated.
1105 const Type *LastContainedTy;
1107 // UpRefTy - This is the actual opaque type that the upreference is
1108 // represented with.
1109 OpaqueType *UpRefTy;
1111 UpRefRecord(unsigned NL, OpaqueType *URTy)
1112 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1116 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1117 static std::vector<UpRefRecord> UpRefs;
1119 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1120 /// called. It loops through the UpRefs vector, which is a list of the
1121 /// currently active types. For each type, if the up reference is contained in
1122 /// the newly completed type, we decrement the level count. When the level
1123 /// count reaches zero, the upreferenced type is the type that is passed in:
1124 /// thus we can complete the cycle.
1126 static PATypeHolder HandleUpRefs(const Type *ty) {
1127 // If Ty isn't abstract, or if there are no up-references in it, then there is
1128 // nothing to resolve here.
1129 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1131 PATypeHolder Ty(ty);
1132 UR_OUT("Type '" << Ty->getDescription() <<
1133 "' newly formed. Resolving upreferences.\n" <<
1134 UpRefs.size() << " upreferences active!\n");
1136 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1137 // to zero), we resolve them all together before we resolve them to Ty. At
1138 // the end of the loop, if there is anything to resolve to Ty, it will be in
1140 OpaqueType *TypeToResolve = 0;
1142 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1143 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1144 << UpRefs[i].second->getDescription() << ") = "
1145 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1146 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1147 // Decrement level of upreference
1148 unsigned Level = --UpRefs[i].NestingLevel;
1149 UpRefs[i].LastContainedTy = Ty;
1150 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1151 if (Level == 0) { // Upreference should be resolved!
1152 if (!TypeToResolve) {
1153 TypeToResolve = UpRefs[i].UpRefTy;
1155 UR_OUT(" * Resolving upreference for "
1156 << UpRefs[i].second->getDescription() << "\n";
1157 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1158 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1159 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1160 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1162 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1163 --i; // Do not skip the next element...
1168 if (TypeToResolve) {
1169 UR_OUT(" * Resolving upreference for "
1170 << UpRefs[i].second->getDescription() << "\n";
1171 std::string OldName = TypeToResolve->getDescription());
1172 TypeToResolve->refineAbstractTypeTo(Ty);
1178 //===----------------------------------------------------------------------===//
1179 // RunVMAsmParser - Define an interface to this parser
1180 //===----------------------------------------------------------------------===//
1182 static Module* RunParser(Module * M);
1184 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1187 CurFilename = Filename;
1188 return RunParser(new Module(CurFilename));
1191 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1192 set_scan_string(AsmString);
1194 CurFilename = "from_memory";
1196 return RunParser(new Module (CurFilename));
1198 return RunParser(M);
1204 /* Enabling traces. */
1209 /* Enabling verbose error messages. */
1210 #ifdef YYERROR_VERBOSE
1211 # undef YYERROR_VERBOSE
1212 # define YYERROR_VERBOSE 1
1214 # define YYERROR_VERBOSE 0
1217 /* Enabling the token table. */
1218 #ifndef YYTOKEN_TABLE
1219 # define YYTOKEN_TABLE 0
1222 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1223 #line 876 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
1224 typedef union YYSTYPE {
1225 llvm::Module *ModuleVal;
1226 llvm::Function *FunctionVal;
1227 llvm::BasicBlock *BasicBlockVal;
1228 llvm::TerminatorInst *TermInstVal;
1229 llvm::Instruction *InstVal;
1230 llvm::Constant *ConstVal;
1232 const llvm::Type *PrimType;
1233 std::list<llvm::PATypeHolder> *TypeList;
1234 llvm::PATypeHolder *TypeVal;
1235 llvm::Value *ValueVal;
1236 std::vector<llvm::Value*> *ValueList;
1237 llvm::ArgListType *ArgList;
1238 llvm::TypeWithAttrs TypeWithAttrs;
1239 llvm::TypeWithAttrsList *TypeWithAttrsList;
1240 llvm::ValueRefList *ValueRefList;
1242 // Represent the RHS of PHI node
1243 std::list<std::pair<llvm::Value*,
1244 llvm::BasicBlock*> > *PHIList;
1245 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1246 std::vector<llvm::Constant*> *ConstVector;
1248 llvm::GlobalValue::LinkageTypes Linkage;
1249 llvm::FunctionType::ParameterAttributes ParamAttrs;
1257 char *StrVal; // This memory is strdup'd!
1258 llvm::ValID ValIDVal; // strdup'd memory maybe!
1260 llvm::Instruction::BinaryOps BinaryOpVal;
1261 llvm::Instruction::TermOps TermOpVal;
1262 llvm::Instruction::MemoryOps MemOpVal;
1263 llvm::Instruction::CastOps CastOpVal;
1264 llvm::Instruction::OtherOps OtherOpVal;
1265 llvm::Module::Endianness Endianness;
1266 llvm::ICmpInst::Predicate IPredicate;
1267 llvm::FCmpInst::Predicate FPredicate;
1269 /* Line 196 of yacc.c. */
1270 #line 1271 "llvmAsmParser.tab.c"
1271 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1272 # define YYSTYPE_IS_DECLARED 1
1273 # define YYSTYPE_IS_TRIVIAL 1
1278 /* Copy the second part of user declarations. */
1281 /* Line 219 of yacc.c. */
1282 #line 1283 "llvmAsmParser.tab.c"
1284 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1285 # define YYSIZE_T __SIZE_TYPE__
1287 #if ! defined (YYSIZE_T) && defined (size_t)
1288 # define YYSIZE_T size_t
1290 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1291 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1292 # define YYSIZE_T size_t
1294 #if ! defined (YYSIZE_T)
1295 # define YYSIZE_T unsigned int
1301 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1302 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1306 # define YY_(msgid) msgid
1310 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1312 /* The parser invokes alloca or malloc; define the necessary symbols. */
1314 # ifdef YYSTACK_USE_ALLOCA
1315 # if YYSTACK_USE_ALLOCA
1317 # define YYSTACK_ALLOC __builtin_alloca
1319 # define YYSTACK_ALLOC alloca
1320 # if defined (__STDC__) || defined (__cplusplus)
1321 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1322 # define YYINCLUDED_STDLIB_H
1328 # ifdef YYSTACK_ALLOC
1329 /* Pacify GCC's `empty if-body' warning. */
1330 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1331 # ifndef YYSTACK_ALLOC_MAXIMUM
1332 /* The OS might guarantee only one guard page at the bottom of the stack,
1333 and a page size can be as small as 4096 bytes. So we cannot safely
1334 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1335 to allow for a few compiler-allocated temporary stack slots. */
1336 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1339 # define YYSTACK_ALLOC YYMALLOC
1340 # define YYSTACK_FREE YYFREE
1341 # ifndef YYSTACK_ALLOC_MAXIMUM
1342 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1348 # define YYMALLOC malloc
1349 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1350 && (defined (__STDC__) || defined (__cplusplus)))
1351 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1355 # define YYFREE free
1356 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1357 && (defined (__STDC__) || defined (__cplusplus)))
1358 void free (void *); /* INFRINGES ON USER NAME SPACE */
1365 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1368 #if (! defined (yyoverflow) \
1369 && (! defined (__cplusplus) \
1370 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1372 /* A type that is properly aligned for any stack member. */
1379 /* The size of the maximum gap between one aligned stack and the next. */
1380 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1382 /* The size of an array large to enough to hold all stacks, each with
1384 # define YYSTACK_BYTES(N) \
1385 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1386 + YYSTACK_GAP_MAXIMUM)
1388 /* Copy COUNT objects from FROM to TO. The source and destination do
1391 # if defined (__GNUC__) && 1 < __GNUC__
1392 # define YYCOPY(To, From, Count) \
1393 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1395 # define YYCOPY(To, From, Count) \
1399 for (yyi = 0; yyi < (Count); yyi++) \
1400 (To)[yyi] = (From)[yyi]; \
1406 /* Relocate STACK from its old location to the new one. The
1407 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1408 elements in the stack, and YYPTR gives the new location of the
1409 stack. Advance YYPTR to a properly aligned location for the next
1411 # define YYSTACK_RELOCATE(Stack) \
1414 YYSIZE_T yynewbytes; \
1415 YYCOPY (&yyptr->Stack, Stack, yysize); \
1416 Stack = &yyptr->Stack; \
1417 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1418 yyptr += yynewbytes / sizeof (*yyptr); \
1424 #if defined (__STDC__) || defined (__cplusplus)
1425 typedef signed char yysigned_char;
1427 typedef short int yysigned_char;
1430 /* YYFINAL -- State number of the termination state. */
1432 /* YYLAST -- Last index in YYTABLE. */
1435 /* YYNTOKENS -- Number of terminals. */
1436 #define YYNTOKENS 150
1437 /* YYNNTS -- Number of nonterminals. */
1439 /* YYNRULES -- Number of rules. */
1440 #define YYNRULES 291
1441 /* YYNRULES -- Number of states. */
1442 #define YYNSTATES 576
1444 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1445 #define YYUNDEFTOK 2
1446 #define YYMAXUTOK 390
1448 #define YYTRANSLATE(YYX) \
1449 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1451 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1452 static const unsigned char yytranslate[] =
1454 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1458 140, 141, 138, 2, 137, 2, 2, 2, 2, 2,
1459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1460 145, 136, 146, 2, 2, 2, 2, 2, 2, 2,
1461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1463 2, 142, 139, 144, 2, 2, 2, 2, 2, 149,
1464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1466 143, 2, 2, 147, 2, 148, 2, 2, 2, 2,
1467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1479 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1480 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1481 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1482 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1483 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1484 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1485 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1486 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1487 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1488 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1489 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1490 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1491 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1492 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1497 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1499 static const unsigned short int yyprhs[] =
1501 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1502 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1503 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1504 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1505 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1506 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1507 119, 121, 123, 125, 128, 129, 131, 133, 135, 137,
1508 139, 141, 143, 145, 146, 148, 150, 151, 153, 155,
1509 157, 159, 160, 162, 164, 166, 168, 170, 172, 175,
1510 177, 179, 180, 183, 185, 187, 188, 191, 192, 195,
1511 196, 200, 203, 204, 206, 207, 211, 213, 216, 218,
1512 220, 222, 224, 226, 228, 230, 232, 234, 236, 239,
1513 241, 244, 250, 256, 262, 268, 272, 275, 281, 286,
1514 289, 291, 293, 295, 299, 301, 305, 307, 308, 310,
1515 314, 319, 323, 327, 332, 337, 341, 348, 354, 357,
1516 360, 363, 366, 369, 372, 375, 378, 381, 384, 391,
1517 397, 406, 413, 420, 428, 436, 443, 450, 459, 468,
1518 472, 474, 476, 478, 480, 481, 483, 486, 487, 491,
1519 492, 496, 500, 502, 506, 510, 511, 517, 518, 525,
1520 526, 533, 536, 540, 542, 544, 546, 550, 554, 558,
1521 562, 566, 570, 572, 573, 575, 577, 579, 580, 586,
1522 590, 592, 596, 598, 599, 609, 611, 613, 617, 619,
1523 621, 624, 627, 628, 630, 632, 634, 636, 638, 640,
1524 642, 644, 646, 650, 652, 658, 660, 662, 664, 666,
1525 669, 672, 675, 679, 682, 683, 685, 688, 691, 695,
1526 705, 715, 724, 739, 741, 743, 750, 756, 759, 766,
1527 774, 778, 784, 785, 786, 790, 793, 795, 801, 807,
1528 814, 821, 824, 829, 834, 841, 846, 851, 858, 865,
1529 868, 877, 879, 881, 882, 886, 893, 897, 904, 907,
1533 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1534 static const short int yyrhs[] =
1536 187, 0, -1, 5, -1, 6, -1, 74, -1, 75,
1537 -1, 76, -1, 77, -1, 78, -1, 79, -1, 80,
1538 -1, 81, -1, 82, -1, 83, -1, 84, -1, 85,
1539 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
1540 -1, 119, -1, 120, -1, 121, -1, 122, -1, 123,
1541 -1, 124, -1, 125, -1, 128, -1, 129, -1, 130,
1542 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1543 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1544 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1545 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1546 -1, 94, -1, 95, -1, 96, -1, 97, -1, 23,
1547 -1, 24, -1, 13, -1, 12, -1, 11, -1, 10,
1548 -1, 14, -1, 15, -1, 200, 136, -1, -1, 37,
1549 -1, 39, -1, 38, -1, 40, -1, 42, -1, 41,
1550 -1, 43, -1, 46, -1, -1, 41, -1, 43, -1,
1551 -1, 37, -1, 38, -1, 39, -1, 42, -1, -1,
1552 61, -1, 62, -1, 63, -1, 64, -1, 65, -1,
1553 66, -1, 60, 4, -1, 115, -1, 116, -1, -1,
1554 167, 166, -1, 135, -1, 166, -1, -1, 169, 168,
1555 -1, -1, 53, 4, -1, -1, 137, 53, 4, -1,
1556 31, 20, -1, -1, 172, -1, -1, 137, 175, 174,
1557 -1, 172, -1, 53, 4, -1, 9, -1, 10, -1,
1558 11, -1, 12, -1, 13, -1, 14, -1, 15, -1,
1559 16, -1, 44, -1, 176, -1, 177, 138, -1, 212,
1560 -1, 139, 4, -1, 177, 140, 181, 141, 169, -1,
1561 8, 140, 181, 141, 169, -1, 142, 4, 143, 177,
1562 144, -1, 145, 4, 143, 177, 146, -1, 147, 182,
1563 148, -1, 147, 148, -1, 145, 147, 182, 148, 146,
1564 -1, 145, 147, 148, 146, -1, 177, 167, -1, 177,
1565 -1, 8, -1, 178, -1, 180, 137, 178, -1, 180,
1566 -1, 180, 137, 34, -1, 34, -1, -1, 177, -1,
1567 182, 137, 177, -1, 177, 142, 185, 144, -1, 177,
1568 142, 144, -1, 177, 149, 20, -1, 177, 145, 185,
1569 146, -1, 177, 147, 185, 148, -1, 177, 147, 148,
1570 -1, 177, 145, 147, 185, 148, 146, -1, 177, 145,
1571 147, 148, 146, -1, 177, 35, -1, 177, 36, -1,
1572 177, 212, -1, 177, 184, -1, 177, 22, -1, 158,
1573 3, -1, 158, 4, -1, 9, 23, -1, 9, 24,
1574 -1, 159, 7, -1, 154, 140, 183, 33, 177, 141,
1575 -1, 113, 140, 183, 223, 141, -1, 127, 140, 183,
1576 137, 183, 137, 183, 141, -1, 152, 140, 183, 137,
1577 183, 141, -1, 153, 140, 183, 137, 183, 141, -1,
1578 86, 156, 140, 183, 137, 183, 141, -1, 87, 157,
1579 140, 183, 137, 183, 141, -1, 155, 140, 183, 137,
1580 183, 141, -1, 132, 140, 183, 137, 183, 141, -1,
1581 133, 140, 183, 137, 183, 137, 183, 141, -1, 134,
1582 140, 183, 137, 183, 137, 183, 141, -1, 185, 137,
1583 183, -1, 183, -1, 29, -1, 30, -1, 188, -1,
1584 -1, 189, -1, 188, 189, -1, -1, 28, 190, 208,
1585 -1, -1, 27, 191, 209, -1, 58, 57, 195, -1,
1586 21, -1, 160, 17, 177, -1, 160, 17, 8, -1,
1587 -1, 160, 186, 183, 192, 174, -1, -1, 160, 161,
1588 186, 183, 193, 174, -1, -1, 160, 162, 186, 177,
1589 194, 174, -1, 47, 197, -1, 54, 136, 198, -1,
1590 20, -1, 52, -1, 51, -1, 49, 136, 196, -1,
1591 50, 136, 4, -1, 48, 136, 20, -1, 67, 136,
1592 20, -1, 142, 199, 144, -1, 199, 137, 20, -1,
1593 20, -1, -1, 18, -1, 20, -1, 200, -1, -1,
1594 202, 137, 177, 167, 201, -1, 177, 167, 201, -1,
1595 202, -1, 202, 137, 34, -1, 34, -1, -1, 165,
1596 179, 200, 140, 203, 141, 169, 173, 170, -1, 25,
1597 -1, 147, -1, 164, 204, 205, -1, 26, -1, 148,
1598 -1, 215, 207, -1, 163, 204, -1, -1, 59, -1,
1599 3, -1, 4, -1, 7, -1, 23, -1, 24, -1,
1600 35, -1, 36, -1, 22, -1, 145, 185, 146, -1,
1601 184, -1, 57, 210, 20, 137, 20, -1, 151, -1,
1602 200, -1, 212, -1, 211, -1, 177, 213, -1, 215,
1603 216, -1, 206, 216, -1, 217, 160, 218, -1, 217,
1604 220, -1, -1, 19, -1, 68, 214, -1, 68, 8,
1605 -1, 69, 16, 213, -1, 69, 9, 213, 137, 16,
1606 213, 137, 16, 213, -1, 70, 158, 213, 137, 16,
1607 213, 142, 219, 144, -1, 70, 158, 213, 137, 16,
1608 213, 142, 144, -1, 71, 165, 179, 213, 140, 222,
1609 141, 169, 33, 16, 213, 72, 16, 213, -1, 72,
1610 -1, 73, -1, 219, 158, 211, 137, 16, 213, -1,
1611 158, 211, 137, 16, 213, -1, 160, 225, -1, 177,
1612 142, 213, 137, 213, 144, -1, 221, 137, 142, 213,
1613 137, 213, 144, -1, 177, 213, 167, -1, 222, 137,
1614 177, 213, 167, -1, -1, -1, 223, 137, 214, -1,
1615 56, 55, -1, 55, -1, 152, 177, 213, 137, 213,
1616 -1, 153, 177, 213, 137, 213, -1, 86, 156, 177,
1617 213, 137, 213, -1, 87, 157, 177, 213, 137, 213,
1618 -1, 45, 214, -1, 155, 214, 137, 214, -1, 154,
1619 214, 33, 177, -1, 127, 214, 137, 214, 137, 214,
1620 -1, 131, 214, 137, 177, -1, 132, 214, 137, 214,
1621 -1, 133, 214, 137, 214, 137, 214, -1, 134, 214,
1622 137, 214, 137, 214, -1, 126, 221, -1, 224, 165,
1623 179, 213, 140, 222, 141, 169, -1, 227, -1, 32,
1624 -1, -1, 108, 177, 171, -1, 108, 177, 137, 12,
1625 213, 171, -1, 109, 177, 171, -1, 109, 177, 137,
1626 12, 213, 171, -1, 110, 214, -1, 226, 111, 177,
1627 213, -1, 226, 112, 214, 137, 177, 213, -1, 113,
1631 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1632 static const unsigned short int yyrline[] =
1634 0, 1019, 1019, 1020, 1030, 1030, 1030, 1030, 1030, 1030,
1635 1030, 1030, 1030, 1031, 1031, 1031, 1032, 1032, 1032, 1032,
1636 1032, 1032, 1033, 1033, 1033, 1033, 1033, 1033, 1034, 1034,
1637 1034, 1036, 1036, 1037, 1037, 1038, 1038, 1039, 1039, 1040,
1638 1040, 1044, 1044, 1045, 1045, 1046, 1046, 1047, 1047, 1048,
1639 1048, 1049, 1049, 1050, 1050, 1051, 1052, 1057, 1057, 1057,
1640 1057, 1058, 1058, 1061, 1065, 1071, 1072, 1073, 1074, 1075,
1641 1079, 1080, 1081, 1085, 1086, 1087, 1091, 1092, 1093, 1094,
1642 1095, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1112,
1643 1113, 1116, 1117, 1122, 1123, 1126, 1127, 1134, 1135, 1141,
1644 1142, 1150, 1158, 1159, 1164, 1165, 1166, 1171, 1184, 1184,
1645 1184, 1184, 1184, 1184, 1184, 1184, 1187, 1191, 1195, 1202,
1646 1207, 1215, 1233, 1251, 1256, 1268, 1278, 1282, 1292, 1299,
1647 1306, 1313, 1318, 1323, 1330, 1331, 1338, 1345, 1353, 1358,
1648 1369, 1397, 1413, 1442, 1470, 1495, 1514, 1539, 1558, 1570,
1649 1577, 1640, 1650, 1660, 1666, 1672, 1676, 1680, 1688, 1702,
1650 1723, 1731, 1737, 1748, 1753, 1758, 1767, 1773, 1779, 1788,
1651 1792, 1800, 1800, 1811, 1816, 1824, 1825, 1829, 1829, 1833,
1652 1833, 1836, 1839, 1851, 1875, 1886, 1886, 1895, 1895, 1903,
1653 1903, 1913, 1916, 1922, 1935, 1936, 1938, 1942, 1951, 1955,
1654 1960, 1962, 1967, 1972, 1981, 1981, 1982, 1982, 1984, 1994,
1655 2005, 2009, 2018, 2027, 2032, 2137, 2137, 2139, 2147, 2147,
1656 2149, 2154, 2165, 2169, 2174, 2178, 2182, 2186, 2190, 2194,
1657 2198, 2202, 2206, 2231, 2235, 2249, 2253, 2259, 2259, 2265,
1658 2274, 2278, 2287, 2298, 2307, 2319, 2332, 2336, 2340, 2345,
1659 2354, 2373, 2382, 2449, 2453, 2460, 2471, 2484, 2493, 2504,
1660 2514, 2522, 2530, 2533, 2534, 2541, 2545, 2550, 2571, 2588,
1661 2601, 2614, 2627, 2636, 2649, 2657, 2664, 2670, 2676, 2682,
1662 2697, 2760, 2765, 2769, 2776, 2783, 2791, 2798, 2806, 2814,
1667 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1668 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1669 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1670 static const char *const yytname[] =
1672 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1673 "UINTVAL", "FPVAL", "VOID", "BOOL", "INT8", "INT16", "INT32", "INT64",
1674 "FLOAT", "DOUBLE", "LABEL", "TYPE", "VAR_ID", "LABELSTR",
1675 "STRINGCONSTANT", "IMPLEMENTATION", "ZEROINITIALIZER", "TRUETOK",
1676 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1677 "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK",
1678 "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT",
1679 "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "NOT", "EXTERNAL", "TARGET",
1680 "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS",
1681 "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1682 "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1683 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1684 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1685 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "ICMP", "FCMP", "EQ", "NE",
1686 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1687 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1688 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1689 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1690 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR",
1691 "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1692 "NORETURN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1693 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "INTVAL",
1694 "ArithmeticOps", "LogicalOps", "CastOps", "ShiftOps", "IPredicates",
1695 "FPredicates", "IntType", "FPType", "OptAssign", "GVInternalLinkage",
1696 "GVExternalLinkage", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1697 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1698 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1699 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1700 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1701 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1702 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1703 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1704 "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1705 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1706 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1707 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1708 "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList",
1709 "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0
1714 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1716 static const unsigned short int yytoknum[] =
1718 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1719 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1720 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1721 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1722 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1723 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1724 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1725 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1726 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1727 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1728 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1729 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1730 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1731 385, 386, 387, 388, 389, 390, 61, 44, 42, 92,
1732 40, 41, 91, 120, 93, 60, 62, 123, 125, 99
1736 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1737 static const unsigned char yyr1[] =
1739 0, 150, 151, 151, 152, 152, 152, 152, 152, 152,
1740 152, 152, 152, 153, 153, 153, 154, 154, 154, 154,
1741 154, 154, 154, 154, 154, 154, 154, 154, 155, 155,
1742 155, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1743 156, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1744 157, 157, 157, 157, 157, 157, 157, 158, 158, 158,
1745 158, 159, 159, 160, 160, 161, 161, 161, 161, 161,
1746 162, 162, 162, 163, 163, 163, 164, 164, 164, 164,
1747 164, 165, 165, 165, 165, 165, 165, 165, 165, 166,
1748 166, 167, 167, 168, 168, 169, 169, 170, 170, 171,
1749 171, 172, 173, 173, 174, 174, 175, 175, 176, 176,
1750 176, 176, 176, 176, 176, 176, 177, 177, 177, 177,
1751 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
1752 179, 179, 180, 180, 181, 181, 181, 181, 182, 182,
1753 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
1754 183, 183, 183, 183, 183, 183, 183, 183, 184, 184,
1755 184, 184, 184, 184, 184, 184, 184, 184, 184, 185,
1756 185, 186, 186, 187, 187, 188, 188, 190, 189, 191,
1757 189, 189, 189, 189, 189, 192, 189, 193, 189, 194,
1758 189, 189, 189, 195, 196, 196, 197, 197, 197, 197,
1759 198, 199, 199, 199, 200, 200, 201, 201, 202, 202,
1760 203, 203, 203, 203, 204, 205, 205, 206, 207, 207,
1761 208, 209, 210, 210, 211, 211, 211, 211, 211, 211,
1762 211, 211, 211, 211, 211, 212, 212, 213, 213, 214,
1763 215, 215, 216, 217, 217, 217, 218, 218, 218, 218,
1764 218, 218, 218, 218, 218, 219, 219, 220, 221, 221,
1765 222, 222, 222, 223, 223, 224, 224, 225, 225, 225,
1766 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1767 225, 225, 226, 226, 227, 227, 227, 227, 227, 227,
1771 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1772 static const unsigned char yyr2[] =
1774 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1776 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1777 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1778 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1779 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1780 1, 1, 1, 2, 0, 1, 1, 1, 1, 1,
1781 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1782 1, 0, 1, 1, 1, 1, 1, 1, 2, 1,
1783 1, 0, 2, 1, 1, 0, 2, 0, 2, 0,
1784 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1785 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1786 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1787 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1788 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1789 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1790 8, 6, 6, 7, 7, 6, 6, 8, 8, 3,
1791 1, 1, 1, 1, 0, 1, 2, 0, 3, 0,
1792 3, 3, 1, 3, 3, 0, 5, 0, 6, 0,
1793 6, 2, 3, 1, 1, 1, 3, 3, 3, 3,
1794 3, 3, 1, 0, 1, 1, 1, 0, 5, 3,
1795 1, 3, 1, 0, 9, 1, 1, 3, 1, 1,
1796 2, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1797 1, 1, 3, 1, 5, 1, 1, 1, 1, 2,
1798 2, 2, 3, 2, 0, 1, 2, 2, 3, 9,
1799 9, 8, 14, 1, 1, 6, 5, 2, 6, 7,
1800 3, 5, 0, 0, 3, 2, 1, 5, 5, 6,
1801 6, 2, 4, 4, 6, 4, 4, 6, 6, 2,
1802 8, 1, 1, 0, 3, 6, 3, 6, 2, 4,
1806 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1807 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1808 means the default is an error. */
1809 static const unsigned short int yydefact[] =
1811 64, 204, 205, 182, 179, 177, 0, 0, 0, 0,
1812 0, 64, 175, 0, 73, 76, 0, 0, 0, 0,
1813 191, 0, 0, 0, 171, 172, 65, 67, 66, 68,
1814 70, 69, 71, 72, 0, 0, 0, 1, 176, 63,
1815 74, 75, 81, 180, 77, 78, 79, 80, 81, 244,
1816 178, 244, 0, 0, 0, 0, 203, 192, 193, 181,
1817 2, 3, 184, 108, 109, 110, 111, 112, 113, 114,
1818 115, 116, 0, 0, 0, 0, 235, 117, 183, 236,
1819 119, 0, 0, 0, 108, 109, 110, 111, 112, 113,
1820 114, 0, 0, 0, 185, 0, 82, 83, 84, 85,
1821 86, 87, 0, 221, 0, 245, 241, 64, 218, 219,
1822 220, 240, 198, 195, 194, 196, 197, 199, 202, 0,
1823 137, 120, 0, 0, 0, 126, 138, 0, 118, 137,
1824 187, 189, 155, 156, 153, 154, 157, 152, 148, 149,
1825 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1826 14, 15, 0, 0, 0, 16, 17, 18, 19, 20,
1827 21, 22, 23, 24, 25, 26, 27, 0, 28, 29,
1828 30, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1829 0, 0, 151, 150, 104, 88, 131, 130, 0, 215,
1830 216, 217, 283, 243, 0, 200, 136, 91, 132, 134,
1831 0, 0, 0, 0, 0, 0, 125, 0, 104, 104,
1832 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1833 0, 55, 56, 51, 52, 53, 54, 41, 42, 43,
1834 44, 45, 46, 47, 48, 49, 50, 0, 0, 0,
1835 0, 0, 0, 141, 170, 0, 0, 0, 145, 0,
1836 142, 0, 0, 0, 0, 0, 186, 0, 282, 0,
1837 266, 0, 0, 0, 0, 81, 253, 254, 0, 0,
1838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1839 0, 0, 0, 0, 242, 81, 257, 0, 281, 201,
1840 129, 0, 95, 0, 0, 128, 0, 139, 95, 188,
1841 190, 0, 0, 263, 0, 0, 0, 0, 0, 140,
1842 126, 138, 0, 143, 144, 0, 0, 0, 0, 0,
1843 0, 106, 104, 213, 0, 271, 265, 247, 246, 0,
1844 0, 60, 59, 58, 57, 0, 0, 0, 0, 99,
1845 99, 288, 0, 0, 279, 0, 0, 0, 0, 0,
1846 0, 0, 0, 0, 0, 0, 0, 89, 90, 92,
1847 135, 133, 122, 123, 124, 127, 121, 0, 0, 0,
1848 0, 0, 0, 0, 169, 147, 0, 0, 0, 0,
1849 0, 101, 107, 105, 212, 91, 210, 0, 224, 225,
1850 226, 231, 227, 228, 229, 230, 222, 0, 233, 238,
1851 237, 239, 0, 248, 0, 0, 0, 0, 0, 284,
1852 0, 286, 263, 0, 0, 0, 0, 0, 0, 0,
1853 0, 0, 0, 0, 0, 0, 0, 93, 94, 96,
1854 0, 0, 0, 159, 0, 0, 0, 0, 146, 0,
1855 0, 0, 0, 207, 0, 95, 223, 0, 0, 0,
1856 0, 0, 0, 0, 0, 0, 0, 291, 0, 0,
1857 0, 275, 276, 0, 0, 0, 0, 273, 272, 0,
1858 289, 0, 0, 0, 264, 0, 166, 0, 0, 161,
1859 162, 158, 165, 206, 209, 211, 91, 102, 0, 232,
1860 0, 0, 262, 0, 0, 99, 100, 99, 0, 0,
1861 0, 0, 0, 267, 268, 262, 0, 163, 164, 0,
1862 0, 0, 207, 103, 97, 0, 0, 0, 0, 0,
1863 269, 270, 0, 285, 287, 0, 0, 274, 277, 278,
1864 0, 290, 160, 167, 168, 208, 0, 214, 234, 0,
1865 0, 91, 0, 95, 258, 0, 95, 98, 0, 251,
1866 0, 0, 260, 0, 0, 259, 280, 249, 0, 250,
1867 0, 91, 0, 0, 0, 261, 0, 0, 0, 0,
1868 256, 0, 0, 255, 0, 252
1871 /* YYDEFGOTO[NTERM-NUM]. */
1872 static const short int yydefgoto[] =
1874 -1, 76, 178, 179, 180, 181, 220, 237, 91, 92,
1875 9, 34, 35, 42, 48, 102, 359, 290, 429, 362,
1876 537, 409, 321, 514, 256, 322, 77, 93, 198, 188,
1877 199, 200, 127, 244, 398, 245, 36, 10, 11, 12,
1878 15, 14, 184, 208, 209, 59, 115, 20, 57, 119,
1879 79, 484, 386, 387, 103, 191, 49, 110, 50, 43,
1880 447, 399, 80, 401, 325, 51, 106, 107, 284, 551,
1881 193, 344, 519, 369, 285, 286, 287, 288
1884 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1886 #define YYPACT_NINF -457
1887 static const short int yypact[] =
1889 49, -457, -457, -457, -457, -457, 8, -107, -9, 255,
1890 61, 188, -457, -7, 113, 165, 33, 38, 51, 69,
1891 -457, 17, 95, 1056, -457, -457, -457, -457, -457, -457,
1892 -457, -457, -457, -457, 91, 91, 1290, -457, -457, -457,
1893 -457, -457, 130, -457, -457, -457, -457, -457, 130, 116,
1894 -457, 25, 192, 98, 265, 198, 201, -457, -457, -457,
1895 -457, -457, 131, -457, -457, -457, -457, -457, -457, -457,
1896 -457, -457, 270, 273, 5, 128, -457, -457, 73, -457,
1897 -457, 1290, 1310, 131, 217, 234, 259, 262, 276, 281,
1898 292, 278, 297, 623, -457, 279, -457, -457, -457, -457,
1899 -457, -457, 1327, -457, -2, -457, -457, 214, -457, -457,
1900 -457, -457, -457, -457, -457, -457, -457, -457, -457, -120,
1901 809, -457, 162, 163, 710, -457, 73, -84, -457, 809,
1902 -457, 73, -457, -457, -457, -457, -457, -457, -457, -457,
1903 -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,
1904 -457, -457, 269, 1007, 167, -457, -457, -457, -457, -457,
1905 -457, -457, -457, -457, -457, -457, -457, 168, -457, -457,
1906 -457, 169, 171, 172, 75, 1347, 768, 296, 177, 178,
1907 179, 180, -457, -457, 184, -457, 131, 73, 214, -457,
1908 -457, -457, 1450, -457, 302, -457, -457, 73, -457, 189,
1909 183, 1310, 1310, 181, -83, 1310, -457, 194, 184, 184,
1910 -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,
1911 185, -457, -457, -457, -457, -457, -457, -457, -457, -457,
1912 -457, -457, -457, -457, -457, -457, -457, 190, 1290, 1290,
1913 1290, 1290, 1290, -457, -457, -27, 784, -32, -457, -77,
1914 -457, 1290, 1290, 1290, 1290, -21, -457, 196, -457, 1310,
1915 -457, 282, 1370, 114, 216, 130, -457, -457, 269, 1007,
1916 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310,
1917 1310, 1310, 1310, 1310, -457, 130, -457, 175, -457, -457,
1918 187, 952, -457, 13, -22, -457, 193, 73, -457, -457,
1919 -457, 1290, 1290, -457, 203, 205, 206, 207, 1290, -457,
1920 199, 623, -75, -457, -457, 209, 210, 305, 211, 331,
1921 348, -457, 184, 1227, 860, -457, -457, 131, -457, 1003,
1922 1003, -457, -457, -457, -457, 1003, 1327, 1310, 1310, 60,
1923 93, -457, 860, -40, 218, 235, 236, 237, 238, 239,
1924 860, 860, 320, 240, 1327, 1310, 1310, -457, -457, -457,
1925 -457, -457, -69, -457, -457, -457, -69, 241, 242, -59,
1926 1290, 1290, 1290, 1290, -457, -457, 208, 1290, 1290, 1310,
1927 1290, -457, -457, -457, -457, 73, 247, 244, -457, -457,
1928 -457, -457, -457, -457, -457, -457, 327, 1290, -457, -457,
1929 -457, -457, 250, -457, 251, 1003, 860, 860, 2, -457,
1930 19, -457, -457, 1003, 248, 1310, 1310, 1310, 1310, 1310,
1931 252, 254, 1310, 1310, 1003, 860, 260, -457, -457, -457,
1932 1290, 1290, 1310, -457, 261, 266, 264, 271, -457, 272,
1933 274, 45, 275, 10, 1273, -457, -457, 382, -24, 387,
1934 394, 277, 283, 285, 1003, 407, 1003, 288, 289, 1003,
1935 290, 73, -457, 291, 295, 1003, 1003, 73, -457, 293,
1936 -457, 1310, 294, 298, -457, 1290, -457, 1290, 1290, -457,
1937 -457, -457, -457, -457, -457, -457, 73, -4, 299, -457,
1938 1003, 1003, 1310, 1003, 1003, 301, -457, 301, 1003, 303,
1939 1310, 1310, 1310, -457, -457, 1310, 860, -457, -457, 300,
1940 304, 306, 10, -457, 361, 398, 309, 287, 860, 39,
1941 -457, -457, 366, -457, -457, 308, 1003, -457, -457, -457,
1942 40, -457, -457, -457, -457, -457, 430, -457, -457, 426,
1943 23, -457, 1310, -457, -457, 310, -457, -457, 1003, -457,
1944 1135, 27, 187, 860, 12, -457, -69, -457, 312, -457,
1945 1135, -457, 427, 441, 322, 187, 1003, 1003, 444, 389,
1946 -457, 1003, 446, -457, 1003, -457
1949 /* YYPGOTO[NTERM-NUM]. */
1950 static const short int yypgoto[] =
1952 -457, -457, 284, 311, 316, 318, 200, 197, -262, -457,
1953 360, -457, -457, -457, -457, -222, -355, -377, -457, -282,
1954 -457, -327, -17, -457, -167, -457, -457, -23, 182, -286,
1955 -457, 345, 351, 129, -87, -172, 256, -457, -457, 469,
1956 -457, -457, -457, -457, -457, -457, -457, -457, -457, -457,
1957 1, -31, -457, -457, 435, -457, -457, -457, -457, -457,
1958 -457, -456, -1, 121, -257, -457, 433, -457, -457, -457,
1959 -457, -457, -20, 74, -457, -457, -457, -457
1962 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1963 positive, shift that token. If negative, reduce the rule which
1964 number is the opposite. If zero, do what YYDEFACT says.
1965 If YYTABLE_NINF, syntax error. */
1966 #define YYTABLE_NINF -175
1967 static const short int yytable[] =
1969 78, 13, 335, 247, 249, 328, 182, 428, 443, 123,
1970 319, 428, 13, 411, 454, 341, 366, 194, 345, 346,
1971 347, 348, 349, 189, 195, 352, 353, 319, 1, 21,
1972 2, 456, 320, 331, 332, 333, 334, 331, 332, 333,
1973 334, 299, 300, 336, 105, 562, 357, 358, 22, -174,
1974 405, 108, 126, 205, 205, 455, 16, 17, 18, 131,
1975 308, 37, 308, 354, 206, 296, 427, 1, 424, 2,
1976 3, 314, 455, 376, 312, 19, 4, 5, 432, 187,
1977 60, 61, 433, 83, 84, 85, 86, 87, 88, 89,
1978 90, 70, 183, 1, 558, 2, 6, 197, 128, 426,
1979 129, 126, 413, 7, 564, 308, 197, 8, 13, 512,
1980 308, 357, 358, 308, 313, 58, 128, 309, 129, 71,
1981 24, 25, 489, 329, 364, 357, 358, 357, 358, 39,
1982 330, 427, 428, 60, 61, 105, 83, 63, 64, 65,
1983 66, 67, 68, 69, 70, 190, 1, 427, 2, 113,
1984 114, 128, 124, 129, 40, 383, 41, 363, 460, 56,
1985 462, 463, 464, 487, 552, 94, 468, 549, 523, 52,
1986 524, 559, 71, 109, 53, 474, 542, 542, 293, 294,
1987 543, 546, 297, 128, 565, 129, 481, 54, -173, 257,
1988 95, 96, 97, 98, 99, 100, 101, 408, 128, 428,
1989 129, 428, 44, 45, 46, 55, 1, 47, 2, 3,
1990 130, 128, 112, 129, 72, 4, 5, 73, 117, 243,
1991 74, 118, 75, 311, 182, 448, 331, 332, 333, 334,
1992 410, 128, 1, 129, 2, 6, 324, -60, -60, 324,
1993 132, 133, 7, 527, 528, 529, 8, 339, 340, 324,
1994 342, 343, 324, 324, 324, 324, 324, 350, 351, 324,
1995 324, 554, -59, -59, 556, -58, -58, 72, 197, 116,
1996 73, 120, 23, 74, 121, 75, 125, 122, 550, -57,
1997 -57, 134, 135, 185, 24, 25, 355, 356, -61, 560,
1998 81, 82, 26, 27, 28, 29, 30, 31, 32, -62,
1999 385, 33, 357, 358, 136, 201, 202, 238, 239, 240,
2000 183, 241, 242, 187, 406, 407, 250, 251, 252, 253,
2001 254, 255, 289, 400, 292, 301, 291, 295, 400, 400,
2002 302, 187, 425, 324, 400, 298, 323, 326, 379, 365,
2003 370, 400, 371, 372, 373, 375, 377, 378, 380, 400,
2004 400, 381, 382, 422, 438, 414, 441, 210, 211, 212,
2005 213, 214, 215, 216, 217, 218, 219, 303, 304, 305,
2006 306, 307, 415, 416, 417, 418, 419, 423, 430, 431,
2007 315, 316, 317, 318, 444, 445, 446, 449, 450, 465,
2008 459, 466, 324, 461, 324, 324, 324, 471, 475, 467,
2009 324, 477, 488, 490, 400, 400, 400, 476, 478, 324,
2010 491, 496, 400, 479, 536, 480, 482, 492, 538, 455,
2011 493, 486, 494, 400, 400, 432, 498, 500, 501, 540,
2012 367, 368, 502, 505, 547, 507, 515, 374, 522, 508,
2013 526, 532, 548, 566, 483, 533, 539, 534, 506, 563,
2014 402, 403, 544, 400, 555, 400, 404, 567, 400, 568,
2015 571, 572, 574, 412, 400, 400, 338, 192, 337, 518,
2016 513, 420, 421, 361, 207, 204, 280, 324, 324, 324,
2017 38, 535, 518, 104, 111, 530, 457, 0, 0, 400,
2018 400, 0, 400, 400, 0, 0, 0, 400, 0, 434,
2019 435, 436, 437, 281, 0, 400, 439, 440, 282, 442,
2020 283, 0, 0, 483, 0, 0, 0, 400, 0, 553,
2021 0, 0, 0, 0, 0, 400, 451, 452, 453, 0,
2022 0, 0, 0, 0, 458, 0, 0, 0, 0, 0,
2023 0, 0, 0, 0, 0, 469, 470, 400, 0, 0,
2024 0, 0, 400, 0, 0, 0, 0, 0, 0, 472,
2025 473, 0, 0, 0, 0, 400, 400, 0, 0, 0,
2026 400, 0, 0, 400, 0, 495, 0, 497, 0, 0,
2027 499, 0, 0, 0, 0, 0, 503, 504, 0, 0,
2028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2029 0, 0, 0, 0, 509, 0, 510, 511, 0, 0,
2030 0, 516, 517, 0, 520, 521, 0, 0, 0, 525,
2031 0, 0, 0, 0, 0, 0, 0, 531, 60, 61,
2032 0, 0, 0, 0, 0, 0, 0, 0, 0, 541,
2033 0, 1, 0, 2, 0, 137, 0, 545, 0, 0,
2034 0, 0, 0, 0, 0, 0, 0, 0, 138, 139,
2035 0, 0, 0, 0, 0, 0, 0, 0, 0, 557,
2036 0, 0, 0, 0, 561, 0, 0, 0, 0, 0,
2037 0, 0, 0, 0, 0, 0, 0, 569, 570, 0,
2038 0, 0, 573, 0, 0, 575, 0, 140, 141, 142,
2039 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
2040 153, 0, 0, 0, 0, 60, 61, 0, 83, 63,
2041 64, 65, 66, 67, 68, 69, 70, 0, 1, 0,
2042 2, 0, 0, 0, 0, 0, 154, 155, 156, 157,
2043 158, 159, 160, 161, 162, 163, 164, 165, 166, 0,
2044 167, 168, 169, 170, 71, 171, 172, 173, 0, 0,
2045 0, 128, 0, 129, 0, 174, 0, 0, 175, 0,
2046 176, 0, 177, 60, 61, 0, 83, 84, 85, 86,
2047 87, 88, 89, 90, 70, 0, 1, 0, 2, 60,
2048 61, 0, 83, 84, 85, 86, 87, 88, 89, 90,
2049 70, 0, 1, 0, 2, 0, 0, 0, 0, 0,
2050 0, 0, 71, 0, 60, 61, 0, 83, 63, 64,
2051 65, 66, 67, 68, 69, 70, 0, 1, 71, 2,
2052 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2053 0, 0, 0, 196, 0, 0, 0, 0, 0, 72,
2054 0, 0, 73, 71, 0, 74, 0, 75, 203, 0,
2055 0, 0, 0, 388, 389, 60, 61, 390, 0, 0,
2056 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2057 2, 0, 391, 392, 393, 0, 0, 0, 0, 0,
2058 0, 0, 0, 0, 0, 394, 395, 0, 0, 0,
2059 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
2060 73, 0, 0, 74, 0, 75, 248, 396, 0, 0,
2061 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
2062 0, 75, 310, 0, 140, 141, 142, 143, 144, 145,
2063 146, 147, 148, 149, 150, 151, 152, 153, 72, 0,
2064 0, 73, 0, 0, 74, 0, 75, 60, 61, 0,
2065 83, 63, 64, 65, 66, 67, 68, 69, 70, 0,
2066 1, 0, 2, 154, 155, 156, 157, 158, 159, 160,
2067 161, 162, 163, 164, 165, 166, 360, 167, 168, 169,
2068 170, 0, 171, 172, 173, 0, 71, 0, 128, 0,
2069 129, 0, 0, 0, 0, 397, 388, 389, 60, 61,
2070 390, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2071 0, 1, 0, 2, 0, 391, 392, 393, 0, 0,
2072 221, 222, 0, 0, 0, 0, 0, 0, 394, 395,
2073 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 396, 60, 61, 0, 62, 63, 64, 65, 66, 67,
2076 68, 69, 70, 0, 1, 0, 2, 140, 141, 142,
2077 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
2078 153, 72, 0, 0, 73, 0, 0, 74, 0, 75,
2079 71, 223, 224, 225, 226, 227, 228, 229, 230, 231,
2080 232, 233, 234, 235, 236, 0, 154, 155, 156, 157,
2081 158, 159, 160, 161, 162, 163, 164, 165, 166, 0,
2082 167, 168, 169, 170, 0, 171, 172, 173, 388, 389,
2083 0, 0, 390, 0, 0, 0, 0, 0, 397, 0,
2084 0, 0, 0, 0, 0, 0, 0, 391, 392, 393,
2085 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2086 394, 395, 0, 0, 0, 0, 0, 0, 0, 0,
2087 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2088 0, 0, 396, 0, 0, 72, 0, 0, 73, 0,
2089 0, 74, 0, 75, 0, 0, 0, 0, 0, 140,
2090 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2091 151, 152, 153, 0, 0, 0, 0, 0, 0, 0,
2092 0, 0, 60, 61, 0, 83, 63, 64, 65, 66,
2093 67, 68, 69, 70, 0, 1, 0, 2, 154, 155,
2094 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2095 166, 384, 167, 168, 169, 170, 0, 171, 172, 173,
2096 0, 71, 0, 0, 0, 0, 0, 0, 60, 61,
2097 397, 83, 63, 64, 65, 66, 67, 68, 69, 70,
2098 0, 1, 0, 2, 0, 60, 61, 0, 83, 84,
2099 85, 86, 87, 88, 89, 90, 70, 485, 1, 0,
2100 2, 0, 0, 0, 0, 60, 61, 71, 83, 63,
2101 64, 65, 66, 67, 68, 69, 70, 0, 1, 0,
2102 2, 0, 60, 61, 71, 186, 63, 64, 65, 66,
2103 67, 68, 69, 70, 0, 1, 0, 2, 0, 0,
2104 0, 0, 60, 61, 71, 83, 84, 85, 86, 87,
2105 88, 89, 90, 70, 0, 1, 72, 2, 0, 73,
2106 0, 71, 74, 0, 75, 60, 61, 0, 327, 63,
2107 64, 65, 66, 67, 68, 69, 70, 0, 1, 0,
2108 2, 71, 0, 0, 0, 0, 0, 0, 0, 0,
2109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2110 0, 0, 72, 0, 71, 73, 0, 0, 74, 0,
2111 75, 0, 0, 0, 0, 0, 0, 0, 0, 72,
2112 0, 0, 73, 0, 0, 74, 0, 75, 0, 0,
2113 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
2114 0, 0, 73, 0, 0, 74, 0, 75, 0, 0,
2115 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
2116 0, 0, 74, 0, 75, 0, 0, 0, 0, 0,
2117 0, 0, 258, 0, 0, 0, 72, 0, 0, 73,
2118 0, 0, 74, 0, 246, 259, 0, 0, 0, 0,
2119 0, 0, 0, 0, 0, 260, 261, 0, 0, 72,
2120 0, 0, 73, 0, 0, 74, 0, 75, 262, 263,
2121 264, 265, 266, 267, 140, 141, 142, 143, 144, 145,
2122 146, 147, 148, 149, 150, 151, 268, 269, 0, 0,
2123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2124 0, 0, 0, 0, 0, 0, 0, 0, 270, 271,
2125 272, 0, 0, 273, 155, 156, 157, 158, 159, 160,
2126 161, 162, 163, 164, 165, 166, 274, 275, 168, 169,
2127 170, 276, 277, 278, 279
2130 static const short int yycheck[] =
2132 23, 0, 264, 175, 176, 262, 93, 362, 385, 4,
2133 31, 366, 11, 340, 12, 272, 298, 137, 275, 276,
2134 277, 278, 279, 25, 144, 282, 283, 31, 18, 136,
2135 20, 12, 53, 10, 11, 12, 13, 10, 11, 12,
2136 13, 208, 209, 265, 19, 33, 115, 116, 57, 0,
2137 336, 26, 75, 137, 137, 53, 48, 49, 50, 82,
2138 137, 0, 137, 285, 148, 148, 135, 18, 354, 20,
2139 21, 148, 53, 148, 246, 67, 27, 28, 137, 102,
2140 5, 6, 141, 8, 9, 10, 11, 12, 13, 14,
2141 15, 16, 93, 18, 550, 20, 47, 120, 138, 356,
2142 140, 124, 142, 54, 560, 137, 129, 58, 107, 486,
2143 137, 115, 116, 137, 146, 20, 138, 144, 140, 44,
2144 29, 30, 146, 9, 146, 115, 116, 115, 116, 136,
2145 16, 135, 487, 5, 6, 19, 8, 9, 10, 11,
2146 12, 13, 14, 15, 16, 147, 18, 135, 20, 51,
2147 52, 138, 147, 140, 41, 322, 43, 144, 415, 142,
2148 417, 418, 419, 445, 541, 36, 423, 144, 495, 136,
2149 497, 144, 44, 148, 136, 432, 137, 137, 201, 202,
2150 141, 141, 205, 138, 561, 140, 141, 136, 0, 188,
2151 60, 61, 62, 63, 64, 65, 66, 137, 138, 554,
2152 140, 556, 37, 38, 39, 136, 18, 42, 20, 21,
2153 81, 138, 20, 140, 139, 27, 28, 142, 20, 144,
2154 145, 20, 147, 246, 311, 397, 10, 11, 12, 13,
2155 137, 138, 18, 140, 20, 47, 259, 3, 4, 262,
2156 23, 24, 54, 500, 501, 502, 58, 270, 271, 272,
2157 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
2158 283, 543, 3, 4, 546, 3, 4, 139, 291, 4,
2159 142, 140, 17, 145, 4, 147, 148, 4, 540, 3,
2160 4, 3, 4, 4, 29, 30, 111, 112, 7, 551,
2161 34, 35, 37, 38, 39, 40, 41, 42, 43, 7,
2162 323, 46, 115, 116, 7, 143, 143, 140, 140, 140,
2163 311, 140, 140, 336, 337, 338, 20, 140, 140, 140,
2164 140, 137, 20, 324, 141, 140, 137, 146, 329, 330,
2165 140, 354, 355, 356, 335, 141, 140, 55, 33, 146,
2166 137, 342, 137, 137, 137, 146, 137, 137, 137, 350,
2167 351, 20, 4, 33, 146, 137, 379, 88, 89, 90,
2168 91, 92, 93, 94, 95, 96, 97, 238, 239, 240,
2169 241, 242, 137, 137, 137, 137, 137, 137, 137, 137,
2170 251, 252, 253, 254, 137, 141, 59, 137, 137, 137,
2171 142, 137, 415, 416, 417, 418, 419, 137, 137, 422,
2172 423, 137, 20, 16, 405, 406, 407, 141, 137, 432,
2173 16, 4, 413, 141, 53, 141, 141, 140, 20, 53,
2174 137, 444, 137, 424, 425, 137, 137, 137, 137, 142,
2175 301, 302, 137, 140, 4, 141, 137, 308, 137, 141,
2176 137, 141, 16, 16, 443, 141, 137, 141, 471, 137,
2177 329, 330, 144, 454, 144, 456, 335, 16, 459, 137,
2178 16, 72, 16, 342, 465, 466, 269, 107, 268, 492,
2179 487, 350, 351, 291, 129, 124, 192, 500, 501, 502,
2180 11, 512, 505, 48, 51, 505, 412, -1, -1, 490,
2181 491, -1, 493, 494, -1, -1, -1, 498, -1, 370,
2182 371, 372, 373, 192, -1, 506, 377, 378, 192, 380,
2183 192, -1, -1, 512, -1, -1, -1, 518, -1, 542,
2184 -1, -1, -1, -1, -1, 526, 405, 406, 407, -1,
2185 -1, -1, -1, -1, 413, -1, -1, -1, -1, -1,
2186 -1, -1, -1, -1, -1, 424, 425, 548, -1, -1,
2187 -1, -1, 553, -1, -1, -1, -1, -1, -1, 430,
2188 431, -1, -1, -1, -1, 566, 567, -1, -1, -1,
2189 571, -1, -1, 574, -1, 454, -1, 456, -1, -1,
2190 459, -1, -1, -1, -1, -1, 465, 466, -1, -1,
2191 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2192 -1, -1, -1, -1, 475, -1, 477, 478, -1, -1,
2193 -1, 490, 491, -1, 493, 494, -1, -1, -1, 498,
2194 -1, -1, -1, -1, -1, -1, -1, 506, 5, 6,
2195 -1, -1, -1, -1, -1, -1, -1, -1, -1, 518,
2196 -1, 18, -1, 20, -1, 22, -1, 526, -1, -1,
2197 -1, -1, -1, -1, -1, -1, -1, -1, 35, 36,
2198 -1, -1, -1, -1, -1, -1, -1, -1, -1, 548,
2199 -1, -1, -1, -1, 553, -1, -1, -1, -1, -1,
2200 -1, -1, -1, -1, -1, -1, -1, 566, 567, -1,
2201 -1, -1, 571, -1, -1, 574, -1, 74, 75, 76,
2202 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2203 87, -1, -1, -1, -1, 5, 6, -1, 8, 9,
2204 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2205 20, -1, -1, -1, -1, -1, 113, 114, 115, 116,
2206 117, 118, 119, 120, 121, 122, 123, 124, 125, -1,
2207 127, 128, 129, 130, 44, 132, 133, 134, -1, -1,
2208 -1, 138, -1, 140, -1, 142, -1, -1, 145, -1,
2209 147, -1, 149, 5, 6, -1, 8, 9, 10, 11,
2210 12, 13, 14, 15, 16, -1, 18, -1, 20, 5,
2211 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2212 16, -1, 18, -1, 20, -1, -1, -1, -1, -1,
2213 -1, -1, 44, -1, 5, 6, -1, 8, 9, 10,
2214 11, 12, 13, 14, 15, 16, -1, 18, 44, 20,
2215 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2216 -1, -1, -1, 34, -1, -1, -1, -1, -1, 139,
2217 -1, -1, 142, 44, -1, 145, -1, 147, 148, -1,
2218 -1, -1, -1, 3, 4, 5, 6, 7, -1, -1,
2219 -1, -1, -1, -1, -1, -1, -1, -1, 18, -1,
2220 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2221 -1, -1, -1, -1, -1, 35, 36, -1, -1, -1,
2222 -1, -1, -1, -1, -1, -1, -1, 139, -1, -1,
2223 142, -1, -1, 145, -1, 147, 148, 57, -1, -1,
2224 -1, -1, -1, 139, -1, -1, 142, -1, -1, 145,
2225 -1, 147, 148, -1, 74, 75, 76, 77, 78, 79,
2226 80, 81, 82, 83, 84, 85, 86, 87, 139, -1,
2227 -1, 142, -1, -1, 145, -1, 147, 5, 6, -1,
2228 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2229 18, -1, 20, 113, 114, 115, 116, 117, 118, 119,
2230 120, 121, 122, 123, 124, 125, 34, 127, 128, 129,
2231 130, -1, 132, 133, 134, -1, 44, -1, 138, -1,
2232 140, -1, -1, -1, -1, 145, 3, 4, 5, 6,
2233 7, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2234 -1, 18, -1, 20, -1, 22, 23, 24, -1, -1,
2235 23, 24, -1, -1, -1, -1, -1, -1, 35, 36,
2236 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2237 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2238 57, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2239 14, 15, 16, -1, 18, -1, 20, 74, 75, 76,
2240 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2241 87, 139, -1, -1, 142, -1, -1, 145, -1, 147,
2242 44, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2243 103, 104, 105, 106, 107, -1, 113, 114, 115, 116,
2244 117, 118, 119, 120, 121, 122, 123, 124, 125, -1,
2245 127, 128, 129, 130, -1, 132, 133, 134, 3, 4,
2246 -1, -1, 7, -1, -1, -1, -1, -1, 145, -1,
2247 -1, -1, -1, -1, -1, -1, -1, 22, 23, 24,
2248 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2249 35, 36, -1, -1, -1, -1, -1, -1, -1, -1,
2250 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2251 -1, -1, 57, -1, -1, 139, -1, -1, 142, -1,
2252 -1, 145, -1, 147, -1, -1, -1, -1, -1, 74,
2253 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2254 85, 86, 87, -1, -1, -1, -1, -1, -1, -1,
2255 -1, -1, 5, 6, -1, 8, 9, 10, 11, 12,
2256 13, 14, 15, 16, -1, 18, -1, 20, 113, 114,
2257 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2258 125, 34, 127, 128, 129, 130, -1, 132, 133, 134,
2259 -1, 44, -1, -1, -1, -1, -1, -1, 5, 6,
2260 145, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2261 -1, 18, -1, 20, -1, 5, 6, -1, 8, 9,
2262 10, 11, 12, 13, 14, 15, 16, 34, 18, -1,
2263 20, -1, -1, -1, -1, 5, 6, 44, 8, 9,
2264 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2265 20, -1, 5, 6, 44, 8, 9, 10, 11, 12,
2266 13, 14, 15, 16, -1, 18, -1, 20, -1, -1,
2267 -1, -1, 5, 6, 44, 8, 9, 10, 11, 12,
2268 13, 14, 15, 16, -1, 18, 139, 20, -1, 142,
2269 -1, 44, 145, -1, 147, 5, 6, -1, 8, 9,
2270 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2271 20, 44, -1, -1, -1, -1, -1, -1, -1, -1,
2272 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2273 -1, -1, 139, -1, 44, 142, -1, -1, 145, -1,
2274 147, -1, -1, -1, -1, -1, -1, -1, -1, 139,
2275 -1, -1, 142, -1, -1, 145, -1, 147, -1, -1,
2276 -1, -1, -1, -1, -1, -1, -1, -1, -1, 139,
2277 -1, -1, 142, -1, -1, 145, -1, 147, -1, -1,
2278 -1, -1, -1, -1, -1, -1, 139, -1, -1, 142,
2279 -1, -1, 145, -1, 147, -1, -1, -1, -1, -1,
2280 -1, -1, 32, -1, -1, -1, 139, -1, -1, 142,
2281 -1, -1, 145, -1, 147, 45, -1, -1, -1, -1,
2282 -1, -1, -1, -1, -1, 55, 56, -1, -1, 139,
2283 -1, -1, 142, -1, -1, 145, -1, 147, 68, 69,
2284 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2285 80, 81, 82, 83, 84, 85, 86, 87, -1, -1,
2286 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2287 -1, -1, -1, -1, -1, -1, -1, -1, 108, 109,
2288 110, -1, -1, 113, 114, 115, 116, 117, 118, 119,
2289 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2290 130, 131, 132, 133, 134
2293 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2294 symbol of state STATE-NUM. */
2295 static const unsigned char yystos[] =
2297 0, 18, 20, 21, 27, 28, 47, 54, 58, 160,
2298 187, 188, 189, 200, 191, 190, 48, 49, 50, 67,
2299 197, 136, 57, 17, 29, 30, 37, 38, 39, 40,
2300 41, 42, 43, 46, 161, 162, 186, 0, 189, 136,
2301 41, 43, 163, 209, 37, 38, 39, 42, 164, 206,
2302 208, 215, 136, 136, 136, 136, 142, 198, 20, 195,
2303 5, 6, 8, 9, 10, 11, 12, 13, 14, 15,
2304 16, 44, 139, 142, 145, 147, 151, 176, 177, 200,
2305 212, 186, 186, 8, 9, 10, 11, 12, 13, 14,
2306 15, 158, 159, 177, 183, 60, 61, 62, 63, 64,
2307 65, 66, 165, 204, 204, 19, 216, 217, 26, 148,
2308 207, 216, 20, 51, 52, 196, 4, 20, 20, 199,
2309 140, 4, 4, 4, 147, 148, 177, 182, 138, 140,
2310 183, 177, 23, 24, 3, 4, 7, 22, 35, 36,
2311 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2312 84, 85, 86, 87, 113, 114, 115, 116, 117, 118,
2313 119, 120, 121, 122, 123, 124, 125, 127, 128, 129,
2314 130, 132, 133, 134, 142, 145, 147, 149, 152, 153,
2315 154, 155, 184, 212, 192, 4, 8, 177, 179, 25,
2316 147, 205, 160, 220, 137, 144, 34, 177, 178, 180,
2317 181, 143, 143, 148, 182, 137, 148, 181, 193, 194,
2318 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
2319 156, 23, 24, 94, 95, 96, 97, 98, 99, 100,
2320 101, 102, 103, 104, 105, 106, 107, 157, 140, 140,
2321 140, 140, 140, 144, 183, 185, 147, 185, 148, 185,
2322 20, 140, 140, 140, 140, 137, 174, 200, 32, 45,
2323 55, 56, 68, 69, 70, 71, 72, 73, 86, 87,
2324 108, 109, 110, 113, 126, 127, 131, 132, 133, 134,
2325 152, 153, 154, 155, 218, 224, 225, 226, 227, 20,
2326 167, 137, 141, 177, 177, 146, 148, 177, 141, 174,
2327 174, 140, 140, 183, 183, 183, 183, 183, 137, 144,
2328 148, 177, 185, 146, 148, 183, 183, 183, 183, 31,
2329 53, 172, 175, 140, 177, 214, 55, 8, 214, 9,
2330 16, 10, 11, 12, 13, 158, 165, 156, 157, 177,
2331 177, 214, 177, 177, 221, 214, 214, 214, 214, 214,
2332 177, 177, 214, 214, 165, 111, 112, 115, 116, 166,
2333 34, 178, 169, 144, 146, 146, 169, 183, 183, 223,
2334 137, 137, 137, 137, 183, 146, 148, 137, 137, 33,
2335 137, 20, 4, 174, 34, 177, 202, 203, 3, 4,
2336 7, 22, 23, 24, 35, 36, 57, 145, 184, 211,
2337 212, 213, 213, 213, 213, 179, 177, 177, 137, 171,
2338 137, 171, 213, 142, 137, 137, 137, 137, 137, 137,
2339 213, 213, 33, 137, 179, 177, 214, 135, 166, 168,
2340 137, 137, 137, 141, 183, 183, 183, 183, 146, 183,
2341 183, 177, 183, 167, 137, 141, 59, 210, 185, 137,
2342 137, 213, 213, 213, 12, 53, 12, 223, 213, 142,
2343 214, 177, 214, 214, 214, 137, 137, 177, 214, 213,
2344 213, 137, 183, 183, 214, 137, 141, 137, 137, 141,
2345 141, 141, 141, 200, 201, 34, 177, 169, 20, 146,
2346 16, 16, 140, 137, 137, 213, 4, 213, 137, 213,
2347 137, 137, 137, 213, 213, 140, 177, 141, 141, 183,
2348 183, 183, 167, 172, 173, 137, 213, 213, 177, 222,
2349 213, 213, 137, 171, 171, 213, 137, 214, 214, 214,
2350 222, 213, 141, 141, 141, 201, 53, 170, 20, 137,
2351 142, 213, 137, 141, 144, 213, 141, 4, 16, 144,
2352 158, 219, 167, 177, 169, 144, 169, 213, 211, 144,
2353 158, 213, 33, 137, 211, 167, 16, 16, 137, 213,
2354 213, 16, 72, 213, 16, 213
2357 #define yyerrok (yyerrstatus = 0)
2358 #define yyclearin (yychar = YYEMPTY)
2359 #define YYEMPTY (-2)
2362 #define YYACCEPT goto yyacceptlab
2363 #define YYABORT goto yyabortlab
2364 #define YYERROR goto yyerrorlab
2367 /* Like YYERROR except do call yyerror. This remains here temporarily
2368 to ease the transition to the new meaning of YYERROR, for GCC.
2369 Once GCC version 2 has supplanted version 1, this can go. */
2371 #define YYFAIL goto yyerrlab
2373 #define YYRECOVERING() (!!yyerrstatus)
2375 #define YYBACKUP(Token, Value) \
2377 if (yychar == YYEMPTY && yylen == 1) \
2381 yytoken = YYTRANSLATE (yychar); \
2387 yyerror (YY_("syntax error: cannot back up")); \
2394 #define YYERRCODE 256
2397 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2398 If N is 0, then set CURRENT to the empty location which ends
2399 the previous symbol: RHS[0] (always defined). */
2401 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2402 #ifndef YYLLOC_DEFAULT
2403 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2407 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2408 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2409 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2410 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2414 (Current).first_line = (Current).last_line = \
2415 YYRHSLOC (Rhs, 0).last_line; \
2416 (Current).first_column = (Current).last_column = \
2417 YYRHSLOC (Rhs, 0).last_column; \
2423 /* YY_LOCATION_PRINT -- Print the location on the stream.
2424 This macro was not mandated originally: define only if we know
2425 we won't break user code: when these are the locations we know. */
2427 #ifndef YY_LOCATION_PRINT
2428 # if YYLTYPE_IS_TRIVIAL
2429 # define YY_LOCATION_PRINT(File, Loc) \
2430 fprintf (File, "%d.%d-%d.%d", \
2431 (Loc).first_line, (Loc).first_column, \
2432 (Loc).last_line, (Loc).last_column)
2434 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2439 /* YYLEX -- calling `yylex' with the right arguments. */
2442 # define YYLEX yylex (YYLEX_PARAM)
2444 # define YYLEX yylex ()
2447 /* Enable debugging if requested. */
2451 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2452 # define YYFPRINTF fprintf
2455 # define YYDPRINTF(Args) \
2461 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2465 YYFPRINTF (stderr, "%s ", Title); \
2466 yysymprint (stderr, \
2468 YYFPRINTF (stderr, "\n"); \
2472 /*------------------------------------------------------------------.
2473 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2475 `------------------------------------------------------------------*/
2477 #if defined (__STDC__) || defined (__cplusplus)
2479 yy_stack_print (short int *bottom, short int *top)
2482 yy_stack_print (bottom, top)
2487 YYFPRINTF (stderr, "Stack now");
2488 for (/* Nothing. */; bottom <= top; ++bottom)
2489 YYFPRINTF (stderr, " %d", *bottom);
2490 YYFPRINTF (stderr, "\n");
2493 # define YY_STACK_PRINT(Bottom, Top) \
2496 yy_stack_print ((Bottom), (Top)); \
2500 /*------------------------------------------------.
2501 | Report that the YYRULE is going to be reduced. |
2502 `------------------------------------------------*/
2504 #if defined (__STDC__) || defined (__cplusplus)
2506 yy_reduce_print (int yyrule)
2509 yy_reduce_print (yyrule)
2514 unsigned long int yylno = yyrline[yyrule];
2515 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2517 /* Print the symbols being reduced, and their result. */
2518 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2519 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2520 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2523 # define YY_REDUCE_PRINT(Rule) \
2526 yy_reduce_print (Rule); \
2529 /* Nonzero means print parse trace. It is left uninitialized so that
2530 multiple parsers can coexist. */
2532 #else /* !YYDEBUG */
2533 # define YYDPRINTF(Args)
2534 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2535 # define YY_STACK_PRINT(Bottom, Top)
2536 # define YY_REDUCE_PRINT(Rule)
2537 #endif /* !YYDEBUG */
2540 /* YYINITDEPTH -- initial size of the parser's stacks. */
2542 # define YYINITDEPTH 200
2545 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2546 if the built-in stack extension method is used).
2548 Do not make this value too large; the results are undefined if
2549 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2550 evaluated with infinite-precision integer arithmetic. */
2553 # define YYMAXDEPTH 10000
2561 # if defined (__GLIBC__) && defined (_STRING_H)
2562 # define yystrlen strlen
2564 /* Return the length of YYSTR. */
2566 # if defined (__STDC__) || defined (__cplusplus)
2567 yystrlen (const char *yystr)
2573 const char *yys = yystr;
2575 while (*yys++ != '\0')
2578 return yys - yystr - 1;
2584 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2585 # define yystpcpy stpcpy
2587 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2590 # if defined (__STDC__) || defined (__cplusplus)
2591 yystpcpy (char *yydest, const char *yysrc)
2593 yystpcpy (yydest, yysrc)
2599 const char *yys = yysrc;
2601 while ((*yyd++ = *yys++) != '\0')
2610 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2611 quotes and backslashes, so that it's suitable for yyerror. The
2612 heuristic is that double-quoting is unnecessary unless the string
2613 contains an apostrophe, a comma, or backslash (other than
2614 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2615 null, do not copy; instead, return the length of what the result
2618 yytnamerr (char *yyres, const char *yystr)
2623 char const *yyp = yystr;
2630 goto do_not_strip_quotes;
2634 goto do_not_strip_quotes;
2647 do_not_strip_quotes: ;
2651 return yystrlen (yystr);
2653 return yystpcpy (yyres, yystr) - yyres;
2657 #endif /* YYERROR_VERBOSE */
2662 /*--------------------------------.
2663 | Print this symbol on YYOUTPUT. |
2664 `--------------------------------*/
2666 #if defined (__STDC__) || defined (__cplusplus)
2668 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2671 yysymprint (yyoutput, yytype, yyvaluep)
2677 /* Pacify ``unused variable'' warnings. */
2680 if (yytype < YYNTOKENS)
2681 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2683 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2687 if (yytype < YYNTOKENS)
2688 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2695 YYFPRINTF (yyoutput, ")");
2698 #endif /* ! YYDEBUG */
2699 /*-----------------------------------------------.
2700 | Release the memory associated to this symbol. |
2701 `-----------------------------------------------*/
2703 #if defined (__STDC__) || defined (__cplusplus)
2705 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2708 yydestruct (yymsg, yytype, yyvaluep)
2714 /* Pacify ``unused variable'' warnings. */
2719 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2730 /* Prevent warnings from -Wmissing-prototypes. */
2732 #ifdef YYPARSE_PARAM
2733 # if defined (__STDC__) || defined (__cplusplus)
2734 int yyparse (void *YYPARSE_PARAM);
2738 #else /* ! YYPARSE_PARAM */
2739 #if defined (__STDC__) || defined (__cplusplus)
2744 #endif /* ! YYPARSE_PARAM */
2748 /* The look-ahead symbol. */
2751 /* The semantic value of the look-ahead symbol. */
2754 /* Number of syntax errors so far. */
2763 #ifdef YYPARSE_PARAM
2764 # if defined (__STDC__) || defined (__cplusplus)
2765 int yyparse (void *YYPARSE_PARAM)
2767 int yyparse (YYPARSE_PARAM)
2768 void *YYPARSE_PARAM;
2770 #else /* ! YYPARSE_PARAM */
2771 #if defined (__STDC__) || defined (__cplusplus)
2785 /* Number of tokens to shift before error messages enabled. */
2787 /* Look-ahead token as an internal (translated) token number. */
2790 /* Three stacks and their tools:
2791 `yyss': related to states,
2792 `yyvs': related to semantic values,
2793 `yyls': related to locations.
2795 Refer to the stacks thru separate pointers, to allow yyoverflow
2796 to reallocate them elsewhere. */
2798 /* The state stack. */
2799 short int yyssa[YYINITDEPTH];
2800 short int *yyss = yyssa;
2803 /* The semantic value stack. */
2804 YYSTYPE yyvsa[YYINITDEPTH];
2805 YYSTYPE *yyvs = yyvsa;
2810 #define YYPOPSTACK (yyvsp--, yyssp--)
2812 YYSIZE_T yystacksize = YYINITDEPTH;
2814 /* The variables used to return semantic value and location from the
2819 /* When reducing, the number of symbols on the RHS of the reduced
2823 YYDPRINTF ((stderr, "Starting parse\n"));
2828 yychar = YYEMPTY; /* Cause a token to be read. */
2830 /* Initialize stack pointers.
2831 Waste one element of value and location stack
2832 so that they stay on the same level as the state stack.
2833 The wasted elements are never initialized. */
2840 /*------------------------------------------------------------.
2841 | yynewstate -- Push a new state, which is found in yystate. |
2842 `------------------------------------------------------------*/
2844 /* In all cases, when you get here, the value and location stacks
2845 have just been pushed. so pushing a state here evens the stacks.
2852 if (yyss + yystacksize - 1 <= yyssp)
2854 /* Get the current used size of the three stacks, in elements. */
2855 YYSIZE_T yysize = yyssp - yyss + 1;
2859 /* Give user a chance to reallocate the stack. Use copies of
2860 these so that the &'s don't force the real ones into
2862 YYSTYPE *yyvs1 = yyvs;
2863 short int *yyss1 = yyss;
2866 /* Each stack pointer address is followed by the size of the
2867 data in use in that stack, in bytes. This used to be a
2868 conditional around just the two extra args, but that might
2869 be undefined if yyoverflow is a macro. */
2870 yyoverflow (YY_("memory exhausted"),
2871 &yyss1, yysize * sizeof (*yyssp),
2872 &yyvs1, yysize * sizeof (*yyvsp),
2879 #else /* no yyoverflow */
2880 # ifndef YYSTACK_RELOCATE
2881 goto yyexhaustedlab;
2883 /* Extend the stack our own way. */
2884 if (YYMAXDEPTH <= yystacksize)
2885 goto yyexhaustedlab;
2887 if (YYMAXDEPTH < yystacksize)
2888 yystacksize = YYMAXDEPTH;
2891 short int *yyss1 = yyss;
2892 union yyalloc *yyptr =
2893 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2895 goto yyexhaustedlab;
2896 YYSTACK_RELOCATE (yyss);
2897 YYSTACK_RELOCATE (yyvs);
2899 # undef YYSTACK_RELOCATE
2901 YYSTACK_FREE (yyss1);
2904 #endif /* no yyoverflow */
2906 yyssp = yyss + yysize - 1;
2907 yyvsp = yyvs + yysize - 1;
2910 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2911 (unsigned long int) yystacksize));
2913 if (yyss + yystacksize - 1 <= yyssp)
2917 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2926 /* Do appropriate processing given the current state. */
2927 /* Read a look-ahead token if we need one and don't already have one. */
2930 /* First try to decide what to do without reference to look-ahead token. */
2932 yyn = yypact[yystate];
2933 if (yyn == YYPACT_NINF)
2936 /* Not known => get a look-ahead token if don't already have one. */
2938 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2939 if (yychar == YYEMPTY)
2941 YYDPRINTF ((stderr, "Reading a token: "));
2945 if (yychar <= YYEOF)
2947 yychar = yytoken = YYEOF;
2948 YYDPRINTF ((stderr, "Now at end of input.\n"));
2952 yytoken = YYTRANSLATE (yychar);
2953 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2956 /* If the proper action on seeing token YYTOKEN is to reduce or to
2957 detect an error, take that action. */
2959 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2964 if (yyn == 0 || yyn == YYTABLE_NINF)
2973 /* Shift the look-ahead token. */
2974 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2976 /* Discard the token being shifted unless it is eof. */
2977 if (yychar != YYEOF)
2983 /* Count tokens shifted since error; after three, turn off error
2992 /*-----------------------------------------------------------.
2993 | yydefault -- do the default action for the current state. |
2994 `-----------------------------------------------------------*/
2996 yyn = yydefact[yystate];
3002 /*-----------------------------.
3003 | yyreduce -- Do a reduction. |
3004 `-----------------------------*/
3006 /* yyn is the number of a rule to reduce with. */
3009 /* If YYLEN is nonzero, implement the default value of the action:
3012 Otherwise, the following line sets YYVAL to garbage.
3013 This behavior is undocumented and Bison
3014 users should not rely upon it. Assigning to YYVAL
3015 unconditionally makes the parser a bit smaller, and it avoids a
3016 GCC warning that YYVAL may be used uninitialized. */
3017 yyval = yyvsp[1-yylen];
3020 YY_REDUCE_PRINT (yyn);
3024 #line 1020 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3026 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3027 GEN_ERROR("Value too large for type!");
3028 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3034 #line 1036 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3035 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3039 #line 1036 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3040 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3044 #line 1037 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3045 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3049 #line 1037 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3050 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3054 #line 1038 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3055 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3059 #line 1038 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3060 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3064 #line 1039 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3065 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3069 #line 1039 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3070 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3074 #line 1040 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3075 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3079 #line 1040 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3080 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3084 #line 1044 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3085 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3089 #line 1044 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3090 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3094 #line 1045 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3095 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3099 #line 1045 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3100 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3104 #line 1046 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3105 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3109 #line 1046 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3110 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3114 #line 1047 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3115 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3119 #line 1047 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3120 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3124 #line 1048 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3125 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3129 #line 1048 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3130 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3134 #line 1049 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3135 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3139 #line 1049 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3140 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3144 #line 1050 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3145 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3149 #line 1050 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3150 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3154 #line 1051 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3155 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3159 #line 1052 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3160 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3164 #line 1061 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3166 (yyval.StrVal) = (yyvsp[-1].StrVal);
3172 #line 1065 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3180 #line 1071 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3181 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3185 #line 1072 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3186 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3190 #line 1073 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3191 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3195 #line 1074 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3196 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3200 #line 1075 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3205 #line 1079 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3210 #line 1080 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3215 #line 1081 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3220 #line 1085 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3225 #line 1086 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3230 #line 1087 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3235 #line 1091 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3240 #line 1092 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3245 #line 1093 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3246 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3250 #line 1094 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3251 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3255 #line 1095 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3260 #line 1098 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3261 { (yyval.UIntVal) = CallingConv::C; ;}
3265 #line 1099 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3266 { (yyval.UIntVal) = CallingConv::C; ;}
3270 #line 1100 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3275 #line 1101 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3276 { (yyval.UIntVal) = CallingConv::Fast; ;}
3280 #line 1102 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3281 { (yyval.UIntVal) = CallingConv::Cold; ;}
3285 #line 1103 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3286 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3290 #line 1104 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3291 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3295 #line 1105 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3297 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3298 GEN_ERROR("Calling conv too large!");
3299 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3305 #line 1112 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3306 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3310 #line 1113 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3311 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3315 #line 1116 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3316 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3320 #line 1117 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3322 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3327 #line 1122 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3328 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3332 #line 1126 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3333 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3337 #line 1127 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3339 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3344 #line 1134 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3345 { (yyval.UIntVal) = 0; ;}
3349 #line 1135 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3351 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3352 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3353 GEN_ERROR("Alignment must be a power of two!");
3359 #line 1141 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3360 { (yyval.UIntVal) = 0; ;}
3364 #line 1142 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3366 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3367 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3368 GEN_ERROR("Alignment must be a power of two!");
3374 #line 1150 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3376 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3377 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3378 GEN_ERROR("Invalid character in section name!");
3379 (yyval.StrVal) = (yyvsp[0].StrVal);
3385 #line 1158 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3386 { (yyval.StrVal) = 0; ;}
3390 #line 1159 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3391 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3395 #line 1164 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3400 #line 1165 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3405 #line 1166 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3407 CurGV->setSection((yyvsp[0].StrVal));
3408 free((yyvsp[0].StrVal));
3414 #line 1171 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3416 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3417 GEN_ERROR("Alignment must be a power of two!");
3418 CurGV->setAlignment((yyvsp[0].UInt64Val));
3424 #line 1187 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3426 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3432 #line 1191 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3434 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3440 #line 1195 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3442 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3443 GEN_ERROR("Cannot form a pointer to a basic block");
3444 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3445 delete (yyvsp[-1].TypeVal);
3451 #line 1202 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3452 { // Named types are also simple types...
3453 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3455 (yyval.TypeVal) = new PATypeHolder(tmp);
3460 #line 1207 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3461 { // Type UpReference
3462 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3463 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3464 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3465 (yyval.TypeVal) = new PATypeHolder(OT);
3466 UR_OUT("New Upreference!\n");
3472 #line 1215 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3474 std::vector<const Type*> Params;
3475 std::vector<FunctionType::ParameterAttributes> Attrs;
3476 Attrs.push_back((yyvsp[0].ParamAttrs));
3477 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3478 Params.push_back(I->Ty->get());
3479 if (I->Ty->get() != Type::VoidTy)
3480 Attrs.push_back(I->Attrs);
3482 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3483 if (isVarArg) Params.pop_back();
3485 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3486 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3487 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3488 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3494 #line 1233 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3496 std::vector<const Type*> Params;
3497 std::vector<FunctionType::ParameterAttributes> Attrs;
3498 Attrs.push_back((yyvsp[0].ParamAttrs));
3499 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3500 Params.push_back(I->Ty->get());
3501 if (I->Ty->get() != Type::VoidTy)
3502 Attrs.push_back(I->Attrs);
3504 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3505 if (isVarArg) Params.pop_back();
3507 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3508 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3509 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3515 #line 1251 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3516 { // Sized array type?
3517 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3518 delete (yyvsp[-1].TypeVal);
3524 #line 1256 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3525 { // Packed array type?
3526 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3527 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3528 GEN_ERROR("Unsigned result not equal to signed result");
3529 if (!ElemTy->isPrimitiveType())
3530 GEN_ERROR("Elemental type of a PackedType must be primitive");
3531 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3532 GEN_ERROR("Vector length should be a power of 2!");
3533 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3534 delete (yyvsp[-1].TypeVal);
3540 #line 1268 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3541 { // Structure type?
3542 std::vector<const Type*> Elements;
3543 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3544 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3545 Elements.push_back(*I);
3547 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3548 delete (yyvsp[-1].TypeList);
3554 #line 1278 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3555 { // Empty structure type?
3556 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3562 #line 1282 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3564 std::vector<const Type*> Elements;
3565 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3566 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3567 Elements.push_back(*I);
3569 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3570 delete (yyvsp[-2].TypeList);
3576 #line 1292 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3577 { // Empty structure type?
3578 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3584 #line 1299 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3586 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3587 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3592 #line 1306 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3594 if (!UpRefs.empty())
3595 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3596 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3597 GEN_ERROR("LLVM functions cannot return aggregate types!");
3598 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3603 #line 1313 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3605 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3610 #line 1318 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3612 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3613 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3619 #line 1323 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3621 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3627 #line 1331 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3629 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3630 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3631 TWA.Ty = new PATypeHolder(Type::VoidTy);
3632 (yyval.TypeWithAttrsList)->push_back(TWA);
3638 #line 1338 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3640 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3641 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3642 TWA.Ty = new PATypeHolder(Type::VoidTy);
3643 (yyval.TypeWithAttrsList)->push_back(TWA);
3649 #line 1345 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3651 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3657 #line 1353 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3659 (yyval.TypeList) = new std::list<PATypeHolder>();
3660 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3666 #line 1358 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3668 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3674 #line 1369 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3675 { // Nonempty unsized arr
3676 if (!UpRefs.empty())
3677 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3678 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3680 GEN_ERROR("Cannot make array constant with type: '" +
3681 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3682 const Type *ETy = ATy->getElementType();
3683 int NumElements = ATy->getNumElements();
3685 // Verify that we have the correct size...
3686 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3687 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3688 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3689 itostr(NumElements) + "!");
3691 // Verify all elements are correct type!
3692 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3693 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3694 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3695 ETy->getDescription() +"' as required!\nIt is of type '"+
3696 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3699 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3700 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3706 #line 1397 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3708 if (!UpRefs.empty())
3709 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3710 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3712 GEN_ERROR("Cannot make array constant with type: '" +
3713 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3715 int NumElements = ATy->getNumElements();
3716 if (NumElements != -1 && NumElements != 0)
3717 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3718 " arguments, but has size of " + itostr(NumElements) +"!");
3719 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3720 delete (yyvsp[-2].TypeVal);
3726 #line 1413 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3728 if (!UpRefs.empty())
3729 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3730 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3732 GEN_ERROR("Cannot make array constant with type: '" +
3733 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3735 int NumElements = ATy->getNumElements();
3736 const Type *ETy = ATy->getElementType();
3737 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3738 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3739 GEN_ERROR("Can't build string constant of size " +
3740 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3741 " when array has size " + itostr(NumElements) + "!");
3742 std::vector<Constant*> Vals;
3743 if (ETy == Type::Int8Ty) {
3744 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3745 C != (unsigned char*)EndStr; ++C)
3746 Vals.push_back(ConstantInt::get(ETy, *C));
3748 free((yyvsp[0].StrVal));
3749 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3751 free((yyvsp[0].StrVal));
3752 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3753 delete (yyvsp[-2].TypeVal);
3759 #line 1442 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3760 { // Nonempty unsized arr
3761 if (!UpRefs.empty())
3762 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3763 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3765 GEN_ERROR("Cannot make packed constant with type: '" +
3766 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3767 const Type *ETy = PTy->getElementType();
3768 int NumElements = PTy->getNumElements();
3770 // Verify that we have the correct size...
3771 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3772 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3773 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3774 itostr(NumElements) + "!");
3776 // Verify all elements are correct type!
3777 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3778 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3779 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3780 ETy->getDescription() +"' as required!\nIt is of type '"+
3781 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3784 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3785 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3791 #line 1470 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3793 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3795 GEN_ERROR("Cannot make struct constant with type: '" +
3796 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3798 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3799 GEN_ERROR("Illegal number of initializers for structure type!");
3801 // Check to ensure that constants are compatible with the type initializer!
3802 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3803 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3804 GEN_ERROR("Expected type '" +
3805 STy->getElementType(i)->getDescription() +
3806 "' for element #" + utostr(i) +
3807 " of structure initializer!");
3809 // Check to ensure that Type is not packed
3810 if (STy->isPacked())
3811 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3813 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3814 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3820 #line 1495 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3822 if (!UpRefs.empty())
3823 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3824 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3826 GEN_ERROR("Cannot make struct constant with type: '" +
3827 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3829 if (STy->getNumContainedTypes() != 0)
3830 GEN_ERROR("Illegal number of initializers for structure type!");
3832 // Check to ensure that Type is not packed
3833 if (STy->isPacked())
3834 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3836 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3837 delete (yyvsp[-2].TypeVal);
3843 #line 1514 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3845 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3847 GEN_ERROR("Cannot make struct constant with type: '" +
3848 (*(yyvsp[-5].TypeVal))->getDescription() + "'!");
3850 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3851 GEN_ERROR("Illegal number of initializers for structure type!");
3853 // Check to ensure that constants are compatible with the type initializer!
3854 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3855 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3856 GEN_ERROR("Expected type '" +
3857 STy->getElementType(i)->getDescription() +
3858 "' for element #" + utostr(i) +
3859 " of structure initializer!");
3861 // Check to ensure that Type is packed
3862 if (!STy->isPacked())
3863 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3865 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3866 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3872 #line 1539 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3874 if (!UpRefs.empty())
3875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3876 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3878 GEN_ERROR("Cannot make struct constant with type: '" +
3879 (*(yyvsp[-4].TypeVal))->getDescription() + "'!");
3881 if (STy->getNumContainedTypes() != 0)
3882 GEN_ERROR("Illegal number of initializers for structure type!");
3884 // Check to ensure that Type is packed
3885 if (!STy->isPacked())
3886 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3888 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3889 delete (yyvsp[-4].TypeVal);
3895 #line 1558 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3897 if (!UpRefs.empty())
3898 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3899 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3901 GEN_ERROR("Cannot make null pointer constant with type: '" +
3902 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3904 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3905 delete (yyvsp[-1].TypeVal);
3911 #line 1570 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3913 if (!UpRefs.empty())
3914 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3915 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3916 delete (yyvsp[-1].TypeVal);
3922 #line 1577 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3924 if (!UpRefs.empty())
3925 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3926 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3928 GEN_ERROR("Global const reference must be a pointer type!");
3930 // ConstExprs can exist in the body of a function, thus creating
3931 // GlobalValues whenever they refer to a variable. Because we are in
3932 // the context of a function, getValNonImprovising will search the functions
3933 // symbol table instead of the module symbol table for the global symbol,
3934 // which throws things all off. To get around this, we just tell
3935 // getValNonImprovising that we are at global scope here.
3937 Function *SavedCurFn = CurFun.CurrentFunction;
3938 CurFun.CurrentFunction = 0;
3940 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3943 CurFun.CurrentFunction = SavedCurFn;
3945 // If this is an initializer for a constant pointer, which is referencing a
3946 // (currently) undefined variable, create a stub now that shall be replaced
3947 // in the future with the right type of variable.
3950 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3951 const PointerType *PT = cast<PointerType>(Ty);
3953 // First check to see if the forward references value is already created!
3954 PerModuleInfo::GlobalRefsType::iterator I =
3955 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3957 if (I != CurModule.GlobalRefs.end()) {
3958 V = I->second; // Placeholder already exists, use it...
3959 (yyvsp[0].ValIDVal).destroy();
3962 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3964 // Create the forward referenced global.
3966 if (const FunctionType *FTy =
3967 dyn_cast<FunctionType>(PT->getElementType())) {
3968 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3969 CurModule.CurrentModule);
3971 GV = new GlobalVariable(PT->getElementType(), false,
3972 GlobalValue::ExternalLinkage, 0,
3973 Name, CurModule.CurrentModule);
3976 // Keep track of the fact that we have a forward ref to recycle it
3977 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3982 (yyval.ConstVal) = cast<GlobalValue>(V);
3983 delete (yyvsp[-1].TypeVal); // Free the type handle
3989 #line 1640 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3991 if (!UpRefs.empty())
3992 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3993 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3994 GEN_ERROR("Mismatched types for constant expression: " +
3995 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
3996 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3997 delete (yyvsp[-1].TypeVal);
4003 #line 1650 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4005 if (!UpRefs.empty())
4006 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4007 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4008 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4009 GEN_ERROR("Cannot create a null initialized value of this type!");
4010 (yyval.ConstVal) = Constant::getNullValue(Ty);
4011 delete (yyvsp[-1].TypeVal);
4017 #line 1660 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4018 { // integral constants
4019 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4020 GEN_ERROR("Constant value doesn't fit in type!");
4021 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
4027 #line 1666 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4028 { // integral constants
4029 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4030 GEN_ERROR("Constant value doesn't fit in type!");
4031 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
4037 #line 1672 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4038 { // Boolean constants
4039 (yyval.ConstVal) = ConstantInt::getTrue();
4045 #line 1676 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4046 { // Boolean constants
4047 (yyval.ConstVal) = ConstantInt::getFalse();
4053 #line 1680 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4054 { // Float & Double constants
4055 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4056 GEN_ERROR("Floating point constant invalid for type!!");
4057 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4063 #line 1688 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4065 if (!UpRefs.empty())
4066 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4067 Constant *Val = (yyvsp[-3].ConstVal);
4068 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4069 if (!Val->getType()->isFirstClassType())
4070 GEN_ERROR("cast constant expression from a non-primitive type: '" +
4071 Val->getType()->getDescription() + "'!");
4072 if (!Ty->isFirstClassType())
4073 GEN_ERROR("cast constant expression to a non-primitive type: '" +
4074 Ty->getDescription() + "'!");
4075 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
4076 delete (yyvsp[-1].TypeVal);
4081 #line 1702 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4083 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4084 GEN_ERROR("GetElementPtr requires a pointer operand!");
4087 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
4089 GEN_ERROR("Index list invalid for constant getelementptr!");
4091 std::vector<Constant*> IdxVec;
4092 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4093 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4094 IdxVec.push_back(C);
4096 GEN_ERROR("Indices to constant getelementptr must be constants!");
4098 delete (yyvsp[-1].ValueList);
4100 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
4106 #line 1723 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4108 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
4109 GEN_ERROR("Select condition must be of boolean type!");
4110 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4111 GEN_ERROR("Select operand types must match!");
4112 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4118 #line 1731 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4120 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4121 GEN_ERROR("Binary operator types must match!");
4123 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4128 #line 1737 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4130 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4131 GEN_ERROR("Logical operator types must match!");
4132 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4133 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4134 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4135 GEN_ERROR("Logical operator requires integral operands!");
4137 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4143 #line 1748 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4145 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4146 GEN_ERROR("icmp operand types must match!");
4147 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4152 #line 1753 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4154 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4155 GEN_ERROR("fcmp operand types must match!");
4156 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4161 #line 1758 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4163 if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty)
4164 GEN_ERROR("Shift count for shift constant must be i8 type!");
4165 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4166 GEN_ERROR("Shift constant expression requires integer operand!");
4168 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4174 #line 1767 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4176 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4177 GEN_ERROR("Invalid extractelement operands!");
4178 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4184 #line 1773 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4186 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4187 GEN_ERROR("Invalid insertelement operands!");
4188 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4194 #line 1779 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4196 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4197 GEN_ERROR("Invalid shufflevector operands!");
4198 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4204 #line 1788 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4206 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4212 #line 1792 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4214 (yyval.ConstVector) = new std::vector<Constant*>();
4215 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4221 #line 1800 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4222 { (yyval.BoolVal) = false; ;}
4226 #line 1800 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4227 { (yyval.BoolVal) = true; ;}
4231 #line 1811 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4233 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4234 CurModule.ModuleDone();
4240 #line 1816 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4242 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4243 CurModule.ModuleDone();
4249 #line 1829 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4250 { CurFun.isDeclare = false ;}
4254 #line 1829 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4256 CurFun.FunctionDone();
4262 #line 1833 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4263 { CurFun.isDeclare = true; ;}
4267 #line 1833 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4274 #line 1836 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4281 #line 1839 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4283 // Emit an error if there are any unresolved types left.
4284 if (!CurModule.LateResolveTypes.empty()) {
4285 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4286 if (DID.Type == ValID::NameVal) {
4287 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4289 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4297 #line 1851 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4299 if (!UpRefs.empty())
4300 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4301 // Eagerly resolve types. This is not an optimization, this is a
4302 // requirement that is due to the fact that we could have this:
4304 // %list = type { %list * }
4305 // %list = type { %list * } ; repeated type decl
4307 // If types are not resolved eagerly, then the two types will not be
4308 // determined to be the same type!
4310 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4312 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4314 // If this is a named type that is not a redefinition, add it to the slot
4316 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4319 delete (yyvsp[0].TypeVal);
4325 #line 1875 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4327 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4329 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4331 // If this is a named type that is not a redefinition, add it to the slot
4333 CurModule.Types.push_back((yyvsp[0].PrimType));
4340 #line 1886 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4341 { /* "Externally Visible" Linkage */
4342 if ((yyvsp[0].ConstVal) == 0)
4343 GEN_ERROR("Global value initializer is not a constant!");
4344 CurGV = ParseGlobalVariable((yyvsp[-2].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal),
4345 (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4351 #line 1892 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4358 #line 1895 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4360 if ((yyvsp[0].ConstVal) == 0)
4361 GEN_ERROR("Global value initializer is not a constant!");
4362 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4368 #line 1900 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4375 #line 1903 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4377 if (!UpRefs.empty())
4378 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4379 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4381 delete (yyvsp[0].TypeVal);
4386 #line 1909 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4394 #line 1913 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4401 #line 1916 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4408 #line 1922 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4410 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4411 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4412 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4413 free((yyvsp[0].StrVal));
4415 if (AsmSoFar.empty())
4416 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4418 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4424 #line 1935 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4425 { (yyval.Endianness) = Module::BigEndian; ;}
4429 #line 1936 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4430 { (yyval.Endianness) = Module::LittleEndian; ;}
4434 #line 1938 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4436 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4442 #line 1942 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4444 if ((yyvsp[0].UInt64Val) == 32)
4445 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4446 else if ((yyvsp[0].UInt64Val) == 64)
4447 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4449 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4455 #line 1951 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4457 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4458 free((yyvsp[0].StrVal));
4463 #line 1955 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4465 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4466 free((yyvsp[0].StrVal));
4471 #line 1962 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4473 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4474 free((yyvsp[0].StrVal));
4480 #line 1967 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4482 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4483 free((yyvsp[0].StrVal));
4489 #line 1972 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4496 #line 1982 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4497 { (yyval.StrVal) = 0; ;}
4501 #line 1984 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4503 if (!UpRefs.empty())
4504 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4505 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4506 GEN_ERROR("void typed arguments are invalid!");
4507 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4508 (yyval.ArgList) = (yyvsp[-4].ArgList);
4509 (yyvsp[-4].ArgList)->push_back(E);
4515 #line 1994 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4517 if (!UpRefs.empty())
4518 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4519 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4520 GEN_ERROR("void typed arguments are invalid!");
4521 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4522 (yyval.ArgList) = new ArgListType;
4523 (yyval.ArgList)->push_back(E);
4529 #line 2005 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4531 (yyval.ArgList) = (yyvsp[0].ArgList);
4537 #line 2009 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4539 (yyval.ArgList) = (yyvsp[-2].ArgList);
4540 struct ArgListEntry E;
4541 E.Ty = new PATypeHolder(Type::VoidTy);
4543 E.Attrs = FunctionType::NoAttributeSet;
4544 (yyval.ArgList)->push_back(E);
4550 #line 2018 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4552 (yyval.ArgList) = new ArgListType;
4553 struct ArgListEntry E;
4554 E.Ty = new PATypeHolder(Type::VoidTy);
4556 E.Attrs = FunctionType::NoAttributeSet;
4557 (yyval.ArgList)->push_back(E);
4563 #line 2027 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4565 (yyval.ArgList) = 0;
4571 #line 2033 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4573 UnEscapeLexed((yyvsp[-6].StrVal));
4574 std::string FunctionName((yyvsp[-6].StrVal));
4575 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4577 // Check the function result for abstractness if this is a define. We should
4578 // have no abstract types at this point
4579 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4580 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4582 std::vector<const Type*> ParamTypeList;
4583 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4584 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4585 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4586 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4587 const Type* Ty = I->Ty->get();
4588 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4589 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4590 ParamTypeList.push_back(Ty);
4591 if (Ty != Type::VoidTy)
4592 ParamAttrs.push_back(I->Attrs);
4596 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4597 if (isVarArg) ParamTypeList.pop_back();
4599 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4601 const PointerType *PFT = PointerType::get(FT);
4602 delete (yyvsp[-7].TypeVal);
4605 if (!FunctionName.empty()) {
4606 ID = ValID::create((char*)FunctionName.c_str());
4608 ID = ValID::create((int)CurModule.Values[PFT].size());
4612 // See if this function was forward referenced. If so, recycle the object.
4613 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4614 // Move the function to the end of the list, from whereever it was
4615 // previously inserted.
4616 Fn = cast<Function>(FWRef);
4617 CurModule.CurrentModule->getFunctionList().remove(Fn);
4618 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4619 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4620 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4621 // If this is the case, either we need to be a forward decl, or it needs
4623 if (!CurFun.isDeclare && !Fn->isExternal())
4624 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4626 // Make sure to strip off any argument names so we can't get conflicts.
4627 if (Fn->isExternal())
4628 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4631 } else { // Not already defined?
4632 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4633 CurModule.CurrentModule);
4635 InsertValue(Fn, CurModule.Values);
4638 CurFun.FunctionStart(Fn);
4640 if (CurFun.isDeclare) {
4641 // If we have declaration, always overwrite linkage. This will allow us to
4642 // correctly handle cases, when pointer to function is passed as argument to
4643 // another function.
4644 Fn->setLinkage(CurFun.Linkage);
4646 Fn->setCallingConv((yyvsp[-8].UIntVal));
4647 Fn->setAlignment((yyvsp[0].UIntVal));
4648 if ((yyvsp[-1].StrVal)) {
4649 Fn->setSection((yyvsp[-1].StrVal));
4650 free((yyvsp[-1].StrVal));
4653 // Add all of the arguments we parsed to the function...
4654 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4655 if (isVarArg) { // Nuke the last entry
4656 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&&
4657 "Not a varargs marker!");
4658 delete (yyvsp[-4].ArgList)->back().Ty;
4659 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4661 Function::arg_iterator ArgIt = Fn->arg_begin();
4663 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) {
4664 delete I->Ty; // Delete the typeholder...
4665 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4671 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4678 #line 2139 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4680 (yyval.FunctionVal) = CurFun.CurrentFunction;
4682 // Make sure that we keep track of the linkage type even if there was a
4683 // previous "declare".
4684 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4689 #line 2149 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4691 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4697 #line 2154 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4699 CurFun.CurrentFunction->setLinkage((yyvsp[-1].Linkage));
4700 (yyval.FunctionVal) = CurFun.CurrentFunction;
4701 CurFun.FunctionDone();
4707 #line 2165 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4709 (yyval.BoolVal) = false;
4715 #line 2169 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4717 (yyval.BoolVal) = true;
4723 #line 2174 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4724 { // A reference to a direct constant
4725 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4731 #line 2178 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4733 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4739 #line 2182 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4740 { // Perhaps it's an FP constant?
4741 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4747 #line 2186 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4749 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4755 #line 2190 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4757 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4763 #line 2194 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4765 (yyval.ValIDVal) = ValID::createNull();
4771 #line 2198 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4773 (yyval.ValIDVal) = ValID::createUndef();
4779 #line 2202 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4780 { // A vector zero constant.
4781 (yyval.ValIDVal) = ValID::createZeroInit();
4787 #line 2206 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4788 { // Nonempty unsized packed vector
4789 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4790 int NumElements = (yyvsp[-1].ConstVector)->size();
4792 PackedType* pt = PackedType::get(ETy, NumElements);
4793 PATypeHolder* PTy = new PATypeHolder(
4801 // Verify all elements are correct type!
4802 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4803 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4804 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4805 ETy->getDescription() +"' as required!\nIt is of type '" +
4806 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4809 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4810 delete PTy; delete (yyvsp[-1].ConstVector);
4816 #line 2231 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4818 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4824 #line 2235 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4826 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4827 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4828 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4829 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4830 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4831 free((yyvsp[-2].StrVal));
4832 free((yyvsp[0].StrVal));
4838 #line 2249 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4839 { // Is it an integer reference...?
4840 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4846 #line 2253 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4847 { // Is it a named reference...?
4848 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4854 #line 2265 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4856 if (!UpRefs.empty())
4857 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4858 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4859 delete (yyvsp[-1].TypeVal);
4865 #line 2274 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4867 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4873 #line 2278 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4874 { // Do not allow functions with 0 basic blocks
4875 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4881 #line 2287 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4883 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4885 InsertValue((yyvsp[0].TermInstVal));
4887 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4888 InsertValue((yyvsp[-2].BasicBlockVal));
4889 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4895 #line 2298 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4897 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4898 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4899 if (CI2->getParent() == 0)
4900 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4901 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4902 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4908 #line 2307 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4910 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4913 // Make sure to move the basic block to the correct location in the
4914 // function, instead of leaving it inserted wherever it was first
4916 Function::BasicBlockListType &BBL =
4917 CurFun.CurrentFunction->getBasicBlockList();
4918 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4924 #line 2319 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4926 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4929 // Make sure to move the basic block to the correct location in the
4930 // function, instead of leaving it inserted wherever it was first
4932 Function::BasicBlockListType &BBL =
4933 CurFun.CurrentFunction->getBasicBlockList();
4934 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4940 #line 2332 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4941 { // Return with a result...
4942 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4948 #line 2336 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4949 { // Return with no result...
4950 (yyval.TermInstVal) = new ReturnInst();
4956 #line 2340 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4957 { // Unconditional Branch...
4958 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4960 (yyval.TermInstVal) = new BranchInst(tmpBB);
4965 #line 2345 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4967 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4969 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4971 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4973 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4978 #line 2354 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4980 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4982 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4984 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4985 (yyval.TermInstVal) = S;
4987 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4988 E = (yyvsp[-1].JumpTable)->end();
4989 for (; I != E; ++I) {
4990 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4991 S->addCase(CI, I->second);
4993 GEN_ERROR("Switch case is constant, but not a simple integer!");
4995 delete (yyvsp[-1].JumpTable);
5001 #line 2373 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5003 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5005 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5007 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5008 (yyval.TermInstVal) = S;
5014 #line 2383 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5017 // Handle the short syntax
5018 const PointerType *PFTy = 0;
5019 const FunctionType *Ty = 0;
5020 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5021 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5022 // Pull out the types of all of the arguments...
5023 std::vector<const Type*> ParamTypes;
5024 FunctionType::ParamAttrsList ParamAttrs;
5025 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5026 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
5027 const Type *Ty = I->Val->getType();
5028 if (Ty == Type::VoidTy)
5029 GEN_ERROR("Short call syntax cannot be used with varargs");
5030 ParamTypes.push_back(Ty);
5031 ParamAttrs.push_back(I->Attrs);
5034 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5035 PFTy = PointerType::get(Ty);
5038 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5040 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5042 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5045 // Check the arguments
5047 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5048 // Make sure no arguments is a good thing!
5049 if (Ty->getNumParams() != 0)
5050 GEN_ERROR("No arguments passed to a function that "
5051 "expects arguments!");
5052 } else { // Has arguments?
5053 // Loop through FunctionType's arguments and ensure they are specified
5055 FunctionType::param_iterator I = Ty->param_begin();
5056 FunctionType::param_iterator E = Ty->param_end();
5057 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5059 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5060 if (ArgI->Val->getType() != *I)
5061 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5062 (*I)->getDescription() + "'!");
5063 Args.push_back(ArgI->Val);
5066 if (Ty->isVarArg()) {
5068 for (; ArgI != ArgE; ++ArgI)
5069 Args.push_back(ArgI->Val); // push the remaining varargs
5070 } else if (I != E || ArgI != ArgE)
5071 GEN_ERROR("Invalid number of parameters detected!");
5074 // Create the InvokeInst
5075 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
5076 II->setCallingConv((yyvsp[-12].UIntVal));
5077 (yyval.TermInstVal) = II;
5078 delete (yyvsp[-8].ValueRefList);
5084 #line 2449 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5086 (yyval.TermInstVal) = new UnwindInst();
5092 #line 2453 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5094 (yyval.TermInstVal) = new UnreachableInst();
5100 #line 2460 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5102 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5103 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5106 GEN_ERROR("May only switch on a constant pool value!");
5108 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5110 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5115 #line 2471 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5117 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5118 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5122 GEN_ERROR("May only switch on a constant pool value!");
5124 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5126 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5131 #line 2484 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5133 // Is this definition named?? if so, assign the name...
5134 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5136 InsertValue((yyvsp[0].InstVal));
5137 (yyval.InstVal) = (yyvsp[0].InstVal);
5143 #line 2493 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5144 { // Used for PHI nodes
5145 if (!UpRefs.empty())
5146 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5147 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5148 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5150 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5152 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5153 delete (yyvsp[-5].TypeVal);
5158 #line 2504 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5160 (yyval.PHIList) = (yyvsp[-6].PHIList);
5161 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5163 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5165 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5170 #line 2514 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5172 if (!UpRefs.empty())
5173 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5174 // Used for call and invoke instructions
5175 (yyval.ValueRefList) = new ValueRefList();
5176 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5177 (yyval.ValueRefList)->push_back(E);
5182 #line 2522 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5184 if (!UpRefs.empty())
5185 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5186 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5187 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5188 (yyval.ValueRefList)->push_back(E);
5194 #line 2530 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5195 { (yyval.ValueRefList) = new ValueRefList(); ;}
5199 #line 2533 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5200 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5204 #line 2534 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5206 (yyval.ValueList) = (yyvsp[-2].ValueList);
5207 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5213 #line 2541 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5215 (yyval.BoolVal) = true;
5221 #line 2545 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5223 (yyval.BoolVal) = false;
5229 #line 2550 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5231 if (!UpRefs.empty())
5232 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5233 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5234 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5236 "Arithmetic operator requires integer, FP, or packed operands!");
5237 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5238 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5239 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5240 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5241 GEN_ERROR("U/S/FRem not supported on packed types!");
5242 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5244 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5246 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5247 if ((yyval.InstVal) == 0)
5248 GEN_ERROR("binary operator returned null!");
5249 delete (yyvsp[-3].TypeVal);
5254 #line 2571 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5256 if (!UpRefs.empty())
5257 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5258 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5259 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5260 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5261 GEN_ERROR("Logical operator requires integral operands!");
5263 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5265 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5267 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5268 if ((yyval.InstVal) == 0)
5269 GEN_ERROR("binary operator returned null!");
5270 delete (yyvsp[-3].TypeVal);
5275 #line 2588 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5277 if (!UpRefs.empty())
5278 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5279 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5280 GEN_ERROR("Packed types not supported by icmp instruction");
5281 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5283 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5285 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5286 if ((yyval.InstVal) == 0)
5287 GEN_ERROR("icmp operator returned null!");
5292 #line 2601 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5294 if (!UpRefs.empty())
5295 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5296 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5297 GEN_ERROR("Packed types not supported by fcmp instruction");
5298 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5300 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5302 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5303 if ((yyval.InstVal) == 0)
5304 GEN_ERROR("fcmp operator returned null!");
5309 #line 2614 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5311 cerr << "WARNING: Use of eliminated 'not' instruction:"
5312 << " Replacing with 'xor'.\n";
5314 Value *Ones = ConstantInt::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5316 GEN_ERROR("Expected integral type for not instruction!");
5318 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5319 if ((yyval.InstVal) == 0)
5320 GEN_ERROR("Could not create a xor instruction!");
5326 #line 2627 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5328 if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty)
5329 GEN_ERROR("Shift amount must be i8 type!");
5330 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5331 GEN_ERROR("Shift constant expression requires integer operand!");
5333 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5339 #line 2636 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5341 if (!UpRefs.empty())
5342 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5343 Value* Val = (yyvsp[-2].ValueVal);
5344 const Type* Ty = (yyvsp[0].TypeVal)->get();
5345 if (!Val->getType()->isFirstClassType())
5346 GEN_ERROR("cast from a non-primitive type: '" +
5347 Val->getType()->getDescription() + "'!");
5348 if (!Ty->isFirstClassType())
5349 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5350 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, (yyvsp[0].TypeVal)->get());
5351 delete (yyvsp[0].TypeVal);
5356 #line 2649 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5358 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5359 GEN_ERROR("select condition must be boolean!");
5360 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5361 GEN_ERROR("select value types should match!");
5362 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5368 #line 2657 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5370 if (!UpRefs.empty())
5371 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5372 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5373 delete (yyvsp[0].TypeVal);
5379 #line 2664 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5381 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5382 GEN_ERROR("Invalid extractelement operands!");
5383 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5389 #line 2670 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5391 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5392 GEN_ERROR("Invalid insertelement operands!");
5393 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5399 #line 2676 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5401 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5402 GEN_ERROR("Invalid shufflevector operands!");
5403 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5409 #line 2682 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5411 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5412 if (!Ty->isFirstClassType())
5413 GEN_ERROR("PHI node operands must be of first class type!");
5414 (yyval.InstVal) = new PHINode(Ty);
5415 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5416 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5417 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5418 GEN_ERROR("All elements of a PHI node must be of the same type!");
5419 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5420 (yyvsp[0].PHIList)->pop_front();
5422 delete (yyvsp[0].PHIList); // Free the list...
5428 #line 2698 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5431 // Handle the short syntax
5432 const PointerType *PFTy = 0;
5433 const FunctionType *Ty = 0;
5434 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5435 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5436 // Pull out the types of all of the arguments...
5437 std::vector<const Type*> ParamTypes;
5438 FunctionType::ParamAttrsList ParamAttrs;
5439 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5440 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5441 const Type *Ty = I->Val->getType();
5442 if (Ty == Type::VoidTy)
5443 GEN_ERROR("Short call syntax cannot be used with varargs");
5444 ParamTypes.push_back(Ty);
5445 ParamAttrs.push_back(I->Attrs);
5448 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5449 PFTy = PointerType::get(Ty);
5452 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5455 // Check the arguments
5457 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5458 // Make sure no arguments is a good thing!
5459 if (Ty->getNumParams() != 0)
5460 GEN_ERROR("No arguments passed to a function that "
5461 "expects arguments!");
5462 } else { // Has arguments?
5463 // Loop through FunctionType's arguments and ensure they are specified
5466 FunctionType::param_iterator I = Ty->param_begin();
5467 FunctionType::param_iterator E = Ty->param_end();
5468 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5470 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5471 if (ArgI->Val->getType() != *I)
5472 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5473 (*I)->getDescription() + "'!");
5474 Args.push_back(ArgI->Val);
5476 if (Ty->isVarArg()) {
5478 for (; ArgI != ArgE; ++ArgI)
5479 Args.push_back(ArgI->Val); // push the remaining varargs
5480 } else if (I != E || ArgI != ArgE)
5481 GEN_ERROR("Invalid number of parameters detected!");
5483 // Create the call node
5484 CallInst *CI = new CallInst(V, Args);
5485 CI->setTailCall((yyvsp[-7].BoolVal));
5486 CI->setCallingConv((yyvsp[-6].UIntVal));
5487 (yyval.InstVal) = CI;
5488 delete (yyvsp[-2].ValueRefList);
5494 #line 2760 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5496 (yyval.InstVal) = (yyvsp[0].InstVal);
5502 #line 2765 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5504 (yyval.BoolVal) = true;
5510 #line 2769 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5512 (yyval.BoolVal) = false;
5518 #line 2776 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5520 if (!UpRefs.empty())
5521 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5522 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5523 delete (yyvsp[-1].TypeVal);
5529 #line 2783 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5531 if (!UpRefs.empty())
5532 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5533 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5535 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5536 delete (yyvsp[-4].TypeVal);
5541 #line 2791 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5543 if (!UpRefs.empty())
5544 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5545 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5546 delete (yyvsp[-1].TypeVal);
5552 #line 2798 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5554 if (!UpRefs.empty())
5555 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5556 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5558 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5559 delete (yyvsp[-4].TypeVal);
5564 #line 2806 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5566 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5567 GEN_ERROR("Trying to free nonpointer type " +
5568 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5569 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5575 #line 2814 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5577 if (!UpRefs.empty())
5578 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5579 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5580 GEN_ERROR("Can't load from nonpointer type: " +
5581 (*(yyvsp[-1].TypeVal))->getDescription());
5582 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5583 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5584 (*(yyvsp[-1].TypeVal))->getDescription());
5585 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5587 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5588 delete (yyvsp[-1].TypeVal);
5593 #line 2828 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5595 if (!UpRefs.empty())
5596 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5597 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5599 GEN_ERROR("Can't store to a nonpointer type: " +
5600 (*(yyvsp[-1].TypeVal))->getDescription());
5601 const Type *ElTy = PT->getElementType();
5602 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5603 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5604 "' into space of type '" + ElTy->getDescription() + "'!");
5606 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5608 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5609 delete (yyvsp[-1].TypeVal);
5614 #line 2845 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5616 if (!UpRefs.empty())
5617 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5618 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5619 GEN_ERROR("getelementptr insn requires pointer operand!");
5621 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5622 GEN_ERROR("Invalid getelementptr indices for type '" +
5623 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5624 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5626 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5627 delete (yyvsp[-2].TypeVal);
5628 delete (yyvsp[0].ValueList);
5636 /* Line 1126 of yacc.c. */
5637 #line 5638 "llvmAsmParser.tab.c"
5643 YY_STACK_PRINT (yyss, yyssp);
5648 /* Now `shift' the result of the reduction. Determine what state
5649 that goes to, based on the state we popped back to and the rule
5650 number reduced by. */
5654 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5655 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5656 yystate = yytable[yystate];
5658 yystate = yydefgoto[yyn - YYNTOKENS];
5663 /*------------------------------------.
5664 | yyerrlab -- here on detecting error |
5665 `------------------------------------*/
5667 /* If not already recovering from an error, report this error. */
5672 yyn = yypact[yystate];
5674 if (YYPACT_NINF < yyn && yyn < YYLAST)
5676 int yytype = YYTRANSLATE (yychar);
5677 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5678 YYSIZE_T yysize = yysize0;
5680 int yysize_overflow = 0;
5682 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5683 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5687 /* This is so xgettext sees the translatable formats that are
5688 constructed on the fly. */
5689 YY_("syntax error, unexpected %s");
5690 YY_("syntax error, unexpected %s, expecting %s");
5691 YY_("syntax error, unexpected %s, expecting %s or %s");
5692 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5693 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5697 static char const yyunexpected[] = "syntax error, unexpected %s";
5698 static char const yyexpecting[] = ", expecting %s";
5699 static char const yyor[] = " or %s";
5700 char yyformat[sizeof yyunexpected
5701 + sizeof yyexpecting - 1
5702 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5703 * (sizeof yyor - 1))];
5704 char const *yyprefix = yyexpecting;
5706 /* Start YYX at -YYN if negative to avoid negative indexes in
5708 int yyxbegin = yyn < 0 ? -yyn : 0;
5710 /* Stay within bounds of both yycheck and yytname. */
5711 int yychecklim = YYLAST - yyn;
5712 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5715 yyarg[0] = yytname[yytype];
5716 yyfmt = yystpcpy (yyformat, yyunexpected);
5718 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5719 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5721 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5725 yyformat[sizeof yyunexpected - 1] = '\0';
5728 yyarg[yycount++] = yytname[yyx];
5729 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5730 yysize_overflow |= yysize1 < yysize;
5732 yyfmt = yystpcpy (yyfmt, yyprefix);
5736 yyf = YY_(yyformat);
5737 yysize1 = yysize + yystrlen (yyf);
5738 yysize_overflow |= yysize1 < yysize;
5741 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5742 yymsg = (char *) YYSTACK_ALLOC (yysize);
5745 /* Avoid sprintf, as that infringes on the user's name space.
5746 Don't have undefined behavior even if the translation
5747 produced a string with the wrong number of "%s"s. */
5750 while ((*yyp = *yyf))
5752 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5754 yyp += yytnamerr (yyp, yyarg[yyi++]);
5764 YYSTACK_FREE (yymsg);
5768 yyerror (YY_("syntax error"));
5769 goto yyexhaustedlab;
5773 #endif /* YYERROR_VERBOSE */
5774 yyerror (YY_("syntax error"));
5779 if (yyerrstatus == 3)
5781 /* If just tried and failed to reuse look-ahead token after an
5782 error, discard it. */
5784 if (yychar <= YYEOF)
5786 /* Return failure if at end of input. */
5787 if (yychar == YYEOF)
5792 yydestruct ("Error: discarding", yytoken, &yylval);
5797 /* Else will try to reuse look-ahead token after shifting the error
5802 /*---------------------------------------------------.
5803 | yyerrorlab -- error raised explicitly by YYERROR. |
5804 `---------------------------------------------------*/
5807 /* Pacify compilers like GCC when the user code never invokes
5808 YYERROR and the label yyerrorlab therefore never appears in user
5819 /*-------------------------------------------------------------.
5820 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5821 `-------------------------------------------------------------*/
5823 yyerrstatus = 3; /* Each real token shifted decrements this. */
5827 yyn = yypact[yystate];
5828 if (yyn != YYPACT_NINF)
5831 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5839 /* Pop the current state because it cannot handle the error token. */
5844 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5847 YY_STACK_PRINT (yyss, yyssp);
5856 /* Shift the error token. */
5857 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5863 /*-------------------------------------.
5864 | yyacceptlab -- YYACCEPT comes here. |
5865 `-------------------------------------*/
5870 /*-----------------------------------.
5871 | yyabortlab -- YYABORT comes here. |
5872 `-----------------------------------*/
5878 /*-------------------------------------------------.
5879 | yyexhaustedlab -- memory exhaustion comes here. |
5880 `-------------------------------------------------*/
5882 yyerror (YY_("memory exhausted"));
5888 if (yychar != YYEOF && yychar != YYEMPTY)
5889 yydestruct ("Cleanup: discarding lookahead",
5891 while (yyssp != yyss)
5893 yydestruct ("Cleanup: popping",
5894 yystos[*yyssp], yyvsp);
5899 YYSTACK_FREE (yyss);
5905 #line 2862 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5908 // common code from the two 'RunVMAsmParser' functions
5909 static Module* RunParser(Module * M) {
5911 llvmAsmlineno = 1; // Reset the current line number...
5912 CurModule.CurrentModule = M;
5917 // Check to make sure the parser succeeded
5920 delete ParserResult;
5924 // Check to make sure that parsing produced a result
5928 // Reset ParserResult variable while saving its value for the result.
5929 Module *Result = ParserResult;
5935 void llvm::GenerateError(const std::string &message, int LineNo) {
5936 if (LineNo == -1) LineNo = llvmAsmlineno;
5937 // TODO: column number in exception
5939 TheParseError->setError(CurFilename, message, LineNo);
5943 int yyerror(const char *ErrorMsg) {
5945 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5946 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5947 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5948 if (yychar == YYEMPTY || yychar == 0)
5949 errMsg += "end-of-file.";
5951 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5952 GenerateError(errMsg);