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
90 ZEROINITIALIZER = 281,
162 EXTRACTELEMENT = 353,
170 #define ESINT64VAL 258
171 #define EUINT64VAL 259
191 #define STRINGCONSTANT 279
192 #define IMPLEMENTATION 280
193 #define ZEROINITIALIZER 281
204 #define DOTDOTDOT 292
211 #define APPENDING 299
218 #define POINTERSIZE 306
227 #define SIDEEFFECT 315
230 #define CSRETCC_TOK 318
231 #define FASTCC_TOK 319
232 #define COLDCC_TOK 320
238 #define UNREACHABLE 326
258 #define GETELEMENTPTR 346
265 #define EXTRACTELEMENT 353
266 #define INSERTELEMENT 354
267 #define SHUFFLEVECTOR 355
268 #define VAARG_old 356
269 #define VANEXT_old 357
274 /* Copy the first part of user declarations. */
275 #line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
277 #include "ParserInternals.h"
278 #include "llvm/CallingConv.h"
279 #include "llvm/InlineAsm.h"
280 #include "llvm/Instructions.h"
281 #include "llvm/Module.h"
282 #include "llvm/SymbolTable.h"
283 #include "llvm/Assembly/AutoUpgrade.h"
284 #include "llvm/Support/GetElementPtrTypeIterator.h"
285 #include "llvm/ADT/STLExtras.h"
286 #include "llvm/Support/MathExtras.h"
292 // The following is a gross hack. In order to rid the libAsmParser library of
293 // exceptions, we have to have a way of getting the yyparse function to go into
294 // an error situation. So, whenever we want an error to occur, the GenerateError
295 // function (see bottom of file) sets TriggerError. Then, at the end of each
296 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
297 // (a goto) to put YACC in error state. Furthermore, several calls to
298 // GenerateError are made from inside productions and they must simulate the
299 // previous exception behavior by exiting the production immediately. We have
300 // replaced these with the GEN_ERROR macro which calls GeneratError and then
301 // immediately invokes YYERROR. This would be so much cleaner if it was a
302 // recursive descent parser.
303 static bool TriggerError = false;
304 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYERROR; } }
305 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
307 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
308 int yylex(); // declaration" of xxx warnings.
312 std::string CurFilename;
314 using namespace llvm;
316 static Module *ParserResult;
318 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
319 // relating to upreferences in the input stream.
321 //#define DEBUG_UPREFS 1
323 #define UR_OUT(X) std::cerr << X
328 #define YYERROR_VERBOSE 1
330 static bool ObsoleteVarArgs;
331 static bool NewVarArgs;
332 static BasicBlock *CurBB;
333 static GlobalVariable *CurGV;
336 // This contains info used when building the body of a function. It is
337 // destroyed when the function is completed.
339 typedef std::vector<Value *> ValueList; // Numbered defs
341 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
342 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
344 static struct PerModuleInfo {
345 Module *CurrentModule;
346 std::map<const Type *, ValueList> Values; // Module level numbered definitions
347 std::map<const Type *,ValueList> LateResolveValues;
348 std::vector<PATypeHolder> Types;
349 std::map<ValID, PATypeHolder> LateResolveTypes;
351 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
352 /// how they were referenced and on which line of the input they came from so
353 /// that we can resolve them later and print error messages as appropriate.
354 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
356 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
357 // references to global values. Global values may be referenced before they
358 // are defined, and if so, the temporary object that they represent is held
359 // here. This is used for forward references of GlobalValues.
361 typedef std::map<std::pair<const PointerType *,
362 ValID>, GlobalValue*> GlobalRefsType;
363 GlobalRefsType GlobalRefs;
366 // If we could not resolve some functions at function compilation time
367 // (calls to functions before they are defined), resolve them now... Types
368 // are resolved when the constant pool has been completely parsed.
370 ResolveDefinitions(LateResolveValues);
372 // Check to make sure that all global value forward references have been
375 if (!GlobalRefs.empty()) {
376 std::string UndefinedReferences = "Unresolved global references exist:\n";
378 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
380 UndefinedReferences += " " + I->first.first->getDescription() + " " +
381 I->first.second.getName() + "\n";
383 GenerateError(UndefinedReferences);
386 // Look for intrinsic functions and CallInst that need to be upgraded
387 for (Module::iterator FI = CurrentModule->begin(),
388 FE = CurrentModule->end(); FI != FE; )
389 UpgradeCallsToIntrinsic(FI++);
391 Values.clear(); // Clear out function local definitions
396 // GetForwardRefForGlobal - Check to see if there is a forward reference
397 // for this global. If so, remove it from the GlobalRefs map and return it.
398 // If not, just return null.
399 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
400 // Check to see if there is a forward reference to this global variable...
401 // if there is, eliminate it and patch the reference to use the new def'n.
402 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
403 GlobalValue *Ret = 0;
404 if (I != GlobalRefs.end()) {
412 static struct PerFunctionInfo {
413 Function *CurrentFunction; // Pointer to current function being created
415 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
416 std::map<const Type*, ValueList> LateResolveValues;
417 bool isDeclare; // Is this function a forward declararation?
419 /// BBForwardRefs - When we see forward references to basic blocks, keep
420 /// track of them here.
421 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
422 std::vector<BasicBlock*> NumberedBlocks;
425 inline PerFunctionInfo() {
430 inline void FunctionStart(Function *M) {
435 void FunctionDone() {
436 NumberedBlocks.clear();
438 // Any forward referenced blocks left?
439 if (!BBForwardRefs.empty())
440 GenerateError("Undefined reference to label " +
441 BBForwardRefs.begin()->first->getName());
443 // Resolve all forward references now.
444 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
446 Values.clear(); // Clear out function local definitions
450 } CurFun; // Info for the current function...
452 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
455 //===----------------------------------------------------------------------===//
456 // Code to handle definitions of all the types
457 //===----------------------------------------------------------------------===//
459 static int InsertValue(Value *V,
460 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
461 if (V->hasName()) return -1; // Is this a numbered definition?
463 // Yes, insert the value into the value table...
464 ValueList &List = ValueTab[V->getType()];
466 return List.size()-1;
469 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
471 case ValID::NumberVal: // Is it a numbered definition?
472 // Module constants occupy the lowest numbered slots...
473 if ((unsigned)D.Num < CurModule.Types.size())
474 return CurModule.Types[(unsigned)D.Num];
476 case ValID::NameVal: // Is it a named definition?
477 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
478 D.destroy(); // Free old strdup'd memory...
483 GenerateError("Internal parser error: Invalid symbol type reference!");
486 // If we reached here, we referenced either a symbol that we don't know about
487 // or an id number that hasn't been read yet. We may be referencing something
488 // forward, so just create an entry to be resolved later and get to it...
490 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
493 if (inFunctionScope()) {
494 if (D.Type == ValID::NameVal)
495 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
497 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
500 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
501 if (I != CurModule.LateResolveTypes.end())
504 Type *Typ = OpaqueType::get();
505 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
509 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
510 SymbolTable &SymTab =
511 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
512 CurModule.CurrentModule->getSymbolTable();
513 return SymTab.lookup(Ty, Name);
516 // getValNonImprovising - Look up the value specified by the provided type and
517 // the provided ValID. If the value exists and has already been defined, return
518 // it. Otherwise return null.
520 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
521 if (isa<FunctionType>(Ty))
522 GenerateError("Functions are not values and "
523 "must be referenced as pointers");
526 case ValID::NumberVal: { // Is it a numbered definition?
527 unsigned Num = (unsigned)D.Num;
529 // Module constants occupy the lowest numbered slots...
530 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
531 if (VI != CurModule.Values.end()) {
532 if (Num < VI->second.size())
533 return VI->second[Num];
534 Num -= VI->second.size();
537 // Make sure that our type is within bounds
538 VI = CurFun.Values.find(Ty);
539 if (VI == CurFun.Values.end()) return 0;
541 // Check that the number is within bounds...
542 if (VI->second.size() <= Num) return 0;
544 return VI->second[Num];
547 case ValID::NameVal: { // Is it a named definition?
548 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
549 if (N == 0) return 0;
551 D.destroy(); // Free old strdup'd memory...
555 // Check to make sure that "Ty" is an integral type, and that our
556 // value will fit into the specified type...
557 case ValID::ConstSIntVal: // Is it a constant pool reference??
558 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64))
559 GenerateError("Signed integral constant '" +
560 itostr(D.ConstPool64) + "' is invalid for type '" +
561 Ty->getDescription() + "'!");
562 return ConstantSInt::get(Ty, D.ConstPool64);
564 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
565 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
566 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
567 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
568 "' is invalid or out of range!");
569 } else { // This is really a signed reference. Transmogrify.
570 return ConstantSInt::get(Ty, D.ConstPool64);
573 return ConstantUInt::get(Ty, D.UConstPool64);
576 case ValID::ConstFPVal: // Is it a floating point const pool reference?
577 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
578 GenerateError("FP constant invalid for type!!");
579 return ConstantFP::get(Ty, D.ConstPoolFP);
581 case ValID::ConstNullVal: // Is it a null value?
582 if (!isa<PointerType>(Ty))
583 GenerateError("Cannot create a a non pointer null!");
584 return ConstantPointerNull::get(cast<PointerType>(Ty));
586 case ValID::ConstUndefVal: // Is it an undef value?
587 return UndefValue::get(Ty);
589 case ValID::ConstZeroVal: // Is it a zero value?
590 return Constant::getNullValue(Ty);
592 case ValID::ConstantVal: // Fully resolved constant?
593 if (D.ConstantValue->getType() != Ty)
594 GenerateError("Constant expression type different from required type!");
595 return D.ConstantValue;
597 case ValID::InlineAsmVal: { // Inline asm expression
598 const PointerType *PTy = dyn_cast<PointerType>(Ty);
599 const FunctionType *FTy =
600 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
601 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints))
602 GenerateError("Invalid type for asm constraint string!");
603 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
604 D.IAD->HasSideEffects);
605 D.destroy(); // Free InlineAsmDescriptor.
609 assert(0 && "Unhandled case!");
613 assert(0 && "Unhandled case!");
617 // getVal - This function is identical to getValNonImprovising, except that if a
618 // value is not already defined, it "improvises" by creating a placeholder var
619 // that looks and acts just like the requested variable. When the value is
620 // defined later, all uses of the placeholder variable are replaced with the
623 static Value *getVal(const Type *Ty, const ValID &ID) {
624 if (Ty == Type::LabelTy)
625 GenerateError("Cannot use a basic block here");
627 // See if the value has already been defined.
628 Value *V = getValNonImprovising(Ty, ID);
631 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty))
632 GenerateError("Invalid use of a composite type!");
634 // If we reached here, we referenced either a symbol that we don't know about
635 // or an id number that hasn't been read yet. We may be referencing something
636 // forward, so just create an entry to be resolved later and get to it...
638 V = new Argument(Ty);
640 // Remember where this forward reference came from. FIXME, shouldn't we try
641 // to recycle these things??
642 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
645 if (inFunctionScope())
646 InsertValue(V, CurFun.LateResolveValues);
648 InsertValue(V, CurModule.LateResolveValues);
652 /// getBBVal - This is used for two purposes:
653 /// * If isDefinition is true, a new basic block with the specified ID is being
655 /// * If isDefinition is true, this is a reference to a basic block, which may
656 /// or may not be a forward reference.
658 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
659 assert(inFunctionScope() && "Can't get basic block at global scope!");
664 default: GenerateError("Illegal label reference " + ID.getName());
665 case ValID::NumberVal: // Is it a numbered definition?
666 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
667 CurFun.NumberedBlocks.resize(ID.Num+1);
668 BB = CurFun.NumberedBlocks[ID.Num];
670 case ValID::NameVal: // Is it a named definition?
672 if (Value *N = CurFun.CurrentFunction->
673 getSymbolTable().lookup(Type::LabelTy, Name))
674 BB = cast<BasicBlock>(N);
678 // See if the block has already been defined.
680 // If this is the definition of the block, make sure the existing value was
681 // just a forward reference. If it was a forward reference, there will be
682 // an entry for it in the PlaceHolderInfo map.
683 if (isDefinition && !CurFun.BBForwardRefs.erase(BB))
684 // The existing value was a definition, not a forward reference.
685 GenerateError("Redefinition of label " + ID.getName());
687 ID.destroy(); // Free strdup'd memory.
691 // Otherwise this block has not been seen before.
692 BB = new BasicBlock("", CurFun.CurrentFunction);
693 if (ID.Type == ValID::NameVal) {
694 BB->setName(ID.Name);
696 CurFun.NumberedBlocks[ID.Num] = BB;
699 // If this is not a definition, keep track of it so we can use it as a forward
702 // Remember where this forward reference came from.
703 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
705 // The forward declaration could have been inserted anywhere in the
706 // function: insert it into the correct place now.
707 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
708 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
715 //===----------------------------------------------------------------------===//
716 // Code to handle forward references in instructions
717 //===----------------------------------------------------------------------===//
719 // This code handles the late binding needed with statements that reference
720 // values not defined yet... for example, a forward branch, or the PHI node for
723 // This keeps a table (CurFun.LateResolveValues) of all such forward references
724 // and back patchs after we are done.
727 // ResolveDefinitions - If we could not resolve some defs at parsing
728 // time (forward branches, phi functions for loops, etc...) resolve the
732 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
733 std::map<const Type*,ValueList> *FutureLateResolvers) {
734 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
735 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
736 E = LateResolvers.end(); LRI != E; ++LRI) {
737 ValueList &List = LRI->second;
738 while (!List.empty()) {
739 Value *V = List.back();
742 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
743 CurModule.PlaceHolderInfo.find(V);
744 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
746 ValID &DID = PHI->second.first;
748 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
750 V->replaceAllUsesWith(TheRealValue);
752 CurModule.PlaceHolderInfo.erase(PHI);
753 } else if (FutureLateResolvers) {
754 // Functions have their unresolved items forwarded to the module late
756 InsertValue(V, *FutureLateResolvers);
758 if (DID.Type == ValID::NameVal)
759 GenerateError("Reference to an invalid definition: '" +DID.getName()+
760 "' of type '" + V->getType()->getDescription() + "'",
763 GenerateError("Reference to an invalid definition: #" +
764 itostr(DID.Num) + " of type '" +
765 V->getType()->getDescription() + "'",
771 LateResolvers.clear();
774 // ResolveTypeTo - A brand new type was just declared. This means that (if
775 // name is not null) things referencing Name can be resolved. Otherwise, things
776 // refering to the number can be resolved. Do this now.
778 static void ResolveTypeTo(char *Name, const Type *ToTy) {
780 if (Name) D = ValID::create(Name);
781 else D = ValID::create((int)CurModule.Types.size());
783 std::map<ValID, PATypeHolder>::iterator I =
784 CurModule.LateResolveTypes.find(D);
785 if (I != CurModule.LateResolveTypes.end()) {
786 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
787 CurModule.LateResolveTypes.erase(I);
791 // setValueName - Set the specified value to the name given. The name may be
792 // null potentially, in which case this is a noop. The string passed in is
793 // assumed to be a malloc'd string buffer, and is free'd by this function.
795 static void setValueName(Value *V, char *NameStr) {
797 std::string Name(NameStr); // Copy string
798 free(NameStr); // Free old string
800 if (V->getType() == Type::VoidTy)
801 GenerateError("Can't assign name '" + Name+"' to value with void type!");
803 assert(inFunctionScope() && "Must be in function scope!");
804 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
805 if (ST.lookup(V->getType(), Name))
806 GenerateError("Redefinition of value named '" + Name + "' in the '" +
807 V->getType()->getDescription() + "' type plane!");
814 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
815 /// this is a declaration, otherwise it is a definition.
816 static GlobalVariable *
817 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
818 bool isConstantGlobal, const Type *Ty,
819 Constant *Initializer) {
820 if (isa<FunctionType>(Ty))
821 GenerateError("Cannot declare global vars of function type!");
823 const PointerType *PTy = PointerType::get(Ty);
827 Name = NameStr; // Copy string
828 free(NameStr); // Free old string
831 // See if this global value was forward referenced. If so, recycle the
835 ID = ValID::create((char*)Name.c_str());
837 ID = ValID::create((int)CurModule.Values[PTy].size());
840 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
841 // Move the global to the end of the list, from whereever it was
842 // previously inserted.
843 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
844 CurModule.CurrentModule->getGlobalList().remove(GV);
845 CurModule.CurrentModule->getGlobalList().push_back(GV);
846 GV->setInitializer(Initializer);
847 GV->setLinkage(Linkage);
848 GV->setConstant(isConstantGlobal);
849 InsertValue(GV, CurModule.Values);
853 // If this global has a name, check to see if there is already a definition
854 // of this global in the module. If so, merge as appropriate. Note that
855 // this is really just a hack around problems in the CFE. :(
857 // We are a simple redefinition of a value, check to see if it is defined
858 // the same as the old one.
859 if (GlobalVariable *EGV =
860 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
861 // We are allowed to redefine a global variable in two circumstances:
862 // 1. If at least one of the globals is uninitialized or
863 // 2. If both initializers have the same value.
865 if (!EGV->hasInitializer() || !Initializer ||
866 EGV->getInitializer() == Initializer) {
868 // Make sure the existing global version gets the initializer! Make
869 // sure that it also gets marked const if the new version is.
870 if (Initializer && !EGV->hasInitializer())
871 EGV->setInitializer(Initializer);
872 if (isConstantGlobal)
873 EGV->setConstant(true);
874 EGV->setLinkage(Linkage);
878 GenerateError("Redefinition of global variable named '" + Name +
879 "' in the '" + Ty->getDescription() + "' type plane!");
883 // Otherwise there is no existing GV to use, create one now.
885 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
886 CurModule.CurrentModule);
887 InsertValue(GV, CurModule.Values);
891 // setTypeName - Set the specified type to the name given. The name may be
892 // null potentially, in which case this is a noop. The string passed in is
893 // assumed to be a malloc'd string buffer, and is freed by this function.
895 // This function returns true if the type has already been defined, but is
896 // allowed to be redefined in the specified context. If the name is a new name
897 // for the type plane, it is inserted and false is returned.
898 static bool setTypeName(const Type *T, char *NameStr) {
899 assert(!inFunctionScope() && "Can't give types function-local names!");
900 if (NameStr == 0) return false;
902 std::string Name(NameStr); // Copy string
903 free(NameStr); // Free old string
905 // We don't allow assigning names to void type
906 if (T == Type::VoidTy)
907 GenerateError("Can't assign name '" + Name + "' to the void type!");
909 // Set the type name, checking for conflicts as we do so.
910 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
912 if (AlreadyExists) { // Inserting a name that is already defined???
913 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
914 assert(Existing && "Conflict but no matching type?");
916 // There is only one case where this is allowed: when we are refining an
917 // opaque type. In this case, Existing will be an opaque type.
918 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
919 // We ARE replacing an opaque type!
920 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
924 // Otherwise, this is an attempt to redefine a type. That's okay if
925 // the redefinition is identical to the original. This will be so if
926 // Existing and T point to the same Type object. In this one case we
927 // allow the equivalent redefinition.
928 if (Existing == T) return true; // Yes, it's equal.
930 // Any other kind of (non-equivalent) redefinition is an error.
931 GenerateError("Redefinition of type named '" + Name + "' in the '" +
932 T->getDescription() + "' type plane!");
938 //===----------------------------------------------------------------------===//
939 // Code for handling upreferences in type names...
942 // TypeContains - Returns true if Ty directly contains E in it.
944 static bool TypeContains(const Type *Ty, const Type *E) {
945 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
946 E) != Ty->subtype_end();
951 // NestingLevel - The number of nesting levels that need to be popped before
952 // this type is resolved.
953 unsigned NestingLevel;
955 // LastContainedTy - This is the type at the current binding level for the
956 // type. Every time we reduce the nesting level, this gets updated.
957 const Type *LastContainedTy;
959 // UpRefTy - This is the actual opaque type that the upreference is
963 UpRefRecord(unsigned NL, OpaqueType *URTy)
964 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
968 // UpRefs - A list of the outstanding upreferences that need to be resolved.
969 static std::vector<UpRefRecord> UpRefs;
971 /// HandleUpRefs - Every time we finish a new layer of types, this function is
972 /// called. It loops through the UpRefs vector, which is a list of the
973 /// currently active types. For each type, if the up reference is contained in
974 /// the newly completed type, we decrement the level count. When the level
975 /// count reaches zero, the upreferenced type is the type that is passed in:
976 /// thus we can complete the cycle.
978 static PATypeHolder HandleUpRefs(const Type *ty) {
979 if (!ty->isAbstract()) return ty;
981 UR_OUT("Type '" << Ty->getDescription() <<
982 "' newly formed. Resolving upreferences.\n" <<
983 UpRefs.size() << " upreferences active!\n");
985 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
986 // to zero), we resolve them all together before we resolve them to Ty. At
987 // the end of the loop, if there is anything to resolve to Ty, it will be in
989 OpaqueType *TypeToResolve = 0;
991 for (unsigned i = 0; i != UpRefs.size(); ++i) {
992 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
993 << UpRefs[i].second->getDescription() << ") = "
994 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
995 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
996 // Decrement level of upreference
997 unsigned Level = --UpRefs[i].NestingLevel;
998 UpRefs[i].LastContainedTy = Ty;
999 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1000 if (Level == 0) { // Upreference should be resolved!
1001 if (!TypeToResolve) {
1002 TypeToResolve = UpRefs[i].UpRefTy;
1004 UR_OUT(" * Resolving upreference for "
1005 << UpRefs[i].second->getDescription() << "\n";
1006 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1007 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1008 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1009 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1011 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1012 --i; // Do not skip the next element...
1017 if (TypeToResolve) {
1018 UR_OUT(" * Resolving upreference for "
1019 << UpRefs[i].second->getDescription() << "\n";
1020 std::string OldName = TypeToResolve->getDescription());
1021 TypeToResolve->refineAbstractTypeTo(Ty);
1028 // common code from the two 'RunVMAsmParser' functions
1029 static Module * RunParser(Module * M) {
1031 llvmAsmlineno = 1; // Reset the current line number...
1032 ObsoleteVarArgs = false;
1035 CurModule.CurrentModule = M;
1036 yyparse(); // Parse the file, potentially throwing exception
1040 Module *Result = ParserResult;
1043 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1046 if ((F = Result->getNamedFunction("llvm.va_start"))
1047 && F->getFunctionType()->getNumParams() == 0)
1048 ObsoleteVarArgs = true;
1049 if((F = Result->getNamedFunction("llvm.va_copy"))
1050 && F->getFunctionType()->getNumParams() == 1)
1051 ObsoleteVarArgs = true;
1054 if (ObsoleteVarArgs && NewVarArgs)
1055 GenerateError("This file is corrupt: it uses both new and old style varargs");
1057 if(ObsoleteVarArgs) {
1058 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1059 if (F->arg_size() != 0)
1060 GenerateError("Obsolete va_start takes 0 argument!");
1064 //bar = alloca typeof(foo)
1068 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1069 const Type* ArgTy = F->getFunctionType()->getReturnType();
1070 const Type* ArgTyPtr = PointerType::get(ArgTy);
1071 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1072 RetTy, ArgTyPtr, (Type *)0);
1074 while (!F->use_empty()) {
1075 CallInst* CI = cast<CallInst>(F->use_back());
1076 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1077 new CallInst(NF, bar, "", CI);
1078 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1079 CI->replaceAllUsesWith(foo);
1080 CI->getParent()->getInstList().erase(CI);
1082 Result->getFunctionList().erase(F);
1085 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1086 if(F->arg_size() != 1)
1087 GenerateError("Obsolete va_end takes 1 argument!");
1091 //bar = alloca 1 of typeof(foo)
1093 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1094 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1095 const Type* ArgTyPtr = PointerType::get(ArgTy);
1096 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1097 RetTy, ArgTyPtr, (Type *)0);
1099 while (!F->use_empty()) {
1100 CallInst* CI = cast<CallInst>(F->use_back());
1101 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1102 new StoreInst(CI->getOperand(1), bar, CI);
1103 new CallInst(NF, bar, "", CI);
1104 CI->getParent()->getInstList().erase(CI);
1106 Result->getFunctionList().erase(F);
1109 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1110 if(F->arg_size() != 1)
1111 GenerateError("Obsolete va_copy takes 1 argument!");
1114 //a = alloca 1 of typeof(foo)
1115 //b = alloca 1 of typeof(foo)
1120 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1121 const Type* ArgTy = F->getFunctionType()->getReturnType();
1122 const Type* ArgTyPtr = PointerType::get(ArgTy);
1123 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1124 RetTy, ArgTyPtr, ArgTyPtr,
1127 while (!F->use_empty()) {
1128 CallInst* CI = cast<CallInst>(F->use_back());
1129 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1130 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1131 new StoreInst(CI->getOperand(1), b, CI);
1132 new CallInst(NF, a, b, "", CI);
1133 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1134 CI->replaceAllUsesWith(foo);
1135 CI->getParent()->getInstList().erase(CI);
1137 Result->getFunctionList().erase(F);
1145 //===----------------------------------------------------------------------===//
1146 // RunVMAsmParser - Define an interface to this parser
1147 //===----------------------------------------------------------------------===//
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 907 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
1189 typedef union YYSTYPE {
1190 llvm::Module *ModuleVal;
1191 llvm::Function *FunctionVal;
1192 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1193 llvm::BasicBlock *BasicBlockVal;
1194 llvm::TerminatorInst *TermInstVal;
1195 llvm::Instruction *InstVal;
1196 llvm::Constant *ConstVal;
1198 const llvm::Type *PrimType;
1199 llvm::PATypeHolder *TypeVal;
1200 llvm::Value *ValueVal;
1202 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1203 std::vector<llvm::Value*> *ValueList;
1204 std::list<llvm::PATypeHolder> *TypeList;
1205 // Represent the RHS of PHI node
1206 std::list<std::pair<llvm::Value*,
1207 llvm::BasicBlock*> > *PHIList;
1208 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1209 std::vector<llvm::Constant*> *ConstVector;
1211 llvm::GlobalValue::LinkageTypes Linkage;
1219 char *StrVal; // This memory is strdup'd!
1220 llvm::ValID ValIDVal; // strdup'd memory maybe!
1222 llvm::Instruction::BinaryOps BinaryOpVal;
1223 llvm::Instruction::TermOps TermOpVal;
1224 llvm::Instruction::MemoryOps MemOpVal;
1225 llvm::Instruction::OtherOps OtherOpVal;
1226 llvm::Module::Endianness Endianness;
1228 /* Line 196 of yacc.c. */
1229 #line 1230 "llvmAsmParser.tab.c"
1230 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1231 # define YYSTYPE_IS_DECLARED 1
1232 # define YYSTYPE_IS_TRIVIAL 1
1237 /* Copy the second part of user declarations. */
1240 /* Line 219 of yacc.c. */
1241 #line 1242 "llvmAsmParser.tab.c"
1243 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1244 # define YYSIZE_T __SIZE_TYPE__
1246 #if ! defined (YYSIZE_T) && defined (size_t)
1247 # define YYSIZE_T size_t
1249 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1250 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1251 # define YYSIZE_T size_t
1253 #if ! defined (YYSIZE_T)
1254 # define YYSIZE_T unsigned int
1260 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1261 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1265 # define YY_(msgid) msgid
1269 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1271 /* The parser invokes alloca or malloc; define the necessary symbols. */
1273 # ifdef YYSTACK_USE_ALLOCA
1274 # if YYSTACK_USE_ALLOCA
1276 # define YYSTACK_ALLOC __builtin_alloca
1278 # define YYSTACK_ALLOC alloca
1279 # if defined (__STDC__) || defined (__cplusplus)
1280 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1281 # define YYINCLUDED_STDLIB_H
1287 # ifdef YYSTACK_ALLOC
1288 /* Pacify GCC's `empty if-body' warning. */
1289 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1290 # ifndef YYSTACK_ALLOC_MAXIMUM
1291 /* The OS might guarantee only one guard page at the bottom of the stack,
1292 and a page size can be as small as 4096 bytes. So we cannot safely
1293 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1294 to allow for a few compiler-allocated temporary stack slots. */
1295 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1298 # define YYSTACK_ALLOC YYMALLOC
1299 # define YYSTACK_FREE YYFREE
1300 # ifndef YYSTACK_ALLOC_MAXIMUM
1301 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1307 # define YYMALLOC malloc
1308 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1309 && (defined (__STDC__) || defined (__cplusplus)))
1310 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1314 # define YYFREE free
1315 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1316 && (defined (__STDC__) || defined (__cplusplus)))
1317 void free (void *); /* INFRINGES ON USER NAME SPACE */
1324 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1327 #if (! defined (yyoverflow) \
1328 && (! defined (__cplusplus) \
1329 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1331 /* A type that is properly aligned for any stack member. */
1338 /* The size of the maximum gap between one aligned stack and the next. */
1339 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1341 /* The size of an array large to enough to hold all stacks, each with
1343 # define YYSTACK_BYTES(N) \
1344 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1345 + YYSTACK_GAP_MAXIMUM)
1347 /* Copy COUNT objects from FROM to TO. The source and destination do
1350 # if defined (__GNUC__) && 1 < __GNUC__
1351 # define YYCOPY(To, From, Count) \
1352 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1354 # define YYCOPY(To, From, Count) \
1358 for (yyi = 0; yyi < (Count); yyi++) \
1359 (To)[yyi] = (From)[yyi]; \
1365 /* Relocate STACK from its old location to the new one. The
1366 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1367 elements in the stack, and YYPTR gives the new location of the
1368 stack. Advance YYPTR to a properly aligned location for the next
1370 # define YYSTACK_RELOCATE(Stack) \
1373 YYSIZE_T yynewbytes; \
1374 YYCOPY (&yyptr->Stack, Stack, yysize); \
1375 Stack = &yyptr->Stack; \
1376 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1377 yyptr += yynewbytes / sizeof (*yyptr); \
1383 #if defined (__STDC__) || defined (__cplusplus)
1384 typedef signed char yysigned_char;
1386 typedef short int yysigned_char;
1389 /* YYFINAL -- State number of the termination state. */
1391 /* YYLAST -- Last index in YYTABLE. */
1394 /* YYNTOKENS -- Number of terminals. */
1395 #define YYNTOKENS 117
1396 /* YYNNTS -- Number of nonterminals. */
1398 /* YYNRULES -- Number of rules. */
1399 #define YYNRULES 239
1400 /* YYNRULES -- Number of states. */
1401 #define YYNSTATES 496
1403 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1404 #define YYUNDEFTOK 2
1405 #define YYMAXUTOK 357
1407 #define YYTRANSLATE(YYX) \
1408 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1410 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1411 static const unsigned char yytranslate[] =
1413 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1417 106, 107, 115, 2, 104, 2, 2, 2, 2, 2,
1418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1419 111, 103, 112, 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, 108, 105, 110, 2, 2, 2, 2, 2, 116,
1423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1425 109, 2, 2, 113, 2, 114, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1431 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4,
1439 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1440 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1441 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1442 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1443 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1444 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1445 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1446 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1447 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1448 95, 96, 97, 98, 99, 100, 101, 102
1452 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1454 static const unsigned short int yyprhs[] =
1456 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1457 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1458 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1459 59, 61, 63, 65, 67, 70, 71, 73, 75, 77,
1460 79, 80, 81, 83, 85, 87, 89, 92, 93, 96,
1461 97, 101, 104, 105, 107, 108, 112, 114, 117, 119,
1462 121, 123, 125, 127, 129, 131, 133, 135, 137, 139,
1463 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1464 162, 167, 173, 179, 183, 186, 189, 191, 195, 197,
1465 201, 203, 204, 209, 213, 217, 222, 227, 231, 234,
1466 237, 240, 243, 246, 249, 252, 255, 258, 261, 268,
1467 274, 283, 290, 297, 304, 311, 318, 327, 336, 340,
1468 342, 344, 346, 348, 351, 354, 359, 362, 364, 369,
1469 372, 377, 378, 386, 387, 395, 399, 404, 405, 407,
1470 409, 411, 415, 419, 423, 427, 431, 433, 434, 436,
1471 438, 440, 441, 444, 448, 450, 452, 456, 458, 459,
1472 468, 470, 472, 476, 478, 480, 483, 484, 488, 489,
1473 491, 493, 495, 497, 499, 501, 503, 505, 507, 511,
1474 513, 519, 521, 523, 525, 527, 530, 533, 536, 540,
1475 543, 544, 546, 549, 552, 556, 566, 576, 585, 599,
1476 601, 603, 610, 616, 619, 626, 634, 636, 640, 642,
1477 643, 646, 648, 654, 660, 666, 669, 674, 679, 686,
1478 691, 696, 701, 706, 713, 720, 723, 731, 733, 736,
1479 737, 739, 740, 744, 751, 755, 762, 765, 770, 777
1482 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1483 static const short int yyrhs[] =
1485 148, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1486 -1, 72, -1, 73, -1, 74, -1, 75, -1, 76,
1487 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81,
1488 -1, 82, -1, 83, -1, 84, -1, 85, -1, 95,
1489 -1, 96, -1, 16, -1, 14, -1, 12, -1, 10,
1490 -1, 17, -1, 15, -1, 13, -1, 11, -1, 124,
1491 -1, 125, -1, 18, -1, 19, -1, 158, 103, -1,
1492 -1, 41, -1, 42, -1, 43, -1, 44, -1, -1,
1493 -1, 62, -1, 63, -1, 64, -1, 65, -1, 61,
1494 4, -1, -1, 54, 4, -1, -1, 104, 54, 4,
1495 -1, 34, 24, -1, -1, 133, -1, -1, 104, 136,
1496 135, -1, 133, -1, 54, 4, -1, 139, -1, 8,
1497 -1, 141, -1, 8, -1, 141, -1, 9, -1, 10,
1498 -1, 11, -1, 12, -1, 13, -1, 14, -1, 15,
1499 -1, 16, -1, 17, -1, 18, -1, 19, -1, 20,
1500 -1, 21, -1, 45, -1, 140, -1, 172, -1, 105,
1501 4, -1, 138, 106, 143, 107, -1, 108, 4, 109,
1502 141, 110, -1, 111, 4, 109, 141, 112, -1, 113,
1503 142, 114, -1, 113, 114, -1, 141, 115, -1, 141,
1504 -1, 142, 104, 141, -1, 142, -1, 142, 104, 37,
1505 -1, 37, -1, -1, 139, 108, 146, 110, -1, 139,
1506 108, 110, -1, 139, 116, 24, -1, 139, 111, 146,
1507 112, -1, 139, 113, 146, 114, -1, 139, 113, 114,
1508 -1, 139, 38, -1, 139, 39, -1, 139, 172, -1,
1509 139, 145, -1, 139, 26, -1, 124, 119, -1, 125,
1510 4, -1, 9, 27, -1, 9, 28, -1, 127, 7,
1511 -1, 93, 106, 144, 36, 139, 107, -1, 91, 106,
1512 144, 186, 107, -1, 94, 106, 144, 104, 144, 104,
1513 144, 107, -1, 120, 106, 144, 104, 144, 107, -1,
1514 121, 106, 144, 104, 144, 107, -1, 122, 106, 144,
1515 104, 144, 107, -1, 123, 106, 144, 104, 144, 107,
1516 -1, 98, 106, 144, 104, 144, 107, -1, 99, 106,
1517 144, 104, 144, 104, 144, 107, -1, 100, 106, 144,
1518 104, 144, 104, 144, 107, -1, 146, 104, 144, -1,
1519 144, -1, 32, -1, 33, -1, 149, -1, 149, 167,
1520 -1, 149, 168, -1, 149, 59, 58, 153, -1, 149,
1521 25, -1, 150, -1, 150, 128, 20, 137, -1, 150,
1522 168, -1, 150, 59, 58, 153, -1, -1, 150, 128,
1523 129, 147, 144, 151, 135, -1, -1, 150, 128, 47,
1524 147, 139, 152, 135, -1, 150, 48, 155, -1, 150,
1525 55, 103, 156, -1, -1, 24, -1, 53, -1, 52,
1526 -1, 50, 103, 154, -1, 51, 103, 4, -1, 49,
1527 103, 24, -1, 108, 157, 110, -1, 157, 104, 24,
1528 -1, 24, -1, -1, 22, -1, 24, -1, 158, -1,
1529 -1, 139, 159, -1, 161, 104, 160, -1, 160, -1,
1530 161, -1, 161, 104, 37, -1, 37, -1, -1, 130,
1531 137, 158, 106, 162, 107, 134, 131, -1, 29, -1,
1532 113, -1, 129, 163, 164, -1, 30, -1, 114, -1,
1533 175, 166, -1, -1, 31, 169, 163, -1, -1, 60,
1534 -1, 3, -1, 4, -1, 7, -1, 27, -1, 28,
1535 -1, 38, -1, 39, -1, 26, -1, 111, 146, 112,
1536 -1, 145, -1, 58, 170, 24, 104, 24, -1, 118,
1537 -1, 158, -1, 172, -1, 171, -1, 139, 173, -1,
1538 175, 176, -1, 165, 176, -1, 177, 128, 178, -1,
1539 177, 180, -1, -1, 23, -1, 66, 174, -1, 66,
1540 8, -1, 67, 21, 173, -1, 67, 9, 173, 104,
1541 21, 173, 104, 21, 173, -1, 68, 126, 173, 104,
1542 21, 173, 108, 179, 110, -1, 68, 126, 173, 104,
1543 21, 173, 108, 110, -1, 69, 130, 137, 173, 106,
1544 183, 107, 36, 21, 173, 70, 21, 173, -1, 70,
1545 -1, 71, -1, 179, 126, 171, 104, 21, 173, -1,
1546 126, 171, 104, 21, 173, -1, 128, 185, -1, 139,
1547 108, 173, 104, 173, 110, -1, 181, 104, 108, 173,
1548 104, 173, 110, -1, 174, -1, 182, 104, 174, -1,
1549 182, -1, -1, 57, 56, -1, 56, -1, 120, 139,
1550 173, 104, 173, -1, 121, 139, 173, 104, 173, -1,
1551 122, 139, 173, 104, 173, -1, 46, 174, -1, 123,
1552 174, 104, 174, -1, 93, 174, 36, 139, -1, 94,
1553 174, 104, 174, 104, 174, -1, 97, 174, 104, 139,
1554 -1, 101, 174, 104, 139, -1, 102, 174, 104, 139,
1555 -1, 98, 174, 104, 174, -1, 99, 174, 104, 174,
1556 104, 174, -1, 100, 174, 104, 174, 104, 174, -1,
1557 92, 181, -1, 184, 130, 137, 173, 106, 183, 107,
1558 -1, 188, -1, 104, 182, -1, -1, 35, -1, -1,
1559 86, 139, 132, -1, 86, 139, 104, 15, 173, 132,
1560 -1, 87, 139, 132, -1, 87, 139, 104, 15, 173,
1561 132, -1, 88, 174, -1, 187, 89, 139, 173, -1,
1562 187, 90, 174, 104, 139, 173, -1, 91, 139, 173,
1566 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1567 static const unsigned short int yyrline[] =
1569 0, 1027, 1027, 1028, 1036, 1037, 1047, 1047, 1047, 1047,
1570 1047, 1048, 1048, 1048, 1049, 1049, 1049, 1049, 1049, 1049,
1571 1051, 1051, 1055, 1055, 1055, 1055, 1056, 1056, 1056, 1056,
1572 1057, 1057, 1058, 1058, 1061, 1065, 1070, 1071, 1072, 1073,
1573 1074, 1076, 1077, 1078, 1079, 1080, 1081, 1090, 1091, 1097,
1574 1098, 1106, 1114, 1115, 1120, 1121, 1122, 1127, 1141, 1141,
1575 1142, 1142, 1144, 1154, 1154, 1154, 1154, 1154, 1154, 1154,
1576 1155, 1155, 1155, 1155, 1155, 1155, 1156, 1160, 1164, 1171,
1577 1179, 1192, 1197, 1209, 1219, 1223, 1232, 1237, 1243, 1244,
1578 1248, 1252, 1263, 1289, 1303, 1333, 1359, 1380, 1393, 1403,
1579 1408, 1468, 1475, 1484, 1490, 1496, 1500, 1504, 1512, 1523,
1580 1555, 1563, 1585, 1596, 1602, 1610, 1616, 1622, 1631, 1635,
1581 1643, 1643, 1653, 1661, 1666, 1670, 1674, 1678, 1693, 1714,
1582 1717, 1720, 1720, 1727, 1727, 1735, 1738, 1741, 1745, 1758,
1583 1759, 1761, 1765, 1774, 1780, 1782, 1787, 1792, 1801, 1801,
1584 1802, 1802, 1804, 1811, 1817, 1824, 1828, 1834, 1839, 1844,
1585 1931, 1931, 1933, 1941, 1941, 1943, 1948, 1948, 1958, 1962,
1586 1967, 1971, 1975, 1979, 1983, 1987, 1991, 1995, 1999, 2024,
1587 2028, 2042, 2046, 2052, 2052, 2058, 2063, 2067, 2076, 2086,
1588 2091, 2102, 2114, 2118, 2122, 2126, 2130, 2145, 2150, 2204,
1589 2208, 2215, 2224, 2235, 2243, 2249, 2257, 2262, 2269, 2269,
1590 2271, 2275, 2282, 2295, 2307, 2318, 2331, 2339, 2347, 2355,
1591 2361, 2381, 2404, 2410, 2416, 2422, 2437, 2495, 2502, 2505,
1592 2510, 2514, 2521, 2526, 2531, 2536, 2541, 2549, 2560, 2574
1596 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1597 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1598 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1599 static const char *const yytname[] =
1601 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1602 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1603 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1604 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1605 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1606 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1607 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1608 "WEAK", "APPENDING", "OPAQUE", "NOT", "EXTERNAL", "TARGET", "TRIPLE",
1609 "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS", "CALL",
1610 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1611 "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "RET", "BR", "SWITCH",
1612 "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "DIV", "REM",
1613 "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE",
1614 "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK",
1615 "CAST", "SELECT", "SHL", "SHR", "VAARG", "EXTRACTELEMENT",
1616 "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='",
1617 "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1618 "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps",
1619 "LogicalOps", "SetCondOps", "ShiftOps", "SIntType", "UIntType",
1620 "IntType", "FPType", "OptAssign", "OptLinkage", "OptCallingConv",
1621 "OptAlign", "OptCAlign", "SectionString", "OptSection",
1622 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV",
1623 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal",
1624 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList",
1625 "ConstPool", "@1", "@2", "AsmBlock", "BigOrLittle", "TargetDefinition",
1626 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
1627 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1628 "END", "Function", "FunctionProto", "@3", "OptSideEffect",
1629 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1630 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1631 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1632 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
1637 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1639 static const unsigned short int yytoknum[] =
1641 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1642 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1643 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1644 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1645 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1646 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1647 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1648 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1649 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1650 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1651 355, 356, 357, 61, 44, 92, 40, 41, 91, 120,
1652 93, 60, 62, 123, 125, 42, 99
1656 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1657 static const unsigned char yyr1[] =
1659 0, 117, 118, 118, 119, 119, 120, 120, 120, 120,
1660 120, 121, 121, 121, 122, 122, 122, 122, 122, 122,
1661 123, 123, 124, 124, 124, 124, 125, 125, 125, 125,
1662 126, 126, 127, 127, 128, 128, 129, 129, 129, 129,
1663 129, 130, 130, 130, 130, 130, 130, 131, 131, 132,
1664 132, 133, 134, 134, 135, 135, 136, 136, 137, 137,
1665 138, 138, 139, 140, 140, 140, 140, 140, 140, 140,
1666 140, 140, 140, 140, 140, 140, 141, 141, 141, 141,
1667 141, 141, 141, 141, 141, 141, 142, 142, 143, 143,
1668 143, 143, 144, 144, 144, 144, 144, 144, 144, 144,
1669 144, 144, 144, 144, 144, 144, 144, 144, 145, 145,
1670 145, 145, 145, 145, 145, 145, 145, 145, 146, 146,
1671 147, 147, 148, 149, 149, 149, 149, 149, 150, 150,
1672 150, 151, 150, 152, 150, 150, 150, 150, 153, 154,
1673 154, 155, 155, 155, 156, 157, 157, 157, 158, 158,
1674 159, 159, 160, 161, 161, 162, 162, 162, 162, 163,
1675 164, 164, 165, 166, 166, 167, 169, 168, 170, 170,
1676 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1677 171, 172, 172, 173, 173, 174, 175, 175, 176, 177,
1678 177, 177, 178, 178, 178, 178, 178, 178, 178, 178,
1679 178, 179, 179, 180, 181, 181, 182, 182, 183, 183,
1680 184, 184, 185, 185, 185, 185, 185, 185, 185, 185,
1681 185, 185, 185, 185, 185, 185, 185, 185, 186, 186,
1682 187, 187, 188, 188, 188, 188, 188, 188, 188, 188
1685 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1686 static const unsigned char yyr2[] =
1688 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1689 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1690 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1691 1, 1, 1, 1, 2, 0, 1, 1, 1, 1,
1692 0, 0, 1, 1, 1, 1, 2, 0, 2, 0,
1693 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1694 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1695 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1696 4, 5, 5, 3, 2, 2, 1, 3, 1, 3,
1697 1, 0, 4, 3, 3, 4, 4, 3, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1699 8, 6, 6, 6, 6, 6, 8, 8, 3, 1,
1700 1, 1, 1, 2, 2, 4, 2, 1, 4, 2,
1701 4, 0, 7, 0, 7, 3, 4, 0, 1, 1,
1702 1, 3, 3, 3, 3, 3, 1, 0, 1, 1,
1703 1, 0, 2, 3, 1, 1, 3, 1, 0, 8,
1704 1, 1, 3, 1, 1, 2, 0, 3, 0, 1,
1705 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1706 5, 1, 1, 1, 1, 2, 2, 2, 3, 2,
1707 0, 1, 2, 2, 3, 9, 9, 8, 13, 1,
1708 1, 6, 5, 2, 6, 7, 1, 3, 1, 0,
1709 2, 1, 5, 5, 5, 2, 4, 4, 6, 4,
1710 4, 4, 4, 6, 6, 2, 7, 1, 2, 0,
1711 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
1714 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1715 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1716 means the default is an error. */
1717 static const unsigned char yydefact[] =
1719 137, 0, 40, 127, 1, 126, 166, 36, 37, 38,
1720 39, 0, 41, 190, 123, 124, 190, 148, 149, 0,
1721 0, 0, 40, 0, 129, 41, 0, 0, 42, 43,
1722 44, 45, 0, 0, 191, 187, 35, 163, 164, 165,
1723 186, 0, 0, 0, 135, 0, 0, 0, 0, 0,
1724 34, 167, 138, 125, 46, 2, 3, 59, 63, 64,
1725 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1726 75, 76, 0, 0, 0, 0, 181, 0, 0, 58,
1727 77, 62, 182, 78, 160, 161, 162, 231, 189, 0,
1728 0, 0, 147, 136, 130, 128, 120, 121, 0, 0,
1729 79, 0, 0, 61, 84, 86, 0, 0, 91, 85,
1730 230, 0, 211, 0, 0, 0, 0, 41, 199, 200,
1731 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1732 16, 17, 18, 19, 0, 0, 0, 0, 0, 0,
1733 0, 20, 21, 0, 0, 0, 0, 0, 0, 0,
1734 0, 0, 0, 188, 41, 203, 0, 227, 143, 140,
1735 139, 141, 142, 146, 0, 133, 63, 64, 65, 66,
1736 67, 68, 69, 70, 71, 72, 73, 0, 0, 0,
1737 0, 131, 0, 0, 0, 83, 158, 90, 88, 0,
1738 0, 215, 210, 193, 192, 0, 0, 25, 29, 24,
1739 28, 23, 27, 22, 26, 30, 31, 0, 0, 49,
1740 49, 236, 0, 0, 225, 0, 0, 0, 0, 0,
1741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1742 0, 144, 54, 105, 106, 4, 5, 103, 104, 107,
1743 102, 98, 99, 0, 0, 0, 0, 0, 0, 0,
1744 0, 0, 0, 0, 0, 0, 0, 101, 100, 54,
1745 60, 60, 87, 157, 151, 154, 155, 0, 0, 80,
1746 170, 171, 172, 177, 173, 174, 175, 176, 168, 0,
1747 179, 184, 183, 185, 0, 194, 0, 0, 0, 232,
1748 0, 234, 229, 0, 0, 0, 0, 0, 0, 0,
1749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1750 145, 0, 134, 0, 0, 0, 0, 0, 0, 93,
1751 119, 0, 0, 97, 0, 94, 0, 0, 0, 0,
1752 132, 81, 82, 150, 152, 0, 52, 89, 169, 0,
1753 0, 0, 0, 0, 0, 0, 0, 0, 239, 0,
1754 0, 217, 0, 219, 222, 0, 0, 220, 221, 0,
1755 0, 0, 216, 0, 237, 0, 0, 0, 56, 54,
1756 229, 0, 0, 0, 0, 0, 0, 92, 95, 96,
1757 0, 0, 0, 0, 156, 153, 53, 47, 0, 178,
1758 0, 0, 209, 49, 50, 49, 206, 228, 0, 0,
1759 0, 0, 0, 212, 213, 214, 209, 0, 51, 57,
1760 55, 0, 0, 0, 0, 0, 0, 118, 0, 0,
1761 0, 0, 0, 159, 0, 0, 0, 208, 0, 0,
1762 233, 235, 0, 0, 0, 218, 223, 224, 0, 238,
1763 109, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1764 48, 180, 0, 0, 0, 207, 204, 0, 226, 108,
1765 0, 115, 0, 0, 111, 112, 113, 114, 0, 197,
1766 0, 0, 0, 205, 0, 0, 0, 195, 0, 196,
1767 0, 0, 110, 116, 117, 0, 0, 0, 0, 0,
1768 0, 202, 0, 0, 201, 198
1771 /* YYDEFGOTO[NTERM-NUM]. */
1772 static const short int yydefgoto[] =
1774 -1, 76, 237, 253, 254, 255, 256, 177, 178, 207,
1775 179, 22, 12, 32, 423, 289, 368, 387, 312, 369,
1776 77, 78, 180, 80, 81, 106, 189, 320, 280, 321,
1777 98, 1, 2, 3, 259, 232, 53, 161, 44, 93,
1778 164, 82, 334, 265, 266, 267, 33, 86, 13, 39,
1779 14, 15, 25, 339, 281, 83, 283, 396, 16, 35,
1780 36, 153, 471, 88, 214, 427, 428, 154, 155, 348,
1784 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1786 #define YYPACT_NINF -442
1787 static const short int yypact[] =
1789 -442, 25, 181, 372, -442, -442, -442, -442, -442, -442,
1790 -442, -16, 33, 42, -442, -442, -14, -442, -442, 12,
1791 -57, 18, 44, -25, -442, 33, 75, 106, -442, -442,
1792 -442, -442, 1012, -21, -442, -442, 4, -442, -442, -442,
1793 -442, 29, 32, 49, -442, 47, 75, 1012, 97, 97,
1794 -442, -442, -442, -442, -442, -442, -442, 63, -442, -442,
1795 -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,
1796 -442, -442, 170, 171, 173, 524, -442, 4, 72, -442,
1797 -442, -84, -442, -442, -442, -442, -442, 1176, -442, 156,
1798 94, 175, 158, -442, -442, -442, -442, -442, 1050, 1088,
1799 -442, 74, 76, -442, -442, -84, -37, 78, 819, -442,
1800 -442, 1050, -442, 131, 1126, 14, 128, 33, -442, -442,
1801 -442, -442, -442, -442, -442, -442, -442, -442, -442, -442,
1802 -442, -442, -442, -442, 1050, 1050, 1050, 1050, 1050, 1050,
1803 1050, -442, -442, 1050, 1050, 1050, 1050, 1050, 1050, 1050,
1804 1050, 1050, 1050, -442, 33, -442, 60, -442, -442, -442,
1805 -442, -442, -442, -442, 23, -442, 129, 155, 190, 157,
1806 194, 159, 196, 167, 197, 195, 198, 169, 199, 200,
1807 406, -442, 1050, 1050, 1050, -442, 857, -442, 100, 101,
1808 617, -442, -442, 63, -442, 617, 617, -442, -442, -442,
1809 -442, -442, -442, -442, -442, -442, -442, 617, 1012, 105,
1810 107, -442, 617, 118, 109, 178, 111, 123, 132, 133,
1811 134, 135, 137, 617, 617, 617, 138, 1012, 1050, 1050,
1812 209, -442, 139, -442, -442, -442, -442, -442, -442, -442,
1813 -442, -442, -442, 140, 141, 144, 145, 146, 147, 895,
1814 1088, 566, 211, 148, 149, 150, 151, -442, -442, 139,
1815 -66, -88, -84, -442, 4, -442, 154, 152, 936, -442,
1816 -442, -442, -442, -442, -442, -442, -442, -442, 184, 1088,
1817 -442, -442, -442, -442, 168, -442, 172, 617, 5, -442,
1818 6, -442, 174, 617, 153, 1050, 1050, 1050, 1050, 1050,
1819 1050, 1050, 1050, 176, 177, 179, 1050, 617, 617, 180,
1820 -442, -20, -442, 1088, 1088, 1088, 1088, 1088, 1088, -442,
1821 -442, 24, -23, -442, -24, -442, 1088, 1088, 1088, 1088,
1822 -442, -442, -442, -442, -442, 974, 226, -442, -442, 221,
1823 -3, 241, 252, 182, 617, 271, 617, 1050, -442, 185,
1824 617, -442, 186, -442, -442, 188, 192, -442, -442, 617,
1825 617, 617, -442, 191, -442, 1050, 253, 278, -442, 139,
1826 174, 250, 201, 202, 203, 204, 1088, -442, -442, -442,
1827 205, 206, 207, 208, -442, -442, -442, 244, 210, -442,
1828 617, 617, 1050, 216, -442, 216, -442, 222, 617, 223,
1829 1050, 1050, 1050, -442, -442, -442, 1050, 617, -442, -442,
1830 -442, 227, 1050, 1088, 1088, 1088, 1088, -442, 1088, 1088,
1831 1088, 1088, 295, -442, 280, 224, 228, 222, 230, 259,
1832 -442, -442, 1050, 219, 617, -442, -442, -442, 234, -442,
1833 -442, 235, 231, 236, 240, 242, 238, 243, 245, 246,
1834 -442, -442, 309, 41, 311, -442, -442, 239, -442, -442,
1835 1088, -442, 1088, 1088, -442, -442, -442, -442, 617, -442,
1836 715, 58, 330, -442, 247, 248, 257, -442, 255, -442,
1837 715, 617, -442, -442, -442, 336, 263, 301, 617, 351,
1838 355, -442, 617, 617, -442, -442
1841 /* YYPGOTO[NTERM-NUM]. */
1842 static const short int yypgoto[] =
1844 -442, -442, -442, 290, 292, 294, 296, -115, -113, -441,
1845 -442, 346, 362, -106, -442, -205, 50, -442, -246, -442,
1846 -41, -442, -32, -442, -58, 277, -442, -97, 213, -232,
1847 338, -442, -442, -442, -442, -442, 342, -442, -442, -442,
1848 -442, 7, -442, 62, -442, -442, 370, -442, -442, -442,
1849 -442, 395, -442, -442, -387, -59, 166, -107, -442, 383,
1850 -442, -442, -442, -442, -442, 54, -4, -442, -442, 36,
1854 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1855 positive, shift that token. If negative, reduce the rule which
1856 number is the opposite. If zero, do what YYDEFACT says.
1857 If YYTABLE_NINF, syntax error. */
1858 #define YYTABLE_NINF -123
1859 static const short int yytable[] =
1861 79, 205, 181, 206, 191, 291, 95, 194, 84, 34,
1862 23, 208, 470, 330, 366, 79, 37, 105, 322, 324,
1863 344, 346, -60, 195, 332, 4, 17, 109, 18, 211,
1864 480, 109, 215, 216, 367, 196, 217, 218, 219, 220,
1865 221, 222, 26, 23, 331, 226, 45, 340, 227, 109,
1866 105, 197, 198, 199, 200, 201, 202, 203, 204, 345,
1867 345, 41, 42, 43, 47, 34, 165, 184, 197, 198,
1868 199, 200, 201, 202, 203, 204, 46, 185, 50, 190,
1869 376, 376, 190, 478, 107, 7, 8, 9, 10, 378,
1870 379, 48, 85, 486, 27, 28, 29, 30, 31, 52,
1871 38, 376, 209, 210, 190, 212, 213, 190, 190, 389,
1872 54, 190, 190, 190, 190, 190, 190, 223, 224, 225,
1873 190, 258, 309, 410, 260, 261, 262, 230, 376, 96,
1874 97, 282, 89, 231, 377, 90, 282, 282, 197, 198,
1875 199, 200, 201, 202, 203, 204, 159, 160, 282, 228,
1876 229, 469, 91, 282, 264, 92, 233, 234, -25, -25,
1877 -24, -24, -23, -23, 282, 282, 282, 287, 479, -61,
1878 -22, -22, 235, 236, 100, 101, 79, 102, 108, 162,
1879 158, -122, 163, 182, 186, 183, 307, 192, 430, 352,
1880 431, 354, 355, 356, -29, 79, 308, 190, -28, 362,
1881 -27, -26, -32, 238, 268, -33, 5, 239, 269, 288,
1882 262, 290, 6, 294, 295, 296, 370, 371, 372, 373,
1883 374, 375, 7, 8, 9, 10, 293, 297, 282, 380,
1884 381, 382, 383, 310, 282, 325, 298, 299, 300, 301,
1885 11, 302, 306, 311, 338, 388, 313, 314, 282, 282,
1886 315, 316, 317, 318, 326, 327, 328, 329, 335, 336,
1887 366, 350, 390, 351, 190, 353, 190, 190, 190, 357,
1888 358, 333, 341, 391, 190, 394, 342, 408, 347, 417,
1889 359, 360, 409, 361, 365, 282, 412, 282, 392, 398,
1890 400, 282, 401, 435, 436, 437, 402, 406, 422, 450,
1891 282, 282, 282, 264, 451, 413, 414, 415, 416, 418,
1892 419, 420, 421, 345, 424, 190, 442, 443, 444, 445,
1893 429, 446, 447, 448, 449, 455, 432, 434, 452, 456,
1894 468, 282, 282, 407, 440, 460, 453, 454, 205, 282,
1895 206, 458, 459, 461, 462, 464, 463, 472, 282, 473,
1896 465, 481, 466, 467, 482, 483, 205, 488, 206, 485,
1897 190, 284, 285, 474, 484, 475, 476, 489, 190, 190,
1898 190, 490, 492, 286, 190, 282, 493, 149, 292, 150,
1899 441, 151, 87, 152, 49, 188, 386, 99, 94, 303,
1900 304, 305, -35, 257, 17, 51, 18, 385, 24, 40,
1901 190, 397, 438, 6, -35, -35, 411, 0, 0, 282,
1902 0, 55, 56, -35, -35, -35, -35, 0, 0, -35,
1903 19, 0, 282, 0, 0, 0, 0, 20, 17, 282,
1904 18, 21, 240, 282, 282, 0, 0, 0, 0, 0,
1905 0, 0, 0, 0, 241, 242, 0, 0, 0, 0,
1906 0, 0, 0, 343, 0, 0, 0, 0, 0, 349,
1907 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1908 0, 0, 0, 363, 364, 0, 0, 0, 120, 121,
1909 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
1910 132, 133, 0, 0, 0, 0, 0, 243, 0, 244,
1911 245, 141, 142, 0, 246, 247, 248, 0, 0, 0,
1912 393, 0, 395, 0, 249, 0, 399, 250, 0, 251,
1913 0, 0, 252, 0, 0, 403, 404, 405, 0, 55,
1914 56, 0, 103, 58, 59, 60, 61, 62, 63, 64,
1915 65, 66, 67, 68, 69, 70, 17, 0, 18, 0,
1916 0, 0, 0, 0, 0, 0, 425, 426, 0, 0,
1917 0, 0, 0, 0, 433, 0, 0, 0, 0, 71,
1918 0, 55, 56, 439, 103, 166, 167, 168, 169, 170,
1919 171, 172, 173, 174, 175, 176, 69, 70, 17, 0,
1920 18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1921 457, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1922 0, 71, 0, 0, 0, 0, 0, 0, 0, 0,
1923 270, 271, 55, 56, 272, 0, 0, 0, 0, 72,
1924 0, 0, 73, 0, 477, 74, 0, 75, 104, 17,
1925 0, 18, 0, 273, 274, 275, 0, 487, 0, 0,
1926 0, 0, 0, 0, 491, 276, 277, 0, 494, 495,
1927 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1928 0, 72, 0, 0, 73, 278, 0, 74, 0, 75,
1929 323, 0, 0, 0, 0, 0, 0, 0, 0, 120,
1930 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
1931 131, 132, 133, 0, 0, 0, 0, 0, 243, 0,
1932 244, 245, 141, 142, 0, 246, 247, 248, 270, 271,
1933 0, 0, 272, 0, 0, 0, 0, 0, 279, 0,
1934 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1935 0, 273, 274, 275, 0, 0, 0, 0, 0, 0,
1936 0, 0, 0, 276, 277, 0, 0, 0, 0, 0,
1937 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1938 0, 0, 0, 278, 0, 0, 0, 0, 0, 0,
1939 0, 0, 0, 0, 0, 0, 0, 120, 121, 122,
1940 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
1941 133, 0, 0, 0, 0, 0, 243, 0, 244, 245,
1942 141, 142, 0, 246, 247, 248, 0, 0, 0, 0,
1943 0, 0, 0, 0, 55, 56, 279, 103, 58, 59,
1944 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1945 70, 17, 0, 18, 0, 0, 0, 0, 0, 0,
1946 0, 0, 0, 0, 0, 0, 187, 0, 0, 0,
1947 0, 0, 55, 56, 71, 103, 58, 59, 60, 61,
1948 62, 63, 64, 65, 66, 67, 68, 69, 70, 17,
1949 0, 18, 0, 0, 0, 0, 0, 0, 0, 0,
1950 0, 0, 0, 0, 263, 0, 0, 0, 0, 0,
1951 55, 56, 71, 103, 166, 167, 168, 169, 170, 171,
1952 172, 173, 174, 175, 176, 69, 70, 17, 0, 18,
1953 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1954 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
1955 71, 55, 56, 0, 103, 58, 59, 60, 61, 62,
1956 63, 64, 65, 66, 67, 68, 69, 70, 17, 0,
1957 18, 0, 72, 0, 0, 73, 0, 0, 74, 0,
1958 75, 0, 0, 337, 0, 0, 0, 0, 0, 55,
1959 56, 71, 103, 58, 59, 60, 61, 62, 63, 64,
1960 65, 66, 67, 68, 69, 70, 17, 0, 18, 0,
1961 72, 0, 0, 73, 0, 319, 74, 0, 75, 0,
1962 0, 384, 0, 0, 0, 0, 0, 55, 56, 71,
1963 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1964 67, 68, 69, 70, 17, 0, 18, 0, 0, 0,
1965 0, 72, 0, 0, 73, 0, 0, 74, 0, 75,
1966 0, 0, 0, 0, 0, 55, 56, 71, 103, 58,
1967 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
1968 69, 70, 17, 0, 18, 0, 0, 0, 0, 72,
1969 0, 0, 73, 0, 0, 74, 0, 75, 0, 0,
1970 0, 0, 0, 55, 56, 71, 103, 166, 167, 168,
1971 169, 170, 171, 172, 173, 174, 175, 176, 69, 70,
1972 17, 0, 18, 0, 0, 0, 0, 72, 0, 0,
1973 73, 0, 0, 74, 0, 75, 0, 0, 0, 0,
1974 0, 55, 56, 71, 193, 58, 59, 60, 61, 62,
1975 63, 64, 65, 66, 67, 68, 69, 70, 17, 0,
1976 18, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1977 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1978 0, 71, 0, 0, 0, 0, 0, 0, 0, 0,
1979 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1980 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
1981 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
1982 0, 110, 0, 0, 0, 0, 0, 0, 0, 0,
1983 0, 0, 111, 0, 0, 0, 0, 0, 0, 0,
1984 0, 72, 112, 113, 73, 0, 0, 74, 0, 75,
1985 0, 0, 114, 115, 116, 117, 118, 119, 120, 121,
1986 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
1987 132, 133, 134, 135, 136, 0, 0, 137, 138, 139,
1988 140, 141, 142, 143, 144, 145, 146, 147, 148
1991 static const short int yycheck[] =
1993 32, 116, 99, 116, 111, 210, 47, 114, 29, 23,
1994 3, 117, 453, 259, 34, 47, 30, 75, 250, 251,
1995 15, 15, 106, 9, 112, 0, 22, 115, 24, 136,
1996 471, 115, 139, 140, 54, 21, 143, 144, 145, 146,
1997 147, 148, 58, 36, 110, 152, 103, 279, 154, 115,
1998 108, 10, 11, 12, 13, 14, 15, 16, 17, 54,
1999 54, 49, 50, 51, 20, 23, 98, 104, 10, 11,
2000 12, 13, 14, 15, 16, 17, 58, 114, 103, 111,
2001 104, 104, 114, 470, 77, 41, 42, 43, 44, 112,
2002 114, 47, 113, 480, 61, 62, 63, 64, 65, 24,
2003 114, 104, 134, 135, 136, 137, 138, 139, 140, 112,
2004 4, 143, 144, 145, 146, 147, 148, 149, 150, 151,
2005 152, 180, 229, 369, 182, 183, 184, 104, 104, 32,
2006 33, 190, 103, 110, 110, 103, 195, 196, 10, 11,
2007 12, 13, 14, 15, 16, 17, 52, 53, 207, 89,
2008 90, 110, 103, 212, 186, 108, 27, 28, 3, 4,
2009 3, 4, 3, 4, 223, 224, 225, 208, 110, 106,
2010 3, 4, 3, 4, 4, 4, 208, 4, 106, 4,
2011 24, 0, 24, 109, 106, 109, 227, 56, 393, 296,
2012 395, 298, 299, 300, 4, 227, 228, 229, 4, 306,
2013 4, 4, 7, 4, 104, 7, 25, 7, 107, 104,
2014 268, 104, 31, 104, 36, 104, 313, 314, 315, 316,
2015 317, 318, 41, 42, 43, 44, 108, 104, 287, 326,
2016 327, 328, 329, 24, 293, 24, 104, 104, 104, 104,
2017 59, 104, 104, 104, 60, 24, 106, 106, 307, 308,
2018 106, 106, 106, 106, 106, 106, 106, 106, 104, 107,
2019 34, 108, 21, 295, 296, 297, 298, 299, 300, 301,
2020 302, 264, 104, 21, 306, 4, 104, 24, 104, 376,
2021 104, 104, 4, 104, 104, 344, 36, 346, 106, 104,
2022 104, 350, 104, 400, 401, 402, 104, 106, 54, 4,
2023 359, 360, 361, 335, 24, 104, 104, 104, 104, 104,
2024 104, 104, 104, 54, 104, 347, 413, 414, 415, 416,
2025 104, 418, 419, 420, 421, 432, 104, 104, 104, 110,
2026 21, 390, 391, 365, 107, 104, 108, 107, 453, 398,
2027 453, 107, 107, 107, 104, 107, 104, 36, 407, 110,
2028 107, 21, 107, 107, 107, 107, 471, 21, 471, 104,
2029 392, 195, 196, 460, 107, 462, 463, 104, 400, 401,
2030 402, 70, 21, 207, 406, 434, 21, 87, 212, 87,
2031 412, 87, 36, 87, 22, 108, 336, 49, 46, 223,
2032 224, 225, 20, 180, 22, 25, 24, 335, 3, 16,
2033 432, 347, 406, 31, 32, 33, 370, -1, -1, 468,
2034 -1, 5, 6, 41, 42, 43, 44, -1, -1, 47,
2035 48, -1, 481, -1, -1, -1, -1, 55, 22, 488,
2036 24, 59, 26, 492, 493, -1, -1, -1, -1, -1,
2037 -1, -1, -1, -1, 38, 39, -1, -1, -1, -1,
2038 -1, -1, -1, 287, -1, -1, -1, -1, -1, 293,
2039 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2040 -1, -1, -1, 307, 308, -1, -1, -1, 72, 73,
2041 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2042 84, 85, -1, -1, -1, -1, -1, 91, -1, 93,
2043 94, 95, 96, -1, 98, 99, 100, -1, -1, -1,
2044 344, -1, 346, -1, 108, -1, 350, 111, -1, 113,
2045 -1, -1, 116, -1, -1, 359, 360, 361, -1, 5,
2046 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2047 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2048 -1, -1, -1, -1, -1, -1, 390, 391, -1, -1,
2049 -1, -1, -1, -1, 398, -1, -1, -1, -1, 45,
2050 -1, 5, 6, 407, 8, 9, 10, 11, 12, 13,
2051 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2052 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2053 434, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2054 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1,
2055 3, 4, 5, 6, 7, -1, -1, -1, -1, 105,
2056 -1, -1, 108, -1, 468, 111, -1, 113, 114, 22,
2057 -1, 24, -1, 26, 27, 28, -1, 481, -1, -1,
2058 -1, -1, -1, -1, 488, 38, 39, -1, 492, 493,
2059 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2060 -1, 105, -1, -1, 108, 58, -1, 111, -1, 113,
2061 114, -1, -1, -1, -1, -1, -1, -1, -1, 72,
2062 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2063 83, 84, 85, -1, -1, -1, -1, -1, 91, -1,
2064 93, 94, 95, 96, -1, 98, 99, 100, 3, 4,
2065 -1, -1, 7, -1, -1, -1, -1, -1, 111, -1,
2066 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2067 -1, 26, 27, 28, -1, -1, -1, -1, -1, -1,
2068 -1, -1, -1, 38, 39, -1, -1, -1, -1, -1,
2069 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2070 -1, -1, -1, 58, -1, -1, -1, -1, -1, -1,
2071 -1, -1, -1, -1, -1, -1, -1, 72, 73, 74,
2072 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2073 85, -1, -1, -1, -1, -1, 91, -1, 93, 94,
2074 95, 96, -1, 98, 99, 100, -1, -1, -1, -1,
2075 -1, -1, -1, -1, 5, 6, 111, 8, 9, 10,
2076 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2077 21, 22, -1, 24, -1, -1, -1, -1, -1, -1,
2078 -1, -1, -1, -1, -1, -1, 37, -1, -1, -1,
2079 -1, -1, 5, 6, 45, 8, 9, 10, 11, 12,
2080 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2081 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2082 -1, -1, -1, -1, 37, -1, -1, -1, -1, -1,
2083 5, 6, 45, 8, 9, 10, 11, 12, 13, 14,
2084 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2085 -1, -1, -1, -1, 105, -1, -1, 108, -1, -1,
2086 111, -1, 113, -1, -1, -1, -1, -1, -1, -1,
2087 45, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2088 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2089 24, -1, 105, -1, -1, 108, -1, -1, 111, -1,
2090 113, -1, -1, 37, -1, -1, -1, -1, -1, 5,
2091 6, 45, 8, 9, 10, 11, 12, 13, 14, 15,
2092 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2093 105, -1, -1, 108, -1, 110, 111, -1, 113, -1,
2094 -1, 37, -1, -1, -1, -1, -1, 5, 6, 45,
2095 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2096 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2097 -1, 105, -1, -1, 108, -1, -1, 111, -1, 113,
2098 -1, -1, -1, -1, -1, 5, 6, 45, 8, 9,
2099 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2100 20, 21, 22, -1, 24, -1, -1, -1, -1, 105,
2101 -1, -1, 108, -1, -1, 111, -1, 113, -1, -1,
2102 -1, -1, -1, 5, 6, 45, 8, 9, 10, 11,
2103 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2104 22, -1, 24, -1, -1, -1, -1, 105, -1, -1,
2105 108, -1, -1, 111, -1, 113, -1, -1, -1, -1,
2106 -1, 5, 6, 45, 8, 9, 10, 11, 12, 13,
2107 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2108 24, -1, -1, -1, -1, 105, -1, -1, 108, -1,
2109 -1, 111, -1, 113, -1, -1, -1, -1, -1, -1,
2110 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1,
2111 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2112 -1, -1, -1, 105, -1, -1, 108, -1, -1, 111,
2113 -1, 113, -1, -1, -1, -1, -1, -1, -1, -1,
2114 -1, 35, -1, -1, -1, -1, -1, -1, -1, -1,
2115 -1, -1, 46, -1, -1, -1, -1, -1, -1, -1,
2116 -1, 105, 56, 57, 108, -1, -1, 111, -1, 113,
2117 -1, -1, 66, 67, 68, 69, 70, 71, 72, 73,
2118 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2119 84, 85, 86, 87, 88, -1, -1, 91, 92, 93,
2120 94, 95, 96, 97, 98, 99, 100, 101, 102
2123 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2124 symbol of state STATE-NUM. */
2125 static const unsigned char yystos[] =
2127 0, 148, 149, 150, 0, 25, 31, 41, 42, 43,
2128 44, 59, 129, 165, 167, 168, 175, 22, 24, 48,
2129 55, 59, 128, 158, 168, 169, 58, 61, 62, 63,
2130 64, 65, 130, 163, 23, 176, 177, 30, 114, 166,
2131 176, 49, 50, 51, 155, 103, 58, 20, 47, 129,
2132 103, 163, 24, 153, 4, 5, 6, 8, 9, 10,
2133 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2134 21, 45, 105, 108, 111, 113, 118, 137, 138, 139,
2135 140, 141, 158, 172, 29, 113, 164, 128, 180, 103,
2136 103, 103, 108, 156, 153, 137, 32, 33, 147, 147,
2137 4, 4, 4, 8, 114, 141, 142, 158, 106, 115,
2138 35, 46, 56, 57, 66, 67, 68, 69, 70, 71,
2139 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2140 82, 83, 84, 85, 86, 87, 88, 91, 92, 93,
2141 94, 95, 96, 97, 98, 99, 100, 101, 102, 120,
2142 121, 122, 123, 178, 184, 185, 187, 188, 24, 52,
2143 53, 154, 4, 24, 157, 139, 9, 10, 11, 12,
2144 13, 14, 15, 16, 17, 18, 19, 124, 125, 127,
2145 139, 144, 109, 109, 104, 114, 106, 37, 142, 143,
2146 139, 174, 56, 8, 174, 9, 21, 10, 11, 12,
2147 13, 14, 15, 16, 17, 124, 125, 126, 130, 139,
2148 139, 174, 139, 139, 181, 174, 174, 174, 174, 174,
2149 174, 174, 174, 139, 139, 139, 174, 130, 89, 90,
2150 104, 110, 152, 27, 28, 3, 4, 119, 4, 7,
2151 26, 38, 39, 91, 93, 94, 98, 99, 100, 108,
2152 111, 113, 116, 120, 121, 122, 123, 145, 172, 151,
2153 141, 141, 141, 37, 139, 160, 161, 162, 104, 107,
2154 3, 4, 7, 26, 27, 28, 38, 39, 58, 111,
2155 145, 171, 172, 173, 173, 173, 173, 137, 104, 132,
2156 104, 132, 173, 108, 104, 36, 104, 104, 104, 104,
2157 104, 104, 104, 173, 173, 173, 104, 137, 139, 174,
2158 24, 104, 135, 106, 106, 106, 106, 106, 106, 110,
2159 144, 146, 146, 114, 146, 24, 106, 106, 106, 106,
2160 135, 110, 112, 158, 159, 104, 107, 37, 60, 170,
2161 146, 104, 104, 173, 15, 54, 15, 104, 186, 173,
2162 108, 139, 174, 139, 174, 174, 174, 139, 139, 104,
2163 104, 104, 174, 173, 173, 104, 34, 54, 133, 136,
2164 144, 144, 144, 144, 144, 144, 104, 110, 112, 114,
2165 144, 144, 144, 144, 37, 160, 133, 134, 24, 112,
2166 21, 21, 106, 173, 4, 173, 174, 182, 104, 173,
2167 104, 104, 104, 173, 173, 173, 106, 139, 24, 4,
2168 135, 186, 36, 104, 104, 104, 104, 144, 104, 104,
2169 104, 104, 54, 131, 104, 173, 173, 182, 183, 104,
2170 132, 132, 104, 173, 104, 174, 174, 174, 183, 173,
2171 107, 139, 144, 144, 144, 144, 144, 144, 144, 144,
2172 4, 24, 104, 108, 107, 174, 110, 173, 107, 107,
2173 104, 107, 104, 104, 107, 107, 107, 107, 21, 110,
2174 126, 179, 36, 110, 144, 144, 144, 173, 171, 110,
2175 126, 21, 107, 107, 107, 104, 171, 173, 21, 104,
2176 70, 173, 21, 21, 173, 173
2179 #define yyerrok (yyerrstatus = 0)
2180 #define yyclearin (yychar = YYEMPTY)
2181 #define YYEMPTY (-2)
2184 #define YYACCEPT goto yyacceptlab
2185 #define YYABORT goto yyabortlab
2186 #define YYERROR goto yyerrorlab
2189 /* Like YYERROR except do call yyerror. This remains here temporarily
2190 to ease the transition to the new meaning of YYERROR, for GCC.
2191 Once GCC version 2 has supplanted version 1, this can go. */
2193 #define YYFAIL goto yyerrlab
2195 #define YYRECOVERING() (!!yyerrstatus)
2197 #define YYBACKUP(Token, Value) \
2199 if (yychar == YYEMPTY && yylen == 1) \
2203 yytoken = YYTRANSLATE (yychar); \
2209 yyerror (YY_("syntax error: cannot back up")); \
2216 #define YYERRCODE 256
2219 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2220 If N is 0, then set CURRENT to the empty location which ends
2221 the previous symbol: RHS[0] (always defined). */
2223 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2224 #ifndef YYLLOC_DEFAULT
2225 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2229 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2230 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2231 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2232 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2236 (Current).first_line = (Current).last_line = \
2237 YYRHSLOC (Rhs, 0).last_line; \
2238 (Current).first_column = (Current).last_column = \
2239 YYRHSLOC (Rhs, 0).last_column; \
2245 /* YY_LOCATION_PRINT -- Print the location on the stream.
2246 This macro was not mandated originally: define only if we know
2247 we won't break user code: when these are the locations we know. */
2249 #ifndef YY_LOCATION_PRINT
2250 # if YYLTYPE_IS_TRIVIAL
2251 # define YY_LOCATION_PRINT(File, Loc) \
2252 fprintf (File, "%d.%d-%d.%d", \
2253 (Loc).first_line, (Loc).first_column, \
2254 (Loc).last_line, (Loc).last_column)
2256 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2261 /* YYLEX -- calling `yylex' with the right arguments. */
2264 # define YYLEX yylex (YYLEX_PARAM)
2266 # define YYLEX yylex ()
2269 /* Enable debugging if requested. */
2273 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2274 # define YYFPRINTF fprintf
2277 # define YYDPRINTF(Args) \
2283 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2287 YYFPRINTF (stderr, "%s ", Title); \
2288 yysymprint (stderr, \
2290 YYFPRINTF (stderr, "\n"); \
2294 /*------------------------------------------------------------------.
2295 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2297 `------------------------------------------------------------------*/
2299 #if defined (__STDC__) || defined (__cplusplus)
2301 yy_stack_print (short int *bottom, short int *top)
2304 yy_stack_print (bottom, top)
2309 YYFPRINTF (stderr, "Stack now");
2310 for (/* Nothing. */; bottom <= top; ++bottom)
2311 YYFPRINTF (stderr, " %d", *bottom);
2312 YYFPRINTF (stderr, "\n");
2315 # define YY_STACK_PRINT(Bottom, Top) \
2318 yy_stack_print ((Bottom), (Top)); \
2322 /*------------------------------------------------.
2323 | Report that the YYRULE is going to be reduced. |
2324 `------------------------------------------------*/
2326 #if defined (__STDC__) || defined (__cplusplus)
2328 yy_reduce_print (int yyrule)
2331 yy_reduce_print (yyrule)
2336 unsigned long int yylno = yyrline[yyrule];
2337 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2339 /* Print the symbols being reduced, and their result. */
2340 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2341 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2342 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2345 # define YY_REDUCE_PRINT(Rule) \
2348 yy_reduce_print (Rule); \
2351 /* Nonzero means print parse trace. It is left uninitialized so that
2352 multiple parsers can coexist. */
2354 #else /* !YYDEBUG */
2355 # define YYDPRINTF(Args)
2356 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2357 # define YY_STACK_PRINT(Bottom, Top)
2358 # define YY_REDUCE_PRINT(Rule)
2359 #endif /* !YYDEBUG */
2362 /* YYINITDEPTH -- initial size of the parser's stacks. */
2364 # define YYINITDEPTH 200
2367 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2368 if the built-in stack extension method is used).
2370 Do not make this value too large; the results are undefined if
2371 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2372 evaluated with infinite-precision integer arithmetic. */
2375 # define YYMAXDEPTH 10000
2383 # if defined (__GLIBC__) && defined (_STRING_H)
2384 # define yystrlen strlen
2386 /* Return the length of YYSTR. */
2388 # if defined (__STDC__) || defined (__cplusplus)
2389 yystrlen (const char *yystr)
2395 const char *yys = yystr;
2397 while (*yys++ != '\0')
2400 return yys - yystr - 1;
2406 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2407 # define yystpcpy stpcpy
2409 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2412 # if defined (__STDC__) || defined (__cplusplus)
2413 yystpcpy (char *yydest, const char *yysrc)
2415 yystpcpy (yydest, yysrc)
2421 const char *yys = yysrc;
2423 while ((*yyd++ = *yys++) != '\0')
2432 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2433 quotes and backslashes, so that it's suitable for yyerror. The
2434 heuristic is that double-quoting is unnecessary unless the string
2435 contains an apostrophe, a comma, or backslash (other than
2436 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2437 null, do not copy; instead, return the length of what the result
2440 yytnamerr (char *yyres, const char *yystr)
2445 char const *yyp = yystr;
2452 goto do_not_strip_quotes;
2456 goto do_not_strip_quotes;
2469 do_not_strip_quotes: ;
2473 return yystrlen (yystr);
2475 return yystpcpy (yyres, yystr) - yyres;
2479 #endif /* YYERROR_VERBOSE */
2484 /*--------------------------------.
2485 | Print this symbol on YYOUTPUT. |
2486 `--------------------------------*/
2488 #if defined (__STDC__) || defined (__cplusplus)
2490 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2493 yysymprint (yyoutput, yytype, yyvaluep)
2499 /* Pacify ``unused variable'' warnings. */
2502 if (yytype < YYNTOKENS)
2503 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2505 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2509 if (yytype < YYNTOKENS)
2510 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2517 YYFPRINTF (yyoutput, ")");
2520 #endif /* ! YYDEBUG */
2521 /*-----------------------------------------------.
2522 | Release the memory associated to this symbol. |
2523 `-----------------------------------------------*/
2525 #if defined (__STDC__) || defined (__cplusplus)
2527 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2530 yydestruct (yymsg, yytype, yyvaluep)
2536 /* Pacify ``unused variable'' warnings. */
2541 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2552 /* Prevent warnings from -Wmissing-prototypes. */
2554 #ifdef YYPARSE_PARAM
2555 # if defined (__STDC__) || defined (__cplusplus)
2556 int yyparse (void *YYPARSE_PARAM);
2560 #else /* ! YYPARSE_PARAM */
2561 #if defined (__STDC__) || defined (__cplusplus)
2566 #endif /* ! YYPARSE_PARAM */
2570 /* The look-ahead symbol. */
2573 /* The semantic value of the look-ahead symbol. */
2576 /* Number of syntax errors so far. */
2585 #ifdef YYPARSE_PARAM
2586 # if defined (__STDC__) || defined (__cplusplus)
2587 int yyparse (void *YYPARSE_PARAM)
2589 int yyparse (YYPARSE_PARAM)
2590 void *YYPARSE_PARAM;
2592 #else /* ! YYPARSE_PARAM */
2593 #if defined (__STDC__) || defined (__cplusplus)
2607 /* Number of tokens to shift before error messages enabled. */
2609 /* Look-ahead token as an internal (translated) token number. */
2612 /* Three stacks and their tools:
2613 `yyss': related to states,
2614 `yyvs': related to semantic values,
2615 `yyls': related to locations.
2617 Refer to the stacks thru separate pointers, to allow yyoverflow
2618 to reallocate them elsewhere. */
2620 /* The state stack. */
2621 short int yyssa[YYINITDEPTH];
2622 short int *yyss = yyssa;
2625 /* The semantic value stack. */
2626 YYSTYPE yyvsa[YYINITDEPTH];
2627 YYSTYPE *yyvs = yyvsa;
2632 #define YYPOPSTACK (yyvsp--, yyssp--)
2634 YYSIZE_T yystacksize = YYINITDEPTH;
2636 /* The variables used to return semantic value and location from the
2641 /* When reducing, the number of symbols on the RHS of the reduced
2645 YYDPRINTF ((stderr, "Starting parse\n"));
2650 yychar = YYEMPTY; /* Cause a token to be read. */
2652 /* Initialize stack pointers.
2653 Waste one element of value and location stack
2654 so that they stay on the same level as the state stack.
2655 The wasted elements are never initialized. */
2662 /*------------------------------------------------------------.
2663 | yynewstate -- Push a new state, which is found in yystate. |
2664 `------------------------------------------------------------*/
2666 /* In all cases, when you get here, the value and location stacks
2667 have just been pushed. so pushing a state here evens the stacks.
2674 if (yyss + yystacksize - 1 <= yyssp)
2676 /* Get the current used size of the three stacks, in elements. */
2677 YYSIZE_T yysize = yyssp - yyss + 1;
2681 /* Give user a chance to reallocate the stack. Use copies of
2682 these so that the &'s don't force the real ones into
2684 YYSTYPE *yyvs1 = yyvs;
2685 short int *yyss1 = yyss;
2688 /* Each stack pointer address is followed by the size of the
2689 data in use in that stack, in bytes. This used to be a
2690 conditional around just the two extra args, but that might
2691 be undefined if yyoverflow is a macro. */
2692 yyoverflow (YY_("memory exhausted"),
2693 &yyss1, yysize * sizeof (*yyssp),
2694 &yyvs1, yysize * sizeof (*yyvsp),
2701 #else /* no yyoverflow */
2702 # ifndef YYSTACK_RELOCATE
2703 goto yyexhaustedlab;
2705 /* Extend the stack our own way. */
2706 if (YYMAXDEPTH <= yystacksize)
2707 goto yyexhaustedlab;
2709 if (YYMAXDEPTH < yystacksize)
2710 yystacksize = YYMAXDEPTH;
2713 short int *yyss1 = yyss;
2714 union yyalloc *yyptr =
2715 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2717 goto yyexhaustedlab;
2718 YYSTACK_RELOCATE (yyss);
2719 YYSTACK_RELOCATE (yyvs);
2721 # undef YYSTACK_RELOCATE
2723 YYSTACK_FREE (yyss1);
2726 #endif /* no yyoverflow */
2728 yyssp = yyss + yysize - 1;
2729 yyvsp = yyvs + yysize - 1;
2732 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2733 (unsigned long int) yystacksize));
2735 if (yyss + yystacksize - 1 <= yyssp)
2739 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2748 /* Do appropriate processing given the current state. */
2749 /* Read a look-ahead token if we need one and don't already have one. */
2752 /* First try to decide what to do without reference to look-ahead token. */
2754 yyn = yypact[yystate];
2755 if (yyn == YYPACT_NINF)
2758 /* Not known => get a look-ahead token if don't already have one. */
2760 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2761 if (yychar == YYEMPTY)
2763 YYDPRINTF ((stderr, "Reading a token: "));
2767 if (yychar <= YYEOF)
2769 yychar = yytoken = YYEOF;
2770 YYDPRINTF ((stderr, "Now at end of input.\n"));
2774 yytoken = YYTRANSLATE (yychar);
2775 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2778 /* If the proper action on seeing token YYTOKEN is to reduce or to
2779 detect an error, take that action. */
2781 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2786 if (yyn == 0 || yyn == YYTABLE_NINF)
2795 /* Shift the look-ahead token. */
2796 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2798 /* Discard the token being shifted unless it is eof. */
2799 if (yychar != YYEOF)
2805 /* Count tokens shifted since error; after three, turn off error
2814 /*-----------------------------------------------------------.
2815 | yydefault -- do the default action for the current state. |
2816 `-----------------------------------------------------------*/
2818 yyn = yydefact[yystate];
2824 /*-----------------------------.
2825 | yyreduce -- Do a reduction. |
2826 `-----------------------------*/
2828 /* yyn is the number of a rule to reduce with. */
2831 /* If YYLEN is nonzero, implement the default value of the action:
2834 Otherwise, the following line sets YYVAL to garbage.
2835 This behavior is undocumented and Bison
2836 users should not rely upon it. Assigning to YYVAL
2837 unconditionally makes the parser a bit smaller, and it avoids a
2838 GCC warning that YYVAL may be used uninitialized. */
2839 yyval = yyvsp[1-yylen];
2842 YY_REDUCE_PRINT (yyn);
2846 #line 1028 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2848 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
2849 GEN_ERROR("Value too large for type!");
2850 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
2856 #line 1037 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2858 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
2859 GEN_ERROR("Value too large for type!");
2860 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
2866 #line 1061 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2868 (yyval.StrVal) = (yyvsp[-1].StrVal);
2874 #line 1065 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2882 #line 1070 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2883 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
2887 #line 1071 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2888 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
2892 #line 1072 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2893 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
2897 #line 1073 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2898 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
2902 #line 1074 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2903 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
2907 #line 1076 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2908 { (yyval.UIntVal) = CallingConv::C; ;}
2912 #line 1077 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2913 { (yyval.UIntVal) = CallingConv::C; ;}
2917 #line 1078 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2918 { (yyval.UIntVal) = CallingConv::CSRet; ;}
2922 #line 1079 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2923 { (yyval.UIntVal) = CallingConv::Fast; ;}
2927 #line 1080 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2928 { (yyval.UIntVal) = CallingConv::Cold; ;}
2932 #line 1081 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2934 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
2935 GEN_ERROR("Calling conv too large!");
2936 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
2942 #line 1090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2943 { (yyval.UIntVal) = 0; ;}
2947 #line 1091 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2949 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
2950 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
2951 GEN_ERROR("Alignment must be a power of two!");
2957 #line 1097 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2958 { (yyval.UIntVal) = 0; ;}
2962 #line 1098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2964 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
2965 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
2966 GEN_ERROR("Alignment must be a power of two!");
2972 #line 1106 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2974 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
2975 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
2976 GEN_ERROR("Invalid character in section name!");
2977 (yyval.StrVal) = (yyvsp[0].StrVal);
2983 #line 1114 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2984 { (yyval.StrVal) = 0; ;}
2988 #line 1115 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2989 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
2993 #line 1120 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2998 #line 1121 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3003 #line 1122 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3005 CurGV->setSection((yyvsp[0].StrVal));
3006 free((yyvsp[0].StrVal));
3012 #line 1127 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3014 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3015 GEN_ERROR("Alignment must be a power of two!");
3016 CurGV->setAlignment((yyvsp[0].UInt64Val));
3022 #line 1141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3023 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3027 #line 1142 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3028 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3032 #line 1144 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3034 if (!UpRefs.empty())
3035 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3036 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3042 #line 1156 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3044 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3050 #line 1160 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3052 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3058 #line 1164 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3059 { // Named types are also simple types...
3060 (yyval.TypeVal) = new PATypeHolder(getTypeVal((yyvsp[0].ValIDVal)));
3066 #line 1171 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3067 { // Type UpReference
3068 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3069 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3070 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3071 (yyval.TypeVal) = new PATypeHolder(OT);
3072 UR_OUT("New Upreference!\n");
3078 #line 1179 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3079 { // Function derived type?
3080 std::vector<const Type*> Params;
3081 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3082 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3083 Params.push_back(*I);
3084 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3085 if (isVarArg) Params.pop_back();
3087 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3088 delete (yyvsp[-1].TypeList); // Delete the argument list
3089 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3095 #line 1192 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3096 { // Sized array type?
3097 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3098 delete (yyvsp[-1].TypeVal);
3104 #line 1197 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3105 { // Packed array type?
3106 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3107 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3108 GEN_ERROR("Unsigned result not equal to signed result");
3109 if (!ElemTy->isPrimitiveType())
3110 GEN_ERROR("Elemental type of a PackedType must be primitive");
3111 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3112 GEN_ERROR("Vector length should be a power of 2!");
3113 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3114 delete (yyvsp[-1].TypeVal);
3120 #line 1209 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3121 { // Structure type?
3122 std::vector<const Type*> Elements;
3123 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3124 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3125 Elements.push_back(*I);
3127 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3128 delete (yyvsp[-1].TypeList);
3134 #line 1219 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3135 { // Empty structure type?
3136 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3142 #line 1223 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3144 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3145 delete (yyvsp[-1].TypeVal);
3151 #line 1232 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3153 (yyval.TypeList) = new std::list<PATypeHolder>();
3154 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3160 #line 1237 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3162 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3168 #line 1244 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3170 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3176 #line 1248 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3178 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3184 #line 1252 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3186 (yyval.TypeList) = new std::list<PATypeHolder>();
3192 #line 1263 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3193 { // Nonempty unsized arr
3194 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3196 GEN_ERROR("Cannot make array constant with type: '" +
3197 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3198 const Type *ETy = ATy->getElementType();
3199 int NumElements = ATy->getNumElements();
3201 // Verify that we have the correct size...
3202 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3203 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3204 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3205 itostr(NumElements) + "!");
3207 // Verify all elements are correct type!
3208 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3209 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3210 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3211 ETy->getDescription() +"' as required!\nIt is of type '"+
3212 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3215 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3216 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3222 #line 1289 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3224 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3226 GEN_ERROR("Cannot make array constant with type: '" +
3227 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3229 int NumElements = ATy->getNumElements();
3230 if (NumElements != -1 && NumElements != 0)
3231 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3232 " arguments, but has size of " + itostr(NumElements) +"!");
3233 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3234 delete (yyvsp[-2].TypeVal);
3240 #line 1303 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3242 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3244 GEN_ERROR("Cannot make array constant with type: '" +
3245 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3247 int NumElements = ATy->getNumElements();
3248 const Type *ETy = ATy->getElementType();
3249 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3250 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3251 GEN_ERROR("Can't build string constant of size " +
3252 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3253 " when array has size " + itostr(NumElements) + "!");
3254 std::vector<Constant*> Vals;
3255 if (ETy == Type::SByteTy) {
3256 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3257 Vals.push_back(ConstantSInt::get(ETy, *C));
3258 } else if (ETy == Type::UByteTy) {
3259 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3260 C != (unsigned char*)EndStr; ++C)
3261 Vals.push_back(ConstantUInt::get(ETy, *C));
3263 free((yyvsp[0].StrVal));
3264 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3266 free((yyvsp[0].StrVal));
3267 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3268 delete (yyvsp[-2].TypeVal);
3274 #line 1333 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3275 { // Nonempty unsized arr
3276 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3278 GEN_ERROR("Cannot make packed constant with type: '" +
3279 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3280 const Type *ETy = PTy->getElementType();
3281 int NumElements = PTy->getNumElements();
3283 // Verify that we have the correct size...
3284 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3285 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3286 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3287 itostr(NumElements) + "!");
3289 // Verify all elements are correct type!
3290 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3291 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3292 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3293 ETy->getDescription() +"' as required!\nIt is of type '"+
3294 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3297 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3298 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3304 #line 1359 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3306 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3308 GEN_ERROR("Cannot make struct constant with type: '" +
3309 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3311 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3312 GEN_ERROR("Illegal number of initializers for structure type!");
3314 // Check to ensure that constants are compatible with the type initializer!
3315 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3316 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3317 GEN_ERROR("Expected type '" +
3318 STy->getElementType(i)->getDescription() +
3319 "' for element #" + utostr(i) +
3320 " of structure initializer!");
3322 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3323 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3329 #line 1380 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3331 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3333 GEN_ERROR("Cannot make struct constant with type: '" +
3334 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3336 if (STy->getNumContainedTypes() != 0)
3337 GEN_ERROR("Illegal number of initializers for structure type!");
3339 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3340 delete (yyvsp[-2].TypeVal);
3346 #line 1393 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3348 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3350 GEN_ERROR("Cannot make null pointer constant with type: '" +
3351 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3353 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3354 delete (yyvsp[-1].TypeVal);
3360 #line 1403 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3362 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3363 delete (yyvsp[-1].TypeVal);
3369 #line 1408 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3371 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3373 GEN_ERROR("Global const reference must be a pointer type!");
3375 // ConstExprs can exist in the body of a function, thus creating
3376 // GlobalValues whenever they refer to a variable. Because we are in
3377 // the context of a function, getValNonImprovising will search the functions
3378 // symbol table instead of the module symbol table for the global symbol,
3379 // which throws things all off. To get around this, we just tell
3380 // getValNonImprovising that we are at global scope here.
3382 Function *SavedCurFn = CurFun.CurrentFunction;
3383 CurFun.CurrentFunction = 0;
3385 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3387 CurFun.CurrentFunction = SavedCurFn;
3389 // If this is an initializer for a constant pointer, which is referencing a
3390 // (currently) undefined variable, create a stub now that shall be replaced
3391 // in the future with the right type of variable.
3394 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3395 const PointerType *PT = cast<PointerType>(Ty);
3397 // First check to see if the forward references value is already created!
3398 PerModuleInfo::GlobalRefsType::iterator I =
3399 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3401 if (I != CurModule.GlobalRefs.end()) {
3402 V = I->second; // Placeholder already exists, use it...
3403 (yyvsp[0].ValIDVal).destroy();
3406 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3408 // Create the forward referenced global.
3410 if (const FunctionType *FTy =
3411 dyn_cast<FunctionType>(PT->getElementType())) {
3412 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3413 CurModule.CurrentModule);
3415 GV = new GlobalVariable(PT->getElementType(), false,
3416 GlobalValue::ExternalLinkage, 0,
3417 Name, CurModule.CurrentModule);
3420 // Keep track of the fact that we have a forward ref to recycle it
3421 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3426 (yyval.ConstVal) = cast<GlobalValue>(V);
3427 delete (yyvsp[-1].TypeVal); // Free the type handle
3433 #line 1468 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3435 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3436 GEN_ERROR("Mismatched types for constant expression!");
3437 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3438 delete (yyvsp[-1].TypeVal);
3444 #line 1475 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3446 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3447 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3448 GEN_ERROR("Cannot create a null initialized value of this type!");
3449 (yyval.ConstVal) = Constant::getNullValue(Ty);
3450 delete (yyvsp[-1].TypeVal);
3456 #line 1484 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3457 { // integral constants
3458 if (!ConstantSInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3459 GEN_ERROR("Constant value doesn't fit in type!");
3460 (yyval.ConstVal) = ConstantSInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3466 #line 1490 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3467 { // integral constants
3468 if (!ConstantUInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3469 GEN_ERROR("Constant value doesn't fit in type!");
3470 (yyval.ConstVal) = ConstantUInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3476 #line 1496 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3477 { // Boolean constants
3478 (yyval.ConstVal) = ConstantBool::True;
3484 #line 1500 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3485 { // Boolean constants
3486 (yyval.ConstVal) = ConstantBool::False;
3492 #line 1504 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3493 { // Float & Double constants
3494 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3495 GEN_ERROR("Floating point constant invalid for type!!");
3496 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3502 #line 1512 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3504 if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType())
3505 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3506 (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!");
3507 if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType())
3508 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3509 (yyvsp[-1].TypeVal)->get()->getDescription() + "'!");
3510 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3511 delete (yyvsp[-1].TypeVal);
3517 #line 1523 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3519 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3520 GEN_ERROR("GetElementPtr requires a pointer operand!");
3522 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3523 // indices to uint struct indices for compatibility.
3524 generic_gep_type_iterator<std::vector<Value*>::iterator>
3525 GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3526 GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3527 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3528 if (isa<StructType>(*GTI)) // Only change struct indices
3529 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[-1].ValueList))[i]))
3530 if (CUI->getType() == Type::UByteTy)
3531 (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3534 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3536 GEN_ERROR("Index list invalid for constant getelementptr!");
3538 std::vector<Constant*> IdxVec;
3539 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3540 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3541 IdxVec.push_back(C);
3543 GEN_ERROR("Indices to constant getelementptr must be constants!");
3545 delete (yyvsp[-1].ValueList);
3547 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3553 #line 1555 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3555 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3556 GEN_ERROR("Select condition must be of boolean type!");
3557 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3558 GEN_ERROR("Select operand types must match!");
3559 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3565 #line 1563 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3567 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3568 GEN_ERROR("Binary operator types must match!");
3569 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3570 // To retain backward compatibility with these early compilers, we emit a
3571 // cast to the appropriate integer type automatically if we are in the
3572 // broken case. See PR424 for more information.
3573 if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
3574 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3576 const Type *IntPtrTy = 0;
3577 switch (CurModule.CurrentModule->getPointerSize()) {
3578 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
3579 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
3580 default: GEN_ERROR("invalid pointer binary constant expr!");
3582 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
3583 ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
3584 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
3591 #line 1585 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3593 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3594 GEN_ERROR("Logical operator types must match!");
3595 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
3596 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
3597 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
3598 GEN_ERROR("Logical operator requires integral operands!");
3600 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3606 #line 1596 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3608 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3609 GEN_ERROR("setcc operand types must match!");
3610 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3616 #line 1602 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3618 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
3619 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3620 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
3621 GEN_ERROR("Shift constant expression requires integer operand!");
3622 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3628 #line 1610 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3630 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3631 GEN_ERROR("Invalid extractelement operands!");
3632 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3638 #line 1616 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3640 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3641 GEN_ERROR("Invalid insertelement operands!");
3642 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3648 #line 1622 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3650 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3651 GEN_ERROR("Invalid shufflevector operands!");
3652 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3658 #line 1631 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3660 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
3666 #line 1635 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3668 (yyval.ConstVector) = new std::vector<Constant*>();
3669 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
3675 #line 1643 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3676 { (yyval.BoolVal) = false; ;}
3680 #line 1643 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3681 { (yyval.BoolVal) = true; ;}
3685 #line 1653 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3687 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
3688 CurModule.ModuleDone();
3694 #line 1661 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3696 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3697 CurFun.FunctionDone();
3703 #line 1666 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3705 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3711 #line 1670 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3713 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
3719 #line 1674 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3721 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3727 #line 1678 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3729 (yyval.ModuleVal) = CurModule.CurrentModule;
3730 // Emit an error if there are any unresolved types left.
3731 if (!CurModule.LateResolveTypes.empty()) {
3732 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
3733 if (DID.Type == ValID::NameVal) {
3734 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
3736 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
3744 #line 1693 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3746 // Eagerly resolve types. This is not an optimization, this is a
3747 // requirement that is due to the fact that we could have this:
3749 // %list = type { %list * }
3750 // %list = type { %list * } ; repeated type decl
3752 // If types are not resolved eagerly, then the two types will not be
3753 // determined to be the same type!
3755 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
3757 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
3758 // If this is a named type that is not a redefinition, add it to the slot
3760 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
3763 delete (yyvsp[0].TypeVal);
3769 #line 1714 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3770 { // Function prototypes can be in const pool
3776 #line 1717 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3777 { // Asm blocks can be in the const pool
3783 #line 1720 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3785 if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!");
3786 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
3791 #line 1723 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3799 #line 1727 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3801 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
3802 (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
3803 delete (yyvsp[0].TypeVal);
3808 #line 1731 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3816 #line 1735 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3823 #line 1738 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3830 #line 1741 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3836 #line 1745 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3838 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3839 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3840 std::string NewAsm((yyvsp[0].StrVal), EndStr);
3841 free((yyvsp[0].StrVal));
3843 if (AsmSoFar.empty())
3844 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
3846 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
3852 #line 1758 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3853 { (yyval.Endianness) = Module::BigEndian; ;}
3857 #line 1759 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3858 { (yyval.Endianness) = Module::LittleEndian; ;}
3862 #line 1761 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3864 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
3870 #line 1765 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3872 if ((yyvsp[0].UInt64Val) == 32)
3873 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
3874 else if ((yyvsp[0].UInt64Val) == 64)
3875 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
3877 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
3883 #line 1774 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3885 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
3886 free((yyvsp[0].StrVal));
3892 #line 1782 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3894 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
3895 free((yyvsp[0].StrVal));
3901 #line 1787 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3903 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
3904 free((yyvsp[0].StrVal));
3910 #line 1792 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3917 #line 1802 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3918 { (yyval.StrVal) = 0; ;}
3922 #line 1804 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3924 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
3925 GEN_ERROR("void typed arguments are invalid!");
3926 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
3932 #line 1811 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3934 (yyval.ArgList) = (yyvsp[-2].ArgList);
3935 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
3936 delete (yyvsp[0].ArgVal);
3942 #line 1817 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3944 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
3945 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
3946 delete (yyvsp[0].ArgVal);
3952 #line 1824 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3954 (yyval.ArgList) = (yyvsp[0].ArgList);
3960 #line 1828 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3962 (yyval.ArgList) = (yyvsp[-2].ArgList);
3963 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
3964 char*>(new PATypeHolder(Type::VoidTy), 0));
3970 #line 1834 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3972 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
3973 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
3979 #line 1839 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3981 (yyval.ArgList) = 0;
3987 #line 1845 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3989 UnEscapeLexed((yyvsp[-5].StrVal));
3990 std::string FunctionName((yyvsp[-5].StrVal));
3991 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
3993 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
3994 GEN_ERROR("LLVM functions cannot return aggregate types!");
3996 std::vector<const Type*> ParamTypeList;
3997 if ((yyvsp[-3].ArgList)) { // If there are arguments...
3998 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
3999 I != (yyvsp[-3].ArgList)->end(); ++I)
4000 ParamTypeList.push_back(I->first->get());
4003 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4004 if (isVarArg) ParamTypeList.pop_back();
4006 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4007 const PointerType *PFT = PointerType::get(FT);
4008 delete (yyvsp[-6].TypeVal);
4011 if (!FunctionName.empty()) {
4012 ID = ValID::create((char*)FunctionName.c_str());
4014 ID = ValID::create((int)CurModule.Values[PFT].size());
4018 // See if this function was forward referenced. If so, recycle the object.
4019 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4020 // Move the function to the end of the list, from whereever it was
4021 // previously inserted.
4022 Fn = cast<Function>(FWRef);
4023 CurModule.CurrentModule->getFunctionList().remove(Fn);
4024 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4025 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4026 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4027 // If this is the case, either we need to be a forward decl, or it needs
4029 if (!CurFun.isDeclare && !Fn->isExternal())
4030 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4032 // Make sure to strip off any argument names so we can't get conflicts.
4033 if (Fn->isExternal())
4034 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4038 } else { // Not already defined?
4039 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4040 CurModule.CurrentModule);
4041 InsertValue(Fn, CurModule.Values);
4044 CurFun.FunctionStart(Fn);
4045 Fn->setCallingConv((yyvsp[-7].UIntVal));
4046 Fn->setAlignment((yyvsp[0].UIntVal));
4047 if ((yyvsp[-1].StrVal)) {
4048 Fn->setSection((yyvsp[-1].StrVal));
4049 free((yyvsp[-1].StrVal));
4052 // Add all of the arguments we parsed to the function...
4053 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4054 if (isVarArg) { // Nuke the last entry
4055 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4056 "Not a varargs marker!");
4057 delete (yyvsp[-3].ArgList)->back().first;
4058 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4060 Function::arg_iterator ArgIt = Fn->arg_begin();
4061 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4062 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4063 delete I->first; // Delete the typeholder...
4065 setValueName(ArgIt, I->second); // Insert arg into symtab...
4069 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4076 #line 1933 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4078 (yyval.FunctionVal) = CurFun.CurrentFunction;
4080 // Make sure that we keep track of the linkage type even if there was a
4081 // previous "declare".
4082 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4087 #line 1943 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4089 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4095 #line 1948 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4096 { CurFun.isDeclare = true; ;}
4100 #line 1948 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4102 (yyval.FunctionVal) = CurFun.CurrentFunction;
4103 CurFun.FunctionDone();
4109 #line 1958 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4111 (yyval.BoolVal) = false;
4117 #line 1962 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4119 (yyval.BoolVal) = true;
4125 #line 1967 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4126 { // A reference to a direct constant
4127 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4133 #line 1971 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4135 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4141 #line 1975 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4142 { // Perhaps it's an FP constant?
4143 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4149 #line 1979 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4151 (yyval.ValIDVal) = ValID::create(ConstantBool::True);
4157 #line 1983 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4159 (yyval.ValIDVal) = ValID::create(ConstantBool::False);
4165 #line 1987 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4167 (yyval.ValIDVal) = ValID::createNull();
4173 #line 1991 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4175 (yyval.ValIDVal) = ValID::createUndef();
4181 #line 1995 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4182 { // A vector zero constant.
4183 (yyval.ValIDVal) = ValID::createZeroInit();
4189 #line 1999 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4190 { // Nonempty unsized packed vector
4191 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4192 int NumElements = (yyvsp[-1].ConstVector)->size();
4194 PackedType* pt = PackedType::get(ETy, NumElements);
4195 PATypeHolder* PTy = new PATypeHolder(
4203 // Verify all elements are correct type!
4204 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4205 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4206 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4207 ETy->getDescription() +"' as required!\nIt is of type '" +
4208 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4211 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4212 delete PTy; delete (yyvsp[-1].ConstVector);
4218 #line 2024 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4220 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4226 #line 2028 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4228 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4229 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4230 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4231 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4232 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4233 free((yyvsp[-2].StrVal));
4234 free((yyvsp[0].StrVal));
4240 #line 2042 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4241 { // Is it an integer reference...?
4242 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4248 #line 2046 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4249 { // Is it a named reference...?
4250 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4256 #line 2058 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4258 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4264 #line 2063 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4266 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4272 #line 2067 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4273 { // Do not allow functions with 0 basic blocks
4274 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4280 #line 2076 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4282 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4283 InsertValue((yyvsp[0].TermInstVal));
4285 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4286 InsertValue((yyvsp[-2].BasicBlockVal));
4287 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4293 #line 2086 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4295 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4296 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4302 #line 2091 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4304 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4306 // Make sure to move the basic block to the correct location in the
4307 // function, instead of leaving it inserted wherever it was first
4309 Function::BasicBlockListType &BBL =
4310 CurFun.CurrentFunction->getBasicBlockList();
4311 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4317 #line 2102 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4319 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4321 // Make sure to move the basic block to the correct location in the
4322 // function, instead of leaving it inserted wherever it was first
4324 Function::BasicBlockListType &BBL =
4325 CurFun.CurrentFunction->getBasicBlockList();
4326 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4332 #line 2114 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4333 { // Return with a result...
4334 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4340 #line 2118 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4341 { // Return with no result...
4342 (yyval.TermInstVal) = new ReturnInst();
4348 #line 2122 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4349 { // Unconditional Branch...
4350 (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[0].ValIDVal)));
4356 #line 2126 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4358 (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[-3].ValIDVal)), getBBVal((yyvsp[0].ValIDVal)), getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)));
4364 #line 2130 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4366 SwitchInst *S = new SwitchInst(getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)), getBBVal((yyvsp[-3].ValIDVal)), (yyvsp[-1].JumpTable)->size());
4367 (yyval.TermInstVal) = S;
4369 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4370 E = (yyvsp[-1].JumpTable)->end();
4371 for (; I != E; ++I) {
4372 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4373 S->addCase(CI, I->second);
4375 GEN_ERROR("Switch case is constant, but not a simple integer!");
4377 delete (yyvsp[-1].JumpTable);
4383 #line 2145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4385 SwitchInst *S = new SwitchInst(getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)), getBBVal((yyvsp[-2].ValIDVal)), 0);
4386 (yyval.TermInstVal) = S;
4392 #line 2151 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4394 const PointerType *PFTy;
4395 const FunctionType *Ty;
4397 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4398 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4399 // Pull out the types of all of the arguments...
4400 std::vector<const Type*> ParamTypes;
4401 if ((yyvsp[-7].ValueList)) {
4402 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4404 ParamTypes.push_back((*I)->getType());
4407 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4408 if (isVarArg) ParamTypes.pop_back();
4410 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4411 PFTy = PointerType::get(Ty);
4414 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4416 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4417 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4419 // Create the call node...
4420 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4421 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4422 } else { // Has arguments?
4423 // Loop through FunctionType's arguments and ensure they are specified
4426 FunctionType::param_iterator I = Ty->param_begin();
4427 FunctionType::param_iterator E = Ty->param_end();
4428 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4430 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4431 if ((*ArgI)->getType() != *I)
4432 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4433 (*I)->getDescription() + "'!");
4435 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4436 GEN_ERROR("Invalid number of parameters detected!");
4438 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4440 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4442 delete (yyvsp[-10].TypeVal);
4443 delete (yyvsp[-7].ValueList);
4449 #line 2204 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4451 (yyval.TermInstVal) = new UnwindInst();
4457 #line 2208 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4459 (yyval.TermInstVal) = new UnreachableInst();
4465 #line 2215 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4467 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4468 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4470 GEN_ERROR("May only switch on a constant pool value!");
4472 (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[0].ValIDVal))));
4478 #line 2224 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4480 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4481 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4484 GEN_ERROR("May only switch on a constant pool value!");
4486 (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[0].ValIDVal))));
4492 #line 2235 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4494 // Is this definition named?? if so, assign the name...
4495 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4496 InsertValue((yyvsp[0].InstVal));
4497 (yyval.InstVal) = (yyvsp[0].InstVal);
4503 #line 2243 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4504 { // Used for PHI nodes
4505 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4506 (yyval.PHIList)->push_back(std::make_pair(getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)), getBBVal((yyvsp[-1].ValIDVal))));
4507 delete (yyvsp[-5].TypeVal);
4513 #line 2249 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4515 (yyval.PHIList) = (yyvsp[-6].PHIList);
4516 (yyvsp[-6].PHIList)->push_back(std::make_pair(getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)),
4517 getBBVal((yyvsp[-1].ValIDVal))));
4523 #line 2257 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4524 { // Used for call statements, and memory insts...
4525 (yyval.ValueList) = new std::vector<Value*>();
4526 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4532 #line 2262 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4534 (yyval.ValueList) = (yyvsp[-2].ValueList);
4535 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4541 #line 2269 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4542 { (yyval.ValueList) = 0; ;}
4546 #line 2271 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4548 (yyval.BoolVal) = true;
4554 #line 2275 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4556 (yyval.BoolVal) = false;
4562 #line 2282 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4564 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
4565 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
4567 "Arithmetic operator requires integer, FP, or packed operands!");
4568 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem)
4569 GEN_ERROR("Rem not supported on packed types!");
4570 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)), getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)));
4571 if ((yyval.InstVal) == 0)
4572 GEN_ERROR("binary operator returned null!");
4573 delete (yyvsp[-3].TypeVal);
4579 #line 2295 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4581 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
4582 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
4583 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
4584 GEN_ERROR("Logical operator requires integral operands!");
4586 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)), getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)));
4587 if ((yyval.InstVal) == 0)
4588 GEN_ERROR("binary operator returned null!");
4589 delete (yyvsp[-3].TypeVal);
4595 #line 2307 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4597 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
4599 "PackedTypes currently not supported in setcc instructions!");
4601 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)), getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)));
4602 if ((yyval.InstVal) == 0)
4603 GEN_ERROR("binary operator returned null!");
4604 delete (yyvsp[-3].TypeVal);
4610 #line 2318 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4612 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
4613 << " Replacing with 'xor'.\n";
4615 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
4617 GEN_ERROR("Expected integral type for not instruction!");
4619 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
4620 if ((yyval.InstVal) == 0)
4621 GEN_ERROR("Could not create a xor instruction!");
4627 #line 2331 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4629 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
4630 GEN_ERROR("Shift amount must be ubyte!");
4631 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
4632 GEN_ERROR("Shift constant expression requires integer operand!");
4633 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4639 #line 2339 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4641 if (!(yyvsp[0].TypeVal)->get()->isFirstClassType())
4642 GEN_ERROR("cast instruction to a non-primitive type: '" +
4643 (yyvsp[0].TypeVal)->get()->getDescription() + "'!");
4644 (yyval.InstVal) = new CastInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
4645 delete (yyvsp[0].TypeVal);
4651 #line 2347 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4653 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
4654 GEN_ERROR("select condition must be boolean!");
4655 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
4656 GEN_ERROR("select value types should match!");
4657 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4663 #line 2355 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4666 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
4667 delete (yyvsp[0].TypeVal);
4673 #line 2361 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4675 ObsoleteVarArgs = true;
4676 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
4677 Function* NF = CurModule.CurrentModule->
4678 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
4681 //foo = alloca 1 of t
4685 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
4686 CurBB->getInstList().push_back(foo);
4687 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
4688 CurBB->getInstList().push_back(bar);
4689 CurBB->getInstList().push_back(new StoreInst(bar, foo));
4690 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
4691 delete (yyvsp[0].TypeVal);
4697 #line 2381 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4699 ObsoleteVarArgs = true;
4700 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
4701 Function* NF = CurModule.CurrentModule->
4702 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
4704 //b = vanext a, t ->
4705 //foo = alloca 1 of t
4708 //tmp = vaarg foo, t
4710 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
4711 CurBB->getInstList().push_back(foo);
4712 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
4713 CurBB->getInstList().push_back(bar);
4714 CurBB->getInstList().push_back(new StoreInst(bar, foo));
4715 Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
4716 CurBB->getInstList().push_back(tmp);
4717 (yyval.InstVal) = new LoadInst(foo);
4718 delete (yyvsp[0].TypeVal);
4724 #line 2404 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4726 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
4727 GEN_ERROR("Invalid extractelement operands!");
4728 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4734 #line 2410 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4736 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
4737 GEN_ERROR("Invalid insertelement operands!");
4738 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4744 #line 2416 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4746 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
4747 GEN_ERROR("Invalid shufflevector operands!");
4748 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4754 #line 2422 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4756 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
4757 if (!Ty->isFirstClassType())
4758 GEN_ERROR("PHI node operands must be of first class type!");
4759 (yyval.InstVal) = new PHINode(Ty);
4760 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
4761 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
4762 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
4763 GEN_ERROR("All elements of a PHI node must be of the same type!");
4764 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
4765 (yyvsp[0].PHIList)->pop_front();
4767 delete (yyvsp[0].PHIList); // Free the list...
4773 #line 2437 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4775 const PointerType *PFTy;
4776 const FunctionType *Ty;
4778 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
4779 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4780 // Pull out the types of all of the arguments...
4781 std::vector<const Type*> ParamTypes;
4782 if ((yyvsp[-1].ValueList)) {
4783 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
4785 ParamTypes.push_back((*I)->getType());
4788 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4789 if (isVarArg) ParamTypes.pop_back();
4791 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
4792 GEN_ERROR("LLVM functions cannot return aggregate types!");
4794 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
4795 PFTy = PointerType::get(Ty);
4798 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
4800 // Create the call node...
4801 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
4802 // Make sure no arguments is a good thing!
4803 if (Ty->getNumParams() != 0)
4804 GEN_ERROR("No arguments passed to a function that "
4805 "expects arguments!");
4807 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
4808 } else { // Has arguments?
4809 // Loop through FunctionType's arguments and ensure they are specified
4812 FunctionType::param_iterator I = Ty->param_begin();
4813 FunctionType::param_iterator E = Ty->param_end();
4814 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
4816 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4817 if ((*ArgI)->getType() != *I)
4818 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4819 (*I)->getDescription() + "'!");
4821 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4822 GEN_ERROR("Invalid number of parameters detected!");
4824 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
4826 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
4827 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
4828 delete (yyvsp[-4].TypeVal);
4829 delete (yyvsp[-1].ValueList);
4835 #line 2495 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4837 (yyval.InstVal) = (yyvsp[0].InstVal);
4843 #line 2502 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4845 (yyval.ValueList) = (yyvsp[0].ValueList);
4851 #line 2505 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4853 (yyval.ValueList) = new std::vector<Value*>();
4859 #line 2510 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4861 (yyval.BoolVal) = true;
4867 #line 2514 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4869 (yyval.BoolVal) = false;
4875 #line 2521 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4877 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
4878 delete (yyvsp[-1].TypeVal);
4884 #line 2526 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4886 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)), (yyvsp[0].UIntVal));
4887 delete (yyvsp[-4].TypeVal);
4893 #line 2531 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4895 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
4896 delete (yyvsp[-1].TypeVal);
4902 #line 2536 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4904 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)), (yyvsp[0].UIntVal));
4905 delete (yyvsp[-4].TypeVal);
4911 #line 2541 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4913 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
4914 GEN_ERROR("Trying to free nonpointer type " +
4915 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
4916 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
4922 #line 2549 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4924 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
4925 GEN_ERROR("Can't load from nonpointer type: " +
4926 (*(yyvsp[-1].TypeVal))->getDescription());
4927 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
4928 GEN_ERROR("Can't load from pointer of non-first-class type: " +
4929 (*(yyvsp[-1].TypeVal))->getDescription());
4930 (yyval.InstVal) = new LoadInst(getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)), "", (yyvsp[-3].BoolVal));
4931 delete (yyvsp[-1].TypeVal);
4937 #line 2560 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4939 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
4941 GEN_ERROR("Can't store to a nonpointer type: " +
4942 (*(yyvsp[-1].TypeVal))->getDescription());
4943 const Type *ElTy = PT->getElementType();
4944 if (ElTy != (yyvsp[-3].ValueVal)->getType())
4945 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
4946 "' into space of type '" + ElTy->getDescription() + "'!");
4948 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)), (yyvsp[-5].BoolVal));
4949 delete (yyvsp[-1].TypeVal);
4955 #line 2574 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4957 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
4958 GEN_ERROR("getelementptr insn requires pointer operand!");
4960 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
4961 // indices to uint struct indices for compatibility.
4962 generic_gep_type_iterator<std::vector<Value*>::iterator>
4963 GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
4964 GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
4965 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
4966 if (isa<StructType>(*GTI)) // Only change struct indices
4967 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[0].ValueList))[i]))
4968 if (CUI->getType() == Type::UByteTy)
4969 (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
4971 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
4972 GEN_ERROR("Invalid getelementptr indices for type '" +
4973 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
4974 (yyval.InstVal) = new GetElementPtrInst(getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)), *(yyvsp[0].ValueList));
4975 delete (yyvsp[-2].TypeVal); delete (yyvsp[0].ValueList);
4984 /* Line 1126 of yacc.c. */
4985 #line 4986 "llvmAsmParser.tab.c"
4991 YY_STACK_PRINT (yyss, yyssp);
4996 /* Now `shift' the result of the reduction. Determine what state
4997 that goes to, based on the state we popped back to and the rule
4998 number reduced by. */
5002 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5003 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5004 yystate = yytable[yystate];
5006 yystate = yydefgoto[yyn - YYNTOKENS];
5011 /*------------------------------------.
5012 | yyerrlab -- here on detecting error |
5013 `------------------------------------*/
5015 /* If not already recovering from an error, report this error. */
5020 yyn = yypact[yystate];
5022 if (YYPACT_NINF < yyn && yyn < YYLAST)
5024 int yytype = YYTRANSLATE (yychar);
5025 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5026 YYSIZE_T yysize = yysize0;
5028 int yysize_overflow = 0;
5030 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5031 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5035 /* This is so xgettext sees the translatable formats that are
5036 constructed on the fly. */
5037 YY_("syntax error, unexpected %s");
5038 YY_("syntax error, unexpected %s, expecting %s");
5039 YY_("syntax error, unexpected %s, expecting %s or %s");
5040 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5041 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5045 static char const yyunexpected[] = "syntax error, unexpected %s";
5046 static char const yyexpecting[] = ", expecting %s";
5047 static char const yyor[] = " or %s";
5048 char yyformat[sizeof yyunexpected
5049 + sizeof yyexpecting - 1
5050 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5051 * (sizeof yyor - 1))];
5052 char const *yyprefix = yyexpecting;
5054 /* Start YYX at -YYN if negative to avoid negative indexes in
5056 int yyxbegin = yyn < 0 ? -yyn : 0;
5058 /* Stay within bounds of both yycheck and yytname. */
5059 int yychecklim = YYLAST - yyn;
5060 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5063 yyarg[0] = yytname[yytype];
5064 yyfmt = yystpcpy (yyformat, yyunexpected);
5066 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5067 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5069 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5073 yyformat[sizeof yyunexpected - 1] = '\0';
5076 yyarg[yycount++] = yytname[yyx];
5077 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5078 yysize_overflow |= yysize1 < yysize;
5080 yyfmt = yystpcpy (yyfmt, yyprefix);
5084 yyf = YY_(yyformat);
5085 yysize1 = yysize + yystrlen (yyf);
5086 yysize_overflow |= yysize1 < yysize;
5089 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5090 yymsg = (char *) YYSTACK_ALLOC (yysize);
5093 /* Avoid sprintf, as that infringes on the user's name space.
5094 Don't have undefined behavior even if the translation
5095 produced a string with the wrong number of "%s"s. */
5098 while ((*yyp = *yyf))
5100 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5102 yyp += yytnamerr (yyp, yyarg[yyi++]);
5112 YYSTACK_FREE (yymsg);
5116 yyerror (YY_("syntax error"));
5117 goto yyexhaustedlab;
5121 #endif /* YYERROR_VERBOSE */
5122 yyerror (YY_("syntax error"));
5127 if (yyerrstatus == 3)
5129 /* If just tried and failed to reuse look-ahead token after an
5130 error, discard it. */
5132 if (yychar <= YYEOF)
5134 /* Return failure if at end of input. */
5135 if (yychar == YYEOF)
5140 yydestruct ("Error: discarding", yytoken, &yylval);
5145 /* Else will try to reuse look-ahead token after shifting the error
5150 /*---------------------------------------------------.
5151 | yyerrorlab -- error raised explicitly by YYERROR. |
5152 `---------------------------------------------------*/
5155 /* Pacify compilers like GCC when the user code never invokes
5156 YYERROR and the label yyerrorlab therefore never appears in user
5167 /*-------------------------------------------------------------.
5168 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5169 `-------------------------------------------------------------*/
5171 yyerrstatus = 3; /* Each real token shifted decrements this. */
5175 yyn = yypact[yystate];
5176 if (yyn != YYPACT_NINF)
5179 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5187 /* Pop the current state because it cannot handle the error token. */
5192 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5195 YY_STACK_PRINT (yyss, yyssp);
5204 /* Shift the error token. */
5205 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5211 /*-------------------------------------.
5212 | yyacceptlab -- YYACCEPT comes here. |
5213 `-------------------------------------*/
5218 /*-----------------------------------.
5219 | yyabortlab -- YYABORT comes here. |
5220 `-----------------------------------*/
5226 /*-------------------------------------------------.
5227 | yyexhaustedlab -- memory exhaustion comes here. |
5228 `-------------------------------------------------*/
5230 yyerror (YY_("memory exhausted"));
5236 if (yychar != YYEOF && yychar != YYEMPTY)
5237 yydestruct ("Cleanup: discarding lookahead",
5239 while (yyssp != yyss)
5241 yydestruct ("Cleanup: popping",
5242 yystos[*yyssp], yyvsp);
5247 YYSTACK_FREE (yyss);
5253 #line 2598 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5256 void llvm::GenerateError(const std::string &message, int LineNo) {
5257 if (LineNo == -1) LineNo = llvmAsmlineno;
5258 // TODO: column number in exception
5260 TheParseError->setError(CurFilename, message, LineNo);
5264 int yyerror(const char *ErrorMsg) {
5266 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5267 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5268 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5269 if (yychar == YYEMPTY || yychar == 0)
5270 errMsg += "end-of-file.";
5272 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5273 GenerateError(errMsg);