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,
133 X86_STDCALLCC_TOK = 324,
134 X86_FASTCALLCC_TOK = 325,
167 EXTRACTELEMENT = 358,
175 #define ESINT64VAL 258
176 #define EUINT64VAL 259
196 #define STRINGCONSTANT 279
197 #define IMPLEMENTATION 280
198 #define ZEROINITIALIZER 281
209 #define DOTDOTDOT 292
216 #define APPENDING 299
217 #define DLLIMPORT 300
218 #define DLLEXPORT 301
219 #define EXTERN_WEAK 302
226 #define POINTERSIZE 309
235 #define SIDEEFFECT 318
238 #define CSRETCC_TOK 321
239 #define FASTCC_TOK 322
240 #define COLDCC_TOK 323
241 #define X86_STDCALLCC_TOK 324
242 #define X86_FASTCALLCC_TOK 325
248 #define UNREACHABLE 331
268 #define GETELEMENTPTR 351
275 #define EXTRACTELEMENT 358
276 #define INSERTELEMENT 359
277 #define SHUFFLEVECTOR 360
278 #define VAARG_old 361
279 #define VANEXT_old 362
284 /* Copy the first part of user declarations. */
285 #line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
287 #include "ParserInternals.h"
288 #include "llvm/CallingConv.h"
289 #include "llvm/InlineAsm.h"
290 #include "llvm/Instructions.h"
291 #include "llvm/Module.h"
292 #include "llvm/SymbolTable.h"
293 #include "llvm/Assembly/AutoUpgrade.h"
294 #include "llvm/Support/GetElementPtrTypeIterator.h"
295 #include "llvm/ADT/STLExtras.h"
296 #include "llvm/Support/MathExtras.h"
302 // The following is a gross hack. In order to rid the libAsmParser library of
303 // exceptions, we have to have a way of getting the yyparse function to go into
304 // an error situation. So, whenever we want an error to occur, the GenerateError
305 // function (see bottom of file) sets TriggerError. Then, at the end of each
306 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
307 // (a goto) to put YACC in error state. Furthermore, several calls to
308 // GenerateError are made from inside productions and they must simulate the
309 // previous exception behavior by exiting the production immediately. We have
310 // replaced these with the GEN_ERROR macro which calls GeneratError and then
311 // immediately invokes YYERROR. This would be so much cleaner if it was a
312 // recursive descent parser.
313 static bool TriggerError = false;
314 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
315 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
317 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
318 int yylex(); // declaration" of xxx warnings.
322 std::string CurFilename;
324 using namespace llvm;
326 static Module *ParserResult;
328 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
329 // relating to upreferences in the input stream.
331 //#define DEBUG_UPREFS 1
333 #define UR_OUT(X) std::cerr << X
338 #define YYERROR_VERBOSE 1
340 static bool ObsoleteVarArgs;
341 static bool NewVarArgs;
342 static BasicBlock *CurBB;
343 static GlobalVariable *CurGV;
346 // This contains info used when building the body of a function. It is
347 // destroyed when the function is completed.
349 typedef std::vector<Value *> ValueList; // Numbered defs
351 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
352 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
354 static struct PerModuleInfo {
355 Module *CurrentModule;
356 std::map<const Type *, ValueList> Values; // Module level numbered definitions
357 std::map<const Type *,ValueList> LateResolveValues;
358 std::vector<PATypeHolder> Types;
359 std::map<ValID, PATypeHolder> LateResolveTypes;
361 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
362 /// how they were referenced and on which line of the input they came from so
363 /// that we can resolve them later and print error messages as appropriate.
364 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
366 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
367 // references to global values. Global values may be referenced before they
368 // are defined, and if so, the temporary object that they represent is held
369 // here. This is used for forward references of GlobalValues.
371 typedef std::map<std::pair<const PointerType *,
372 ValID>, GlobalValue*> GlobalRefsType;
373 GlobalRefsType GlobalRefs;
376 // If we could not resolve some functions at function compilation time
377 // (calls to functions before they are defined), resolve them now... Types
378 // are resolved when the constant pool has been completely parsed.
380 ResolveDefinitions(LateResolveValues);
384 // Check to make sure that all global value forward references have been
387 if (!GlobalRefs.empty()) {
388 std::string UndefinedReferences = "Unresolved global references exist:\n";
390 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
392 UndefinedReferences += " " + I->first.first->getDescription() + " " +
393 I->first.second.getName() + "\n";
395 GenerateError(UndefinedReferences);
399 // Look for intrinsic functions and CallInst that need to be upgraded
400 for (Module::iterator FI = CurrentModule->begin(),
401 FE = CurrentModule->end(); FI != FE; )
402 UpgradeCallsToIntrinsic(FI++);
404 Values.clear(); // Clear out function local definitions
409 // GetForwardRefForGlobal - Check to see if there is a forward reference
410 // for this global. If so, remove it from the GlobalRefs map and return it.
411 // If not, just return null.
412 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
413 // Check to see if there is a forward reference to this global variable...
414 // if there is, eliminate it and patch the reference to use the new def'n.
415 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
416 GlobalValue *Ret = 0;
417 if (I != GlobalRefs.end()) {
425 static struct PerFunctionInfo {
426 Function *CurrentFunction; // Pointer to current function being created
428 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
429 std::map<const Type*, ValueList> LateResolveValues;
430 bool isDeclare; // Is this function a forward declararation?
431 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
433 /// BBForwardRefs - When we see forward references to basic blocks, keep
434 /// track of them here.
435 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
436 std::vector<BasicBlock*> NumberedBlocks;
439 inline PerFunctionInfo() {
442 Linkage = GlobalValue::ExternalLinkage;
445 inline void FunctionStart(Function *M) {
450 void FunctionDone() {
451 NumberedBlocks.clear();
453 // Any forward referenced blocks left?
454 if (!BBForwardRefs.empty()) {
455 GenerateError("Undefined reference to label " +
456 BBForwardRefs.begin()->first->getName());
460 // Resolve all forward references now.
461 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
463 Values.clear(); // Clear out function local definitions
466 Linkage = GlobalValue::ExternalLinkage;
468 } CurFun; // Info for the current function...
470 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
473 //===----------------------------------------------------------------------===//
474 // Code to handle definitions of all the types
475 //===----------------------------------------------------------------------===//
477 static int InsertValue(Value *V,
478 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
479 if (V->hasName()) return -1; // Is this a numbered definition?
481 // Yes, insert the value into the value table...
482 ValueList &List = ValueTab[V->getType()];
484 return List.size()-1;
487 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
489 case ValID::NumberVal: // Is it a numbered definition?
490 // Module constants occupy the lowest numbered slots...
491 if ((unsigned)D.Num < CurModule.Types.size())
492 return CurModule.Types[(unsigned)D.Num];
494 case ValID::NameVal: // Is it a named definition?
495 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
496 D.destroy(); // Free old strdup'd memory...
501 GenerateError("Internal parser error: Invalid symbol type reference!");
505 // If we reached here, we referenced either a symbol that we don't know about
506 // or an id number that hasn't been read yet. We may be referencing something
507 // forward, so just create an entry to be resolved later and get to it...
509 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
512 if (inFunctionScope()) {
513 if (D.Type == ValID::NameVal) {
514 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
517 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
522 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
523 if (I != CurModule.LateResolveTypes.end())
526 Type *Typ = OpaqueType::get();
527 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
531 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
532 SymbolTable &SymTab =
533 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
534 CurModule.CurrentModule->getSymbolTable();
535 return SymTab.lookup(Ty, Name);
538 // getValNonImprovising - Look up the value specified by the provided type and
539 // the provided ValID. If the value exists and has already been defined, return
540 // it. Otherwise return null.
542 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
543 if (isa<FunctionType>(Ty)) {
544 GenerateError("Functions are not values and "
545 "must be referenced as pointers");
550 case ValID::NumberVal: { // Is it a numbered definition?
551 unsigned Num = (unsigned)D.Num;
553 // Module constants occupy the lowest numbered slots...
554 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
555 if (VI != CurModule.Values.end()) {
556 if (Num < VI->second.size())
557 return VI->second[Num];
558 Num -= VI->second.size();
561 // Make sure that our type is within bounds
562 VI = CurFun.Values.find(Ty);
563 if (VI == CurFun.Values.end()) return 0;
565 // Check that the number is within bounds...
566 if (VI->second.size() <= Num) return 0;
568 return VI->second[Num];
571 case ValID::NameVal: { // Is it a named definition?
572 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
573 if (N == 0) return 0;
575 D.destroy(); // Free old strdup'd memory...
579 // Check to make sure that "Ty" is an integral type, and that our
580 // value will fit into the specified type...
581 case ValID::ConstSIntVal: // Is it a constant pool reference??
582 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
583 GenerateError("Signed integral constant '" +
584 itostr(D.ConstPool64) + "' is invalid for type '" +
585 Ty->getDescription() + "'!");
588 return ConstantSInt::get(Ty, D.ConstPool64);
590 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
591 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
592 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
593 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
594 "' is invalid or out of range!");
596 } else { // This is really a signed reference. Transmogrify.
597 return ConstantSInt::get(Ty, D.ConstPool64);
600 return ConstantUInt::get(Ty, D.UConstPool64);
603 case ValID::ConstFPVal: // Is it a floating point const pool reference?
604 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
605 GenerateError("FP constant invalid for type!!");
608 return ConstantFP::get(Ty, D.ConstPoolFP);
610 case ValID::ConstNullVal: // Is it a null value?
611 if (!isa<PointerType>(Ty)) {
612 GenerateError("Cannot create a a non pointer null!");
615 return ConstantPointerNull::get(cast<PointerType>(Ty));
617 case ValID::ConstUndefVal: // Is it an undef value?
618 return UndefValue::get(Ty);
620 case ValID::ConstZeroVal: // Is it a zero value?
621 return Constant::getNullValue(Ty);
623 case ValID::ConstantVal: // Fully resolved constant?
624 if (D.ConstantValue->getType() != Ty) {
625 GenerateError("Constant expression type different from required type!");
628 return D.ConstantValue;
630 case ValID::InlineAsmVal: { // Inline asm expression
631 const PointerType *PTy = dyn_cast<PointerType>(Ty);
632 const FunctionType *FTy =
633 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
634 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
635 GenerateError("Invalid type for asm constraint string!");
638 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
639 D.IAD->HasSideEffects);
640 D.destroy(); // Free InlineAsmDescriptor.
644 assert(0 && "Unhandled case!");
648 assert(0 && "Unhandled case!");
652 // getVal - This function is identical to getValNonImprovising, except that if a
653 // value is not already defined, it "improvises" by creating a placeholder var
654 // that looks and acts just like the requested variable. When the value is
655 // defined later, all uses of the placeholder variable are replaced with the
658 static Value *getVal(const Type *Ty, const ValID &ID) {
659 if (Ty == Type::LabelTy) {
660 GenerateError("Cannot use a basic block here");
664 // See if the value has already been defined.
665 Value *V = getValNonImprovising(Ty, ID);
667 if (TriggerError) return 0;
669 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
670 GenerateError("Invalid use of a composite type!");
674 // If we reached here, we referenced either a symbol that we don't know about
675 // or an id number that hasn't been read yet. We may be referencing something
676 // forward, so just create an entry to be resolved later and get to it...
678 V = new Argument(Ty);
680 // Remember where this forward reference came from. FIXME, shouldn't we try
681 // to recycle these things??
682 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
685 if (inFunctionScope())
686 InsertValue(V, CurFun.LateResolveValues);
688 InsertValue(V, CurModule.LateResolveValues);
692 /// getBBVal - This is used for two purposes:
693 /// * If isDefinition is true, a new basic block with the specified ID is being
695 /// * If isDefinition is true, this is a reference to a basic block, which may
696 /// or may not be a forward reference.
698 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
699 assert(inFunctionScope() && "Can't get basic block at global scope!");
705 GenerateError("Illegal label reference " + ID.getName());
707 case ValID::NumberVal: // Is it a numbered definition?
708 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
709 CurFun.NumberedBlocks.resize(ID.Num+1);
710 BB = CurFun.NumberedBlocks[ID.Num];
712 case ValID::NameVal: // Is it a named definition?
714 if (Value *N = CurFun.CurrentFunction->
715 getSymbolTable().lookup(Type::LabelTy, Name))
716 BB = cast<BasicBlock>(N);
720 // See if the block has already been defined.
722 // If this is the definition of the block, make sure the existing value was
723 // just a forward reference. If it was a forward reference, there will be
724 // an entry for it in the PlaceHolderInfo map.
725 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
726 // The existing value was a definition, not a forward reference.
727 GenerateError("Redefinition of label " + ID.getName());
731 ID.destroy(); // Free strdup'd memory.
735 // Otherwise this block has not been seen before.
736 BB = new BasicBlock("", CurFun.CurrentFunction);
737 if (ID.Type == ValID::NameVal) {
738 BB->setName(ID.Name);
740 CurFun.NumberedBlocks[ID.Num] = BB;
743 // If this is not a definition, keep track of it so we can use it as a forward
746 // Remember where this forward reference came from.
747 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
749 // The forward declaration could have been inserted anywhere in the
750 // function: insert it into the correct place now.
751 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
752 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
759 //===----------------------------------------------------------------------===//
760 // Code to handle forward references in instructions
761 //===----------------------------------------------------------------------===//
763 // This code handles the late binding needed with statements that reference
764 // values not defined yet... for example, a forward branch, or the PHI node for
767 // This keeps a table (CurFun.LateResolveValues) of all such forward references
768 // and back patchs after we are done.
771 // ResolveDefinitions - If we could not resolve some defs at parsing
772 // time (forward branches, phi functions for loops, etc...) resolve the
776 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
777 std::map<const Type*,ValueList> *FutureLateResolvers) {
778 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
779 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
780 E = LateResolvers.end(); LRI != E; ++LRI) {
781 ValueList &List = LRI->second;
782 while (!List.empty()) {
783 Value *V = List.back();
786 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
787 CurModule.PlaceHolderInfo.find(V);
788 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
790 ValID &DID = PHI->second.first;
792 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
796 V->replaceAllUsesWith(TheRealValue);
798 CurModule.PlaceHolderInfo.erase(PHI);
799 } else if (FutureLateResolvers) {
800 // Functions have their unresolved items forwarded to the module late
802 InsertValue(V, *FutureLateResolvers);
804 if (DID.Type == ValID::NameVal) {
805 GenerateError("Reference to an invalid definition: '" +DID.getName()+
806 "' of type '" + V->getType()->getDescription() + "'",
810 GenerateError("Reference to an invalid definition: #" +
811 itostr(DID.Num) + " of type '" +
812 V->getType()->getDescription() + "'",
820 LateResolvers.clear();
823 // ResolveTypeTo - A brand new type was just declared. This means that (if
824 // name is not null) things referencing Name can be resolved. Otherwise, things
825 // refering to the number can be resolved. Do this now.
827 static void ResolveTypeTo(char *Name, const Type *ToTy) {
829 if (Name) D = ValID::create(Name);
830 else D = ValID::create((int)CurModule.Types.size());
832 std::map<ValID, PATypeHolder>::iterator I =
833 CurModule.LateResolveTypes.find(D);
834 if (I != CurModule.LateResolveTypes.end()) {
835 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
836 CurModule.LateResolveTypes.erase(I);
840 // setValueName - Set the specified value to the name given. The name may be
841 // null potentially, in which case this is a noop. The string passed in is
842 // assumed to be a malloc'd string buffer, and is free'd by this function.
844 static void setValueName(Value *V, char *NameStr) {
846 std::string Name(NameStr); // Copy string
847 free(NameStr); // Free old string
849 if (V->getType() == Type::VoidTy) {
850 GenerateError("Can't assign name '" + Name+"' to value with void type!");
854 assert(inFunctionScope() && "Must be in function scope!");
855 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
856 if (ST.lookup(V->getType(), Name)) {
857 GenerateError("Redefinition of value named '" + Name + "' in the '" +
858 V->getType()->getDescription() + "' type plane!");
867 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
868 /// this is a declaration, otherwise it is a definition.
869 static GlobalVariable *
870 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
871 bool isConstantGlobal, const Type *Ty,
872 Constant *Initializer) {
873 if (isa<FunctionType>(Ty)) {
874 GenerateError("Cannot declare global vars of function type!");
878 const PointerType *PTy = PointerType::get(Ty);
882 Name = NameStr; // Copy string
883 free(NameStr); // Free old string
886 // See if this global value was forward referenced. If so, recycle the
890 ID = ValID::create((char*)Name.c_str());
892 ID = ValID::create((int)CurModule.Values[PTy].size());
895 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
896 // Move the global to the end of the list, from whereever it was
897 // previously inserted.
898 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
899 CurModule.CurrentModule->getGlobalList().remove(GV);
900 CurModule.CurrentModule->getGlobalList().push_back(GV);
901 GV->setInitializer(Initializer);
902 GV->setLinkage(Linkage);
903 GV->setConstant(isConstantGlobal);
904 InsertValue(GV, CurModule.Values);
908 // If this global has a name, check to see if there is already a definition
909 // of this global in the module. If so, merge as appropriate. Note that
910 // this is really just a hack around problems in the CFE. :(
912 // We are a simple redefinition of a value, check to see if it is defined
913 // the same as the old one.
914 if (GlobalVariable *EGV =
915 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
916 // We are allowed to redefine a global variable in two circumstances:
917 // 1. If at least one of the globals is uninitialized or
918 // 2. If both initializers have the same value.
920 if (!EGV->hasInitializer() || !Initializer ||
921 EGV->getInitializer() == Initializer) {
923 // Make sure the existing global version gets the initializer! Make
924 // sure that it also gets marked const if the new version is.
925 if (Initializer && !EGV->hasInitializer())
926 EGV->setInitializer(Initializer);
927 if (isConstantGlobal)
928 EGV->setConstant(true);
929 EGV->setLinkage(Linkage);
933 GenerateError("Redefinition of global variable named '" + Name +
934 "' in the '" + Ty->getDescription() + "' type plane!");
939 // Otherwise there is no existing GV to use, create one now.
941 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
942 CurModule.CurrentModule);
943 InsertValue(GV, CurModule.Values);
947 // setTypeName - Set the specified type to the name given. The name may be
948 // null potentially, in which case this is a noop. The string passed in is
949 // assumed to be a malloc'd string buffer, and is freed by this function.
951 // This function returns true if the type has already been defined, but is
952 // allowed to be redefined in the specified context. If the name is a new name
953 // for the type plane, it is inserted and false is returned.
954 static bool setTypeName(const Type *T, char *NameStr) {
955 assert(!inFunctionScope() && "Can't give types function-local names!");
956 if (NameStr == 0) return false;
958 std::string Name(NameStr); // Copy string
959 free(NameStr); // Free old string
961 // We don't allow assigning names to void type
962 if (T == Type::VoidTy) {
963 GenerateError("Can't assign name '" + Name + "' to the void type!");
967 // Set the type name, checking for conflicts as we do so.
968 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
970 if (AlreadyExists) { // Inserting a name that is already defined???
971 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
972 assert(Existing && "Conflict but no matching type?");
974 // There is only one case where this is allowed: when we are refining an
975 // opaque type. In this case, Existing will be an opaque type.
976 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
977 // We ARE replacing an opaque type!
978 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
982 // Otherwise, this is an attempt to redefine a type. That's okay if
983 // the redefinition is identical to the original. This will be so if
984 // Existing and T point to the same Type object. In this one case we
985 // allow the equivalent redefinition.
986 if (Existing == T) return true; // Yes, it's equal.
988 // Any other kind of (non-equivalent) redefinition is an error.
989 GenerateError("Redefinition of type named '" + Name + "' in the '" +
990 T->getDescription() + "' type plane!");
996 //===----------------------------------------------------------------------===//
997 // Code for handling upreferences in type names...
1000 // TypeContains - Returns true if Ty directly contains E in it.
1002 static bool TypeContains(const Type *Ty, const Type *E) {
1003 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1004 E) != Ty->subtype_end();
1008 struct UpRefRecord {
1009 // NestingLevel - The number of nesting levels that need to be popped before
1010 // this type is resolved.
1011 unsigned NestingLevel;
1013 // LastContainedTy - This is the type at the current binding level for the
1014 // type. Every time we reduce the nesting level, this gets updated.
1015 const Type *LastContainedTy;
1017 // UpRefTy - This is the actual opaque type that the upreference is
1018 // represented with.
1019 OpaqueType *UpRefTy;
1021 UpRefRecord(unsigned NL, OpaqueType *URTy)
1022 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1026 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1027 static std::vector<UpRefRecord> UpRefs;
1029 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1030 /// called. It loops through the UpRefs vector, which is a list of the
1031 /// currently active types. For each type, if the up reference is contained in
1032 /// the newly completed type, we decrement the level count. When the level
1033 /// count reaches zero, the upreferenced type is the type that is passed in:
1034 /// thus we can complete the cycle.
1036 static PATypeHolder HandleUpRefs(const Type *ty) {
1037 // If Ty isn't abstract, or if there are no up-references in it, then there is
1038 // nothing to resolve here.
1039 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1041 PATypeHolder Ty(ty);
1042 UR_OUT("Type '" << Ty->getDescription() <<
1043 "' newly formed. Resolving upreferences.\n" <<
1044 UpRefs.size() << " upreferences active!\n");
1046 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1047 // to zero), we resolve them all together before we resolve them to Ty. At
1048 // the end of the loop, if there is anything to resolve to Ty, it will be in
1050 OpaqueType *TypeToResolve = 0;
1052 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1053 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1054 << UpRefs[i].second->getDescription() << ") = "
1055 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1056 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1057 // Decrement level of upreference
1058 unsigned Level = --UpRefs[i].NestingLevel;
1059 UpRefs[i].LastContainedTy = Ty;
1060 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1061 if (Level == 0) { // Upreference should be resolved!
1062 if (!TypeToResolve) {
1063 TypeToResolve = UpRefs[i].UpRefTy;
1065 UR_OUT(" * Resolving upreference for "
1066 << UpRefs[i].second->getDescription() << "\n";
1067 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1068 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1069 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1070 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1072 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1073 --i; // Do not skip the next element...
1078 if (TypeToResolve) {
1079 UR_OUT(" * Resolving upreference for "
1080 << UpRefs[i].second->getDescription() << "\n";
1081 std::string OldName = TypeToResolve->getDescription());
1082 TypeToResolve->refineAbstractTypeTo(Ty);
1089 // common code from the two 'RunVMAsmParser' functions
1090 static Module* RunParser(Module * M) {
1092 llvmAsmlineno = 1; // Reset the current line number...
1093 ObsoleteVarArgs = false;
1095 CurModule.CurrentModule = M;
1097 // Check to make sure the parser succeeded
1100 delete ParserResult;
1104 // Check to make sure that parsing produced a result
1108 // Reset ParserResult variable while saving its value for the result.
1109 Module *Result = ParserResult;
1112 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1115 if ((F = Result->getNamedFunction("llvm.va_start"))
1116 && F->getFunctionType()->getNumParams() == 0)
1117 ObsoleteVarArgs = true;
1118 if((F = Result->getNamedFunction("llvm.va_copy"))
1119 && F->getFunctionType()->getNumParams() == 1)
1120 ObsoleteVarArgs = true;
1123 if (ObsoleteVarArgs && NewVarArgs) {
1125 "This file is corrupt: it uses both new and old style varargs");
1129 if(ObsoleteVarArgs) {
1130 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1131 if (F->arg_size() != 0) {
1132 GenerateError("Obsolete va_start takes 0 argument!");
1138 //bar = alloca typeof(foo)
1142 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1143 const Type* ArgTy = F->getFunctionType()->getReturnType();
1144 const Type* ArgTyPtr = PointerType::get(ArgTy);
1145 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1146 RetTy, ArgTyPtr, (Type *)0);
1148 while (!F->use_empty()) {
1149 CallInst* CI = cast<CallInst>(F->use_back());
1150 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1151 new CallInst(NF, bar, "", CI);
1152 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1153 CI->replaceAllUsesWith(foo);
1154 CI->getParent()->getInstList().erase(CI);
1156 Result->getFunctionList().erase(F);
1159 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1160 if(F->arg_size() != 1) {
1161 GenerateError("Obsolete va_end takes 1 argument!");
1167 //bar = alloca 1 of typeof(foo)
1169 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1170 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1171 const Type* ArgTyPtr = PointerType::get(ArgTy);
1172 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1173 RetTy, ArgTyPtr, (Type *)0);
1175 while (!F->use_empty()) {
1176 CallInst* CI = cast<CallInst>(F->use_back());
1177 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1178 new StoreInst(CI->getOperand(1), bar, CI);
1179 new CallInst(NF, bar, "", CI);
1180 CI->getParent()->getInstList().erase(CI);
1182 Result->getFunctionList().erase(F);
1185 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1186 if(F->arg_size() != 1) {
1187 GenerateError("Obsolete va_copy takes 1 argument!");
1192 //a = alloca 1 of typeof(foo)
1193 //b = alloca 1 of typeof(foo)
1198 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1199 const Type* ArgTy = F->getFunctionType()->getReturnType();
1200 const Type* ArgTyPtr = PointerType::get(ArgTy);
1201 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1202 RetTy, ArgTyPtr, ArgTyPtr,
1205 while (!F->use_empty()) {
1206 CallInst* CI = cast<CallInst>(F->use_back());
1207 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1208 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1209 new StoreInst(CI->getOperand(1), b, CI);
1210 new CallInst(NF, a, b, "", CI);
1211 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1212 CI->replaceAllUsesWith(foo);
1213 CI->getParent()->getInstList().erase(CI);
1215 Result->getFunctionList().erase(F);
1222 //===----------------------------------------------------------------------===//
1223 // RunVMAsmParser - Define an interface to this parser
1224 //===----------------------------------------------------------------------===//
1226 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1229 CurFilename = Filename;
1230 return RunParser(new Module(CurFilename));
1233 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1234 set_scan_string(AsmString);
1236 CurFilename = "from_memory";
1238 return RunParser(new Module (CurFilename));
1240 return RunParser(M);
1246 /* Enabling traces. */
1251 /* Enabling verbose error messages. */
1252 #ifdef YYERROR_VERBOSE
1253 # undef YYERROR_VERBOSE
1254 # define YYERROR_VERBOSE 1
1256 # define YYERROR_VERBOSE 0
1259 /* Enabling the token table. */
1260 #ifndef YYTOKEN_TABLE
1261 # define YYTOKEN_TABLE 0
1264 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1265 #line 974 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
1266 typedef union YYSTYPE {
1267 llvm::Module *ModuleVal;
1268 llvm::Function *FunctionVal;
1269 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1270 llvm::BasicBlock *BasicBlockVal;
1271 llvm::TerminatorInst *TermInstVal;
1272 llvm::Instruction *InstVal;
1273 llvm::Constant *ConstVal;
1275 const llvm::Type *PrimType;
1276 llvm::PATypeHolder *TypeVal;
1277 llvm::Value *ValueVal;
1279 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1280 std::vector<llvm::Value*> *ValueList;
1281 std::list<llvm::PATypeHolder> *TypeList;
1282 // Represent the RHS of PHI node
1283 std::list<std::pair<llvm::Value*,
1284 llvm::BasicBlock*> > *PHIList;
1285 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1286 std::vector<llvm::Constant*> *ConstVector;
1288 llvm::GlobalValue::LinkageTypes Linkage;
1296 char *StrVal; // This memory is strdup'd!
1297 llvm::ValID ValIDVal; // strdup'd memory maybe!
1299 llvm::Instruction::BinaryOps BinaryOpVal;
1300 llvm::Instruction::TermOps TermOpVal;
1301 llvm::Instruction::MemoryOps MemOpVal;
1302 llvm::Instruction::OtherOps OtherOpVal;
1303 llvm::Module::Endianness Endianness;
1305 /* Line 196 of yacc.c. */
1306 #line 1307 "llvmAsmParser.tab.c"
1307 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1308 # define YYSTYPE_IS_DECLARED 1
1309 # define YYSTYPE_IS_TRIVIAL 1
1314 /* Copy the second part of user declarations. */
1317 /* Line 219 of yacc.c. */
1318 #line 1319 "llvmAsmParser.tab.c"
1320 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1321 # define YYSIZE_T __SIZE_TYPE__
1323 #if ! defined (YYSIZE_T) && defined (size_t)
1324 # define YYSIZE_T size_t
1326 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1327 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1328 # define YYSIZE_T size_t
1330 #if ! defined (YYSIZE_T)
1331 # define YYSIZE_T unsigned int
1337 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1338 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1342 # define YY_(msgid) msgid
1346 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1348 /* The parser invokes alloca or malloc; define the necessary symbols. */
1350 # ifdef YYSTACK_USE_ALLOCA
1351 # if YYSTACK_USE_ALLOCA
1353 # define YYSTACK_ALLOC __builtin_alloca
1355 # define YYSTACK_ALLOC alloca
1356 # if defined (__STDC__) || defined (__cplusplus)
1357 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1358 # define YYINCLUDED_STDLIB_H
1364 # ifdef YYSTACK_ALLOC
1365 /* Pacify GCC's `empty if-body' warning. */
1366 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1367 # ifndef YYSTACK_ALLOC_MAXIMUM
1368 /* The OS might guarantee only one guard page at the bottom of the stack,
1369 and a page size can be as small as 4096 bytes. So we cannot safely
1370 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1371 to allow for a few compiler-allocated temporary stack slots. */
1372 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1375 # define YYSTACK_ALLOC YYMALLOC
1376 # define YYSTACK_FREE YYFREE
1377 # ifndef YYSTACK_ALLOC_MAXIMUM
1378 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1384 # define YYMALLOC malloc
1385 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1386 && (defined (__STDC__) || defined (__cplusplus)))
1387 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1391 # define YYFREE free
1392 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1393 && (defined (__STDC__) || defined (__cplusplus)))
1394 void free (void *); /* INFRINGES ON USER NAME SPACE */
1401 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1404 #if (! defined (yyoverflow) \
1405 && (! defined (__cplusplus) \
1406 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1408 /* A type that is properly aligned for any stack member. */
1415 /* The size of the maximum gap between one aligned stack and the next. */
1416 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1418 /* The size of an array large to enough to hold all stacks, each with
1420 # define YYSTACK_BYTES(N) \
1421 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1422 + YYSTACK_GAP_MAXIMUM)
1424 /* Copy COUNT objects from FROM to TO. The source and destination do
1427 # if defined (__GNUC__) && 1 < __GNUC__
1428 # define YYCOPY(To, From, Count) \
1429 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1431 # define YYCOPY(To, From, Count) \
1435 for (yyi = 0; yyi < (Count); yyi++) \
1436 (To)[yyi] = (From)[yyi]; \
1442 /* Relocate STACK from its old location to the new one. The
1443 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1444 elements in the stack, and YYPTR gives the new location of the
1445 stack. Advance YYPTR to a properly aligned location for the next
1447 # define YYSTACK_RELOCATE(Stack) \
1450 YYSIZE_T yynewbytes; \
1451 YYCOPY (&yyptr->Stack, Stack, yysize); \
1452 Stack = &yyptr->Stack; \
1453 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1454 yyptr += yynewbytes / sizeof (*yyptr); \
1460 #if defined (__STDC__) || defined (__cplusplus)
1461 typedef signed char yysigned_char;
1463 typedef short int yysigned_char;
1466 /* YYFINAL -- State number of the termination state. */
1468 /* YYLAST -- Last index in YYTABLE. */
1471 /* YYNTOKENS -- Number of terminals. */
1472 #define YYNTOKENS 122
1473 /* YYNNTS -- Number of nonterminals. */
1475 /* YYNRULES -- Number of rules. */
1476 #define YYNRULES 251
1477 /* YYNRULES -- Number of states. */
1478 #define YYNSTATES 514
1480 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1481 #define YYUNDEFTOK 2
1482 #define YYMAXUTOK 362
1484 #define YYTRANSLATE(YYX) \
1485 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1487 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1488 static const unsigned char yytranslate[] =
1490 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 111, 112, 120, 2, 109, 2, 2, 2, 2, 2,
1495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1496 116, 108, 117, 2, 2, 2, 2, 2, 2, 2,
1497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1499 2, 113, 110, 115, 2, 2, 2, 2, 2, 121,
1500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1502 114, 2, 2, 118, 2, 119, 2, 2, 2, 2,
1503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1515 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1516 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1517 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1518 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1519 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1520 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1521 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1522 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1523 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1524 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1525 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1530 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1532 static const unsigned short int yyprhs[] =
1534 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1535 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1536 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1537 59, 61, 63, 65, 67, 70, 71, 73, 75, 77,
1538 79, 81, 83, 85, 86, 87, 89, 91, 93, 95,
1539 97, 99, 102, 103, 106, 107, 111, 114, 115, 117,
1540 118, 122, 124, 127, 129, 131, 133, 135, 137, 139,
1541 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1542 161, 163, 165, 167, 169, 172, 177, 183, 189, 193,
1543 196, 199, 201, 205, 207, 211, 213, 214, 219, 223,
1544 227, 232, 237, 241, 244, 247, 250, 253, 256, 259,
1545 262, 265, 268, 271, 278, 284, 293, 300, 307, 314,
1546 321, 328, 337, 346, 350, 352, 354, 356, 358, 361,
1547 364, 369, 372, 374, 379, 382, 387, 388, 396, 397,
1548 405, 406, 414, 415, 423, 427, 432, 433, 435, 437,
1549 439, 443, 447, 451, 455, 459, 461, 462, 464, 466,
1550 468, 469, 472, 476, 478, 480, 484, 486, 487, 496,
1551 498, 500, 504, 506, 508, 511, 512, 514, 516, 517,
1552 522, 523, 525, 527, 529, 531, 533, 535, 537, 539,
1553 541, 545, 547, 553, 555, 557, 559, 561, 564, 567,
1554 570, 574, 577, 578, 580, 583, 586, 590, 600, 610,
1555 619, 633, 635, 637, 644, 650, 653, 660, 668, 670,
1556 674, 676, 677, 680, 682, 688, 694, 700, 703, 708,
1557 713, 720, 725, 730, 735, 740, 747, 754, 757, 765,
1558 767, 770, 771, 773, 774, 778, 785, 789, 796, 799,
1562 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1563 static const short int yyrhs[] =
1565 153, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1566 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81,
1567 -1, 82, -1, 83, -1, 84, -1, 85, -1, 86,
1568 -1, 87, -1, 88, -1, 89, -1, 90, -1, 100,
1569 -1, 101, -1, 16, -1, 14, -1, 12, -1, 10,
1570 -1, 17, -1, 15, -1, 13, -1, 11, -1, 129,
1571 -1, 130, -1, 18, -1, 19, -1, 165, 108, -1,
1572 -1, 41, -1, 42, -1, 43, -1, 44, -1, 45,
1573 -1, 46, -1, 47, -1, -1, -1, 65, -1, 66,
1574 -1, 67, -1, 68, -1, 69, -1, 70, -1, 64,
1575 4, -1, -1, 57, 4, -1, -1, 109, 57, 4,
1576 -1, 34, 24, -1, -1, 138, -1, -1, 109, 141,
1577 140, -1, 138, -1, 57, 4, -1, 144, -1, 8,
1578 -1, 146, -1, 8, -1, 146, -1, 9, -1, 10,
1579 -1, 11, -1, 12, -1, 13, -1, 14, -1, 15,
1580 -1, 16, -1, 17, -1, 18, -1, 19, -1, 20,
1581 -1, 21, -1, 48, -1, 145, -1, 180, -1, 110,
1582 4, -1, 143, 111, 148, 112, -1, 113, 4, 114,
1583 146, 115, -1, 116, 4, 114, 146, 117, -1, 118,
1584 147, 119, -1, 118, 119, -1, 146, 120, -1, 146,
1585 -1, 147, 109, 146, -1, 147, -1, 147, 109, 37,
1586 -1, 37, -1, -1, 144, 113, 151, 115, -1, 144,
1587 113, 115, -1, 144, 121, 24, -1, 144, 116, 151,
1588 117, -1, 144, 118, 151, 119, -1, 144, 118, 119,
1589 -1, 144, 38, -1, 144, 39, -1, 144, 180, -1,
1590 144, 150, -1, 144, 26, -1, 129, 124, -1, 130,
1591 4, -1, 9, 27, -1, 9, 28, -1, 132, 7,
1592 -1, 98, 111, 149, 36, 144, 112, -1, 96, 111,
1593 149, 194, 112, -1, 99, 111, 149, 109, 149, 109,
1594 149, 112, -1, 125, 111, 149, 109, 149, 112, -1,
1595 126, 111, 149, 109, 149, 112, -1, 127, 111, 149,
1596 109, 149, 112, -1, 128, 111, 149, 109, 149, 112,
1597 -1, 103, 111, 149, 109, 149, 112, -1, 104, 111,
1598 149, 109, 149, 109, 149, 112, -1, 105, 111, 149,
1599 109, 149, 109, 149, 112, -1, 151, 109, 149, -1,
1600 149, -1, 32, -1, 33, -1, 154, -1, 154, 174,
1601 -1, 154, 176, -1, 154, 62, 61, 160, -1, 154,
1602 25, -1, 155, -1, 155, 133, 20, 142, -1, 155,
1603 176, -1, 155, 62, 61, 160, -1, -1, 155, 133,
1604 134, 152, 149, 156, 140, -1, -1, 155, 133, 50,
1605 152, 144, 157, 140, -1, -1, 155, 133, 45, 152,
1606 144, 158, 140, -1, -1, 155, 133, 47, 152, 144,
1607 159, 140, -1, 155, 51, 162, -1, 155, 58, 108,
1608 163, -1, -1, 24, -1, 56, -1, 55, -1, 53,
1609 108, 161, -1, 54, 108, 4, -1, 52, 108, 24,
1610 -1, 113, 164, 115, -1, 164, 109, 24, -1, 24,
1611 -1, -1, 22, -1, 24, -1, 165, -1, -1, 144,
1612 166, -1, 168, 109, 167, -1, 167, -1, 168, -1,
1613 168, 109, 37, -1, 37, -1, -1, 135, 142, 165,
1614 111, 169, 112, 139, 136, -1, 29, -1, 118, -1,
1615 134, 170, 171, -1, 30, -1, 119, -1, 183, 173,
1616 -1, -1, 45, -1, 47, -1, -1, 31, 177, 175,
1617 170, -1, -1, 63, -1, 3, -1, 4, -1, 7,
1618 -1, 27, -1, 28, -1, 38, -1, 39, -1, 26,
1619 -1, 116, 151, 117, -1, 150, -1, 61, 178, 24,
1620 109, 24, -1, 123, -1, 165, -1, 180, -1, 179,
1621 -1, 144, 181, -1, 183, 184, -1, 172, 184, -1,
1622 185, 133, 186, -1, 185, 188, -1, -1, 23, -1,
1623 71, 182, -1, 71, 8, -1, 72, 21, 181, -1,
1624 72, 9, 181, 109, 21, 181, 109, 21, 181, -1,
1625 73, 131, 181, 109, 21, 181, 113, 187, 115, -1,
1626 73, 131, 181, 109, 21, 181, 113, 115, -1, 74,
1627 135, 142, 181, 111, 191, 112, 36, 21, 181, 75,
1628 21, 181, -1, 75, -1, 76, -1, 187, 131, 179,
1629 109, 21, 181, -1, 131, 179, 109, 21, 181, -1,
1630 133, 193, -1, 144, 113, 181, 109, 181, 115, -1,
1631 189, 109, 113, 181, 109, 181, 115, -1, 182, -1,
1632 190, 109, 182, -1, 190, -1, -1, 60, 59, -1,
1633 59, -1, 125, 144, 181, 109, 181, -1, 126, 144,
1634 181, 109, 181, -1, 127, 144, 181, 109, 181, -1,
1635 49, 182, -1, 128, 182, 109, 182, -1, 98, 182,
1636 36, 144, -1, 99, 182, 109, 182, 109, 182, -1,
1637 102, 182, 109, 144, -1, 106, 182, 109, 144, -1,
1638 107, 182, 109, 144, -1, 103, 182, 109, 182, -1,
1639 104, 182, 109, 182, 109, 182, -1, 105, 182, 109,
1640 182, 109, 182, -1, 97, 189, -1, 192, 135, 142,
1641 181, 111, 191, 112, -1, 196, -1, 109, 190, -1,
1642 -1, 35, -1, -1, 91, 144, 137, -1, 91, 144,
1643 109, 15, 181, 137, -1, 92, 144, 137, -1, 92,
1644 144, 109, 15, 181, 137, -1, 93, 182, -1, 195,
1645 94, 144, 181, -1, 195, 95, 182, 109, 144, 181,
1646 -1, 96, 144, 181, 194, -1
1649 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1650 static const unsigned short int yyrline[] =
1652 0, 1096, 1096, 1097, 1105, 1106, 1116, 1116, 1116, 1116,
1653 1116, 1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118, 1118,
1654 1120, 1120, 1124, 1124, 1124, 1124, 1125, 1125, 1125, 1125,
1655 1126, 1126, 1127, 1127, 1130, 1134, 1139, 1140, 1141, 1142,
1656 1143, 1144, 1145, 1146, 1148, 1149, 1150, 1151, 1152, 1153,
1657 1154, 1155, 1164, 1165, 1171, 1172, 1180, 1188, 1189, 1194,
1658 1195, 1196, 1201, 1215, 1215, 1216, 1216, 1218, 1228, 1228,
1659 1228, 1228, 1228, 1228, 1228, 1229, 1229, 1229, 1229, 1229,
1660 1229, 1230, 1234, 1238, 1246, 1254, 1267, 1272, 1284, 1294,
1661 1298, 1307, 1312, 1318, 1319, 1323, 1327, 1338, 1364, 1378,
1662 1408, 1434, 1455, 1468, 1478, 1483, 1544, 1551, 1560, 1566,
1663 1572, 1576, 1580, 1588, 1599, 1631, 1639, 1661, 1672, 1678,
1664 1686, 1692, 1698, 1707, 1711, 1719, 1719, 1729, 1737, 1742,
1665 1746, 1750, 1754, 1769, 1791, 1794, 1797, 1797, 1805, 1805,
1666 1813, 1813, 1821, 1821, 1830, 1833, 1836, 1840, 1853, 1854,
1667 1856, 1860, 1869, 1875, 1877, 1882, 1887, 1896, 1896, 1897,
1668 1897, 1899, 1906, 1912, 1919, 1923, 1929, 1934, 1939, 2034,
1669 2034, 2036, 2044, 2044, 2046, 2051, 2052, 2053, 2055, 2055,
1670 2065, 2069, 2074, 2078, 2082, 2086, 2090, 2094, 2098, 2102,
1671 2106, 2131, 2135, 2149, 2153, 2159, 2159, 2165, 2170, 2174,
1672 2183, 2194, 2199, 2211, 2224, 2228, 2232, 2237, 2246, 2265,
1673 2274, 2330, 2334, 2341, 2352, 2365, 2374, 2383, 2393, 2397,
1674 2404, 2404, 2406, 2410, 2415, 2431, 2446, 2460, 2473, 2481,
1675 2489, 2497, 2503, 2523, 2546, 2552, 2558, 2564, 2579, 2638,
1676 2645, 2648, 2653, 2657, 2664, 2669, 2675, 2680, 2686, 2694,
1681 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1682 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1683 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1684 static const char *const yytname[] =
1686 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1687 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1688 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1689 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1690 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1691 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1692 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1693 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1694 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1695 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1696 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1697 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "RET", "BR",
1698 "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "DIV",
1699 "REM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ",
1700 "SETNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1701 "PHI_TOK", "CAST", "SELECT", "SHL", "SHR", "VAARG", "EXTRACTELEMENT",
1702 "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='",
1703 "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1704 "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps",
1705 "LogicalOps", "SetCondOps", "ShiftOps", "SIntType", "UIntType",
1706 "IntType", "FPType", "OptAssign", "OptLinkage", "OptCallingConv",
1707 "OptAlign", "OptCAlign", "SectionString", "OptSection",
1708 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV",
1709 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal",
1710 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList",
1711 "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle",
1712 "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName",
1713 "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1714 "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto",
1715 "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1716 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1717 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1718 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1724 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1726 static const unsigned short int yytoknum[] =
1728 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1729 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1730 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1731 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1732 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1733 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1734 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1735 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1736 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1737 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1738 355, 356, 357, 358, 359, 360, 361, 362, 61, 44,
1739 92, 40, 41, 91, 120, 93, 60, 62, 123, 125,
1744 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1745 static const unsigned char yyr1[] =
1747 0, 122, 123, 123, 124, 124, 125, 125, 125, 125,
1748 125, 126, 126, 126, 127, 127, 127, 127, 127, 127,
1749 128, 128, 129, 129, 129, 129, 130, 130, 130, 130,
1750 131, 131, 132, 132, 133, 133, 134, 134, 134, 134,
1751 134, 134, 134, 134, 135, 135, 135, 135, 135, 135,
1752 135, 135, 136, 136, 137, 137, 138, 139, 139, 140,
1753 140, 141, 141, 142, 142, 143, 143, 144, 145, 145,
1754 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
1755 145, 146, 146, 146, 146, 146, 146, 146, 146, 146,
1756 146, 147, 147, 148, 148, 148, 148, 149, 149, 149,
1757 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
1758 149, 149, 149, 150, 150, 150, 150, 150, 150, 150,
1759 150, 150, 150, 151, 151, 152, 152, 153, 154, 154,
1760 154, 154, 154, 155, 155, 155, 156, 155, 157, 155,
1761 158, 155, 159, 155, 155, 155, 155, 160, 161, 161,
1762 162, 162, 162, 163, 164, 164, 164, 165, 165, 166,
1763 166, 167, 168, 168, 169, 169, 169, 169, 170, 171,
1764 171, 172, 173, 173, 174, 175, 175, 175, 177, 176,
1765 178, 178, 179, 179, 179, 179, 179, 179, 179, 179,
1766 179, 179, 179, 180, 180, 181, 181, 182, 183, 183,
1767 184, 185, 185, 185, 186, 186, 186, 186, 186, 186,
1768 186, 186, 186, 187, 187, 188, 189, 189, 190, 190,
1769 191, 191, 192, 192, 193, 193, 193, 193, 193, 193,
1770 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
1771 194, 194, 195, 195, 196, 196, 196, 196, 196, 196,
1775 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1776 static const unsigned char yyr2[] =
1778 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1779 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1780 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1781 1, 1, 1, 1, 2, 0, 1, 1, 1, 1,
1782 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,
1783 1, 2, 0, 2, 0, 3, 2, 0, 1, 0,
1784 3, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1785 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1786 1, 1, 1, 1, 2, 4, 5, 5, 3, 2,
1787 2, 1, 3, 1, 3, 1, 0, 4, 3, 3,
1788 4, 4, 3, 2, 2, 2, 2, 2, 2, 2,
1789 2, 2, 2, 6, 5, 8, 6, 6, 6, 6,
1790 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1791 4, 2, 1, 4, 2, 4, 0, 7, 0, 7,
1792 0, 7, 0, 7, 3, 4, 0, 1, 1, 1,
1793 3, 3, 3, 3, 3, 1, 0, 1, 1, 1,
1794 0, 2, 3, 1, 1, 3, 1, 0, 8, 1,
1795 1, 3, 1, 1, 2, 0, 1, 1, 0, 4,
1796 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1797 3, 1, 5, 1, 1, 1, 1, 2, 2, 2,
1798 3, 2, 0, 1, 2, 2, 3, 9, 9, 8,
1799 13, 1, 1, 6, 5, 2, 6, 7, 1, 3,
1800 1, 0, 2, 1, 5, 5, 5, 2, 4, 4,
1801 6, 4, 4, 4, 4, 6, 6, 2, 7, 1,
1802 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1806 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1807 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1808 means the default is an error. */
1809 static const unsigned char yydefact[] =
1811 146, 0, 43, 132, 1, 131, 178, 36, 37, 38,
1812 39, 40, 41, 42, 0, 44, 202, 128, 129, 202,
1813 157, 158, 0, 0, 0, 43, 0, 134, 175, 0,
1814 0, 45, 46, 47, 48, 49, 50, 0, 0, 203,
1815 199, 35, 172, 173, 174, 198, 0, 0, 0, 144,
1816 0, 0, 0, 0, 0, 0, 0, 34, 176, 177,
1817 44, 147, 130, 51, 2, 3, 64, 68, 69, 70,
1818 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1819 81, 0, 0, 0, 0, 193, 0, 0, 63, 82,
1820 67, 194, 83, 169, 170, 171, 243, 201, 0, 0,
1821 0, 156, 145, 135, 133, 125, 126, 0, 0, 0,
1822 0, 179, 84, 0, 0, 66, 89, 91, 0, 0,
1823 96, 90, 242, 0, 223, 0, 0, 0, 0, 44,
1824 211, 212, 6, 7, 8, 9, 10, 11, 12, 13,
1825 14, 15, 16, 17, 18, 19, 0, 0, 0, 0,
1826 0, 0, 0, 20, 21, 0, 0, 0, 0, 0,
1827 0, 0, 0, 0, 0, 200, 44, 215, 0, 239,
1828 152, 149, 148, 150, 151, 155, 0, 140, 142, 138,
1829 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1830 78, 0, 0, 0, 0, 136, 0, 0, 0, 88,
1831 167, 95, 93, 0, 0, 227, 222, 205, 204, 0,
1832 0, 25, 29, 24, 28, 23, 27, 22, 26, 30,
1833 31, 0, 0, 54, 54, 248, 0, 0, 237, 0,
1834 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1835 0, 0, 0, 0, 0, 153, 59, 59, 59, 110,
1836 111, 4, 5, 108, 109, 112, 107, 103, 104, 0,
1837 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1838 0, 0, 0, 106, 105, 59, 65, 65, 92, 166,
1839 160, 163, 164, 0, 0, 85, 182, 183, 184, 189,
1840 185, 186, 187, 188, 180, 0, 191, 196, 195, 197,
1841 0, 206, 0, 0, 0, 244, 0, 246, 241, 0,
1842 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1843 0, 0, 0, 0, 0, 0, 154, 0, 141, 143,
1844 139, 0, 0, 0, 0, 0, 0, 98, 124, 0,
1845 0, 102, 0, 99, 0, 0, 0, 0, 137, 86,
1846 87, 159, 161, 0, 57, 94, 181, 0, 0, 0,
1847 0, 0, 0, 0, 0, 0, 251, 0, 0, 229,
1848 0, 231, 234, 0, 0, 232, 233, 0, 0, 0,
1849 228, 0, 249, 0, 0, 0, 61, 59, 241, 0,
1850 0, 0, 0, 0, 0, 97, 100, 101, 0, 0,
1851 0, 0, 165, 162, 58, 52, 0, 190, 0, 0,
1852 221, 54, 55, 54, 218, 240, 0, 0, 0, 0,
1853 0, 224, 225, 226, 221, 0, 56, 62, 60, 0,
1854 0, 0, 0, 0, 0, 123, 0, 0, 0, 0,
1855 0, 168, 0, 0, 0, 220, 0, 0, 245, 247,
1856 0, 0, 0, 230, 235, 236, 0, 250, 114, 0,
1857 0, 0, 0, 0, 0, 0, 0, 0, 53, 192,
1858 0, 0, 0, 219, 216, 0, 238, 113, 0, 120,
1859 0, 0, 116, 117, 118, 119, 0, 209, 0, 0,
1860 0, 217, 0, 0, 0, 207, 0, 208, 0, 0,
1861 115, 121, 122, 0, 0, 0, 0, 0, 0, 214,
1865 /* YYDEFGOTO[NTERM-NUM]. */
1866 static const short int yydefgoto[] =
1868 -1, 85, 253, 269, 270, 271, 272, 191, 192, 221,
1869 193, 25, 15, 37, 441, 305, 386, 405, 328, 387,
1870 86, 87, 194, 89, 90, 118, 203, 338, 296, 339,
1871 107, 1, 2, 3, 275, 248, 246, 247, 62, 173,
1872 49, 102, 176, 91, 352, 281, 282, 283, 38, 95,
1873 16, 44, 17, 60, 18, 28, 357, 297, 92, 299,
1874 414, 19, 40, 41, 165, 489, 97, 228, 445, 446,
1875 166, 167, 366, 168, 169
1878 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1880 #define YYPACT_NINF -428
1881 static const short int yypact[] =
1883 -428, 45, 194, 602, -428, -428, -428, -428, -428, -428,
1884 -428, -428, -428, -428, 26, 14, 85, -428, -428, -13,
1885 -428, -428, 91, 28, 90, 49, 33, -428, 21, 155,
1886 158, -428, -428, -428, -428, -428, -428, 1052, -20, -428,
1887 -428, 80, -428, -428, -428, -428, 75, 76, 79, -428,
1888 73, 155, 1052, 84, 84, 84, 84, -428, -428, -428,
1889 14, -428, -428, -428, -428, -428, 77, -428, -428, -428,
1890 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1891 -428, 185, 187, 191, 569, -428, 80, 86, -428, -428,
1892 -44, -428, -428, -428, -428, -428, 1223, -428, 175, 78,
1893 192, 176, -428, -428, -428, -428, -428, 1093, 1093, 1093,
1894 1134, -428, -428, 87, 88, -428, -428, -44, -95, 92,
1895 847, -428, -428, 1093, -428, 139, 1175, 52, 144, 14,
1896 -428, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1897 -428, -428, -428, -428, -428, -428, 1093, 1093, 1093, 1093,
1898 1093, 1093, 1093, -428, -428, 1093, 1093, 1093, 1093, 1093,
1899 1093, 1093, 1093, 1093, 1093, -428, 14, -428, 44, -428,
1900 -428, -428, -428, -428, -428, -428, -12, -428, -428, -428,
1901 138, 164, 203, 167, 204, 169, 205, 172, 206, 210,
1902 211, 174, 208, 213, 412, -428, 1093, 1093, 1093, -428,
1903 888, -428, 113, 111, 635, -428, -428, 77, -428, 635,
1904 635, -428, -428, -428, -428, -428, -428, -428, -428, -428,
1905 -428, 635, 1052, 115, 117, -428, 635, 114, 119, 212,
1906 140, 141, 142, 145, 146, 148, 149, 635, 635, 635,
1907 150, 1052, 1093, 1093, 223, -428, 151, 151, 151, -428,
1908 -428, -428, -428, -428, -428, -428, -428, -428, -428, 152,
1909 153, 154, 157, 159, 162, 929, 1134, 589, 229, 173,
1910 178, 179, 180, -428, -428, 151, -15, 15, -44, -428,
1911 80, -428, 160, 181, 970, -428, -428, -428, -428, -428,
1912 -428, -428, -428, -428, 198, 1134, -428, -428, -428, -428,
1913 177, -428, 186, 635, -4, -428, 3, -428, 188, 635,
1914 183, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 189,
1915 193, 195, 1093, 635, 635, 197, -428, -11, -428, -428,
1916 -428, 1134, 1134, 1134, 1134, 1134, 1134, -428, -428, -8,
1917 -96, -428, -45, -428, 1134, 1134, 1134, 1134, -428, -428,
1918 -428, -428, -428, 1011, 228, -428, -428, 263, -32, 273,
1919 282, 199, 635, 304, 635, 1093, -428, 200, 635, -428,
1920 214, -428, -428, 215, 216, -428, -428, 635, 635, 635,
1921 -428, 201, -428, 1093, 289, 310, -428, 151, 188, 279,
1922 217, 218, 224, 230, 1134, -428, -428, -428, 231, 232,
1923 233, 234, -428, -428, -428, 281, 238, -428, 635, 635,
1924 1093, 239, -428, 239, -428, 241, 635, 244, 1093, 1093,
1925 1093, -428, -428, -428, 1093, 635, -428, -428, -428, 242,
1926 1093, 1134, 1134, 1134, 1134, -428, 1134, 1134, 1134, 1134,
1927 351, -428, 332, 248, 245, 241, 249, 303, -428, -428,
1928 1093, 251, 635, -428, -428, -428, 252, -428, -428, 255,
1929 260, 258, 265, 266, 268, 272, 276, 277, -428, -428,
1930 356, 16, 336, -428, -428, 275, -428, -428, 1134, -428,
1931 1134, 1134, -428, -428, -428, -428, 635, -428, 738, 25,
1932 370, -428, 280, 284, 285, -428, 290, -428, 738, 635,
1933 -428, -428, -428, 373, 291, 323, 635, 380, 381, -428,
1934 635, 635, -428, -428
1937 /* YYPGOTO[NTERM-NUM]. */
1938 static const short int yypgoto[] =
1940 -428, -428, -428, 307, 308, 309, 311, -127, -126, -427,
1941 -428, 365, 383, -117, -428, -221, 55, -428, -241, -428,
1942 -48, -428, -37, -428, -68, 292, -428, -102, 220, -247,
1943 94, -428, -428, -428, -428, -428, -428, -428, 359, -428,
1944 -428, -428, -428, 2, -428, 58, -428, -428, 355, -428,
1945 -428, -428, -428, -428, 413, -428, -428, -423, -57, 62,
1946 -101, -428, 400, -428, -428, -428, -428, -428, 56, -2,
1947 -428, -428, 32, -428, -428
1950 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1951 positive, shift that token. If negative, reduce the rule which
1952 number is the opposite. If zero, do what YYDEFACT says.
1953 If YYTABLE_NINF, syntax error. */
1954 #define YYTABLE_NINF -128
1955 static const short int yytable[] =
1957 88, 219, 220, 307, 104, 26, 329, 330, 195, 93,
1958 39, 362, 222, 394, 198, 88, 117, 42, 364, 340,
1959 342, 396, 205, 384, 199, 208, 211, 212, 213, 214,
1960 215, 216, 217, 218, 348, 211, 212, 213, 214, 215,
1961 216, 217, 218, 26, 488, 4, 385, 225, 358, 241,
1962 229, 230, 117, 363, 231, 232, 233, 234, 235, 236,
1963 363, 209, 498, 240, 394, 496, 58, -65, 59, 52,
1964 177, 178, 179, 210, 397, 504, 121, 394, 30, 31,
1965 32, 33, 34, 35, 36, 407, 204, 29, 119, 204,
1966 7, 8, 9, 10, 53, 12, 54, 244, 94, 55,
1967 349, 394, 20, 245, 21, 121, 43, 395, 39, 223,
1968 224, 204, 226, 227, 204, 204, 105, 106, 204, 204,
1969 204, 204, 204, 204, 237, 238, 239, 204, 276, 277,
1970 278, 487, 350, 171, 172, 121, 50, 274, 242, 243,
1971 497, 57, 325, 46, 47, 48, 428, 298, 108, 109,
1972 110, 51, 298, 298, 211, 212, 213, 214, 215, 216,
1973 217, 218, 63, 280, 298, 249, 250, -25, -25, 298,
1974 -24, -24, -23, -23, 303, -22, -22, 251, 252, 61,
1975 298, 298, 298, 98, 99, 88, 101, 100, -66, 112,
1976 448, 113, 449, 323, -127, 114, 174, 120, 206, 170,
1977 175, 196, 197, 200, 88, 324, 204, -29, -28, -27,
1978 -26, 370, 254, 372, 373, 374, 278, -32, -33, 5,
1979 255, 380, 284, 285, 304, 6, 306, 309, 310, 388,
1980 389, 390, 391, 392, 393, 7, 8, 9, 10, 11,
1981 12, 13, 398, 399, 400, 401, 298, 326, 311, 312,
1982 313, 314, 298, 343, 315, 316, 14, 317, 318, 322,
1983 327, 356, 384, 331, 332, 333, 298, 298, 334, 353,
1984 335, 300, 301, 336, 369, 204, 371, 204, 204, 204,
1985 375, 376, 351, 302, 344, 204, 359, 406, 308, 345,
1986 346, 347, 435, 354, 408, 360, 368, 365, 377, 319,
1987 320, 321, 378, 409, 379, 298, 383, 298, 412, 416,
1988 410, 298, 424, 426, 427, 430, 280, 453, 454, 455,
1989 298, 298, 298, 418, 419, 420, 431, 432, 204, 460,
1990 461, 462, 463, 433, 464, 465, 466, 467, 440, 434,
1991 436, 437, 438, 439, 219, 220, 425, 442, 447, 473,
1992 450, 298, 298, 452, 458, 468, 469, 470, 471, 298,
1993 363, 472, 219, 220, 476, 361, 474, 477, 298, 478,
1994 479, 367, 490, 204, 480, 481, 492, 486, 493, 494,
1995 482, 204, 204, 204, 483, 381, 382, 204, 484, 485,
1996 491, 499, 500, 459, 506, 298, 501, 502, 508, 503,
1997 507, 510, 511, 161, 162, 163, 96, 164, 56, 404,
1998 103, 403, 202, 204, 273, 111, 27, 64, 65, 45,
1999 429, 415, 456, 0, 411, 0, 413, 0, 0, 298,
2000 417, 0, 0, 0, 20, 0, 21, 0, 256, 421,
2001 422, 423, 298, 0, 0, 0, 0, 0, 0, 298,
2002 257, 258, 0, 298, 298, 0, 0, 0, 0, 0,
2003 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2004 443, 444, 0, 0, 0, 0, 0, 0, 451, 0,
2005 0, 0, 0, 0, 0, 0, 0, 457, 0, 132,
2006 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
2007 143, 144, 145, 0, 0, 0, 0, 0, 259, 0,
2008 260, 261, 153, 154, 475, 262, 263, 264, 0, 0,
2009 0, 0, 0, 0, 0, 265, 0, 0, 266, 0,
2010 267, 0, 0, 268, 0, 0, 0, 0, 0, 0,
2011 0, 0, 0, 0, 0, 0, 0, 0, 495, 0,
2012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2013 0, 505, 0, 0, 0, 0, 0, 0, 509, 0,
2014 0, 0, 512, 513, 64, 65, 0, 115, 67, 68,
2015 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2016 79, 20, 0, 21, 64, 65, 0, 115, 180, 181,
2017 182, 183, 184, 185, 186, 187, 188, 189, 190, 78,
2018 79, 20, 0, 21, 0, 0, 0, 80, 0, 0,
2019 0, 0, -35, 0, 20, 0, 21, 0, 0, 0,
2020 0, 0, 0, 6, -35, -35, 0, 80, 286, 287,
2021 64, 65, 288, -35, -35, -35, -35, -35, -35, -35,
2022 0, 0, -35, 22, 0, 0, 0, 20, 0, 21,
2023 23, 289, 290, 291, 24, 0, 0, 0, 0, 0,
2024 0, 0, 0, 292, 293, 0, 0, 0, 0, 81,
2025 0, 0, 82, 0, 0, 83, 0, 84, 116, 0,
2026 0, 0, 0, 0, 0, 0, 294, 0, 0, 81,
2027 0, 0, 82, 0, 0, 83, 0, 84, 341, 0,
2028 0, 0, 132, 133, 134, 135, 136, 137, 138, 139,
2029 140, 141, 142, 143, 144, 145, 0, 0, 0, 0,
2030 0, 259, 0, 260, 261, 153, 154, 0, 262, 263,
2031 264, 286, 287, 0, 0, 288, 0, 0, 0, 0,
2032 0, 295, 0, 0, 0, 0, 0, 0, 0, 0,
2033 0, 0, 0, 0, 289, 290, 291, 0, 0, 0,
2034 0, 0, 0, 0, 0, 0, 292, 293, 0, 0,
2035 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2036 0, 0, 0, 0, 0, 0, 0, 0, 0, 294,
2037 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2038 0, 0, 0, 0, 0, 132, 133, 134, 135, 136,
2039 137, 138, 139, 140, 141, 142, 143, 144, 145, 0,
2040 0, 0, 0, 0, 259, 0, 260, 261, 153, 154,
2041 0, 262, 263, 264, 0, 0, 0, 0, 0, 0,
2042 0, 0, 64, 65, 295, 115, 67, 68, 69, 70,
2043 71, 72, 73, 74, 75, 76, 77, 78, 79, 20,
2044 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
2045 0, 0, 0, 0, 201, 0, 0, 0, 0, 0,
2046 0, 0, 0, 64, 65, 80, 115, 67, 68, 69,
2047 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2048 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 279, 0, 0, 0, 0,
2050 0, 0, 0, 0, 64, 65, 80, 115, 180, 181,
2051 182, 183, 184, 185, 186, 187, 188, 189, 190, 78,
2052 79, 20, 0, 21, 0, 0, 0, 81, 0, 0,
2053 82, 0, 0, 83, 0, 84, 0, 0, 0, 0,
2054 0, 0, 0, 0, 0, 64, 65, 80, 115, 67,
2055 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2056 78, 79, 20, 0, 21, 0, 0, 0, 81, 0,
2057 0, 82, 0, 0, 83, 0, 84, 355, 0, 0,
2058 0, 0, 0, 0, 0, 0, 64, 65, 80, 115,
2059 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2060 77, 78, 79, 20, 0, 21, 0, 0, 0, 81,
2061 0, 0, 82, 0, 337, 83, 0, 84, 402, 0,
2062 0, 0, 0, 0, 0, 0, 0, 64, 65, 80,
2063 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2064 76, 77, 78, 79, 20, 0, 21, 0, 0, 0,
2065 81, 0, 0, 82, 0, 0, 83, 0, 84, 0,
2066 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2067 80, 115, 67, 68, 69, 70, 71, 72, 73, 74,
2068 75, 76, 77, 78, 79, 20, 0, 21, 0, 0,
2069 0, 81, 0, 0, 82, 0, 0, 83, 0, 84,
2070 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,
2071 65, 80, 115, 180, 181, 182, 183, 184, 185, 186,
2072 187, 188, 189, 190, 78, 79, 20, 0, 21, 0,
2073 0, 0, 81, 0, 0, 82, 0, 0, 83, 0,
2074 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 64, 65, 80, 207, 67, 68, 69, 70, 71, 72,
2076 73, 74, 75, 76, 77, 78, 79, 20, 0, 21,
2077 0, 0, 0, 81, 0, 0, 82, 0, 0, 83,
2078 0, 84, 0, 0, 0, 0, 0, 0, 0, 0,
2079 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
2080 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2081 0, 0, 0, 0, 81, 0, 0, 82, 0, 0,
2082 83, 0, 84, 0, 0, 0, 0, 0, 122, 0,
2083 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2084 0, 0, 123, 0, 0, 0, 0, 0, 0, 0,
2085 0, 0, 124, 125, 0, 81, 0, 0, 82, 0,
2086 0, 83, 0, 84, 126, 127, 128, 129, 130, 131,
2087 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
2088 142, 143, 144, 145, 146, 147, 148, 0, 0, 149,
2089 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
2093 static const short int yycheck[] =
2095 37, 128, 128, 224, 52, 3, 247, 248, 110, 29,
2096 23, 15, 129, 109, 109, 52, 84, 30, 15, 266,
2097 267, 117, 123, 34, 119, 126, 10, 11, 12, 13,
2098 14, 15, 16, 17, 275, 10, 11, 12, 13, 14,
2099 15, 16, 17, 41, 471, 0, 57, 148, 295, 166,
2100 151, 152, 120, 57, 155, 156, 157, 158, 159, 160,
2101 57, 9, 489, 164, 109, 488, 45, 111, 47, 20,
2102 107, 108, 109, 21, 119, 498, 120, 109, 64, 65,
2103 66, 67, 68, 69, 70, 117, 123, 61, 86, 126,
2104 41, 42, 43, 44, 45, 46, 47, 109, 118, 50,
2105 115, 109, 22, 115, 24, 120, 119, 115, 23, 146,
2106 147, 148, 149, 150, 151, 152, 32, 33, 155, 156,
2107 157, 158, 159, 160, 161, 162, 163, 164, 196, 197,
2108 198, 115, 117, 55, 56, 120, 108, 194, 94, 95,
2109 115, 108, 243, 52, 53, 54, 387, 204, 54, 55,
2110 56, 61, 209, 210, 10, 11, 12, 13, 14, 15,
2111 16, 17, 4, 200, 221, 27, 28, 3, 4, 226,
2112 3, 4, 3, 4, 222, 3, 4, 3, 4, 24,
2113 237, 238, 239, 108, 108, 222, 113, 108, 111, 4,
2114 411, 4, 413, 241, 0, 4, 4, 111, 59, 24,
2115 24, 114, 114, 111, 241, 242, 243, 4, 4, 4,
2116 4, 312, 4, 314, 315, 316, 284, 7, 7, 25,
2117 7, 322, 109, 112, 109, 31, 109, 113, 109, 331,
2118 332, 333, 334, 335, 336, 41, 42, 43, 44, 45,
2119 46, 47, 344, 345, 346, 347, 303, 24, 36, 109,
2120 109, 109, 309, 24, 109, 109, 62, 109, 109, 109,
2121 109, 63, 34, 111, 111, 111, 323, 324, 111, 109,
2122 111, 209, 210, 111, 311, 312, 313, 314, 315, 316,
2123 317, 318, 280, 221, 111, 322, 109, 24, 226, 111,
2124 111, 111, 394, 112, 21, 109, 113, 109, 109, 237,
2125 238, 239, 109, 21, 109, 362, 109, 364, 4, 109,
2126 111, 368, 111, 24, 4, 36, 353, 418, 419, 420,
2127 377, 378, 379, 109, 109, 109, 109, 109, 365, 431,
2128 432, 433, 434, 109, 436, 437, 438, 439, 57, 109,
2129 109, 109, 109, 109, 471, 471, 383, 109, 109, 450,
2130 109, 408, 409, 109, 112, 4, 24, 109, 113, 416,
2131 57, 112, 489, 489, 112, 303, 115, 112, 425, 109,
2132 112, 309, 36, 410, 109, 109, 478, 21, 480, 481,
2133 112, 418, 419, 420, 112, 323, 324, 424, 112, 112,
2134 115, 21, 112, 430, 21, 452, 112, 112, 75, 109,
2135 109, 21, 21, 96, 96, 96, 41, 96, 25, 354,
2136 51, 353, 120, 450, 194, 60, 3, 5, 6, 19,
2137 388, 365, 424, -1, 362, -1, 364, -1, -1, 486,
2138 368, -1, -1, -1, 22, -1, 24, -1, 26, 377,
2139 378, 379, 499, -1, -1, -1, -1, -1, -1, 506,
2140 38, 39, -1, 510, 511, -1, -1, -1, -1, -1,
2141 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2142 408, 409, -1, -1, -1, -1, -1, -1, 416, -1,
2143 -1, -1, -1, -1, -1, -1, -1, 425, -1, 77,
2144 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2145 88, 89, 90, -1, -1, -1, -1, -1, 96, -1,
2146 98, 99, 100, 101, 452, 103, 104, 105, -1, -1,
2147 -1, -1, -1, -1, -1, 113, -1, -1, 116, -1,
2148 118, -1, -1, 121, -1, -1, -1, -1, -1, -1,
2149 -1, -1, -1, -1, -1, -1, -1, -1, 486, -1,
2150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2151 -1, 499, -1, -1, -1, -1, -1, -1, 506, -1,
2152 -1, -1, 510, 511, 5, 6, -1, 8, 9, 10,
2153 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2154 21, 22, -1, 24, 5, 6, -1, 8, 9, 10,
2155 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2156 21, 22, -1, 24, -1, -1, -1, 48, -1, -1,
2157 -1, -1, 20, -1, 22, -1, 24, -1, -1, -1,
2158 -1, -1, -1, 31, 32, 33, -1, 48, 3, 4,
2159 5, 6, 7, 41, 42, 43, 44, 45, 46, 47,
2160 -1, -1, 50, 51, -1, -1, -1, 22, -1, 24,
2161 58, 26, 27, 28, 62, -1, -1, -1, -1, -1,
2162 -1, -1, -1, 38, 39, -1, -1, -1, -1, 110,
2163 -1, -1, 113, -1, -1, 116, -1, 118, 119, -1,
2164 -1, -1, -1, -1, -1, -1, 61, -1, -1, 110,
2165 -1, -1, 113, -1, -1, 116, -1, 118, 119, -1,
2166 -1, -1, 77, 78, 79, 80, 81, 82, 83, 84,
2167 85, 86, 87, 88, 89, 90, -1, -1, -1, -1,
2168 -1, 96, -1, 98, 99, 100, 101, -1, 103, 104,
2169 105, 3, 4, -1, -1, 7, -1, -1, -1, -1,
2170 -1, 116, -1, -1, -1, -1, -1, -1, -1, -1,
2171 -1, -1, -1, -1, 26, 27, 28, -1, -1, -1,
2172 -1, -1, -1, -1, -1, -1, 38, 39, -1, -1,
2173 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2174 -1, -1, -1, -1, -1, -1, -1, -1, -1, 61,
2175 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2176 -1, -1, -1, -1, -1, 77, 78, 79, 80, 81,
2177 82, 83, 84, 85, 86, 87, 88, 89, 90, -1,
2178 -1, -1, -1, -1, 96, -1, 98, 99, 100, 101,
2179 -1, 103, 104, 105, -1, -1, -1, -1, -1, -1,
2180 -1, -1, 5, 6, 116, 8, 9, 10, 11, 12,
2181 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2182 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2183 -1, -1, -1, -1, 37, -1, -1, -1, -1, -1,
2184 -1, -1, -1, 5, 6, 48, 8, 9, 10, 11,
2185 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2186 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
2187 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
2188 -1, -1, -1, -1, 5, 6, 48, 8, 9, 10,
2189 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2190 21, 22, -1, 24, -1, -1, -1, 110, -1, -1,
2191 113, -1, -1, 116, -1, 118, -1, -1, -1, -1,
2192 -1, -1, -1, -1, -1, 5, 6, 48, 8, 9,
2193 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2194 20, 21, 22, -1, 24, -1, -1, -1, 110, -1,
2195 -1, 113, -1, -1, 116, -1, 118, 37, -1, -1,
2196 -1, -1, -1, -1, -1, -1, 5, 6, 48, 8,
2197 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2198 19, 20, 21, 22, -1, 24, -1, -1, -1, 110,
2199 -1, -1, 113, -1, 115, 116, -1, 118, 37, -1,
2200 -1, -1, -1, -1, -1, -1, -1, 5, 6, 48,
2201 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2202 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2203 110, -1, -1, 113, -1, -1, 116, -1, 118, -1,
2204 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2205 48, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2206 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2207 -1, 110, -1, -1, 113, -1, -1, 116, -1, 118,
2208 -1, -1, -1, -1, -1, -1, -1, -1, -1, 5,
2209 6, 48, 8, 9, 10, 11, 12, 13, 14, 15,
2210 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2211 -1, -1, 110, -1, -1, 113, -1, -1, 116, -1,
2212 118, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2213 5, 6, 48, 8, 9, 10, 11, 12, 13, 14,
2214 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2215 -1, -1, -1, 110, -1, -1, 113, -1, -1, 116,
2216 -1, 118, -1, -1, -1, -1, -1, -1, -1, -1,
2217 -1, -1, -1, 48, -1, -1, -1, -1, -1, -1,
2218 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2219 -1, -1, -1, -1, 110, -1, -1, 113, -1, -1,
2220 116, -1, 118, -1, -1, -1, -1, -1, 35, -1,
2221 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2222 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2223 -1, -1, 59, 60, -1, 110, -1, -1, 113, -1,
2224 -1, 116, -1, 118, 71, 72, 73, 74, 75, 76,
2225 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2226 87, 88, 89, 90, 91, 92, 93, -1, -1, 96,
2227 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2231 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2232 symbol of state STATE-NUM. */
2233 static const unsigned char yystos[] =
2235 0, 153, 154, 155, 0, 25, 31, 41, 42, 43,
2236 44, 45, 46, 47, 62, 134, 172, 174, 176, 183,
2237 22, 24, 51, 58, 62, 133, 165, 176, 177, 61,
2238 64, 65, 66, 67, 68, 69, 70, 135, 170, 23,
2239 184, 185, 30, 119, 173, 184, 52, 53, 54, 162,
2240 108, 61, 20, 45, 47, 50, 134, 108, 45, 47,
2241 175, 24, 160, 4, 5, 6, 8, 9, 10, 11,
2242 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2243 48, 110, 113, 116, 118, 123, 142, 143, 144, 145,
2244 146, 165, 180, 29, 118, 171, 133, 188, 108, 108,
2245 108, 113, 163, 160, 142, 32, 33, 152, 152, 152,
2246 152, 170, 4, 4, 4, 8, 119, 146, 147, 165,
2247 111, 120, 35, 49, 59, 60, 71, 72, 73, 74,
2248 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2249 85, 86, 87, 88, 89, 90, 91, 92, 93, 96,
2250 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2251 107, 125, 126, 127, 128, 186, 192, 193, 195, 196,
2252 24, 55, 56, 161, 4, 24, 164, 144, 144, 144,
2253 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2254 19, 129, 130, 132, 144, 149, 114, 114, 109, 119,
2255 111, 37, 147, 148, 144, 182, 59, 8, 182, 9,
2256 21, 10, 11, 12, 13, 14, 15, 16, 17, 129,
2257 130, 131, 135, 144, 144, 182, 144, 144, 189, 182,
2258 182, 182, 182, 182, 182, 182, 182, 144, 144, 144,
2259 182, 135, 94, 95, 109, 115, 158, 159, 157, 27,
2260 28, 3, 4, 124, 4, 7, 26, 38, 39, 96,
2261 98, 99, 103, 104, 105, 113, 116, 118, 121, 125,
2262 126, 127, 128, 150, 180, 156, 146, 146, 146, 37,
2263 144, 167, 168, 169, 109, 112, 3, 4, 7, 26,
2264 27, 28, 38, 39, 61, 116, 150, 179, 180, 181,
2265 181, 181, 181, 142, 109, 137, 109, 137, 181, 113,
2266 109, 36, 109, 109, 109, 109, 109, 109, 109, 181,
2267 181, 181, 109, 142, 144, 182, 24, 109, 140, 140,
2268 140, 111, 111, 111, 111, 111, 111, 115, 149, 151,
2269 151, 119, 151, 24, 111, 111, 111, 111, 140, 115,
2270 117, 165, 166, 109, 112, 37, 63, 178, 151, 109,
2271 109, 181, 15, 57, 15, 109, 194, 181, 113, 144,
2272 182, 144, 182, 182, 182, 144, 144, 109, 109, 109,
2273 182, 181, 181, 109, 34, 57, 138, 141, 149, 149,
2274 149, 149, 149, 149, 109, 115, 117, 119, 149, 149,
2275 149, 149, 37, 167, 138, 139, 24, 117, 21, 21,
2276 111, 181, 4, 181, 182, 190, 109, 181, 109, 109,
2277 109, 181, 181, 181, 111, 144, 24, 4, 140, 194,
2278 36, 109, 109, 109, 109, 149, 109, 109, 109, 109,
2279 57, 136, 109, 181, 181, 190, 191, 109, 137, 137,
2280 109, 181, 109, 182, 182, 182, 191, 181, 112, 144,
2281 149, 149, 149, 149, 149, 149, 149, 149, 4, 24,
2282 109, 113, 112, 182, 115, 181, 112, 112, 109, 112,
2283 109, 109, 112, 112, 112, 112, 21, 115, 131, 187,
2284 36, 115, 149, 149, 149, 181, 179, 115, 131, 21,
2285 112, 112, 112, 109, 179, 181, 21, 109, 75, 181,
2289 #define yyerrok (yyerrstatus = 0)
2290 #define yyclearin (yychar = YYEMPTY)
2291 #define YYEMPTY (-2)
2294 #define YYACCEPT goto yyacceptlab
2295 #define YYABORT goto yyabortlab
2296 #define YYERROR goto yyerrorlab
2299 /* Like YYERROR except do call yyerror. This remains here temporarily
2300 to ease the transition to the new meaning of YYERROR, for GCC.
2301 Once GCC version 2 has supplanted version 1, this can go. */
2303 #define YYFAIL goto yyerrlab
2305 #define YYRECOVERING() (!!yyerrstatus)
2307 #define YYBACKUP(Token, Value) \
2309 if (yychar == YYEMPTY && yylen == 1) \
2313 yytoken = YYTRANSLATE (yychar); \
2319 yyerror (YY_("syntax error: cannot back up")); \
2326 #define YYERRCODE 256
2329 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2330 If N is 0, then set CURRENT to the empty location which ends
2331 the previous symbol: RHS[0] (always defined). */
2333 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2334 #ifndef YYLLOC_DEFAULT
2335 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2339 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2340 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2341 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2342 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2346 (Current).first_line = (Current).last_line = \
2347 YYRHSLOC (Rhs, 0).last_line; \
2348 (Current).first_column = (Current).last_column = \
2349 YYRHSLOC (Rhs, 0).last_column; \
2355 /* YY_LOCATION_PRINT -- Print the location on the stream.
2356 This macro was not mandated originally: define only if we know
2357 we won't break user code: when these are the locations we know. */
2359 #ifndef YY_LOCATION_PRINT
2360 # if YYLTYPE_IS_TRIVIAL
2361 # define YY_LOCATION_PRINT(File, Loc) \
2362 fprintf (File, "%d.%d-%d.%d", \
2363 (Loc).first_line, (Loc).first_column, \
2364 (Loc).last_line, (Loc).last_column)
2366 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2371 /* YYLEX -- calling `yylex' with the right arguments. */
2374 # define YYLEX yylex (YYLEX_PARAM)
2376 # define YYLEX yylex ()
2379 /* Enable debugging if requested. */
2383 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2384 # define YYFPRINTF fprintf
2387 # define YYDPRINTF(Args) \
2393 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2397 YYFPRINTF (stderr, "%s ", Title); \
2398 yysymprint (stderr, \
2400 YYFPRINTF (stderr, "\n"); \
2404 /*------------------------------------------------------------------.
2405 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2407 `------------------------------------------------------------------*/
2409 #if defined (__STDC__) || defined (__cplusplus)
2411 yy_stack_print (short int *bottom, short int *top)
2414 yy_stack_print (bottom, top)
2419 YYFPRINTF (stderr, "Stack now");
2420 for (/* Nothing. */; bottom <= top; ++bottom)
2421 YYFPRINTF (stderr, " %d", *bottom);
2422 YYFPRINTF (stderr, "\n");
2425 # define YY_STACK_PRINT(Bottom, Top) \
2428 yy_stack_print ((Bottom), (Top)); \
2432 /*------------------------------------------------.
2433 | Report that the YYRULE is going to be reduced. |
2434 `------------------------------------------------*/
2436 #if defined (__STDC__) || defined (__cplusplus)
2438 yy_reduce_print (int yyrule)
2441 yy_reduce_print (yyrule)
2446 unsigned long int yylno = yyrline[yyrule];
2447 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2449 /* Print the symbols being reduced, and their result. */
2450 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2451 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2452 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2455 # define YY_REDUCE_PRINT(Rule) \
2458 yy_reduce_print (Rule); \
2461 /* Nonzero means print parse trace. It is left uninitialized so that
2462 multiple parsers can coexist. */
2464 #else /* !YYDEBUG */
2465 # define YYDPRINTF(Args)
2466 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2467 # define YY_STACK_PRINT(Bottom, Top)
2468 # define YY_REDUCE_PRINT(Rule)
2469 #endif /* !YYDEBUG */
2472 /* YYINITDEPTH -- initial size of the parser's stacks. */
2474 # define YYINITDEPTH 200
2477 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2478 if the built-in stack extension method is used).
2480 Do not make this value too large; the results are undefined if
2481 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2482 evaluated with infinite-precision integer arithmetic. */
2485 # define YYMAXDEPTH 10000
2493 # if defined (__GLIBC__) && defined (_STRING_H)
2494 # define yystrlen strlen
2496 /* Return the length of YYSTR. */
2498 # if defined (__STDC__) || defined (__cplusplus)
2499 yystrlen (const char *yystr)
2505 const char *yys = yystr;
2507 while (*yys++ != '\0')
2510 return yys - yystr - 1;
2516 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2517 # define yystpcpy stpcpy
2519 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2522 # if defined (__STDC__) || defined (__cplusplus)
2523 yystpcpy (char *yydest, const char *yysrc)
2525 yystpcpy (yydest, yysrc)
2531 const char *yys = yysrc;
2533 while ((*yyd++ = *yys++) != '\0')
2542 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2543 quotes and backslashes, so that it's suitable for yyerror. The
2544 heuristic is that double-quoting is unnecessary unless the string
2545 contains an apostrophe, a comma, or backslash (other than
2546 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2547 null, do not copy; instead, return the length of what the result
2550 yytnamerr (char *yyres, const char *yystr)
2555 char const *yyp = yystr;
2562 goto do_not_strip_quotes;
2566 goto do_not_strip_quotes;
2579 do_not_strip_quotes: ;
2583 return yystrlen (yystr);
2585 return yystpcpy (yyres, yystr) - yyres;
2589 #endif /* YYERROR_VERBOSE */
2594 /*--------------------------------.
2595 | Print this symbol on YYOUTPUT. |
2596 `--------------------------------*/
2598 #if defined (__STDC__) || defined (__cplusplus)
2600 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2603 yysymprint (yyoutput, yytype, yyvaluep)
2609 /* Pacify ``unused variable'' warnings. */
2612 if (yytype < YYNTOKENS)
2613 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2615 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2619 if (yytype < YYNTOKENS)
2620 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2627 YYFPRINTF (yyoutput, ")");
2630 #endif /* ! YYDEBUG */
2631 /*-----------------------------------------------.
2632 | Release the memory associated to this symbol. |
2633 `-----------------------------------------------*/
2635 #if defined (__STDC__) || defined (__cplusplus)
2637 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2640 yydestruct (yymsg, yytype, yyvaluep)
2646 /* Pacify ``unused variable'' warnings. */
2651 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2662 /* Prevent warnings from -Wmissing-prototypes. */
2664 #ifdef YYPARSE_PARAM
2665 # if defined (__STDC__) || defined (__cplusplus)
2666 int yyparse (void *YYPARSE_PARAM);
2670 #else /* ! YYPARSE_PARAM */
2671 #if defined (__STDC__) || defined (__cplusplus)
2676 #endif /* ! YYPARSE_PARAM */
2680 /* The look-ahead symbol. */
2683 /* The semantic value of the look-ahead symbol. */
2686 /* Number of syntax errors so far. */
2695 #ifdef YYPARSE_PARAM
2696 # if defined (__STDC__) || defined (__cplusplus)
2697 int yyparse (void *YYPARSE_PARAM)
2699 int yyparse (YYPARSE_PARAM)
2700 void *YYPARSE_PARAM;
2702 #else /* ! YYPARSE_PARAM */
2703 #if defined (__STDC__) || defined (__cplusplus)
2717 /* Number of tokens to shift before error messages enabled. */
2719 /* Look-ahead token as an internal (translated) token number. */
2722 /* Three stacks and their tools:
2723 `yyss': related to states,
2724 `yyvs': related to semantic values,
2725 `yyls': related to locations.
2727 Refer to the stacks thru separate pointers, to allow yyoverflow
2728 to reallocate them elsewhere. */
2730 /* The state stack. */
2731 short int yyssa[YYINITDEPTH];
2732 short int *yyss = yyssa;
2735 /* The semantic value stack. */
2736 YYSTYPE yyvsa[YYINITDEPTH];
2737 YYSTYPE *yyvs = yyvsa;
2742 #define YYPOPSTACK (yyvsp--, yyssp--)
2744 YYSIZE_T yystacksize = YYINITDEPTH;
2746 /* The variables used to return semantic value and location from the
2751 /* When reducing, the number of symbols on the RHS of the reduced
2755 YYDPRINTF ((stderr, "Starting parse\n"));
2760 yychar = YYEMPTY; /* Cause a token to be read. */
2762 /* Initialize stack pointers.
2763 Waste one element of value and location stack
2764 so that they stay on the same level as the state stack.
2765 The wasted elements are never initialized. */
2772 /*------------------------------------------------------------.
2773 | yynewstate -- Push a new state, which is found in yystate. |
2774 `------------------------------------------------------------*/
2776 /* In all cases, when you get here, the value and location stacks
2777 have just been pushed. so pushing a state here evens the stacks.
2784 if (yyss + yystacksize - 1 <= yyssp)
2786 /* Get the current used size of the three stacks, in elements. */
2787 YYSIZE_T yysize = yyssp - yyss + 1;
2791 /* Give user a chance to reallocate the stack. Use copies of
2792 these so that the &'s don't force the real ones into
2794 YYSTYPE *yyvs1 = yyvs;
2795 short int *yyss1 = yyss;
2798 /* Each stack pointer address is followed by the size of the
2799 data in use in that stack, in bytes. This used to be a
2800 conditional around just the two extra args, but that might
2801 be undefined if yyoverflow is a macro. */
2802 yyoverflow (YY_("memory exhausted"),
2803 &yyss1, yysize * sizeof (*yyssp),
2804 &yyvs1, yysize * sizeof (*yyvsp),
2811 #else /* no yyoverflow */
2812 # ifndef YYSTACK_RELOCATE
2813 goto yyexhaustedlab;
2815 /* Extend the stack our own way. */
2816 if (YYMAXDEPTH <= yystacksize)
2817 goto yyexhaustedlab;
2819 if (YYMAXDEPTH < yystacksize)
2820 yystacksize = YYMAXDEPTH;
2823 short int *yyss1 = yyss;
2824 union yyalloc *yyptr =
2825 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2827 goto yyexhaustedlab;
2828 YYSTACK_RELOCATE (yyss);
2829 YYSTACK_RELOCATE (yyvs);
2831 # undef YYSTACK_RELOCATE
2833 YYSTACK_FREE (yyss1);
2836 #endif /* no yyoverflow */
2838 yyssp = yyss + yysize - 1;
2839 yyvsp = yyvs + yysize - 1;
2842 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2843 (unsigned long int) yystacksize));
2845 if (yyss + yystacksize - 1 <= yyssp)
2849 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2858 /* Do appropriate processing given the current state. */
2859 /* Read a look-ahead token if we need one and don't already have one. */
2862 /* First try to decide what to do without reference to look-ahead token. */
2864 yyn = yypact[yystate];
2865 if (yyn == YYPACT_NINF)
2868 /* Not known => get a look-ahead token if don't already have one. */
2870 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2871 if (yychar == YYEMPTY)
2873 YYDPRINTF ((stderr, "Reading a token: "));
2877 if (yychar <= YYEOF)
2879 yychar = yytoken = YYEOF;
2880 YYDPRINTF ((stderr, "Now at end of input.\n"));
2884 yytoken = YYTRANSLATE (yychar);
2885 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2888 /* If the proper action on seeing token YYTOKEN is to reduce or to
2889 detect an error, take that action. */
2891 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2896 if (yyn == 0 || yyn == YYTABLE_NINF)
2905 /* Shift the look-ahead token. */
2906 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2908 /* Discard the token being shifted unless it is eof. */
2909 if (yychar != YYEOF)
2915 /* Count tokens shifted since error; after three, turn off error
2924 /*-----------------------------------------------------------.
2925 | yydefault -- do the default action for the current state. |
2926 `-----------------------------------------------------------*/
2928 yyn = yydefact[yystate];
2934 /*-----------------------------.
2935 | yyreduce -- Do a reduction. |
2936 `-----------------------------*/
2938 /* yyn is the number of a rule to reduce with. */
2941 /* If YYLEN is nonzero, implement the default value of the action:
2944 Otherwise, the following line sets YYVAL to garbage.
2945 This behavior is undocumented and Bison
2946 users should not rely upon it. Assigning to YYVAL
2947 unconditionally makes the parser a bit smaller, and it avoids a
2948 GCC warning that YYVAL may be used uninitialized. */
2949 yyval = yyvsp[1-yylen];
2952 YY_REDUCE_PRINT (yyn);
2956 #line 1097 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2958 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
2959 GEN_ERROR("Value too large for type!");
2960 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
2966 #line 1106 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2968 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
2969 GEN_ERROR("Value too large for type!");
2970 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
2976 #line 1130 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2978 (yyval.StrVal) = (yyvsp[-1].StrVal);
2984 #line 1134 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2992 #line 1139 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2993 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
2997 #line 1140 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
2998 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3002 #line 1141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3003 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3007 #line 1142 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3008 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3012 #line 1143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3013 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3017 #line 1144 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3018 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3022 #line 1145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3023 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3027 #line 1146 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3028 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3032 #line 1148 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3033 { (yyval.UIntVal) = CallingConv::C; ;}
3037 #line 1149 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3038 { (yyval.UIntVal) = CallingConv::C; ;}
3042 #line 1150 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3043 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3047 #line 1151 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3048 { (yyval.UIntVal) = CallingConv::Fast; ;}
3052 #line 1152 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3053 { (yyval.UIntVal) = CallingConv::Cold; ;}
3057 #line 1153 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3058 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3062 #line 1154 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3063 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3067 #line 1155 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3069 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3070 GEN_ERROR("Calling conv too large!");
3071 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3077 #line 1164 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3078 { (yyval.UIntVal) = 0; ;}
3082 #line 1165 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3084 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3085 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3086 GEN_ERROR("Alignment must be a power of two!");
3092 #line 1171 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3093 { (yyval.UIntVal) = 0; ;}
3097 #line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3099 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3100 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3101 GEN_ERROR("Alignment must be a power of two!");
3107 #line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3109 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3110 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3111 GEN_ERROR("Invalid character in section name!");
3112 (yyval.StrVal) = (yyvsp[0].StrVal);
3118 #line 1188 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3119 { (yyval.StrVal) = 0; ;}
3123 #line 1189 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3124 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3128 #line 1194 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3133 #line 1195 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3138 #line 1196 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3140 CurGV->setSection((yyvsp[0].StrVal));
3141 free((yyvsp[0].StrVal));
3147 #line 1201 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3149 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3150 GEN_ERROR("Alignment must be a power of two!");
3151 CurGV->setAlignment((yyvsp[0].UInt64Val));
3157 #line 1215 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3158 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3162 #line 1216 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3163 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3167 #line 1218 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3169 if (!UpRefs.empty())
3170 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3171 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3177 #line 1230 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3179 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3185 #line 1234 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3187 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3193 #line 1238 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3194 { // Named types are also simple types...
3195 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3197 (yyval.TypeVal) = new PATypeHolder(tmp);
3202 #line 1246 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3203 { // Type UpReference
3204 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3205 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3206 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3207 (yyval.TypeVal) = new PATypeHolder(OT);
3208 UR_OUT("New Upreference!\n");
3214 #line 1254 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3215 { // Function derived type?
3216 std::vector<const Type*> Params;
3217 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3218 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3219 Params.push_back(*I);
3220 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3221 if (isVarArg) Params.pop_back();
3223 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3224 delete (yyvsp[-1].TypeList); // Delete the argument list
3225 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3231 #line 1267 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3232 { // Sized array type?
3233 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3234 delete (yyvsp[-1].TypeVal);
3240 #line 1272 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3241 { // Packed array type?
3242 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3243 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3244 GEN_ERROR("Unsigned result not equal to signed result");
3245 if (!ElemTy->isPrimitiveType())
3246 GEN_ERROR("Elemental type of a PackedType must be primitive");
3247 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3248 GEN_ERROR("Vector length should be a power of 2!");
3249 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3250 delete (yyvsp[-1].TypeVal);
3256 #line 1284 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3257 { // Structure type?
3258 std::vector<const Type*> Elements;
3259 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3260 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3261 Elements.push_back(*I);
3263 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3264 delete (yyvsp[-1].TypeList);
3270 #line 1294 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3271 { // Empty structure type?
3272 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3278 #line 1298 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3280 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3281 delete (yyvsp[-1].TypeVal);
3287 #line 1307 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3289 (yyval.TypeList) = new std::list<PATypeHolder>();
3290 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3296 #line 1312 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3298 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3304 #line 1319 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3306 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3312 #line 1323 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3314 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3320 #line 1327 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3322 (yyval.TypeList) = new std::list<PATypeHolder>();
3328 #line 1338 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3329 { // Nonempty unsized arr
3330 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3332 GEN_ERROR("Cannot make array constant with type: '" +
3333 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3334 const Type *ETy = ATy->getElementType();
3335 int NumElements = ATy->getNumElements();
3337 // Verify that we have the correct size...
3338 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3339 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3340 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3341 itostr(NumElements) + "!");
3343 // Verify all elements are correct type!
3344 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3345 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3346 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3347 ETy->getDescription() +"' as required!\nIt is of type '"+
3348 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3351 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3352 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3358 #line 1364 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3360 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3362 GEN_ERROR("Cannot make array constant with type: '" +
3363 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3365 int NumElements = ATy->getNumElements();
3366 if (NumElements != -1 && NumElements != 0)
3367 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3368 " arguments, but has size of " + itostr(NumElements) +"!");
3369 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3370 delete (yyvsp[-2].TypeVal);
3376 #line 1378 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3378 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3380 GEN_ERROR("Cannot make array constant with type: '" +
3381 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3383 int NumElements = ATy->getNumElements();
3384 const Type *ETy = ATy->getElementType();
3385 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3386 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3387 GEN_ERROR("Can't build string constant of size " +
3388 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3389 " when array has size " + itostr(NumElements) + "!");
3390 std::vector<Constant*> Vals;
3391 if (ETy == Type::SByteTy) {
3392 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3393 Vals.push_back(ConstantSInt::get(ETy, *C));
3394 } else if (ETy == Type::UByteTy) {
3395 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3396 C != (unsigned char*)EndStr; ++C)
3397 Vals.push_back(ConstantUInt::get(ETy, *C));
3399 free((yyvsp[0].StrVal));
3400 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3402 free((yyvsp[0].StrVal));
3403 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3404 delete (yyvsp[-2].TypeVal);
3410 #line 1408 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3411 { // Nonempty unsized arr
3412 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3414 GEN_ERROR("Cannot make packed constant with type: '" +
3415 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3416 const Type *ETy = PTy->getElementType();
3417 int NumElements = PTy->getNumElements();
3419 // Verify that we have the correct size...
3420 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3421 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3422 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3423 itostr(NumElements) + "!");
3425 // Verify all elements are correct type!
3426 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3427 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3428 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3429 ETy->getDescription() +"' as required!\nIt is of type '"+
3430 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3433 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3434 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3440 #line 1434 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3442 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3444 GEN_ERROR("Cannot make struct constant with type: '" +
3445 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3447 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3448 GEN_ERROR("Illegal number of initializers for structure type!");
3450 // Check to ensure that constants are compatible with the type initializer!
3451 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3452 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3453 GEN_ERROR("Expected type '" +
3454 STy->getElementType(i)->getDescription() +
3455 "' for element #" + utostr(i) +
3456 " of structure initializer!");
3458 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3459 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3465 #line 1455 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3467 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3469 GEN_ERROR("Cannot make struct constant with type: '" +
3470 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3472 if (STy->getNumContainedTypes() != 0)
3473 GEN_ERROR("Illegal number of initializers for structure type!");
3475 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3476 delete (yyvsp[-2].TypeVal);
3482 #line 1468 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3484 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3486 GEN_ERROR("Cannot make null pointer constant with type: '" +
3487 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3489 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3490 delete (yyvsp[-1].TypeVal);
3496 #line 1478 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3498 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3499 delete (yyvsp[-1].TypeVal);
3505 #line 1483 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3507 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3509 GEN_ERROR("Global const reference must be a pointer type!");
3511 // ConstExprs can exist in the body of a function, thus creating
3512 // GlobalValues whenever they refer to a variable. Because we are in
3513 // the context of a function, getValNonImprovising will search the functions
3514 // symbol table instead of the module symbol table for the global symbol,
3515 // which throws things all off. To get around this, we just tell
3516 // getValNonImprovising that we are at global scope here.
3518 Function *SavedCurFn = CurFun.CurrentFunction;
3519 CurFun.CurrentFunction = 0;
3521 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3524 CurFun.CurrentFunction = SavedCurFn;
3526 // If this is an initializer for a constant pointer, which is referencing a
3527 // (currently) undefined variable, create a stub now that shall be replaced
3528 // in the future with the right type of variable.
3531 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3532 const PointerType *PT = cast<PointerType>(Ty);
3534 // First check to see if the forward references value is already created!
3535 PerModuleInfo::GlobalRefsType::iterator I =
3536 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3538 if (I != CurModule.GlobalRefs.end()) {
3539 V = I->second; // Placeholder already exists, use it...
3540 (yyvsp[0].ValIDVal).destroy();
3543 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3545 // Create the forward referenced global.
3547 if (const FunctionType *FTy =
3548 dyn_cast<FunctionType>(PT->getElementType())) {
3549 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3550 CurModule.CurrentModule);
3552 GV = new GlobalVariable(PT->getElementType(), false,
3553 GlobalValue::ExternalLinkage, 0,
3554 Name, CurModule.CurrentModule);
3557 // Keep track of the fact that we have a forward ref to recycle it
3558 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3563 (yyval.ConstVal) = cast<GlobalValue>(V);
3564 delete (yyvsp[-1].TypeVal); // Free the type handle
3570 #line 1544 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3572 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3573 GEN_ERROR("Mismatched types for constant expression!");
3574 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3575 delete (yyvsp[-1].TypeVal);
3581 #line 1551 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3583 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3584 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3585 GEN_ERROR("Cannot create a null initialized value of this type!");
3586 (yyval.ConstVal) = Constant::getNullValue(Ty);
3587 delete (yyvsp[-1].TypeVal);
3593 #line 1560 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3594 { // integral constants
3595 if (!ConstantSInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3596 GEN_ERROR("Constant value doesn't fit in type!");
3597 (yyval.ConstVal) = ConstantSInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3603 #line 1566 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3604 { // integral constants
3605 if (!ConstantUInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3606 GEN_ERROR("Constant value doesn't fit in type!");
3607 (yyval.ConstVal) = ConstantUInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3613 #line 1572 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3614 { // Boolean constants
3615 (yyval.ConstVal) = ConstantBool::getTrue();
3621 #line 1576 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3622 { // Boolean constants
3623 (yyval.ConstVal) = ConstantBool::getFalse();
3629 #line 1580 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3630 { // Float & Double constants
3631 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3632 GEN_ERROR("Floating point constant invalid for type!!");
3633 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3639 #line 1588 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3641 if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType())
3642 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3643 (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!");
3644 if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType())
3645 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3646 (yyvsp[-1].TypeVal)->get()->getDescription() + "'!");
3647 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3648 delete (yyvsp[-1].TypeVal);
3654 #line 1599 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3656 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3657 GEN_ERROR("GetElementPtr requires a pointer operand!");
3659 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3660 // indices to uint struct indices for compatibility.
3661 generic_gep_type_iterator<std::vector<Value*>::iterator>
3662 GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3663 GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3664 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3665 if (isa<StructType>(*GTI)) // Only change struct indices
3666 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[-1].ValueList))[i]))
3667 if (CUI->getType() == Type::UByteTy)
3668 (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3671 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3673 GEN_ERROR("Index list invalid for constant getelementptr!");
3675 std::vector<Constant*> IdxVec;
3676 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3677 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3678 IdxVec.push_back(C);
3680 GEN_ERROR("Indices to constant getelementptr must be constants!");
3682 delete (yyvsp[-1].ValueList);
3684 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3690 #line 1631 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3692 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3693 GEN_ERROR("Select condition must be of boolean type!");
3694 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3695 GEN_ERROR("Select operand types must match!");
3696 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3702 #line 1639 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3704 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3705 GEN_ERROR("Binary operator types must match!");
3706 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3707 // To retain backward compatibility with these early compilers, we emit a
3708 // cast to the appropriate integer type automatically if we are in the
3709 // broken case. See PR424 for more information.
3710 if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
3711 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3713 const Type *IntPtrTy = 0;
3714 switch (CurModule.CurrentModule->getPointerSize()) {
3715 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
3716 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
3717 default: GEN_ERROR("invalid pointer binary constant expr!");
3719 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
3720 ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
3721 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
3728 #line 1661 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3730 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3731 GEN_ERROR("Logical operator types must match!");
3732 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
3733 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
3734 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
3735 GEN_ERROR("Logical operator requires integral operands!");
3737 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3743 #line 1672 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3745 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3746 GEN_ERROR("setcc operand types must match!");
3747 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3753 #line 1678 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3755 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
3756 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3757 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
3758 GEN_ERROR("Shift constant expression requires integer operand!");
3759 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3765 #line 1686 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3767 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3768 GEN_ERROR("Invalid extractelement operands!");
3769 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3775 #line 1692 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3777 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3778 GEN_ERROR("Invalid insertelement operands!");
3779 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3785 #line 1698 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3787 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3788 GEN_ERROR("Invalid shufflevector operands!");
3789 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3795 #line 1707 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3797 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
3803 #line 1711 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3805 (yyval.ConstVector) = new std::vector<Constant*>();
3806 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
3812 #line 1719 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3813 { (yyval.BoolVal) = false; ;}
3817 #line 1719 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3818 { (yyval.BoolVal) = true; ;}
3822 #line 1729 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3824 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
3825 CurModule.ModuleDone();
3831 #line 1737 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3833 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3834 CurFun.FunctionDone();
3840 #line 1742 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3842 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3848 #line 1746 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3850 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
3856 #line 1750 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3858 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3864 #line 1754 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3866 (yyval.ModuleVal) = CurModule.CurrentModule;
3867 // Emit an error if there are any unresolved types left.
3868 if (!CurModule.LateResolveTypes.empty()) {
3869 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
3870 if (DID.Type == ValID::NameVal) {
3871 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
3873 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
3881 #line 1769 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3883 // Eagerly resolve types. This is not an optimization, this is a
3884 // requirement that is due to the fact that we could have this:
3886 // %list = type { %list * }
3887 // %list = type { %list * } ; repeated type decl
3889 // If types are not resolved eagerly, then the two types will not be
3890 // determined to be the same type!
3892 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
3894 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
3896 // If this is a named type that is not a redefinition, add it to the slot
3898 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
3901 delete (yyvsp[0].TypeVal);
3907 #line 1791 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3908 { // Function prototypes can be in const pool
3914 #line 1794 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3915 { // Asm blocks can be in the const pool
3921 #line 1797 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3923 if ((yyvsp[0].ConstVal) == 0)
3924 GEN_ERROR("Global value initializer is not a constant!");
3925 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
3931 #line 1802 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3938 #line 1805 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3940 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
3942 delete (yyvsp[0].TypeVal);
3947 #line 1809 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3955 #line 1813 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3957 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
3959 delete (yyvsp[0].TypeVal);
3964 #line 1817 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3972 #line 1821 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3975 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
3977 delete (yyvsp[0].TypeVal);
3982 #line 1826 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3990 #line 1830 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
3997 #line 1833 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4004 #line 1836 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4010 #line 1840 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4012 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4013 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4014 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4015 free((yyvsp[0].StrVal));
4017 if (AsmSoFar.empty())
4018 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4020 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4026 #line 1853 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4027 { (yyval.Endianness) = Module::BigEndian; ;}
4031 #line 1854 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4032 { (yyval.Endianness) = Module::LittleEndian; ;}
4036 #line 1856 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4038 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4044 #line 1860 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4046 if ((yyvsp[0].UInt64Val) == 32)
4047 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4048 else if ((yyvsp[0].UInt64Val) == 64)
4049 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4051 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4057 #line 1869 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4059 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4060 free((yyvsp[0].StrVal));
4066 #line 1877 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4068 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4069 free((yyvsp[0].StrVal));
4075 #line 1882 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4077 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4078 free((yyvsp[0].StrVal));
4084 #line 1887 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4091 #line 1897 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4092 { (yyval.StrVal) = 0; ;}
4096 #line 1899 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4098 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4099 GEN_ERROR("void typed arguments are invalid!");
4100 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4106 #line 1906 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4108 (yyval.ArgList) = (yyvsp[-2].ArgList);
4109 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4110 delete (yyvsp[0].ArgVal);
4116 #line 1912 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4118 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4119 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4120 delete (yyvsp[0].ArgVal);
4126 #line 1919 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4128 (yyval.ArgList) = (yyvsp[0].ArgList);
4134 #line 1923 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4136 (yyval.ArgList) = (yyvsp[-2].ArgList);
4137 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4138 char*>(new PATypeHolder(Type::VoidTy), 0));
4144 #line 1929 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4146 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4147 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4153 #line 1934 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4155 (yyval.ArgList) = 0;
4161 #line 1940 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4163 UnEscapeLexed((yyvsp[-5].StrVal));
4164 std::string FunctionName((yyvsp[-5].StrVal));
4165 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4167 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4168 GEN_ERROR("LLVM functions cannot return aggregate types!");
4170 std::vector<const Type*> ParamTypeList;
4171 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4172 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4173 I != (yyvsp[-3].ArgList)->end(); ++I)
4174 ParamTypeList.push_back(I->first->get());
4177 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4178 if (isVarArg) ParamTypeList.pop_back();
4180 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4181 const PointerType *PFT = PointerType::get(FT);
4182 delete (yyvsp[-6].TypeVal);
4185 if (!FunctionName.empty()) {
4186 ID = ValID::create((char*)FunctionName.c_str());
4188 ID = ValID::create((int)CurModule.Values[PFT].size());
4192 // See if this function was forward referenced. If so, recycle the object.
4193 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4194 // Move the function to the end of the list, from whereever it was
4195 // previously inserted.
4196 Fn = cast<Function>(FWRef);
4197 CurModule.CurrentModule->getFunctionList().remove(Fn);
4198 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4199 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4200 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4201 // If this is the case, either we need to be a forward decl, or it needs
4203 if (!CurFun.isDeclare && !Fn->isExternal())
4204 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4206 // Make sure to strip off any argument names so we can't get conflicts.
4207 if (Fn->isExternal())
4208 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4211 } else { // Not already defined?
4212 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4213 CurModule.CurrentModule);
4215 InsertValue(Fn, CurModule.Values);
4218 CurFun.FunctionStart(Fn);
4220 if (CurFun.isDeclare) {
4221 // If we have declaration, always overwrite linkage. This will allow us to
4222 // correctly handle cases, when pointer to function is passed as argument to
4223 // another function.
4224 Fn->setLinkage(CurFun.Linkage);
4226 Fn->setCallingConv((yyvsp[-7].UIntVal));
4227 Fn->setAlignment((yyvsp[0].UIntVal));
4228 if ((yyvsp[-1].StrVal)) {
4229 Fn->setSection((yyvsp[-1].StrVal));
4230 free((yyvsp[-1].StrVal));
4233 // Add all of the arguments we parsed to the function...
4234 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4235 if (isVarArg) { // Nuke the last entry
4236 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4237 "Not a varargs marker!");
4238 delete (yyvsp[-3].ArgList)->back().first;
4239 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4241 Function::arg_iterator ArgIt = Fn->arg_begin();
4242 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4243 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4244 delete I->first; // Delete the typeholder...
4246 setValueName(ArgIt, I->second); // Insert arg into symtab...
4251 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4258 #line 2036 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4260 (yyval.FunctionVal) = CurFun.CurrentFunction;
4262 // Make sure that we keep track of the linkage type even if there was a
4263 // previous "declare".
4264 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4269 #line 2046 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4271 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4277 #line 2052 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4278 { CurFun.Linkage = GlobalValue::DLLImportLinkage ;}
4282 #line 2053 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4283 { CurFun.Linkage = GlobalValue::DLLImportLinkage ;}
4287 #line 2055 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4288 { CurFun.isDeclare = true; ;}
4292 #line 2055 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4294 (yyval.FunctionVal) = CurFun.CurrentFunction;
4295 CurFun.FunctionDone();
4301 #line 2065 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4303 (yyval.BoolVal) = false;
4309 #line 2069 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4311 (yyval.BoolVal) = true;
4317 #line 2074 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4318 { // A reference to a direct constant
4319 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4325 #line 2078 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4327 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4333 #line 2082 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4334 { // Perhaps it's an FP constant?
4335 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4341 #line 2086 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4343 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4349 #line 2090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4351 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4357 #line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4359 (yyval.ValIDVal) = ValID::createNull();
4365 #line 2098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4367 (yyval.ValIDVal) = ValID::createUndef();
4373 #line 2102 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4374 { // A vector zero constant.
4375 (yyval.ValIDVal) = ValID::createZeroInit();
4381 #line 2106 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4382 { // Nonempty unsized packed vector
4383 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4384 int NumElements = (yyvsp[-1].ConstVector)->size();
4386 PackedType* pt = PackedType::get(ETy, NumElements);
4387 PATypeHolder* PTy = new PATypeHolder(
4395 // Verify all elements are correct type!
4396 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4397 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4398 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4399 ETy->getDescription() +"' as required!\nIt is of type '" +
4400 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4403 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4404 delete PTy; delete (yyvsp[-1].ConstVector);
4410 #line 2131 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4412 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4418 #line 2135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4420 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4421 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4422 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4423 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4424 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4425 free((yyvsp[-2].StrVal));
4426 free((yyvsp[0].StrVal));
4432 #line 2149 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4433 { // Is it an integer reference...?
4434 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4440 #line 2153 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4441 { // Is it a named reference...?
4442 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4448 #line 2165 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4450 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4456 #line 2170 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4458 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4464 #line 2174 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4465 { // Do not allow functions with 0 basic blocks
4466 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4472 #line 2183 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4474 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4476 InsertValue((yyvsp[0].TermInstVal));
4478 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4479 InsertValue((yyvsp[-2].BasicBlockVal));
4480 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4486 #line 2194 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4488 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4489 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4495 #line 2199 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4497 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4500 // Make sure to move the basic block to the correct location in the
4501 // function, instead of leaving it inserted wherever it was first
4503 Function::BasicBlockListType &BBL =
4504 CurFun.CurrentFunction->getBasicBlockList();
4505 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4511 #line 2211 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4513 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4516 // Make sure to move the basic block to the correct location in the
4517 // function, instead of leaving it inserted wherever it was first
4519 Function::BasicBlockListType &BBL =
4520 CurFun.CurrentFunction->getBasicBlockList();
4521 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4527 #line 2224 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4528 { // Return with a result...
4529 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4535 #line 2228 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4536 { // Return with no result...
4537 (yyval.TermInstVal) = new ReturnInst();
4543 #line 2232 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4544 { // Unconditional Branch...
4545 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4547 (yyval.TermInstVal) = new BranchInst(tmpBB);
4552 #line 2237 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4554 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4556 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4558 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4560 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4565 #line 2246 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4567 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4569 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4571 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4572 (yyval.TermInstVal) = S;
4574 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4575 E = (yyvsp[-1].JumpTable)->end();
4576 for (; I != E; ++I) {
4577 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4578 S->addCase(CI, I->second);
4580 GEN_ERROR("Switch case is constant, but not a simple integer!");
4582 delete (yyvsp[-1].JumpTable);
4588 #line 2265 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4590 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4592 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4594 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4595 (yyval.TermInstVal) = S;
4601 #line 2275 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4603 const PointerType *PFTy;
4604 const FunctionType *Ty;
4606 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4607 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4608 // Pull out the types of all of the arguments...
4609 std::vector<const Type*> ParamTypes;
4610 if ((yyvsp[-7].ValueList)) {
4611 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4613 ParamTypes.push_back((*I)->getType());
4616 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4617 if (isVarArg) ParamTypes.pop_back();
4619 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4620 PFTy = PointerType::get(Ty);
4623 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4625 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4627 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4630 // Create the call node...
4631 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4632 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4633 } else { // Has arguments?
4634 // Loop through FunctionType's arguments and ensure they are specified
4637 FunctionType::param_iterator I = Ty->param_begin();
4638 FunctionType::param_iterator E = Ty->param_end();
4639 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4641 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4642 if ((*ArgI)->getType() != *I)
4643 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4644 (*I)->getDescription() + "'!");
4646 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4647 GEN_ERROR("Invalid number of parameters detected!");
4649 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4651 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4653 delete (yyvsp[-10].TypeVal);
4654 delete (yyvsp[-7].ValueList);
4660 #line 2330 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4662 (yyval.TermInstVal) = new UnwindInst();
4668 #line 2334 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4670 (yyval.TermInstVal) = new UnreachableInst();
4676 #line 2341 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4678 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4679 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4682 GEN_ERROR("May only switch on a constant pool value!");
4684 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4686 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4691 #line 2352 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4693 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4694 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4698 GEN_ERROR("May only switch on a constant pool value!");
4700 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4702 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4707 #line 2365 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4709 // Is this definition named?? if so, assign the name...
4710 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4712 InsertValue((yyvsp[0].InstVal));
4713 (yyval.InstVal) = (yyvsp[0].InstVal);
4719 #line 2374 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4720 { // Used for PHI nodes
4721 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4722 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
4724 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4726 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4727 delete (yyvsp[-5].TypeVal);
4732 #line 2383 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4734 (yyval.PHIList) = (yyvsp[-6].PHIList);
4735 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
4737 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4739 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4744 #line 2393 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4745 { // Used for call statements, and memory insts...
4746 (yyval.ValueList) = new std::vector<Value*>();
4747 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4752 #line 2397 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4754 (yyval.ValueList) = (yyvsp[-2].ValueList);
4755 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4761 #line 2404 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4762 { (yyval.ValueList) = 0; ;}
4766 #line 2406 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4768 (yyval.BoolVal) = true;
4774 #line 2410 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4776 (yyval.BoolVal) = false;
4782 #line 2415 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4784 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
4785 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
4787 "Arithmetic operator requires integer, FP, or packed operands!");
4788 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem)
4789 GEN_ERROR("Rem not supported on packed types!");
4790 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4792 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4794 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
4795 if ((yyval.InstVal) == 0)
4796 GEN_ERROR("binary operator returned null!");
4797 delete (yyvsp[-3].TypeVal);
4802 #line 2431 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4804 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
4805 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
4806 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
4807 GEN_ERROR("Logical operator requires integral operands!");
4809 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4811 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4813 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
4814 if ((yyval.InstVal) == 0)
4815 GEN_ERROR("binary operator returned null!");
4816 delete (yyvsp[-3].TypeVal);
4821 #line 2446 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4823 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
4825 "PackedTypes currently not supported in setcc instructions!");
4827 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4829 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4831 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
4832 if ((yyval.InstVal) == 0)
4833 GEN_ERROR("binary operator returned null!");
4834 delete (yyvsp[-3].TypeVal);
4839 #line 2460 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4841 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
4842 << " Replacing with 'xor'.\n";
4844 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
4846 GEN_ERROR("Expected integral type for not instruction!");
4848 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
4849 if ((yyval.InstVal) == 0)
4850 GEN_ERROR("Could not create a xor instruction!");
4856 #line 2473 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4858 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
4859 GEN_ERROR("Shift amount must be ubyte!");
4860 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
4861 GEN_ERROR("Shift constant expression requires integer operand!");
4862 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4868 #line 2481 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4870 if (!(yyvsp[0].TypeVal)->get()->isFirstClassType())
4871 GEN_ERROR("cast instruction to a non-primitive type: '" +
4872 (yyvsp[0].TypeVal)->get()->getDescription() + "'!");
4873 (yyval.InstVal) = new CastInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
4874 delete (yyvsp[0].TypeVal);
4880 #line 2489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4882 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
4883 GEN_ERROR("select condition must be boolean!");
4884 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
4885 GEN_ERROR("select value types should match!");
4886 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4892 #line 2497 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4895 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
4896 delete (yyvsp[0].TypeVal);
4902 #line 2503 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4904 ObsoleteVarArgs = true;
4905 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
4906 Function* NF = CurModule.CurrentModule->
4907 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
4910 //foo = alloca 1 of t
4914 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
4915 CurBB->getInstList().push_back(foo);
4916 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
4917 CurBB->getInstList().push_back(bar);
4918 CurBB->getInstList().push_back(new StoreInst(bar, foo));
4919 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
4920 delete (yyvsp[0].TypeVal);
4926 #line 2523 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4928 ObsoleteVarArgs = true;
4929 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
4930 Function* NF = CurModule.CurrentModule->
4931 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
4933 //b = vanext a, t ->
4934 //foo = alloca 1 of t
4937 //tmp = vaarg foo, t
4939 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
4940 CurBB->getInstList().push_back(foo);
4941 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
4942 CurBB->getInstList().push_back(bar);
4943 CurBB->getInstList().push_back(new StoreInst(bar, foo));
4944 Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
4945 CurBB->getInstList().push_back(tmp);
4946 (yyval.InstVal) = new LoadInst(foo);
4947 delete (yyvsp[0].TypeVal);
4953 #line 2546 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4955 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
4956 GEN_ERROR("Invalid extractelement operands!");
4957 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4963 #line 2552 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4965 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
4966 GEN_ERROR("Invalid insertelement operands!");
4967 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4973 #line 2558 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4975 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
4976 GEN_ERROR("Invalid shufflevector operands!");
4977 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4983 #line 2564 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
4985 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
4986 if (!Ty->isFirstClassType())
4987 GEN_ERROR("PHI node operands must be of first class type!");
4988 (yyval.InstVal) = new PHINode(Ty);
4989 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
4990 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
4991 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
4992 GEN_ERROR("All elements of a PHI node must be of the same type!");
4993 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
4994 (yyvsp[0].PHIList)->pop_front();
4996 delete (yyvsp[0].PHIList); // Free the list...
5002 #line 2579 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5004 const PointerType *PFTy;
5005 const FunctionType *Ty;
5007 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5008 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5009 // Pull out the types of all of the arguments...
5010 std::vector<const Type*> ParamTypes;
5011 if ((yyvsp[-1].ValueList)) {
5012 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5014 ParamTypes.push_back((*I)->getType());
5017 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5018 if (isVarArg) ParamTypes.pop_back();
5020 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5021 GEN_ERROR("LLVM functions cannot return aggregate types!");
5023 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5024 PFTy = PointerType::get(Ty);
5027 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5030 // Create the call node...
5031 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5032 // Make sure no arguments is a good thing!
5033 if (Ty->getNumParams() != 0)
5034 GEN_ERROR("No arguments passed to a function that "
5035 "expects arguments!");
5037 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5038 } else { // Has arguments?
5039 // Loop through FunctionType's arguments and ensure they are specified
5042 FunctionType::param_iterator I = Ty->param_begin();
5043 FunctionType::param_iterator E = Ty->param_end();
5044 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5046 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5047 if ((*ArgI)->getType() != *I)
5048 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5049 (*I)->getDescription() + "'!");
5051 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5052 GEN_ERROR("Invalid number of parameters detected!");
5054 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5056 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5057 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5058 delete (yyvsp[-4].TypeVal);
5059 delete (yyvsp[-1].ValueList);
5065 #line 2638 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5067 (yyval.InstVal) = (yyvsp[0].InstVal);
5073 #line 2645 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5075 (yyval.ValueList) = (yyvsp[0].ValueList);
5081 #line 2648 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5083 (yyval.ValueList) = new std::vector<Value*>();
5089 #line 2653 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5091 (yyval.BoolVal) = true;
5097 #line 2657 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5099 (yyval.BoolVal) = false;
5105 #line 2664 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5107 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5108 delete (yyvsp[-1].TypeVal);
5114 #line 2669 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5116 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5118 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5119 delete (yyvsp[-4].TypeVal);
5124 #line 2675 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5126 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5127 delete (yyvsp[-1].TypeVal);
5133 #line 2680 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5135 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5137 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5138 delete (yyvsp[-4].TypeVal);
5143 #line 2686 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5145 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5146 GEN_ERROR("Trying to free nonpointer type " +
5147 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5148 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5154 #line 2694 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5156 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5157 GEN_ERROR("Can't load from nonpointer type: " +
5158 (*(yyvsp[-1].TypeVal))->getDescription());
5159 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5160 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5161 (*(yyvsp[-1].TypeVal))->getDescription());
5162 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5164 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5165 delete (yyvsp[-1].TypeVal);
5170 #line 2706 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5172 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5174 GEN_ERROR("Can't store to a nonpointer type: " +
5175 (*(yyvsp[-1].TypeVal))->getDescription());
5176 const Type *ElTy = PT->getElementType();
5177 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5178 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5179 "' into space of type '" + ElTy->getDescription() + "'!");
5181 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5183 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5184 delete (yyvsp[-1].TypeVal);
5189 #line 2721 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5191 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5192 GEN_ERROR("getelementptr insn requires pointer operand!");
5194 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
5195 // indices to uint struct indices for compatibility.
5196 generic_gep_type_iterator<std::vector<Value*>::iterator>
5197 GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
5198 GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
5199 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
5200 if (isa<StructType>(*GTI)) // Only change struct indices
5201 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[0].ValueList))[i]))
5202 if (CUI->getType() == Type::UByteTy)
5203 (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
5205 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5206 GEN_ERROR("Invalid getelementptr indices for type '" +
5207 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5208 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5210 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5211 delete (yyvsp[-2].TypeVal);
5212 delete (yyvsp[0].ValueList);
5220 /* Line 1126 of yacc.c. */
5221 #line 5222 "llvmAsmParser.tab.c"
5227 YY_STACK_PRINT (yyss, yyssp);
5232 /* Now `shift' the result of the reduction. Determine what state
5233 that goes to, based on the state we popped back to and the rule
5234 number reduced by. */
5238 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5239 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5240 yystate = yytable[yystate];
5242 yystate = yydefgoto[yyn - YYNTOKENS];
5247 /*------------------------------------.
5248 | yyerrlab -- here on detecting error |
5249 `------------------------------------*/
5251 /* If not already recovering from an error, report this error. */
5256 yyn = yypact[yystate];
5258 if (YYPACT_NINF < yyn && yyn < YYLAST)
5260 int yytype = YYTRANSLATE (yychar);
5261 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5262 YYSIZE_T yysize = yysize0;
5264 int yysize_overflow = 0;
5266 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5267 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5271 /* This is so xgettext sees the translatable formats that are
5272 constructed on the fly. */
5273 YY_("syntax error, unexpected %s");
5274 YY_("syntax error, unexpected %s, expecting %s");
5275 YY_("syntax error, unexpected %s, expecting %s or %s");
5276 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5277 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5281 static char const yyunexpected[] = "syntax error, unexpected %s";
5282 static char const yyexpecting[] = ", expecting %s";
5283 static char const yyor[] = " or %s";
5284 char yyformat[sizeof yyunexpected
5285 + sizeof yyexpecting - 1
5286 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5287 * (sizeof yyor - 1))];
5288 char const *yyprefix = yyexpecting;
5290 /* Start YYX at -YYN if negative to avoid negative indexes in
5292 int yyxbegin = yyn < 0 ? -yyn : 0;
5294 /* Stay within bounds of both yycheck and yytname. */
5295 int yychecklim = YYLAST - yyn;
5296 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5299 yyarg[0] = yytname[yytype];
5300 yyfmt = yystpcpy (yyformat, yyunexpected);
5302 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5303 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5305 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5309 yyformat[sizeof yyunexpected - 1] = '\0';
5312 yyarg[yycount++] = yytname[yyx];
5313 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5314 yysize_overflow |= yysize1 < yysize;
5316 yyfmt = yystpcpy (yyfmt, yyprefix);
5320 yyf = YY_(yyformat);
5321 yysize1 = yysize + yystrlen (yyf);
5322 yysize_overflow |= yysize1 < yysize;
5325 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5326 yymsg = (char *) YYSTACK_ALLOC (yysize);
5329 /* Avoid sprintf, as that infringes on the user's name space.
5330 Don't have undefined behavior even if the translation
5331 produced a string with the wrong number of "%s"s. */
5334 while ((*yyp = *yyf))
5336 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5338 yyp += yytnamerr (yyp, yyarg[yyi++]);
5348 YYSTACK_FREE (yymsg);
5352 yyerror (YY_("syntax error"));
5353 goto yyexhaustedlab;
5357 #endif /* YYERROR_VERBOSE */
5358 yyerror (YY_("syntax error"));
5363 if (yyerrstatus == 3)
5365 /* If just tried and failed to reuse look-ahead token after an
5366 error, discard it. */
5368 if (yychar <= YYEOF)
5370 /* Return failure if at end of input. */
5371 if (yychar == YYEOF)
5376 yydestruct ("Error: discarding", yytoken, &yylval);
5381 /* Else will try to reuse look-ahead token after shifting the error
5386 /*---------------------------------------------------.
5387 | yyerrorlab -- error raised explicitly by YYERROR. |
5388 `---------------------------------------------------*/
5391 /* Pacify compilers like GCC when the user code never invokes
5392 YYERROR and the label yyerrorlab therefore never appears in user
5403 /*-------------------------------------------------------------.
5404 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5405 `-------------------------------------------------------------*/
5407 yyerrstatus = 3; /* Each real token shifted decrements this. */
5411 yyn = yypact[yystate];
5412 if (yyn != YYPACT_NINF)
5415 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5423 /* Pop the current state because it cannot handle the error token. */
5428 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5431 YY_STACK_PRINT (yyss, yyssp);
5440 /* Shift the error token. */
5441 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5447 /*-------------------------------------.
5448 | yyacceptlab -- YYACCEPT comes here. |
5449 `-------------------------------------*/
5454 /*-----------------------------------.
5455 | yyabortlab -- YYABORT comes here. |
5456 `-----------------------------------*/
5462 /*-------------------------------------------------.
5463 | yyexhaustedlab -- memory exhaustion comes here. |
5464 `-------------------------------------------------*/
5466 yyerror (YY_("memory exhausted"));
5472 if (yychar != YYEOF && yychar != YYEMPTY)
5473 yydestruct ("Cleanup: discarding lookahead",
5475 while (yyssp != yyss)
5477 yydestruct ("Cleanup: popping",
5478 yystos[*yyssp], yyvsp);
5483 YYSTACK_FREE (yyss);
5489 #line 2747 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
5492 void llvm::GenerateError(const std::string &message, int LineNo) {
5493 if (LineNo == -1) LineNo = llvmAsmlineno;
5494 // TODO: column number in exception
5496 TheParseError->setError(CurFilename, message, LineNo);
5500 int yyerror(const char *ErrorMsg) {
5502 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5503 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5504 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5505 if (yychar == YYEMPTY || yychar == 0)
5506 errMsg += "end-of-file.";
5508 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5509 GenerateError(errMsg);