1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
86 ZEROINITIALIZER = 277,
129 X86_STDCALLCC_TOK = 320,
130 X86_FASTCALLCC_TOK = 321,
196 EXTRACTELEMENT = 387,
202 #define ESINT64VAL 258
203 #define EUINT64VAL 259
219 #define STRINGCONSTANT 275
220 #define IMPLEMENTATION 276
221 #define ZEROINITIALIZER 277
233 #define DOTDOTDOT 289
239 #define APPENDING 295
240 #define DLLIMPORT 296
241 #define DLLEXPORT 297
242 #define EXTERN_WEAK 298
249 #define POINTERSIZE 305
258 #define SIDEEFFECT 314
261 #define CSRETCC_TOK 317
262 #define FASTCC_TOK 318
263 #define COLDCC_TOK 319
264 #define X86_STDCALLCC_TOK 320
265 #define X86_FASTCALLCC_TOK 321
266 #define DATALAYOUT 322
272 #define UNREACHABLE 328
312 #define GETELEMENTPTR 368
331 #define EXTRACTELEMENT 387
332 #define INSERTELEMENT 388
333 #define SHUFFLEVECTOR 389
338 /* Copy the first part of user declarations. */
339 #line 14 "/proj/llvm/llvm-3/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/SymbolTable.h"
347 #include "llvm/Support/GetElementPtrTypeIterator.h"
348 #include "llvm/Support/CommandLine.h"
349 #include "llvm/ADT/STLExtras.h"
350 #include "llvm/Support/MathExtras.h"
351 #include "llvm/Support/Streams.h"
359 // The following is a gross hack. In order to rid the libAsmParser library of
360 // exceptions, we have to have a way of getting the yyparse function to go into
361 // an error situation. So, whenever we want an error to occur, the GenerateError
362 // function (see bottom of file) sets TriggerError. Then, at the end of each
363 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
364 // (a goto) to put YACC in error state. Furthermore, several calls to
365 // GenerateError are made from inside productions and they must simulate the
366 // previous exception behavior by exiting the production immediately. We have
367 // replaced these with the GEN_ERROR macro which calls GeneratError and then
368 // immediately invokes YYERROR. This would be so much cleaner if it was a
369 // recursive descent parser.
370 static bool TriggerError = false;
371 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
372 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
374 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
375 int yylex(); // declaration" of xxx warnings.
379 std::string CurFilename;
382 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
383 cl::Hidden, cl::init(false));
386 using namespace llvm;
388 static Module *ParserResult;
390 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
391 // relating to upreferences in the input stream.
393 //#define DEBUG_UPREFS 1
395 #define UR_OUT(X) cerr << X
400 #define YYERROR_VERBOSE 1
402 static GlobalVariable *CurGV;
405 // This contains info used when building the body of a function. It is
406 // destroyed when the function is completed.
408 typedef std::vector<Value *> ValueList; // Numbered defs
411 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
412 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
414 static struct PerModuleInfo {
415 Module *CurrentModule;
416 std::map<const Type *, ValueList> Values; // Module level numbered definitions
417 std::map<const Type *,ValueList> LateResolveValues;
418 std::vector<PATypeHolder> Types;
419 std::map<ValID, PATypeHolder> LateResolveTypes;
421 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
422 /// how they were referenced and on which line of the input they came from so
423 /// that we can resolve them later and print error messages as appropriate.
424 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
426 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
427 // references to global values. Global values may be referenced before they
428 // are defined, and if so, the temporary object that they represent is held
429 // here. This is used for forward references of GlobalValues.
431 typedef std::map<std::pair<const PointerType *,
432 ValID>, GlobalValue*> GlobalRefsType;
433 GlobalRefsType GlobalRefs;
436 // If we could not resolve some functions at function compilation time
437 // (calls to functions before they are defined), resolve them now... Types
438 // are resolved when the constant pool has been completely parsed.
440 ResolveDefinitions(LateResolveValues);
444 // Check to make sure that all global value forward references have been
447 if (!GlobalRefs.empty()) {
448 std::string UndefinedReferences = "Unresolved global references exist:\n";
450 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
452 UndefinedReferences += " " + I->first.first->getDescription() + " " +
453 I->first.second.getName() + "\n";
455 GenerateError(UndefinedReferences);
459 Values.clear(); // Clear out function local definitions
464 // GetForwardRefForGlobal - Check to see if there is a forward reference
465 // for this global. If so, remove it from the GlobalRefs map and return it.
466 // If not, just return null.
467 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
468 // Check to see if there is a forward reference to this global variable...
469 // if there is, eliminate it and patch the reference to use the new def'n.
470 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
471 GlobalValue *Ret = 0;
472 if (I != GlobalRefs.end()) {
480 static struct PerFunctionInfo {
481 Function *CurrentFunction; // Pointer to current function being created
483 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
484 std::map<const Type*, ValueList> LateResolveValues;
485 bool isDeclare; // Is this function a forward declararation?
486 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
488 /// BBForwardRefs - When we see forward references to basic blocks, keep
489 /// track of them here.
490 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
491 std::vector<BasicBlock*> NumberedBlocks;
494 inline PerFunctionInfo() {
497 Linkage = GlobalValue::ExternalLinkage;
500 inline void FunctionStart(Function *M) {
505 void FunctionDone() {
506 NumberedBlocks.clear();
508 // Any forward referenced blocks left?
509 if (!BBForwardRefs.empty()) {
510 GenerateError("Undefined reference to label " +
511 BBForwardRefs.begin()->first->getName());
515 // Resolve all forward references now.
516 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
518 Values.clear(); // Clear out function local definitions
521 Linkage = GlobalValue::ExternalLinkage;
523 } CurFun; // Info for the current function...
525 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
528 //===----------------------------------------------------------------------===//
529 // Code to handle definitions of all the types
530 //===----------------------------------------------------------------------===//
532 static int InsertValue(Value *V,
533 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
534 if (V->hasName()) return -1; // Is this a numbered definition?
536 // Yes, insert the value into the value table...
537 ValueList &List = ValueTab[V->getType()];
539 return List.size()-1;
542 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
544 case ValID::NumberVal: // Is it a numbered definition?
545 // Module constants occupy the lowest numbered slots...
546 if ((unsigned)D.Num < CurModule.Types.size())
547 return CurModule.Types[(unsigned)D.Num];
549 case ValID::NameVal: // Is it a named definition?
550 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
551 D.destroy(); // Free old strdup'd memory...
556 GenerateError("Internal parser error: Invalid symbol type reference!");
560 // If we reached here, we referenced either a symbol that we don't know about
561 // or an id number that hasn't been read yet. We may be referencing something
562 // forward, so just create an entry to be resolved later and get to it...
564 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
567 if (inFunctionScope()) {
568 if (D.Type == ValID::NameVal) {
569 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
572 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
577 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
578 if (I != CurModule.LateResolveTypes.end())
581 Type *Typ = OpaqueType::get();
582 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
586 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
587 SymbolTable &SymTab =
588 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
589 CurModule.CurrentModule->getSymbolTable();
590 return SymTab.lookup(Ty, Name);
593 // getValNonImprovising - Look up the value specified by the provided type and
594 // the provided ValID. If the value exists and has already been defined, return
595 // it. Otherwise return null.
597 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
598 if (isa<FunctionType>(Ty)) {
599 GenerateError("Functions are not values and "
600 "must be referenced as pointers");
605 case ValID::NumberVal: { // Is it a numbered definition?
606 unsigned Num = (unsigned)D.Num;
608 // Module constants occupy the lowest numbered slots...
609 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
610 if (VI != CurModule.Values.end()) {
611 if (Num < VI->second.size())
612 return VI->second[Num];
613 Num -= VI->second.size();
616 // Make sure that our type is within bounds
617 VI = CurFun.Values.find(Ty);
618 if (VI == CurFun.Values.end()) return 0;
620 // Check that the number is within bounds...
621 if (VI->second.size() <= Num) return 0;
623 return VI->second[Num];
626 case ValID::NameVal: { // Is it a named definition?
627 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
628 if (N == 0) return 0;
630 D.destroy(); // Free old strdup'd memory...
634 // Check to make sure that "Ty" is an integral type, and that our
635 // value will fit into the specified type...
636 case ValID::ConstSIntVal: // Is it a constant pool reference??
637 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
638 GenerateError("Signed integral constant '" +
639 itostr(D.ConstPool64) + "' is invalid for type '" +
640 Ty->getDescription() + "'!");
643 return ConstantInt::get(Ty, D.ConstPool64);
645 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
646 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
647 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
648 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
649 "' is invalid or out of range!");
651 } else { // This is really a signed reference. Transmogrify.
652 return ConstantInt::get(Ty, D.ConstPool64);
655 return ConstantInt::get(Ty, D.UConstPool64);
658 case ValID::ConstFPVal: // Is it a floating point const pool reference?
659 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
660 GenerateError("FP constant invalid for type!!");
663 return ConstantFP::get(Ty, D.ConstPoolFP);
665 case ValID::ConstNullVal: // Is it a null value?
666 if (!isa<PointerType>(Ty)) {
667 GenerateError("Cannot create a a non pointer null!");
670 return ConstantPointerNull::get(cast<PointerType>(Ty));
672 case ValID::ConstUndefVal: // Is it an undef value?
673 return UndefValue::get(Ty);
675 case ValID::ConstZeroVal: // Is it a zero value?
676 return Constant::getNullValue(Ty);
678 case ValID::ConstantVal: // Fully resolved constant?
679 if (D.ConstantValue->getType() != Ty) {
680 GenerateError("Constant expression type different from required type!");
683 return D.ConstantValue;
685 case ValID::InlineAsmVal: { // Inline asm expression
686 const PointerType *PTy = dyn_cast<PointerType>(Ty);
687 const FunctionType *FTy =
688 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
689 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
690 GenerateError("Invalid type for asm constraint string!");
693 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
694 D.IAD->HasSideEffects);
695 D.destroy(); // Free InlineAsmDescriptor.
699 assert(0 && "Unhandled case!");
703 assert(0 && "Unhandled case!");
707 // getVal - This function is identical to getValNonImprovising, except that if a
708 // value is not already defined, it "improvises" by creating a placeholder var
709 // that looks and acts just like the requested variable. When the value is
710 // defined later, all uses of the placeholder variable are replaced with the
713 static Value *getVal(const Type *Ty, const ValID &ID) {
714 if (Ty == Type::LabelTy) {
715 GenerateError("Cannot use a basic block here");
719 // See if the value has already been defined.
720 Value *V = getValNonImprovising(Ty, ID);
722 if (TriggerError) return 0;
724 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
725 GenerateError("Invalid use of a composite type!");
729 // If we reached here, we referenced either a symbol that we don't know about
730 // or an id number that hasn't been read yet. We may be referencing something
731 // forward, so just create an entry to be resolved later and get to it...
733 V = new Argument(Ty);
735 // Remember where this forward reference came from. FIXME, shouldn't we try
736 // to recycle these things??
737 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
740 if (inFunctionScope())
741 InsertValue(V, CurFun.LateResolveValues);
743 InsertValue(V, CurModule.LateResolveValues);
747 /// getBBVal - This is used for two purposes:
748 /// * If isDefinition is true, a new basic block with the specified ID is being
750 /// * If isDefinition is true, this is a reference to a basic block, which may
751 /// or may not be a forward reference.
753 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
754 assert(inFunctionScope() && "Can't get basic block at global scope!");
760 GenerateError("Illegal label reference " + ID.getName());
762 case ValID::NumberVal: // Is it a numbered definition?
763 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
764 CurFun.NumberedBlocks.resize(ID.Num+1);
765 BB = CurFun.NumberedBlocks[ID.Num];
767 case ValID::NameVal: // Is it a named definition?
769 if (Value *N = CurFun.CurrentFunction->
770 getSymbolTable().lookup(Type::LabelTy, Name))
771 BB = cast<BasicBlock>(N);
775 // See if the block has already been defined.
777 // If this is the definition of the block, make sure the existing value was
778 // just a forward reference. If it was a forward reference, there will be
779 // an entry for it in the PlaceHolderInfo map.
780 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
781 // The existing value was a definition, not a forward reference.
782 GenerateError("Redefinition of label " + ID.getName());
786 ID.destroy(); // Free strdup'd memory.
790 // Otherwise this block has not been seen before.
791 BB = new BasicBlock("", CurFun.CurrentFunction);
792 if (ID.Type == ValID::NameVal) {
793 BB->setName(ID.Name);
795 CurFun.NumberedBlocks[ID.Num] = BB;
798 // If this is not a definition, keep track of it so we can use it as a forward
801 // Remember where this forward reference came from.
802 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
804 // The forward declaration could have been inserted anywhere in the
805 // function: insert it into the correct place now.
806 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
807 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
814 //===----------------------------------------------------------------------===//
815 // Code to handle forward references in instructions
816 //===----------------------------------------------------------------------===//
818 // This code handles the late binding needed with statements that reference
819 // values not defined yet... for example, a forward branch, or the PHI node for
822 // This keeps a table (CurFun.LateResolveValues) of all such forward references
823 // and back patchs after we are done.
826 // ResolveDefinitions - If we could not resolve some defs at parsing
827 // time (forward branches, phi functions for loops, etc...) resolve the
831 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
832 std::map<const Type*,ValueList> *FutureLateResolvers) {
833 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
834 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
835 E = LateResolvers.end(); LRI != E; ++LRI) {
836 ValueList &List = LRI->second;
837 while (!List.empty()) {
838 Value *V = List.back();
841 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
842 CurModule.PlaceHolderInfo.find(V);
843 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
845 ValID &DID = PHI->second.first;
847 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
851 V->replaceAllUsesWith(TheRealValue);
853 CurModule.PlaceHolderInfo.erase(PHI);
854 } else if (FutureLateResolvers) {
855 // Functions have their unresolved items forwarded to the module late
857 InsertValue(V, *FutureLateResolvers);
859 if (DID.Type == ValID::NameVal) {
860 GenerateError("Reference to an invalid definition: '" +DID.getName()+
861 "' of type '" + V->getType()->getDescription() + "'",
865 GenerateError("Reference to an invalid definition: #" +
866 itostr(DID.Num) + " of type '" +
867 V->getType()->getDescription() + "'",
875 LateResolvers.clear();
878 // ResolveTypeTo - A brand new type was just declared. This means that (if
879 // name is not null) things referencing Name can be resolved. Otherwise, things
880 // refering to the number can be resolved. Do this now.
882 static void ResolveTypeTo(char *Name, const Type *ToTy) {
884 if (Name) D = ValID::create(Name);
885 else D = ValID::create((int)CurModule.Types.size());
887 std::map<ValID, PATypeHolder>::iterator I =
888 CurModule.LateResolveTypes.find(D);
889 if (I != CurModule.LateResolveTypes.end()) {
890 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
891 CurModule.LateResolveTypes.erase(I);
895 // setValueName - Set the specified value to the name given. The name may be
896 // null potentially, in which case this is a noop. The string passed in is
897 // assumed to be a malloc'd string buffer, and is free'd by this function.
899 static void setValueName(Value *V, char *NameStr) {
901 std::string Name(NameStr); // Copy string
902 free(NameStr); // Free old string
904 if (V->getType() == Type::VoidTy) {
905 GenerateError("Can't assign name '" + Name+"' to value with void type!");
909 assert(inFunctionScope() && "Must be in function scope!");
910 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
911 if (ST.lookup(V->getType(), Name)) {
912 GenerateError("Redefinition of value named '" + Name + "' in the '" +
913 V->getType()->getDescription() + "' type plane!");
922 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
923 /// this is a declaration, otherwise it is a definition.
924 static GlobalVariable *
925 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
926 bool isConstantGlobal, const Type *Ty,
927 Constant *Initializer) {
928 if (isa<FunctionType>(Ty)) {
929 GenerateError("Cannot declare global vars of function type!");
933 const PointerType *PTy = PointerType::get(Ty);
937 Name = NameStr; // Copy string
938 free(NameStr); // Free old string
941 // See if this global value was forward referenced. If so, recycle the
945 ID = ValID::create((char*)Name.c_str());
947 ID = ValID::create((int)CurModule.Values[PTy].size());
950 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
951 // Move the global to the end of the list, from whereever it was
952 // previously inserted.
953 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
954 CurModule.CurrentModule->getGlobalList().remove(GV);
955 CurModule.CurrentModule->getGlobalList().push_back(GV);
956 GV->setInitializer(Initializer);
957 GV->setLinkage(Linkage);
958 GV->setConstant(isConstantGlobal);
959 InsertValue(GV, CurModule.Values);
963 // If this global has a name, check to see if there is already a definition
964 // of this global in the module. If so, merge as appropriate. Note that
965 // this is really just a hack around problems in the CFE. :(
967 // We are a simple redefinition of a value, check to see if it is defined
968 // the same as the old one.
969 if (GlobalVariable *EGV =
970 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
971 // We are allowed to redefine a global variable in two circumstances:
972 // 1. If at least one of the globals is uninitialized or
973 // 2. If both initializers have the same value.
975 if (!EGV->hasInitializer() || !Initializer ||
976 EGV->getInitializer() == Initializer) {
978 // Make sure the existing global version gets the initializer! Make
979 // sure that it also gets marked const if the new version is.
980 if (Initializer && !EGV->hasInitializer())
981 EGV->setInitializer(Initializer);
982 if (isConstantGlobal)
983 EGV->setConstant(true);
984 EGV->setLinkage(Linkage);
988 GenerateError("Redefinition of global variable named '" + Name +
989 "' in the '" + Ty->getDescription() + "' type plane!");
994 // Otherwise there is no existing GV to use, create one now.
996 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
997 CurModule.CurrentModule);
998 InsertValue(GV, CurModule.Values);
1002 // setTypeName - Set the specified type to the name given. The name may be
1003 // null potentially, in which case this is a noop. The string passed in is
1004 // assumed to be a malloc'd string buffer, and is freed by this function.
1006 // This function returns true if the type has already been defined, but is
1007 // allowed to be redefined in the specified context. If the name is a new name
1008 // for the type plane, it is inserted and false is returned.
1009 static bool setTypeName(const Type *T, char *NameStr) {
1010 assert(!inFunctionScope() && "Can't give types function-local names!");
1011 if (NameStr == 0) return false;
1013 std::string Name(NameStr); // Copy string
1014 free(NameStr); // Free old string
1016 // We don't allow assigning names to void type
1017 if (T == Type::VoidTy) {
1018 GenerateError("Can't assign name '" + Name + "' to the void type!");
1022 // Set the type name, checking for conflicts as we do so.
1023 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1025 if (AlreadyExists) { // Inserting a name that is already defined???
1026 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1027 assert(Existing && "Conflict but no matching type?");
1029 // There is only one case where this is allowed: when we are refining an
1030 // opaque type. In this case, Existing will be an opaque type.
1031 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1032 // We ARE replacing an opaque type!
1033 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1037 // Otherwise, this is an attempt to redefine a type. That's okay if
1038 // the redefinition is identical to the original. This will be so if
1039 // Existing and T point to the same Type object. In this one case we
1040 // allow the equivalent redefinition.
1041 if (Existing == T) return true; // Yes, it's equal.
1043 // Any other kind of (non-equivalent) redefinition is an error.
1044 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1045 T->getDescription() + "' type plane!");
1051 //===----------------------------------------------------------------------===//
1052 // Code for handling upreferences in type names...
1055 // TypeContains - Returns true if Ty directly contains E in it.
1057 static bool TypeContains(const Type *Ty, const Type *E) {
1058 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1059 E) != Ty->subtype_end();
1063 struct UpRefRecord {
1064 // NestingLevel - The number of nesting levels that need to be popped before
1065 // this type is resolved.
1066 unsigned NestingLevel;
1068 // LastContainedTy - This is the type at the current binding level for the
1069 // type. Every time we reduce the nesting level, this gets updated.
1070 const Type *LastContainedTy;
1072 // UpRefTy - This is the actual opaque type that the upreference is
1073 // represented with.
1074 OpaqueType *UpRefTy;
1076 UpRefRecord(unsigned NL, OpaqueType *URTy)
1077 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1081 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1082 static std::vector<UpRefRecord> UpRefs;
1084 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1085 /// called. It loops through the UpRefs vector, which is a list of the
1086 /// currently active types. For each type, if the up reference is contained in
1087 /// the newly completed type, we decrement the level count. When the level
1088 /// count reaches zero, the upreferenced type is the type that is passed in:
1089 /// thus we can complete the cycle.
1091 static PATypeHolder HandleUpRefs(const Type *ty) {
1092 // If Ty isn't abstract, or if there are no up-references in it, then there is
1093 // nothing to resolve here.
1094 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1096 PATypeHolder Ty(ty);
1097 UR_OUT("Type '" << Ty->getDescription() <<
1098 "' newly formed. Resolving upreferences.\n" <<
1099 UpRefs.size() << " upreferences active!\n");
1101 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1102 // to zero), we resolve them all together before we resolve them to Ty. At
1103 // the end of the loop, if there is anything to resolve to Ty, it will be in
1105 OpaqueType *TypeToResolve = 0;
1107 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1108 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1109 << UpRefs[i].second->getDescription() << ") = "
1110 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1111 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1112 // Decrement level of upreference
1113 unsigned Level = --UpRefs[i].NestingLevel;
1114 UpRefs[i].LastContainedTy = Ty;
1115 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1116 if (Level == 0) { // Upreference should be resolved!
1117 if (!TypeToResolve) {
1118 TypeToResolve = UpRefs[i].UpRefTy;
1120 UR_OUT(" * Resolving upreference for "
1121 << UpRefs[i].second->getDescription() << "\n";
1122 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1123 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1124 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1125 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1127 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1128 --i; // Do not skip the next element...
1133 if (TypeToResolve) {
1134 UR_OUT(" * Resolving upreference for "
1135 << UpRefs[i].second->getDescription() << "\n";
1136 std::string OldName = TypeToResolve->getDescription());
1137 TypeToResolve->refineAbstractTypeTo(Ty);
1143 //===----------------------------------------------------------------------===//
1144 // RunVMAsmParser - Define an interface to this parser
1145 //===----------------------------------------------------------------------===//
1147 static Module* RunParser(Module * M);
1149 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1152 CurFilename = Filename;
1153 return RunParser(new Module(CurFilename));
1156 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1157 set_scan_string(AsmString);
1159 CurFilename = "from_memory";
1161 return RunParser(new Module (CurFilename));
1163 return RunParser(M);
1169 /* Enabling traces. */
1174 /* Enabling verbose error messages. */
1175 #ifdef YYERROR_VERBOSE
1176 # undef YYERROR_VERBOSE
1177 # define YYERROR_VERBOSE 1
1179 # define YYERROR_VERBOSE 0
1182 /* Enabling the token table. */
1183 #ifndef YYTOKEN_TABLE
1184 # define YYTOKEN_TABLE 0
1187 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1188 #line 843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
1189 typedef union YYSTYPE {
1190 llvm::Module *ModuleVal;
1191 llvm::Function *FunctionVal;
1192 llvm::BasicBlock *BasicBlockVal;
1193 llvm::TerminatorInst *TermInstVal;
1194 llvm::Instruction *InstVal;
1195 llvm::Constant *ConstVal;
1197 const llvm::Type *PrimType;
1198 std::list<llvm::PATypeHolder> *TypeList;
1199 llvm::PATypeHolder *TypeVal;
1200 llvm::Value *ValueVal;
1201 std::vector<llvm::Value*> *ValueList;
1202 llvm::ArgListType *ArgList;
1203 llvm::TypeWithAttrs TypeWithAttrs;
1204 llvm::TypeWithAttrsList *TypeWithAttrsList;
1205 llvm::ValueRefList *ValueRefList;
1207 // Represent the RHS of PHI node
1208 std::list<std::pair<llvm::Value*,
1209 llvm::BasicBlock*> > *PHIList;
1210 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1211 std::vector<llvm::Constant*> *ConstVector;
1213 llvm::GlobalValue::LinkageTypes Linkage;
1214 llvm::FunctionType::ParameterAttributes ParamAttrs;
1222 char *StrVal; // This memory is strdup'd!
1223 llvm::ValID ValIDVal; // strdup'd memory maybe!
1225 llvm::Instruction::BinaryOps BinaryOpVal;
1226 llvm::Instruction::TermOps TermOpVal;
1227 llvm::Instruction::MemoryOps MemOpVal;
1228 llvm::Instruction::CastOps CastOpVal;
1229 llvm::Instruction::OtherOps OtherOpVal;
1230 llvm::Module::Endianness Endianness;
1231 llvm::ICmpInst::Predicate IPredicate;
1232 llvm::FCmpInst::Predicate FPredicate;
1234 /* Line 196 of yacc.c. */
1235 #line 1236 "llvmAsmParser.tab.c"
1236 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1237 # define YYSTYPE_IS_DECLARED 1
1238 # define YYSTYPE_IS_TRIVIAL 1
1243 /* Copy the second part of user declarations. */
1246 /* Line 219 of yacc.c. */
1247 #line 1248 "llvmAsmParser.tab.c"
1249 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1250 # define YYSIZE_T __SIZE_TYPE__
1252 #if ! defined (YYSIZE_T) && defined (size_t)
1253 # define YYSIZE_T size_t
1255 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1256 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1257 # define YYSIZE_T size_t
1259 #if ! defined (YYSIZE_T)
1260 # define YYSIZE_T unsigned int
1266 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1267 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1271 # define YY_(msgid) msgid
1275 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1277 /* The parser invokes alloca or malloc; define the necessary symbols. */
1279 # ifdef YYSTACK_USE_ALLOCA
1280 # if YYSTACK_USE_ALLOCA
1282 # define YYSTACK_ALLOC __builtin_alloca
1284 # define YYSTACK_ALLOC alloca
1285 # if defined (__STDC__) || defined (__cplusplus)
1286 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1287 # define YYINCLUDED_STDLIB_H
1293 # ifdef YYSTACK_ALLOC
1294 /* Pacify GCC's `empty if-body' warning. */
1295 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1296 # ifndef YYSTACK_ALLOC_MAXIMUM
1297 /* The OS might guarantee only one guard page at the bottom of the stack,
1298 and a page size can be as small as 4096 bytes. So we cannot safely
1299 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1300 to allow for a few compiler-allocated temporary stack slots. */
1301 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1304 # define YYSTACK_ALLOC YYMALLOC
1305 # define YYSTACK_FREE YYFREE
1306 # ifndef YYSTACK_ALLOC_MAXIMUM
1307 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1313 # define YYMALLOC malloc
1314 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1315 && (defined (__STDC__) || defined (__cplusplus)))
1316 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1320 # define YYFREE free
1321 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1322 && (defined (__STDC__) || defined (__cplusplus)))
1323 void free (void *); /* INFRINGES ON USER NAME SPACE */
1330 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1333 #if (! defined (yyoverflow) \
1334 && (! defined (__cplusplus) \
1335 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1337 /* A type that is properly aligned for any stack member. */
1344 /* The size of the maximum gap between one aligned stack and the next. */
1345 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1347 /* The size of an array large to enough to hold all stacks, each with
1349 # define YYSTACK_BYTES(N) \
1350 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1351 + YYSTACK_GAP_MAXIMUM)
1353 /* Copy COUNT objects from FROM to TO. The source and destination do
1356 # if defined (__GNUC__) && 1 < __GNUC__
1357 # define YYCOPY(To, From, Count) \
1358 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1360 # define YYCOPY(To, From, Count) \
1364 for (yyi = 0; yyi < (Count); yyi++) \
1365 (To)[yyi] = (From)[yyi]; \
1371 /* Relocate STACK from its old location to the new one. The
1372 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1373 elements in the stack, and YYPTR gives the new location of the
1374 stack. Advance YYPTR to a properly aligned location for the next
1376 # define YYSTACK_RELOCATE(Stack) \
1379 YYSIZE_T yynewbytes; \
1380 YYCOPY (&yyptr->Stack, Stack, yysize); \
1381 Stack = &yyptr->Stack; \
1382 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1383 yyptr += yynewbytes / sizeof (*yyptr); \
1389 #if defined (__STDC__) || defined (__cplusplus)
1390 typedef signed char yysigned_char;
1392 typedef short int yysigned_char;
1395 /* YYFINAL -- State number of the termination state. */
1397 /* YYLAST -- Last index in YYTABLE. */
1400 /* YYNTOKENS -- Number of terminals. */
1401 #define YYNTOKENS 150
1402 /* YYNNTS -- Number of nonterminals. */
1404 /* YYNRULES -- Number of rules. */
1405 #define YYNRULES 288
1406 /* YYNRULES -- Number of states. */
1407 #define YYNSTATES 572
1409 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1410 #define YYUNDEFTOK 2
1411 #define YYMAXUTOK 389
1413 #define YYTRANSLATE(YYX) \
1414 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1416 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1417 static const unsigned char yytranslate[] =
1419 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1423 138, 139, 140, 2, 136, 2, 2, 2, 2, 2,
1424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1425 145, 135, 146, 2, 137, 2, 2, 2, 2, 2,
1426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1428 2, 142, 141, 144, 2, 2, 2, 2, 2, 149,
1429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1431 143, 2, 2, 147, 2, 148, 2, 2, 2, 2,
1432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1444 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1445 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1446 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1447 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1448 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1449 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1450 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1451 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1452 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1453 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1454 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1455 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1456 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1457 125, 126, 127, 128, 129, 130, 131, 132, 133, 134
1461 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1463 static const unsigned short int yyprhs[] =
1465 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1466 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1467 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1468 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1469 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1470 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1471 119, 121, 123, 125, 128, 129, 131, 133, 135, 137,
1472 139, 141, 143, 145, 146, 148, 150, 151, 153, 155,
1473 157, 159, 160, 162, 164, 166, 168, 170, 172, 175,
1474 177, 179, 181, 185, 186, 189, 194, 195, 198, 199,
1475 203, 206, 207, 209, 210, 214, 216, 219, 221, 223,
1476 225, 227, 229, 231, 233, 235, 237, 239, 242, 244,
1477 247, 253, 259, 265, 271, 275, 278, 284, 289, 292,
1478 295, 298, 300, 304, 306, 310, 312, 313, 315, 319,
1479 324, 328, 332, 337, 342, 346, 349, 352, 355, 358,
1480 361, 364, 367, 370, 373, 376, 383, 389, 398, 405,
1481 412, 420, 428, 435, 442, 451, 460, 464, 466, 468,
1482 470, 472, 473, 475, 478, 479, 483, 484, 488, 492,
1483 494, 498, 502, 503, 509, 510, 517, 518, 525, 528,
1484 532, 534, 536, 538, 542, 546, 550, 554, 558, 562,
1485 564, 565, 567, 569, 571, 572, 578, 582, 584, 588,
1486 590, 591, 600, 602, 604, 608, 610, 612, 615, 618,
1487 619, 621, 623, 625, 627, 629, 631, 633, 635, 637,
1488 641, 643, 649, 651, 653, 655, 657, 660, 663, 666,
1489 670, 673, 674, 676, 679, 682, 686, 696, 706, 715,
1490 729, 731, 733, 740, 746, 749, 756, 764, 768, 774,
1491 775, 776, 780, 783, 785, 791, 797, 804, 811, 814,
1492 819, 824, 831, 836, 841, 848, 855, 858, 866, 868,
1493 870, 871, 875, 882, 886, 893, 896, 901, 908
1496 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1497 static const short int yyrhs[] =
1499 186, 0, -1, 5, -1, 6, -1, 74, -1, 75,
1500 -1, 76, -1, 77, -1, 78, -1, 79, -1, 80,
1501 -1, 81, -1, 82, -1, 83, -1, 84, -1, 85,
1502 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
1503 -1, 119, -1, 120, -1, 121, -1, 122, -1, 123,
1504 -1, 124, -1, 125, -1, 128, -1, 129, -1, 130,
1505 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1506 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1507 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1508 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1509 -1, 94, -1, 95, -1, 96, -1, 97, -1, 23,
1510 -1, 24, -1, 13, -1, 12, -1, 11, -1, 10,
1511 -1, 14, -1, 15, -1, 199, 135, -1, -1, 37,
1512 -1, 39, -1, 38, -1, 40, -1, 42, -1, 41,
1513 -1, 43, -1, 46, -1, -1, 41, -1, 43, -1,
1514 -1, 37, -1, 38, -1, 39, -1, 42, -1, -1,
1515 61, -1, 62, -1, 63, -1, 64, -1, 65, -1,
1516 66, -1, 60, 4, -1, 115, -1, 116, -1, 166,
1517 -1, 167, 136, 166, -1, -1, 137, 166, -1, 137,
1518 138, 167, 139, -1, -1, 53, 4, -1, -1, 136,
1519 53, 4, -1, 31, 20, -1, -1, 171, -1, -1,
1520 136, 174, 173, -1, 171, -1, 53, 4, -1, 9,
1521 -1, 10, -1, 11, -1, 12, -1, 13, -1, 14,
1522 -1, 15, -1, 16, -1, 44, -1, 175, -1, 176,
1523 140, -1, 211, -1, 141, 4, -1, 176, 168, 138,
1524 180, 139, -1, 8, 168, 138, 180, 139, -1, 142,
1525 4, 143, 176, 144, -1, 145, 4, 143, 176, 146,
1526 -1, 147, 181, 148, -1, 147, 148, -1, 145, 147,
1527 181, 148, 146, -1, 145, 147, 148, 146, -1, 176,
1528 168, -1, 176, 168, -1, 8, 168, -1, 177, -1,
1529 179, 136, 177, -1, 179, -1, 179, 136, 34, -1,
1530 34, -1, -1, 176, -1, 181, 136, 176, -1, 176,
1531 142, 184, 144, -1, 176, 142, 144, -1, 176, 149,
1532 20, -1, 176, 145, 184, 146, -1, 176, 147, 184,
1533 148, -1, 176, 147, 148, -1, 176, 35, -1, 176,
1534 36, -1, 176, 211, -1, 176, 183, -1, 176, 22,
1535 -1, 158, 3, -1, 158, 4, -1, 9, 23, -1,
1536 9, 24, -1, 159, 7, -1, 154, 138, 182, 33,
1537 176, 139, -1, 113, 138, 182, 222, 139, -1, 127,
1538 138, 182, 136, 182, 136, 182, 139, -1, 152, 138,
1539 182, 136, 182, 139, -1, 153, 138, 182, 136, 182,
1540 139, -1, 86, 156, 138, 182, 136, 182, 139, -1,
1541 87, 157, 138, 182, 136, 182, 139, -1, 155, 138,
1542 182, 136, 182, 139, -1, 132, 138, 182, 136, 182,
1543 139, -1, 133, 138, 182, 136, 182, 136, 182, 139,
1544 -1, 134, 138, 182, 136, 182, 136, 182, 139, -1,
1545 184, 136, 182, -1, 182, -1, 29, -1, 30, -1,
1546 187, -1, -1, 188, -1, 187, 188, -1, -1, 28,
1547 189, 207, -1, -1, 27, 190, 208, -1, 58, 57,
1548 194, -1, 21, -1, 160, 17, 176, -1, 160, 17,
1549 8, -1, -1, 160, 185, 182, 191, 173, -1, -1,
1550 160, 161, 185, 182, 192, 173, -1, -1, 160, 162,
1551 185, 176, 193, 173, -1, 47, 196, -1, 54, 135,
1552 197, -1, 20, -1, 52, -1, 51, -1, 49, 135,
1553 195, -1, 50, 135, 4, -1, 48, 135, 20, -1,
1554 67, 135, 20, -1, 142, 198, 144, -1, 198, 136,
1555 20, -1, 20, -1, -1, 18, -1, 20, -1, 199,
1556 -1, -1, 201, 136, 176, 168, 200, -1, 176, 168,
1557 200, -1, 201, -1, 201, 136, 34, -1, 34, -1,
1558 -1, 165, 178, 199, 138, 202, 139, 172, 169, -1,
1559 25, -1, 147, -1, 164, 203, 204, -1, 26, -1,
1560 148, -1, 214, 206, -1, 163, 203, -1, -1, 59,
1561 -1, 3, -1, 4, -1, 7, -1, 23, -1, 24,
1562 -1, 35, -1, 36, -1, 22, -1, 145, 184, 146,
1563 -1, 183, -1, 57, 209, 20, 136, 20, -1, 151,
1564 -1, 199, -1, 211, -1, 210, -1, 176, 212, -1,
1565 214, 215, -1, 205, 215, -1, 216, 160, 217, -1,
1566 216, 219, -1, -1, 19, -1, 68, 213, -1, 68,
1567 8, -1, 69, 16, 212, -1, 69, 9, 212, 136,
1568 16, 212, 136, 16, 212, -1, 70, 158, 212, 136,
1569 16, 212, 142, 218, 144, -1, 70, 158, 212, 136,
1570 16, 212, 142, 144, -1, 71, 165, 178, 212, 138,
1571 221, 139, 33, 16, 212, 72, 16, 212, -1, 72,
1572 -1, 73, -1, 218, 158, 210, 136, 16, 212, -1,
1573 158, 210, 136, 16, 212, -1, 160, 224, -1, 176,
1574 142, 212, 136, 212, 144, -1, 220, 136, 142, 212,
1575 136, 212, 144, -1, 176, 212, 168, -1, 221, 136,
1576 176, 212, 168, -1, -1, -1, 222, 136, 213, -1,
1577 56, 55, -1, 55, -1, 152, 176, 212, 136, 212,
1578 -1, 153, 176, 212, 136, 212, -1, 86, 156, 176,
1579 212, 136, 212, -1, 87, 157, 176, 212, 136, 212,
1580 -1, 45, 213, -1, 155, 213, 136, 213, -1, 154,
1581 213, 33, 176, -1, 127, 213, 136, 213, 136, 213,
1582 -1, 131, 213, 136, 176, -1, 132, 213, 136, 213,
1583 -1, 133, 213, 136, 213, 136, 213, -1, 134, 213,
1584 136, 213, 136, 213, -1, 126, 220, -1, 223, 165,
1585 178, 212, 138, 221, 139, -1, 226, -1, 32, -1,
1586 -1, 108, 176, 170, -1, 108, 176, 136, 12, 212,
1587 170, -1, 109, 176, 170, -1, 109, 176, 136, 12,
1588 212, 170, -1, 110, 213, -1, 225, 111, 176, 212,
1589 -1, 225, 112, 213, 136, 176, 212, -1, 113, 176,
1593 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1594 static const unsigned short int yyrline[] =
1596 0, 983, 983, 984, 994, 994, 994, 994, 994, 994,
1597 994, 994, 994, 995, 995, 995, 996, 996, 996, 996,
1598 996, 996, 997, 997, 997, 997, 997, 997, 998, 998,
1599 998, 1000, 1000, 1001, 1001, 1002, 1002, 1003, 1003, 1004,
1600 1004, 1008, 1008, 1009, 1009, 1010, 1010, 1011, 1011, 1012,
1601 1012, 1013, 1013, 1014, 1014, 1015, 1016, 1021, 1021, 1021,
1602 1021, 1022, 1022, 1025, 1029, 1035, 1036, 1037, 1038, 1039,
1603 1043, 1044, 1045, 1049, 1050, 1051, 1055, 1056, 1057, 1058,
1604 1059, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1076,
1605 1077, 1080, 1081, 1086, 1087, 1088, 1093, 1094, 1100, 1101,
1606 1109, 1117, 1118, 1123, 1124, 1125, 1130, 1143, 1143, 1143,
1607 1143, 1143, 1143, 1143, 1143, 1146, 1150, 1154, 1161, 1166,
1608 1174, 1192, 1210, 1215, 1227, 1237, 1241, 1251, 1258, 1265,
1609 1273, 1279, 1284, 1291, 1292, 1299, 1306, 1314, 1319, 1330,
1610 1358, 1374, 1403, 1431, 1452, 1467, 1479, 1486, 1549, 1558,
1611 1568, 1574, 1580, 1584, 1588, 1596, 1610, 1631, 1639, 1645,
1612 1656, 1661, 1666, 1675, 1681, 1687, 1696, 1700, 1708, 1708,
1613 1719, 1724, 1732, 1733, 1737, 1737, 1741, 1741, 1744, 1747,
1614 1759, 1783, 1794, 1794, 1803, 1803, 1811, 1811, 1821, 1824,
1615 1830, 1843, 1844, 1846, 1850, 1859, 1863, 1868, 1870, 1875,
1616 1880, 1889, 1889, 1890, 1890, 1892, 1902, 1913, 1917, 1926,
1617 1935, 1940, 2038, 2038, 2040, 2048, 2048, 2050, 2055, 2066,
1618 2070, 2075, 2079, 2083, 2087, 2091, 2095, 2099, 2103, 2107,
1619 2132, 2136, 2150, 2154, 2160, 2160, 2166, 2175, 2179, 2188,
1620 2199, 2208, 2220, 2233, 2237, 2241, 2246, 2255, 2274, 2283,
1621 2350, 2354, 2361, 2372, 2385, 2394, 2405, 2415, 2423, 2431,
1622 2434, 2435, 2441, 2445, 2450, 2471, 2488, 2501, 2514, 2527,
1623 2536, 2549, 2557, 2564, 2570, 2576, 2582, 2597, 2659, 2664,
1624 2668, 2675, 2682, 2690, 2697, 2705, 2713, 2727, 2744
1628 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1629 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1630 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1631 static const char *const yytname[] =
1633 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1634 "UINTVAL", "FPVAL", "VOID", "BOOL", "INT8", "INT16", "INT32", "INT64",
1635 "FLOAT", "DOUBLE", "LABEL", "TYPE", "VAR_ID", "LABELSTR",
1636 "STRINGCONSTANT", "IMPLEMENTATION", "ZEROINITIALIZER", "TRUETOK",
1637 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1638 "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK",
1639 "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT",
1640 "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "NOT", "EXTERNAL", "TARGET",
1641 "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS",
1642 "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1643 "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1644 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1645 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1646 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "ICMP", "FCMP", "EQ", "NE",
1647 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1648 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1649 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1650 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1651 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR",
1652 "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1653 "'='", "','", "'@'", "'('", "')'", "'*'", "'\\\\'", "'['", "'x'", "']'",
1654 "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "INTVAL", "ArithmeticOps",
1655 "LogicalOps", "CastOps", "ShiftOps", "IPredicates", "FPredicates",
1656 "IntType", "FPType", "OptAssign", "GVInternalLinkage",
1657 "GVExternalLinkage", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1658 "OptCallingConv", "ParamAttr", "ParamAttrList", "OptParamAttrs",
1659 "OptAlign", "OptCAlign", "SectionString", "OptSection",
1660 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1661 "ArgType", "ResultType", "ArgTypeList", "ArgTypeListI", "TypeListI",
1662 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1663 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1664 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1665 "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1666 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1667 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1668 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1669 "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList",
1670 "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0
1675 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1677 static const unsigned short int yytoknum[] =
1679 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1680 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1681 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1682 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1683 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1684 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1685 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1686 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1687 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1688 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1689 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1690 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1691 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1692 385, 386, 387, 388, 389, 61, 44, 64, 40, 41,
1693 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
1697 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1698 static const unsigned char yyr1[] =
1700 0, 150, 151, 151, 152, 152, 152, 152, 152, 152,
1701 152, 152, 152, 153, 153, 153, 154, 154, 154, 154,
1702 154, 154, 154, 154, 154, 154, 154, 154, 155, 155,
1703 155, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1704 156, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1705 157, 157, 157, 157, 157, 157, 157, 158, 158, 158,
1706 158, 159, 159, 160, 160, 161, 161, 161, 161, 161,
1707 162, 162, 162, 163, 163, 163, 164, 164, 164, 164,
1708 164, 165, 165, 165, 165, 165, 165, 165, 165, 166,
1709 166, 167, 167, 168, 168, 168, 169, 169, 170, 170,
1710 171, 172, 172, 173, 173, 174, 174, 175, 175, 175,
1711 175, 175, 175, 175, 175, 176, 176, 176, 176, 176,
1712 176, 176, 176, 176, 176, 176, 176, 176, 177, 178,
1713 178, 179, 179, 180, 180, 180, 180, 181, 181, 182,
1714 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
1715 182, 182, 182, 182, 182, 183, 183, 183, 183, 183,
1716 183, 183, 183, 183, 183, 183, 184, 184, 185, 185,
1717 186, 186, 187, 187, 189, 188, 190, 188, 188, 188,
1718 188, 188, 191, 188, 192, 188, 193, 188, 188, 188,
1719 194, 195, 195, 196, 196, 196, 196, 197, 198, 198,
1720 198, 199, 199, 200, 200, 201, 201, 202, 202, 202,
1721 202, 203, 204, 204, 205, 206, 206, 207, 208, 209,
1722 209, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1723 210, 210, 211, 211, 212, 212, 213, 214, 214, 215,
1724 216, 216, 216, 217, 217, 217, 217, 217, 217, 217,
1725 217, 217, 218, 218, 219, 220, 220, 221, 221, 221,
1726 222, 222, 223, 223, 224, 224, 224, 224, 224, 224,
1727 224, 224, 224, 224, 224, 224, 224, 224, 224, 225,
1728 225, 226, 226, 226, 226, 226, 226, 226, 226
1731 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1732 static const unsigned char yyr2[] =
1734 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1735 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1736 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1737 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1738 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1739 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1740 1, 1, 1, 2, 0, 1, 1, 1, 1, 1,
1741 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1742 1, 0, 1, 1, 1, 1, 1, 1, 2, 1,
1743 1, 1, 3, 0, 2, 4, 0, 2, 0, 3,
1744 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
1745 1, 1, 1, 1, 1, 1, 1, 2, 1, 2,
1746 5, 5, 5, 5, 3, 2, 5, 4, 2, 2,
1747 2, 1, 3, 1, 3, 1, 0, 1, 3, 4,
1748 3, 3, 4, 4, 3, 2, 2, 2, 2, 2,
1749 2, 2, 2, 2, 2, 6, 5, 8, 6, 6,
1750 7, 7, 6, 6, 8, 8, 3, 1, 1, 1,
1751 1, 0, 1, 2, 0, 3, 0, 3, 3, 1,
1752 3, 3, 0, 5, 0, 6, 0, 6, 2, 3,
1753 1, 1, 1, 3, 3, 3, 3, 3, 3, 1,
1754 0, 1, 1, 1, 0, 5, 3, 1, 3, 1,
1755 0, 8, 1, 1, 3, 1, 1, 2, 2, 0,
1756 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1757 1, 5, 1, 1, 1, 1, 2, 2, 2, 3,
1758 2, 0, 1, 2, 2, 3, 9, 9, 8, 13,
1759 1, 1, 6, 5, 2, 6, 7, 3, 5, 0,
1760 0, 3, 2, 1, 5, 5, 6, 6, 2, 4,
1761 4, 6, 4, 4, 6, 6, 2, 7, 1, 1,
1762 0, 3, 6, 3, 6, 2, 4, 6, 4
1765 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1766 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1767 means the default is an error. */
1768 static const unsigned short int yydefact[] =
1770 64, 201, 202, 179, 176, 174, 0, 0, 0, 0,
1771 0, 64, 172, 0, 73, 76, 0, 0, 0, 0,
1772 188, 0, 0, 0, 168, 169, 65, 67, 66, 68,
1773 70, 69, 71, 72, 0, 0, 0, 1, 173, 63,
1774 74, 75, 81, 177, 77, 78, 79, 80, 81, 241,
1775 175, 241, 0, 0, 0, 0, 200, 189, 190, 178,
1776 2, 3, 181, 107, 108, 109, 110, 111, 112, 113,
1777 114, 115, 0, 0, 0, 0, 232, 116, 180, 233,
1778 118, 0, 0, 93, 107, 108, 109, 110, 111, 112,
1779 113, 0, 0, 93, 182, 0, 82, 83, 84, 85,
1780 86, 87, 0, 218, 0, 242, 238, 64, 215, 216,
1781 217, 237, 195, 192, 191, 193, 194, 196, 199, 0,
1782 0, 0, 119, 0, 0, 0, 125, 137, 0, 117,
1783 0, 184, 186, 152, 153, 150, 151, 154, 149, 145,
1784 146, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1785 13, 14, 15, 0, 0, 0, 16, 17, 18, 19,
1786 20, 21, 22, 23, 24, 25, 26, 27, 0, 28,
1787 29, 30, 0, 0, 0, 0, 0, 0, 0, 0,
1788 0, 0, 0, 148, 147, 103, 88, 93, 93, 0,
1789 212, 213, 214, 280, 240, 0, 197, 89, 90, 0,
1790 94, 136, 0, 0, 0, 0, 0, 124, 136, 103,
1791 103, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1792 40, 0, 55, 56, 51, 52, 53, 54, 41, 42,
1793 43, 44, 45, 46, 47, 48, 49, 50, 0, 0,
1794 0, 0, 0, 0, 140, 167, 0, 0, 144, 0,
1795 141, 0, 0, 0, 0, 0, 183, 130, 129, 0,
1796 279, 0, 263, 0, 0, 0, 0, 81, 250, 251,
1797 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1798 0, 0, 0, 0, 0, 0, 239, 81, 254, 0,
1799 278, 198, 91, 0, 135, 93, 131, 133, 0, 93,
1800 93, 127, 0, 138, 0, 185, 187, 0, 0, 260,
1801 0, 0, 0, 0, 0, 139, 142, 143, 0, 0,
1802 0, 0, 0, 0, 105, 103, 210, 93, 268, 262,
1803 244, 243, 0, 0, 60, 59, 58, 57, 0, 0,
1804 0, 0, 98, 98, 285, 93, 93, 276, 0, 0,
1805 0, 0, 0, 93, 93, 0, 0, 0, 0, 0,
1806 0, 95, 128, 0, 121, 122, 123, 126, 120, 0,
1807 0, 0, 0, 0, 0, 0, 166, 0, 0, 0,
1808 0, 100, 106, 104, 209, 93, 207, 0, 221, 222,
1809 223, 228, 224, 225, 226, 227, 219, 0, 230, 235,
1810 234, 236, 0, 245, 0, 0, 93, 93, 0, 281,
1811 0, 283, 260, 0, 0, 0, 0, 0, 0, 0,
1812 0, 0, 0, 0, 0, 93, 0, 92, 134, 132,
1813 0, 0, 0, 156, 0, 0, 0, 0, 0, 0,
1814 93, 0, 204, 0, 101, 220, 0, 0, 0, 0,
1815 0, 0, 0, 0, 0, 0, 288, 0, 0, 0,
1816 272, 273, 0, 0, 0, 0, 270, 269, 0, 286,
1817 0, 0, 0, 261, 0, 163, 0, 0, 158, 159,
1818 155, 162, 203, 206, 208, 93, 102, 96, 0, 229,
1819 0, 0, 259, 0, 0, 98, 99, 98, 0, 0,
1820 0, 0, 0, 264, 265, 259, 93, 160, 161, 0,
1821 0, 0, 204, 0, 211, 0, 0, 0, 93, 0,
1822 266, 267, 0, 282, 284, 0, 0, 271, 274, 275,
1823 0, 287, 157, 164, 165, 205, 97, 231, 0, 0,
1824 93, 0, 0, 255, 0, 277, 0, 248, 0, 0,
1825 257, 93, 0, 256, 246, 0, 247, 0, 93, 0,
1826 0, 0, 258, 0, 0, 0, 0, 253, 0, 0,
1830 /* YYDEFGOTO[NTERM-NUM]. */
1831 static const short int yydefgoto[] =
1833 -1, 76, 179, 180, 181, 182, 221, 238, 91, 92,
1834 9, 34, 35, 42, 48, 102, 200, 293, 130, 514,
1835 409, 324, 487, 256, 325, 77, 93, 296, 189, 297,
1836 298, 128, 245, 398, 246, 36, 10, 11, 12, 15,
1837 14, 185, 209, 210, 59, 115, 20, 57, 119, 79,
1838 483, 386, 387, 103, 192, 49, 110, 50, 43, 446,
1839 399, 80, 401, 328, 51, 106, 107, 286, 549, 194,
1840 347, 519, 371, 287, 288, 289, 290
1843 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1845 #define YYPACT_NINF -444
1846 static const short int yypact[] =
1848 76, -444, -444, -444, -444, -444, -14, -77, 12, 548,
1849 89, 91, -444, -40, 79, 116, -36, -29, -11, -3,
1850 -444, 14, 119, 949, -444, -444, -444, -444, -444, -444,
1851 -444, -444, -444, -444, 15, 15, 1230, -444, -444, -444,
1852 -444, -444, 131, -444, -444, -444, -444, -444, 131, 124,
1853 -444, -2, 130, -12, 173, 179, 188, -444, -444, -444,
1854 -444, -444, 25, -444, -444, -444, -444, -444, -444, -444,
1855 -444, -444, 212, 214, 4, 72, -444, -444, 44, -444,
1856 -444, 1230, 1271, 103, 152, 207, 225, 243, 260, 230,
1857 241, 262, 269, 575, -444, 263, -444, -444, -444, -444,
1858 -444, -444, 1288, -444, -16, -444, -444, 117, -444, -444,
1859 -444, -444, -444, -444, -444, -444, -444, -444, -444, -19,
1860 -84, 140, -444, 136, 139, 539, -444, 44, -99, -444,
1861 150, -444, 44, -444, -444, -444, -444, -444, -444, -444,
1862 -444, -444, -444, -444, -444, -444, -444, -444, -444, -444,
1863 -444, -444, -444, 77, 283, 151, -444, -444, -444, -444,
1864 -444, -444, -444, -444, -444, -444, -444, -444, 154, -444,
1865 -444, -444, 156, 157, 158, 806, 1230, 720, 270, 159,
1866 162, 166, 170, -444, -444, 155, -444, 103, 20, 117,
1867 -444, -444, -444, 1369, -444, 289, -444, -444, -444, 153,
1868 -444, 1123, 1271, 1271, 164, -98, 1271, -444, 1123, 155,
1869 155, -444, -444, -444, -444, -444, -444, -444, -444, -444,
1870 -444, 174, -444, -444, -444, -444, -444, -444, -444, -444,
1871 -444, -444, -444, -444, -444, -444, -444, -444, 175, 1230,
1872 1230, 1230, 1230, 1230, -444, -444, -15, -90, -444, -93,
1873 -444, 1230, 1230, 1230, 1230, -5, -444, 140, 150, 177,
1874 -444, 1271, -444, 256, 1329, 84, 176, 131, -444, -444,
1875 77, 283, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271,
1876 1271, 1271, 1271, 1271, 1271, 1271, -444, 131, -444, 160,
1877 -444, -444, -444, 5, -444, 20, -444, 178, 180, -4,
1878 -39, -444, 181, 44, 182, -444, -444, 1230, 1230, -444,
1879 184, 186, 187, 190, 1230, -444, -444, -444, 192, 193,
1880 291, 194, 311, 328, -444, 155, 1169, 756, -444, -444,
1881 25, -444, 899, 899, -444, -444, -444, -444, 899, 1288,
1882 1271, 1271, 67, 85, -444, 756, -27, 197, 201, 202,
1883 203, 205, 206, 756, 756, 310, 208, 1288, 1271, 1271,
1884 153, -444, 150, 1186, -444, -444, -444, -444, -444, 209,
1885 210, 73, 1230, 1230, 1230, 1230, -444, 1230, 1230, 1271,
1886 1230, -444, -444, -444, -444, 20, 211, 213, -444, -444,
1887 -444, -444, -444, -444, -444, -444, 290, 1230, -444, -444,
1888 -444, -444, 215, -444, 221, 899, 756, 756, 13, -444,
1889 17, -444, -444, 899, 216, 1271, 1271, 1271, 1271, 1271,
1890 223, 224, 1271, 1271, 899, 756, 226, -444, -444, -444,
1891 1230, 1230, 1271, -444, 231, 235, 234, 240, 236, 252,
1892 -66, 258, 10, 1213, 317, -444, 330, -71, 382, 386,
1893 266, 271, 272, 899, 401, 899, 278, 279, 899, 281,
1894 44, -444, 282, 288, 899, 899, 44, -444, 292, -444,
1895 1271, 280, 287, -444, 1230, -444, 1230, 1230, -444, -444,
1896 -444, -444, -444, -444, -444, 20, -444, 374, 293, -444,
1897 899, 899, 1271, 899, 899, 297, -444, 297, 899, 298,
1898 1271, 1271, 1271, -444, -444, 1271, 756, -444, -444, 296,
1899 301, 305, 10, 424, -444, 416, 309, 295, 756, 88,
1900 -444, -444, 395, -444, -444, 306, 899, -444, -444, -444,
1901 100, -444, -444, -444, -444, -444, -444, -444, 433, 3,
1902 103, 1271, 418, -444, 308, -444, 899, -444, 1031, 8,
1903 -444, 756, 437, -444, -444, 319, -444, 1031, 103, 899,
1904 440, 321, -444, 387, 899, 442, 444, -444, 899, 899,
1908 /* YYPGOTO[NTERM-NUM]. */
1909 static const short int yypgoto[] =
1911 -444, -444, 268, 277, 294, 299, 218, 191, -262, -444,
1912 356, -444, -444, -444, -444, -245, -196, -444, -60, -444,
1913 -336, 27, -444, -199, -444, -444, -23, 101, -306, -444,
1914 264, 348, -9, 383, -171, 239, -444, -444, 464, -444,
1915 -444, -444, -444, -444, -444, -444, -444, -444, -444, 1,
1916 -31, -444, -444, 438, -444, -444, -444, -444, -444, -444,
1917 -443, -52, 78, -217, -444, 439, -444, -444, -444, -444,
1918 -444, -10, 81, -444, -444, -444, -444
1921 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1922 positive, shift that token. If negative, reduce the rule which
1923 number is the opposite. If zero, do what YYDEFACT says.
1924 If YYTABLE_NINF, syntax error. */
1925 #define YYTABLE_NINF -172
1926 static const short int yytable[] =
1928 78, 13, 121, 292, 338, 247, 249, 411, 124, 190,
1929 305, 306, 13, 334, 335, 336, 337, 105, 334, 335,
1930 336, 337, 339, 121, 108, 453, 322, 94, 1, 455,
1931 2, 197, 198, 405, 16, 17, 18, 206, 206, 113,
1932 114, 184, 357, 314, 24, 25, 314, 331, 323, 207,
1933 302, 424, 127, 19, 199, 317, 316, 344, 21, 132,
1934 348, 349, 350, 351, 352, 314, 454, 355, 356, 22,
1935 454, 120, 131, 480, 129, 489, -171, 60, 61, 188,
1936 83, 63, 64, 65, 66, 67, 68, 69, 70, 37,
1937 1, -170, 2, 332, 1, 39, 2, 3, 120, 52,
1938 333, 129, 127, 4, 5, 555, 53, 366, 13, 1,
1939 120, 2, 3, 129, 561, 413, 71, 195, 4, 5,
1940 40, 314, 41, 6, 54, 196, 383, 257, 258, 315,
1941 7, 191, 55, 120, 8, 1, 129, 2, 6, 58,
1942 365, 360, 426, 105, 361, 7, 109, 547, 208, 8,
1943 112, 125, 556, 44, 45, 46, 56, 120, 47, 523,
1944 129, 524, 120, -93, 427, 211, 212, 213, 214, 215,
1945 216, 217, 218, 219, 220, 133, 134, 116, 295, 299,
1946 300, 120, -93, 303, 129, 295, 334, 335, 336, 337,
1947 259, 95, 96, 97, 98, 99, 100, 101, 459, 117,
1948 461, 462, 463, 408, 120, -93, 467, 129, 118, 432,
1949 -60, -60, 433, 72, 73, 473, 122, 74, 123, 75,
1950 126, 410, 120, -93, 541, 129, 447, 542, -59, -59,
1951 309, 310, 311, 312, 313, 362, 541, -61, 327, 545,
1952 120, 327, 318, 319, 320, 321, -58, -58, -62, 342,
1953 343, 327, 345, 346, 327, 327, 327, 327, 327, 353,
1954 354, 327, 327, -57, -57, 135, 136, 186, 197, 198,
1955 121, 358, 359, 81, 82, 400, 137, 548, 201, 202,
1956 400, 400, 203, 527, 528, 529, 400, 557, 208, 239,
1957 250, 255, 240, 400, 241, 242, 243, 251, 369, 370,
1958 252, 400, 400, 385, 253, 376, 222, 223, 254, 291,
1959 301, 329, 307, 308, 363, 326, 188, 406, 407, 364,
1960 372, 368, 373, 374, 379, 442, 375, 367, 377, 378,
1961 380, 381, 382, 414, 188, 425, 327, 415, 416, 417,
1962 295, 418, 419, 422, 423, 430, 431, 443, 322, 445,
1963 488, 448, 444, 400, 400, 400, 440, 449, 458, 464,
1964 465, 400, 470, 434, 435, 436, 437, 474, 438, 439,
1965 476, 441, 400, 400, 475, 478, 477, 224, 225, 226,
1966 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
1967 237, 479, 327, 460, 327, 327, 327, 481, 490, 466,
1968 327, 400, 491, 400, 492, 496, 400, 493, 494, 327,
1969 402, 403, 400, 400, 432, 498, 404, 500, 501, 507,
1970 485, 471, 472, 412, 502, 512, 508, 513, 536, 515,
1971 505, 420, 421, 522, 526, 532, 537, 539, 400, 400,
1972 533, 400, 400, 482, 534, 538, 400, 506, 454, 546,
1973 543, 552, 553, 559, 400, 560, 564, 565, 568, 566,
1974 569, 282, 341, 193, 429, 509, 400, 510, 511, 518,
1975 283, 486, 304, 205, 400, 38, 183, 327, 327, 327,
1976 550, 535, 518, 450, 451, 452, 104, 284, 340, 0,
1977 111, 457, 285, 456, 400, 530, 0, 0, 562, 400,
1978 0, 0, 468, 469, 0, 0, 0, 400, 0, 0,
1979 0, 0, 400, 482, 0, 0, 400, 400, 551, 0,
1980 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1981 0, 495, 0, 497, 0, 0, 499, 0, 0, 0,
1982 0, 0, 503, 504, 60, 61, 0, 83, 63, 64,
1983 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
1984 0, 0, 0, 0, 0, 23, 0, 0, 516, 517,
1985 0, 520, 521, 0, 0, 0, 525, 24, 25, 0,
1986 60, 61, 0, 71, 531, 26, 27, 28, 29, 30,
1987 31, 32, 0, 1, 33, 2, 540, 138, 0, 0,
1988 0, 0, 0, 0, 544, 0, 0, 0, 0, 0,
1989 139, 140, 0, 0, 0, 0, 0, 0, 0, 0,
1990 0, 0, 0, 0, 554, 0, 0, 0, 0, 558,
1991 0, 0, 0, 0, 0, 0, 0, 563, 0, 0,
1992 0, 0, 567, 0, 0, 0, 570, 571, 0, 141,
1993 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
1994 152, 153, 154, 0, 0, 0, 0, 0, 0, 0,
1995 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1996 72, 73, 0, 0, 74, 0, 75, 204, 155, 156,
1997 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
1998 167, 0, 168, 169, 170, 171, 0, 172, 173, 174,
1999 0, 0, 120, 0, 0, 129, 0, 175, 0, 0,
2000 176, 0, 177, 0, 178, 60, 61, 0, 83, 84,
2001 85, 86, 87, 88, 89, 90, 70, 0, 1, 0,
2002 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2003 0, 0, 0, 0, 0, 0, 0, 0, 0, 388,
2004 389, 60, 61, 390, 71, 0, 0, 0, 0, 0,
2005 0, 0, 0, 0, 1, 0, 2, 0, 391, 392,
2006 393, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2007 0, 394, 395, 0, 0, 0, 0, 0, 0, 0,
2008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2009 0, 60, 61, 396, 83, 84, 85, 86, 87, 88,
2010 89, 90, 70, 0, 1, 0, 2, 0, 0, 0,
2011 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2012 151, 152, 153, 154, 0, 0, 0, 0, 0, 0,
2013 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 0, 72, 73, 0, 0, 74, 0, 75, 248, 155,
2015 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2016 166, 167, 0, 168, 169, 170, 171, 0, 172, 173,
2017 174, 0, 0, 120, 0, 0, 129, 0, 0, 0,
2018 0, 397, 388, 389, 60, 61, 390, 0, 0, 0,
2019 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
2020 0, 391, 392, 393, 0, 0, 0, 0, 0, 0,
2021 0, 0, 0, 0, 394, 395, 0, 0, 0, 0,
2022 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
2023 244, 74, 0, 75, 60, 61, 396, 62, 63, 64,
2024 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2025 0, 0, 0, 141, 142, 143, 144, 145, 146, 147,
2026 148, 149, 150, 151, 152, 153, 154, 0, 0, 0,
2027 0, 0, 0, 71, 0, 0, 0, 0, 0, 0,
2028 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2029 0, 0, 155, 156, 157, 158, 159, 160, 161, 162,
2030 163, 164, 165, 166, 167, 0, 168, 169, 170, 171,
2031 0, 172, 173, 174, 388, 389, 0, 0, 390, 0,
2032 0, 0, 0, 0, 397, 0, 0, 0, 0, 0,
2033 0, 0, 0, 391, 392, 393, 0, 0, 0, 0,
2034 0, 0, 0, 0, 0, 0, 394, 395, 0, 0,
2035 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2036 0, 0, 0, 0, 0, 0, 0, 0, 396, 0,
2037 72, 73, 0, 0, 74, 0, 75, 0, 0, 0,
2038 0, 0, 0, 0, 0, 141, 142, 143, 144, 145,
2039 146, 147, 148, 149, 150, 151, 152, 153, 154, 0,
2040 0, 0, 0, 0, 0, 0, 0, 0, 60, 61,
2041 0, 83, 63, 64, 65, 66, 67, 68, 69, 70,
2042 0, 1, 0, 2, 155, 156, 157, 158, 159, 160,
2043 161, 162, 163, 164, 165, 166, 167, 294, 168, 169,
2044 170, 171, 0, 172, 173, 174, 0, 71, 0, 0,
2045 0, 0, 0, 0, 60, 61, 397, 83, 63, 64,
2046 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2047 0, 60, 61, 0, 83, 63, 64, 65, 66, 67,
2048 68, 69, 70, 384, 1, 0, 2, 0, 0, 0,
2049 0, 0, 0, 71, 0, 0, 0, 0, 60, 61,
2050 428, 83, 63, 64, 65, 66, 67, 68, 69, 70,
2051 71, 1, 0, 2, 0, 60, 61, 0, 83, 84,
2052 85, 86, 87, 88, 89, 90, 70, 484, 1, 0,
2053 2, 0, 0, 0, 0, 0, 0, 71, 0, 0,
2054 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
2055 75, 0, 0, 0, 71, 0, 60, 61, 0, 83,
2056 63, 64, 65, 66, 67, 68, 69, 70, 0, 1,
2057 0, 2, 0, 60, 61, 0, 187, 63, 64, 65,
2058 66, 67, 68, 69, 70, 0, 1, 0, 2, 0,
2059 72, 73, 0, 0, 74, 71, 75, 0, 0, 0,
2060 0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
2061 0, 74, 71, 75, 60, 61, 0, 330, 63, 64,
2062 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
2063 0, 0, 0, 0, 72, 73, 0, 0, 74, 0,
2064 75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2065 0, 72, 73, 71, 0, 74, 0, 75, 0, 0,
2066 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2067 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2068 0, 260, 0, 0, 0, 0, 0, 0, 0, 0,
2069 0, 0, 72, 73, 261, 0, 74, 0, 75, 0,
2070 0, 0, 0, 0, 262, 263, 0, 0, 0, 72,
2071 73, 0, 0, 74, 0, 75, 0, 264, 265, 266,
2072 267, 268, 269, 141, 142, 143, 144, 145, 146, 147,
2073 148, 149, 150, 151, 152, 270, 271, 0, 0, 0,
2074 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 72, 73, 0, 0, 74, 0, 75, 272, 273, 274,
2076 0, 0, 275, 156, 157, 158, 159, 160, 161, 162,
2077 163, 164, 165, 166, 167, 276, 277, 169, 170, 171,
2081 static const short int yycheck[] =
2083 23, 0, 62, 199, 266, 176, 177, 343, 4, 25,
2084 209, 210, 11, 10, 11, 12, 13, 19, 10, 11,
2085 12, 13, 267, 83, 26, 12, 31, 36, 18, 12,
2086 20, 115, 116, 339, 48, 49, 50, 136, 136, 51,
2087 52, 93, 287, 136, 29, 30, 136, 264, 53, 148,
2088 148, 357, 75, 67, 138, 148, 146, 274, 135, 82,
2089 277, 278, 279, 280, 281, 136, 53, 284, 285, 57,
2090 53, 137, 81, 139, 140, 146, 0, 5, 6, 102,
2091 8, 9, 10, 11, 12, 13, 14, 15, 16, 0,
2092 18, 0, 20, 9, 18, 135, 20, 21, 137, 135,
2093 16, 140, 125, 27, 28, 548, 135, 146, 107, 18,
2094 137, 20, 21, 140, 557, 142, 44, 136, 27, 28,
2095 41, 136, 43, 47, 135, 144, 325, 187, 188, 144,
2096 54, 147, 135, 137, 58, 18, 140, 20, 47, 20,
2097 144, 136, 359, 19, 139, 54, 148, 144, 138, 58,
2098 20, 147, 144, 37, 38, 39, 142, 137, 42, 495,
2099 140, 497, 137, 138, 360, 88, 89, 90, 91, 92,
2100 93, 94, 95, 96, 97, 23, 24, 4, 201, 202,
2101 203, 137, 138, 206, 140, 208, 10, 11, 12, 13,
2102 189, 60, 61, 62, 63, 64, 65, 66, 415, 20,
2103 417, 418, 419, 136, 137, 138, 423, 140, 20, 136,
2104 3, 4, 139, 141, 142, 432, 4, 145, 4, 147,
2105 148, 136, 137, 138, 136, 140, 397, 139, 3, 4,
2106 239, 240, 241, 242, 243, 295, 136, 7, 261, 139,
2107 137, 264, 251, 252, 253, 254, 3, 4, 7, 272,
2108 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
2109 283, 284, 285, 3, 4, 3, 4, 4, 115, 116,
2110 330, 111, 112, 34, 35, 327, 7, 539, 138, 143,
2111 332, 333, 143, 500, 501, 502, 338, 549, 138, 138,
2112 20, 136, 138, 345, 138, 138, 138, 138, 307, 308,
2113 138, 353, 354, 326, 138, 314, 23, 24, 138, 20,
2114 146, 55, 138, 138, 136, 138, 339, 340, 341, 139,
2115 136, 139, 136, 136, 33, 385, 136, 146, 136, 136,
2116 136, 20, 4, 136, 357, 358, 359, 136, 136, 136,
2117 363, 136, 136, 33, 136, 136, 136, 136, 31, 59,
2118 20, 136, 139, 405, 406, 407, 379, 136, 142, 136,
2119 136, 413, 136, 372, 373, 374, 375, 136, 377, 378,
2120 136, 380, 424, 425, 139, 139, 136, 94, 95, 96,
2121 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2122 107, 139, 415, 416, 417, 418, 419, 139, 16, 422,
2123 423, 453, 16, 455, 138, 4, 458, 136, 136, 432,
2124 332, 333, 464, 465, 136, 136, 338, 136, 136, 139,
2125 443, 430, 431, 345, 136, 485, 139, 53, 4, 136,
2126 138, 353, 354, 136, 136, 139, 20, 142, 490, 491,
2127 139, 493, 494, 442, 139, 136, 498, 470, 53, 16,
2128 144, 33, 144, 16, 506, 136, 16, 136, 16, 72,
2129 16, 193, 271, 107, 363, 474, 518, 476, 477, 492,
2130 193, 444, 208, 125, 526, 11, 93, 500, 501, 502,
2131 540, 512, 505, 405, 406, 407, 48, 193, 270, -1,
2132 51, 413, 193, 412, 546, 505, -1, -1, 558, 551,
2133 -1, -1, 424, 425, -1, -1, -1, 559, -1, -1,
2134 -1, -1, 564, 512, -1, -1, 568, 569, 541, -1,
2135 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2136 -1, 453, -1, 455, -1, -1, 458, -1, -1, -1,
2137 -1, -1, 464, 465, 5, 6, -1, 8, 9, 10,
2138 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2139 -1, -1, -1, -1, -1, 17, -1, -1, 490, 491,
2140 -1, 493, 494, -1, -1, -1, 498, 29, 30, -1,
2141 5, 6, -1, 44, 506, 37, 38, 39, 40, 41,
2142 42, 43, -1, 18, 46, 20, 518, 22, -1, -1,
2143 -1, -1, -1, -1, 526, -1, -1, -1, -1, -1,
2144 35, 36, -1, -1, -1, -1, -1, -1, -1, -1,
2145 -1, -1, -1, -1, 546, -1, -1, -1, -1, 551,
2146 -1, -1, -1, -1, -1, -1, -1, 559, -1, -1,
2147 -1, -1, 564, -1, -1, -1, 568, 569, -1, 74,
2148 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2149 85, 86, 87, -1, -1, -1, -1, -1, -1, -1,
2150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2151 141, 142, -1, -1, 145, -1, 147, 148, 113, 114,
2152 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2153 125, -1, 127, 128, 129, 130, -1, 132, 133, 134,
2154 -1, -1, 137, -1, -1, 140, -1, 142, -1, -1,
2155 145, -1, 147, -1, 149, 5, 6, -1, 8, 9,
2156 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2157 20, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2158 -1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
2159 4, 5, 6, 7, 44, -1, -1, -1, -1, -1,
2160 -1, -1, -1, -1, 18, -1, 20, -1, 22, 23,
2161 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2162 -1, 35, 36, -1, -1, -1, -1, -1, -1, -1,
2163 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2164 -1, 5, 6, 57, 8, 9, 10, 11, 12, 13,
2165 14, 15, 16, -1, 18, -1, 20, -1, -1, -1,
2166 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2167 84, 85, 86, 87, -1, -1, -1, -1, -1, -1,
2168 44, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2169 -1, 141, 142, -1, -1, 145, -1, 147, 148, 113,
2170 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
2171 124, 125, -1, 127, 128, 129, 130, -1, 132, 133,
2172 134, -1, -1, 137, -1, -1, 140, -1, -1, -1,
2173 -1, 145, 3, 4, 5, 6, 7, -1, -1, -1,
2174 -1, -1, -1, -1, -1, -1, -1, 18, -1, 20,
2175 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2176 -1, -1, -1, -1, 35, 36, -1, -1, -1, -1,
2177 -1, -1, -1, -1, -1, -1, -1, 141, 142, -1,
2178 144, 145, -1, 147, 5, 6, 57, 8, 9, 10,
2179 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2180 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
2181 81, 82, 83, 84, 85, 86, 87, -1, -1, -1,
2182 -1, -1, -1, 44, -1, -1, -1, -1, -1, -1,
2183 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2184 -1, -1, 113, 114, 115, 116, 117, 118, 119, 120,
2185 121, 122, 123, 124, 125, -1, 127, 128, 129, 130,
2186 -1, 132, 133, 134, 3, 4, -1, -1, 7, -1,
2187 -1, -1, -1, -1, 145, -1, -1, -1, -1, -1,
2188 -1, -1, -1, 22, 23, 24, -1, -1, -1, -1,
2189 -1, -1, -1, -1, -1, -1, 35, 36, -1, -1,
2190 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2191 -1, -1, -1, -1, -1, -1, -1, -1, 57, -1,
2192 141, 142, -1, -1, 145, -1, 147, -1, -1, -1,
2193 -1, -1, -1, -1, -1, 74, 75, 76, 77, 78,
2194 79, 80, 81, 82, 83, 84, 85, 86, 87, -1,
2195 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2196 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2197 -1, 18, -1, 20, 113, 114, 115, 116, 117, 118,
2198 119, 120, 121, 122, 123, 124, 125, 34, 127, 128,
2199 129, 130, -1, 132, 133, 134, -1, 44, -1, -1,
2200 -1, -1, -1, -1, 5, 6, 145, 8, 9, 10,
2201 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2202 -1, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2203 14, 15, 16, 34, 18, -1, 20, -1, -1, -1,
2204 -1, -1, -1, 44, -1, -1, -1, -1, 5, 6,
2205 34, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2206 44, 18, -1, 20, -1, 5, 6, -1, 8, 9,
2207 10, 11, 12, 13, 14, 15, 16, 34, 18, -1,
2208 20, -1, -1, -1, -1, -1, -1, 44, -1, -1,
2209 -1, -1, -1, -1, 141, 142, -1, -1, 145, -1,
2210 147, -1, -1, -1, 44, -1, 5, 6, -1, 8,
2211 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
2212 -1, 20, -1, 5, 6, -1, 8, 9, 10, 11,
2213 12, 13, 14, 15, 16, -1, 18, -1, 20, -1,
2214 141, 142, -1, -1, 145, 44, 147, -1, -1, -1,
2215 -1, -1, -1, -1, -1, -1, -1, 141, 142, -1,
2216 -1, 145, 44, 147, 5, 6, -1, 8, 9, 10,
2217 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
2218 -1, -1, -1, -1, 141, 142, -1, -1, 145, -1,
2219 147, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2220 -1, 141, 142, 44, -1, 145, -1, 147, -1, -1,
2221 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2222 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2223 -1, 32, -1, -1, -1, -1, -1, -1, -1, -1,
2224 -1, -1, 141, 142, 45, -1, 145, -1, 147, -1,
2225 -1, -1, -1, -1, 55, 56, -1, -1, -1, 141,
2226 142, -1, -1, 145, -1, 147, -1, 68, 69, 70,
2227 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2228 81, 82, 83, 84, 85, 86, 87, -1, -1, -1,
2229 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2230 141, 142, -1, -1, 145, -1, 147, 108, 109, 110,
2231 -1, -1, 113, 114, 115, 116, 117, 118, 119, 120,
2232 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2236 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2237 symbol of state STATE-NUM. */
2238 static const unsigned char yystos[] =
2240 0, 18, 20, 21, 27, 28, 47, 54, 58, 160,
2241 186, 187, 188, 199, 190, 189, 48, 49, 50, 67,
2242 196, 135, 57, 17, 29, 30, 37, 38, 39, 40,
2243 41, 42, 43, 46, 161, 162, 185, 0, 188, 135,
2244 41, 43, 163, 208, 37, 38, 39, 42, 164, 205,
2245 207, 214, 135, 135, 135, 135, 142, 197, 20, 194,
2246 5, 6, 8, 9, 10, 11, 12, 13, 14, 15,
2247 16, 44, 141, 142, 145, 147, 151, 175, 176, 199,
2248 211, 185, 185, 8, 9, 10, 11, 12, 13, 14,
2249 15, 158, 159, 176, 182, 60, 61, 62, 63, 64,
2250 65, 66, 165, 203, 203, 19, 215, 216, 26, 148,
2251 206, 215, 20, 51, 52, 195, 4, 20, 20, 198,
2252 137, 168, 4, 4, 4, 147, 148, 176, 181, 140,
2253 168, 182, 176, 23, 24, 3, 4, 7, 22, 35,
2254 36, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2255 83, 84, 85, 86, 87, 113, 114, 115, 116, 117,
2256 118, 119, 120, 121, 122, 123, 124, 125, 127, 128,
2257 129, 130, 132, 133, 134, 142, 145, 147, 149, 152,
2258 153, 154, 155, 183, 211, 191, 4, 8, 176, 178,
2259 25, 147, 204, 160, 219, 136, 144, 115, 116, 138,
2260 166, 138, 143, 143, 148, 181, 136, 148, 138, 192,
2261 193, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2262 97, 156, 23, 24, 94, 95, 96, 97, 98, 99,
2263 100, 101, 102, 103, 104, 105, 106, 107, 157, 138,
2264 138, 138, 138, 138, 144, 182, 184, 184, 148, 184,
2265 20, 138, 138, 138, 138, 136, 173, 168, 168, 199,
2266 32, 45, 55, 56, 68, 69, 70, 71, 72, 73,
2267 86, 87, 108, 109, 110, 113, 126, 127, 131, 132,
2268 133, 134, 152, 153, 154, 155, 217, 223, 224, 225,
2269 226, 20, 166, 167, 34, 176, 177, 179, 180, 176,
2270 176, 146, 148, 176, 180, 173, 173, 138, 138, 182,
2271 182, 182, 182, 182, 136, 144, 146, 148, 182, 182,
2272 182, 182, 31, 53, 171, 174, 138, 176, 213, 55,
2273 8, 213, 9, 16, 10, 11, 12, 13, 158, 165,
2274 156, 157, 176, 176, 213, 176, 176, 220, 213, 213,
2275 213, 213, 213, 176, 176, 213, 213, 165, 111, 112,
2276 136, 139, 168, 136, 139, 144, 146, 146, 139, 182,
2277 182, 222, 136, 136, 136, 136, 182, 136, 136, 33,
2278 136, 20, 4, 173, 34, 176, 201, 202, 3, 4,
2279 7, 22, 23, 24, 35, 36, 57, 145, 183, 210,
2280 211, 212, 212, 212, 212, 178, 176, 176, 136, 170,
2281 136, 170, 212, 142, 136, 136, 136, 136, 136, 136,
2282 212, 212, 33, 136, 178, 176, 213, 166, 34, 177,
2283 136, 136, 136, 139, 182, 182, 182, 182, 182, 182,
2284 176, 182, 168, 136, 139, 59, 209, 184, 136, 136,
2285 212, 212, 212, 12, 53, 12, 222, 212, 142, 213,
2286 176, 213, 213, 213, 136, 136, 176, 213, 212, 212,
2287 136, 182, 182, 213, 136, 139, 136, 136, 139, 139,
2288 139, 139, 199, 200, 34, 176, 171, 172, 20, 146,
2289 16, 16, 138, 136, 136, 212, 4, 212, 136, 212,
2290 136, 136, 136, 212, 212, 138, 176, 139, 139, 182,
2291 182, 182, 168, 53, 169, 136, 212, 212, 176, 221,
2292 212, 212, 136, 170, 170, 212, 136, 213, 213, 213,
2293 221, 212, 139, 139, 139, 200, 4, 20, 136, 142,
2294 212, 136, 139, 144, 212, 139, 16, 144, 158, 218,
2295 168, 176, 33, 144, 212, 210, 144, 158, 212, 16,
2296 136, 210, 168, 212, 16, 136, 72, 212, 16, 16,
2300 #define yyerrok (yyerrstatus = 0)
2301 #define yyclearin (yychar = YYEMPTY)
2302 #define YYEMPTY (-2)
2305 #define YYACCEPT goto yyacceptlab
2306 #define YYABORT goto yyabortlab
2307 #define YYERROR goto yyerrorlab
2310 /* Like YYERROR except do call yyerror. This remains here temporarily
2311 to ease the transition to the new meaning of YYERROR, for GCC.
2312 Once GCC version 2 has supplanted version 1, this can go. */
2314 #define YYFAIL goto yyerrlab
2316 #define YYRECOVERING() (!!yyerrstatus)
2318 #define YYBACKUP(Token, Value) \
2320 if (yychar == YYEMPTY && yylen == 1) \
2324 yytoken = YYTRANSLATE (yychar); \
2330 yyerror (YY_("syntax error: cannot back up")); \
2337 #define YYERRCODE 256
2340 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2341 If N is 0, then set CURRENT to the empty location which ends
2342 the previous symbol: RHS[0] (always defined). */
2344 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2345 #ifndef YYLLOC_DEFAULT
2346 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2350 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2351 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2352 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2353 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2357 (Current).first_line = (Current).last_line = \
2358 YYRHSLOC (Rhs, 0).last_line; \
2359 (Current).first_column = (Current).last_column = \
2360 YYRHSLOC (Rhs, 0).last_column; \
2366 /* YY_LOCATION_PRINT -- Print the location on the stream.
2367 This macro was not mandated originally: define only if we know
2368 we won't break user code: when these are the locations we know. */
2370 #ifndef YY_LOCATION_PRINT
2371 # if YYLTYPE_IS_TRIVIAL
2372 # define YY_LOCATION_PRINT(File, Loc) \
2373 fprintf (File, "%d.%d-%d.%d", \
2374 (Loc).first_line, (Loc).first_column, \
2375 (Loc).last_line, (Loc).last_column)
2377 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2382 /* YYLEX -- calling `yylex' with the right arguments. */
2385 # define YYLEX yylex (YYLEX_PARAM)
2387 # define YYLEX yylex ()
2390 /* Enable debugging if requested. */
2394 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2395 # define YYFPRINTF fprintf
2398 # define YYDPRINTF(Args) \
2404 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2408 YYFPRINTF (stderr, "%s ", Title); \
2409 yysymprint (stderr, \
2411 YYFPRINTF (stderr, "\n"); \
2415 /*------------------------------------------------------------------.
2416 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2418 `------------------------------------------------------------------*/
2420 #if defined (__STDC__) || defined (__cplusplus)
2422 yy_stack_print (short int *bottom, short int *top)
2425 yy_stack_print (bottom, top)
2430 YYFPRINTF (stderr, "Stack now");
2431 for (/* Nothing. */; bottom <= top; ++bottom)
2432 YYFPRINTF (stderr, " %d", *bottom);
2433 YYFPRINTF (stderr, "\n");
2436 # define YY_STACK_PRINT(Bottom, Top) \
2439 yy_stack_print ((Bottom), (Top)); \
2443 /*------------------------------------------------.
2444 | Report that the YYRULE is going to be reduced. |
2445 `------------------------------------------------*/
2447 #if defined (__STDC__) || defined (__cplusplus)
2449 yy_reduce_print (int yyrule)
2452 yy_reduce_print (yyrule)
2457 unsigned long int yylno = yyrline[yyrule];
2458 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2460 /* Print the symbols being reduced, and their result. */
2461 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2462 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2463 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2466 # define YY_REDUCE_PRINT(Rule) \
2469 yy_reduce_print (Rule); \
2472 /* Nonzero means print parse trace. It is left uninitialized so that
2473 multiple parsers can coexist. */
2475 #else /* !YYDEBUG */
2476 # define YYDPRINTF(Args)
2477 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2478 # define YY_STACK_PRINT(Bottom, Top)
2479 # define YY_REDUCE_PRINT(Rule)
2480 #endif /* !YYDEBUG */
2483 /* YYINITDEPTH -- initial size of the parser's stacks. */
2485 # define YYINITDEPTH 200
2488 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2489 if the built-in stack extension method is used).
2491 Do not make this value too large; the results are undefined if
2492 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2493 evaluated with infinite-precision integer arithmetic. */
2496 # define YYMAXDEPTH 10000
2504 # if defined (__GLIBC__) && defined (_STRING_H)
2505 # define yystrlen strlen
2507 /* Return the length of YYSTR. */
2509 # if defined (__STDC__) || defined (__cplusplus)
2510 yystrlen (const char *yystr)
2516 const char *yys = yystr;
2518 while (*yys++ != '\0')
2521 return yys - yystr - 1;
2527 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2528 # define yystpcpy stpcpy
2530 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2533 # if defined (__STDC__) || defined (__cplusplus)
2534 yystpcpy (char *yydest, const char *yysrc)
2536 yystpcpy (yydest, yysrc)
2542 const char *yys = yysrc;
2544 while ((*yyd++ = *yys++) != '\0')
2553 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2554 quotes and backslashes, so that it's suitable for yyerror. The
2555 heuristic is that double-quoting is unnecessary unless the string
2556 contains an apostrophe, a comma, or backslash (other than
2557 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2558 null, do not copy; instead, return the length of what the result
2561 yytnamerr (char *yyres, const char *yystr)
2566 char const *yyp = yystr;
2573 goto do_not_strip_quotes;
2577 goto do_not_strip_quotes;
2590 do_not_strip_quotes: ;
2594 return yystrlen (yystr);
2596 return yystpcpy (yyres, yystr) - yyres;
2600 #endif /* YYERROR_VERBOSE */
2605 /*--------------------------------.
2606 | Print this symbol on YYOUTPUT. |
2607 `--------------------------------*/
2609 #if defined (__STDC__) || defined (__cplusplus)
2611 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2614 yysymprint (yyoutput, yytype, yyvaluep)
2620 /* Pacify ``unused variable'' warnings. */
2623 if (yytype < YYNTOKENS)
2624 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2626 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2630 if (yytype < YYNTOKENS)
2631 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2638 YYFPRINTF (yyoutput, ")");
2641 #endif /* ! YYDEBUG */
2642 /*-----------------------------------------------.
2643 | Release the memory associated to this symbol. |
2644 `-----------------------------------------------*/
2646 #if defined (__STDC__) || defined (__cplusplus)
2648 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2651 yydestruct (yymsg, yytype, yyvaluep)
2657 /* Pacify ``unused variable'' warnings. */
2662 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2673 /* Prevent warnings from -Wmissing-prototypes. */
2675 #ifdef YYPARSE_PARAM
2676 # if defined (__STDC__) || defined (__cplusplus)
2677 int yyparse (void *YYPARSE_PARAM);
2681 #else /* ! YYPARSE_PARAM */
2682 #if defined (__STDC__) || defined (__cplusplus)
2687 #endif /* ! YYPARSE_PARAM */
2691 /* The look-ahead symbol. */
2694 /* The semantic value of the look-ahead symbol. */
2697 /* Number of syntax errors so far. */
2706 #ifdef YYPARSE_PARAM
2707 # if defined (__STDC__) || defined (__cplusplus)
2708 int yyparse (void *YYPARSE_PARAM)
2710 int yyparse (YYPARSE_PARAM)
2711 void *YYPARSE_PARAM;
2713 #else /* ! YYPARSE_PARAM */
2714 #if defined (__STDC__) || defined (__cplusplus)
2728 /* Number of tokens to shift before error messages enabled. */
2730 /* Look-ahead token as an internal (translated) token number. */
2733 /* Three stacks and their tools:
2734 `yyss': related to states,
2735 `yyvs': related to semantic values,
2736 `yyls': related to locations.
2738 Refer to the stacks thru separate pointers, to allow yyoverflow
2739 to reallocate them elsewhere. */
2741 /* The state stack. */
2742 short int yyssa[YYINITDEPTH];
2743 short int *yyss = yyssa;
2746 /* The semantic value stack. */
2747 YYSTYPE yyvsa[YYINITDEPTH];
2748 YYSTYPE *yyvs = yyvsa;
2753 #define YYPOPSTACK (yyvsp--, yyssp--)
2755 YYSIZE_T yystacksize = YYINITDEPTH;
2757 /* The variables used to return semantic value and location from the
2762 /* When reducing, the number of symbols on the RHS of the reduced
2766 YYDPRINTF ((stderr, "Starting parse\n"));
2771 yychar = YYEMPTY; /* Cause a token to be read. */
2773 /* Initialize stack pointers.
2774 Waste one element of value and location stack
2775 so that they stay on the same level as the state stack.
2776 The wasted elements are never initialized. */
2783 /*------------------------------------------------------------.
2784 | yynewstate -- Push a new state, which is found in yystate. |
2785 `------------------------------------------------------------*/
2787 /* In all cases, when you get here, the value and location stacks
2788 have just been pushed. so pushing a state here evens the stacks.
2795 if (yyss + yystacksize - 1 <= yyssp)
2797 /* Get the current used size of the three stacks, in elements. */
2798 YYSIZE_T yysize = yyssp - yyss + 1;
2802 /* Give user a chance to reallocate the stack. Use copies of
2803 these so that the &'s don't force the real ones into
2805 YYSTYPE *yyvs1 = yyvs;
2806 short int *yyss1 = yyss;
2809 /* Each stack pointer address is followed by the size of the
2810 data in use in that stack, in bytes. This used to be a
2811 conditional around just the two extra args, but that might
2812 be undefined if yyoverflow is a macro. */
2813 yyoverflow (YY_("memory exhausted"),
2814 &yyss1, yysize * sizeof (*yyssp),
2815 &yyvs1, yysize * sizeof (*yyvsp),
2822 #else /* no yyoverflow */
2823 # ifndef YYSTACK_RELOCATE
2824 goto yyexhaustedlab;
2826 /* Extend the stack our own way. */
2827 if (YYMAXDEPTH <= yystacksize)
2828 goto yyexhaustedlab;
2830 if (YYMAXDEPTH < yystacksize)
2831 yystacksize = YYMAXDEPTH;
2834 short int *yyss1 = yyss;
2835 union yyalloc *yyptr =
2836 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2838 goto yyexhaustedlab;
2839 YYSTACK_RELOCATE (yyss);
2840 YYSTACK_RELOCATE (yyvs);
2842 # undef YYSTACK_RELOCATE
2844 YYSTACK_FREE (yyss1);
2847 #endif /* no yyoverflow */
2849 yyssp = yyss + yysize - 1;
2850 yyvsp = yyvs + yysize - 1;
2853 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2854 (unsigned long int) yystacksize));
2856 if (yyss + yystacksize - 1 <= yyssp)
2860 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2869 /* Do appropriate processing given the current state. */
2870 /* Read a look-ahead token if we need one and don't already have one. */
2873 /* First try to decide what to do without reference to look-ahead token. */
2875 yyn = yypact[yystate];
2876 if (yyn == YYPACT_NINF)
2879 /* Not known => get a look-ahead token if don't already have one. */
2881 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2882 if (yychar == YYEMPTY)
2884 YYDPRINTF ((stderr, "Reading a token: "));
2888 if (yychar <= YYEOF)
2890 yychar = yytoken = YYEOF;
2891 YYDPRINTF ((stderr, "Now at end of input.\n"));
2895 yytoken = YYTRANSLATE (yychar);
2896 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2899 /* If the proper action on seeing token YYTOKEN is to reduce or to
2900 detect an error, take that action. */
2902 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2907 if (yyn == 0 || yyn == YYTABLE_NINF)
2916 /* Shift the look-ahead token. */
2917 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2919 /* Discard the token being shifted unless it is eof. */
2920 if (yychar != YYEOF)
2926 /* Count tokens shifted since error; after three, turn off error
2935 /*-----------------------------------------------------------.
2936 | yydefault -- do the default action for the current state. |
2937 `-----------------------------------------------------------*/
2939 yyn = yydefact[yystate];
2945 /*-----------------------------.
2946 | yyreduce -- Do a reduction. |
2947 `-----------------------------*/
2949 /* yyn is the number of a rule to reduce with. */
2952 /* If YYLEN is nonzero, implement the default value of the action:
2955 Otherwise, the following line sets YYVAL to garbage.
2956 This behavior is undocumented and Bison
2957 users should not rely upon it. Assigning to YYVAL
2958 unconditionally makes the parser a bit smaller, and it avoids a
2959 GCC warning that YYVAL may be used uninitialized. */
2960 yyval = yyvsp[1-yylen];
2963 YY_REDUCE_PRINT (yyn);
2967 #line 984 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2969 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
2970 GEN_ERROR("Value too large for type!");
2971 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
2977 #line 1000 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2978 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
2982 #line 1000 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2983 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
2987 #line 1001 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2988 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
2992 #line 1001 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2993 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
2997 #line 1002 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
2998 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3002 #line 1002 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3003 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3007 #line 1003 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3008 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3012 #line 1003 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3013 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3017 #line 1004 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3018 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3022 #line 1004 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3023 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3027 #line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3028 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3032 #line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3033 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3037 #line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3038 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3042 #line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3043 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3047 #line 1010 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3048 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3052 #line 1010 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3053 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3057 #line 1011 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3058 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3062 #line 1011 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3063 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3067 #line 1012 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3068 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3072 #line 1012 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3073 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3077 #line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3078 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3082 #line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3083 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3087 #line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3088 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3092 #line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3093 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3097 #line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3098 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3102 #line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3103 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3107 #line 1025 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3109 (yyval.StrVal) = (yyvsp[-1].StrVal);
3115 #line 1029 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3123 #line 1035 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3124 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3128 #line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3129 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3133 #line 1037 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3134 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3138 #line 1038 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3139 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3143 #line 1039 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3144 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3148 #line 1043 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3149 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3153 #line 1044 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3154 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3158 #line 1045 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3159 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3163 #line 1049 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3164 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3168 #line 1050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3169 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3173 #line 1051 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3174 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3178 #line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3179 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3183 #line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3184 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3188 #line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3189 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3193 #line 1058 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3194 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3198 #line 1059 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3199 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3203 #line 1062 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3204 { (yyval.UIntVal) = CallingConv::C; ;}
3208 #line 1063 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3209 { (yyval.UIntVal) = CallingConv::C; ;}
3213 #line 1064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3214 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3218 #line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3219 { (yyval.UIntVal) = CallingConv::Fast; ;}
3223 #line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3224 { (yyval.UIntVal) = CallingConv::Cold; ;}
3228 #line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3229 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3233 #line 1068 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3234 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3238 #line 1069 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3240 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3241 GEN_ERROR("Calling conv too large!");
3242 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3248 #line 1076 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3249 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3253 #line 1077 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3254 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3258 #line 1080 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3259 { (yyval.ParamAttrs) = (yyvsp[0].ParamAttrs); ;}
3263 #line 1081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3265 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-2].ParamAttrs) | (yyvsp[0].ParamAttrs));
3270 #line 1086 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3271 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3275 #line 1087 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3276 { (yyval.ParamAttrs) = (yyvsp[0].ParamAttrs); ;}
3280 #line 1088 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3281 { (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs); ;}
3285 #line 1093 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3286 { (yyval.UIntVal) = 0; ;}
3290 #line 1094 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3292 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3293 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3294 GEN_ERROR("Alignment must be a power of two!");
3300 #line 1100 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3301 { (yyval.UIntVal) = 0; ;}
3305 #line 1101 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3307 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3308 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3309 GEN_ERROR("Alignment must be a power of two!");
3315 #line 1109 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3317 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3318 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3319 GEN_ERROR("Invalid character in section name!");
3320 (yyval.StrVal) = (yyvsp[0].StrVal);
3326 #line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3327 { (yyval.StrVal) = 0; ;}
3331 #line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3332 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3336 #line 1123 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3341 #line 1124 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3346 #line 1125 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3348 CurGV->setSection((yyvsp[0].StrVal));
3349 free((yyvsp[0].StrVal));
3355 #line 1130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3357 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3358 GEN_ERROR("Alignment must be a power of two!");
3359 CurGV->setAlignment((yyvsp[0].UInt64Val));
3365 #line 1146 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3367 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3373 #line 1150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3375 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3381 #line 1154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3383 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3384 GEN_ERROR("Cannot form a pointer to a basic block");
3385 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3386 delete (yyvsp[-1].TypeVal);
3392 #line 1161 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3393 { // Named types are also simple types...
3394 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3396 (yyval.TypeVal) = new PATypeHolder(tmp);
3401 #line 1166 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3402 { // Type UpReference
3403 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3404 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3405 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3406 (yyval.TypeVal) = new PATypeHolder(OT);
3407 UR_OUT("New Upreference!\n");
3413 #line 1174 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3415 std::vector<const Type*> Params;
3416 std::vector<FunctionType::ParameterAttributes> Attrs;
3417 Attrs.push_back((yyvsp[-3].ParamAttrs));
3418 for (TypeWithAttrsList::iterator I=(yyvsp[-1].TypeWithAttrsList)->begin(), E=(yyvsp[-1].TypeWithAttrsList)->end(); I != E; ++I) {
3419 Params.push_back(I->Ty->get());
3420 if (I->Ty->get() != Type::VoidTy)
3421 Attrs.push_back(I->Attrs);
3423 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3424 if (isVarArg) Params.pop_back();
3426 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3427 delete (yyvsp[-1].TypeWithAttrsList); // Delete the argument list
3428 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3429 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3435 #line 1192 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3437 std::vector<const Type*> Params;
3438 std::vector<FunctionType::ParameterAttributes> Attrs;
3439 Attrs.push_back((yyvsp[-3].ParamAttrs));
3440 for (TypeWithAttrsList::iterator I=(yyvsp[-1].TypeWithAttrsList)->begin(), E=(yyvsp[-1].TypeWithAttrsList)->end(); I != E; ++I) {
3441 Params.push_back(I->Ty->get());
3442 if (I->Ty->get() != Type::VoidTy)
3443 Attrs.push_back(I->Attrs);
3445 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3446 if (isVarArg) Params.pop_back();
3448 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3449 delete (yyvsp[-1].TypeWithAttrsList); // Delete the argument list
3450 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3456 #line 1210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3457 { // Sized array type?
3458 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3459 delete (yyvsp[-1].TypeVal);
3465 #line 1215 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3466 { // Packed array type?
3467 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3468 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3469 GEN_ERROR("Unsigned result not equal to signed result");
3470 if (!ElemTy->isPrimitiveType())
3471 GEN_ERROR("Elemental type of a PackedType must be primitive");
3472 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3473 GEN_ERROR("Vector length should be a power of 2!");
3474 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3475 delete (yyvsp[-1].TypeVal);
3481 #line 1227 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3482 { // Structure type?
3483 std::vector<const Type*> Elements;
3484 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3485 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3486 Elements.push_back(*I);
3488 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3489 delete (yyvsp[-1].TypeList);
3495 #line 1237 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3496 { // Empty structure type?
3497 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3503 #line 1241 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3505 std::vector<const Type*> Elements;
3506 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3507 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3508 Elements.push_back(*I);
3510 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3511 delete (yyvsp[-2].TypeList);
3517 #line 1251 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3518 { // Empty structure type?
3519 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3525 #line 1258 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3527 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3528 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3533 #line 1265 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3535 if (!UpRefs.empty())
3536 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3537 if (!(*(yyvsp[-1].TypeVal))->isFirstClassType())
3538 GEN_ERROR("LLVM functions cannot return aggregate types!");
3539 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3540 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3545 #line 1273 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3547 (yyval.TypeWithAttrs).Ty = new PATypeHolder(Type::VoidTy);
3548 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3553 #line 1279 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3555 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3556 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3562 #line 1284 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3564 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3570 #line 1292 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3572 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3573 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3574 TWA.Ty = new PATypeHolder(Type::VoidTy);
3575 (yyval.TypeWithAttrsList)->push_back(TWA);
3581 #line 1299 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3583 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3584 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3585 TWA.Ty = new PATypeHolder(Type::VoidTy);
3586 (yyval.TypeWithAttrsList)->push_back(TWA);
3592 #line 1306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3594 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3600 #line 1314 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3602 (yyval.TypeList) = new std::list<PATypeHolder>();
3603 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3609 #line 1319 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3611 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3617 #line 1330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3618 { // Nonempty unsized arr
3619 if (!UpRefs.empty())
3620 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3621 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3623 GEN_ERROR("Cannot make array constant with type: '" +
3624 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3625 const Type *ETy = ATy->getElementType();
3626 int NumElements = ATy->getNumElements();
3628 // Verify that we have the correct size...
3629 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3630 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3631 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3632 itostr(NumElements) + "!");
3634 // Verify all elements are correct type!
3635 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3636 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3637 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3638 ETy->getDescription() +"' as required!\nIt is of type '"+
3639 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3642 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3643 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3649 #line 1358 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3651 if (!UpRefs.empty())
3652 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3653 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3655 GEN_ERROR("Cannot make array constant with type: '" +
3656 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3658 int NumElements = ATy->getNumElements();
3659 if (NumElements != -1 && NumElements != 0)
3660 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3661 " arguments, but has size of " + itostr(NumElements) +"!");
3662 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3663 delete (yyvsp[-2].TypeVal);
3669 #line 1374 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3671 if (!UpRefs.empty())
3672 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3673 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3675 GEN_ERROR("Cannot make array constant with type: '" +
3676 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3678 int NumElements = ATy->getNumElements();
3679 const Type *ETy = ATy->getElementType();
3680 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3681 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3682 GEN_ERROR("Can't build string constant of size " +
3683 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3684 " when array has size " + itostr(NumElements) + "!");
3685 std::vector<Constant*> Vals;
3686 if (ETy == Type::Int8Ty) {
3687 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3688 C != (unsigned char*)EndStr; ++C)
3689 Vals.push_back(ConstantInt::get(ETy, *C));
3691 free((yyvsp[0].StrVal));
3692 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3694 free((yyvsp[0].StrVal));
3695 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3696 delete (yyvsp[-2].TypeVal);
3702 #line 1403 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3703 { // Nonempty unsized arr
3704 if (!UpRefs.empty())
3705 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3706 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3708 GEN_ERROR("Cannot make packed constant with type: '" +
3709 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3710 const Type *ETy = PTy->getElementType();
3711 int NumElements = PTy->getNumElements();
3713 // Verify that we have the correct size...
3714 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3715 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3716 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3717 itostr(NumElements) + "!");
3719 // Verify all elements are correct type!
3720 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3721 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3722 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3723 ETy->getDescription() +"' as required!\nIt is of type '"+
3724 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3727 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3728 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3734 #line 1431 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3736 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3738 GEN_ERROR("Cannot make struct constant with type: '" +
3739 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3741 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3742 GEN_ERROR("Illegal number of initializers for structure type!");
3744 // Check to ensure that constants are compatible with the type initializer!
3745 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3746 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3747 GEN_ERROR("Expected type '" +
3748 STy->getElementType(i)->getDescription() +
3749 "' for element #" + utostr(i) +
3750 " of structure initializer!");
3752 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3753 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3759 #line 1452 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3761 if (!UpRefs.empty())
3762 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3763 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3765 GEN_ERROR("Cannot make struct constant with type: '" +
3766 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3768 if (STy->getNumContainedTypes() != 0)
3769 GEN_ERROR("Illegal number of initializers for structure type!");
3771 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3772 delete (yyvsp[-2].TypeVal);
3778 #line 1467 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3780 if (!UpRefs.empty())
3781 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3782 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3784 GEN_ERROR("Cannot make null pointer constant with type: '" +
3785 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3787 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3788 delete (yyvsp[-1].TypeVal);
3794 #line 1479 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3796 if (!UpRefs.empty())
3797 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3798 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3799 delete (yyvsp[-1].TypeVal);
3805 #line 1486 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3807 if (!UpRefs.empty())
3808 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3809 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3811 GEN_ERROR("Global const reference must be a pointer type!");
3813 // ConstExprs can exist in the body of a function, thus creating
3814 // GlobalValues whenever they refer to a variable. Because we are in
3815 // the context of a function, getValNonImprovising will search the functions
3816 // symbol table instead of the module symbol table for the global symbol,
3817 // which throws things all off. To get around this, we just tell
3818 // getValNonImprovising that we are at global scope here.
3820 Function *SavedCurFn = CurFun.CurrentFunction;
3821 CurFun.CurrentFunction = 0;
3823 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3826 CurFun.CurrentFunction = SavedCurFn;
3828 // If this is an initializer for a constant pointer, which is referencing a
3829 // (currently) undefined variable, create a stub now that shall be replaced
3830 // in the future with the right type of variable.
3833 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3834 const PointerType *PT = cast<PointerType>(Ty);
3836 // First check to see if the forward references value is already created!
3837 PerModuleInfo::GlobalRefsType::iterator I =
3838 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3840 if (I != CurModule.GlobalRefs.end()) {
3841 V = I->second; // Placeholder already exists, use it...
3842 (yyvsp[0].ValIDVal).destroy();
3845 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3847 // Create the forward referenced global.
3849 if (const FunctionType *FTy =
3850 dyn_cast<FunctionType>(PT->getElementType())) {
3851 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3852 CurModule.CurrentModule);
3854 GV = new GlobalVariable(PT->getElementType(), false,
3855 GlobalValue::ExternalLinkage, 0,
3856 Name, CurModule.CurrentModule);
3859 // Keep track of the fact that we have a forward ref to recycle it
3860 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3865 (yyval.ConstVal) = cast<GlobalValue>(V);
3866 delete (yyvsp[-1].TypeVal); // Free the type handle
3872 #line 1549 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3874 if (!UpRefs.empty())
3875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3876 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3877 GEN_ERROR("Mismatched types for constant expression!");
3878 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3879 delete (yyvsp[-1].TypeVal);
3885 #line 1558 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3887 if (!UpRefs.empty())
3888 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3889 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3890 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3891 GEN_ERROR("Cannot create a null initialized value of this type!");
3892 (yyval.ConstVal) = Constant::getNullValue(Ty);
3893 delete (yyvsp[-1].TypeVal);
3899 #line 1568 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3900 { // integral constants
3901 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3902 GEN_ERROR("Constant value doesn't fit in type!");
3903 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3909 #line 1574 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3910 { // integral constants
3911 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3912 GEN_ERROR("Constant value doesn't fit in type!");
3913 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3919 #line 1580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3920 { // Boolean constants
3921 (yyval.ConstVal) = ConstantBool::getTrue();
3927 #line 1584 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3928 { // Boolean constants
3929 (yyval.ConstVal) = ConstantBool::getFalse();
3935 #line 1588 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3936 { // Float & Double constants
3937 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3938 GEN_ERROR("Floating point constant invalid for type!!");
3939 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3945 #line 1596 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3947 if (!UpRefs.empty())
3948 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3949 Constant *Val = (yyvsp[-3].ConstVal);
3950 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3951 if (!Val->getType()->isFirstClassType())
3952 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3953 Val->getType()->getDescription() + "'!");
3954 if (!Ty->isFirstClassType())
3955 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3956 Ty->getDescription() + "'!");
3957 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3958 delete (yyvsp[-1].TypeVal);
3963 #line 1610 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3965 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3966 GEN_ERROR("GetElementPtr requires a pointer operand!");
3969 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3971 GEN_ERROR("Index list invalid for constant getelementptr!");
3973 std::vector<Constant*> IdxVec;
3974 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3975 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3976 IdxVec.push_back(C);
3978 GEN_ERROR("Indices to constant getelementptr must be constants!");
3980 delete (yyvsp[-1].ValueList);
3982 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3988 #line 1631 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3990 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3991 GEN_ERROR("Select condition must be of boolean type!");
3992 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3993 GEN_ERROR("Select operand types must match!");
3994 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4000 #line 1639 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4002 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4003 GEN_ERROR("Binary operator types must match!");
4005 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4010 #line 1645 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4012 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4013 GEN_ERROR("Logical operator types must match!");
4014 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4015 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4016 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4017 GEN_ERROR("Logical operator requires integral operands!");
4019 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4025 #line 1656 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4027 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4028 GEN_ERROR("icmp operand types must match!");
4029 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4034 #line 1661 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4036 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4037 GEN_ERROR("fcmp operand types must match!");
4038 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4043 #line 1666 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4045 if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty)
4046 GEN_ERROR("Shift count for shift constant must be i8 type!");
4047 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4048 GEN_ERROR("Shift constant expression requires integer operand!");
4050 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4056 #line 1675 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4058 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4059 GEN_ERROR("Invalid extractelement operands!");
4060 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4066 #line 1681 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4068 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4069 GEN_ERROR("Invalid insertelement operands!");
4070 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4076 #line 1687 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4078 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4079 GEN_ERROR("Invalid shufflevector operands!");
4080 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4086 #line 1696 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4088 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4094 #line 1700 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4096 (yyval.ConstVector) = new std::vector<Constant*>();
4097 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4103 #line 1708 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4104 { (yyval.BoolVal) = false; ;}
4108 #line 1708 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4109 { (yyval.BoolVal) = true; ;}
4113 #line 1719 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4115 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4116 CurModule.ModuleDone();
4122 #line 1724 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4124 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4125 CurModule.ModuleDone();
4131 #line 1737 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4132 { CurFun.isDeclare = false ;}
4136 #line 1737 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4138 CurFun.FunctionDone();
4144 #line 1741 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4145 { CurFun.isDeclare = true; ;}
4149 #line 1741 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4156 #line 1744 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4163 #line 1747 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4165 // Emit an error if there are any unresolved types left.
4166 if (!CurModule.LateResolveTypes.empty()) {
4167 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4168 if (DID.Type == ValID::NameVal) {
4169 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4171 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4179 #line 1759 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4181 if (!UpRefs.empty())
4182 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4183 // Eagerly resolve types. This is not an optimization, this is a
4184 // requirement that is due to the fact that we could have this:
4186 // %list = type { %list * }
4187 // %list = type { %list * } ; repeated type decl
4189 // If types are not resolved eagerly, then the two types will not be
4190 // determined to be the same type!
4192 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4194 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4196 // If this is a named type that is not a redefinition, add it to the slot
4198 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4201 delete (yyvsp[0].TypeVal);
4207 #line 1783 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4209 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4211 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4213 // If this is a named type that is not a redefinition, add it to the slot
4215 CurModule.Types.push_back((yyvsp[0].PrimType));
4222 #line 1794 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4223 { /* "Externally Visible" Linkage */
4224 if ((yyvsp[0].ConstVal) == 0)
4225 GEN_ERROR("Global value initializer is not a constant!");
4226 CurGV = ParseGlobalVariable((yyvsp[-2].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal),
4227 (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4233 #line 1800 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4240 #line 1803 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4242 if ((yyvsp[0].ConstVal) == 0)
4243 GEN_ERROR("Global value initializer is not a constant!");
4244 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4250 #line 1808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4257 #line 1811 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4259 if (!UpRefs.empty())
4260 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4261 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4263 delete (yyvsp[0].TypeVal);
4268 #line 1817 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4276 #line 1821 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4283 #line 1824 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4290 #line 1830 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4292 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4293 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4294 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4295 free((yyvsp[0].StrVal));
4297 if (AsmSoFar.empty())
4298 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4300 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4306 #line 1843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4307 { (yyval.Endianness) = Module::BigEndian; ;}
4311 #line 1844 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4312 { (yyval.Endianness) = Module::LittleEndian; ;}
4316 #line 1846 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4318 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4324 #line 1850 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4326 if ((yyvsp[0].UInt64Val) == 32)
4327 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4328 else if ((yyvsp[0].UInt64Val) == 64)
4329 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4331 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4337 #line 1859 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4339 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4340 free((yyvsp[0].StrVal));
4345 #line 1863 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4347 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4348 free((yyvsp[0].StrVal));
4353 #line 1870 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4355 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4356 free((yyvsp[0].StrVal));
4362 #line 1875 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4364 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4365 free((yyvsp[0].StrVal));
4371 #line 1880 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4378 #line 1890 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4379 { (yyval.StrVal) = 0; ;}
4383 #line 1892 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4385 if (!UpRefs.empty())
4386 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4387 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4388 GEN_ERROR("void typed arguments are invalid!");
4389 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4390 (yyval.ArgList) = (yyvsp[-4].ArgList);
4391 (yyvsp[-4].ArgList)->push_back(E);
4397 #line 1902 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4399 if (!UpRefs.empty())
4400 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4401 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4402 GEN_ERROR("void typed arguments are invalid!");
4403 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4404 (yyval.ArgList) = new ArgListType;
4405 (yyval.ArgList)->push_back(E);
4411 #line 1913 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4413 (yyval.ArgList) = (yyvsp[0].ArgList);
4419 #line 1917 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4421 (yyval.ArgList) = (yyvsp[-2].ArgList);
4422 struct ArgListEntry E;
4423 E.Ty = new PATypeHolder(Type::VoidTy);
4425 E.Attrs = FunctionType::NoAttributeSet;
4426 (yyval.ArgList)->push_back(E);
4432 #line 1926 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4434 (yyval.ArgList) = new ArgListType;
4435 struct ArgListEntry E;
4436 E.Ty = new PATypeHolder(Type::VoidTy);
4438 E.Attrs = FunctionType::NoAttributeSet;
4439 (yyval.ArgList)->push_back(E);
4445 #line 1935 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4447 (yyval.ArgList) = 0;
4453 #line 1941 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4455 UnEscapeLexed((yyvsp[-5].StrVal));
4456 std::string FunctionName((yyvsp[-5].StrVal));
4457 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4459 std::vector<const Type*> ParamTypeList;
4460 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
4461 ParamAttrs.push_back((yyvsp[-6].TypeWithAttrs).Attrs);
4462 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4463 for (ArgListType::iterator I = (yyvsp[-3].ArgList)->begin(); I != (yyvsp[-3].ArgList)->end(); ++I) {
4464 const Type* Ty = I->Ty->get();
4465 ParamTypeList.push_back(Ty);
4466 if (Ty != Type::VoidTy)
4467 ParamAttrs.push_back(I->Attrs);
4471 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4472 if (isVarArg) ParamTypeList.pop_back();
4474 FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeWithAttrs).Ty, ParamTypeList, isVarArg,
4476 const PointerType *PFT = PointerType::get(FT);
4477 delete (yyvsp[-6].TypeWithAttrs).Ty;
4480 if (!FunctionName.empty()) {
4481 ID = ValID::create((char*)FunctionName.c_str());
4483 ID = ValID::create((int)CurModule.Values[PFT].size());
4487 // See if this function was forward referenced. If so, recycle the object.
4488 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4489 // Move the function to the end of the list, from whereever it was
4490 // previously inserted.
4491 Fn = cast<Function>(FWRef);
4492 CurModule.CurrentModule->getFunctionList().remove(Fn);
4493 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4494 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4495 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4496 // If this is the case, either we need to be a forward decl, or it needs
4498 if (!CurFun.isDeclare && !Fn->isExternal())
4499 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4501 // Make sure to strip off any argument names so we can't get conflicts.
4502 if (Fn->isExternal())
4503 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4506 } else { // Not already defined?
4507 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4508 CurModule.CurrentModule);
4510 InsertValue(Fn, CurModule.Values);
4513 CurFun.FunctionStart(Fn);
4515 if (CurFun.isDeclare) {
4516 // If we have declaration, always overwrite linkage. This will allow us to
4517 // correctly handle cases, when pointer to function is passed as argument to
4518 // another function.
4519 Fn->setLinkage(CurFun.Linkage);
4521 Fn->setCallingConv((yyvsp[-7].UIntVal));
4522 Fn->setAlignment((yyvsp[0].UIntVal));
4523 if ((yyvsp[-1].StrVal)) {
4524 Fn->setSection((yyvsp[-1].StrVal));
4525 free((yyvsp[-1].StrVal));
4528 // Add all of the arguments we parsed to the function...
4529 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4530 if (isVarArg) { // Nuke the last entry
4531 assert((yyvsp[-3].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().Name == 0&&
4532 "Not a varargs marker!");
4533 delete (yyvsp[-3].ArgList)->back().Ty;
4534 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4536 Function::arg_iterator ArgIt = Fn->arg_begin();
4538 for (ArgListType::iterator I = (yyvsp[-3].ArgList)->begin(); I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4539 delete I->Ty; // Delete the typeholder...
4540 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4546 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4553 #line 2040 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4555 (yyval.FunctionVal) = CurFun.CurrentFunction;
4557 // Make sure that we keep track of the linkage type even if there was a
4558 // previous "declare".
4559 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4564 #line 2050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4566 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4572 #line 2055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4574 CurFun.CurrentFunction->setLinkage((yyvsp[-1].Linkage));
4575 (yyval.FunctionVal) = CurFun.CurrentFunction;
4576 CurFun.FunctionDone();
4582 #line 2066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4584 (yyval.BoolVal) = false;
4590 #line 2070 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4592 (yyval.BoolVal) = true;
4598 #line 2075 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4599 { // A reference to a direct constant
4600 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4606 #line 2079 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4608 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4614 #line 2083 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4615 { // Perhaps it's an FP constant?
4616 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4622 #line 2087 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4624 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4630 #line 2091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4632 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4638 #line 2095 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4640 (yyval.ValIDVal) = ValID::createNull();
4646 #line 2099 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4648 (yyval.ValIDVal) = ValID::createUndef();
4654 #line 2103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4655 { // A vector zero constant.
4656 (yyval.ValIDVal) = ValID::createZeroInit();
4662 #line 2107 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4663 { // Nonempty unsized packed vector
4664 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4665 int NumElements = (yyvsp[-1].ConstVector)->size();
4667 PackedType* pt = PackedType::get(ETy, NumElements);
4668 PATypeHolder* PTy = new PATypeHolder(
4676 // Verify all elements are correct type!
4677 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4678 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4679 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4680 ETy->getDescription() +"' as required!\nIt is of type '" +
4681 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4684 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4685 delete PTy; delete (yyvsp[-1].ConstVector);
4691 #line 2132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4693 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4699 #line 2136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4701 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4702 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4703 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4704 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4705 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4706 free((yyvsp[-2].StrVal));
4707 free((yyvsp[0].StrVal));
4713 #line 2150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4714 { // Is it an integer reference...?
4715 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4721 #line 2154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4722 { // Is it a named reference...?
4723 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4729 #line 2166 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4731 if (!UpRefs.empty())
4732 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4733 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4734 delete (yyvsp[-1].TypeVal);
4740 #line 2175 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4742 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4748 #line 2179 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4749 { // Do not allow functions with 0 basic blocks
4750 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4756 #line 2188 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4758 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4760 InsertValue((yyvsp[0].TermInstVal));
4762 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4763 InsertValue((yyvsp[-2].BasicBlockVal));
4764 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4770 #line 2199 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4772 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4773 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4774 if (CI2->getParent() == 0)
4775 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4776 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4777 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4783 #line 2208 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4785 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4788 // Make sure to move the basic block to the correct location in the
4789 // function, instead of leaving it inserted wherever it was first
4791 Function::BasicBlockListType &BBL =
4792 CurFun.CurrentFunction->getBasicBlockList();
4793 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4799 #line 2220 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4801 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4804 // Make sure to move the basic block to the correct location in the
4805 // function, instead of leaving it inserted wherever it was first
4807 Function::BasicBlockListType &BBL =
4808 CurFun.CurrentFunction->getBasicBlockList();
4809 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4815 #line 2233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4816 { // Return with a result...
4817 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4823 #line 2237 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4824 { // Return with no result...
4825 (yyval.TermInstVal) = new ReturnInst();
4831 #line 2241 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4832 { // Unconditional Branch...
4833 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4835 (yyval.TermInstVal) = new BranchInst(tmpBB);
4840 #line 2246 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4842 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4844 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4846 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4848 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4853 #line 2255 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4855 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4857 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4859 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4860 (yyval.TermInstVal) = S;
4862 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4863 E = (yyvsp[-1].JumpTable)->end();
4864 for (; I != E; ++I) {
4865 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4866 S->addCase(CI, I->second);
4868 GEN_ERROR("Switch case is constant, but not a simple integer!");
4870 delete (yyvsp[-1].JumpTable);
4876 #line 2274 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4878 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4880 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4882 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4883 (yyval.TermInstVal) = S;
4889 #line 2284 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4892 // Handle the short syntax
4893 const PointerType *PFTy = 0;
4894 const FunctionType *Ty = 0;
4895 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeWithAttrs).Ty->get())) ||
4896 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4897 // Pull out the types of all of the arguments...
4898 std::vector<const Type*> ParamTypes;
4899 FunctionType::ParamAttrsList ParamAttrs;
4900 ParamAttrs.push_back((yyvsp[-10].TypeWithAttrs).Attrs);
4901 for (ValueRefList::iterator I = (yyvsp[-7].ValueRefList)->begin(), E = (yyvsp[-7].ValueRefList)->end(); I != E; ++I) {
4902 const Type *Ty = I->Val->getType();
4903 if (Ty == Type::VoidTy)
4904 GEN_ERROR("Short call syntax cannot be used with varargs");
4905 ParamTypes.push_back(Ty);
4906 ParamAttrs.push_back(I->Attrs);
4909 Ty = FunctionType::get((yyvsp[-10].TypeWithAttrs).Ty->get(), ParamTypes, false, ParamAttrs);
4910 PFTy = PointerType::get(Ty);
4913 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4915 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4917 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4920 // Check the arguments
4922 if ((yyvsp[-7].ValueRefList)->empty()) { // Has no arguments?
4923 // Make sure no arguments is a good thing!
4924 if (Ty->getNumParams() != 0)
4925 GEN_ERROR("No arguments passed to a function that "
4926 "expects arguments!");
4927 } else { // Has arguments?
4928 // Loop through FunctionType's arguments and ensure they are specified
4930 FunctionType::param_iterator I = Ty->param_begin();
4931 FunctionType::param_iterator E = Ty->param_end();
4932 ValueRefList::iterator ArgI = (yyvsp[-7].ValueRefList)->begin(), ArgE = (yyvsp[-7].ValueRefList)->end();
4934 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4935 if (ArgI->Val->getType() != *I)
4936 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4937 (*I)->getDescription() + "'!");
4938 Args.push_back(ArgI->Val);
4941 if (Ty->isVarArg()) {
4943 for (; ArgI != ArgE; ++ArgI)
4944 Args.push_back(ArgI->Val); // push the remaining varargs
4945 } else if (I != E || ArgI != ArgE)
4946 GEN_ERROR("Invalid number of parameters detected!");
4949 // Create the InvokeInst
4950 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
4951 II->setCallingConv((yyvsp[-11].UIntVal));
4952 (yyval.TermInstVal) = II;
4953 delete (yyvsp[-7].ValueRefList);
4959 #line 2350 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4961 (yyval.TermInstVal) = new UnwindInst();
4967 #line 2354 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4969 (yyval.TermInstVal) = new UnreachableInst();
4975 #line 2361 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4977 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4978 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4981 GEN_ERROR("May only switch on a constant pool value!");
4983 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4985 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4990 #line 2372 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4992 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4993 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4997 GEN_ERROR("May only switch on a constant pool value!");
4999 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5001 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5006 #line 2385 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5008 // Is this definition named?? if so, assign the name...
5009 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5011 InsertValue((yyvsp[0].InstVal));
5012 (yyval.InstVal) = (yyvsp[0].InstVal);
5018 #line 2394 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5019 { // Used for PHI nodes
5020 if (!UpRefs.empty())
5021 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5022 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5023 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5025 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5027 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5028 delete (yyvsp[-5].TypeVal);
5033 #line 2405 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5035 (yyval.PHIList) = (yyvsp[-6].PHIList);
5036 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5038 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5040 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5045 #line 2415 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5047 if (!UpRefs.empty())
5048 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5049 // Used for call and invoke instructions
5050 (yyval.ValueRefList) = new ValueRefList();
5051 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5052 (yyval.ValueRefList)->push_back(E);
5057 #line 2423 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5059 if (!UpRefs.empty())
5060 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5061 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5062 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5063 (yyval.ValueRefList)->push_back(E);
5069 #line 2431 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5070 { (yyval.ValueRefList) = new ValueRefList(); ;}
5074 #line 2434 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5075 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5079 #line 2435 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5081 (yyval.ValueList) = (yyvsp[-2].ValueList);
5082 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5088 #line 2441 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5090 (yyval.BoolVal) = true;
5096 #line 2445 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5098 (yyval.BoolVal) = false;
5104 #line 2450 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5106 if (!UpRefs.empty())
5107 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5108 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5109 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5111 "Arithmetic operator requires integer, FP, or packed operands!");
5112 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5113 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5114 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5115 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5116 GEN_ERROR("U/S/FRem not supported on packed types!");
5117 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5119 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5121 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5122 if ((yyval.InstVal) == 0)
5123 GEN_ERROR("binary operator returned null!");
5124 delete (yyvsp[-3].TypeVal);
5129 #line 2471 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5131 if (!UpRefs.empty())
5132 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5133 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5134 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5135 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5136 GEN_ERROR("Logical operator requires integral operands!");
5138 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5140 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5142 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5143 if ((yyval.InstVal) == 0)
5144 GEN_ERROR("binary operator returned null!");
5145 delete (yyvsp[-3].TypeVal);
5150 #line 2488 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5152 if (!UpRefs.empty())
5153 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5154 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5155 GEN_ERROR("Packed types not supported by icmp instruction");
5156 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5158 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5160 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5161 if ((yyval.InstVal) == 0)
5162 GEN_ERROR("icmp operator returned null!");
5167 #line 2501 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5169 if (!UpRefs.empty())
5170 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5171 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5172 GEN_ERROR("Packed types not supported by fcmp instruction");
5173 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5175 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5177 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5178 if ((yyval.InstVal) == 0)
5179 GEN_ERROR("fcmp operator returned null!");
5184 #line 2514 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5186 cerr << "WARNING: Use of eliminated 'not' instruction:"
5187 << " Replacing with 'xor'.\n";
5189 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5191 GEN_ERROR("Expected integral type for not instruction!");
5193 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5194 if ((yyval.InstVal) == 0)
5195 GEN_ERROR("Could not create a xor instruction!");
5201 #line 2527 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5203 if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty)
5204 GEN_ERROR("Shift amount must be i8 type!");
5205 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5206 GEN_ERROR("Shift constant expression requires integer operand!");
5208 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5214 #line 2536 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5216 if (!UpRefs.empty())
5217 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5218 Value* Val = (yyvsp[-2].ValueVal);
5219 const Type* Ty = (yyvsp[0].TypeVal)->get();
5220 if (!Val->getType()->isFirstClassType())
5221 GEN_ERROR("cast from a non-primitive type: '" +
5222 Val->getType()->getDescription() + "'!");
5223 if (!Ty->isFirstClassType())
5224 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5225 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, (yyvsp[0].TypeVal)->get());
5226 delete (yyvsp[0].TypeVal);
5231 #line 2549 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5233 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5234 GEN_ERROR("select condition must be boolean!");
5235 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5236 GEN_ERROR("select value types should match!");
5237 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5243 #line 2557 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5245 if (!UpRefs.empty())
5246 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5247 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5248 delete (yyvsp[0].TypeVal);
5254 #line 2564 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5256 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5257 GEN_ERROR("Invalid extractelement operands!");
5258 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5264 #line 2570 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5266 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5267 GEN_ERROR("Invalid insertelement operands!");
5268 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5274 #line 2576 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5276 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5277 GEN_ERROR("Invalid shufflevector operands!");
5278 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5284 #line 2582 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5286 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5287 if (!Ty->isFirstClassType())
5288 GEN_ERROR("PHI node operands must be of first class type!");
5289 (yyval.InstVal) = new PHINode(Ty);
5290 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5291 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5292 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5293 GEN_ERROR("All elements of a PHI node must be of the same type!");
5294 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5295 (yyvsp[0].PHIList)->pop_front();
5297 delete (yyvsp[0].PHIList); // Free the list...
5303 #line 2597 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5306 // Handle the short syntax
5307 const PointerType *PFTy = 0;
5308 const FunctionType *Ty = 0;
5309 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeWithAttrs).Ty->get())) ||
5310 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5311 // Pull out the types of all of the arguments...
5312 std::vector<const Type*> ParamTypes;
5313 FunctionType::ParamAttrsList ParamAttrs;
5314 ParamAttrs.push_back((yyvsp[-4].TypeWithAttrs).Attrs);
5315 for (ValueRefList::iterator I = (yyvsp[-1].ValueRefList)->begin(), E = (yyvsp[-1].ValueRefList)->end(); I != E; ++I) {
5316 const Type *Ty = I->Val->getType();
5317 if (Ty == Type::VoidTy)
5318 GEN_ERROR("Short call syntax cannot be used with varargs");
5319 ParamTypes.push_back(Ty);
5320 ParamAttrs.push_back(I->Attrs);
5323 Ty = FunctionType::get((yyvsp[-4].TypeWithAttrs).Ty->get(), ParamTypes, false, ParamAttrs);
5324 PFTy = PointerType::get(Ty);
5327 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5330 // Check the arguments
5332 if ((yyvsp[-1].ValueRefList)->empty()) { // Has no arguments?
5333 // Make sure no arguments is a good thing!
5334 if (Ty->getNumParams() != 0)
5335 GEN_ERROR("No arguments passed to a function that "
5336 "expects arguments!");
5337 } else { // Has arguments?
5338 // Loop through FunctionType's arguments and ensure they are specified
5341 FunctionType::param_iterator I = Ty->param_begin();
5342 FunctionType::param_iterator E = Ty->param_end();
5343 ValueRefList::iterator ArgI = (yyvsp[-1].ValueRefList)->begin(), ArgE = (yyvsp[-1].ValueRefList)->end();
5345 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5346 if (ArgI->Val->getType() != *I)
5347 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5348 (*I)->getDescription() + "'!");
5349 Args.push_back(ArgI->Val);
5351 if (Ty->isVarArg()) {
5353 for (; ArgI != ArgE; ++ArgI)
5354 Args.push_back(ArgI->Val); // push the remaining varargs
5355 } else if (I != E || ArgI != ArgE)
5356 GEN_ERROR("Invalid number of parameters detected!");
5358 // Create the call node
5359 CallInst *CI = new CallInst(V, Args);
5360 CI->setTailCall((yyvsp[-6].BoolVal));
5361 CI->setCallingConv((yyvsp[-5].UIntVal));
5362 (yyval.InstVal) = CI;
5363 delete (yyvsp[-1].ValueRefList);
5369 #line 2659 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5371 (yyval.InstVal) = (yyvsp[0].InstVal);
5377 #line 2664 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5379 (yyval.BoolVal) = true;
5385 #line 2668 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5387 (yyval.BoolVal) = false;
5393 #line 2675 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5395 if (!UpRefs.empty())
5396 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5397 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5398 delete (yyvsp[-1].TypeVal);
5404 #line 2682 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5406 if (!UpRefs.empty())
5407 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5408 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5410 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5411 delete (yyvsp[-4].TypeVal);
5416 #line 2690 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5418 if (!UpRefs.empty())
5419 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5420 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5421 delete (yyvsp[-1].TypeVal);
5427 #line 2697 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5429 if (!UpRefs.empty())
5430 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5431 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5433 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5434 delete (yyvsp[-4].TypeVal);
5439 #line 2705 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5441 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5442 GEN_ERROR("Trying to free nonpointer type " +
5443 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5444 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5450 #line 2713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5452 if (!UpRefs.empty())
5453 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5454 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5455 GEN_ERROR("Can't load from nonpointer type: " +
5456 (*(yyvsp[-1].TypeVal))->getDescription());
5457 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5458 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5459 (*(yyvsp[-1].TypeVal))->getDescription());
5460 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5462 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5463 delete (yyvsp[-1].TypeVal);
5468 #line 2727 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5470 if (!UpRefs.empty())
5471 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5472 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5474 GEN_ERROR("Can't store to a nonpointer type: " +
5475 (*(yyvsp[-1].TypeVal))->getDescription());
5476 const Type *ElTy = PT->getElementType();
5477 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5478 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5479 "' into space of type '" + ElTy->getDescription() + "'!");
5481 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5483 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5484 delete (yyvsp[-1].TypeVal);
5489 #line 2744 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5491 if (!UpRefs.empty())
5492 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5493 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5494 GEN_ERROR("getelementptr insn requires pointer operand!");
5496 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5497 GEN_ERROR("Invalid getelementptr indices for type '" +
5498 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5499 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5501 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5502 delete (yyvsp[-2].TypeVal);
5503 delete (yyvsp[0].ValueList);
5511 /* Line 1126 of yacc.c. */
5512 #line 5513 "llvmAsmParser.tab.c"
5518 YY_STACK_PRINT (yyss, yyssp);
5523 /* Now `shift' the result of the reduction. Determine what state
5524 that goes to, based on the state we popped back to and the rule
5525 number reduced by. */
5529 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5530 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5531 yystate = yytable[yystate];
5533 yystate = yydefgoto[yyn - YYNTOKENS];
5538 /*------------------------------------.
5539 | yyerrlab -- here on detecting error |
5540 `------------------------------------*/
5542 /* If not already recovering from an error, report this error. */
5547 yyn = yypact[yystate];
5549 if (YYPACT_NINF < yyn && yyn < YYLAST)
5551 int yytype = YYTRANSLATE (yychar);
5552 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5553 YYSIZE_T yysize = yysize0;
5555 int yysize_overflow = 0;
5557 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5558 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5562 /* This is so xgettext sees the translatable formats that are
5563 constructed on the fly. */
5564 YY_("syntax error, unexpected %s");
5565 YY_("syntax error, unexpected %s, expecting %s");
5566 YY_("syntax error, unexpected %s, expecting %s or %s");
5567 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5568 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5572 static char const yyunexpected[] = "syntax error, unexpected %s";
5573 static char const yyexpecting[] = ", expecting %s";
5574 static char const yyor[] = " or %s";
5575 char yyformat[sizeof yyunexpected
5576 + sizeof yyexpecting - 1
5577 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5578 * (sizeof yyor - 1))];
5579 char const *yyprefix = yyexpecting;
5581 /* Start YYX at -YYN if negative to avoid negative indexes in
5583 int yyxbegin = yyn < 0 ? -yyn : 0;
5585 /* Stay within bounds of both yycheck and yytname. */
5586 int yychecklim = YYLAST - yyn;
5587 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5590 yyarg[0] = yytname[yytype];
5591 yyfmt = yystpcpy (yyformat, yyunexpected);
5593 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5594 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5596 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5600 yyformat[sizeof yyunexpected - 1] = '\0';
5603 yyarg[yycount++] = yytname[yyx];
5604 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5605 yysize_overflow |= yysize1 < yysize;
5607 yyfmt = yystpcpy (yyfmt, yyprefix);
5611 yyf = YY_(yyformat);
5612 yysize1 = yysize + yystrlen (yyf);
5613 yysize_overflow |= yysize1 < yysize;
5616 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5617 yymsg = (char *) YYSTACK_ALLOC (yysize);
5620 /* Avoid sprintf, as that infringes on the user's name space.
5621 Don't have undefined behavior even if the translation
5622 produced a string with the wrong number of "%s"s. */
5625 while ((*yyp = *yyf))
5627 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5629 yyp += yytnamerr (yyp, yyarg[yyi++]);
5639 YYSTACK_FREE (yymsg);
5643 yyerror (YY_("syntax error"));
5644 goto yyexhaustedlab;
5648 #endif /* YYERROR_VERBOSE */
5649 yyerror (YY_("syntax error"));
5654 if (yyerrstatus == 3)
5656 /* If just tried and failed to reuse look-ahead token after an
5657 error, discard it. */
5659 if (yychar <= YYEOF)
5661 /* Return failure if at end of input. */
5662 if (yychar == YYEOF)
5667 yydestruct ("Error: discarding", yytoken, &yylval);
5672 /* Else will try to reuse look-ahead token after shifting the error
5677 /*---------------------------------------------------.
5678 | yyerrorlab -- error raised explicitly by YYERROR. |
5679 `---------------------------------------------------*/
5682 /* Pacify compilers like GCC when the user code never invokes
5683 YYERROR and the label yyerrorlab therefore never appears in user
5694 /*-------------------------------------------------------------.
5695 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5696 `-------------------------------------------------------------*/
5698 yyerrstatus = 3; /* Each real token shifted decrements this. */
5702 yyn = yypact[yystate];
5703 if (yyn != YYPACT_NINF)
5706 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5714 /* Pop the current state because it cannot handle the error token. */
5719 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5722 YY_STACK_PRINT (yyss, yyssp);
5731 /* Shift the error token. */
5732 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5738 /*-------------------------------------.
5739 | yyacceptlab -- YYACCEPT comes here. |
5740 `-------------------------------------*/
5745 /*-----------------------------------.
5746 | yyabortlab -- YYABORT comes here. |
5747 `-----------------------------------*/
5753 /*-------------------------------------------------.
5754 | yyexhaustedlab -- memory exhaustion comes here. |
5755 `-------------------------------------------------*/
5757 yyerror (YY_("memory exhausted"));
5763 if (yychar != YYEOF && yychar != YYEMPTY)
5764 yydestruct ("Cleanup: discarding lookahead",
5766 while (yyssp != yyss)
5768 yydestruct ("Cleanup: popping",
5769 yystos[*yyssp], yyvsp);
5774 YYSTACK_FREE (yyss);
5780 #line 2761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5783 // common code from the two 'RunVMAsmParser' functions
5784 static Module* RunParser(Module * M) {
5786 llvmAsmlineno = 1; // Reset the current line number...
5787 CurModule.CurrentModule = M;
5792 // Check to make sure the parser succeeded
5795 delete ParserResult;
5799 // Check to make sure that parsing produced a result
5803 // Reset ParserResult variable while saving its value for the result.
5804 Module *Result = ParserResult;
5810 void llvm::GenerateError(const std::string &message, int LineNo) {
5811 if (LineNo == -1) LineNo = llvmAsmlineno;
5812 // TODO: column number in exception
5814 TheParseError->setError(CurFilename, message, LineNo);
5818 int yyerror(const char *ErrorMsg) {
5820 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5821 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5822 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5823 if (yychar == YYEMPTY || yychar == 0)
5824 errMsg += "end-of-file.";
5826 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5827 GenerateError(errMsg);