1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
86 ZEROINITIALIZER = 277,
123 X86_STDCALLCC_TOK = 314,
124 X86_FASTCALLCC_TOK = 315,
190 EXTRACTELEMENT = 381,
201 #define ESINT64VAL 258
202 #define EUINT64VAL 259
203 #define ESAPINTVAL 260
204 #define EUAPINTVAL 261
205 #define LOCALVAL_ID 262
206 #define GLOBALVAL_ID 263
215 #define GLOBALVAR 272
217 #define STRINGCONSTANT 274
218 #define ATSTRINGCONSTANT 275
219 #define IMPLEMENTATION 276
220 #define ZEROINITIALIZER 277
232 #define DOTDOTDOT 289
238 #define APPENDING 295
239 #define DLLIMPORT 296
240 #define DLLEXPORT 297
241 #define EXTERN_WEAK 298
252 #define SIDEEFFECT 309
255 #define FASTCC_TOK 312
256 #define COLDCC_TOK 313
257 #define X86_STDCALLCC_TOK 314
258 #define X86_FASTCALLCC_TOK 315
259 #define DATALAYOUT 316
265 #define UNREACHABLE 322
308 #define GETELEMENTPTR 365
324 #define EXTRACTELEMENT 381
325 #define INSERTELEMENT 382
326 #define SHUFFLEVECTOR 383
336 /* Copy the first part of user declarations. */
337 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
339 #include "ParserInternals.h"
340 #include "llvm/CallingConv.h"
341 #include "llvm/InlineAsm.h"
342 #include "llvm/Instructions.h"
343 #include "llvm/Module.h"
344 #include "llvm/ValueSymbolTable.h"
345 #include "llvm/Support/GetElementPtrTypeIterator.h"
346 #include "llvm/Support/CommandLine.h"
347 #include "llvm/ADT/SmallVector.h"
348 #include "llvm/ADT/STLExtras.h"
349 #include "llvm/Support/MathExtras.h"
350 #include "llvm/Support/Streams.h"
359 // The following is a gross hack. In order to rid the libAsmParser library of
360 // exceptions, we have to have a way of getting the yyparse function to go into
361 // an error situation. So, whenever we want an error to occur, the GenerateError
362 // function (see bottom of file) sets TriggerError. Then, at the end of each
363 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
364 // (a goto) to put YACC in error state. Furthermore, several calls to
365 // GenerateError are made from inside productions and they must simulate the
366 // previous exception behavior by exiting the production immediately. We have
367 // replaced these with the GEN_ERROR macro which calls GeneratError and then
368 // immediately invokes YYERROR. This would be so much cleaner if it was a
369 // recursive descent parser.
370 static bool TriggerError = false;
371 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
372 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
374 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
375 int yylex(); // declaration" of xxx warnings.
379 std::string CurFilename;
382 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
383 cl::Hidden, cl::init(false));
386 using namespace llvm;
388 static Module *ParserResult;
390 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
391 // relating to upreferences in the input stream.
393 //#define DEBUG_UPREFS 1
395 #define UR_OUT(X) cerr << X
400 #define YYERROR_VERBOSE 1
402 static GlobalVariable *CurGV;
405 // This contains info used when building the body of a function. It is
406 // destroyed when the function is completed.
408 typedef std::vector<Value *> ValueList; // Numbered defs
411 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
413 static struct PerModuleInfo {
414 Module *CurrentModule;
415 ValueList Values; // Module level numbered definitions
416 ValueList LateResolveValues;
417 std::vector<PATypeHolder> Types;
418 std::map<ValID, PATypeHolder> LateResolveTypes;
420 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
421 /// how they were referenced and on which line of the input they came from so
422 /// that we can resolve them later and print error messages as appropriate.
423 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
425 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
426 // references to global values. Global values may be referenced before they
427 // are defined, and if so, the temporary object that they represent is held
428 // here. This is used for forward references of GlobalValues.
430 typedef std::map<std::pair<const PointerType *,
431 ValID>, GlobalValue*> GlobalRefsType;
432 GlobalRefsType GlobalRefs;
435 // If we could not resolve some functions at function compilation time
436 // (calls to functions before they are defined), resolve them now... Types
437 // are resolved when the constant pool has been completely parsed.
439 ResolveDefinitions(LateResolveValues);
443 // Check to make sure that all global value forward references have been
446 if (!GlobalRefs.empty()) {
447 std::string UndefinedReferences = "Unresolved global references exist:\n";
449 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
451 UndefinedReferences += " " + I->first.first->getDescription() + " " +
452 I->first.second.getName() + "\n";
454 GenerateError(UndefinedReferences);
458 Values.clear(); // Clear out function local definitions
463 // GetForwardRefForGlobal - Check to see if there is a forward reference
464 // for this global. If so, remove it from the GlobalRefs map and return it.
465 // If not, just return null.
466 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
467 // Check to see if there is a forward reference to this global variable...
468 // if there is, eliminate it and patch the reference to use the new def'n.
469 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
470 GlobalValue *Ret = 0;
471 if (I != GlobalRefs.end()) {
478 bool TypeIsUnresolved(PATypeHolder* PATy) {
479 // If it isn't abstract, its resolved
480 const Type* Ty = PATy->get();
481 if (!Ty->isAbstract())
483 // Traverse the type looking for abstract types. If it isn't abstract then
484 // we don't need to traverse that leg of the type.
485 std::vector<const Type*> WorkList, SeenList;
486 WorkList.push_back(Ty);
487 while (!WorkList.empty()) {
488 const Type* Ty = WorkList.back();
489 SeenList.push_back(Ty);
491 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
492 // Check to see if this is an unresolved type
493 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
494 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
495 for ( ; I != E; ++I) {
496 if (I->second.get() == OpTy)
499 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
500 const Type* TheTy = SeqTy->getElementType();
501 if (TheTy->isAbstract() && TheTy != Ty) {
502 std::vector<const Type*>::iterator I = SeenList.begin(),
508 WorkList.push_back(TheTy);
510 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
511 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
512 const Type* TheTy = StrTy->getElementType(i);
513 if (TheTy->isAbstract() && TheTy != Ty) {
514 std::vector<const Type*>::iterator I = SeenList.begin(),
520 WorkList.push_back(TheTy);
531 static struct PerFunctionInfo {
532 Function *CurrentFunction; // Pointer to current function being created
534 ValueList Values; // Keep track of #'d definitions
536 ValueList LateResolveValues;
537 bool isDeclare; // Is this function a forward declararation?
538 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
539 GlobalValue::VisibilityTypes Visibility;
541 /// BBForwardRefs - When we see forward references to basic blocks, keep
542 /// track of them here.
543 std::map<ValID, BasicBlock*> BBForwardRefs;
545 inline PerFunctionInfo() {
548 Linkage = GlobalValue::ExternalLinkage;
549 Visibility = GlobalValue::DefaultVisibility;
552 inline void FunctionStart(Function *M) {
557 void FunctionDone() {
558 // Any forward referenced blocks left?
559 if (!BBForwardRefs.empty()) {
560 GenerateError("Undefined reference to label " +
561 BBForwardRefs.begin()->second->getName());
565 // Resolve all forward references now.
566 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
568 Values.clear(); // Clear out function local definitions
569 BBForwardRefs.clear();
572 Linkage = GlobalValue::ExternalLinkage;
573 Visibility = GlobalValue::DefaultVisibility;
575 } CurFun; // Info for the current function...
577 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
580 //===----------------------------------------------------------------------===//
581 // Code to handle definitions of all the types
582 //===----------------------------------------------------------------------===//
584 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
585 // Things that have names or are void typed don't get slot numbers
586 if (V->hasName() || (V->getType() == Type::VoidTy))
589 // In the case of function values, we have to allow for the forward reference
590 // of basic blocks, which are included in the numbering. Consequently, we keep
591 // track of the next insertion location with NextValNum. When a BB gets
592 // inserted, it could change the size of the CurFun.Values vector.
593 if (&ValueTab == &CurFun.Values) {
594 if (ValueTab.size() <= CurFun.NextValNum)
595 ValueTab.resize(CurFun.NextValNum+1);
596 ValueTab[CurFun.NextValNum++] = V;
599 // For all other lists, its okay to just tack it on the back of the vector.
600 ValueTab.push_back(V);
603 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
605 case ValID::LocalID: // Is it a numbered definition?
606 // Module constants occupy the lowest numbered slots...
607 if (D.Num < CurModule.Types.size())
608 return CurModule.Types[D.Num];
610 case ValID::LocalName: // Is it a named definition?
611 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
612 D.destroy(); // Free old strdup'd memory...
617 GenerateError("Internal parser error: Invalid symbol type reference");
621 // If we reached here, we referenced either a symbol that we don't know about
622 // or an id number that hasn't been read yet. We may be referencing something
623 // forward, so just create an entry to be resolved later and get to it...
625 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
628 if (inFunctionScope()) {
629 if (D.Type == ValID::LocalName) {
630 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
633 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
638 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
639 if (I != CurModule.LateResolveTypes.end())
642 Type *Typ = OpaqueType::get();
643 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
647 // getExistingVal - 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 *getExistingVal(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::LocalID: { // Is it a numbered definition?
660 // Check that the number is within bounds.
661 if (D.Num >= CurFun.Values.size())
663 Value *Result = CurFun.Values[D.Num];
664 if (Ty != Result->getType()) {
665 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
666 Result->getType()->getDescription() + "' does not match "
667 "expected type, '" + Ty->getDescription() + "'");
672 case ValID::GlobalID: { // Is it a numbered definition?
673 if (D.Num >= CurModule.Values.size())
675 Value *Result = CurModule.Values[D.Num];
676 if (Ty != Result->getType()) {
677 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
678 Result->getType()->getDescription() + "' does not match "
679 "expected type, '" + Ty->getDescription() + "'");
685 case ValID::LocalName: { // Is it a named definition?
686 if (!inFunctionScope())
688 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
689 Value *N = SymTab.lookup(D.Name);
692 if (N->getType() != Ty)
695 D.destroy(); // Free old strdup'd memory...
698 case ValID::GlobalName: { // Is it a named definition?
699 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
700 Value *N = SymTab.lookup(D.Name);
703 if (N->getType() != Ty)
706 D.destroy(); // Free old strdup'd memory...
710 // Check to make sure that "Ty" is an integral type, and that our
711 // value will fit into the specified type...
712 case ValID::ConstSIntVal: // Is it a constant pool reference??
713 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
714 GenerateError("Signed integral constant '" +
715 itostr(D.ConstPool64) + "' is invalid for type '" +
716 Ty->getDescription() + "'");
719 return ConstantInt::get(Ty, D.ConstPool64, true);
721 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
722 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
723 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
724 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
725 "' is invalid or out of range");
727 } else { // This is really a signed reference. Transmogrify.
728 return ConstantInt::get(Ty, D.ConstPool64, true);
731 return ConstantInt::get(Ty, D.UConstPool64);
734 case ValID::ConstFPVal: // Is it a floating point const pool reference?
735 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
736 GenerateError("FP constant invalid for type");
739 return ConstantFP::get(Ty, D.ConstPoolFP);
741 case ValID::ConstNullVal: // Is it a null value?
742 if (!isa<PointerType>(Ty)) {
743 GenerateError("Cannot create a a non pointer null");
746 return ConstantPointerNull::get(cast<PointerType>(Ty));
748 case ValID::ConstUndefVal: // Is it an undef value?
749 return UndefValue::get(Ty);
751 case ValID::ConstZeroVal: // Is it a zero value?
752 return Constant::getNullValue(Ty);
754 case ValID::ConstantVal: // Fully resolved constant?
755 if (D.ConstantValue->getType() != Ty) {
756 GenerateError("Constant expression type different from required type");
759 return D.ConstantValue;
761 case ValID::InlineAsmVal: { // Inline asm expression
762 const PointerType *PTy = dyn_cast<PointerType>(Ty);
763 const FunctionType *FTy =
764 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
765 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
766 GenerateError("Invalid type for asm constraint string");
769 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
770 D.IAD->HasSideEffects);
771 D.destroy(); // Free InlineAsmDescriptor.
775 assert(0 && "Unhandled case!");
779 assert(0 && "Unhandled case!");
783 // getVal - This function is identical to getExistingVal, except that if a
784 // value is not already defined, it "improvises" by creating a placeholder var
785 // that looks and acts just like the requested variable. When the value is
786 // defined later, all uses of the placeholder variable are replaced with the
789 static Value *getVal(const Type *Ty, const ValID &ID) {
790 if (Ty == Type::LabelTy) {
791 GenerateError("Cannot use a basic block here");
795 // See if the value has already been defined.
796 Value *V = getExistingVal(Ty, ID);
798 if (TriggerError) return 0;
800 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
801 GenerateError("Invalid use of a composite type");
805 // If we reached here, we referenced either a symbol that we don't know about
806 // or an id number that hasn't been read yet. We may be referencing something
807 // forward, so just create an entry to be resolved later and get to it...
809 V = new Argument(Ty);
811 // Remember where this forward reference came from. FIXME, shouldn't we try
812 // to recycle these things??
813 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
816 if (inFunctionScope())
817 InsertValue(V, CurFun.LateResolveValues);
819 InsertValue(V, CurModule.LateResolveValues);
823 /// defineBBVal - This is a definition of a new basic block with the specified
824 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
825 static BasicBlock *defineBBVal(const ValID &ID) {
826 assert(inFunctionScope() && "Can't get basic block at global scope!");
830 // First, see if this was forward referenced
832 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
833 if (BBI != CurFun.BBForwardRefs.end()) {
835 // The forward declaration could have been inserted anywhere in the
836 // function: insert it into the correct place now.
837 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
838 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
840 // Erase the forward ref from the map as its no longer "forward"
841 CurFun.BBForwardRefs.erase(ID);
843 // If its a numbered definition, bump the number and set the BB value.
844 if (ID.Type == ValID::LocalID) {
845 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
853 // We haven't seen this BB before and its first mention is a definition.
854 // Just create it and return it.
855 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
856 BB = new BasicBlock(Name, CurFun.CurrentFunction);
857 if (ID.Type == ValID::LocalID) {
858 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
862 ID.destroy(); // Free strdup'd memory
866 /// getBBVal - get an existing BB value or create a forward reference for it.
868 static BasicBlock *getBBVal(const ValID &ID) {
869 assert(inFunctionScope() && "Can't get basic block at global scope!");
873 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
874 if (BBI != CurFun.BBForwardRefs.end()) {
876 } if (ID.Type == ValID::LocalName) {
877 std::string Name = ID.Name;
878 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
880 if (N->getType()->getTypeID() == Type::LabelTyID)
881 BB = cast<BasicBlock>(N);
883 GenerateError("Reference to label '" + Name + "' is actually of type '"+
884 N->getType()->getDescription() + "'");
885 } else if (ID.Type == ValID::LocalID) {
886 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
887 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
888 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
890 GenerateError("Reference to label '%" + utostr(ID.Num) +
891 "' is actually of type '"+
892 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
895 GenerateError("Illegal label reference " + ID.getName());
899 // If its already been defined, return it now.
901 ID.destroy(); // Free strdup'd memory.
905 // Otherwise, this block has not been seen before, create it.
907 if (ID.Type == ValID::LocalName)
909 BB = new BasicBlock(Name, CurFun.CurrentFunction);
911 // Insert it in the forward refs map.
912 CurFun.BBForwardRefs[ID] = BB;
918 //===----------------------------------------------------------------------===//
919 // Code to handle forward references in instructions
920 //===----------------------------------------------------------------------===//
922 // This code handles the late binding needed with statements that reference
923 // values not defined yet... for example, a forward branch, or the PHI node for
926 // This keeps a table (CurFun.LateResolveValues) of all such forward references
927 // and back patchs after we are done.
930 // ResolveDefinitions - If we could not resolve some defs at parsing
931 // time (forward branches, phi functions for loops, etc...) resolve the
935 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
936 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
937 while (!LateResolvers.empty()) {
938 Value *V = LateResolvers.back();
939 LateResolvers.pop_back();
941 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
942 CurModule.PlaceHolderInfo.find(V);
943 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
945 ValID &DID = PHI->second.first;
947 Value *TheRealValue = getExistingVal(V->getType(), DID);
951 V->replaceAllUsesWith(TheRealValue);
953 CurModule.PlaceHolderInfo.erase(PHI);
954 } else if (FutureLateResolvers) {
955 // Functions have their unresolved items forwarded to the module late
957 InsertValue(V, *FutureLateResolvers);
959 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
960 GenerateError("Reference to an invalid definition: '" +DID.getName()+
961 "' of type '" + V->getType()->getDescription() + "'",
965 GenerateError("Reference to an invalid definition: #" +
966 itostr(DID.Num) + " of type '" +
967 V->getType()->getDescription() + "'",
973 LateResolvers.clear();
976 // ResolveTypeTo - A brand new type was just declared. This means that (if
977 // name is not null) things referencing Name can be resolved. Otherwise, things
978 // refering to the number can be resolved. Do this now.
980 static void ResolveTypeTo(char *Name, const Type *ToTy) {
982 if (Name) D = ValID::createLocalName(Name);
983 else D = ValID::createLocalID(CurModule.Types.size());
985 std::map<ValID, PATypeHolder>::iterator I =
986 CurModule.LateResolveTypes.find(D);
987 if (I != CurModule.LateResolveTypes.end()) {
988 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
989 CurModule.LateResolveTypes.erase(I);
993 // setValueName - Set the specified value to the name given. The name may be
994 // null potentially, in which case this is a noop. The string passed in is
995 // assumed to be a malloc'd string buffer, and is free'd by this function.
997 static void setValueName(Value *V, char *NameStr) {
998 if (!NameStr) return;
999 std::string Name(NameStr); // Copy string
1000 free(NameStr); // Free old string
1002 if (V->getType() == Type::VoidTy) {
1003 GenerateError("Can't assign name '" + Name+"' to value with void type");
1007 assert(inFunctionScope() && "Must be in function scope!");
1008 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1009 if (ST.lookup(Name)) {
1010 GenerateError("Redefinition of value '" + Name + "' of type '" +
1011 V->getType()->getDescription() + "'");
1019 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1020 /// this is a declaration, otherwise it is a definition.
1021 static GlobalVariable *
1022 ParseGlobalVariable(char *NameStr,
1023 GlobalValue::LinkageTypes Linkage,
1024 GlobalValue::VisibilityTypes Visibility,
1025 bool isConstantGlobal, const Type *Ty,
1026 Constant *Initializer) {
1027 if (isa<FunctionType>(Ty)) {
1028 GenerateError("Cannot declare global vars of function type");
1032 const PointerType *PTy = PointerType::get(Ty);
1036 Name = NameStr; // Copy string
1037 free(NameStr); // Free old string
1040 // See if this global value was forward referenced. If so, recycle the
1043 if (!Name.empty()) {
1044 ID = ValID::createGlobalName((char*)Name.c_str());
1046 ID = ValID::createGlobalID(CurModule.Values.size());
1049 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1050 // Move the global to the end of the list, from whereever it was
1051 // previously inserted.
1052 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1053 CurModule.CurrentModule->getGlobalList().remove(GV);
1054 CurModule.CurrentModule->getGlobalList().push_back(GV);
1055 GV->setInitializer(Initializer);
1056 GV->setLinkage(Linkage);
1057 GV->setVisibility(Visibility);
1058 GV->setConstant(isConstantGlobal);
1059 InsertValue(GV, CurModule.Values);
1063 // If this global has a name
1064 if (!Name.empty()) {
1065 // if the global we're parsing has an initializer (is a definition) and
1066 // has external linkage.
1067 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1068 // If there is already a global with external linkage with this name
1069 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1070 // If we allow this GVar to get created, it will be renamed in the
1071 // symbol table because it conflicts with an existing GVar. We can't
1072 // allow redefinition of GVars whose linking indicates that their name
1073 // must stay the same. Issue the error.
1074 GenerateError("Redefinition of global variable named '" + Name +
1075 "' of type '" + Ty->getDescription() + "'");
1080 // Otherwise there is no existing GV to use, create one now.
1081 GlobalVariable *GV =
1082 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1083 CurModule.CurrentModule);
1084 GV->setVisibility(Visibility);
1085 InsertValue(GV, CurModule.Values);
1089 // setTypeName - Set the specified type to the name given. The name may be
1090 // null potentially, in which case this is a noop. The string passed in is
1091 // assumed to be a malloc'd string buffer, and is freed by this function.
1093 // This function returns true if the type has already been defined, but is
1094 // allowed to be redefined in the specified context. If the name is a new name
1095 // for the type plane, it is inserted and false is returned.
1096 static bool setTypeName(const Type *T, char *NameStr) {
1097 assert(!inFunctionScope() && "Can't give types function-local names!");
1098 if (NameStr == 0) return false;
1100 std::string Name(NameStr); // Copy string
1101 free(NameStr); // Free old string
1103 // We don't allow assigning names to void type
1104 if (T == Type::VoidTy) {
1105 GenerateError("Can't assign name '" + Name + "' to the void type");
1109 // Set the type name, checking for conflicts as we do so.
1110 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1112 if (AlreadyExists) { // Inserting a name that is already defined???
1113 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1114 assert(Existing && "Conflict but no matching type?!");
1116 // There is only one case where this is allowed: when we are refining an
1117 // opaque type. In this case, Existing will be an opaque type.
1118 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1119 // We ARE replacing an opaque type!
1120 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1124 // Otherwise, this is an attempt to redefine a type. That's okay if
1125 // the redefinition is identical to the original. This will be so if
1126 // Existing and T point to the same Type object. In this one case we
1127 // allow the equivalent redefinition.
1128 if (Existing == T) return true; // Yes, it's equal.
1130 // Any other kind of (non-equivalent) redefinition is an error.
1131 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1132 T->getDescription() + "'");
1138 //===----------------------------------------------------------------------===//
1139 // Code for handling upreferences in type names...
1142 // TypeContains - Returns true if Ty directly contains E in it.
1144 static bool TypeContains(const Type *Ty, const Type *E) {
1145 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1146 E) != Ty->subtype_end();
1150 struct UpRefRecord {
1151 // NestingLevel - The number of nesting levels that need to be popped before
1152 // this type is resolved.
1153 unsigned NestingLevel;
1155 // LastContainedTy - This is the type at the current binding level for the
1156 // type. Every time we reduce the nesting level, this gets updated.
1157 const Type *LastContainedTy;
1159 // UpRefTy - This is the actual opaque type that the upreference is
1160 // represented with.
1161 OpaqueType *UpRefTy;
1163 UpRefRecord(unsigned NL, OpaqueType *URTy)
1164 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1168 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1169 static std::vector<UpRefRecord> UpRefs;
1171 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1172 /// called. It loops through the UpRefs vector, which is a list of the
1173 /// currently active types. For each type, if the up reference is contained in
1174 /// the newly completed type, we decrement the level count. When the level
1175 /// count reaches zero, the upreferenced type is the type that is passed in:
1176 /// thus we can complete the cycle.
1178 static PATypeHolder HandleUpRefs(const Type *ty) {
1179 // If Ty isn't abstract, or if there are no up-references in it, then there is
1180 // nothing to resolve here.
1181 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1183 PATypeHolder Ty(ty);
1184 UR_OUT("Type '" << Ty->getDescription() <<
1185 "' newly formed. Resolving upreferences.\n" <<
1186 UpRefs.size() << " upreferences active!\n");
1188 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1189 // to zero), we resolve them all together before we resolve them to Ty. At
1190 // the end of the loop, if there is anything to resolve to Ty, it will be in
1192 OpaqueType *TypeToResolve = 0;
1194 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1195 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1196 << UpRefs[i].second->getDescription() << ") = "
1197 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1198 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1199 // Decrement level of upreference
1200 unsigned Level = --UpRefs[i].NestingLevel;
1201 UpRefs[i].LastContainedTy = Ty;
1202 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1203 if (Level == 0) { // Upreference should be resolved!
1204 if (!TypeToResolve) {
1205 TypeToResolve = UpRefs[i].UpRefTy;
1207 UR_OUT(" * Resolving upreference for "
1208 << UpRefs[i].second->getDescription() << "\n";
1209 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1210 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1211 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1212 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1214 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1215 --i; // Do not skip the next element...
1220 if (TypeToResolve) {
1221 UR_OUT(" * Resolving upreference for "
1222 << UpRefs[i].second->getDescription() << "\n";
1223 std::string OldName = TypeToResolve->getDescription());
1224 TypeToResolve->refineAbstractTypeTo(Ty);
1230 //===----------------------------------------------------------------------===//
1231 // RunVMAsmParser - Define an interface to this parser
1232 //===----------------------------------------------------------------------===//
1234 static Module* RunParser(Module * M);
1236 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1239 CurFilename = Filename;
1240 return RunParser(new Module(CurFilename));
1243 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1244 set_scan_string(AsmString);
1246 CurFilename = "from_memory";
1248 return RunParser(new Module (CurFilename));
1250 return RunParser(M);
1256 /* Enabling traces. */
1261 /* Enabling verbose error messages. */
1262 #ifdef YYERROR_VERBOSE
1263 # undef YYERROR_VERBOSE
1264 # define YYERROR_VERBOSE 1
1266 # define YYERROR_VERBOSE 0
1269 /* Enabling the token table. */
1270 #ifndef YYTOKEN_TABLE
1271 # define YYTOKEN_TABLE 0
1274 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1275 #line 932 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1276 typedef union YYSTYPE {
1277 llvm::Module *ModuleVal;
1278 llvm::Function *FunctionVal;
1279 llvm::BasicBlock *BasicBlockVal;
1280 llvm::TerminatorInst *TermInstVal;
1281 llvm::Instruction *InstVal;
1282 llvm::Constant *ConstVal;
1284 const llvm::Type *PrimType;
1285 std::list<llvm::PATypeHolder> *TypeList;
1286 llvm::PATypeHolder *TypeVal;
1287 llvm::Value *ValueVal;
1288 std::vector<llvm::Value*> *ValueList;
1289 llvm::ArgListType *ArgList;
1290 llvm::TypeWithAttrs TypeWithAttrs;
1291 llvm::TypeWithAttrsList *TypeWithAttrsList;
1292 llvm::ValueRefList *ValueRefList;
1294 // Represent the RHS of PHI node
1295 std::list<std::pair<llvm::Value*,
1296 llvm::BasicBlock*> > *PHIList;
1297 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1298 std::vector<llvm::Constant*> *ConstVector;
1300 llvm::GlobalValue::LinkageTypes Linkage;
1301 llvm::GlobalValue::VisibilityTypes Visibility;
1302 llvm::FunctionType::ParameterAttributes ParamAttrs;
1303 llvm::APInt *APIntVal;
1311 char *StrVal; // This memory is strdup'd!
1312 llvm::ValID ValIDVal; // strdup'd memory maybe!
1314 llvm::Instruction::BinaryOps BinaryOpVal;
1315 llvm::Instruction::TermOps TermOpVal;
1316 llvm::Instruction::MemoryOps MemOpVal;
1317 llvm::Instruction::CastOps CastOpVal;
1318 llvm::Instruction::OtherOps OtherOpVal;
1319 llvm::ICmpInst::Predicate IPredicate;
1320 llvm::FCmpInst::Predicate FPredicate;
1322 /* Line 196 of yacc.c. */
1323 #line 1324 "llvmAsmParser.tab.c"
1324 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1325 # define YYSTYPE_IS_DECLARED 1
1326 # define YYSTYPE_IS_TRIVIAL 1
1331 /* Copy the second part of user declarations. */
1334 /* Line 219 of yacc.c. */
1335 #line 1336 "llvmAsmParser.tab.c"
1337 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1338 # define YYSIZE_T __SIZE_TYPE__
1340 #if ! defined (YYSIZE_T) && defined (size_t)
1341 # define YYSIZE_T size_t
1343 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1344 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1345 # define YYSIZE_T size_t
1347 #if ! defined (YYSIZE_T)
1348 # define YYSIZE_T unsigned int
1354 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1355 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1359 # define YY_(msgid) msgid
1363 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1365 /* The parser invokes alloca or malloc; define the necessary symbols. */
1367 # ifdef YYSTACK_USE_ALLOCA
1368 # if YYSTACK_USE_ALLOCA
1370 # define YYSTACK_ALLOC __builtin_alloca
1372 # define YYSTACK_ALLOC alloca
1373 # if defined (__STDC__) || defined (__cplusplus)
1374 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1375 # define YYINCLUDED_STDLIB_H
1381 # ifdef YYSTACK_ALLOC
1382 /* Pacify GCC's `empty if-body' warning. */
1383 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1384 # ifndef YYSTACK_ALLOC_MAXIMUM
1385 /* The OS might guarantee only one guard page at the bottom of the stack,
1386 and a page size can be as small as 4096 bytes. So we cannot safely
1387 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1388 to allow for a few compiler-allocated temporary stack slots. */
1389 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1392 # define YYSTACK_ALLOC YYMALLOC
1393 # define YYSTACK_FREE YYFREE
1394 # ifndef YYSTACK_ALLOC_MAXIMUM
1395 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1401 # define YYMALLOC malloc
1402 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1403 && (defined (__STDC__) || defined (__cplusplus)))
1404 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1408 # define YYFREE free
1409 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1410 && (defined (__STDC__) || defined (__cplusplus)))
1411 void free (void *); /* INFRINGES ON USER NAME SPACE */
1418 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1421 #if (! defined (yyoverflow) \
1422 && (! defined (__cplusplus) \
1423 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1425 /* A type that is properly aligned for any stack member. */
1432 /* The size of the maximum gap between one aligned stack and the next. */
1433 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1435 /* The size of an array large to enough to hold all stacks, each with
1437 # define YYSTACK_BYTES(N) \
1438 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1439 + YYSTACK_GAP_MAXIMUM)
1441 /* Copy COUNT objects from FROM to TO. The source and destination do
1444 # if defined (__GNUC__) && 1 < __GNUC__
1445 # define YYCOPY(To, From, Count) \
1446 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1448 # define YYCOPY(To, From, Count) \
1452 for (yyi = 0; yyi < (Count); yyi++) \
1453 (To)[yyi] = (From)[yyi]; \
1459 /* Relocate STACK from its old location to the new one. The
1460 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1461 elements in the stack, and YYPTR gives the new location of the
1462 stack. Advance YYPTR to a properly aligned location for the next
1464 # define YYSTACK_RELOCATE(Stack) \
1467 YYSIZE_T yynewbytes; \
1468 YYCOPY (&yyptr->Stack, Stack, yysize); \
1469 Stack = &yyptr->Stack; \
1470 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1471 yyptr += yynewbytes / sizeof (*yyptr); \
1477 #if defined (__STDC__) || defined (__cplusplus)
1478 typedef signed char yysigned_char;
1480 typedef short int yysigned_char;
1483 /* YYFINAL -- State number of the termination state. */
1485 /* YYLAST -- Last index in YYTABLE. */
1488 /* YYNTOKENS -- Number of terminals. */
1489 #define YYNTOKENS 148
1490 /* YYNNTS -- Number of nonterminals. */
1492 /* YYNRULES -- Number of rules. */
1493 #define YYNRULES 286
1494 /* YYNRULES -- Number of states. */
1495 #define YYNSTATES 559
1497 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1498 #define YYUNDEFTOK 2
1499 #define YYMAXUTOK 388
1501 #define YYTRANSLATE(YYX) \
1502 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1504 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1505 static const unsigned char yytranslate[] =
1507 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1511 138, 139, 136, 2, 135, 2, 2, 2, 2, 2,
1512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1513 143, 134, 144, 2, 2, 2, 2, 2, 2, 2,
1514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1516 2, 140, 137, 142, 2, 2, 2, 2, 2, 147,
1517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1519 141, 2, 2, 145, 2, 146, 2, 2, 2, 2,
1520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1532 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1533 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1534 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1535 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1536 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1537 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1538 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1539 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1540 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1541 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1542 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1543 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1544 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1545 125, 126, 127, 128, 129, 130, 131, 132, 133
1549 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1551 static const unsigned short int yyprhs[] =
1553 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1554 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1555 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1556 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1557 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1558 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1559 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1560 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1561 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1562 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1563 195, 197, 198, 201, 202, 205, 206, 210, 213, 214,
1564 216, 217, 221, 223, 226, 228, 230, 232, 234, 236,
1565 238, 241, 243, 246, 252, 258, 264, 270, 274, 277,
1566 283, 288, 291, 293, 295, 297, 301, 303, 307, 309,
1567 310, 312, 316, 321, 325, 329, 334, 339, 343, 350,
1568 356, 359, 362, 365, 368, 371, 374, 377, 380, 383,
1569 386, 389, 392, 399, 405, 414, 421, 428, 436, 444,
1570 451, 460, 469, 473, 475, 477, 479, 481, 482, 484,
1571 487, 488, 492, 493, 497, 501, 503, 507, 511, 512,
1572 519, 520, 528, 529, 537, 540, 544, 546, 550, 554,
1573 558, 562, 564, 565, 571, 575, 577, 581, 583, 584,
1574 594, 596, 598, 603, 605, 607, 610, 614, 615, 617,
1575 619, 621, 623, 625, 627, 629, 631, 633, 637, 639,
1576 645, 647, 649, 651, 653, 655, 657, 660, 663, 666,
1577 670, 673, 674, 676, 679, 682, 686, 696, 706, 715,
1578 730, 732, 734, 741, 747, 750, 757, 765, 769, 775,
1579 776, 777, 781, 784, 786, 792, 798, 805, 812, 817,
1580 824, 829, 834, 841, 848, 851, 860, 862, 864, 865,
1581 869, 876, 880, 887, 890, 895, 902
1584 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1585 static const short int yyrhs[] =
1587 188, 0, -1, 68, -1, 69, -1, 70, -1, 71,
1588 -1, 72, -1, 73, -1, 74, -1, 75, -1, 76,
1589 -1, 80, -1, 81, -1, 82, -1, 77, -1, 78,
1590 -1, 79, -1, 111, -1, 112, -1, 113, -1, 114,
1591 -1, 115, -1, 116, -1, 117, -1, 118, -1, 119,
1592 -1, 120, -1, 121, -1, 122, -1, 85, -1, 86,
1593 -1, 87, -1, 88, -1, 89, -1, 90, -1, 91,
1594 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1595 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1596 -1, 102, -1, 103, -1, 104, -1, 91, -1, 92,
1597 -1, 93, -1, 94, -1, 23, -1, 24, -1, 11,
1598 -1, 12, -1, 13, -1, 16, -1, 19, -1, 156,
1599 -1, -1, 156, 134, -1, -1, 17, -1, 20, -1,
1600 159, 134, -1, -1, 37, -1, 39, -1, 38, -1,
1601 40, -1, 42, -1, 41, -1, 43, -1, 45, -1,
1602 -1, 133, -1, -1, 41, -1, 43, -1, -1, 37,
1603 -1, 38, -1, 39, -1, 42, -1, -1, 56, -1,
1604 57, -1, 58, -1, 59, -1, 60, -1, 55, 4,
1605 -1, 112, -1, 113, -1, 130, -1, 131, -1, -1,
1606 168, 167, -1, 129, -1, 167, -1, -1, 170, 169,
1607 -1, -1, 48, 4, -1, -1, 135, 48, 4, -1,
1608 31, 19, -1, -1, 173, -1, -1, 135, 176, 175,
1609 -1, 173, -1, 48, 4, -1, 11, -1, 12, -1,
1610 13, -1, 14, -1, 44, -1, 177, -1, 178, 136,
1611 -1, 210, -1, 137, 4, -1, 178, 138, 182, 139,
1612 170, -1, 10, 138, 182, 139, 170, -1, 140, 4,
1613 141, 178, 142, -1, 143, 4, 141, 178, 144, -1,
1614 145, 183, 146, -1, 145, 146, -1, 143, 145, 183,
1615 146, 144, -1, 143, 145, 146, 144, -1, 178, 168,
1616 -1, 178, -1, 10, -1, 179, -1, 181, 135, 179,
1617 -1, 181, -1, 181, 135, 34, -1, 34, -1, -1,
1618 178, -1, 183, 135, 178, -1, 178, 140, 186, 142,
1619 -1, 178, 140, 142, -1, 178, 147, 19, -1, 178,
1620 143, 186, 144, -1, 178, 145, 186, 146, -1, 178,
1621 145, 146, -1, 178, 143, 145, 186, 146, 144, -1,
1622 178, 143, 145, 146, 144, -1, 178, 35, -1, 178,
1623 36, -1, 178, 210, -1, 178, 185, -1, 178, 22,
1624 -1, 154, 3, -1, 154, 5, -1, 154, 4, -1,
1625 154, 6, -1, 11, 23, -1, 11, 24, -1, 155,
1626 9, -1, 151, 138, 184, 33, 178, 139, -1, 110,
1627 138, 184, 221, 139, -1, 124, 138, 184, 135, 184,
1628 135, 184, 139, -1, 149, 138, 184, 135, 184, 139,
1629 -1, 150, 138, 184, 135, 184, 139, -1, 83, 152,
1630 138, 184, 135, 184, 139, -1, 84, 153, 138, 184,
1631 135, 184, 139, -1, 126, 138, 184, 135, 184, 139,
1632 -1, 127, 138, 184, 135, 184, 135, 184, 139, -1,
1633 128, 138, 184, 135, 184, 135, 184, 139, -1, 186,
1634 135, 184, -1, 184, -1, 29, -1, 30, -1, 189,
1635 -1, -1, 190, -1, 189, 190, -1, -1, 28, 191,
1636 206, -1, -1, 27, 192, 207, -1, 53, 52, 196,
1637 -1, 21, -1, 158, 15, 178, -1, 158, 15, 10,
1638 -1, -1, 160, 163, 187, 184, 193, 175, -1, -1,
1639 160, 161, 163, 187, 184, 194, 175, -1, -1, 160,
1640 162, 163, 187, 178, 195, 175, -1, 46, 197, -1,
1641 49, 134, 198, -1, 19, -1, 47, 134, 19, -1,
1642 61, 134, 19, -1, 140, 199, 142, -1, 199, 135,
1643 19, -1, 19, -1, -1, 200, 135, 178, 168, 157,
1644 -1, 178, 168, 157, -1, 200, -1, 200, 135, 34,
1645 -1, 34, -1, -1, 166, 180, 159, 138, 201, 139,
1646 170, 174, 171, -1, 25, -1, 145, -1, 165, 163,
1647 202, 203, -1, 26, -1, 146, -1, 213, 205, -1,
1648 164, 163, 202, -1, -1, 54, -1, 3, -1, 4,
1649 -1, 9, -1, 23, -1, 24, -1, 35, -1, 36,
1650 -1, 22, -1, 143, 186, 144, -1, 185, -1, 52,
1651 208, 19, 135, 19, -1, 7, -1, 8, -1, 156,
1652 -1, 159, -1, 210, -1, 209, -1, 178, 211, -1,
1653 213, 214, -1, 204, 214, -1, 215, 158, 216, -1,
1654 215, 218, -1, -1, 18, -1, 62, 212, -1, 62,
1655 10, -1, 63, 14, 211, -1, 63, 11, 211, 135,
1656 14, 211, 135, 14, 211, -1, 64, 154, 211, 135,
1657 14, 211, 140, 217, 142, -1, 64, 154, 211, 135,
1658 14, 211, 140, 142, -1, 65, 166, 180, 211, 138,
1659 220, 139, 170, 33, 14, 211, 66, 14, 211, -1,
1660 66, -1, 67, -1, 217, 154, 209, 135, 14, 211,
1661 -1, 154, 209, 135, 14, 211, -1, 158, 223, -1,
1662 178, 140, 211, 135, 211, 142, -1, 219, 135, 140,
1663 211, 135, 211, 142, -1, 178, 211, 168, -1, 220,
1664 135, 178, 211, 168, -1, -1, -1, 221, 135, 212,
1665 -1, 51, 50, -1, 50, -1, 149, 178, 211, 135,
1666 211, -1, 150, 178, 211, 135, 211, -1, 83, 152,
1667 178, 211, 135, 211, -1, 84, 153, 178, 211, 135,
1668 211, -1, 151, 212, 33, 178, -1, 124, 212, 135,
1669 212, 135, 212, -1, 125, 212, 135, 178, -1, 126,
1670 212, 135, 212, -1, 127, 212, 135, 212, 135, 212,
1671 -1, 128, 212, 135, 212, 135, 212, -1, 123, 219,
1672 -1, 222, 166, 180, 211, 138, 220, 139, 170, -1,
1673 225, -1, 32, -1, -1, 105, 178, 172, -1, 105,
1674 178, 135, 11, 211, 172, -1, 106, 178, 172, -1,
1675 106, 178, 135, 11, 211, 172, -1, 107, 212, -1,
1676 224, 108, 178, 211, -1, 224, 109, 212, 135, 178,
1677 211, -1, 110, 178, 211, 221, -1
1680 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1681 static const unsigned short int yyrline[] =
1683 0, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086,
1684 1086, 1087, 1087, 1087, 1087, 1087, 1087, 1088, 1088, 1088,
1685 1088, 1088, 1088, 1089, 1089, 1089, 1089, 1089, 1089, 1092,
1686 1092, 1093, 1093, 1094, 1094, 1095, 1095, 1096, 1096, 1100,
1687 1100, 1101, 1101, 1102, 1102, 1103, 1103, 1104, 1104, 1105,
1688 1105, 1106, 1106, 1107, 1108, 1113, 1114, 1114, 1116, 1116,
1689 1117, 1117, 1121, 1125, 1130, 1130, 1132, 1136, 1142, 1143,
1690 1144, 1145, 1146, 1150, 1151, 1152, 1156, 1157, 1161, 1162,
1691 1163, 1167, 1168, 1169, 1170, 1171, 1174, 1175, 1176, 1177,
1692 1178, 1179, 1180, 1187, 1188, 1189, 1190, 1193, 1194, 1199,
1693 1200, 1203, 1204, 1211, 1212, 1218, 1219, 1227, 1235, 1236,
1694 1241, 1242, 1243, 1248, 1261, 1261, 1261, 1261, 1264, 1268,
1695 1272, 1279, 1284, 1292, 1310, 1328, 1333, 1345, 1355, 1359,
1696 1369, 1376, 1383, 1390, 1395, 1400, 1407, 1408, 1415, 1422,
1697 1430, 1435, 1446, 1474, 1490, 1519, 1547, 1572, 1591, 1617,
1698 1637, 1649, 1656, 1722, 1732, 1742, 1748, 1758, 1764, 1774,
1699 1779, 1784, 1792, 1804, 1826, 1834, 1840, 1851, 1856, 1861,
1700 1867, 1873, 1882, 1886, 1894, 1894, 1905, 1910, 1918, 1919,
1701 1923, 1923, 1927, 1927, 1930, 1933, 1945, 1969, 1980, 1980,
1702 1990, 1990, 1998, 1998, 2008, 2011, 2017, 2030, 2034, 2039,
1703 2041, 2046, 2051, 2060, 2070, 2081, 2085, 2094, 2103, 2108,
1704 2220, 2220, 2222, 2231, 2231, 2233, 2238, 2250, 2254, 2259,
1705 2263, 2267, 2271, 2275, 2279, 2283, 2287, 2291, 2316, 2320,
1706 2334, 2338, 2342, 2346, 2352, 2352, 2358, 2367, 2371, 2380,
1707 2389, 2398, 2402, 2407, 2411, 2415, 2420, 2430, 2449, 2458,
1708 2525, 2529, 2536, 2547, 2560, 2570, 2581, 2591, 2599, 2607,
1709 2610, 2611, 2618, 2622, 2627, 2648, 2665, 2678, 2691, 2703,
1710 2711, 2718, 2724, 2730, 2736, 2751, 2815, 2820, 2824, 2831,
1711 2838, 2846, 2853, 2861, 2869, 2883, 2900
1715 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1716 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1717 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1718 static const char *const yytname[] =
1720 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1721 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1722 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1723 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1724 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1725 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1726 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1727 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1728 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1729 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1730 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1731 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1732 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1733 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1734 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1735 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1736 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1737 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1738 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1739 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT",
1740 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1741 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1742 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1743 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1744 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1745 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1746 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1747 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1748 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1749 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1750 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1751 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1752 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1753 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1754 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1755 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1756 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1757 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1758 "OptVolatile", "MemoryInst", 0
1763 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1765 static const unsigned short int yytoknum[] =
1767 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1768 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1769 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1770 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1771 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1772 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1773 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1774 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1775 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1776 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1777 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1778 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1779 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1780 385, 386, 387, 388, 61, 44, 42, 92, 40, 41,
1781 91, 120, 93, 60, 62, 123, 125, 99
1785 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1786 static const unsigned char yyr1[] =
1788 0, 148, 149, 149, 149, 149, 149, 149, 149, 149,
1789 149, 150, 150, 150, 150, 150, 150, 151, 151, 151,
1790 151, 151, 151, 151, 151, 151, 151, 151, 151, 152,
1791 152, 152, 152, 152, 152, 152, 152, 152, 152, 153,
1792 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
1793 153, 153, 153, 153, 153, 154, 155, 155, 156, 156,
1794 157, 157, 158, 158, 159, 159, 160, 160, 161, 161,
1795 161, 161, 161, 162, 162, 162, 163, 163, 164, 164,
1796 164, 165, 165, 165, 165, 165, 166, 166, 166, 166,
1797 166, 166, 166, 167, 167, 167, 167, 168, 168, 169,
1798 169, 170, 170, 171, 171, 172, 172, 173, 174, 174,
1799 175, 175, 176, 176, 177, 177, 177, 177, 178, 178,
1800 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
1801 178, 179, 180, 180, 181, 181, 182, 182, 182, 182,
1802 183, 183, 184, 184, 184, 184, 184, 184, 184, 184,
1803 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1804 184, 184, 185, 185, 185, 185, 185, 185, 185, 185,
1805 185, 185, 186, 186, 187, 187, 188, 188, 189, 189,
1806 191, 190, 192, 190, 190, 190, 190, 190, 193, 190,
1807 194, 190, 195, 190, 190, 190, 196, 197, 197, 198,
1808 199, 199, 199, 200, 200, 201, 201, 201, 201, 202,
1809 203, 203, 204, 205, 205, 206, 207, 208, 208, 209,
1810 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1811 210, 210, 210, 210, 211, 211, 212, 213, 213, 214,
1812 215, 215, 215, 216, 216, 216, 216, 216, 216, 216,
1813 216, 216, 217, 217, 218, 219, 219, 220, 220, 220,
1814 221, 221, 222, 222, 223, 223, 223, 223, 223, 223,
1815 223, 223, 223, 223, 223, 223, 223, 224, 224, 225,
1816 225, 225, 225, 225, 225, 225, 225
1819 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1820 static const unsigned char yyr2[] =
1822 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1823 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1825 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1826 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1827 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1828 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1829 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1830 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1831 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1832 1, 0, 2, 0, 2, 0, 3, 2, 0, 1,
1833 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1834 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1835 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1836 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1837 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1838 2, 2, 6, 5, 8, 6, 6, 7, 7, 6,
1839 8, 8, 3, 1, 1, 1, 1, 0, 1, 2,
1840 0, 3, 0, 3, 3, 1, 3, 3, 0, 6,
1841 0, 7, 0, 7, 2, 3, 1, 3, 3, 3,
1842 3, 1, 0, 5, 3, 1, 3, 1, 0, 9,
1843 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
1844 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
1845 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
1846 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
1847 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1848 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1849 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1853 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1854 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1855 means the default is an error. */
1856 static const unsigned short int yydefact[] =
1858 67, 58, 64, 59, 65, 185, 182, 180, 0, 0,
1859 0, 0, 0, 0, 76, 0, 67, 178, 78, 81,
1860 0, 0, 194, 0, 0, 62, 0, 66, 68, 70,
1861 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
1862 1, 179, 79, 80, 76, 183, 82, 83, 84, 85,
1863 76, 241, 181, 241, 0, 0, 202, 195, 196, 184,
1864 230, 231, 187, 114, 115, 116, 117, 118, 0, 0,
1865 0, 0, 232, 233, 119, 186, 121, 0, 0, 174,
1866 175, 0, 86, 86, 242, 238, 63, 213, 214, 215,
1867 237, 197, 198, 201, 0, 139, 122, 0, 0, 0,
1868 0, 128, 140, 0, 120, 139, 0, 0, 114, 115,
1869 116, 0, 0, 0, 188, 0, 87, 88, 89, 90,
1870 91, 0, 216, 0, 278, 240, 0, 199, 138, 97,
1871 134, 136, 0, 0, 0, 0, 0, 0, 127, 0,
1872 190, 192, 159, 160, 155, 157, 156, 158, 161, 154,
1873 150, 151, 2, 3, 4, 5, 6, 7, 8, 9,
1874 10, 14, 15, 16, 11, 12, 13, 0, 0, 0,
1875 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1876 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
1877 0, 0, 0, 153, 152, 110, 92, 133, 132, 0,
1878 210, 211, 212, 277, 263, 0, 0, 0, 0, 86,
1879 250, 251, 0, 0, 0, 0, 0, 0, 0, 0,
1880 0, 0, 0, 0, 0, 0, 0, 239, 86, 254,
1881 0, 276, 200, 131, 0, 101, 0, 0, 130, 0,
1882 141, 101, 110, 110, 29, 30, 31, 32, 33, 34,
1883 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
1884 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1885 48, 0, 0, 0, 0, 0, 0, 143, 173, 0,
1886 0, 0, 147, 0, 144, 0, 0, 0, 0, 189,
1887 0, 262, 244, 0, 243, 0, 0, 55, 0, 0,
1888 0, 0, 105, 105, 283, 0, 0, 274, 0, 0,
1889 0, 0, 0, 0, 0, 0, 0, 0, 0, 93,
1890 94, 95, 96, 98, 137, 135, 124, 125, 126, 129,
1891 123, 191, 193, 0, 0, 260, 0, 0, 0, 0,
1892 0, 142, 128, 140, 0, 145, 146, 0, 0, 0,
1893 0, 0, 112, 110, 208, 219, 220, 221, 226, 222,
1894 223, 224, 225, 217, 0, 228, 235, 234, 236, 0,
1895 245, 0, 0, 0, 0, 0, 279, 0, 281, 260,
1896 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1897 0, 0, 0, 99, 100, 102, 0, 0, 0, 0,
1898 0, 0, 0, 172, 149, 0, 0, 0, 0, 107,
1899 113, 111, 207, 97, 205, 0, 218, 0, 0, 0,
1900 0, 0, 0, 0, 0, 0, 0, 286, 0, 0,
1901 0, 270, 271, 0, 0, 0, 0, 268, 0, 284,
1902 0, 0, 0, 0, 163, 0, 0, 0, 0, 148,
1903 0, 0, 0, 61, 0, 101, 0, 227, 0, 0,
1904 259, 0, 0, 105, 106, 105, 0, 0, 0, 0,
1905 0, 264, 265, 259, 0, 0, 0, 261, 0, 169,
1906 0, 0, 165, 166, 162, 60, 204, 206, 97, 108,
1907 0, 0, 0, 0, 0, 266, 267, 0, 280, 282,
1908 0, 0, 269, 272, 273, 0, 285, 167, 168, 0,
1909 0, 0, 61, 109, 103, 229, 0, 0, 97, 0,
1910 101, 255, 0, 101, 164, 170, 171, 203, 0, 209,
1911 0, 248, 0, 0, 257, 0, 0, 256, 275, 104,
1912 246, 0, 247, 0, 97, 0, 0, 0, 258, 0,
1913 0, 0, 0, 253, 0, 0, 252, 0, 249
1916 /* YYDEFGOTO[NTERM-NUM]. */
1917 static const short int yydefgoto[] =
1919 -1, 190, 191, 192, 254, 271, 111, 112, 72, 486,
1920 12, 73, 14, 37, 38, 39, 44, 50, 121, 323,
1921 233, 395, 326, 529, 376, 352, 514, 289, 353, 74,
1922 113, 130, 199, 131, 132, 103, 278, 365, 279, 81,
1923 15, 16, 17, 19, 18, 195, 242, 243, 59, 22,
1924 57, 94, 414, 415, 122, 202, 51, 89, 52, 45,
1925 417, 366, 76, 368, 294, 53, 85, 86, 227, 533,
1926 125, 307, 494, 398, 228, 229, 230, 231
1929 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1931 #define YYPACT_NINF -440
1932 static const short int yypact[] =
1934 406, -440, -440, -440, -440, -440, -440, -440, -2, -101,
1935 21, -55, 80, -20, 15, 132, 556, -440, 253, 197,
1936 -7, 87, -440, 20, 207, -440, 893, -440, -440, -440,
1937 -440, -440, -440, -440, -440, -440, -440, 97, 97, 125,
1938 -440, -440, -440, -440, 97, -440, -440, -440, -440, -440,
1939 97, 235, -440, 6, 240, 248, 258, -440, -440, -440,
1940 -440, -440, 134, -440, -440, -440, -440, -440, 269, 277,
1941 11, 123, -440, -440, -440, 33, -440, 125, 125, -440,
1942 -440, 1055, 128, 128, -440, -440, 47, -440, -440, -440,
1943 -440, -440, -440, -440, -57, 939, -440, 154, 156, 488,
1944 134, -440, 33, -112, -440, 939, 1055, 1149, 38, 281,
1945 289, 239, 293, 850, -440, 299, -440, -440, -440, -440,
1946 -440, 1168, -440, 2, 1301, -440, 285, -440, -440, 33,
1947 -440, 170, 167, 1149, 1149, 164, -97, 1149, -440, 171,
1948 -440, 33, -440, -440, -440, -440, -440, -440, -440, -440,
1949 -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,
1950 -440, -440, -440, -440, -440, -440, -440, 254, 446, 174,
1951 -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,
1952 -440, -440, 175, 176, 177, 178, 109, 1203, 676, 290,
1953 181, 182, 183, -440, -440, 187, -440, 134, 33, 93,
1954 -440, -440, -440, -440, -440, 273, 1217, 127, 313, 128,
1955 -440, -440, 254, 446, 1149, 1149, 1149, 1149, 1149, 1149,
1956 1149, 1149, 1149, 1149, 1149, 1149, 1149, -440, 128, -440,
1957 70, -440, -440, -29, 1098, -440, 72, -39, -440, 184,
1958 33, -440, 187, 187, -440, -440, -440, -440, -440, -440,
1959 -440, -440, -440, -440, 188, -440, -440, -440, -440, -440,
1960 -440, -440, -440, -440, -440, -440, -440, -440, -440, -440,
1961 -440, 196, 1055, 1055, 1055, 1055, 1055, -440, -440, 22,
1962 771, -44, -440, -59, -440, 1055, 1055, 1055, -9, -440,
1963 198, -440, 134, 591, -440, 728, 728, -440, 728, 1168,
1964 1149, 1149, 112, 147, -440, 591, 75, 190, 200, 214,
1965 215, 217, 219, 591, 591, 322, 1168, 1149, 1149, -440,
1966 -440, -440, -440, -440, -440, -440, -41, -440, -440, -440,
1967 -41, -440, -440, 1055, 1055, -440, 230, 231, 232, 233,
1968 1055, -440, 225, 850, -43, -440, -440, 236, 241, 337,
1969 355, 371, -440, 187, 1114, -440, -440, -440, -440, -440,
1970 -440, -440, -440, 323, 1055, -440, -440, -440, -440, 243,
1971 -440, 244, 728, 591, 591, 17, -440, 19, -440, -440,
1972 728, 242, 1149, 1149, 1149, 1149, 1149, 245, 246, 1149,
1973 728, 591, 249, -440, -440, -440, 252, 255, -24, 1055,
1974 1055, 1055, 1055, -440, -440, 247, 1055, 1055, 1149, -440,
1975 -440, -440, -440, 33, 257, 260, -440, 375, -37, 383,
1976 386, 264, 268, 272, 728, 400, 728, 275, 282, 728,
1977 284, 33, -440, 295, 296, 728, 728, 33, 270, -440,
1978 1149, 1055, 1055, 1149, -440, 297, 298, 301, 303, -440,
1979 300, 302, 150, 32, 1133, -440, 305, -440, 728, 728,
1980 1149, 728, 728, 307, -440, 307, 728, 311, 1149, 1149,
1981 1149, -440, -440, 1149, 591, 308, 310, -440, 1055, -440,
1982 1055, 1055, -440, -440, -440, -440, -440, -440, 33, 46,
1983 397, 315, 314, 591, 26, -440, -440, 376, -440, -440,
1984 309, 728, -440, -440, -440, 89, -440, -440, -440, 317,
1985 319, 321, 32, -440, 413, -440, 449, 7, -440, 1149,
1986 -440, -440, 324, -440, -440, -440, -440, -440, 460, -440,
1987 728, -440, 976, 9, -29, 591, 149, -440, -41, -440,
1988 -440, 330, -440, 976, -440, 453, 454, 336, -29, 728,
1989 728, 461, 412, -440, 728, 465, -440, 728, -440
1992 /* YYPGOTO[NTERM-NUM]. */
1993 static const short int yypgoto[] =
1995 -440, 358, 359, 361, 274, 276, -206, -440, 0, -19,
1996 401, 13, -440, -440, -440, 31, -440, -440, -178, -309,
1997 -394, -440, -236, -440, -297, -1, -440, -207, -440, -440,
1998 -25, 263, -252, -440, 387, 404, -69, -110, -162, 160,
1999 -440, -440, 490, -440, -440, -440, -440, -440, -440, -440,
2000 -440, -440, -440, -440, 426, -440, -440, -440, -440, -440,
2001 -440, -439, -73, 100, -212, -440, 457, -440, -440, -440,
2002 -440, -440, 40, 135, -440, -440, -440, -440
2005 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2006 positive, shift that token. If negative, reduce the rule which
2007 number is the opposite. If zero, do what YYDEFACT says.
2008 If YYTABLE_NINF, syntax error. */
2009 #define YYTABLE_NINF -178
2010 static const short int yytable[] =
2012 11, 75, 298, 193, 304, 330, 378, 308, 309, 310,
2013 311, 312, 114, 13, 315, 98, 11, 394, 297, 453,
2014 297, 394, 350, 137, 84, 281, 283, 200, 424, 13,
2015 426, 299, 87, 23, 138, 331, 332, 140, 137, 351,
2016 194, -55, -55, -55, -55, 20, 102, 372, 1, 239,
2017 316, 3, 28, 29, 30, 31, 32, 33, 34, 21,
2018 35, 142, 143, 1, 390, 425, 3, 425, 77, 78,
2019 129, 319, 320, 24, 102, 82, 340, 350, 126, 25,
2020 129, 83, 141, 319, 320, 127, 11, 346, 393, 321,
2021 322, 340, 340, 541, 512, 26, 198, 104, 340, 105,
2022 345, 321, 322, 405, 547, 328, 392, 457, 236, 237,
2023 2, 443, 240, 4, 27, 444, 60, 61, 344, 100,
2024 108, 109, 110, 66, 534, 1, 2, 54, 3, 4,
2025 60, 61, 40, 100, 63, 64, 65, 66, 295, 1,
2026 2, 296, 3, 4, 319, 320, 411, 201, 36, 531,
2027 548, 542, 88, 67, 79, 80, 99, 340, 319, 320,
2028 56, 519, 321, 322, 341, 520, 498, 67, 499, 104,
2029 430, 105, 432, 433, 434, 393, 321, 322, 317, 318,
2030 394, 293, 545, 115, 116, 117, 118, 119, 120, 302,
2031 303, 293, 305, 306, 293, 293, 293, 293, 293, 313,
2032 314, 293, 418, 335, 336, 337, 338, 339, 104, 129,
2033 105, 104, 290, 105, 327, 380, 347, 348, 349, 489,
2034 367, 55, 367, 367, 519, 367, 58, 394, 523, 394,
2035 36, 477, 367, 193, 46, 47, 48, 106, 107, 49,
2036 367, 367, 144, 145, 146, 147, 68, 375, 104, 69,
2037 105, 277, 70, 84, 71, 343, 502, 503, 504, 91,
2038 68, 319, 320, 69, 396, 397, 70, 92, 71, 101,
2039 194, 403, 95, 96, 198, 373, 374, 93, 393, 321,
2040 322, 97, 377, 104, 536, 105, 104, 538, 105, 484,
2041 -56, 198, 391, 293, 42, 133, 43, 134, -57, 367,
2042 367, 367, 148, 196, 232, 234, 235, 367, 238, 284,
2043 241, 532, 272, 273, 274, 275, 276, 367, 367, 285,
2044 286, 287, 288, 291, 297, 381, 333, 543, 329, 413,
2045 445, 446, 447, 448, 334, 382, 354, 450, 451, 244,
2046 245, 246, 247, 248, 249, 250, 251, 252, 253, 383,
2047 384, 367, 385, 367, 386, 389, 367, 293, 431, 293,
2048 293, 293, 367, 367, 437, 399, 400, 401, 402, 404,
2049 408, 406, 475, 476, 409, 410, 407, 416, 419, 420,
2050 435, 436, 429, 452, 440, 367, 367, 441, 367, 367,
2051 442, 449, 454, 367, 456, 369, 370, 458, 371, 455,
2052 459, 367, 460, 461, 464, 379, -177, 462, 473, 509,
2053 443, 510, 511, 387, 388, 474, 515, 466, 293, 468,
2054 367, -63, 1, 2, 425, 3, 4, 5, 367, 488,
2055 469, 470, 478, 6, 7, 493, 480, 479, 481, 482,
2056 490, 483, 497, 293, 293, 293, 501, 507, 493, 508,
2057 516, 521, 8, 485, 517, 9, 524, 367, 525, 10,
2058 526, 528, 367, 530, 539, 546, 537, 549, 550, 255,
2059 256, 551, 421, 422, 423, 554, 367, 367, 555, 557,
2060 428, 367, 224, 225, 367, 226, 300, 124, 513, 301,
2061 438, 439, 139, 527, 535, 60, 61, 325, 100, 63,
2062 64, 65, 66, 136, 1, 2, 41, 3, 4, 123,
2063 90, 0, 485, 505, 427, 0, 0, 0, 0, 0,
2064 0, 0, 0, 0, 463, 0, 465, 0, 0, 467,
2065 0, 0, 67, 0, 0, 471, 472, 257, 258, 259,
2066 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
2067 270, 0, 0, 0, 0, 0, -176, 0, 491, 492,
2068 0, 495, 496, 0, 0, 0, 500, 0, 0, 0,
2069 0, -63, 1, 2, 506, 3, 4, 5, 0, 0,
2070 0, 0, 0, 6, 7, 0, 0, 0, 0, 0,
2071 0, 0, 0, 518, 355, 356, 0, 0, 60, 61,
2072 357, 522, 8, 0, 0, 9, 0, 1, 2, 10,
2073 3, 4, 0, 358, 359, 360, 0, 0, 0, 0,
2074 0, 0, 0, 0, 0, 68, 361, 362, 69, 0,
2075 540, 70, 0, 71, 135, 544, 0, 0, 0, 0,
2076 0, 0, 0, 363, 0, 0, 0, 0, 0, 552,
2077 553, 0, 0, 0, 556, 0, 0, 558, 0, 152,
2078 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2079 163, 164, 165, 166, 167, 168, 0, 0, 0, 0,
2080 0, 0, 0, 60, 61, 0, 100, 108, 109, 110,
2081 66, 0, 1, 2, 0, 3, 4, 0, 0, 0,
2082 0, 169, 170, 171, 172, 173, 174, 175, 176, 177,
2083 178, 179, 180, 181, 0, 182, 0, 183, 184, 185,
2084 67, 0, 0, 0, 0, 0, 0, 104, 0, 105,
2085 0, 355, 356, 0, 364, 60, 61, 357, 0, 0,
2086 0, 0, 0, 0, 1, 2, 0, 3, 4, 0,
2087 358, 359, 360, 0, 0, 0, 0, 0, 0, 0,
2088 0, 0, 0, 361, 362, 0, 0, 0, 0, 0,
2089 0, 0, 0, 0, 0, 0, 0, 0, 60, 61,
2090 363, 100, 108, 109, 110, 66, 0, 1, 2, 0,
2091 3, 4, 0, 0, 0, 0, 152, 153, 154, 155,
2092 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2093 166, 167, 168, 68, 0, 67, 69, 0, 0, 70,
2094 0, 71, 282, 0, 0, 0, 0, 0, 0, 0,
2095 0, 0, 0, 0, 0, 0, 0, 0, 169, 170,
2096 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
2097 181, 0, 182, 0, 183, 184, 185, 60, 61, 0,
2098 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2099 4, 364, 149, 0, 0, 0, 0, 0, 0, 0,
2100 0, 0, 0, 0, 0, 150, 151, 0, 0, 0,
2101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2102 60, 61, 0, 62, 63, 64, 65, 66, 68, 1,
2103 2, 69, 3, 4, 70, 0, 71, 342, 152, 153,
2104 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2105 164, 165, 166, 167, 168, 0, 0, 67, 0, 0,
2106 0, 0, 0, 0, 0, 0, 60, 61, 0, 100,
2107 63, 64, 65, 66, 0, 1, 2, 0, 3, 4,
2108 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2109 179, 180, 181, 128, 182, 0, 183, 184, 185, 355,
2110 356, 0, 0, 67, 0, 357, 104, 0, 105, 0,
2111 186, 0, 0, 187, 0, 188, 0, 189, 358, 359,
2112 360, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2113 0, 361, 362, 0, 0, 0, 0, 0, 0, 0,
2114 0, 0, 0, 0, 0, 0, 0, 0, 363, 0,
2115 68, 0, 0, 69, 0, 0, 70, 0, 71, 0,
2116 0, 0, 0, 0, 152, 153, 154, 155, 156, 157,
2117 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
2118 168, 0, 60, 61, 0, 100, 108, 109, 110, 66,
2119 0, 1, 2, 0, 3, 4, 68, 0, 0, 69,
2120 0, 0, 70, 0, 71, 0, 169, 170, 171, 172,
2121 173, 174, 175, 176, 177, 178, 179, 180, 181, 67,
2122 182, 0, 183, 184, 185, 60, 61, 0, 100, 63,
2123 64, 65, 66, 0, 1, 2, 0, 3, 4, 364,
2124 0, 60, 61, 0, 100, 63, 64, 65, 66, 0,
2125 1, 2, 324, 3, 4, 0, 0, 0, 0, 0,
2126 60, 61, 67, 100, 63, 64, 65, 66, 412, 1,
2127 2, 0, 3, 4, 0, 0, 60, 61, 67, 100,
2128 63, 64, 65, 66, 0, 1, 2, 487, 3, 4,
2129 0, 0, 0, 0, 0, 60, 61, 67, 197, 63,
2130 64, 65, 66, 0, 1, 2, 0, 3, 4, 0,
2131 0, 0, 68, 67, 0, 69, 0, 0, 70, 0,
2132 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2133 60, 61, 67, 100, 108, 109, 110, 66, 0, 1,
2134 2, 0, 3, 4, 60, 61, 0, 292, 63, 64,
2135 65, 66, 0, 1, 2, 68, 3, 4, 69, 0,
2136 0, 70, 0, 71, 0, 0, 0, 67, 0, 0,
2137 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2138 0, 67, 0, 0, 0, 0, 0, 0, 0, 0,
2139 68, 0, 0, 69, 0, 0, 70, 0, 71, 0,
2140 0, 0, 0, 0, 0, 0, 68, 0, 0, 69,
2141 0, 0, 70, 0, 71, 0, 0, 0, 0, 0,
2142 0, 0, 0, 0, 0, 68, 0, 0, 69, 0,
2143 0, 70, 0, 71, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2145 0, 0, 0, 203, 0, 0, 0, 0, 0, 0,
2146 68, 0, 0, 69, 0, 0, 70, 0, 280, 0,
2147 0, 204, 205, 0, 68, 0, 0, 69, 0, 0,
2148 70, 0, 71, 206, 207, 208, 209, 210, 211, 152,
2149 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2150 163, 164, 165, 166, 212, 213, 0, 0, 0, 0,
2151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2152 0, 0, 0, 0, 0, 0, 214, 215, 216, 0,
2153 0, 217, 170, 171, 172, 173, 174, 175, 176, 177,
2154 178, 179, 180, 181, 218, 219, 220, 221, 222, 223
2157 static const short int yycheck[] =
2159 0, 26, 208, 113, 216, 241, 303, 219, 220, 221,
2160 222, 223, 81, 0, 226, 4, 16, 326, 11, 413,
2161 11, 330, 31, 135, 18, 187, 188, 25, 11, 16,
2162 11, 209, 26, 134, 146, 242, 243, 106, 135, 48,
2163 113, 3, 4, 5, 6, 47, 71, 299, 16, 146,
2164 228, 19, 37, 38, 39, 40, 41, 42, 43, 61,
2165 45, 23, 24, 16, 316, 48, 19, 48, 37, 38,
2166 95, 112, 113, 52, 99, 44, 135, 31, 135, 134,
2167 105, 50, 107, 112, 113, 142, 86, 146, 129, 130,
2168 131, 135, 135, 532, 488, 15, 121, 136, 135, 138,
2169 144, 130, 131, 146, 543, 144, 318, 144, 133, 134,
2170 17, 135, 137, 20, 134, 139, 7, 8, 280, 10,
2171 11, 12, 13, 14, 518, 16, 17, 134, 19, 20,
2172 7, 8, 0, 10, 11, 12, 13, 14, 11, 16,
2173 17, 14, 19, 20, 112, 113, 353, 145, 133, 142,
2174 544, 142, 146, 44, 29, 30, 145, 135, 112, 113,
2175 140, 135, 130, 131, 142, 139, 463, 44, 465, 136,
2176 382, 138, 384, 385, 386, 129, 130, 131, 108, 109,
2177 489, 206, 33, 55, 56, 57, 58, 59, 60, 214,
2178 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
2179 225, 226, 364, 272, 273, 274, 275, 276, 136, 234,
2180 138, 136, 199, 138, 142, 140, 285, 286, 287, 455,
2181 293, 134, 295, 296, 135, 298, 19, 536, 139, 538,
2182 133, 443, 305, 343, 37, 38, 39, 77, 78, 42,
2183 313, 314, 3, 4, 5, 6, 137, 135, 136, 140,
2184 138, 142, 143, 18, 145, 280, 468, 469, 470, 19,
2185 137, 112, 113, 140, 333, 334, 143, 19, 145, 146,
2186 343, 340, 138, 4, 299, 300, 301, 19, 129, 130,
2187 131, 4, 135, 136, 520, 138, 136, 523, 138, 139,
2188 9, 316, 317, 318, 41, 141, 43, 141, 9, 372,
2189 373, 374, 9, 4, 19, 135, 139, 380, 144, 19,
2190 139, 517, 138, 138, 138, 138, 138, 390, 391, 138,
2191 138, 138, 135, 50, 11, 135, 138, 533, 144, 354,
2192 399, 400, 401, 402, 138, 135, 138, 406, 407, 85,
2193 86, 87, 88, 89, 90, 91, 92, 93, 94, 135,
2194 135, 424, 135, 426, 135, 33, 429, 382, 383, 384,
2195 385, 386, 435, 436, 389, 135, 135, 135, 135, 144,
2196 33, 135, 441, 442, 19, 4, 135, 54, 135, 135,
2197 135, 135, 140, 408, 135, 458, 459, 135, 461, 462,
2198 135, 144, 135, 466, 19, 295, 296, 14, 298, 139,
2199 14, 474, 138, 135, 4, 305, 0, 135, 138, 478,
2200 135, 480, 481, 313, 314, 440, 19, 135, 443, 135,
2201 493, 15, 16, 17, 48, 19, 20, 21, 501, 454,
2202 135, 135, 135, 27, 28, 460, 135, 139, 135, 139,
2203 135, 139, 135, 468, 469, 470, 135, 139, 473, 139,
2204 135, 142, 46, 453, 140, 49, 139, 530, 139, 53,
2205 139, 48, 535, 14, 4, 135, 142, 14, 14, 23,
2206 24, 135, 372, 373, 374, 14, 549, 550, 66, 14,
2207 380, 554, 124, 124, 557, 124, 212, 86, 489, 213,
2208 390, 391, 105, 512, 519, 7, 8, 234, 10, 11,
2209 12, 13, 14, 99, 16, 17, 16, 19, 20, 83,
2210 53, -1, 512, 473, 379, -1, -1, -1, -1, -1,
2211 -1, -1, -1, -1, 424, -1, 426, -1, -1, 429,
2212 -1, -1, 44, -1, -1, 435, 436, 91, 92, 93,
2213 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2214 104, -1, -1, -1, -1, -1, 0, -1, 458, 459,
2215 -1, 461, 462, -1, -1, -1, 466, -1, -1, -1,
2216 -1, 15, 16, 17, 474, 19, 20, 21, -1, -1,
2217 -1, -1, -1, 27, 28, -1, -1, -1, -1, -1,
2218 -1, -1, -1, 493, 3, 4, -1, -1, 7, 8,
2219 9, 501, 46, -1, -1, 49, -1, 16, 17, 53,
2220 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2221 -1, -1, -1, -1, -1, 137, 35, 36, 140, -1,
2222 530, 143, -1, 145, 146, 535, -1, -1, -1, -1,
2223 -1, -1, -1, 52, -1, -1, -1, -1, -1, 549,
2224 550, -1, -1, -1, 554, -1, -1, 557, -1, 68,
2225 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2226 79, 80, 81, 82, 83, 84, -1, -1, -1, -1,
2227 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2228 14, -1, 16, 17, -1, 19, 20, -1, -1, -1,
2229 -1, 110, 111, 112, 113, 114, 115, 116, 117, 118,
2230 119, 120, 121, 122, -1, 124, -1, 126, 127, 128,
2231 44, -1, -1, -1, -1, -1, -1, 136, -1, 138,
2232 -1, 3, 4, -1, 143, 7, 8, 9, -1, -1,
2233 -1, -1, -1, -1, 16, 17, -1, 19, 20, -1,
2234 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2235 -1, -1, -1, 35, 36, -1, -1, -1, -1, -1,
2236 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2237 52, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2238 19, 20, -1, -1, -1, -1, 68, 69, 70, 71,
2239 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2240 82, 83, 84, 137, -1, 44, 140, -1, -1, 143,
2241 -1, 145, 146, -1, -1, -1, -1, -1, -1, -1,
2242 -1, -1, -1, -1, -1, -1, -1, -1, 110, 111,
2243 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2244 122, -1, 124, -1, 126, 127, 128, 7, 8, -1,
2245 -1, -1, -1, -1, -1, -1, 16, 17, -1, 19,
2246 20, 143, 22, -1, -1, -1, -1, -1, -1, -1,
2247 -1, -1, -1, -1, -1, 35, 36, -1, -1, -1,
2248 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2249 7, 8, -1, 10, 11, 12, 13, 14, 137, 16,
2250 17, 140, 19, 20, 143, -1, 145, 146, 68, 69,
2251 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2252 80, 81, 82, 83, 84, -1, -1, 44, -1, -1,
2253 -1, -1, -1, -1, -1, -1, 7, 8, -1, 10,
2254 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2255 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2256 120, 121, 122, 34, 124, -1, 126, 127, 128, 3,
2257 4, -1, -1, 44, -1, 9, 136, -1, 138, -1,
2258 140, -1, -1, 143, -1, 145, -1, 147, 22, 23,
2259 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2260 -1, 35, 36, -1, -1, -1, -1, -1, -1, -1,
2261 -1, -1, -1, -1, -1, -1, -1, -1, 52, -1,
2262 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2263 -1, -1, -1, -1, 68, 69, 70, 71, 72, 73,
2264 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2265 84, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2266 -1, 16, 17, -1, 19, 20, 137, -1, -1, 140,
2267 -1, -1, 143, -1, 145, -1, 110, 111, 112, 113,
2268 114, 115, 116, 117, 118, 119, 120, 121, 122, 44,
2269 124, -1, 126, 127, 128, 7, 8, -1, 10, 11,
2270 12, 13, 14, -1, 16, 17, -1, 19, 20, 143,
2271 -1, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2272 16, 17, 34, 19, 20, -1, -1, -1, -1, -1,
2273 7, 8, 44, 10, 11, 12, 13, 14, 34, 16,
2274 17, -1, 19, 20, -1, -1, 7, 8, 44, 10,
2275 11, 12, 13, 14, -1, 16, 17, 34, 19, 20,
2276 -1, -1, -1, -1, -1, 7, 8, 44, 10, 11,
2277 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2278 -1, -1, 137, 44, -1, 140, -1, -1, 143, -1,
2279 145, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2280 7, 8, 44, 10, 11, 12, 13, 14, -1, 16,
2281 17, -1, 19, 20, 7, 8, -1, 10, 11, 12,
2282 13, 14, -1, 16, 17, 137, 19, 20, 140, -1,
2283 -1, 143, -1, 145, -1, -1, -1, 44, -1, -1,
2284 -1, 137, -1, -1, 140, -1, -1, 143, -1, 145,
2285 -1, 44, -1, -1, -1, -1, -1, -1, -1, -1,
2286 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2287 -1, -1, -1, -1, -1, -1, 137, -1, -1, 140,
2288 -1, -1, 143, -1, 145, -1, -1, -1, -1, -1,
2289 -1, -1, -1, -1, -1, 137, -1, -1, 140, -1,
2290 -1, 143, -1, 145, -1, -1, -1, -1, -1, -1,
2291 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2292 -1, -1, -1, 32, -1, -1, -1, -1, -1, -1,
2293 137, -1, -1, 140, -1, -1, 143, -1, 145, -1,
2294 -1, 50, 51, -1, 137, -1, -1, 140, -1, -1,
2295 143, -1, 145, 62, 63, 64, 65, 66, 67, 68,
2296 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2297 79, 80, 81, 82, 83, 84, -1, -1, -1, -1,
2298 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2299 -1, -1, -1, -1, -1, -1, 105, 106, 107, -1,
2300 -1, 110, 111, 112, 113, 114, 115, 116, 117, 118,
2301 119, 120, 121, 122, 123, 124, 125, 126, 127, 128
2304 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2305 symbol of state STATE-NUM. */
2306 static const unsigned char yystos[] =
2308 0, 16, 17, 19, 20, 21, 27, 28, 46, 49,
2309 53, 156, 158, 159, 160, 188, 189, 190, 192, 191,
2310 47, 61, 197, 134, 52, 134, 15, 134, 37, 38,
2311 39, 40, 41, 42, 43, 45, 133, 161, 162, 163,
2312 0, 190, 41, 43, 164, 207, 37, 38, 39, 42,
2313 165, 204, 206, 213, 134, 134, 140, 198, 19, 196,
2314 7, 8, 10, 11, 12, 13, 14, 44, 137, 140,
2315 143, 145, 156, 159, 177, 178, 210, 163, 163, 29,
2316 30, 187, 163, 163, 18, 214, 215, 26, 146, 205,
2317 214, 19, 19, 19, 199, 138, 4, 4, 4, 145,
2318 10, 146, 178, 183, 136, 138, 187, 187, 11, 12,
2319 13, 154, 155, 178, 184, 55, 56, 57, 58, 59,
2320 60, 166, 202, 202, 158, 218, 135, 142, 34, 178,
2321 179, 181, 182, 141, 141, 146, 183, 135, 146, 182,
2322 184, 178, 23, 24, 3, 4, 5, 6, 9, 22,
2323 35, 36, 68, 69, 70, 71, 72, 73, 74, 75,
2324 76, 77, 78, 79, 80, 81, 82, 83, 84, 110,
2325 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2326 121, 122, 124, 126, 127, 128, 140, 143, 145, 147,
2327 149, 150, 151, 185, 210, 193, 4, 10, 178, 180,
2328 25, 145, 203, 32, 50, 51, 62, 63, 64, 65,
2329 66, 67, 83, 84, 105, 106, 107, 110, 123, 124,
2330 125, 126, 127, 128, 149, 150, 151, 216, 222, 223,
2331 224, 225, 19, 168, 135, 139, 178, 178, 144, 146,
2332 178, 139, 194, 195, 85, 86, 87, 88, 89, 90,
2333 91, 92, 93, 94, 152, 23, 24, 91, 92, 93,
2334 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
2335 104, 153, 138, 138, 138, 138, 138, 142, 184, 186,
2336 145, 186, 146, 186, 19, 138, 138, 138, 135, 175,
2337 159, 50, 10, 178, 212, 11, 14, 11, 154, 166,
2338 152, 153, 178, 178, 212, 178, 178, 219, 212, 212,
2339 212, 212, 212, 178, 178, 212, 166, 108, 109, 112,
2340 113, 130, 131, 167, 34, 179, 170, 142, 144, 144,
2341 170, 175, 175, 138, 138, 184, 184, 184, 184, 184,
2342 135, 142, 146, 178, 186, 144, 146, 184, 184, 184,
2343 31, 48, 173, 176, 138, 3, 4, 9, 22, 23,
2344 24, 35, 36, 52, 143, 185, 209, 210, 211, 211,
2345 211, 211, 180, 178, 178, 135, 172, 135, 172, 211,
2346 140, 135, 135, 135, 135, 135, 135, 211, 211, 33,
2347 180, 178, 212, 129, 167, 169, 184, 184, 221, 135,
2348 135, 135, 135, 184, 144, 146, 135, 135, 33, 19,
2349 4, 175, 34, 178, 200, 201, 54, 208, 186, 135,
2350 135, 211, 211, 211, 11, 48, 11, 221, 211, 140,
2351 212, 178, 212, 212, 212, 135, 135, 178, 211, 211,
2352 135, 135, 135, 135, 139, 184, 184, 184, 184, 144,
2353 184, 184, 178, 168, 135, 139, 19, 144, 14, 14,
2354 138, 135, 135, 211, 4, 211, 135, 211, 135, 135,
2355 135, 211, 211, 138, 178, 184, 184, 212, 135, 139,
2356 135, 135, 139, 139, 139, 156, 157, 34, 178, 170,
2357 135, 211, 211, 178, 220, 211, 211, 135, 172, 172,
2358 211, 135, 212, 212, 212, 220, 211, 139, 139, 184,
2359 184, 184, 168, 173, 174, 19, 135, 140, 211, 135,
2360 139, 142, 211, 139, 139, 139, 139, 157, 48, 171,
2361 14, 142, 154, 217, 168, 178, 170, 142, 170, 4,
2362 211, 209, 142, 154, 211, 33, 135, 209, 168, 14,
2363 14, 135, 211, 211, 14, 66, 211, 14, 211
2366 #define yyerrok (yyerrstatus = 0)
2367 #define yyclearin (yychar = YYEMPTY)
2368 #define YYEMPTY (-2)
2371 #define YYACCEPT goto yyacceptlab
2372 #define YYABORT goto yyabortlab
2373 #define YYERROR goto yyerrorlab
2376 /* Like YYERROR except do call yyerror. This remains here temporarily
2377 to ease the transition to the new meaning of YYERROR, for GCC.
2378 Once GCC version 2 has supplanted version 1, this can go. */
2380 #define YYFAIL goto yyerrlab
2382 #define YYRECOVERING() (!!yyerrstatus)
2384 #define YYBACKUP(Token, Value) \
2386 if (yychar == YYEMPTY && yylen == 1) \
2390 yytoken = YYTRANSLATE (yychar); \
2396 yyerror (YY_("syntax error: cannot back up")); \
2403 #define YYERRCODE 256
2406 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2407 If N is 0, then set CURRENT to the empty location which ends
2408 the previous symbol: RHS[0] (always defined). */
2410 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2411 #ifndef YYLLOC_DEFAULT
2412 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2416 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2417 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2418 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2419 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2423 (Current).first_line = (Current).last_line = \
2424 YYRHSLOC (Rhs, 0).last_line; \
2425 (Current).first_column = (Current).last_column = \
2426 YYRHSLOC (Rhs, 0).last_column; \
2432 /* YY_LOCATION_PRINT -- Print the location on the stream.
2433 This macro was not mandated originally: define only if we know
2434 we won't break user code: when these are the locations we know. */
2436 #ifndef YY_LOCATION_PRINT
2437 # if YYLTYPE_IS_TRIVIAL
2438 # define YY_LOCATION_PRINT(File, Loc) \
2439 fprintf (File, "%d.%d-%d.%d", \
2440 (Loc).first_line, (Loc).first_column, \
2441 (Loc).last_line, (Loc).last_column)
2443 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2448 /* YYLEX -- calling `yylex' with the right arguments. */
2451 # define YYLEX yylex (YYLEX_PARAM)
2453 # define YYLEX yylex ()
2456 /* Enable debugging if requested. */
2460 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2461 # define YYFPRINTF fprintf
2464 # define YYDPRINTF(Args) \
2470 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2474 YYFPRINTF (stderr, "%s ", Title); \
2475 yysymprint (stderr, \
2477 YYFPRINTF (stderr, "\n"); \
2481 /*------------------------------------------------------------------.
2482 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2484 `------------------------------------------------------------------*/
2486 #if defined (__STDC__) || defined (__cplusplus)
2488 yy_stack_print (short int *bottom, short int *top)
2491 yy_stack_print (bottom, top)
2496 YYFPRINTF (stderr, "Stack now");
2497 for (/* Nothing. */; bottom <= top; ++bottom)
2498 YYFPRINTF (stderr, " %d", *bottom);
2499 YYFPRINTF (stderr, "\n");
2502 # define YY_STACK_PRINT(Bottom, Top) \
2505 yy_stack_print ((Bottom), (Top)); \
2509 /*------------------------------------------------.
2510 | Report that the YYRULE is going to be reduced. |
2511 `------------------------------------------------*/
2513 #if defined (__STDC__) || defined (__cplusplus)
2515 yy_reduce_print (int yyrule)
2518 yy_reduce_print (yyrule)
2523 unsigned long int yylno = yyrline[yyrule];
2524 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2526 /* Print the symbols being reduced, and their result. */
2527 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2528 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2529 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2532 # define YY_REDUCE_PRINT(Rule) \
2535 yy_reduce_print (Rule); \
2538 /* Nonzero means print parse trace. It is left uninitialized so that
2539 multiple parsers can coexist. */
2541 #else /* !YYDEBUG */
2542 # define YYDPRINTF(Args)
2543 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2544 # define YY_STACK_PRINT(Bottom, Top)
2545 # define YY_REDUCE_PRINT(Rule)
2546 #endif /* !YYDEBUG */
2549 /* YYINITDEPTH -- initial size of the parser's stacks. */
2551 # define YYINITDEPTH 200
2554 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2555 if the built-in stack extension method is used).
2557 Do not make this value too large; the results are undefined if
2558 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2559 evaluated with infinite-precision integer arithmetic. */
2562 # define YYMAXDEPTH 10000
2570 # if defined (__GLIBC__) && defined (_STRING_H)
2571 # define yystrlen strlen
2573 /* Return the length of YYSTR. */
2575 # if defined (__STDC__) || defined (__cplusplus)
2576 yystrlen (const char *yystr)
2582 const char *yys = yystr;
2584 while (*yys++ != '\0')
2587 return yys - yystr - 1;
2593 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2594 # define yystpcpy stpcpy
2596 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2599 # if defined (__STDC__) || defined (__cplusplus)
2600 yystpcpy (char *yydest, const char *yysrc)
2602 yystpcpy (yydest, yysrc)
2608 const char *yys = yysrc;
2610 while ((*yyd++ = *yys++) != '\0')
2619 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2620 quotes and backslashes, so that it's suitable for yyerror. The
2621 heuristic is that double-quoting is unnecessary unless the string
2622 contains an apostrophe, a comma, or backslash (other than
2623 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2624 null, do not copy; instead, return the length of what the result
2627 yytnamerr (char *yyres, const char *yystr)
2632 char const *yyp = yystr;
2639 goto do_not_strip_quotes;
2643 goto do_not_strip_quotes;
2656 do_not_strip_quotes: ;
2660 return yystrlen (yystr);
2662 return yystpcpy (yyres, yystr) - yyres;
2666 #endif /* YYERROR_VERBOSE */
2671 /*--------------------------------.
2672 | Print this symbol on YYOUTPUT. |
2673 `--------------------------------*/
2675 #if defined (__STDC__) || defined (__cplusplus)
2677 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2680 yysymprint (yyoutput, yytype, yyvaluep)
2686 /* Pacify ``unused variable'' warnings. */
2689 if (yytype < YYNTOKENS)
2690 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2692 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2696 if (yytype < YYNTOKENS)
2697 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2704 YYFPRINTF (yyoutput, ")");
2707 #endif /* ! YYDEBUG */
2708 /*-----------------------------------------------.
2709 | Release the memory associated to this symbol. |
2710 `-----------------------------------------------*/
2712 #if defined (__STDC__) || defined (__cplusplus)
2714 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2717 yydestruct (yymsg, yytype, yyvaluep)
2723 /* Pacify ``unused variable'' warnings. */
2728 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2739 /* Prevent warnings from -Wmissing-prototypes. */
2741 #ifdef YYPARSE_PARAM
2742 # if defined (__STDC__) || defined (__cplusplus)
2743 int yyparse (void *YYPARSE_PARAM);
2747 #else /* ! YYPARSE_PARAM */
2748 #if defined (__STDC__) || defined (__cplusplus)
2753 #endif /* ! YYPARSE_PARAM */
2757 /* The look-ahead symbol. */
2760 /* The semantic value of the look-ahead symbol. */
2763 /* Number of syntax errors so far. */
2772 #ifdef YYPARSE_PARAM
2773 # if defined (__STDC__) || defined (__cplusplus)
2774 int yyparse (void *YYPARSE_PARAM)
2776 int yyparse (YYPARSE_PARAM)
2777 void *YYPARSE_PARAM;
2779 #else /* ! YYPARSE_PARAM */
2780 #if defined (__STDC__) || defined (__cplusplus)
2794 /* Number of tokens to shift before error messages enabled. */
2796 /* Look-ahead token as an internal (translated) token number. */
2799 /* Three stacks and their tools:
2800 `yyss': related to states,
2801 `yyvs': related to semantic values,
2802 `yyls': related to locations.
2804 Refer to the stacks thru separate pointers, to allow yyoverflow
2805 to reallocate them elsewhere. */
2807 /* The state stack. */
2808 short int yyssa[YYINITDEPTH];
2809 short int *yyss = yyssa;
2812 /* The semantic value stack. */
2813 YYSTYPE yyvsa[YYINITDEPTH];
2814 YYSTYPE *yyvs = yyvsa;
2819 #define YYPOPSTACK (yyvsp--, yyssp--)
2821 YYSIZE_T yystacksize = YYINITDEPTH;
2823 /* The variables used to return semantic value and location from the
2828 /* When reducing, the number of symbols on the RHS of the reduced
2832 YYDPRINTF ((stderr, "Starting parse\n"));
2837 yychar = YYEMPTY; /* Cause a token to be read. */
2839 /* Initialize stack pointers.
2840 Waste one element of value and location stack
2841 so that they stay on the same level as the state stack.
2842 The wasted elements are never initialized. */
2849 /*------------------------------------------------------------.
2850 | yynewstate -- Push a new state, which is found in yystate. |
2851 `------------------------------------------------------------*/
2853 /* In all cases, when you get here, the value and location stacks
2854 have just been pushed. so pushing a state here evens the stacks.
2861 if (yyss + yystacksize - 1 <= yyssp)
2863 /* Get the current used size of the three stacks, in elements. */
2864 YYSIZE_T yysize = yyssp - yyss + 1;
2868 /* Give user a chance to reallocate the stack. Use copies of
2869 these so that the &'s don't force the real ones into
2871 YYSTYPE *yyvs1 = yyvs;
2872 short int *yyss1 = yyss;
2875 /* Each stack pointer address is followed by the size of the
2876 data in use in that stack, in bytes. This used to be a
2877 conditional around just the two extra args, but that might
2878 be undefined if yyoverflow is a macro. */
2879 yyoverflow (YY_("memory exhausted"),
2880 &yyss1, yysize * sizeof (*yyssp),
2881 &yyvs1, yysize * sizeof (*yyvsp),
2888 #else /* no yyoverflow */
2889 # ifndef YYSTACK_RELOCATE
2890 goto yyexhaustedlab;
2892 /* Extend the stack our own way. */
2893 if (YYMAXDEPTH <= yystacksize)
2894 goto yyexhaustedlab;
2896 if (YYMAXDEPTH < yystacksize)
2897 yystacksize = YYMAXDEPTH;
2900 short int *yyss1 = yyss;
2901 union yyalloc *yyptr =
2902 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2904 goto yyexhaustedlab;
2905 YYSTACK_RELOCATE (yyss);
2906 YYSTACK_RELOCATE (yyvs);
2908 # undef YYSTACK_RELOCATE
2910 YYSTACK_FREE (yyss1);
2913 #endif /* no yyoverflow */
2915 yyssp = yyss + yysize - 1;
2916 yyvsp = yyvs + yysize - 1;
2919 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2920 (unsigned long int) yystacksize));
2922 if (yyss + yystacksize - 1 <= yyssp)
2926 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2935 /* Do appropriate processing given the current state. */
2936 /* Read a look-ahead token if we need one and don't already have one. */
2939 /* First try to decide what to do without reference to look-ahead token. */
2941 yyn = yypact[yystate];
2942 if (yyn == YYPACT_NINF)
2945 /* Not known => get a look-ahead token if don't already have one. */
2947 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2948 if (yychar == YYEMPTY)
2950 YYDPRINTF ((stderr, "Reading a token: "));
2954 if (yychar <= YYEOF)
2956 yychar = yytoken = YYEOF;
2957 YYDPRINTF ((stderr, "Now at end of input.\n"));
2961 yytoken = YYTRANSLATE (yychar);
2962 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2965 /* If the proper action on seeing token YYTOKEN is to reduce or to
2966 detect an error, take that action. */
2968 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2973 if (yyn == 0 || yyn == YYTABLE_NINF)
2982 /* Shift the look-ahead token. */
2983 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2985 /* Discard the token being shifted unless it is eof. */
2986 if (yychar != YYEOF)
2992 /* Count tokens shifted since error; after three, turn off error
3001 /*-----------------------------------------------------------.
3002 | yydefault -- do the default action for the current state. |
3003 `-----------------------------------------------------------*/
3005 yyn = yydefact[yystate];
3011 /*-----------------------------.
3012 | yyreduce -- Do a reduction. |
3013 `-----------------------------*/
3015 /* yyn is the number of a rule to reduce with. */
3018 /* If YYLEN is nonzero, implement the default value of the action:
3021 Otherwise, the following line sets YYVAL to garbage.
3022 This behavior is undocumented and Bison
3023 users should not rely upon it. Assigning to YYVAL
3024 unconditionally makes the parser a bit smaller, and it avoids a
3025 GCC warning that YYVAL may be used uninitialized. */
3026 yyval = yyvsp[1-yylen];
3029 YY_REDUCE_PRINT (yyn);
3033 #line 1092 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3034 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3038 #line 1092 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3039 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3043 #line 1093 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3044 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3048 #line 1093 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3049 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3053 #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3054 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3058 #line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3059 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3063 #line 1095 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3064 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3068 #line 1095 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3069 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3073 #line 1096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3074 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3078 #line 1096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3079 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3083 #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3084 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3088 #line 1100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3089 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3093 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3094 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3098 #line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3099 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3103 #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3104 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3108 #line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3109 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3113 #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3114 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3118 #line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3119 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3123 #line 1104 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3124 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3128 #line 1104 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3129 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3133 #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3134 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3138 #line 1105 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3139 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3143 #line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3144 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3148 #line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3149 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3153 #line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3154 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3158 #line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3159 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3163 #line 1117 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3164 { (yyval.StrVal) = 0; ;}
3168 #line 1121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3170 (yyval.StrVal) = (yyvsp[-1].StrVal);
3176 #line 1125 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3184 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3186 (yyval.StrVal) = (yyvsp[-1].StrVal);
3192 #line 1136 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3200 #line 1142 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3205 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3210 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3215 #line 1145 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3220 #line 1146 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3225 #line 1150 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3230 #line 1151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3235 #line 1152 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3240 #line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3245 #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3246 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3250 #line 1161 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3251 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3255 #line 1162 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3260 #line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3261 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3265 #line 1167 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3266 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3270 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3275 #line 1169 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3276 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3280 #line 1170 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3281 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3285 #line 1171 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3286 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3290 #line 1174 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3291 { (yyval.UIntVal) = CallingConv::C; ;}
3295 #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3296 { (yyval.UIntVal) = CallingConv::C; ;}
3300 #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3301 { (yyval.UIntVal) = CallingConv::Fast; ;}
3305 #line 1177 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3306 { (yyval.UIntVal) = CallingConv::Cold; ;}
3310 #line 1178 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3311 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3315 #line 1179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3316 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3320 #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3322 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3323 GEN_ERROR("Calling conv too large");
3324 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3330 #line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3331 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3335 #line 1188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3336 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3340 #line 1189 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3341 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
3345 #line 1190 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3346 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
3350 #line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3351 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3355 #line 1194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3357 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3362 #line 1199 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3363 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3367 #line 1203 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3368 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3372 #line 1204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3374 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3379 #line 1211 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3380 { (yyval.UIntVal) = 0; ;}
3384 #line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3386 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3387 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3388 GEN_ERROR("Alignment must be a power of two");
3394 #line 1218 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3395 { (yyval.UIntVal) = 0; ;}
3399 #line 1219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3401 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3402 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3403 GEN_ERROR("Alignment must be a power of two");
3409 #line 1227 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3411 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3412 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3413 GEN_ERROR("Invalid character in section name");
3414 (yyval.StrVal) = (yyvsp[0].StrVal);
3420 #line 1235 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3421 { (yyval.StrVal) = 0; ;}
3425 #line 1236 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3426 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3430 #line 1241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3435 #line 1242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3440 #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3442 CurGV->setSection((yyvsp[0].StrVal));
3443 free((yyvsp[0].StrVal));
3449 #line 1248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3451 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3452 GEN_ERROR("Alignment must be a power of two");
3453 CurGV->setAlignment((yyvsp[0].UInt64Val));
3459 #line 1264 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3461 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3467 #line 1268 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3469 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3475 #line 1272 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3477 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3478 GEN_ERROR("Cannot form a pointer to a basic block");
3479 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3480 delete (yyvsp[-1].TypeVal);
3486 #line 1279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3487 { // Named types are also simple types...
3488 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3490 (yyval.TypeVal) = new PATypeHolder(tmp);
3495 #line 1284 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3496 { // Type UpReference
3497 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3498 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3499 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3500 (yyval.TypeVal) = new PATypeHolder(OT);
3501 UR_OUT("New Upreference!\n");
3507 #line 1292 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3509 std::vector<const Type*> Params;
3510 std::vector<FunctionType::ParameterAttributes> Attrs;
3511 Attrs.push_back((yyvsp[0].ParamAttrs));
3512 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3513 Params.push_back(I->Ty->get());
3514 if (I->Ty->get() != Type::VoidTy)
3515 Attrs.push_back(I->Attrs);
3517 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3518 if (isVarArg) Params.pop_back();
3520 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3521 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3522 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3523 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3529 #line 1310 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3531 std::vector<const Type*> Params;
3532 std::vector<FunctionType::ParameterAttributes> Attrs;
3533 Attrs.push_back((yyvsp[0].ParamAttrs));
3534 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
3535 Params.push_back(I->Ty->get());
3536 if (I->Ty->get() != Type::VoidTy)
3537 Attrs.push_back(I->Attrs);
3539 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3540 if (isVarArg) Params.pop_back();
3542 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3543 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3544 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3550 #line 1328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3551 { // Sized array type?
3552 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3553 delete (yyvsp[-1].TypeVal);
3559 #line 1333 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3561 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3562 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3563 GEN_ERROR("Unsigned result not equal to signed result");
3564 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3565 GEN_ERROR("Element type of a VectorType must be primitive");
3566 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3567 GEN_ERROR("Vector length should be a power of 2");
3568 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3569 delete (yyvsp[-1].TypeVal);
3575 #line 1345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3576 { // Structure type?
3577 std::vector<const Type*> Elements;
3578 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3579 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3580 Elements.push_back(*I);
3582 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3583 delete (yyvsp[-1].TypeList);
3589 #line 1355 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3590 { // Empty structure type?
3591 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3597 #line 1359 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3599 std::vector<const Type*> Elements;
3600 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3601 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3602 Elements.push_back(*I);
3604 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3605 delete (yyvsp[-2].TypeList);
3611 #line 1369 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3612 { // Empty structure type?
3613 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3619 #line 1376 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3621 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3622 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3627 #line 1383 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3629 if (!UpRefs.empty())
3630 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3631 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3632 GEN_ERROR("LLVM functions cannot return aggregate types");
3633 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3638 #line 1390 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3640 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3645 #line 1395 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3647 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3648 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3654 #line 1400 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3656 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3662 #line 1408 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3664 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3665 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3666 TWA.Ty = new PATypeHolder(Type::VoidTy);
3667 (yyval.TypeWithAttrsList)->push_back(TWA);
3673 #line 1415 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3675 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3676 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3677 TWA.Ty = new PATypeHolder(Type::VoidTy);
3678 (yyval.TypeWithAttrsList)->push_back(TWA);
3684 #line 1422 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3686 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3692 #line 1430 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3694 (yyval.TypeList) = new std::list<PATypeHolder>();
3695 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3701 #line 1435 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3703 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3709 #line 1446 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3710 { // Nonempty unsized arr
3711 if (!UpRefs.empty())
3712 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3713 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3715 GEN_ERROR("Cannot make array constant with type: '" +
3716 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3717 const Type *ETy = ATy->getElementType();
3718 int NumElements = ATy->getNumElements();
3720 // Verify that we have the correct size...
3721 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3722 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3723 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3724 itostr(NumElements) + "");
3726 // Verify all elements are correct type!
3727 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3728 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3729 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3730 ETy->getDescription() +"' as required!\nIt is of type '"+
3731 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3734 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3735 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3741 #line 1474 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3743 if (!UpRefs.empty())
3744 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3745 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3747 GEN_ERROR("Cannot make array constant with type: '" +
3748 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3750 int NumElements = ATy->getNumElements();
3751 if (NumElements != -1 && NumElements != 0)
3752 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3753 " arguments, but has size of " + itostr(NumElements) +"");
3754 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3755 delete (yyvsp[-2].TypeVal);
3761 #line 1490 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3763 if (!UpRefs.empty())
3764 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3765 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3767 GEN_ERROR("Cannot make array constant with type: '" +
3768 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3770 int NumElements = ATy->getNumElements();
3771 const Type *ETy = ATy->getElementType();
3772 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3773 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3774 GEN_ERROR("Can't build string constant of size " +
3775 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3776 " when array has size " + itostr(NumElements) + "");
3777 std::vector<Constant*> Vals;
3778 if (ETy == Type::Int8Ty) {
3779 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3780 C != (unsigned char*)EndStr; ++C)
3781 Vals.push_back(ConstantInt::get(ETy, *C));
3783 free((yyvsp[0].StrVal));
3784 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3786 free((yyvsp[0].StrVal));
3787 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3788 delete (yyvsp[-2].TypeVal);
3794 #line 1519 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3795 { // Nonempty unsized arr
3796 if (!UpRefs.empty())
3797 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3798 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3800 GEN_ERROR("Cannot make packed constant with type: '" +
3801 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3802 const Type *ETy = PTy->getElementType();
3803 int NumElements = PTy->getNumElements();
3805 // Verify that we have the correct size...
3806 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3807 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3808 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3809 itostr(NumElements) + "");
3811 // Verify all elements are correct type!
3812 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3813 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3814 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3815 ETy->getDescription() +"' as required!\nIt is of type '"+
3816 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3819 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3820 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3826 #line 1547 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3828 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3830 GEN_ERROR("Cannot make struct constant with type: '" +
3831 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3833 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3834 GEN_ERROR("Illegal number of initializers for structure type");
3836 // Check to ensure that constants are compatible with the type initializer!
3837 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3838 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3839 GEN_ERROR("Expected type '" +
3840 STy->getElementType(i)->getDescription() +
3841 "' for element #" + utostr(i) +
3842 " of structure initializer");
3844 // Check to ensure that Type is not packed
3845 if (STy->isPacked())
3846 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3848 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3849 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3855 #line 1572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3857 if (!UpRefs.empty())
3858 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3859 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3861 GEN_ERROR("Cannot make struct constant with type: '" +
3862 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3864 if (STy->getNumContainedTypes() != 0)
3865 GEN_ERROR("Illegal number of initializers for structure type");
3867 // Check to ensure that Type is not packed
3868 if (STy->isPacked())
3869 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3871 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3872 delete (yyvsp[-2].TypeVal);
3878 #line 1591 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3880 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3882 GEN_ERROR("Cannot make struct constant with type: '" +
3883 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3885 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3886 GEN_ERROR("Illegal number of initializers for structure type");
3888 // Check to ensure that constants are compatible with the type initializer!
3889 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3890 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3891 GEN_ERROR("Expected type '" +
3892 STy->getElementType(i)->getDescription() +
3893 "' for element #" + utostr(i) +
3894 " of structure initializer");
3896 // Check to ensure that Type is packed
3897 if (!STy->isPacked())
3898 GEN_ERROR("Vector initializer to non-vector type '" +
3899 STy->getDescription() + "'");
3901 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3902 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3908 #line 1617 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3910 if (!UpRefs.empty())
3911 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3912 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3914 GEN_ERROR("Cannot make struct constant with type: '" +
3915 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3917 if (STy->getNumContainedTypes() != 0)
3918 GEN_ERROR("Illegal number of initializers for structure type");
3920 // Check to ensure that Type is packed
3921 if (!STy->isPacked())
3922 GEN_ERROR("Vector initializer to non-vector type '" +
3923 STy->getDescription() + "'");
3925 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3926 delete (yyvsp[-4].TypeVal);
3932 #line 1637 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3934 if (!UpRefs.empty())
3935 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3936 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3938 GEN_ERROR("Cannot make null pointer constant with type: '" +
3939 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3941 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3942 delete (yyvsp[-1].TypeVal);
3948 #line 1649 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3950 if (!UpRefs.empty())
3951 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3952 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3953 delete (yyvsp[-1].TypeVal);
3959 #line 1656 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3961 if (!UpRefs.empty())
3962 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3963 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3965 GEN_ERROR("Global const reference must be a pointer type");
3967 // ConstExprs can exist in the body of a function, thus creating
3968 // GlobalValues whenever they refer to a variable. Because we are in
3969 // the context of a function, getExistingVal will search the functions
3970 // symbol table instead of the module symbol table for the global symbol,
3971 // which throws things all off. To get around this, we just tell
3972 // getExistingVal that we are at global scope here.
3974 Function *SavedCurFn = CurFun.CurrentFunction;
3975 CurFun.CurrentFunction = 0;
3977 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
3980 CurFun.CurrentFunction = SavedCurFn;
3982 // If this is an initializer for a constant pointer, which is referencing a
3983 // (currently) undefined variable, create a stub now that shall be replaced
3984 // in the future with the right type of variable.
3987 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3988 const PointerType *PT = cast<PointerType>(Ty);
3990 // First check to see if the forward references value is already created!
3991 PerModuleInfo::GlobalRefsType::iterator I =
3992 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3994 if (I != CurModule.GlobalRefs.end()) {
3995 V = I->second; // Placeholder already exists, use it...
3996 (yyvsp[0].ValIDVal).destroy();
3999 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4000 Name = (yyvsp[0].ValIDVal).Name;
4001 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4002 GEN_ERROR("Invalid reference to global");
4004 // Create the forward referenced global.
4006 if (const FunctionType *FTy =
4007 dyn_cast<FunctionType>(PT->getElementType())) {
4008 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
4009 CurModule.CurrentModule);
4011 GV = new GlobalVariable(PT->getElementType(), false,
4012 GlobalValue::ExternalLinkage, 0,
4013 Name, CurModule.CurrentModule);
4016 // Keep track of the fact that we have a forward ref to recycle it
4017 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4022 (yyval.ConstVal) = cast<GlobalValue>(V);
4023 delete (yyvsp[-1].TypeVal); // Free the type handle
4029 #line 1722 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4031 if (!UpRefs.empty())
4032 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4033 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4034 GEN_ERROR("Mismatched types for constant expression: " +
4035 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4036 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4037 delete (yyvsp[-1].TypeVal);
4043 #line 1732 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4045 if (!UpRefs.empty())
4046 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4047 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4048 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4049 GEN_ERROR("Cannot create a null initialized value of this type");
4050 (yyval.ConstVal) = Constant::getNullValue(Ty);
4051 delete (yyvsp[-1].TypeVal);
4057 #line 1742 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4058 { // integral constants
4059 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4060 GEN_ERROR("Constant value doesn't fit in type");
4061 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4067 #line 1748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4068 { // arbitrary precision integer constants
4069 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4070 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4071 GEN_ERROR("Constant value does not fit in type");
4073 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4074 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4075 delete (yyvsp[0].APIntVal);
4081 #line 1758 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4082 { // integral constants
4083 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4084 GEN_ERROR("Constant value doesn't fit in type");
4085 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4091 #line 1764 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4092 { // arbitrary precision integer constants
4093 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4094 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4095 GEN_ERROR("Constant value does not fit in type");
4097 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4098 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4099 delete (yyvsp[0].APIntVal);
4105 #line 1774 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4106 { // Boolean constants
4107 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4108 (yyval.ConstVal) = ConstantInt::getTrue();
4114 #line 1779 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4115 { // Boolean constants
4116 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4117 (yyval.ConstVal) = ConstantInt::getFalse();
4123 #line 1784 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4124 { // Float & Double constants
4125 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4126 GEN_ERROR("Floating point constant invalid for type");
4127 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4133 #line 1792 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4135 if (!UpRefs.empty())
4136 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4137 Constant *Val = (yyvsp[-3].ConstVal);
4138 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4139 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4140 GEN_ERROR("invalid cast opcode for cast from '" +
4141 Val->getType()->getDescription() + "' to '" +
4142 DestTy->getDescription() + "'");
4143 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4144 delete (yyvsp[-1].TypeVal);
4149 #line 1804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4151 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4152 GEN_ERROR("GetElementPtr requires a pointer operand");
4155 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4158 GEN_ERROR("Index list invalid for constant getelementptr");
4160 SmallVector<Constant*, 8> IdxVec;
4161 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4162 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4163 IdxVec.push_back(C);
4165 GEN_ERROR("Indices to constant getelementptr must be constants");
4167 delete (yyvsp[-1].ValueList);
4169 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4175 #line 1826 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4177 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4178 GEN_ERROR("Select condition must be of boolean type");
4179 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4180 GEN_ERROR("Select operand types must match");
4181 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4187 #line 1834 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4189 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4190 GEN_ERROR("Binary operator types must match");
4192 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4197 #line 1840 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4199 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4200 GEN_ERROR("Logical operator types must match");
4201 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4202 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4203 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4204 GEN_ERROR("Logical operator requires integral operands");
4206 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4212 #line 1851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4214 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4215 GEN_ERROR("icmp operand types must match");
4216 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4221 #line 1856 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4223 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4224 GEN_ERROR("fcmp operand types must match");
4225 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4230 #line 1861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4232 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4233 GEN_ERROR("Invalid extractelement operands");
4234 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4240 #line 1867 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4242 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4243 GEN_ERROR("Invalid insertelement operands");
4244 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4250 #line 1873 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4252 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4253 GEN_ERROR("Invalid shufflevector operands");
4254 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4260 #line 1882 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4262 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4268 #line 1886 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4270 (yyval.ConstVector) = new std::vector<Constant*>();
4271 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4277 #line 1894 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4278 { (yyval.BoolVal) = false; ;}
4282 #line 1894 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4283 { (yyval.BoolVal) = true; ;}
4287 #line 1905 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4289 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4290 CurModule.ModuleDone();
4296 #line 1910 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4298 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4299 CurModule.ModuleDone();
4305 #line 1923 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4306 { CurFun.isDeclare = false; ;}
4310 #line 1923 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4312 CurFun.FunctionDone();
4318 #line 1927 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4319 { CurFun.isDeclare = true; ;}
4323 #line 1927 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4330 #line 1930 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4337 #line 1933 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4339 // Emit an error if there are any unresolved types left.
4340 if (!CurModule.LateResolveTypes.empty()) {
4341 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4342 if (DID.Type == ValID::LocalName) {
4343 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4345 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4353 #line 1945 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4355 if (!UpRefs.empty())
4356 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4357 // Eagerly resolve types. This is not an optimization, this is a
4358 // requirement that is due to the fact that we could have this:
4360 // %list = type { %list * }
4361 // %list = type { %list * } ; repeated type decl
4363 // If types are not resolved eagerly, then the two types will not be
4364 // determined to be the same type!
4366 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4368 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4370 // If this is a named type that is not a redefinition, add it to the slot
4372 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4375 delete (yyvsp[0].TypeVal);
4381 #line 1969 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4383 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4385 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4387 // If this is a named type that is not a redefinition, add it to the slot
4389 CurModule.Types.push_back((yyvsp[0].PrimType));
4396 #line 1980 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4398 /* "Externally Visible" Linkage */
4399 if ((yyvsp[0].ConstVal) == 0)
4400 GEN_ERROR("Global value initializer is not a constant");
4401 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4402 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4408 #line 1987 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4415 #line 1990 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4417 if ((yyvsp[0].ConstVal) == 0)
4418 GEN_ERROR("Global value initializer is not a constant");
4419 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4425 #line 1995 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4432 #line 1998 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4434 if (!UpRefs.empty())
4435 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4436 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4438 delete (yyvsp[0].TypeVal);
4443 #line 2004 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4451 #line 2008 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4458 #line 2011 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4465 #line 2017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4467 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4468 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4469 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4470 free((yyvsp[0].StrVal));
4472 if (AsmSoFar.empty())
4473 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4475 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4481 #line 2030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4483 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4484 free((yyvsp[0].StrVal));
4489 #line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4491 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4492 free((yyvsp[0].StrVal));
4497 #line 2041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4499 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4500 free((yyvsp[0].StrVal));
4506 #line 2046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4508 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4509 free((yyvsp[0].StrVal));
4515 #line 2051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4522 #line 2060 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4524 if (!UpRefs.empty())
4525 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4526 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4527 GEN_ERROR("void typed arguments are invalid");
4528 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4529 (yyval.ArgList) = (yyvsp[-4].ArgList);
4530 (yyvsp[-4].ArgList)->push_back(E);
4536 #line 2070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4538 if (!UpRefs.empty())
4539 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4540 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4541 GEN_ERROR("void typed arguments are invalid");
4542 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4543 (yyval.ArgList) = new ArgListType;
4544 (yyval.ArgList)->push_back(E);
4550 #line 2081 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4552 (yyval.ArgList) = (yyvsp[0].ArgList);
4558 #line 2085 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4560 (yyval.ArgList) = (yyvsp[-2].ArgList);
4561 struct ArgListEntry E;
4562 E.Ty = new PATypeHolder(Type::VoidTy);
4564 E.Attrs = FunctionType::NoAttributeSet;
4565 (yyval.ArgList)->push_back(E);
4571 #line 2094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4573 (yyval.ArgList) = new ArgListType;
4574 struct ArgListEntry E;
4575 E.Ty = new PATypeHolder(Type::VoidTy);
4577 E.Attrs = FunctionType::NoAttributeSet;
4578 (yyval.ArgList)->push_back(E);
4584 #line 2103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4586 (yyval.ArgList) = 0;
4592 #line 2109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4594 UnEscapeLexed((yyvsp[-6].StrVal));
4595 std::string FunctionName((yyvsp[-6].StrVal));
4596 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4598 // Check the function result for abstractness if this is a define. We should
4599 // have no abstract types at this point
4600 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4601 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4603 std::vector<const Type*> ParamTypeList;
4604 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4605 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4606 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4607 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
4608 const Type* Ty = I->Ty->get();
4609 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4610 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4611 ParamTypeList.push_back(Ty);
4612 if (Ty != Type::VoidTy)
4613 ParamAttrs.push_back(I->Attrs);
4617 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4618 if (isVarArg) ParamTypeList.pop_back();
4620 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4622 const PointerType *PFT = PointerType::get(FT);
4623 delete (yyvsp[-7].TypeVal);
4626 if (!FunctionName.empty()) {
4627 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4629 ID = ValID::createGlobalID(CurModule.Values.size());
4633 // See if this function was forward referenced. If so, recycle the object.
4634 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4635 // Move the function to the end of the list, from whereever it was
4636 // previously inserted.
4637 Fn = cast<Function>(FWRef);
4638 CurModule.CurrentModule->getFunctionList().remove(Fn);
4639 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4640 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4641 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4642 if (Fn->getFunctionType() != FT ) {
4643 // The existing function doesn't have the same type. This is an overload
4645 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4646 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4647 // Neither the existing or the current function is a declaration and they
4648 // have the same name and same type. Clearly this is a redefinition.
4649 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4650 } if (Fn->isDeclaration()) {
4651 // Make sure to strip off any argument names so we can't get conflicts.
4652 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4656 } else { // Not already defined?
4657 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4658 CurModule.CurrentModule);
4660 InsertValue(Fn, CurModule.Values);
4663 CurFun.FunctionStart(Fn);
4665 if (CurFun.isDeclare) {
4666 // If we have declaration, always overwrite linkage. This will allow us to
4667 // correctly handle cases, when pointer to function is passed as argument to
4668 // another function.
4669 Fn->setLinkage(CurFun.Linkage);
4670 Fn->setVisibility(CurFun.Visibility);
4672 Fn->setCallingConv((yyvsp[-8].UIntVal));
4673 Fn->setAlignment((yyvsp[0].UIntVal));
4674 if ((yyvsp[-1].StrVal)) {
4675 Fn->setSection((yyvsp[-1].StrVal));
4676 free((yyvsp[-1].StrVal));
4679 // Add all of the arguments we parsed to the function...
4680 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4681 if (isVarArg) { // Nuke the last entry
4682 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4683 "Not a varargs marker!");
4684 delete (yyvsp[-4].ArgList)->back().Ty;
4685 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4687 Function::arg_iterator ArgIt = Fn->arg_begin();
4688 Function::arg_iterator ArgEnd = Fn->arg_end();
4690 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4691 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4692 delete I->Ty; // Delete the typeholder...
4693 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4699 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4706 #line 2222 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4708 (yyval.FunctionVal) = CurFun.CurrentFunction;
4710 // Make sure that we keep track of the linkage type even if there was a
4711 // previous "declare".
4712 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4713 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4718 #line 2233 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4720 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4726 #line 2238 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4728 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4729 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4730 (yyval.FunctionVal) = CurFun.CurrentFunction;
4731 CurFun.FunctionDone();
4737 #line 2250 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4739 (yyval.BoolVal) = false;
4745 #line 2254 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4747 (yyval.BoolVal) = true;
4753 #line 2259 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4754 { // A reference to a direct constant
4755 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4761 #line 2263 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4763 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4769 #line 2267 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4770 { // Perhaps it's an FP constant?
4771 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4777 #line 2271 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4779 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4785 #line 2275 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4787 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4793 #line 2279 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4795 (yyval.ValIDVal) = ValID::createNull();
4801 #line 2283 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4803 (yyval.ValIDVal) = ValID::createUndef();
4809 #line 2287 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4810 { // A vector zero constant.
4811 (yyval.ValIDVal) = ValID::createZeroInit();
4817 #line 2291 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4818 { // Nonempty unsized packed vector
4819 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4820 int NumElements = (yyvsp[-1].ConstVector)->size();
4822 VectorType* pt = VectorType::get(ETy, NumElements);
4823 PATypeHolder* PTy = new PATypeHolder(
4831 // Verify all elements are correct type!
4832 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4833 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4834 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4835 ETy->getDescription() +"' as required!\nIt is of type '" +
4836 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4839 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
4840 delete PTy; delete (yyvsp[-1].ConstVector);
4846 #line 2316 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4848 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4854 #line 2320 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4856 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4857 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4858 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4859 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4860 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4861 free((yyvsp[-2].StrVal));
4862 free((yyvsp[0].StrVal));
4868 #line 2334 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4869 { // Is it an integer reference...?
4870 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4876 #line 2338 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4878 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4884 #line 2342 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4885 { // Is it a named reference...?
4886 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4892 #line 2346 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4893 { // Is it a named reference...?
4894 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4900 #line 2358 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4902 if (!UpRefs.empty())
4903 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4904 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4905 delete (yyvsp[-1].TypeVal);
4911 #line 2367 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4913 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4919 #line 2371 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4920 { // Do not allow functions with 0 basic blocks
4921 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4927 #line 2380 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4929 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4931 InsertValue((yyvsp[0].TermInstVal));
4932 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4933 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4939 #line 2389 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4941 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4942 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4943 if (CI2->getParent() == 0)
4944 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4945 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4946 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4952 #line 2398 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4953 { // Empty space between instruction lists
4954 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4960 #line 2402 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4961 { // Labelled (named) basic block
4962 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal)));
4968 #line 2407 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4969 { // Return with a result...
4970 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4976 #line 2411 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4977 { // Return with no result...
4978 (yyval.TermInstVal) = new ReturnInst();
4984 #line 2415 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4985 { // Unconditional Branch...
4986 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4988 (yyval.TermInstVal) = new BranchInst(tmpBB);
4993 #line 2420 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4995 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
4996 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4998 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5000 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5002 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5007 #line 2430 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5009 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5011 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5013 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5014 (yyval.TermInstVal) = S;
5016 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5017 E = (yyvsp[-1].JumpTable)->end();
5018 for (; I != E; ++I) {
5019 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5020 S->addCase(CI, I->second);
5022 GEN_ERROR("Switch case is constant, but not a simple integer");
5024 delete (yyvsp[-1].JumpTable);
5030 #line 2449 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5032 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5034 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5036 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5037 (yyval.TermInstVal) = S;
5043 #line 2459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5046 // Handle the short syntax
5047 const PointerType *PFTy = 0;
5048 const FunctionType *Ty = 0;
5049 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5050 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5051 // Pull out the types of all of the arguments...
5052 std::vector<const Type*> ParamTypes;
5053 FunctionType::ParamAttrsList ParamAttrs;
5054 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5055 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
5056 const Type *Ty = I->Val->getType();
5057 if (Ty == Type::VoidTy)
5058 GEN_ERROR("Short call syntax cannot be used with varargs");
5059 ParamTypes.push_back(Ty);
5060 ParamAttrs.push_back(I->Attrs);
5063 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5064 PFTy = PointerType::get(Ty);
5067 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5069 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5071 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5074 // Check the arguments
5076 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5077 // Make sure no arguments is a good thing!
5078 if (Ty->getNumParams() != 0)
5079 GEN_ERROR("No arguments passed to a function that "
5080 "expects arguments");
5081 } else { // Has arguments?
5082 // Loop through FunctionType's arguments and ensure they are specified
5084 FunctionType::param_iterator I = Ty->param_begin();
5085 FunctionType::param_iterator E = Ty->param_end();
5086 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5088 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5089 if (ArgI->Val->getType() != *I)
5090 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5091 (*I)->getDescription() + "'");
5092 Args.push_back(ArgI->Val);
5095 if (Ty->isVarArg()) {
5097 for (; ArgI != ArgE; ++ArgI)
5098 Args.push_back(ArgI->Val); // push the remaining varargs
5099 } else if (I != E || ArgI != ArgE)
5100 GEN_ERROR("Invalid number of parameters detected");
5103 // Create the InvokeInst
5104 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5105 II->setCallingConv((yyvsp[-12].UIntVal));
5106 (yyval.TermInstVal) = II;
5107 delete (yyvsp[-8].ValueRefList);
5113 #line 2525 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5115 (yyval.TermInstVal) = new UnwindInst();
5121 #line 2529 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5123 (yyval.TermInstVal) = new UnreachableInst();
5129 #line 2536 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5131 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5132 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5135 GEN_ERROR("May only switch on a constant pool value");
5137 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5139 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5144 #line 2547 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5146 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5147 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5151 GEN_ERROR("May only switch on a constant pool value");
5153 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5155 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5160 #line 2560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5162 // Is this definition named?? if so, assign the name...
5163 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5165 InsertValue((yyvsp[0].InstVal));
5166 (yyval.InstVal) = (yyvsp[0].InstVal);
5172 #line 2570 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5173 { // Used for PHI nodes
5174 if (!UpRefs.empty())
5175 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5176 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5177 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5179 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5181 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5182 delete (yyvsp[-5].TypeVal);
5187 #line 2581 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5189 (yyval.PHIList) = (yyvsp[-6].PHIList);
5190 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5192 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5194 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5199 #line 2591 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5201 if (!UpRefs.empty())
5202 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5203 // Used for call and invoke instructions
5204 (yyval.ValueRefList) = new ValueRefList();
5205 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5206 (yyval.ValueRefList)->push_back(E);
5211 #line 2599 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5213 if (!UpRefs.empty())
5214 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5215 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5216 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5217 (yyval.ValueRefList)->push_back(E);
5223 #line 2607 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5224 { (yyval.ValueRefList) = new ValueRefList(); ;}
5228 #line 2610 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5229 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5233 #line 2611 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5235 (yyval.ValueList) = (yyvsp[-2].ValueList);
5236 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5242 #line 2618 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5244 (yyval.BoolVal) = true;
5250 #line 2622 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5252 (yyval.BoolVal) = false;
5258 #line 2627 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5260 if (!UpRefs.empty())
5261 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5262 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5263 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5265 "Arithmetic operator requires integer, FP, or packed operands");
5266 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5267 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5268 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5269 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5270 GEN_ERROR("Remainder not supported on vector types");
5271 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5273 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5275 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5276 if ((yyval.InstVal) == 0)
5277 GEN_ERROR("binary operator returned null");
5278 delete (yyvsp[-3].TypeVal);
5283 #line 2648 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5285 if (!UpRefs.empty())
5286 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5287 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5288 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5289 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5290 GEN_ERROR("Logical operator requires integral operands");
5292 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5294 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5296 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5297 if ((yyval.InstVal) == 0)
5298 GEN_ERROR("binary operator returned null");
5299 delete (yyvsp[-3].TypeVal);
5304 #line 2665 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5306 if (!UpRefs.empty())
5307 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5308 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5309 GEN_ERROR("Vector types not supported by icmp instruction");
5310 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5312 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5314 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5315 if ((yyval.InstVal) == 0)
5316 GEN_ERROR("icmp operator returned null");
5321 #line 2678 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5323 if (!UpRefs.empty())
5324 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5325 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5326 GEN_ERROR("Vector types not supported by fcmp instruction");
5327 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5329 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5331 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5332 if ((yyval.InstVal) == 0)
5333 GEN_ERROR("fcmp operator returned null");
5338 #line 2691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5340 if (!UpRefs.empty())
5341 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5342 Value* Val = (yyvsp[-2].ValueVal);
5343 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5344 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5345 GEN_ERROR("invalid cast opcode for cast from '" +
5346 Val->getType()->getDescription() + "' to '" +
5347 DestTy->getDescription() + "'");
5348 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5349 delete (yyvsp[0].TypeVal);
5354 #line 2703 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5356 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5357 GEN_ERROR("select condition must be boolean");
5358 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5359 GEN_ERROR("select value types should match");
5360 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5366 #line 2711 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5368 if (!UpRefs.empty())
5369 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5370 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5371 delete (yyvsp[0].TypeVal);
5377 #line 2718 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5379 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5380 GEN_ERROR("Invalid extractelement operands");
5381 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5387 #line 2724 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5389 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5390 GEN_ERROR("Invalid insertelement operands");
5391 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5397 #line 2730 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5399 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5400 GEN_ERROR("Invalid shufflevector operands");
5401 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5407 #line 2736 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5409 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5410 if (!Ty->isFirstClassType())
5411 GEN_ERROR("PHI node operands must be of first class type");
5412 (yyval.InstVal) = new PHINode(Ty);
5413 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5414 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5415 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5416 GEN_ERROR("All elements of a PHI node must be of the same type");
5417 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5418 (yyvsp[0].PHIList)->pop_front();
5420 delete (yyvsp[0].PHIList); // Free the list...
5426 #line 2752 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5429 // Handle the short syntax
5430 const PointerType *PFTy = 0;
5431 const FunctionType *Ty = 0;
5432 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5433 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5434 // Pull out the types of all of the arguments...
5435 std::vector<const Type*> ParamTypes;
5436 FunctionType::ParamAttrsList ParamAttrs;
5437 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5438 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
5439 const Type *Ty = I->Val->getType();
5440 if (Ty == Type::VoidTy)
5441 GEN_ERROR("Short call syntax cannot be used with varargs");
5442 ParamTypes.push_back(Ty);
5443 ParamAttrs.push_back(I->Attrs);
5446 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
5447 PFTy = PointerType::get(Ty);
5450 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5453 // Check the arguments
5455 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5456 // Make sure no arguments is a good thing!
5457 if (Ty->getNumParams() != 0)
5458 GEN_ERROR("No arguments passed to a function that "
5459 "expects arguments");
5460 } else { // Has arguments?
5461 // Loop through FunctionType's arguments and ensure they are specified
5464 FunctionType::param_iterator I = Ty->param_begin();
5465 FunctionType::param_iterator E = Ty->param_end();
5466 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5468 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5469 if (ArgI->Val->getType() != *I)
5470 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5471 (*I)->getDescription() + "'");
5472 Args.push_back(ArgI->Val);
5474 if (Ty->isVarArg()) {
5476 for (; ArgI != ArgE; ++ArgI)
5477 Args.push_back(ArgI->Val); // push the remaining varargs
5478 } else if (I != E || ArgI != ArgE)
5479 GEN_ERROR("Invalid number of parameters detected");
5481 // Create the call node
5482 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5483 CI->setTailCall((yyvsp[-7].BoolVal));
5484 CI->setCallingConv((yyvsp[-6].UIntVal));
5485 (yyval.InstVal) = CI;
5486 delete (yyvsp[-2].ValueRefList);
5487 delete (yyvsp[-5].TypeVal);
5493 #line 2815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5495 (yyval.InstVal) = (yyvsp[0].InstVal);
5501 #line 2820 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5503 (yyval.BoolVal) = true;
5509 #line 2824 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5511 (yyval.BoolVal) = false;
5517 #line 2831 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5519 if (!UpRefs.empty())
5520 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5521 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5522 delete (yyvsp[-1].TypeVal);
5528 #line 2838 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5530 if (!UpRefs.empty())
5531 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5532 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5534 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5535 delete (yyvsp[-4].TypeVal);
5540 #line 2846 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5542 if (!UpRefs.empty())
5543 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5544 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5545 delete (yyvsp[-1].TypeVal);
5551 #line 2853 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5553 if (!UpRefs.empty())
5554 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5555 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5557 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5558 delete (yyvsp[-4].TypeVal);
5563 #line 2861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5565 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5566 GEN_ERROR("Trying to free nonpointer type " +
5567 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5568 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5574 #line 2869 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5576 if (!UpRefs.empty())
5577 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5578 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5579 GEN_ERROR("Can't load from nonpointer type: " +
5580 (*(yyvsp[-1].TypeVal))->getDescription());
5581 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5582 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5583 (*(yyvsp[-1].TypeVal))->getDescription());
5584 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5586 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5587 delete (yyvsp[-1].TypeVal);
5592 #line 2883 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5594 if (!UpRefs.empty())
5595 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5596 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5598 GEN_ERROR("Can't store to a nonpointer type: " +
5599 (*(yyvsp[-1].TypeVal))->getDescription());
5600 const Type *ElTy = PT->getElementType();
5601 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5602 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5603 "' into space of type '" + ElTy->getDescription() + "'");
5605 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5607 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5608 delete (yyvsp[-1].TypeVal);
5613 #line 2900 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5615 if (!UpRefs.empty())
5616 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5617 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5618 GEN_ERROR("getelementptr insn requires pointer operand");
5620 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5621 GEN_ERROR("Invalid getelementptr indices for type '" +
5622 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5623 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5625 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5626 delete (yyvsp[-2].TypeVal);
5627 delete (yyvsp[0].ValueList);
5635 /* Line 1126 of yacc.c. */
5636 #line 5637 "llvmAsmParser.tab.c"
5642 YY_STACK_PRINT (yyss, yyssp);
5647 /* Now `shift' the result of the reduction. Determine what state
5648 that goes to, based on the state we popped back to and the rule
5649 number reduced by. */
5653 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5654 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5655 yystate = yytable[yystate];
5657 yystate = yydefgoto[yyn - YYNTOKENS];
5662 /*------------------------------------.
5663 | yyerrlab -- here on detecting error |
5664 `------------------------------------*/
5666 /* If not already recovering from an error, report this error. */
5671 yyn = yypact[yystate];
5673 if (YYPACT_NINF < yyn && yyn < YYLAST)
5675 int yytype = YYTRANSLATE (yychar);
5676 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5677 YYSIZE_T yysize = yysize0;
5679 int yysize_overflow = 0;
5681 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5682 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5686 /* This is so xgettext sees the translatable formats that are
5687 constructed on the fly. */
5688 YY_("syntax error, unexpected %s");
5689 YY_("syntax error, unexpected %s, expecting %s");
5690 YY_("syntax error, unexpected %s, expecting %s or %s");
5691 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5692 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5696 static char const yyunexpected[] = "syntax error, unexpected %s";
5697 static char const yyexpecting[] = ", expecting %s";
5698 static char const yyor[] = " or %s";
5699 char yyformat[sizeof yyunexpected
5700 + sizeof yyexpecting - 1
5701 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5702 * (sizeof yyor - 1))];
5703 char const *yyprefix = yyexpecting;
5705 /* Start YYX at -YYN if negative to avoid negative indexes in
5707 int yyxbegin = yyn < 0 ? -yyn : 0;
5709 /* Stay within bounds of both yycheck and yytname. */
5710 int yychecklim = YYLAST - yyn;
5711 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5714 yyarg[0] = yytname[yytype];
5715 yyfmt = yystpcpy (yyformat, yyunexpected);
5717 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5718 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5720 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5724 yyformat[sizeof yyunexpected - 1] = '\0';
5727 yyarg[yycount++] = yytname[yyx];
5728 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5729 yysize_overflow |= yysize1 < yysize;
5731 yyfmt = yystpcpy (yyfmt, yyprefix);
5735 yyf = YY_(yyformat);
5736 yysize1 = yysize + yystrlen (yyf);
5737 yysize_overflow |= yysize1 < yysize;
5740 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5741 yymsg = (char *) YYSTACK_ALLOC (yysize);
5744 /* Avoid sprintf, as that infringes on the user's name space.
5745 Don't have undefined behavior even if the translation
5746 produced a string with the wrong number of "%s"s. */
5749 while ((*yyp = *yyf))
5751 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5753 yyp += yytnamerr (yyp, yyarg[yyi++]);
5763 YYSTACK_FREE (yymsg);
5767 yyerror (YY_("syntax error"));
5768 goto yyexhaustedlab;
5772 #endif /* YYERROR_VERBOSE */
5773 yyerror (YY_("syntax error"));
5778 if (yyerrstatus == 3)
5780 /* If just tried and failed to reuse look-ahead token after an
5781 error, discard it. */
5783 if (yychar <= YYEOF)
5785 /* Return failure if at end of input. */
5786 if (yychar == YYEOF)
5791 yydestruct ("Error: discarding", yytoken, &yylval);
5796 /* Else will try to reuse look-ahead token after shifting the error
5801 /*---------------------------------------------------.
5802 | yyerrorlab -- error raised explicitly by YYERROR. |
5803 `---------------------------------------------------*/
5806 /* Pacify compilers like GCC when the user code never invokes
5807 YYERROR and the label yyerrorlab therefore never appears in user
5818 /*-------------------------------------------------------------.
5819 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5820 `-------------------------------------------------------------*/
5822 yyerrstatus = 3; /* Each real token shifted decrements this. */
5826 yyn = yypact[yystate];
5827 if (yyn != YYPACT_NINF)
5830 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5838 /* Pop the current state because it cannot handle the error token. */
5843 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5846 YY_STACK_PRINT (yyss, yyssp);
5855 /* Shift the error token. */
5856 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5862 /*-------------------------------------.
5863 | yyacceptlab -- YYACCEPT comes here. |
5864 `-------------------------------------*/
5869 /*-----------------------------------.
5870 | yyabortlab -- YYABORT comes here. |
5871 `-----------------------------------*/
5877 /*-------------------------------------------------.
5878 | yyexhaustedlab -- memory exhaustion comes here. |
5879 `-------------------------------------------------*/
5881 yyerror (YY_("memory exhausted"));
5887 if (yychar != YYEOF && yychar != YYEMPTY)
5888 yydestruct ("Cleanup: discarding lookahead",
5890 while (yyssp != yyss)
5892 yydestruct ("Cleanup: popping",
5893 yystos[*yyssp], yyvsp);
5898 YYSTACK_FREE (yyss);
5904 #line 2917 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5907 // common code from the two 'RunVMAsmParser' functions
5908 static Module* RunParser(Module * M) {
5910 llvmAsmlineno = 1; // Reset the current line number...
5911 CurModule.CurrentModule = M;
5916 // Check to make sure the parser succeeded
5919 delete ParserResult;
5923 // Check to make sure that parsing produced a result
5927 // Reset ParserResult variable while saving its value for the result.
5928 Module *Result = ParserResult;
5934 void llvm::GenerateError(const std::string &message, int LineNo) {
5935 if (LineNo == -1) LineNo = llvmAsmlineno;
5936 // TODO: column number in exception
5938 TheParseError->setError(CurFilename, message, LineNo);
5942 int yyerror(const char *ErrorMsg) {
5944 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5945 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5946 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5947 if (yychar != YYEMPTY && yychar != 0)
5948 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5950 GenerateError(errMsg);