1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
85 ZEROINITIALIZER = 276,
123 X86_STDCALLCC_TOK = 314,
124 X86_FASTCALLCC_TOK = 315,
190 EXTRACTELEMENT = 381,
202 #define ESINT64VAL 258
203 #define EUINT64VAL 259
204 #define ESAPINTVAL 260
205 #define EUAPINTVAL 261
206 #define LOCALVAL_ID 262
207 #define GLOBALVAL_ID 263
216 #define GLOBALVAR 272
218 #define STRINGCONSTANT 274
219 #define ATSTRINGCONSTANT 275
220 #define ZEROINITIALIZER 276
231 #define THREAD_LOCAL 287
233 #define DOTDOTDOT 289
239 #define APPENDING 295
240 #define DLLIMPORT 296
241 #define DLLEXPORT 297
242 #define EXTERN_WEAK 298
253 #define SIDEEFFECT 309
256 #define FASTCC_TOK 312
257 #define COLDCC_TOK 313
258 #define X86_STDCALLCC_TOK 314
259 #define X86_FASTCALLCC_TOK 315
260 #define DATALAYOUT 316
266 #define UNREACHABLE 322
309 #define GETELEMENTPTR 365
325 #define EXTRACTELEMENT 381
326 #define INSERTELEMENT 382
327 #define SHUFFLEVECTOR 383
338 /* Copy the first part of user declarations. */
339 #line 14 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
341 #include "ParserInternals.h"
342 #include "llvm/CallingConv.h"
343 #include "llvm/InlineAsm.h"
344 #include "llvm/Instructions.h"
345 #include "llvm/Module.h"
346 #include "llvm/ValueSymbolTable.h"
347 #include "llvm/Support/GetElementPtrTypeIterator.h"
348 #include "llvm/Support/CommandLine.h"
349 #include "llvm/ADT/SmallVector.h"
350 #include "llvm/ADT/STLExtras.h"
351 #include "llvm/Support/MathExtras.h"
352 #include "llvm/Support/Streams.h"
361 // The following is a gross hack. In order to rid the libAsmParser library of
362 // exceptions, we have to have a way of getting the yyparse function to go into
363 // an error situation. So, whenever we want an error to occur, the GenerateError
364 // function (see bottom of file) sets TriggerError. Then, at the end of each
365 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
366 // (a goto) to put YACC in error state. Furthermore, several calls to
367 // GenerateError are made from inside productions and they must simulate the
368 // previous exception behavior by exiting the production immediately. We have
369 // replaced these with the GEN_ERROR macro which calls GeneratError and then
370 // immediately invokes YYERROR. This would be so much cleaner if it was a
371 // recursive descent parser.
372 static bool TriggerError = false;
373 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
374 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
376 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
377 int yylex(); // declaration" of xxx warnings.
381 std::string CurFilename;
384 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
385 cl::Hidden, cl::init(false));
388 using namespace llvm;
390 static Module *ParserResult;
392 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
393 // relating to upreferences in the input stream.
395 //#define DEBUG_UPREFS 1
397 #define UR_OUT(X) cerr << X
402 #define YYERROR_VERBOSE 1
404 static GlobalVariable *CurGV;
407 // This contains info used when building the body of a function. It is
408 // destroyed when the function is completed.
410 typedef std::vector<Value *> ValueList; // Numbered defs
413 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
415 static struct PerModuleInfo {
416 Module *CurrentModule;
417 ValueList Values; // Module level numbered definitions
418 ValueList LateResolveValues;
419 std::vector<PATypeHolder> Types;
420 std::map<ValID, PATypeHolder> LateResolveTypes;
422 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
423 /// how they were referenced and on which line of the input they came from so
424 /// that we can resolve them later and print error messages as appropriate.
425 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
427 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
428 // references to global values. Global values may be referenced before they
429 // are defined, and if so, the temporary object that they represent is held
430 // here. This is used for forward references of GlobalValues.
432 typedef std::map<std::pair<const PointerType *,
433 ValID>, GlobalValue*> GlobalRefsType;
434 GlobalRefsType GlobalRefs;
437 // If we could not resolve some functions at function compilation time
438 // (calls to functions before they are defined), resolve them now... Types
439 // are resolved when the constant pool has been completely parsed.
441 ResolveDefinitions(LateResolveValues);
445 // Check to make sure that all global value forward references have been
448 if (!GlobalRefs.empty()) {
449 std::string UndefinedReferences = "Unresolved global references exist:\n";
451 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
453 UndefinedReferences += " " + I->first.first->getDescription() + " " +
454 I->first.second.getName() + "\n";
456 GenerateError(UndefinedReferences);
460 Values.clear(); // Clear out function local definitions
465 // GetForwardRefForGlobal - Check to see if there is a forward reference
466 // for this global. If so, remove it from the GlobalRefs map and return it.
467 // If not, just return null.
468 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
469 // Check to see if there is a forward reference to this global variable...
470 // if there is, eliminate it and patch the reference to use the new def'n.
471 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
472 GlobalValue *Ret = 0;
473 if (I != GlobalRefs.end()) {
480 bool TypeIsUnresolved(PATypeHolder* PATy) {
481 // If it isn't abstract, its resolved
482 const Type* Ty = PATy->get();
483 if (!Ty->isAbstract())
485 // Traverse the type looking for abstract types. If it isn't abstract then
486 // we don't need to traverse that leg of the type.
487 std::vector<const Type*> WorkList, SeenList;
488 WorkList.push_back(Ty);
489 while (!WorkList.empty()) {
490 const Type* Ty = WorkList.back();
491 SeenList.push_back(Ty);
493 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
494 // Check to see if this is an unresolved type
495 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
496 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
497 for ( ; I != E; ++I) {
498 if (I->second.get() == OpTy)
501 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
502 const Type* TheTy = SeqTy->getElementType();
503 if (TheTy->isAbstract() && TheTy != Ty) {
504 std::vector<const Type*>::iterator I = SeenList.begin(),
510 WorkList.push_back(TheTy);
512 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
513 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
514 const Type* TheTy = StrTy->getElementType(i);
515 if (TheTy->isAbstract() && TheTy != Ty) {
516 std::vector<const Type*>::iterator I = SeenList.begin(),
522 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 // We're about to erase the entry, save the key so we can clean it up.
841 ValID Tmp = BBI->first;
843 // Erase the forward ref from the map as its no longer "forward"
844 CurFun.BBForwardRefs.erase(ID);
846 // The key has been removed from the map but so we don't want to leave
847 // strdup'd memory around so destroy it too.
850 // If its a numbered definition, bump the number and set the BB value.
851 if (ID.Type == ValID::LocalID) {
852 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
860 // We haven't seen this BB before and its first mention is a definition.
861 // Just create it and return it.
862 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
863 BB = new BasicBlock(Name, CurFun.CurrentFunction);
864 if (ID.Type == ValID::LocalID) {
865 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
869 ID.destroy(); // Free strdup'd memory
873 /// getBBVal - get an existing BB value or create a forward reference for it.
875 static BasicBlock *getBBVal(const ValID &ID) {
876 assert(inFunctionScope() && "Can't get basic block at global scope!");
880 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
881 if (BBI != CurFun.BBForwardRefs.end()) {
883 } if (ID.Type == ValID::LocalName) {
884 std::string Name = ID.Name;
885 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
887 if (N->getType()->getTypeID() == Type::LabelTyID)
888 BB = cast<BasicBlock>(N);
890 GenerateError("Reference to label '" + Name + "' is actually of type '"+
891 N->getType()->getDescription() + "'");
892 } else if (ID.Type == ValID::LocalID) {
893 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
894 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
895 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
897 GenerateError("Reference to label '%" + utostr(ID.Num) +
898 "' is actually of type '"+
899 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
902 GenerateError("Illegal label reference " + ID.getName());
906 // If its already been defined, return it now.
908 ID.destroy(); // Free strdup'd memory.
912 // Otherwise, this block has not been seen before, create it.
914 if (ID.Type == ValID::LocalName)
916 BB = new BasicBlock(Name, CurFun.CurrentFunction);
918 // Insert it in the forward refs map.
919 CurFun.BBForwardRefs[ID] = BB;
925 //===----------------------------------------------------------------------===//
926 // Code to handle forward references in instructions
927 //===----------------------------------------------------------------------===//
929 // This code handles the late binding needed with statements that reference
930 // values not defined yet... for example, a forward branch, or the PHI node for
933 // This keeps a table (CurFun.LateResolveValues) of all such forward references
934 // and back patchs after we are done.
937 // ResolveDefinitions - If we could not resolve some defs at parsing
938 // time (forward branches, phi functions for loops, etc...) resolve the
942 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
943 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
944 while (!LateResolvers.empty()) {
945 Value *V = LateResolvers.back();
946 LateResolvers.pop_back();
948 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
949 CurModule.PlaceHolderInfo.find(V);
950 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
952 ValID &DID = PHI->second.first;
954 Value *TheRealValue = getExistingVal(V->getType(), DID);
958 V->replaceAllUsesWith(TheRealValue);
960 CurModule.PlaceHolderInfo.erase(PHI);
961 } else if (FutureLateResolvers) {
962 // Functions have their unresolved items forwarded to the module late
964 InsertValue(V, *FutureLateResolvers);
966 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
967 GenerateError("Reference to an invalid definition: '" +DID.getName()+
968 "' of type '" + V->getType()->getDescription() + "'",
972 GenerateError("Reference to an invalid definition: #" +
973 itostr(DID.Num) + " of type '" +
974 V->getType()->getDescription() + "'",
980 LateResolvers.clear();
983 // ResolveTypeTo - A brand new type was just declared. This means that (if
984 // name is not null) things referencing Name can be resolved. Otherwise, things
985 // refering to the number can be resolved. Do this now.
987 static void ResolveTypeTo(char *Name, const Type *ToTy) {
989 if (Name) D = ValID::createLocalName(Name);
990 else D = ValID::createLocalID(CurModule.Types.size());
992 std::map<ValID, PATypeHolder>::iterator I =
993 CurModule.LateResolveTypes.find(D);
994 if (I != CurModule.LateResolveTypes.end()) {
995 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
996 CurModule.LateResolveTypes.erase(I);
1000 // setValueName - Set the specified value to the name given. The name may be
1001 // null potentially, in which case this is a noop. The string passed in is
1002 // assumed to be a malloc'd string buffer, and is free'd by this function.
1004 static void setValueName(Value *V, char *NameStr) {
1005 if (!NameStr) return;
1006 std::string Name(NameStr); // Copy string
1007 free(NameStr); // Free old string
1009 if (V->getType() == Type::VoidTy) {
1010 GenerateError("Can't assign name '" + Name+"' to value with void type");
1014 assert(inFunctionScope() && "Must be in function scope!");
1015 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1016 if (ST.lookup(Name)) {
1017 GenerateError("Redefinition of value '" + Name + "' of type '" +
1018 V->getType()->getDescription() + "'");
1026 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1027 /// this is a declaration, otherwise it is a definition.
1028 static GlobalVariable *
1029 ParseGlobalVariable(char *NameStr,
1030 GlobalValue::LinkageTypes Linkage,
1031 GlobalValue::VisibilityTypes Visibility,
1032 bool isConstantGlobal, const Type *Ty,
1033 Constant *Initializer, bool IsThreadLocal) {
1034 if (isa<FunctionType>(Ty)) {
1035 GenerateError("Cannot declare global vars of function type");
1039 const PointerType *PTy = PointerType::get(Ty);
1043 Name = NameStr; // Copy string
1044 free(NameStr); // Free old string
1047 // See if this global value was forward referenced. If so, recycle the
1050 if (!Name.empty()) {
1051 ID = ValID::createGlobalName((char*)Name.c_str());
1053 ID = ValID::createGlobalID(CurModule.Values.size());
1056 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1057 // Move the global to the end of the list, from whereever it was
1058 // previously inserted.
1059 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1060 CurModule.CurrentModule->getGlobalList().remove(GV);
1061 CurModule.CurrentModule->getGlobalList().push_back(GV);
1062 GV->setInitializer(Initializer);
1063 GV->setLinkage(Linkage);
1064 GV->setVisibility(Visibility);
1065 GV->setConstant(isConstantGlobal);
1066 GV->setThreadLocal(IsThreadLocal);
1067 InsertValue(GV, CurModule.Values);
1071 // If this global has a name
1072 if (!Name.empty()) {
1073 // if the global we're parsing has an initializer (is a definition) and
1074 // has external linkage.
1075 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1076 // If there is already a global with external linkage with this name
1077 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1078 // If we allow this GVar to get created, it will be renamed in the
1079 // symbol table because it conflicts with an existing GVar. We can't
1080 // allow redefinition of GVars whose linking indicates that their name
1081 // must stay the same. Issue the error.
1082 GenerateError("Redefinition of global variable named '" + Name +
1083 "' of type '" + Ty->getDescription() + "'");
1088 // Otherwise there is no existing GV to use, create one now.
1089 GlobalVariable *GV =
1090 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1091 CurModule.CurrentModule, IsThreadLocal);
1092 GV->setVisibility(Visibility);
1093 InsertValue(GV, CurModule.Values);
1097 // setTypeName - Set the specified type to the name given. The name may be
1098 // null potentially, in which case this is a noop. The string passed in is
1099 // assumed to be a malloc'd string buffer, and is freed by this function.
1101 // This function returns true if the type has already been defined, but is
1102 // allowed to be redefined in the specified context. If the name is a new name
1103 // for the type plane, it is inserted and false is returned.
1104 static bool setTypeName(const Type *T, char *NameStr) {
1105 assert(!inFunctionScope() && "Can't give types function-local names!");
1106 if (NameStr == 0) return false;
1108 std::string Name(NameStr); // Copy string
1109 free(NameStr); // Free old string
1111 // We don't allow assigning names to void type
1112 if (T == Type::VoidTy) {
1113 GenerateError("Can't assign name '" + Name + "' to the void type");
1117 // Set the type name, checking for conflicts as we do so.
1118 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1120 if (AlreadyExists) { // Inserting a name that is already defined???
1121 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1122 assert(Existing && "Conflict but no matching type?!");
1124 // There is only one case where this is allowed: when we are refining an
1125 // opaque type. In this case, Existing will be an opaque type.
1126 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1127 // We ARE replacing an opaque type!
1128 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1132 // Otherwise, this is an attempt to redefine a type. That's okay if
1133 // the redefinition is identical to the original. This will be so if
1134 // Existing and T point to the same Type object. In this one case we
1135 // allow the equivalent redefinition.
1136 if (Existing == T) return true; // Yes, it's equal.
1138 // Any other kind of (non-equivalent) redefinition is an error.
1139 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1140 T->getDescription() + "'");
1146 //===----------------------------------------------------------------------===//
1147 // Code for handling upreferences in type names...
1150 // TypeContains - Returns true if Ty directly contains E in it.
1152 static bool TypeContains(const Type *Ty, const Type *E) {
1153 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1154 E) != Ty->subtype_end();
1158 struct UpRefRecord {
1159 // NestingLevel - The number of nesting levels that need to be popped before
1160 // this type is resolved.
1161 unsigned NestingLevel;
1163 // LastContainedTy - This is the type at the current binding level for the
1164 // type. Every time we reduce the nesting level, this gets updated.
1165 const Type *LastContainedTy;
1167 // UpRefTy - This is the actual opaque type that the upreference is
1168 // represented with.
1169 OpaqueType *UpRefTy;
1171 UpRefRecord(unsigned NL, OpaqueType *URTy)
1172 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1176 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1177 static std::vector<UpRefRecord> UpRefs;
1179 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1180 /// called. It loops through the UpRefs vector, which is a list of the
1181 /// currently active types. For each type, if the up reference is contained in
1182 /// the newly completed type, we decrement the level count. When the level
1183 /// count reaches zero, the upreferenced type is the type that is passed in:
1184 /// thus we can complete the cycle.
1186 static PATypeHolder HandleUpRefs(const Type *ty) {
1187 // If Ty isn't abstract, or if there are no up-references in it, then there is
1188 // nothing to resolve here.
1189 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1191 PATypeHolder Ty(ty);
1192 UR_OUT("Type '" << Ty->getDescription() <<
1193 "' newly formed. Resolving upreferences.\n" <<
1194 UpRefs.size() << " upreferences active!\n");
1196 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1197 // to zero), we resolve them all together before we resolve them to Ty. At
1198 // the end of the loop, if there is anything to resolve to Ty, it will be in
1200 OpaqueType *TypeToResolve = 0;
1202 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1203 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1204 << UpRefs[i].second->getDescription() << ") = "
1205 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1206 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1207 // Decrement level of upreference
1208 unsigned Level = --UpRefs[i].NestingLevel;
1209 UpRefs[i].LastContainedTy = Ty;
1210 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1211 if (Level == 0) { // Upreference should be resolved!
1212 if (!TypeToResolve) {
1213 TypeToResolve = UpRefs[i].UpRefTy;
1215 UR_OUT(" * Resolving upreference for "
1216 << UpRefs[i].second->getDescription() << "\n";
1217 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1218 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1219 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1220 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1222 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1223 --i; // Do not skip the next element...
1228 if (TypeToResolve) {
1229 UR_OUT(" * Resolving upreference for "
1230 << UpRefs[i].second->getDescription() << "\n";
1231 std::string OldName = TypeToResolve->getDescription());
1232 TypeToResolve->refineAbstractTypeTo(Ty);
1238 //===----------------------------------------------------------------------===//
1239 // RunVMAsmParser - Define an interface to this parser
1240 //===----------------------------------------------------------------------===//
1242 static Module* RunParser(Module * M);
1244 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1247 CurFilename = Filename;
1248 return RunParser(new Module(CurFilename));
1251 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1252 set_scan_string(AsmString);
1254 CurFilename = "from_memory";
1256 return RunParser(new Module (CurFilename));
1258 return RunParser(M);
1264 /* Enabling traces. */
1269 /* Enabling verbose error messages. */
1270 #ifdef YYERROR_VERBOSE
1271 # undef YYERROR_VERBOSE
1272 # define YYERROR_VERBOSE 1
1274 # define YYERROR_VERBOSE 0
1277 /* Enabling the token table. */
1278 #ifndef YYTOKEN_TABLE
1279 # define YYTOKEN_TABLE 0
1282 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1283 #line 938 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
1284 typedef union YYSTYPE {
1285 llvm::Module *ModuleVal;
1286 llvm::Function *FunctionVal;
1287 llvm::BasicBlock *BasicBlockVal;
1288 llvm::TerminatorInst *TermInstVal;
1289 llvm::Instruction *InstVal;
1290 llvm::Constant *ConstVal;
1292 const llvm::Type *PrimType;
1293 std::list<llvm::PATypeHolder> *TypeList;
1294 llvm::PATypeHolder *TypeVal;
1295 llvm::Value *ValueVal;
1296 std::vector<llvm::Value*> *ValueList;
1297 llvm::ArgListType *ArgList;
1298 llvm::TypeWithAttrs TypeWithAttrs;
1299 llvm::TypeWithAttrsList *TypeWithAttrsList;
1300 llvm::ValueRefList *ValueRefList;
1302 // Represent the RHS of PHI node
1303 std::list<std::pair<llvm::Value*,
1304 llvm::BasicBlock*> > *PHIList;
1305 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1306 std::vector<llvm::Constant*> *ConstVector;
1308 llvm::GlobalValue::LinkageTypes Linkage;
1309 llvm::GlobalValue::VisibilityTypes Visibility;
1310 uint16_t ParamAttrs;
1311 llvm::APInt *APIntVal;
1319 char *StrVal; // This memory is strdup'd!
1320 llvm::ValID ValIDVal; // strdup'd memory maybe!
1322 llvm::Instruction::BinaryOps BinaryOpVal;
1323 llvm::Instruction::TermOps TermOpVal;
1324 llvm::Instruction::MemoryOps MemOpVal;
1325 llvm::Instruction::CastOps CastOpVal;
1326 llvm::Instruction::OtherOps OtherOpVal;
1327 llvm::ICmpInst::Predicate IPredicate;
1328 llvm::FCmpInst::Predicate FPredicate;
1330 /* Line 196 of yacc.c. */
1331 #line 1332 "llvmAsmParser.tab.c"
1332 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1333 # define YYSTYPE_IS_DECLARED 1
1334 # define YYSTYPE_IS_TRIVIAL 1
1339 /* Copy the second part of user declarations. */
1342 /* Line 219 of yacc.c. */
1343 #line 1344 "llvmAsmParser.tab.c"
1345 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1346 # define YYSIZE_T __SIZE_TYPE__
1348 #if ! defined (YYSIZE_T) && defined (size_t)
1349 # define YYSIZE_T size_t
1351 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1352 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1353 # define YYSIZE_T size_t
1355 #if ! defined (YYSIZE_T)
1356 # define YYSIZE_T unsigned int
1362 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1363 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1367 # define YY_(msgid) msgid
1371 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1373 /* The parser invokes alloca or malloc; define the necessary symbols. */
1375 # ifdef YYSTACK_USE_ALLOCA
1376 # if YYSTACK_USE_ALLOCA
1378 # define YYSTACK_ALLOC __builtin_alloca
1380 # define YYSTACK_ALLOC alloca
1381 # if defined (__STDC__) || defined (__cplusplus)
1382 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1383 # define YYINCLUDED_STDLIB_H
1389 # ifdef YYSTACK_ALLOC
1390 /* Pacify GCC's `empty if-body' warning. */
1391 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1392 # ifndef YYSTACK_ALLOC_MAXIMUM
1393 /* The OS might guarantee only one guard page at the bottom of the stack,
1394 and a page size can be as small as 4096 bytes. So we cannot safely
1395 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1396 to allow for a few compiler-allocated temporary stack slots. */
1397 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1400 # define YYSTACK_ALLOC YYMALLOC
1401 # define YYSTACK_FREE YYFREE
1402 # ifndef YYSTACK_ALLOC_MAXIMUM
1403 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1409 # define YYMALLOC malloc
1410 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1411 && (defined (__STDC__) || defined (__cplusplus)))
1412 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1416 # define YYFREE free
1417 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1418 && (defined (__STDC__) || defined (__cplusplus)))
1419 void free (void *); /* INFRINGES ON USER NAME SPACE */
1426 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1429 #if (! defined (yyoverflow) \
1430 && (! defined (__cplusplus) \
1431 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1433 /* A type that is properly aligned for any stack member. */
1440 /* The size of the maximum gap between one aligned stack and the next. */
1441 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1443 /* The size of an array large to enough to hold all stacks, each with
1445 # define YYSTACK_BYTES(N) \
1446 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1447 + YYSTACK_GAP_MAXIMUM)
1449 /* Copy COUNT objects from FROM to TO. The source and destination do
1452 # if defined (__GNUC__) && 1 < __GNUC__
1453 # define YYCOPY(To, From, Count) \
1454 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1456 # define YYCOPY(To, From, Count) \
1460 for (yyi = 0; yyi < (Count); yyi++) \
1461 (To)[yyi] = (From)[yyi]; \
1467 /* Relocate STACK from its old location to the new one. The
1468 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1469 elements in the stack, and YYPTR gives the new location of the
1470 stack. Advance YYPTR to a properly aligned location for the next
1472 # define YYSTACK_RELOCATE(Stack) \
1475 YYSIZE_T yynewbytes; \
1476 YYCOPY (&yyptr->Stack, Stack, yysize); \
1477 Stack = &yyptr->Stack; \
1478 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1479 yyptr += yynewbytes / sizeof (*yyptr); \
1485 #if defined (__STDC__) || defined (__cplusplus)
1486 typedef signed char yysigned_char;
1488 typedef short int yysigned_char;
1491 /* YYFINAL -- State number of the termination state. */
1493 /* YYLAST -- Last index in YYTABLE. */
1496 /* YYNTOKENS -- Number of terminals. */
1497 #define YYNTOKENS 149
1498 /* YYNNTS -- Number of nonterminals. */
1500 /* YYNRULES -- Number of rules. */
1501 #define YYNRULES 288
1502 /* YYNRULES -- Number of states. */
1503 #define YYNSTATES 563
1505 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1506 #define YYUNDEFTOK 2
1507 #define YYMAXUTOK 389
1509 #define YYTRANSLATE(YYX) \
1510 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1512 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1513 static const unsigned char yytranslate[] =
1515 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1519 139, 140, 137, 2, 136, 2, 2, 2, 2, 2,
1520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1521 144, 135, 145, 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, 141, 138, 143, 2, 2, 2, 2, 2, 148,
1525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1527 142, 2, 2, 146, 2, 147, 2, 2, 2, 2,
1528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1540 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1541 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1542 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1543 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1544 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1545 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1546 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1547 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1548 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1549 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1550 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1551 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1552 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1553 125, 126, 127, 128, 129, 130, 131, 132, 133, 134
1557 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1559 static const unsigned short int yyprhs[] =
1561 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1562 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1563 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1564 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1565 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1566 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1567 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1568 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1569 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
1570 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1571 195, 197, 199, 200, 203, 204, 207, 208, 212, 215,
1572 216, 218, 219, 223, 225, 228, 230, 232, 234, 236,
1573 238, 240, 243, 245, 248, 254, 260, 266, 272, 276,
1574 279, 285, 290, 293, 295, 297, 299, 303, 305, 309,
1575 311, 312, 314, 318, 323, 327, 331, 336, 341, 345,
1576 352, 358, 361, 364, 367, 370, 373, 376, 379, 382,
1577 385, 388, 391, 394, 401, 407, 416, 423, 430, 438,
1578 446, 453, 462, 471, 475, 477, 479, 481, 483, 484,
1579 486, 487, 489, 492, 493, 497, 498, 502, 506, 510,
1580 514, 515, 523, 524, 533, 534, 543, 546, 550, 552,
1581 556, 560, 564, 568, 570, 571, 577, 581, 583, 587,
1582 589, 590, 600, 602, 604, 609, 611, 613, 616, 620,
1583 621, 623, 625, 627, 629, 631, 633, 635, 637, 639,
1584 643, 645, 651, 653, 655, 657, 659, 661, 663, 666,
1585 669, 672, 676, 679, 680, 682, 685, 688, 692, 702,
1586 712, 721, 736, 738, 740, 747, 753, 756, 763, 771,
1587 775, 781, 782, 783, 787, 790, 792, 798, 804, 811,
1588 818, 823, 830, 835, 840, 847, 854, 857, 866, 868,
1589 870, 871, 875, 882, 886, 893, 896, 901, 908
1592 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1593 static const short int yyrhs[] =
1595 190, 0, -1, 68, -1, 69, -1, 70, -1, 71,
1596 -1, 72, -1, 73, -1, 74, -1, 75, -1, 76,
1597 -1, 80, -1, 81, -1, 82, -1, 77, -1, 78,
1598 -1, 79, -1, 111, -1, 112, -1, 113, -1, 114,
1599 -1, 115, -1, 116, -1, 117, -1, 118, -1, 119,
1600 -1, 120, -1, 121, -1, 122, -1, 85, -1, 86,
1601 -1, 87, -1, 88, -1, 89, -1, 90, -1, 91,
1602 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1603 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1604 -1, 102, -1, 103, -1, 104, -1, 91, -1, 92,
1605 -1, 93, -1, 94, -1, 22, -1, 23, -1, 11,
1606 -1, 12, -1, 13, -1, 16, -1, 19, -1, 157,
1607 -1, -1, 157, 135, -1, -1, 17, -1, 20, -1,
1608 160, 135, -1, -1, 37, -1, 39, -1, 38, -1,
1609 40, -1, 42, -1, 41, -1, 43, -1, 45, -1,
1610 -1, 134, -1, -1, 41, -1, 43, -1, -1, 37,
1611 -1, 38, -1, 39, -1, 42, -1, -1, 56, -1,
1612 57, -1, 58, -1, 59, -1, 60, -1, 55, 4,
1613 -1, 112, -1, 113, -1, 130, -1, 131, -1, -1,
1614 169, 168, -1, 129, -1, 132, -1, 168, -1, -1,
1615 171, 170, -1, -1, 48, 4, -1, -1, 136, 48,
1616 4, -1, 30, 19, -1, -1, 174, -1, -1, 136,
1617 177, 176, -1, 174, -1, 48, 4, -1, 11, -1,
1618 12, -1, 13, -1, 14, -1, 44, -1, 178, -1,
1619 179, 137, -1, 212, -1, 138, 4, -1, 179, 139,
1620 183, 140, 171, -1, 10, 139, 183, 140, 171, -1,
1621 141, 4, 142, 179, 143, -1, 144, 4, 142, 179,
1622 145, -1, 146, 184, 147, -1, 146, 147, -1, 144,
1623 146, 184, 147, 145, -1, 144, 146, 147, 145, -1,
1624 179, 169, -1, 179, -1, 10, -1, 180, -1, 182,
1625 136, 180, -1, 182, -1, 182, 136, 34, -1, 34,
1626 -1, -1, 179, -1, 184, 136, 179, -1, 179, 141,
1627 187, 143, -1, 179, 141, 143, -1, 179, 148, 19,
1628 -1, 179, 144, 187, 145, -1, 179, 146, 187, 147,
1629 -1, 179, 146, 147, -1, 179, 144, 146, 187, 147,
1630 145, -1, 179, 144, 146, 147, 145, -1, 179, 35,
1631 -1, 179, 36, -1, 179, 212, -1, 179, 186, -1,
1632 179, 21, -1, 155, 3, -1, 155, 5, -1, 155,
1633 4, -1, 155, 6, -1, 11, 22, -1, 11, 23,
1634 -1, 156, 9, -1, 152, 139, 185, 33, 179, 140,
1635 -1, 110, 139, 185, 223, 140, -1, 124, 139, 185,
1636 136, 185, 136, 185, 140, -1, 150, 139, 185, 136,
1637 185, 140, -1, 151, 139, 185, 136, 185, 140, -1,
1638 83, 153, 139, 185, 136, 185, 140, -1, 84, 154,
1639 139, 185, 136, 185, 140, -1, 126, 139, 185, 136,
1640 185, 140, -1, 127, 139, 185, 136, 185, 136, 185,
1641 140, -1, 128, 139, 185, 136, 185, 136, 185, 140,
1642 -1, 187, 136, 185, -1, 185, -1, 28, -1, 29,
1643 -1, 32, -1, -1, 191, -1, -1, 192, -1, 191,
1644 192, -1, -1, 27, 193, 208, -1, -1, 26, 194,
1645 209, -1, 53, 52, 198, -1, 159, 15, 179, -1,
1646 159, 15, 10, -1, -1, 161, 164, 189, 188, 185,
1647 195, 176, -1, -1, 161, 162, 164, 189, 188, 185,
1648 196, 176, -1, -1, 161, 163, 164, 189, 188, 179,
1649 197, 176, -1, 46, 199, -1, 49, 135, 200, -1,
1650 19, -1, 47, 135, 19, -1, 61, 135, 19, -1,
1651 141, 201, 143, -1, 201, 136, 19, -1, 19, -1,
1652 -1, 202, 136, 179, 169, 158, -1, 179, 169, 158,
1653 -1, 202, -1, 202, 136, 34, -1, 34, -1, -1,
1654 167, 181, 160, 139, 203, 140, 171, 175, 172, -1,
1655 24, -1, 146, -1, 166, 164, 204, 205, -1, 25,
1656 -1, 147, -1, 215, 207, -1, 165, 164, 204, -1,
1657 -1, 54, -1, 3, -1, 4, -1, 9, -1, 22,
1658 -1, 23, -1, 35, -1, 36, -1, 21, -1, 144,
1659 187, 145, -1, 186, -1, 52, 210, 19, 136, 19,
1660 -1, 7, -1, 8, -1, 157, -1, 160, -1, 212,
1661 -1, 211, -1, 179, 213, -1, 215, 216, -1, 206,
1662 216, -1, 217, 159, 218, -1, 217, 220, -1, -1,
1663 18, -1, 62, 214, -1, 62, 10, -1, 63, 14,
1664 213, -1, 63, 11, 213, 136, 14, 213, 136, 14,
1665 213, -1, 64, 155, 213, 136, 14, 213, 141, 219,
1666 143, -1, 64, 155, 213, 136, 14, 213, 141, 143,
1667 -1, 65, 167, 181, 213, 139, 222, 140, 171, 33,
1668 14, 213, 66, 14, 213, -1, 66, -1, 67, -1,
1669 219, 155, 211, 136, 14, 213, -1, 155, 211, 136,
1670 14, 213, -1, 159, 225, -1, 179, 141, 213, 136,
1671 213, 143, -1, 221, 136, 141, 213, 136, 213, 143,
1672 -1, 179, 213, 169, -1, 222, 136, 179, 213, 169,
1673 -1, -1, -1, 223, 136, 214, -1, 51, 50, -1,
1674 50, -1, 150, 179, 213, 136, 213, -1, 151, 179,
1675 213, 136, 213, -1, 83, 153, 179, 213, 136, 213,
1676 -1, 84, 154, 179, 213, 136, 213, -1, 152, 214,
1677 33, 179, -1, 124, 214, 136, 214, 136, 214, -1,
1678 125, 214, 136, 179, -1, 126, 214, 136, 214, -1,
1679 127, 214, 136, 214, 136, 214, -1, 128, 214, 136,
1680 214, 136, 214, -1, 123, 221, -1, 224, 167, 181,
1681 213, 139, 222, 140, 171, -1, 227, -1, 31, -1,
1682 -1, 105, 179, 173, -1, 105, 179, 136, 11, 213,
1683 173, -1, 106, 179, 173, -1, 106, 179, 136, 11,
1684 213, 173, -1, 107, 214, -1, 226, 108, 179, 213,
1685 -1, 226, 109, 214, 136, 179, 213, -1, 110, 179,
1689 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1690 static const unsigned short int yyrline[] =
1692 0, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093,
1693 1093, 1094, 1094, 1094, 1094, 1094, 1094, 1095, 1095, 1095,
1694 1095, 1095, 1095, 1096, 1096, 1096, 1096, 1096, 1096, 1099,
1695 1099, 1100, 1100, 1101, 1101, 1102, 1102, 1103, 1103, 1107,
1696 1107, 1108, 1108, 1109, 1109, 1110, 1110, 1111, 1111, 1112,
1697 1112, 1113, 1113, 1114, 1115, 1120, 1121, 1121, 1123, 1123,
1698 1124, 1124, 1128, 1132, 1137, 1137, 1139, 1143, 1149, 1150,
1699 1151, 1152, 1153, 1157, 1158, 1159, 1163, 1164, 1168, 1169,
1700 1170, 1174, 1175, 1176, 1177, 1178, 1181, 1182, 1183, 1184,
1701 1185, 1186, 1187, 1194, 1195, 1196, 1197, 1200, 1201, 1206,
1702 1207, 1208, 1211, 1212, 1219, 1220, 1226, 1227, 1235, 1243,
1703 1244, 1249, 1250, 1251, 1256, 1269, 1269, 1269, 1269, 1272,
1704 1276, 1280, 1287, 1292, 1300, 1326, 1353, 1358, 1370, 1380,
1705 1384, 1394, 1401, 1408, 1415, 1420, 1425, 1432, 1433, 1440,
1706 1447, 1455, 1461, 1473, 1501, 1517, 1546, 1574, 1599, 1618,
1707 1644, 1664, 1676, 1683, 1749, 1759, 1769, 1775, 1785, 1791,
1708 1801, 1806, 1811, 1819, 1831, 1853, 1861, 1867, 1878, 1883,
1709 1888, 1894, 1900, 1909, 1913, 1921, 1921, 1924, 1924, 1935,
1710 1940, 1948, 1949, 1953, 1953, 1957, 1957, 1960, 1963, 1987,
1711 1998, 1998, 2008, 2008, 2016, 2016, 2026, 2029, 2035, 2048,
1712 2052, 2057, 2059, 2064, 2069, 2078, 2088, 2099, 2103, 2112,
1713 2121, 2126, 2245, 2245, 2247, 2256, 2256, 2258, 2263, 2275,
1714 2279, 2284, 2288, 2292, 2296, 2300, 2304, 2308, 2312, 2316,
1715 2341, 2345, 2359, 2363, 2367, 2371, 2377, 2377, 2383, 2392,
1716 2396, 2405, 2414, 2423, 2427, 2432, 2436, 2440, 2445, 2455,
1717 2474, 2483, 2559, 2563, 2570, 2581, 2594, 2604, 2615, 2625,
1718 2634, 2643, 2646, 2647, 2654, 2658, 2663, 2684, 2701, 2715,
1719 2729, 2741, 2749, 2756, 2762, 2768, 2774, 2789, 2870, 2875,
1720 2879, 2886, 2893, 2901, 2908, 2916, 2924, 2938, 2955
1724 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1725 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1726 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1727 static const char *const yytname[] =
1729 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1730 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1731 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1732 "STRINGCONSTANT", "ATSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1733 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1734 "CONSTANT", "SECTION", "VOLATILE", "THREAD_LOCAL", "TO", "DOTDOTDOT",
1735 "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING",
1736 "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET",
1737 "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1738 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK",
1739 "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR",
1740 "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV",
1741 "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL",
1742 "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1743 "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE",
1744 "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1745 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1746 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1747 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1748 "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "NOUNWIND", "DEFAULT",
1749 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1750 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1751 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1752 "FPType", "LocalName", "OptLocalName", "OptLocalAssign", "GlobalName",
1753 "OptGlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1754 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1755 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1756 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1757 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1758 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1759 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1760 "Module", "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5",
1761 "AsmBlock", "TargetDefinition", "LibrariesDefinition", "LibList",
1762 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1763 "END", "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1764 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1765 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1766 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1767 "OptVolatile", "MemoryInst", 0
1772 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1774 static const unsigned short int yytoknum[] =
1776 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1777 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1778 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1779 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1780 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1781 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1782 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1783 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1784 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1785 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1786 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1787 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1788 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1789 385, 386, 387, 388, 389, 61, 44, 42, 92, 40,
1790 41, 91, 120, 93, 60, 62, 123, 125, 99
1794 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1795 static const unsigned char yyr1[] =
1797 0, 149, 150, 150, 150, 150, 150, 150, 150, 150,
1798 150, 151, 151, 151, 151, 151, 151, 152, 152, 152,
1799 152, 152, 152, 152, 152, 152, 152, 152, 152, 153,
1800 153, 153, 153, 153, 153, 153, 153, 153, 153, 154,
1801 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
1802 154, 154, 154, 154, 154, 155, 156, 156, 157, 157,
1803 158, 158, 159, 159, 160, 160, 161, 161, 162, 162,
1804 162, 162, 162, 163, 163, 163, 164, 164, 165, 165,
1805 165, 166, 166, 166, 166, 166, 167, 167, 167, 167,
1806 167, 167, 167, 168, 168, 168, 168, 169, 169, 170,
1807 170, 170, 171, 171, 172, 172, 173, 173, 174, 175,
1808 175, 176, 176, 177, 177, 178, 178, 178, 178, 179,
1809 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
1810 179, 179, 180, 181, 181, 182, 182, 183, 183, 183,
1811 183, 184, 184, 185, 185, 185, 185, 185, 185, 185,
1812 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
1813 185, 185, 185, 186, 186, 186, 186, 186, 186, 186,
1814 186, 186, 186, 187, 187, 188, 188, 189, 189, 190,
1815 190, 191, 191, 193, 192, 194, 192, 192, 192, 192,
1816 195, 192, 196, 192, 197, 192, 192, 192, 198, 199,
1817 199, 200, 201, 201, 201, 202, 202, 203, 203, 203,
1818 203, 204, 205, 205, 206, 207, 207, 208, 209, 210,
1819 210, 211, 211, 211, 211, 211, 211, 211, 211, 211,
1820 211, 211, 212, 212, 212, 212, 213, 213, 214, 215,
1821 215, 216, 217, 217, 217, 218, 218, 218, 218, 218,
1822 218, 218, 218, 218, 219, 219, 220, 221, 221, 222,
1823 222, 222, 223, 223, 224, 224, 225, 225, 225, 225,
1824 225, 225, 225, 225, 225, 225, 225, 225, 225, 226,
1825 226, 227, 227, 227, 227, 227, 227, 227, 227
1828 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1829 static const unsigned char yyr2[] =
1831 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1832 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1833 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1834 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1835 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1836 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1837 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1838 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1839 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
1840 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1841 1, 1, 0, 2, 0, 2, 0, 3, 2, 0,
1842 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1843 1, 2, 1, 2, 5, 5, 5, 5, 3, 2,
1844 5, 4, 2, 1, 1, 1, 3, 1, 3, 1,
1845 0, 1, 3, 4, 3, 3, 4, 4, 3, 6,
1846 5, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1847 2, 2, 2, 6, 5, 8, 6, 6, 7, 7,
1848 6, 8, 8, 3, 1, 1, 1, 1, 0, 1,
1849 0, 1, 2, 0, 3, 0, 3, 3, 3, 3,
1850 0, 7, 0, 8, 0, 8, 2, 3, 1, 3,
1851 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1852 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1853 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1854 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1855 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1856 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1857 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1858 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1859 0, 3, 6, 3, 6, 2, 4, 6, 4
1862 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1863 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1864 means the default is an error. */
1865 static const unsigned short int yydefact[] =
1867 67, 58, 64, 59, 65, 185, 183, 0, 0, 0,
1868 0, 0, 0, 76, 0, 67, 181, 78, 81, 0,
1869 0, 196, 0, 0, 62, 0, 66, 68, 70, 69,
1870 71, 73, 72, 74, 75, 77, 76, 76, 178, 1,
1871 182, 79, 80, 76, 186, 82, 83, 84, 85, 76,
1872 243, 184, 243, 0, 0, 204, 197, 198, 187, 232,
1873 233, 189, 115, 116, 117, 118, 119, 0, 0, 0,
1874 0, 234, 235, 120, 188, 122, 178, 178, 177, 0,
1875 86, 86, 244, 240, 63, 215, 216, 217, 239, 199,
1876 200, 203, 0, 140, 123, 0, 0, 0, 0, 129,
1877 141, 0, 121, 140, 0, 0, 175, 176, 0, 0,
1878 87, 88, 89, 90, 91, 0, 218, 0, 280, 242,
1879 0, 201, 139, 97, 135, 137, 0, 0, 0, 0,
1880 0, 0, 128, 0, 0, 0, 115, 116, 117, 0,
1881 0, 0, 190, 92, 134, 133, 0, 212, 213, 214,
1882 279, 265, 0, 0, 0, 0, 86, 252, 253, 2,
1883 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
1884 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
1885 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1886 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
1887 0, 241, 86, 256, 0, 278, 202, 132, 0, 102,
1888 0, 0, 131, 0, 142, 102, 192, 194, 160, 161,
1889 156, 158, 157, 159, 162, 155, 151, 152, 0, 0,
1890 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1891 0, 0, 154, 153, 111, 0, 264, 246, 0, 245,
1892 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
1893 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
1894 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
1895 47, 48, 0, 106, 106, 285, 0, 0, 276, 0,
1896 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1897 93, 94, 95, 96, 98, 138, 136, 125, 126, 127,
1898 130, 124, 111, 111, 0, 0, 0, 0, 0, 0,
1899 0, 144, 174, 0, 0, 0, 148, 0, 145, 0,
1900 0, 0, 0, 191, 210, 221, 222, 223, 228, 224,
1901 225, 226, 227, 219, 0, 230, 237, 236, 238, 0,
1902 247, 0, 0, 0, 0, 0, 281, 0, 283, 262,
1903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1904 0, 0, 0, 99, 100, 101, 103, 193, 195, 0,
1905 0, 262, 0, 0, 0, 0, 0, 143, 129, 141,
1906 0, 146, 147, 0, 0, 0, 0, 0, 113, 111,
1907 209, 97, 207, 0, 220, 0, 0, 0, 0, 0,
1908 0, 0, 0, 0, 0, 288, 0, 0, 0, 272,
1909 273, 0, 0, 0, 0, 270, 0, 286, 0, 0,
1910 0, 0, 0, 0, 0, 0, 173, 150, 0, 0,
1911 0, 0, 108, 114, 112, 61, 0, 102, 0, 229,
1912 0, 0, 261, 0, 0, 106, 107, 106, 0, 0,
1913 0, 0, 0, 0, 266, 267, 261, 0, 0, 0,
1914 164, 0, 0, 0, 0, 149, 0, 0, 0, 60,
1915 206, 208, 97, 109, 0, 0, 0, 0, 0, 268,
1916 269, 0, 282, 284, 263, 0, 0, 271, 274, 275,
1917 0, 287, 0, 0, 0, 170, 0, 0, 166, 167,
1918 163, 61, 110, 104, 231, 0, 0, 97, 0, 102,
1919 257, 0, 102, 168, 169, 0, 0, 0, 205, 0,
1920 211, 0, 250, 0, 0, 259, 0, 0, 258, 277,
1921 165, 171, 172, 105, 248, 0, 249, 0, 97, 0,
1922 0, 0, 260, 0, 0, 0, 0, 255, 0, 0,
1926 /* YYDEFGOTO[NTERM-NUM]. */
1927 static const short int yydefgoto[] =
1929 -1, 239, 240, 241, 265, 282, 139, 140, 71, 480,
1930 11, 72, 13, 36, 37, 38, 43, 49, 115, 304,
1931 207, 376, 307, 530, 356, 398, 513, 333, 399, 73,
1932 141, 124, 146, 125, 126, 101, 322, 345, 323, 108,
1933 79, 14, 15, 16, 18, 17, 244, 312, 313, 58,
1934 21, 56, 92, 402, 403, 116, 149, 50, 87, 51,
1935 44, 405, 346, 75, 348, 249, 52, 83, 84, 201,
1936 534, 119, 288, 488, 415, 202, 203, 204, 205
1939 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1941 #define YYPACT_NINF -476
1942 static const short int yypact[] =
1944 28, -476, -476, -476, -476, -476, -476, -10, -55, 8,
1945 -33, 97, 3, 55, 167, 394, -476, 172, 210, 86,
1946 98, -476, 102, 219, -476, 1017, -476, -476, -476, -476,
1947 -476, -476, -476, -476, -476, -476, 123, 123, 218, -476,
1948 -476, -476, -476, 123, -476, -476, -476, -476, -476, 123,
1949 241, -476, 2, 242, 251, 253, -476, -476, -476, -476,
1950 -476, 137, -476, -476, -476, -476, -476, 274, 283, 1,
1951 456, -476, -476, -476, 83, -476, 218, 218, -476, 103,
1952 291, 291, -476, -476, 121, -476, -476, -476, -476, -476,
1953 -476, -476, -26, 874, -476, 148, 149, 470, 137, -476,
1954 83, -97, -476, 874, 103, 103, -476, -476, 1031, 288,
1955 -476, -476, -476, -476, -476, 1073, -476, -7, 1172, -476,
1956 282, -476, -476, 83, -476, 157, 162, 1087, 1087, 158,
1957 -61, 1087, -476, 165, 1031, 1087, 60, 297, 298, 201,
1958 299, 656, -476, -476, 137, 83, 217, -476, -476, -476,
1959 -476, -476, 262, 1129, 257, 302, 291, -476, -476, -476,
1960 -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,
1961 -476, -476, -476, -476, 461, 273, 1087, 1087, 1087, 1087,
1962 -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,
1963 -476, -476, 1087, 1087, 1087, 1087, 1087, 1087, 1087, 1087,
1964 1087, -476, 291, -476, 74, -476, -476, -25, 914, -476,
1965 19, 41, -476, 175, 83, -476, -476, 83, -476, -476,
1966 -476, -476, -476, -476, -476, -476, -476, -476, 461, 273,
1967 178, 182, 183, 184, 186, 933, 1171, 552, 309, 190,
1968 191, 194, -476, -476, 199, 197, -476, 137, 509, -476,
1969 635, 635, -476, 635, 1073, -476, -476, -476, -476, -476,
1970 -476, -476, -476, -476, -476, 1087, -476, -476, -476, -476,
1971 -476, -476, -476, -476, -476, -476, -476, -476, -476, -476,
1972 -476, -476, 1087, -17, 92, -476, 509, 75, 207, 208,
1973 220, 221, 222, 223, 509, 509, 304, 1073, 1087, 1087,
1974 -476, -476, -476, -476, -476, -476, -476, 154, -476, -476,
1975 -476, 154, 199, 199, 214, 215, 1031, 1031, 1031, 1031,
1976 1031, -476, -476, -22, 828, -75, -476, -58, -476, 1031,
1977 1031, 1031, 5, -476, 972, -476, -476, -476, -476, -476,
1978 -476, -476, -476, 301, 1031, -476, -476, -476, -476, 224,
1979 -476, 226, 635, 509, 509, 14, -476, 23, -476, -476,
1980 635, 237, 1087, 1087, 1087, 1087, 1087, 243, 244, 1087,
1981 635, 509, 246, -476, -476, -476, -476, -476, -476, 1031,
1982 1031, -476, 247, 248, 254, 255, 1031, -476, 250, 656,
1983 -46, -476, -476, 256, 261, 360, 383, 399, -476, 199,
1984 -476, 83, 269, 266, -476, 388, -60, 398, 401, 277,
1985 272, 289, 635, 420, 635, 293, 294, 635, 295, 83,
1986 -476, 296, 300, 635, 635, 83, 305, -476, 1087, 310,
1987 314, -98, 1031, 1031, 1031, 1031, -476, -476, 290, 1031,
1988 1031, 1087, -476, -476, -476, 33, 988, -476, 315, -476,
1989 635, 635, 1087, 635, 635, 316, -476, 316, 1087, 635,
1990 317, 1087, 1087, 1087, -476, -476, 1087, 509, 1031, 1031,
1991 -476, 318, 287, 320, 321, -476, 319, 322, 116, -476,
1992 -476, -476, 83, 79, 414, 324, 330, 509, 21, -476,
1993 -476, 393, -476, -476, -476, 331, 635, -476, -476, -476,
1994 59, -476, 325, 339, 1031, -476, 1031, 1031, -476, -476,
1995 -476, 33, -476, 410, -476, 447, -2, -476, 1087, -476,
1996 -476, 342, -476, -476, -476, 348, 351, 352, -476, 489,
1997 -476, 635, -476, 785, -1, -25, 509, 133, -476, 154,
1998 -476, -476, -476, -476, -476, 359, -476, 785, -476, 482,
1999 483, 362, -25, 635, 635, 485, 439, -476, 635, 492,
2003 /* YYPGOTO[NTERM-NUM]. */
2004 static const short int yypgoto[] =
2006 -476, 389, 392, 397, 292, 306, -153, -476, 0, 10,
2007 435, 4, -476, -476, -476, 87, -476, -476, -145, -295,
2008 -383, -476, -208, -476, -276, 39, -476, -291, -476, -476,
2009 -24, 326, -241, -476, 421, 426, 69, -138, -196, 89,
2010 204, -476, -476, 512, -476, -476, -476, -476, -476, -476,
2011 -476, -476, -476, -476, -476, 452, -476, -476, -476, -476,
2012 -476, -476, -475, -135, -227, -164, -476, 484, -476, -476,
2013 -476, -476, -476, 73, 159, -476, -476, -476, -476
2016 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2017 positive, shift that token. If negative, reduce the rule which
2018 number is the opposite. If zero, do what YYDEFACT says.
2019 If YYTABLE_NINF, syntax error. */
2020 #define YYTABLE_NINF -181
2021 static const short int yytable[] =
2023 10, 74, 253, 242, 12, 96, 243, 311, 358, 252,
2024 252, 254, 375, 352, 285, 10, 375, 147, 445, 12,
2025 82, 377, 378, 349, 350, 412, 351, 85, -180, 289,
2026 290, 291, 292, 293, 414, 396, 296, 19, 458, 131,
2027 325, 327, 470, -63, 1, 2, 100, 3, 4, 1,
2028 132, 20, 3, 397, 5, 6, 370, 297, 545, 359,
2029 23, 386, 413, -55, -55, -55, -55, 367, 368, 123,
2030 391, 413, 551, 100, 7, 131, 386, 8, 386, 123,
2031 22, 9, 218, 219, 10, 449, 213, 300, 301, 392,
2032 386, 145, 27, 28, 29, 30, 31, 32, 33, 511,
2033 34, 438, 24, 210, 211, 302, 303, 214, 444, 396,
2034 120, 217, 25, 347, 386, 347, 347, 121, 347, 355,
2035 102, 387, 103, 76, 77, 409, 410, 411, 390, 248,
2036 80, 106, 107, 416, 535, 372, 81, 1, 26, 148,
2037 3, 532, 546, 426, 427, 300, 301, 97, 406, 86,
2038 245, 347, 283, 284, 248, 286, 102, 518, 103, 347,
2039 347, 519, 308, 302, 303, 552, 549, 39, 287, 248,
2040 248, 248, 248, 248, 294, 295, 248, 142, 102, 492,
2041 103, 493, 298, 299, 123, 455, 309, 457, 375, 35,
2042 460, 300, 301, 134, 135, 518, 464, 465, 418, 522,
2043 420, 421, 422, 216, 220, 221, 222, 223, 373, 302,
2044 303, 374, 102, 41, 103, 42, 360, 347, 347, 347,
2045 102, 53, 103, 485, 486, 347, 489, 490, 357, 102,
2046 145, 103, 495, 54, 2, 347, 347, 4, 57, 483,
2047 501, 353, 375, 55, 375, 300, 301, 45, 46, 47,
2048 78, 242, 48, 102, 243, 103, 510, 35, 354, 82,
2049 517, 89, 373, 302, 303, 374, 300, 301, 250, 521,
2050 90, 251, 91, 145, 371, 248, 93, 347, 94, 347,
2051 104, 105, 347, 373, 302, 303, 374, 95, 347, 347,
2052 127, 128, 143, 208, 494, 266, 267, 497, 498, 499,
2053 389, 206, 209, 212, 544, 215, -56, -57, 224, 548,
2054 401, 537, 246, 252, 539, 347, 347, 316, 347, 347,
2055 310, 317, 318, 319, 347, 320, 556, 557, 328, 329,
2056 330, 560, 347, 331, 562, 332, 334, 369, 248, 419,
2057 248, 248, 248, 361, 362, 425, 109, 110, 111, 112,
2058 113, 114, 347, 379, 380, 404, 363, 364, 365, 366,
2059 407, 347, 408, 533, 268, 269, 270, 271, 272, 273,
2060 274, 275, 276, 277, 278, 279, 280, 281, 417, 423,
2061 424, 547, 428, 432, 433, 381, 382, 383, 384, 385,
2062 434, 435, 439, 441, -179, 437, 347, 440, 393, 394,
2063 395, 347, 442, 443, 467, 446, 447, 448, 453, -63,
2064 1, 2, 450, 3, 4, 451, 452, 478, 347, 347,
2065 5, 6, 482, 347, 456, 454, 347, 505, 487, 458,
2066 459, 461, 462, 514, 248, 475, 463, 248, 248, 248,
2067 7, 413, 487, 8, 466, 479, 468, 9, 429, 430,
2068 469, 484, 491, 496, 504, 436, 506, 507, 529, 508,
2069 515, 531, 509, 59, 60, 523, 98, 62, 63, 64,
2070 65, 516, 1, 2, 520, 3, 4, 59, 60, 524,
2071 98, 62, 63, 64, 65, 538, 1, 2, 540, 3,
2072 4, 541, 542, 543, 536, 550, 553, 554, 555, 558,
2073 66, 471, 472, 473, 474, 559, 561, 198, 476, 477,
2074 199, 479, 335, 336, 66, 200, 59, 60, 337, 118,
2075 314, 528, 512, 130, 133, 1, 2, 40, 3, 4,
2076 338, 339, 340, 117, 306, 315, 88, 502, 503, 500,
2077 431, 0, 0, 0, 341, 342, 255, 256, 257, 258,
2078 259, 260, 261, 262, 263, 264, 0, 0, 0, 59,
2079 60, 343, 98, 136, 137, 138, 65, 0, 1, 2,
2080 0, 3, 4, 525, 0, 526, 527, 159, 160, 161,
2081 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
2082 172, 173, 228, 229, 67, 0, 66, 68, 0, 0,
2083 69, 0, 70, 99, 0, 0, 0, 0, 67, 0,
2084 0, 68, 0, 0, 69, 0, 70, 129, 0, 230,
2085 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2086 190, 191, 0, 231, 0, 232, 233, 234, 335, 336,
2087 0, 0, 59, 60, 337, 0, 102, 0, 103, 0,
2088 0, 1, 2, 344, 3, 4, 338, 339, 340, 0,
2089 0, 0, 0, 59, 60, 0, 0, 0, 0, 0,
2090 341, 342, 1, 2, 0, 3, 4, 225, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 343, 0, 0,
2092 67, 226, 227, 68, 0, 0, 69, 0, 70, 326,
2093 0, 0, 0, 159, 160, 161, 162, 163, 164, 165,
2094 166, 167, 168, 169, 170, 171, 172, 173, 228, 229,
2095 0, 0, 0, 0, 159, 160, 161, 162, 163, 164,
2096 165, 166, 167, 168, 169, 170, 171, 172, 173, 228,
2097 229, 0, 0, 0, 0, 230, 180, 181, 182, 183,
2098 184, 185, 186, 187, 188, 189, 190, 191, 0, 231,
2099 0, 232, 233, 234, 0, 0, 230, 180, 181, 182,
2100 183, 184, 185, 186, 187, 188, 189, 190, 191, 344,
2101 231, 0, 232, 233, 234, 0, 0, 0, 335, 336,
2102 0, 0, 0, 102, 337, 103, 0, 235, 0, 0,
2103 236, 0, 237, 0, 238, 0, 338, 339, 340, 0,
2104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2105 341, 342, 0, 0, 0, 0, 0, 0, 0, 0,
2106 0, 0, 0, 0, 0, 59, 60, 343, 98, 136,
2107 137, 138, 65, 0, 1, 2, 0, 3, 4, 0,
2108 0, 0, 0, 159, 160, 161, 162, 163, 164, 165,
2109 166, 167, 168, 169, 170, 171, 172, 173, 228, 229,
2110 0, 0, 66, 0, 0, 0, 0, 0, 0, 0,
2111 0, 59, 60, 0, 98, 62, 63, 64, 65, 0,
2112 1, 2, 0, 3, 4, 230, 180, 181, 182, 183,
2113 184, 185, 186, 187, 188, 189, 190, 191, 122, 231,
2114 0, 232, 233, 234, 0, 0, 0, 0, 66, 0,
2115 0, 59, 60, 0, 98, 62, 63, 64, 65, 344,
2116 1, 2, 0, 3, 4, 0, 0, 0, 0, 0,
2117 59, 60, 0, 98, 136, 137, 138, 65, 305, 1,
2118 2, 0, 3, 4, 0, 0, 0, 0, 66, 0,
2119 0, 0, 0, 0, 0, 0, 67, 0, 0, 68,
2120 0, 0, 69, 0, 70, 388, 0, 66, 0, 59,
2121 60, 0, 98, 62, 63, 64, 65, 0, 1, 2,
2122 0, 3, 4, 0, 0, 59, 60, 0, 98, 62,
2123 63, 64, 65, 0, 1, 2, 400, 3, 4, 0,
2124 0, 0, 67, 0, 0, 68, 66, 0, 69, 0,
2125 70, 0, 481, 0, 59, 60, 0, 61, 62, 63,
2126 64, 65, 66, 1, 2, 0, 3, 4, 59, 60,
2127 0, 98, 136, 137, 138, 65, 0, 1, 2, 0,
2128 3, 4, 67, 0, 0, 68, 0, 0, 69, 0,
2129 70, 66, 0, 0, 0, 0, 0, 0, 0, 0,
2130 0, 67, 0, 0, 68, 66, 321, 69, 0, 70,
2131 59, 60, 0, 144, 62, 63, 64, 65, 0, 1,
2132 2, 0, 3, 4, 59, 60, 0, 98, 62, 63,
2133 64, 65, 0, 1, 2, 0, 3, 4, 0, 0,
2134 67, 0, 0, 68, 0, 0, 69, 66, 70, 0,
2135 0, 0, 0, 0, 0, 0, 67, 0, 0, 68,
2136 0, 66, 69, 0, 70, 0, 59, 60, 0, 247,
2137 62, 63, 64, 65, 0, 1, 2, 0, 3, 4,
2138 0, 0, 0, 0, 0, 67, 0, 0, 68, 0,
2139 0, 69, 0, 70, 0, 0, 0, 0, 0, 67,
2140 0, 0, 68, 66, 0, 69, 0, 70, 59, 60,
2141 0, 98, 136, 137, 138, 65, 0, 1, 2, 0,
2142 3, 4, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 150, 0, 0, 0, 0, 0, 0,
2144 0, 67, 0, 0, 68, 66, 0, 69, 0, 70,
2145 0, 0, 151, 152, 0, 67, 0, 0, 68, 0,
2146 0, 69, 0, 70, 153, 154, 155, 156, 157, 158,
2147 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
2148 169, 170, 171, 172, 173, 174, 175, 0, 0, 0,
2149 0, 0, 0, 0, 0, 0, 0, 67, 0, 0,
2150 68, 0, 0, 69, 0, 70, 0, 176, 177, 178,
2151 0, 0, 179, 180, 181, 182, 183, 184, 185, 186,
2152 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
2153 197, 0, 0, 0, 0, 0, 0, 0, 0, 67,
2154 0, 0, 68, 0, 0, 69, 0, 324
2157 static const short int yycheck[] =
2159 0, 25, 155, 141, 0, 4, 141, 215, 284, 11,
2160 11, 156, 307, 254, 178, 15, 311, 24, 401, 15,
2161 18, 312, 313, 250, 251, 11, 253, 25, 0, 193,
2162 194, 195, 196, 197, 11, 30, 200, 47, 136, 136,
2163 236, 237, 140, 15, 16, 17, 70, 19, 20, 16,
2164 147, 61, 19, 48, 26, 27, 297, 202, 533, 286,
2165 52, 136, 48, 3, 4, 5, 6, 294, 295, 93,
2166 145, 48, 547, 97, 46, 136, 136, 49, 136, 103,
2167 135, 53, 22, 23, 84, 145, 147, 112, 113, 147,
2168 136, 115, 37, 38, 39, 40, 41, 42, 43, 482,
2169 45, 147, 135, 127, 128, 130, 131, 131, 399, 30,
2170 136, 135, 15, 248, 136, 250, 251, 143, 253, 136,
2171 137, 143, 139, 36, 37, 352, 353, 354, 324, 153,
2172 43, 28, 29, 360, 517, 299, 49, 16, 135, 146,
2173 19, 143, 143, 370, 371, 112, 113, 146, 344, 147,
2174 146, 286, 176, 177, 178, 179, 137, 136, 139, 294,
2175 295, 140, 143, 130, 131, 548, 33, 0, 192, 193,
2176 194, 195, 196, 197, 198, 199, 200, 108, 137, 455,
2177 139, 457, 108, 109, 208, 412, 145, 414, 483, 134,
2178 417, 112, 113, 104, 105, 136, 423, 424, 362, 140,
2179 364, 365, 366, 134, 3, 4, 5, 6, 129, 130,
2180 131, 132, 137, 41, 139, 43, 141, 352, 353, 354,
2181 137, 135, 139, 450, 451, 360, 453, 454, 136, 137,
2182 254, 139, 459, 135, 17, 370, 371, 20, 19, 447,
2183 467, 265, 537, 141, 539, 112, 113, 37, 38, 39,
2184 32, 389, 42, 137, 389, 139, 140, 134, 282, 18,
2185 487, 19, 129, 130, 131, 132, 112, 113, 11, 496,
2186 19, 14, 19, 297, 298, 299, 139, 412, 4, 414,
2187 76, 77, 417, 129, 130, 131, 132, 4, 423, 424,
2188 142, 142, 4, 136, 458, 22, 23, 461, 462, 463,
2189 324, 19, 140, 145, 531, 140, 9, 9, 9, 536,
2190 334, 519, 50, 11, 522, 450, 451, 139, 453, 454,
2191 145, 139, 139, 139, 459, 139, 553, 554, 19, 139,
2192 139, 558, 467, 139, 561, 136, 139, 33, 362, 363,
2193 364, 365, 366, 136, 136, 369, 55, 56, 57, 58,
2194 59, 60, 487, 139, 139, 54, 136, 136, 136, 136,
2195 136, 496, 136, 516, 91, 92, 93, 94, 95, 96,
2196 97, 98, 99, 100, 101, 102, 103, 104, 141, 136,
2197 136, 534, 136, 136, 136, 316, 317, 318, 319, 320,
2198 136, 136, 136, 33, 0, 145, 531, 136, 329, 330,
2199 331, 536, 19, 4, 428, 136, 140, 19, 136, 15,
2200 16, 17, 14, 19, 20, 14, 139, 441, 553, 554,
2201 26, 27, 446, 558, 4, 136, 561, 140, 452, 136,
2202 136, 136, 136, 19, 458, 145, 136, 461, 462, 463,
2203 46, 48, 466, 49, 139, 445, 136, 53, 379, 380,
2204 136, 136, 136, 136, 136, 386, 136, 136, 48, 140,
2205 136, 14, 140, 7, 8, 140, 10, 11, 12, 13,
2206 14, 141, 16, 17, 143, 19, 20, 7, 8, 140,
2207 10, 11, 12, 13, 14, 143, 16, 17, 140, 19,
2208 20, 140, 140, 4, 518, 136, 14, 14, 136, 14,
2209 44, 432, 433, 434, 435, 66, 14, 118, 439, 440,
2210 118, 511, 3, 4, 44, 118, 7, 8, 9, 84,
2211 228, 511, 483, 97, 103, 16, 17, 15, 19, 20,
2212 21, 22, 23, 81, 208, 229, 52, 468, 469, 466,
2213 381, -1, -1, -1, 35, 36, 85, 86, 87, 88,
2214 89, 90, 91, 92, 93, 94, -1, -1, -1, 7,
2215 8, 52, 10, 11, 12, 13, 14, -1, 16, 17,
2216 -1, 19, 20, 504, -1, 506, 507, 68, 69, 70,
2217 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2218 81, 82, 83, 84, 138, -1, 44, 141, -1, -1,
2219 144, -1, 146, 147, -1, -1, -1, -1, 138, -1,
2220 -1, 141, -1, -1, 144, -1, 146, 147, -1, 110,
2221 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2222 121, 122, -1, 124, -1, 126, 127, 128, 3, 4,
2223 -1, -1, 7, 8, 9, -1, 137, -1, 139, -1,
2224 -1, 16, 17, 144, 19, 20, 21, 22, 23, -1,
2225 -1, -1, -1, 7, 8, -1, -1, -1, -1, -1,
2226 35, 36, 16, 17, -1, 19, 20, 21, -1, -1,
2227 -1, -1, -1, -1, -1, -1, -1, 52, -1, -1,
2228 138, 35, 36, 141, -1, -1, 144, -1, 146, 147,
2229 -1, -1, -1, 68, 69, 70, 71, 72, 73, 74,
2230 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2231 -1, -1, -1, -1, 68, 69, 70, 71, 72, 73,
2232 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2233 84, -1, -1, -1, -1, 110, 111, 112, 113, 114,
2234 115, 116, 117, 118, 119, 120, 121, 122, -1, 124,
2235 -1, 126, 127, 128, -1, -1, 110, 111, 112, 113,
2236 114, 115, 116, 117, 118, 119, 120, 121, 122, 144,
2237 124, -1, 126, 127, 128, -1, -1, -1, 3, 4,
2238 -1, -1, -1, 137, 9, 139, -1, 141, -1, -1,
2239 144, -1, 146, -1, 148, -1, 21, 22, 23, -1,
2240 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2241 35, 36, -1, -1, -1, -1, -1, -1, -1, -1,
2242 -1, -1, -1, -1, -1, 7, 8, 52, 10, 11,
2243 12, 13, 14, -1, 16, 17, -1, 19, 20, -1,
2244 -1, -1, -1, 68, 69, 70, 71, 72, 73, 74,
2245 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2246 -1, -1, 44, -1, -1, -1, -1, -1, -1, -1,
2247 -1, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2248 16, 17, -1, 19, 20, 110, 111, 112, 113, 114,
2249 115, 116, 117, 118, 119, 120, 121, 122, 34, 124,
2250 -1, 126, 127, 128, -1, -1, -1, -1, 44, -1,
2251 -1, 7, 8, -1, 10, 11, 12, 13, 14, 144,
2252 16, 17, -1, 19, 20, -1, -1, -1, -1, -1,
2253 7, 8, -1, 10, 11, 12, 13, 14, 34, 16,
2254 17, -1, 19, 20, -1, -1, -1, -1, 44, -1,
2255 -1, -1, -1, -1, -1, -1, 138, -1, -1, 141,
2256 -1, -1, 144, -1, 146, 147, -1, 44, -1, 7,
2257 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2258 -1, 19, 20, -1, -1, 7, 8, -1, 10, 11,
2259 12, 13, 14, -1, 16, 17, 34, 19, 20, -1,
2260 -1, -1, 138, -1, -1, 141, 44, -1, 144, -1,
2261 146, -1, 34, -1, 7, 8, -1, 10, 11, 12,
2262 13, 14, 44, 16, 17, -1, 19, 20, 7, 8,
2263 -1, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2264 19, 20, 138, -1, -1, 141, -1, -1, 144, -1,
2265 146, 44, -1, -1, -1, -1, -1, -1, -1, -1,
2266 -1, 138, -1, -1, 141, 44, 143, 144, -1, 146,
2267 7, 8, -1, 10, 11, 12, 13, 14, -1, 16,
2268 17, -1, 19, 20, 7, 8, -1, 10, 11, 12,
2269 13, 14, -1, 16, 17, -1, 19, 20, -1, -1,
2270 138, -1, -1, 141, -1, -1, 144, 44, 146, -1,
2271 -1, -1, -1, -1, -1, -1, 138, -1, -1, 141,
2272 -1, 44, 144, -1, 146, -1, 7, 8, -1, 10,
2273 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2274 -1, -1, -1, -1, -1, 138, -1, -1, 141, -1,
2275 -1, 144, -1, 146, -1, -1, -1, -1, -1, 138,
2276 -1, -1, 141, 44, -1, 144, -1, 146, 7, 8,
2277 -1, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2278 19, 20, -1, -1, -1, -1, -1, -1, -1, -1,
2279 -1, -1, -1, 31, -1, -1, -1, -1, -1, -1,
2280 -1, 138, -1, -1, 141, 44, -1, 144, -1, 146,
2281 -1, -1, 50, 51, -1, 138, -1, -1, 141, -1,
2282 -1, 144, -1, 146, 62, 63, 64, 65, 66, 67,
2283 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2284 78, 79, 80, 81, 82, 83, 84, -1, -1, -1,
2285 -1, -1, -1, -1, -1, -1, -1, 138, -1, -1,
2286 141, -1, -1, 144, -1, 146, -1, 105, 106, 107,
2287 -1, -1, 110, 111, 112, 113, 114, 115, 116, 117,
2288 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2289 128, -1, -1, -1, -1, -1, -1, -1, -1, 138,
2290 -1, -1, 141, -1, -1, 144, -1, 146
2293 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2294 symbol of state STATE-NUM. */
2295 static const unsigned char yystos[] =
2297 0, 16, 17, 19, 20, 26, 27, 46, 49, 53,
2298 157, 159, 160, 161, 190, 191, 192, 194, 193, 47,
2299 61, 199, 135, 52, 135, 15, 135, 37, 38, 39,
2300 40, 41, 42, 43, 45, 134, 162, 163, 164, 0,
2301 192, 41, 43, 165, 209, 37, 38, 39, 42, 166,
2302 206, 208, 215, 135, 135, 141, 200, 19, 198, 7,
2303 8, 10, 11, 12, 13, 14, 44, 138, 141, 144,
2304 146, 157, 160, 178, 179, 212, 164, 164, 32, 189,
2305 164, 164, 18, 216, 217, 25, 147, 207, 216, 19,
2306 19, 19, 201, 139, 4, 4, 4, 146, 10, 147,
2307 179, 184, 137, 139, 189, 189, 28, 29, 188, 55,
2308 56, 57, 58, 59, 60, 167, 204, 204, 159, 220,
2309 136, 143, 34, 179, 180, 182, 183, 142, 142, 147,
2310 184, 136, 147, 183, 188, 188, 11, 12, 13, 155,
2311 156, 179, 185, 4, 10, 179, 181, 24, 146, 205,
2312 31, 50, 51, 62, 63, 64, 65, 66, 67, 68,
2313 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2314 79, 80, 81, 82, 83, 84, 105, 106, 107, 110,
2315 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2316 121, 122, 123, 124, 125, 126, 127, 128, 150, 151,
2317 152, 218, 224, 225, 226, 227, 19, 169, 136, 140,
2318 179, 179, 145, 147, 179, 140, 185, 179, 22, 23,
2319 3, 4, 5, 6, 9, 21, 35, 36, 83, 84,
2320 110, 124, 126, 127, 128, 141, 144, 146, 148, 150,
2321 151, 152, 186, 212, 195, 160, 50, 10, 179, 214,
2322 11, 14, 11, 155, 167, 85, 86, 87, 88, 89,
2323 90, 91, 92, 93, 94, 153, 22, 23, 91, 92,
2324 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
2325 103, 104, 154, 179, 179, 214, 179, 179, 221, 214,
2326 214, 214, 214, 214, 179, 179, 214, 167, 108, 109,
2327 112, 113, 130, 131, 168, 34, 180, 171, 143, 145,
2328 145, 171, 196, 197, 153, 154, 139, 139, 139, 139,
2329 139, 143, 185, 187, 146, 187, 147, 187, 19, 139,
2330 139, 139, 136, 176, 139, 3, 4, 9, 21, 22,
2331 23, 35, 36, 52, 144, 186, 211, 212, 213, 213,
2332 213, 213, 181, 179, 179, 136, 173, 136, 173, 213,
2333 141, 136, 136, 136, 136, 136, 136, 213, 213, 33,
2334 181, 179, 214, 129, 132, 168, 170, 176, 176, 139,
2335 139, 185, 185, 185, 185, 185, 136, 143, 147, 179,
2336 187, 145, 147, 185, 185, 185, 30, 48, 174, 177,
2337 34, 179, 202, 203, 54, 210, 187, 136, 136, 213,
2338 213, 213, 11, 48, 11, 223, 213, 141, 214, 179,
2339 214, 214, 214, 136, 136, 179, 213, 213, 136, 185,
2340 185, 223, 136, 136, 136, 136, 185, 145, 147, 136,
2341 136, 33, 19, 4, 176, 169, 136, 140, 19, 145,
2342 14, 14, 139, 136, 136, 213, 4, 213, 136, 136,
2343 213, 136, 136, 136, 213, 213, 139, 179, 136, 136,
2344 140, 185, 185, 185, 185, 145, 185, 185, 179, 157,
2345 158, 34, 179, 171, 136, 213, 213, 179, 222, 213,
2346 213, 136, 173, 173, 214, 213, 136, 214, 214, 214,
2347 222, 213, 185, 185, 136, 140, 136, 136, 140, 140,
2348 140, 169, 174, 175, 19, 136, 141, 213, 136, 140,
2349 143, 213, 140, 140, 140, 185, 185, 185, 158, 48,
2350 172, 14, 143, 155, 219, 169, 179, 171, 143, 171,
2351 140, 140, 140, 4, 213, 211, 143, 155, 213, 33,
2352 136, 211, 169, 14, 14, 136, 213, 213, 14, 66,
2356 #define yyerrok (yyerrstatus = 0)
2357 #define yyclearin (yychar = YYEMPTY)
2358 #define YYEMPTY (-2)
2361 #define YYACCEPT goto yyacceptlab
2362 #define YYABORT goto yyabortlab
2363 #define YYERROR goto yyerrorlab
2366 /* Like YYERROR except do call yyerror. This remains here temporarily
2367 to ease the transition to the new meaning of YYERROR, for GCC.
2368 Once GCC version 2 has supplanted version 1, this can go. */
2370 #define YYFAIL goto yyerrlab
2372 #define YYRECOVERING() (!!yyerrstatus)
2374 #define YYBACKUP(Token, Value) \
2376 if (yychar == YYEMPTY && yylen == 1) \
2380 yytoken = YYTRANSLATE (yychar); \
2386 yyerror (YY_("syntax error: cannot back up")); \
2393 #define YYERRCODE 256
2396 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2397 If N is 0, then set CURRENT to the empty location which ends
2398 the previous symbol: RHS[0] (always defined). */
2400 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2401 #ifndef YYLLOC_DEFAULT
2402 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2406 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2407 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2408 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2409 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2413 (Current).first_line = (Current).last_line = \
2414 YYRHSLOC (Rhs, 0).last_line; \
2415 (Current).first_column = (Current).last_column = \
2416 YYRHSLOC (Rhs, 0).last_column; \
2422 /* YY_LOCATION_PRINT -- Print the location on the stream.
2423 This macro was not mandated originally: define only if we know
2424 we won't break user code: when these are the locations we know. */
2426 #ifndef YY_LOCATION_PRINT
2427 # if YYLTYPE_IS_TRIVIAL
2428 # define YY_LOCATION_PRINT(File, Loc) \
2429 fprintf (File, "%d.%d-%d.%d", \
2430 (Loc).first_line, (Loc).first_column, \
2431 (Loc).last_line, (Loc).last_column)
2433 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2438 /* YYLEX -- calling `yylex' with the right arguments. */
2441 # define YYLEX yylex (YYLEX_PARAM)
2443 # define YYLEX yylex ()
2446 /* Enable debugging if requested. */
2450 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2451 # define YYFPRINTF fprintf
2454 # define YYDPRINTF(Args) \
2460 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2464 YYFPRINTF (stderr, "%s ", Title); \
2465 yysymprint (stderr, \
2467 YYFPRINTF (stderr, "\n"); \
2471 /*------------------------------------------------------------------.
2472 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2474 `------------------------------------------------------------------*/
2476 #if defined (__STDC__) || defined (__cplusplus)
2478 yy_stack_print (short int *bottom, short int *top)
2481 yy_stack_print (bottom, top)
2486 YYFPRINTF (stderr, "Stack now");
2487 for (/* Nothing. */; bottom <= top; ++bottom)
2488 YYFPRINTF (stderr, " %d", *bottom);
2489 YYFPRINTF (stderr, "\n");
2492 # define YY_STACK_PRINT(Bottom, Top) \
2495 yy_stack_print ((Bottom), (Top)); \
2499 /*------------------------------------------------.
2500 | Report that the YYRULE is going to be reduced. |
2501 `------------------------------------------------*/
2503 #if defined (__STDC__) || defined (__cplusplus)
2505 yy_reduce_print (int yyrule)
2508 yy_reduce_print (yyrule)
2513 unsigned long int yylno = yyrline[yyrule];
2514 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2516 /* Print the symbols being reduced, and their result. */
2517 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2518 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2519 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2522 # define YY_REDUCE_PRINT(Rule) \
2525 yy_reduce_print (Rule); \
2528 /* Nonzero means print parse trace. It is left uninitialized so that
2529 multiple parsers can coexist. */
2531 #else /* !YYDEBUG */
2532 # define YYDPRINTF(Args)
2533 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2534 # define YY_STACK_PRINT(Bottom, Top)
2535 # define YY_REDUCE_PRINT(Rule)
2536 #endif /* !YYDEBUG */
2539 /* YYINITDEPTH -- initial size of the parser's stacks. */
2541 # define YYINITDEPTH 200
2544 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2545 if the built-in stack extension method is used).
2547 Do not make this value too large; the results are undefined if
2548 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2549 evaluated with infinite-precision integer arithmetic. */
2552 # define YYMAXDEPTH 10000
2560 # if defined (__GLIBC__) && defined (_STRING_H)
2561 # define yystrlen strlen
2563 /* Return the length of YYSTR. */
2565 # if defined (__STDC__) || defined (__cplusplus)
2566 yystrlen (const char *yystr)
2572 const char *yys = yystr;
2574 while (*yys++ != '\0')
2577 return yys - yystr - 1;
2583 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2584 # define yystpcpy stpcpy
2586 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2589 # if defined (__STDC__) || defined (__cplusplus)
2590 yystpcpy (char *yydest, const char *yysrc)
2592 yystpcpy (yydest, yysrc)
2598 const char *yys = yysrc;
2600 while ((*yyd++ = *yys++) != '\0')
2609 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2610 quotes and backslashes, so that it's suitable for yyerror. The
2611 heuristic is that double-quoting is unnecessary unless the string
2612 contains an apostrophe, a comma, or backslash (other than
2613 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2614 null, do not copy; instead, return the length of what the result
2617 yytnamerr (char *yyres, const char *yystr)
2622 char const *yyp = yystr;
2629 goto do_not_strip_quotes;
2633 goto do_not_strip_quotes;
2646 do_not_strip_quotes: ;
2650 return yystrlen (yystr);
2652 return yystpcpy (yyres, yystr) - yyres;
2656 #endif /* YYERROR_VERBOSE */
2661 /*--------------------------------.
2662 | Print this symbol on YYOUTPUT. |
2663 `--------------------------------*/
2665 #if defined (__STDC__) || defined (__cplusplus)
2667 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2670 yysymprint (yyoutput, yytype, yyvaluep)
2676 /* Pacify ``unused variable'' warnings. */
2679 if (yytype < YYNTOKENS)
2680 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2682 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2686 if (yytype < YYNTOKENS)
2687 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2694 YYFPRINTF (yyoutput, ")");
2697 #endif /* ! YYDEBUG */
2698 /*-----------------------------------------------.
2699 | Release the memory associated to this symbol. |
2700 `-----------------------------------------------*/
2702 #if defined (__STDC__) || defined (__cplusplus)
2704 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2707 yydestruct (yymsg, yytype, yyvaluep)
2713 /* Pacify ``unused variable'' warnings. */
2718 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2729 /* Prevent warnings from -Wmissing-prototypes. */
2731 #ifdef YYPARSE_PARAM
2732 # if defined (__STDC__) || defined (__cplusplus)
2733 int yyparse (void *YYPARSE_PARAM);
2737 #else /* ! YYPARSE_PARAM */
2738 #if defined (__STDC__) || defined (__cplusplus)
2743 #endif /* ! YYPARSE_PARAM */
2747 /* The look-ahead symbol. */
2750 /* The semantic value of the look-ahead symbol. */
2753 /* Number of syntax errors so far. */
2762 #ifdef YYPARSE_PARAM
2763 # if defined (__STDC__) || defined (__cplusplus)
2764 int yyparse (void *YYPARSE_PARAM)
2766 int yyparse (YYPARSE_PARAM)
2767 void *YYPARSE_PARAM;
2769 #else /* ! YYPARSE_PARAM */
2770 #if defined (__STDC__) || defined (__cplusplus)
2784 /* Number of tokens to shift before error messages enabled. */
2786 /* Look-ahead token as an internal (translated) token number. */
2789 /* Three stacks and their tools:
2790 `yyss': related to states,
2791 `yyvs': related to semantic values,
2792 `yyls': related to locations.
2794 Refer to the stacks thru separate pointers, to allow yyoverflow
2795 to reallocate them elsewhere. */
2797 /* The state stack. */
2798 short int yyssa[YYINITDEPTH];
2799 short int *yyss = yyssa;
2802 /* The semantic value stack. */
2803 YYSTYPE yyvsa[YYINITDEPTH];
2804 YYSTYPE *yyvs = yyvsa;
2809 #define YYPOPSTACK (yyvsp--, yyssp--)
2811 YYSIZE_T yystacksize = YYINITDEPTH;
2813 /* The variables used to return semantic value and location from the
2818 /* When reducing, the number of symbols on the RHS of the reduced
2822 YYDPRINTF ((stderr, "Starting parse\n"));
2827 yychar = YYEMPTY; /* Cause a token to be read. */
2829 /* Initialize stack pointers.
2830 Waste one element of value and location stack
2831 so that they stay on the same level as the state stack.
2832 The wasted elements are never initialized. */
2839 /*------------------------------------------------------------.
2840 | yynewstate -- Push a new state, which is found in yystate. |
2841 `------------------------------------------------------------*/
2843 /* In all cases, when you get here, the value and location stacks
2844 have just been pushed. so pushing a state here evens the stacks.
2851 if (yyss + yystacksize - 1 <= yyssp)
2853 /* Get the current used size of the three stacks, in elements. */
2854 YYSIZE_T yysize = yyssp - yyss + 1;
2858 /* Give user a chance to reallocate the stack. Use copies of
2859 these so that the &'s don't force the real ones into
2861 YYSTYPE *yyvs1 = yyvs;
2862 short int *yyss1 = yyss;
2865 /* Each stack pointer address is followed by the size of the
2866 data in use in that stack, in bytes. This used to be a
2867 conditional around just the two extra args, but that might
2868 be undefined if yyoverflow is a macro. */
2869 yyoverflow (YY_("memory exhausted"),
2870 &yyss1, yysize * sizeof (*yyssp),
2871 &yyvs1, yysize * sizeof (*yyvsp),
2878 #else /* no yyoverflow */
2879 # ifndef YYSTACK_RELOCATE
2880 goto yyexhaustedlab;
2882 /* Extend the stack our own way. */
2883 if (YYMAXDEPTH <= yystacksize)
2884 goto yyexhaustedlab;
2886 if (YYMAXDEPTH < yystacksize)
2887 yystacksize = YYMAXDEPTH;
2890 short int *yyss1 = yyss;
2891 union yyalloc *yyptr =
2892 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2894 goto yyexhaustedlab;
2895 YYSTACK_RELOCATE (yyss);
2896 YYSTACK_RELOCATE (yyvs);
2898 # undef YYSTACK_RELOCATE
2900 YYSTACK_FREE (yyss1);
2903 #endif /* no yyoverflow */
2905 yyssp = yyss + yysize - 1;
2906 yyvsp = yyvs + yysize - 1;
2909 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2910 (unsigned long int) yystacksize));
2912 if (yyss + yystacksize - 1 <= yyssp)
2916 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2925 /* Do appropriate processing given the current state. */
2926 /* Read a look-ahead token if we need one and don't already have one. */
2929 /* First try to decide what to do without reference to look-ahead token. */
2931 yyn = yypact[yystate];
2932 if (yyn == YYPACT_NINF)
2935 /* Not known => get a look-ahead token if don't already have one. */
2937 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2938 if (yychar == YYEMPTY)
2940 YYDPRINTF ((stderr, "Reading a token: "));
2944 if (yychar <= YYEOF)
2946 yychar = yytoken = YYEOF;
2947 YYDPRINTF ((stderr, "Now at end of input.\n"));
2951 yytoken = YYTRANSLATE (yychar);
2952 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2955 /* If the proper action on seeing token YYTOKEN is to reduce or to
2956 detect an error, take that action. */
2958 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2963 if (yyn == 0 || yyn == YYTABLE_NINF)
2972 /* Shift the look-ahead token. */
2973 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2975 /* Discard the token being shifted unless it is eof. */
2976 if (yychar != YYEOF)
2982 /* Count tokens shifted since error; after three, turn off error
2991 /*-----------------------------------------------------------.
2992 | yydefault -- do the default action for the current state. |
2993 `-----------------------------------------------------------*/
2995 yyn = yydefact[yystate];
3001 /*-----------------------------.
3002 | yyreduce -- Do a reduction. |
3003 `-----------------------------*/
3005 /* yyn is the number of a rule to reduce with. */
3008 /* If YYLEN is nonzero, implement the default value of the action:
3011 Otherwise, the following line sets YYVAL to garbage.
3012 This behavior is undocumented and Bison
3013 users should not rely upon it. Assigning to YYVAL
3014 unconditionally makes the parser a bit smaller, and it avoids a
3015 GCC warning that YYVAL may be used uninitialized. */
3016 yyval = yyvsp[1-yylen];
3019 YY_REDUCE_PRINT (yyn);
3023 #line 1099 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3024 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3028 #line 1099 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3029 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3033 #line 1100 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3034 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3038 #line 1100 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3039 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3043 #line 1101 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3044 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3048 #line 1101 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3049 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3053 #line 1102 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3054 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3058 #line 1102 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3059 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3063 #line 1103 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3064 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3068 #line 1103 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3069 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3073 #line 1107 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3074 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3078 #line 1107 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3079 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3083 #line 1108 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3084 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3088 #line 1108 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3089 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3093 #line 1109 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3094 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3098 #line 1109 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3099 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3103 #line 1110 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3104 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3108 #line 1110 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3109 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3113 #line 1111 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3114 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3118 #line 1111 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3119 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3123 #line 1112 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3124 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3128 #line 1112 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3129 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3133 #line 1113 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3134 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3138 #line 1113 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3139 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3143 #line 1114 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3144 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3148 #line 1115 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3149 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3153 #line 1124 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3154 { (yyval.StrVal) = 0; ;}
3158 #line 1128 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3160 (yyval.StrVal) = (yyvsp[-1].StrVal);
3166 #line 1132 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3174 #line 1139 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3176 (yyval.StrVal) = (yyvsp[-1].StrVal);
3182 #line 1143 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3190 #line 1149 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3191 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3195 #line 1150 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3196 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3200 #line 1151 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3205 #line 1152 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3210 #line 1153 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3215 #line 1157 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3220 #line 1158 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3225 #line 1159 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3230 #line 1163 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3235 #line 1164 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3240 #line 1168 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3245 #line 1169 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3246 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3250 #line 1170 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3251 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3255 #line 1174 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3260 #line 1175 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3261 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3265 #line 1176 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3266 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3270 #line 1177 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3275 #line 1178 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3276 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3280 #line 1181 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3281 { (yyval.UIntVal) = CallingConv::C; ;}
3285 #line 1182 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3286 { (yyval.UIntVal) = CallingConv::C; ;}
3290 #line 1183 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3291 { (yyval.UIntVal) = CallingConv::Fast; ;}
3295 #line 1184 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3296 { (yyval.UIntVal) = CallingConv::Cold; ;}
3300 #line 1185 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3301 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3305 #line 1186 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3306 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3310 #line 1187 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3312 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3313 GEN_ERROR("Calling conv too large");
3314 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3320 #line 1194 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3321 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3325 #line 1195 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3326 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3330 #line 1196 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3331 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3335 #line 1197 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3336 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3340 #line 1200 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3341 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3345 #line 1201 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3347 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3352 #line 1206 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3353 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3357 #line 1207 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3358 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3362 #line 1211 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3363 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3367 #line 1212 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3369 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3374 #line 1219 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3375 { (yyval.UIntVal) = 0; ;}
3379 #line 1220 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3381 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3382 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3383 GEN_ERROR("Alignment must be a power of two");
3389 #line 1226 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3390 { (yyval.UIntVal) = 0; ;}
3394 #line 1227 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3396 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3397 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3398 GEN_ERROR("Alignment must be a power of two");
3404 #line 1235 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3406 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3407 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3408 GEN_ERROR("Invalid character in section name");
3409 (yyval.StrVal) = (yyvsp[0].StrVal);
3415 #line 1243 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3416 { (yyval.StrVal) = 0; ;}
3420 #line 1244 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3421 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3425 #line 1249 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3430 #line 1250 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3435 #line 1251 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3437 CurGV->setSection((yyvsp[0].StrVal));
3438 free((yyvsp[0].StrVal));
3444 #line 1256 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3446 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3447 GEN_ERROR("Alignment must be a power of two");
3448 CurGV->setAlignment((yyvsp[0].UInt64Val));
3454 #line 1272 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3456 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3462 #line 1276 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3464 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3470 #line 1280 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3472 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3473 GEN_ERROR("Cannot form a pointer to a basic block");
3474 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3475 delete (yyvsp[-1].TypeVal);
3481 #line 1287 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3482 { // Named types are also simple types...
3483 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3485 (yyval.TypeVal) = new PATypeHolder(tmp);
3490 #line 1292 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3491 { // Type UpReference
3492 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3493 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3494 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3495 (yyval.TypeVal) = new PATypeHolder(OT);
3496 UR_OUT("New Upreference!\n");
3502 #line 1300 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3504 std::vector<const Type*> Params;
3505 ParamAttrsList Attrs;
3506 if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
3507 Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
3509 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3510 for (; I != E; ++I, ++index) {
3511 const Type *Ty = I->Ty->get();
3512 Params.push_back(Ty);
3513 if (Ty != Type::VoidTy)
3514 if (I->Attrs != ParamAttr::None)
3515 Attrs.addAttributes(index, I->Attrs);
3517 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3518 if (isVarArg) Params.pop_back();
3520 ParamAttrsList *ActualAttrs = 0;
3522 ActualAttrs = new ParamAttrsList(Attrs);
3523 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, ActualAttrs);
3524 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3525 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3526 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3532 #line 1326 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3534 std::vector<const Type*> Params;
3535 ParamAttrsList Attrs;
3536 if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
3537 Attrs.addAttributes(0, (yyvsp[0].ParamAttrs));
3538 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3540 for ( ; I != E; ++I, ++index) {
3541 const Type* Ty = I->Ty->get();
3542 Params.push_back(Ty);
3543 if (Ty != Type::VoidTy)
3544 if (I->Attrs != ParamAttr::None)
3545 Attrs.addAttributes(index, I->Attrs);
3547 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3548 if (isVarArg) Params.pop_back();
3550 ParamAttrsList *ActualAttrs = 0;
3552 ActualAttrs = new ParamAttrsList(Attrs);
3554 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, ActualAttrs);
3555 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3556 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3562 #line 1353 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3563 { // Sized array type?
3564 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3565 delete (yyvsp[-1].TypeVal);
3571 #line 1358 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3573 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3574 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3575 GEN_ERROR("Unsigned result not equal to signed result");
3576 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3577 GEN_ERROR("Element type of a VectorType must be primitive");
3578 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3579 GEN_ERROR("Vector length should be a power of 2");
3580 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3581 delete (yyvsp[-1].TypeVal);
3587 #line 1370 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3588 { // Structure type?
3589 std::vector<const Type*> Elements;
3590 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3591 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3592 Elements.push_back(*I);
3594 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3595 delete (yyvsp[-1].TypeList);
3601 #line 1380 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3602 { // Empty structure type?
3603 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3609 #line 1384 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3611 std::vector<const Type*> Elements;
3612 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3613 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3614 Elements.push_back(*I);
3616 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3617 delete (yyvsp[-2].TypeList);
3623 #line 1394 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3624 { // Empty structure type?
3625 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3631 #line 1401 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3633 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3634 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3639 #line 1408 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3641 if (!UpRefs.empty())
3642 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3643 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3644 GEN_ERROR("LLVM functions cannot return aggregate types");
3645 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3650 #line 1415 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3652 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3657 #line 1420 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3659 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3660 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3666 #line 1425 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3668 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3674 #line 1433 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3676 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3677 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3678 TWA.Ty = new PATypeHolder(Type::VoidTy);
3679 (yyval.TypeWithAttrsList)->push_back(TWA);
3685 #line 1440 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3687 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3688 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3689 TWA.Ty = new PATypeHolder(Type::VoidTy);
3690 (yyval.TypeWithAttrsList)->push_back(TWA);
3696 #line 1447 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3698 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3704 #line 1455 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3706 (yyval.TypeList) = new std::list<PATypeHolder>();
3707 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal));
3708 delete (yyvsp[0].TypeVal);
3714 #line 1461 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3716 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal));
3717 delete (yyvsp[0].TypeVal);
3723 #line 1473 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3724 { // Nonempty unsized arr
3725 if (!UpRefs.empty())
3726 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3727 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3729 GEN_ERROR("Cannot make array constant with type: '" +
3730 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3731 const Type *ETy = ATy->getElementType();
3732 int NumElements = ATy->getNumElements();
3734 // Verify that we have the correct size...
3735 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3736 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3737 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3738 itostr(NumElements) + "");
3740 // Verify all elements are correct type!
3741 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3742 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3743 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3744 ETy->getDescription() +"' as required!\nIt is of type '"+
3745 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3748 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3749 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3755 #line 1501 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3757 if (!UpRefs.empty())
3758 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3759 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3761 GEN_ERROR("Cannot make array constant with type: '" +
3762 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3764 int NumElements = ATy->getNumElements();
3765 if (NumElements != -1 && NumElements != 0)
3766 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3767 " arguments, but has size of " + itostr(NumElements) +"");
3768 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3769 delete (yyvsp[-2].TypeVal);
3775 #line 1517 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3777 if (!UpRefs.empty())
3778 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3779 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3781 GEN_ERROR("Cannot make array constant with type: '" +
3782 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3784 int NumElements = ATy->getNumElements();
3785 const Type *ETy = ATy->getElementType();
3786 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3787 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3788 GEN_ERROR("Can't build string constant of size " +
3789 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3790 " when array has size " + itostr(NumElements) + "");
3791 std::vector<Constant*> Vals;
3792 if (ETy == Type::Int8Ty) {
3793 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3794 C != (unsigned char*)EndStr; ++C)
3795 Vals.push_back(ConstantInt::get(ETy, *C));
3797 free((yyvsp[0].StrVal));
3798 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3800 free((yyvsp[0].StrVal));
3801 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3802 delete (yyvsp[-2].TypeVal);
3808 #line 1546 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3809 { // Nonempty unsized arr
3810 if (!UpRefs.empty())
3811 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3812 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3814 GEN_ERROR("Cannot make packed constant with type: '" +
3815 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3816 const Type *ETy = PTy->getElementType();
3817 int NumElements = PTy->getNumElements();
3819 // Verify that we have the correct size...
3820 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3821 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3822 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3823 itostr(NumElements) + "");
3825 // Verify all elements are correct type!
3826 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3827 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3828 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3829 ETy->getDescription() +"' as required!\nIt is of type '"+
3830 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3833 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3834 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3840 #line 1574 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3842 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3844 GEN_ERROR("Cannot make struct constant with type: '" +
3845 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3847 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3848 GEN_ERROR("Illegal number of initializers for structure type");
3850 // Check to ensure that constants are compatible with the type initializer!
3851 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3852 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3853 GEN_ERROR("Expected type '" +
3854 STy->getElementType(i)->getDescription() +
3855 "' for element #" + utostr(i) +
3856 " of structure initializer");
3858 // Check to ensure that Type is not packed
3859 if (STy->isPacked())
3860 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3862 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3863 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3869 #line 1599 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3871 if (!UpRefs.empty())
3872 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3873 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3875 GEN_ERROR("Cannot make struct constant with type: '" +
3876 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3878 if (STy->getNumContainedTypes() != 0)
3879 GEN_ERROR("Illegal number of initializers for structure type");
3881 // Check to ensure that Type is not packed
3882 if (STy->isPacked())
3883 GEN_ERROR("Unpacked Initializer to vector type '" + STy->getDescription() + "'");
3885 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3886 delete (yyvsp[-2].TypeVal);
3892 #line 1618 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3894 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
3896 GEN_ERROR("Cannot make struct constant with type: '" +
3897 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
3899 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
3900 GEN_ERROR("Illegal number of initializers for structure type");
3902 // Check to ensure that constants are compatible with the type initializer!
3903 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3904 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
3905 GEN_ERROR("Expected type '" +
3906 STy->getElementType(i)->getDescription() +
3907 "' for element #" + utostr(i) +
3908 " of structure initializer");
3910 // Check to ensure that Type is packed
3911 if (!STy->isPacked())
3912 GEN_ERROR("Vector initializer to non-vector type '" +
3913 STy->getDescription() + "'");
3915 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3916 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
3922 #line 1644 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3924 if (!UpRefs.empty())
3925 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3926 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
3928 GEN_ERROR("Cannot make struct constant with type: '" +
3929 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
3931 if (STy->getNumContainedTypes() != 0)
3932 GEN_ERROR("Illegal number of initializers for structure type");
3934 // Check to ensure that Type is packed
3935 if (!STy->isPacked())
3936 GEN_ERROR("Vector initializer to non-vector type '" +
3937 STy->getDescription() + "'");
3939 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3940 delete (yyvsp[-4].TypeVal);
3946 #line 1664 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3948 if (!UpRefs.empty())
3949 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3950 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3952 GEN_ERROR("Cannot make null pointer constant with type: '" +
3953 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
3955 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3956 delete (yyvsp[-1].TypeVal);
3962 #line 1676 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3964 if (!UpRefs.empty())
3965 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3966 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3967 delete (yyvsp[-1].TypeVal);
3973 #line 1683 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3975 if (!UpRefs.empty())
3976 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3977 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3979 GEN_ERROR("Global const reference must be a pointer type");
3981 // ConstExprs can exist in the body of a function, thus creating
3982 // GlobalValues whenever they refer to a variable. Because we are in
3983 // the context of a function, getExistingVal will search the functions
3984 // symbol table instead of the module symbol table for the global symbol,
3985 // which throws things all off. To get around this, we just tell
3986 // getExistingVal that we are at global scope here.
3988 Function *SavedCurFn = CurFun.CurrentFunction;
3989 CurFun.CurrentFunction = 0;
3991 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
3994 CurFun.CurrentFunction = SavedCurFn;
3996 // If this is an initializer for a constant pointer, which is referencing a
3997 // (currently) undefined variable, create a stub now that shall be replaced
3998 // in the future with the right type of variable.
4001 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4002 const PointerType *PT = cast<PointerType>(Ty);
4004 // First check to see if the forward references value is already created!
4005 PerModuleInfo::GlobalRefsType::iterator I =
4006 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
4008 if (I != CurModule.GlobalRefs.end()) {
4009 V = I->second; // Placeholder already exists, use it...
4010 (yyvsp[0].ValIDVal).destroy();
4013 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4014 Name = (yyvsp[0].ValIDVal).Name;
4015 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4016 GEN_ERROR("Invalid reference to global");
4018 // Create the forward referenced global.
4020 if (const FunctionType *FTy =
4021 dyn_cast<FunctionType>(PT->getElementType())) {
4022 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
4023 CurModule.CurrentModule);
4025 GV = new GlobalVariable(PT->getElementType(), false,
4026 GlobalValue::ExternalLinkage, 0,
4027 Name, CurModule.CurrentModule);
4030 // Keep track of the fact that we have a forward ref to recycle it
4031 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4036 (yyval.ConstVal) = cast<GlobalValue>(V);
4037 delete (yyvsp[-1].TypeVal); // Free the type handle
4043 #line 1749 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4045 if (!UpRefs.empty())
4046 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4047 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4048 GEN_ERROR("Mismatched types for constant expression: " +
4049 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4050 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4051 delete (yyvsp[-1].TypeVal);
4057 #line 1759 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4059 if (!UpRefs.empty())
4060 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4061 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4062 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4063 GEN_ERROR("Cannot create a null initialized value of this type");
4064 (yyval.ConstVal) = Constant::getNullValue(Ty);
4065 delete (yyvsp[-1].TypeVal);
4071 #line 1769 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4072 { // integral constants
4073 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4074 GEN_ERROR("Constant value doesn't fit in type");
4075 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4081 #line 1775 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4082 { // arbitrary precision integer constants
4083 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4084 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4085 GEN_ERROR("Constant value does not fit in type");
4087 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4088 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4089 delete (yyvsp[0].APIntVal);
4095 #line 1785 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4096 { // integral constants
4097 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4098 GEN_ERROR("Constant value doesn't fit in type");
4099 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4105 #line 1791 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4106 { // arbitrary precision integer constants
4107 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4108 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4109 GEN_ERROR("Constant value does not fit in type");
4111 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4112 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4113 delete (yyvsp[0].APIntVal);
4119 #line 1801 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4120 { // Boolean constants
4121 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4122 (yyval.ConstVal) = ConstantInt::getTrue();
4128 #line 1806 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4129 { // Boolean constants
4130 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4131 (yyval.ConstVal) = ConstantInt::getFalse();
4137 #line 1811 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4138 { // Float & Double constants
4139 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4140 GEN_ERROR("Floating point constant invalid for type");
4141 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4147 #line 1819 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4149 if (!UpRefs.empty())
4150 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4151 Constant *Val = (yyvsp[-3].ConstVal);
4152 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4153 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4154 GEN_ERROR("invalid cast opcode for cast from '" +
4155 Val->getType()->getDescription() + "' to '" +
4156 DestTy->getDescription() + "'");
4157 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4158 delete (yyvsp[-1].TypeVal);
4163 #line 1831 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4165 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4166 GEN_ERROR("GetElementPtr requires a pointer operand");
4169 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4172 GEN_ERROR("Index list invalid for constant getelementptr");
4174 SmallVector<Constant*, 8> IdxVec;
4175 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4176 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4177 IdxVec.push_back(C);
4179 GEN_ERROR("Indices to constant getelementptr must be constants");
4181 delete (yyvsp[-1].ValueList);
4183 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4189 #line 1853 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4191 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4192 GEN_ERROR("Select condition must be of boolean type");
4193 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4194 GEN_ERROR("Select operand types must match");
4195 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4201 #line 1861 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4203 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4204 GEN_ERROR("Binary operator types must match");
4206 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4211 #line 1867 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4213 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4214 GEN_ERROR("Logical operator types must match");
4215 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4216 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4217 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4218 GEN_ERROR("Logical operator requires integral operands");
4220 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4226 #line 1878 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4228 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4229 GEN_ERROR("icmp operand types must match");
4230 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4235 #line 1883 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4237 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4238 GEN_ERROR("fcmp operand types must match");
4239 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4244 #line 1888 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4246 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4247 GEN_ERROR("Invalid extractelement operands");
4248 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4254 #line 1894 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4256 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4257 GEN_ERROR("Invalid insertelement operands");
4258 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4264 #line 1900 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4266 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4267 GEN_ERROR("Invalid shufflevector operands");
4268 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4274 #line 1909 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4276 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4282 #line 1913 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4284 (yyval.ConstVector) = new std::vector<Constant*>();
4285 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4291 #line 1921 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4292 { (yyval.BoolVal) = false; ;}
4296 #line 1921 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4297 { (yyval.BoolVal) = true; ;}
4301 #line 1924 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4302 { (yyval.BoolVal) = true; ;}
4306 #line 1924 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4307 { (yyval.BoolVal) = false; ;}
4311 #line 1935 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4313 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4314 CurModule.ModuleDone();
4320 #line 1940 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4322 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4323 CurModule.ModuleDone();
4329 #line 1953 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4330 { CurFun.isDeclare = false; ;}
4334 #line 1953 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4336 CurFun.FunctionDone();
4342 #line 1957 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4343 { CurFun.isDeclare = true; ;}
4347 #line 1957 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4354 #line 1960 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4361 #line 1963 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4363 if (!UpRefs.empty())
4364 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4365 // Eagerly resolve types. This is not an optimization, this is a
4366 // requirement that is due to the fact that we could have this:
4368 // %list = type { %list * }
4369 // %list = type { %list * } ; repeated type decl
4371 // If types are not resolved eagerly, then the two types will not be
4372 // determined to be the same type!
4374 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4376 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4378 // If this is a named type that is not a redefinition, add it to the slot
4380 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4383 delete (yyvsp[0].TypeVal);
4389 #line 1987 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4391 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4393 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4395 // If this is a named type that is not a redefinition, add it to the slot
4397 CurModule.Types.push_back((yyvsp[0].PrimType));
4404 #line 1998 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4406 /* "Externally Visible" Linkage */
4407 if ((yyvsp[0].ConstVal) == 0)
4408 GEN_ERROR("Global value initializer is not a constant");
4409 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), GlobalValue::ExternalLinkage,
4410 (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal));
4416 #line 2005 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4423 #line 2008 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4425 if ((yyvsp[0].ConstVal) == 0)
4426 GEN_ERROR("Global value initializer is not a constant");
4427 CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal));
4433 #line 2013 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4440 #line 2016 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4442 if (!UpRefs.empty())
4443 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4444 CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0, (yyvsp[-2].BoolVal));
4446 delete (yyvsp[0].TypeVal);
4451 #line 2022 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4459 #line 2026 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4466 #line 2029 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4473 #line 2035 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4475 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4476 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4477 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4478 free((yyvsp[0].StrVal));
4480 if (AsmSoFar.empty())
4481 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4483 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4489 #line 2048 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4491 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4492 free((yyvsp[0].StrVal));
4497 #line 2052 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4499 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4500 free((yyvsp[0].StrVal));
4505 #line 2059 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4507 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4508 free((yyvsp[0].StrVal));
4514 #line 2064 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4516 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4517 free((yyvsp[0].StrVal));
4523 #line 2069 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4530 #line 2078 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4532 if (!UpRefs.empty())
4533 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4534 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4535 GEN_ERROR("void typed arguments are invalid");
4536 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4537 (yyval.ArgList) = (yyvsp[-4].ArgList);
4538 (yyvsp[-4].ArgList)->push_back(E);
4544 #line 2088 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4546 if (!UpRefs.empty())
4547 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4548 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4549 GEN_ERROR("void typed arguments are invalid");
4550 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4551 (yyval.ArgList) = new ArgListType;
4552 (yyval.ArgList)->push_back(E);
4558 #line 2099 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4560 (yyval.ArgList) = (yyvsp[0].ArgList);
4566 #line 2103 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4568 (yyval.ArgList) = (yyvsp[-2].ArgList);
4569 struct ArgListEntry E;
4570 E.Ty = new PATypeHolder(Type::VoidTy);
4572 E.Attrs = ParamAttr::None;
4573 (yyval.ArgList)->push_back(E);
4579 #line 2112 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4581 (yyval.ArgList) = new ArgListType;
4582 struct ArgListEntry E;
4583 E.Ty = new PATypeHolder(Type::VoidTy);
4585 E.Attrs = ParamAttr::None;
4586 (yyval.ArgList)->push_back(E);
4592 #line 2121 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4594 (yyval.ArgList) = 0;
4600 #line 2127 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4602 UnEscapeLexed((yyvsp[-6].StrVal));
4603 std::string FunctionName((yyvsp[-6].StrVal));
4604 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4606 // Check the function result for abstractness if this is a define. We should
4607 // have no abstract types at this point
4608 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4609 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4611 std::vector<const Type*> ParamTypeList;
4612 ParamAttrsList ParamAttrs;
4613 if ((yyvsp[-2].ParamAttrs) != ParamAttr::None)
4614 ParamAttrs.addAttributes(0, (yyvsp[-2].ParamAttrs));
4615 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4617 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++index) {
4618 const Type* Ty = I->Ty->get();
4619 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4620 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4621 ParamTypeList.push_back(Ty);
4622 if (Ty != Type::VoidTy)
4623 if (I->Attrs != ParamAttr::None)
4624 ParamAttrs.addAttributes(index, I->Attrs);
4628 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4629 if (isVarArg) ParamTypeList.pop_back();
4631 ParamAttrsList *ActualAttrs = 0;
4632 if (!ParamAttrs.empty())
4633 ActualAttrs = new ParamAttrsList(ParamAttrs);
4635 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
4637 const PointerType *PFT = PointerType::get(FT);
4638 delete (yyvsp[-7].TypeVal);
4641 if (!FunctionName.empty()) {
4642 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4644 ID = ValID::createGlobalID(CurModule.Values.size());
4648 // See if this function was forward referenced. If so, recycle the object.
4649 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4650 // Move the function to the end of the list, from whereever it was
4651 // previously inserted.
4652 Fn = cast<Function>(FWRef);
4653 CurModule.CurrentModule->getFunctionList().remove(Fn);
4654 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4655 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4656 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4657 if (Fn->getFunctionType() != FT ) {
4658 // The existing function doesn't have the same type. This is an overload
4660 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4661 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4662 // Neither the existing or the current function is a declaration and they
4663 // have the same name and same type. Clearly this is a redefinition.
4664 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4665 } if (Fn->isDeclaration()) {
4666 // Make sure to strip off any argument names so we can't get conflicts.
4667 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4671 } else { // Not already defined?
4672 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4673 CurModule.CurrentModule);
4675 InsertValue(Fn, CurModule.Values);
4678 CurFun.FunctionStart(Fn);
4680 if (CurFun.isDeclare) {
4681 // If we have declaration, always overwrite linkage. This will allow us to
4682 // correctly handle cases, when pointer to function is passed as argument to
4683 // another function.
4684 Fn->setLinkage(CurFun.Linkage);
4685 Fn->setVisibility(CurFun.Visibility);
4687 Fn->setCallingConv((yyvsp[-8].UIntVal));
4688 Fn->setAlignment((yyvsp[0].UIntVal));
4689 if ((yyvsp[-1].StrVal)) {
4690 Fn->setSection((yyvsp[-1].StrVal));
4691 free((yyvsp[-1].StrVal));
4694 // Add all of the arguments we parsed to the function...
4695 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4696 if (isVarArg) { // Nuke the last entry
4697 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4698 "Not a varargs marker!");
4699 delete (yyvsp[-4].ArgList)->back().Ty;
4700 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4702 Function::arg_iterator ArgIt = Fn->arg_begin();
4703 Function::arg_iterator ArgEnd = Fn->arg_end();
4705 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4706 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4707 delete I->Ty; // Delete the typeholder...
4708 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4714 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4721 #line 2247 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4723 (yyval.FunctionVal) = CurFun.CurrentFunction;
4725 // Make sure that we keep track of the linkage type even if there was a
4726 // previous "declare".
4727 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4728 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4733 #line 2258 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4735 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4741 #line 2263 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4743 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4744 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4745 (yyval.FunctionVal) = CurFun.CurrentFunction;
4746 CurFun.FunctionDone();
4752 #line 2275 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4754 (yyval.BoolVal) = false;
4760 #line 2279 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4762 (yyval.BoolVal) = true;
4768 #line 2284 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4769 { // A reference to a direct constant
4770 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4776 #line 2288 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4778 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4784 #line 2292 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4785 { // Perhaps it's an FP constant?
4786 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4792 #line 2296 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4794 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4800 #line 2300 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4802 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4808 #line 2304 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4810 (yyval.ValIDVal) = ValID::createNull();
4816 #line 2308 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4818 (yyval.ValIDVal) = ValID::createUndef();
4824 #line 2312 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4825 { // A vector zero constant.
4826 (yyval.ValIDVal) = ValID::createZeroInit();
4832 #line 2316 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4833 { // Nonempty unsized packed vector
4834 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4835 int NumElements = (yyvsp[-1].ConstVector)->size();
4837 VectorType* pt = VectorType::get(ETy, NumElements);
4838 PATypeHolder* PTy = new PATypeHolder(
4846 // Verify all elements are correct type!
4847 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4848 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4849 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4850 ETy->getDescription() +"' as required!\nIt is of type '" +
4851 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4854 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
4855 delete PTy; delete (yyvsp[-1].ConstVector);
4861 #line 2341 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4863 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4869 #line 2345 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4871 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4872 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4873 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4874 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4875 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4876 free((yyvsp[-2].StrVal));
4877 free((yyvsp[0].StrVal));
4883 #line 2359 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4884 { // Is it an integer reference...?
4885 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
4891 #line 2363 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4893 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
4899 #line 2367 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4900 { // Is it a named reference...?
4901 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
4907 #line 2371 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4908 { // Is it a named reference...?
4909 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
4915 #line 2383 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4917 if (!UpRefs.empty())
4918 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4919 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4920 delete (yyvsp[-1].TypeVal);
4926 #line 2392 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4928 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4934 #line 2396 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4935 { // Do not allow functions with 0 basic blocks
4936 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4942 #line 2405 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4944 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4946 InsertValue((yyvsp[0].TermInstVal));
4947 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4948 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4954 #line 2414 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4956 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4957 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4958 if (CI2->getParent() == 0)
4959 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4960 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4961 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4967 #line 2423 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4968 { // Empty space between instruction lists
4969 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4975 #line 2427 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4976 { // Labelled (named) basic block
4977 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal)));
4983 #line 2432 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4984 { // Return with a result...
4985 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4991 #line 2436 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4992 { // Return with no result...
4993 (yyval.TermInstVal) = new ReturnInst();
4999 #line 2440 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5000 { // Unconditional Branch...
5001 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5003 (yyval.TermInstVal) = new BranchInst(tmpBB);
5008 #line 2445 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5010 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
5011 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
5013 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5015 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5017 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5022 #line 2455 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5024 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5026 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5028 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5029 (yyval.TermInstVal) = S;
5031 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5032 E = (yyvsp[-1].JumpTable)->end();
5033 for (; I != E; ++I) {
5034 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5035 S->addCase(CI, I->second);
5037 GEN_ERROR("Switch case is constant, but not a simple integer");
5039 delete (yyvsp[-1].JumpTable);
5045 #line 2474 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5047 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5049 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5051 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5052 (yyval.TermInstVal) = S;
5058 #line 2484 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5061 // Handle the short syntax
5062 const PointerType *PFTy = 0;
5063 const FunctionType *Ty = 0;
5064 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5065 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5066 // Pull out the types of all of the arguments...
5067 std::vector<const Type*> ParamTypes;
5068 ParamAttrsList ParamAttrs;
5069 if ((yyvsp[-6].ParamAttrs) != ParamAttr::None)
5070 ParamAttrs.addAttributes(0, (yyvsp[-6].ParamAttrs));
5071 ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end();
5073 for (; I != E; ++I, ++index) {
5074 const Type *Ty = I->Val->getType();
5075 if (Ty == Type::VoidTy)
5076 GEN_ERROR("Short call syntax cannot be used with varargs");
5077 ParamTypes.push_back(Ty);
5078 if (I->Attrs != ParamAttr::None)
5079 ParamAttrs.addAttributes(index, I->Attrs);
5082 ParamAttrsList *Attrs = 0;
5083 if (!ParamAttrs.empty())
5084 Attrs = new ParamAttrsList(ParamAttrs);
5085 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, Attrs);
5086 PFTy = PointerType::get(Ty);
5089 delete (yyvsp[-11].TypeVal);
5091 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5093 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5095 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5098 // Check the arguments
5100 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5101 // Make sure no arguments is a good thing!
5102 if (Ty->getNumParams() != 0)
5103 GEN_ERROR("No arguments passed to a function that "
5104 "expects arguments");
5105 } else { // Has arguments?
5106 // Loop through FunctionType's arguments and ensure they are specified
5108 FunctionType::param_iterator I = Ty->param_begin();
5109 FunctionType::param_iterator E = Ty->param_end();
5110 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5112 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5113 if (ArgI->Val->getType() != *I)
5114 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5115 (*I)->getDescription() + "'");
5116 Args.push_back(ArgI->Val);
5119 if (Ty->isVarArg()) {
5121 for (; ArgI != ArgE; ++ArgI)
5122 Args.push_back(ArgI->Val); // push the remaining varargs
5123 } else if (I != E || ArgI != ArgE)
5124 GEN_ERROR("Invalid number of parameters detected");
5127 // Create the InvokeInst
5128 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5129 II->setCallingConv((yyvsp[-12].UIntVal));
5130 (yyval.TermInstVal) = II;
5131 delete (yyvsp[-8].ValueRefList);
5137 #line 2559 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5139 (yyval.TermInstVal) = new UnwindInst();
5145 #line 2563 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5147 (yyval.TermInstVal) = new UnreachableInst();
5153 #line 2570 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5155 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5156 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5159 GEN_ERROR("May only switch on a constant pool value");
5161 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5163 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5168 #line 2581 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5170 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5171 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5175 GEN_ERROR("May only switch on a constant pool value");
5177 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5179 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5184 #line 2594 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5186 // Is this definition named?? if so, assign the name...
5187 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5189 InsertValue((yyvsp[0].InstVal));
5190 (yyval.InstVal) = (yyvsp[0].InstVal);
5196 #line 2604 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5197 { // Used for PHI nodes
5198 if (!UpRefs.empty())
5199 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5200 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5201 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5203 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5205 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5206 delete (yyvsp[-5].TypeVal);
5211 #line 2615 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5213 (yyval.PHIList) = (yyvsp[-6].PHIList);
5214 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5216 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5218 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5223 #line 2625 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5225 if (!UpRefs.empty())
5226 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5227 // Used for call and invoke instructions
5228 (yyval.ValueRefList) = new ValueRefList();
5229 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5230 (yyval.ValueRefList)->push_back(E);
5231 delete (yyvsp[-2].TypeVal);
5236 #line 2634 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5238 if (!UpRefs.empty())
5239 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5240 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5241 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5242 (yyval.ValueRefList)->push_back(E);
5243 delete (yyvsp[-2].TypeVal);
5249 #line 2643 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5250 { (yyval.ValueRefList) = new ValueRefList(); ;}
5254 #line 2646 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5255 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5259 #line 2647 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5261 (yyval.ValueList) = (yyvsp[-2].ValueList);
5262 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5268 #line 2654 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5270 (yyval.BoolVal) = true;
5276 #line 2658 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5278 (yyval.BoolVal) = false;
5284 #line 2663 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5286 if (!UpRefs.empty())
5287 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5288 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5289 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5291 "Arithmetic operator requires integer, FP, or packed operands");
5292 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5293 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5294 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5295 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5296 GEN_ERROR("Remainder not supported on vector types");
5297 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5299 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5301 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5302 if ((yyval.InstVal) == 0)
5303 GEN_ERROR("binary operator returned null");
5304 delete (yyvsp[-3].TypeVal);
5309 #line 2684 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5311 if (!UpRefs.empty())
5312 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5313 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5314 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5315 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5316 GEN_ERROR("Logical operator requires integral operands");
5318 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5320 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5322 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5323 if ((yyval.InstVal) == 0)
5324 GEN_ERROR("binary operator returned null");
5325 delete (yyvsp[-3].TypeVal);
5330 #line 2701 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5332 if (!UpRefs.empty())
5333 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5334 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5335 GEN_ERROR("Vector types not supported by icmp instruction");
5336 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5338 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5340 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5341 if ((yyval.InstVal) == 0)
5342 GEN_ERROR("icmp operator returned null");
5343 delete (yyvsp[-3].TypeVal);
5348 #line 2715 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5350 if (!UpRefs.empty())
5351 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5352 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5353 GEN_ERROR("Vector types not supported by fcmp instruction");
5354 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5356 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5358 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5359 if ((yyval.InstVal) == 0)
5360 GEN_ERROR("fcmp operator returned null");
5361 delete (yyvsp[-3].TypeVal);
5366 #line 2729 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5368 if (!UpRefs.empty())
5369 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5370 Value* Val = (yyvsp[-2].ValueVal);
5371 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5372 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5373 GEN_ERROR("invalid cast opcode for cast from '" +
5374 Val->getType()->getDescription() + "' to '" +
5375 DestTy->getDescription() + "'");
5376 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5377 delete (yyvsp[0].TypeVal);
5382 #line 2741 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5384 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5385 GEN_ERROR("select condition must be boolean");
5386 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5387 GEN_ERROR("select value types should match");
5388 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5394 #line 2749 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5396 if (!UpRefs.empty())
5397 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5398 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5399 delete (yyvsp[0].TypeVal);
5405 #line 2756 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5407 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5408 GEN_ERROR("Invalid extractelement operands");
5409 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5415 #line 2762 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5417 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5418 GEN_ERROR("Invalid insertelement operands");
5419 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5425 #line 2768 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5427 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5428 GEN_ERROR("Invalid shufflevector operands");
5429 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5435 #line 2774 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5437 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5438 if (!Ty->isFirstClassType())
5439 GEN_ERROR("PHI node operands must be of first class type");
5440 (yyval.InstVal) = new PHINode(Ty);
5441 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5442 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5443 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5444 GEN_ERROR("All elements of a PHI node must be of the same type");
5445 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5446 (yyvsp[0].PHIList)->pop_front();
5448 delete (yyvsp[0].PHIList); // Free the list...
5454 #line 2790 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5457 // Handle the short syntax
5458 const PointerType *PFTy = 0;
5459 const FunctionType *Ty = 0;
5460 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5461 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5462 // Pull out the types of all of the arguments...
5463 std::vector<const Type*> ParamTypes;
5464 ParamAttrsList ParamAttrs;
5465 if ((yyvsp[0].ParamAttrs) != ParamAttr::None)
5466 ParamAttrs.addAttributes(0, (yyvsp[0].ParamAttrs));
5468 ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end();
5469 for (; I != E; ++I, ++index) {
5470 const Type *Ty = I->Val->getType();
5471 if (Ty == Type::VoidTy)
5472 GEN_ERROR("Short call syntax cannot be used with varargs");
5473 ParamTypes.push_back(Ty);
5474 if (I->Attrs != ParamAttr::None)
5475 ParamAttrs.addAttributes(index, I->Attrs);
5478 ParamAttrsList *Attrs = 0;
5479 if (!ParamAttrs.empty())
5480 Attrs = new ParamAttrsList(ParamAttrs);
5482 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, Attrs);
5483 PFTy = PointerType::get(Ty);
5486 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5489 // Check for call to invalid intrinsic to avoid crashing later.
5490 if (Function *theF = dyn_cast<Function>(V)) {
5491 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5492 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5493 !theF->getIntrinsicID(true))
5494 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5495 theF->getName() + "'");
5498 // Check the arguments
5500 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5501 // Make sure no arguments is a good thing!
5502 if (Ty->getNumParams() != 0)
5503 GEN_ERROR("No arguments passed to a function that "
5504 "expects arguments");
5505 } else { // Has arguments?
5506 // Loop through FunctionType's arguments and ensure they are specified
5509 FunctionType::param_iterator I = Ty->param_begin();
5510 FunctionType::param_iterator E = Ty->param_end();
5511 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5513 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5514 if (ArgI->Val->getType() != *I)
5515 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5516 (*I)->getDescription() + "'");
5517 Args.push_back(ArgI->Val);
5519 if (Ty->isVarArg()) {
5521 for (; ArgI != ArgE; ++ArgI)
5522 Args.push_back(ArgI->Val); // push the remaining varargs
5523 } else if (I != E || ArgI != ArgE)
5524 GEN_ERROR("Invalid number of parameters detected");
5526 // Create the call node
5527 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5528 CI->setTailCall((yyvsp[-7].BoolVal));
5529 CI->setCallingConv((yyvsp[-6].UIntVal));
5530 (yyval.InstVal) = CI;
5531 delete (yyvsp[-2].ValueRefList);
5532 delete (yyvsp[-5].TypeVal);
5538 #line 2870 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5540 (yyval.InstVal) = (yyvsp[0].InstVal);
5546 #line 2875 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5548 (yyval.BoolVal) = true;
5554 #line 2879 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5556 (yyval.BoolVal) = false;
5562 #line 2886 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5564 if (!UpRefs.empty())
5565 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5566 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5567 delete (yyvsp[-1].TypeVal);
5573 #line 2893 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5575 if (!UpRefs.empty())
5576 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5577 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5579 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5580 delete (yyvsp[-4].TypeVal);
5585 #line 2901 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5587 if (!UpRefs.empty())
5588 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5589 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5590 delete (yyvsp[-1].TypeVal);
5596 #line 2908 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5598 if (!UpRefs.empty())
5599 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5600 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5602 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5603 delete (yyvsp[-4].TypeVal);
5608 #line 2916 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5610 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5611 GEN_ERROR("Trying to free nonpointer type " +
5612 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5613 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5619 #line 2924 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5621 if (!UpRefs.empty())
5622 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5623 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5624 GEN_ERROR("Can't load from nonpointer type: " +
5625 (*(yyvsp[-1].TypeVal))->getDescription());
5626 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5627 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5628 (*(yyvsp[-1].TypeVal))->getDescription());
5629 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5631 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5632 delete (yyvsp[-1].TypeVal);
5637 #line 2938 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5639 if (!UpRefs.empty())
5640 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5641 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5643 GEN_ERROR("Can't store to a nonpointer type: " +
5644 (*(yyvsp[-1].TypeVal))->getDescription());
5645 const Type *ElTy = PT->getElementType();
5646 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5647 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5648 "' into space of type '" + ElTy->getDescription() + "'");
5650 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5652 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5653 delete (yyvsp[-1].TypeVal);
5658 #line 2955 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5660 if (!UpRefs.empty())
5661 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5662 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5663 GEN_ERROR("getelementptr insn requires pointer operand");
5665 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5666 GEN_ERROR("Invalid getelementptr indices for type '" +
5667 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5668 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5670 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5671 delete (yyvsp[-2].TypeVal);
5672 delete (yyvsp[0].ValueList);
5680 /* Line 1126 of yacc.c. */
5681 #line 5682 "llvmAsmParser.tab.c"
5687 YY_STACK_PRINT (yyss, yyssp);
5692 /* Now `shift' the result of the reduction. Determine what state
5693 that goes to, based on the state we popped back to and the rule
5694 number reduced by. */
5698 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5699 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5700 yystate = yytable[yystate];
5702 yystate = yydefgoto[yyn - YYNTOKENS];
5707 /*------------------------------------.
5708 | yyerrlab -- here on detecting error |
5709 `------------------------------------*/
5711 /* If not already recovering from an error, report this error. */
5716 yyn = yypact[yystate];
5718 if (YYPACT_NINF < yyn && yyn < YYLAST)
5720 int yytype = YYTRANSLATE (yychar);
5721 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5722 YYSIZE_T yysize = yysize0;
5724 int yysize_overflow = 0;
5726 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5727 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5731 /* This is so xgettext sees the translatable formats that are
5732 constructed on the fly. */
5733 YY_("syntax error, unexpected %s");
5734 YY_("syntax error, unexpected %s, expecting %s");
5735 YY_("syntax error, unexpected %s, expecting %s or %s");
5736 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5737 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5741 static char const yyunexpected[] = "syntax error, unexpected %s";
5742 static char const yyexpecting[] = ", expecting %s";
5743 static char const yyor[] = " or %s";
5744 char yyformat[sizeof yyunexpected
5745 + sizeof yyexpecting - 1
5746 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5747 * (sizeof yyor - 1))];
5748 char const *yyprefix = yyexpecting;
5750 /* Start YYX at -YYN if negative to avoid negative indexes in
5752 int yyxbegin = yyn < 0 ? -yyn : 0;
5754 /* Stay within bounds of both yycheck and yytname. */
5755 int yychecklim = YYLAST - yyn;
5756 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5759 yyarg[0] = yytname[yytype];
5760 yyfmt = yystpcpy (yyformat, yyunexpected);
5762 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5763 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5765 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5769 yyformat[sizeof yyunexpected - 1] = '\0';
5772 yyarg[yycount++] = yytname[yyx];
5773 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5774 yysize_overflow |= yysize1 < yysize;
5776 yyfmt = yystpcpy (yyfmt, yyprefix);
5780 yyf = YY_(yyformat);
5781 yysize1 = yysize + yystrlen (yyf);
5782 yysize_overflow |= yysize1 < yysize;
5785 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5786 yymsg = (char *) YYSTACK_ALLOC (yysize);
5789 /* Avoid sprintf, as that infringes on the user's name space.
5790 Don't have undefined behavior even if the translation
5791 produced a string with the wrong number of "%s"s. */
5794 while ((*yyp = *yyf))
5796 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5798 yyp += yytnamerr (yyp, yyarg[yyi++]);
5808 YYSTACK_FREE (yymsg);
5812 yyerror (YY_("syntax error"));
5813 goto yyexhaustedlab;
5817 #endif /* YYERROR_VERBOSE */
5818 yyerror (YY_("syntax error"));
5823 if (yyerrstatus == 3)
5825 /* If just tried and failed to reuse look-ahead token after an
5826 error, discard it. */
5828 if (yychar <= YYEOF)
5830 /* Return failure if at end of input. */
5831 if (yychar == YYEOF)
5836 yydestruct ("Error: discarding", yytoken, &yylval);
5841 /* Else will try to reuse look-ahead token after shifting the error
5846 /*---------------------------------------------------.
5847 | yyerrorlab -- error raised explicitly by YYERROR. |
5848 `---------------------------------------------------*/
5851 /* Pacify compilers like GCC when the user code never invokes
5852 YYERROR and the label yyerrorlab therefore never appears in user
5863 /*-------------------------------------------------------------.
5864 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5865 `-------------------------------------------------------------*/
5867 yyerrstatus = 3; /* Each real token shifted decrements this. */
5871 yyn = yypact[yystate];
5872 if (yyn != YYPACT_NINF)
5875 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5883 /* Pop the current state because it cannot handle the error token. */
5888 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5891 YY_STACK_PRINT (yyss, yyssp);
5900 /* Shift the error token. */
5901 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5907 /*-------------------------------------.
5908 | yyacceptlab -- YYACCEPT comes here. |
5909 `-------------------------------------*/
5914 /*-----------------------------------.
5915 | yyabortlab -- YYABORT comes here. |
5916 `-----------------------------------*/
5922 /*-------------------------------------------------.
5923 | yyexhaustedlab -- memory exhaustion comes here. |
5924 `-------------------------------------------------*/
5926 yyerror (YY_("memory exhausted"));
5932 if (yychar != YYEOF && yychar != YYEMPTY)
5933 yydestruct ("Cleanup: discarding lookahead",
5935 while (yyssp != yyss)
5937 yydestruct ("Cleanup: popping",
5938 yystos[*yyssp], yyvsp);
5943 YYSTACK_FREE (yyss);
5949 #line 2972 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5952 // common code from the two 'RunVMAsmParser' functions
5953 static Module* RunParser(Module * M) {
5955 llvmAsmlineno = 1; // Reset the current line number...
5956 CurModule.CurrentModule = M;
5961 // Check to make sure the parser succeeded
5964 delete ParserResult;
5968 // Emit an error if there are any unresolved types left.
5969 if (!CurModule.LateResolveTypes.empty()) {
5970 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5971 if (DID.Type == ValID::LocalName) {
5972 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5974 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5977 delete ParserResult;
5981 // Emit an error if there are any unresolved values left.
5982 if (!CurModule.LateResolveValues.empty()) {
5983 Value *V = CurModule.LateResolveValues.back();
5984 std::map<Value*, std::pair<ValID, int> >::iterator I =
5985 CurModule.PlaceHolderInfo.find(V);
5987 if (I != CurModule.PlaceHolderInfo.end()) {
5988 ValID &DID = I->second.first;
5989 if (DID.Type == ValID::LocalName) {
5990 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5992 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5995 delete ParserResult;
6000 // Check to make sure that parsing produced a result
6004 // Reset ParserResult variable while saving its value for the result.
6005 Module *Result = ParserResult;
6011 void llvm::GenerateError(const std::string &message, int LineNo) {
6012 if (LineNo == -1) LineNo = llvmAsmlineno;
6013 // TODO: column number in exception
6015 TheParseError->setError(CurFilename, message, LineNo);
6019 int yyerror(const char *ErrorMsg) {
6021 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6022 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6023 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6024 if (yychar != YYEMPTY && yychar != 0)
6025 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6027 GenerateError(errMsg);