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,
173 EXTRACTELEMENT = 364,
181 #define ESINT64VAL 258
182 #define EUINT64VAL 259
202 #define STRINGCONSTANT 279
203 #define IMPLEMENTATION 280
204 #define ZEROINITIALIZER 281
215 #define DOTDOTDOT 292
222 #define APPENDING 299
223 #define DLLIMPORT 300
224 #define DLLEXPORT 301
225 #define EXTERN_WEAK 302
232 #define POINTERSIZE 309
241 #define SIDEEFFECT 318
244 #define CSRETCC_TOK 321
245 #define FASTCC_TOK 322
246 #define COLDCC_TOK 323
247 #define X86_STDCALLCC_TOK 324
248 #define X86_FASTCALLCC_TOK 325
249 #define DATALAYOUT 326
255 #define UNREACHABLE 332
279 #define GETELEMENTPTR 356
287 #define EXTRACTELEMENT 364
288 #define INSERTELEMENT 365
289 #define SHUFFLEVECTOR 366
290 #define VAARG_old 367
291 #define VANEXT_old 368
296 /* Copy the first part of user declarations. */
297 #line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
299 #include "ParserInternals.h"
300 #include "llvm/CallingConv.h"
301 #include "llvm/InlineAsm.h"
302 #include "llvm/Instructions.h"
303 #include "llvm/Module.h"
304 #include "llvm/SymbolTable.h"
305 #include "llvm/Assembly/AutoUpgrade.h"
306 #include "llvm/Support/GetElementPtrTypeIterator.h"
307 #include "llvm/ADT/STLExtras.h"
308 #include "llvm/Support/MathExtras.h"
314 // The following is a gross hack. In order to rid the libAsmParser library of
315 // exceptions, we have to have a way of getting the yyparse function to go into
316 // an error situation. So, whenever we want an error to occur, the GenerateError
317 // function (see bottom of file) sets TriggerError. Then, at the end of each
318 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
319 // (a goto) to put YACC in error state. Furthermore, several calls to
320 // GenerateError are made from inside productions and they must simulate the
321 // previous exception behavior by exiting the production immediately. We have
322 // replaced these with the GEN_ERROR macro which calls GeneratError and then
323 // immediately invokes YYERROR. This would be so much cleaner if it was a
324 // recursive descent parser.
325 static bool TriggerError = false;
326 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
327 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
329 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
330 int yylex(); // declaration" of xxx warnings.
334 std::string CurFilename;
336 using namespace llvm;
338 static Module *ParserResult;
340 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
341 // relating to upreferences in the input stream.
343 //#define DEBUG_UPREFS 1
345 #define UR_OUT(X) std::cerr << X
350 #define YYERROR_VERBOSE 1
352 static bool ObsoleteVarArgs;
353 static bool NewVarArgs;
354 static BasicBlock *CurBB;
355 static GlobalVariable *CurGV;
358 // This contains info used when building the body of a function. It is
359 // destroyed when the function is completed.
361 typedef std::vector<Value *> ValueList; // Numbered defs
363 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
364 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
366 static struct PerModuleInfo {
367 Module *CurrentModule;
368 std::map<const Type *, ValueList> Values; // Module level numbered definitions
369 std::map<const Type *,ValueList> LateResolveValues;
370 std::vector<PATypeHolder> Types;
371 std::map<ValID, PATypeHolder> LateResolveTypes;
373 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
374 /// how they were referenced and on which line of the input they came from so
375 /// that we can resolve them later and print error messages as appropriate.
376 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
378 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
379 // references to global values. Global values may be referenced before they
380 // are defined, and if so, the temporary object that they represent is held
381 // here. This is used for forward references of GlobalValues.
383 typedef std::map<std::pair<const PointerType *,
384 ValID>, GlobalValue*> GlobalRefsType;
385 GlobalRefsType GlobalRefs;
388 // If we could not resolve some functions at function compilation time
389 // (calls to functions before they are defined), resolve them now... Types
390 // are resolved when the constant pool has been completely parsed.
392 ResolveDefinitions(LateResolveValues);
396 // Check to make sure that all global value forward references have been
399 if (!GlobalRefs.empty()) {
400 std::string UndefinedReferences = "Unresolved global references exist:\n";
402 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
404 UndefinedReferences += " " + I->first.first->getDescription() + " " +
405 I->first.second.getName() + "\n";
407 GenerateError(UndefinedReferences);
411 // Look for intrinsic functions and CallInst that need to be upgraded
412 for (Module::iterator FI = CurrentModule->begin(),
413 FE = CurrentModule->end(); FI != FE; )
414 UpgradeCallsToIntrinsic(FI++);
416 Values.clear(); // Clear out function local definitions
421 // GetForwardRefForGlobal - Check to see if there is a forward reference
422 // for this global. If so, remove it from the GlobalRefs map and return it.
423 // If not, just return null.
424 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
425 // Check to see if there is a forward reference to this global variable...
426 // if there is, eliminate it and patch the reference to use the new def'n.
427 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
428 GlobalValue *Ret = 0;
429 if (I != GlobalRefs.end()) {
437 static struct PerFunctionInfo {
438 Function *CurrentFunction; // Pointer to current function being created
440 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
441 std::map<const Type*, ValueList> LateResolveValues;
442 bool isDeclare; // Is this function a forward declararation?
443 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
445 /// BBForwardRefs - When we see forward references to basic blocks, keep
446 /// track of them here.
447 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
448 std::vector<BasicBlock*> NumberedBlocks;
451 inline PerFunctionInfo() {
454 Linkage = GlobalValue::ExternalLinkage;
457 inline void FunctionStart(Function *M) {
462 void FunctionDone() {
463 NumberedBlocks.clear();
465 // Any forward referenced blocks left?
466 if (!BBForwardRefs.empty()) {
467 GenerateError("Undefined reference to label " +
468 BBForwardRefs.begin()->first->getName());
472 // Resolve all forward references now.
473 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
475 Values.clear(); // Clear out function local definitions
478 Linkage = GlobalValue::ExternalLinkage;
480 } CurFun; // Info for the current function...
482 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
485 //===----------------------------------------------------------------------===//
486 // Code to handle definitions of all the types
487 //===----------------------------------------------------------------------===//
489 static int InsertValue(Value *V,
490 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
491 if (V->hasName()) return -1; // Is this a numbered definition?
493 // Yes, insert the value into the value table...
494 ValueList &List = ValueTab[V->getType()];
496 return List.size()-1;
499 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
501 case ValID::NumberVal: // Is it a numbered definition?
502 // Module constants occupy the lowest numbered slots...
503 if ((unsigned)D.Num < CurModule.Types.size())
504 return CurModule.Types[(unsigned)D.Num];
506 case ValID::NameVal: // Is it a named definition?
507 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
508 D.destroy(); // Free old strdup'd memory...
513 GenerateError("Internal parser error: Invalid symbol type reference!");
517 // If we reached here, we referenced either a symbol that we don't know about
518 // or an id number that hasn't been read yet. We may be referencing something
519 // forward, so just create an entry to be resolved later and get to it...
521 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
524 if (inFunctionScope()) {
525 if (D.Type == ValID::NameVal) {
526 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
529 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
534 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
535 if (I != CurModule.LateResolveTypes.end())
538 Type *Typ = OpaqueType::get();
539 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
543 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
544 SymbolTable &SymTab =
545 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
546 CurModule.CurrentModule->getSymbolTable();
547 return SymTab.lookup(Ty, Name);
550 // getValNonImprovising - Look up the value specified by the provided type and
551 // the provided ValID. If the value exists and has already been defined, return
552 // it. Otherwise return null.
554 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
555 if (isa<FunctionType>(Ty)) {
556 GenerateError("Functions are not values and "
557 "must be referenced as pointers");
562 case ValID::NumberVal: { // Is it a numbered definition?
563 unsigned Num = (unsigned)D.Num;
565 // Module constants occupy the lowest numbered slots...
566 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
567 if (VI != CurModule.Values.end()) {
568 if (Num < VI->second.size())
569 return VI->second[Num];
570 Num -= VI->second.size();
573 // Make sure that our type is within bounds
574 VI = CurFun.Values.find(Ty);
575 if (VI == CurFun.Values.end()) return 0;
577 // Check that the number is within bounds...
578 if (VI->second.size() <= Num) return 0;
580 return VI->second[Num];
583 case ValID::NameVal: { // Is it a named definition?
584 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
585 if (N == 0) return 0;
587 D.destroy(); // Free old strdup'd memory...
591 // Check to make sure that "Ty" is an integral type, and that our
592 // value will fit into the specified type...
593 case ValID::ConstSIntVal: // Is it a constant pool reference??
594 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
595 GenerateError("Signed integral constant '" +
596 itostr(D.ConstPool64) + "' is invalid for type '" +
597 Ty->getDescription() + "'!");
600 return ConstantInt::get(Ty, D.ConstPool64);
602 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
603 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
604 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
605 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
606 "' is invalid or out of range!");
608 } else { // This is really a signed reference. Transmogrify.
609 return ConstantInt::get(Ty, D.ConstPool64);
612 return ConstantInt::get(Ty, D.UConstPool64);
615 case ValID::ConstFPVal: // Is it a floating point const pool reference?
616 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
617 GenerateError("FP constant invalid for type!!");
620 return ConstantFP::get(Ty, D.ConstPoolFP);
622 case ValID::ConstNullVal: // Is it a null value?
623 if (!isa<PointerType>(Ty)) {
624 GenerateError("Cannot create a a non pointer null!");
627 return ConstantPointerNull::get(cast<PointerType>(Ty));
629 case ValID::ConstUndefVal: // Is it an undef value?
630 return UndefValue::get(Ty);
632 case ValID::ConstZeroVal: // Is it a zero value?
633 return Constant::getNullValue(Ty);
635 case ValID::ConstantVal: // Fully resolved constant?
636 if (D.ConstantValue->getType() != Ty) {
637 GenerateError("Constant expression type different from required type!");
640 return D.ConstantValue;
642 case ValID::InlineAsmVal: { // Inline asm expression
643 const PointerType *PTy = dyn_cast<PointerType>(Ty);
644 const FunctionType *FTy =
645 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
646 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
647 GenerateError("Invalid type for asm constraint string!");
650 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
651 D.IAD->HasSideEffects);
652 D.destroy(); // Free InlineAsmDescriptor.
656 assert(0 && "Unhandled case!");
660 assert(0 && "Unhandled case!");
664 // getVal - This function is identical to getValNonImprovising, except that if a
665 // value is not already defined, it "improvises" by creating a placeholder var
666 // that looks and acts just like the requested variable. When the value is
667 // defined later, all uses of the placeholder variable are replaced with the
670 static Value *getVal(const Type *Ty, const ValID &ID) {
671 if (Ty == Type::LabelTy) {
672 GenerateError("Cannot use a basic block here");
676 // See if the value has already been defined.
677 Value *V = getValNonImprovising(Ty, ID);
679 if (TriggerError) return 0;
681 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
682 GenerateError("Invalid use of a composite type!");
686 // If we reached here, we referenced either a symbol that we don't know about
687 // or an id number that hasn't been read yet. We may be referencing something
688 // forward, so just create an entry to be resolved later and get to it...
690 V = new Argument(Ty);
692 // Remember where this forward reference came from. FIXME, shouldn't we try
693 // to recycle these things??
694 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
697 if (inFunctionScope())
698 InsertValue(V, CurFun.LateResolveValues);
700 InsertValue(V, CurModule.LateResolveValues);
704 /// getBBVal - This is used for two purposes:
705 /// * If isDefinition is true, a new basic block with the specified ID is being
707 /// * If isDefinition is true, this is a reference to a basic block, which may
708 /// or may not be a forward reference.
710 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
711 assert(inFunctionScope() && "Can't get basic block at global scope!");
717 GenerateError("Illegal label reference " + ID.getName());
719 case ValID::NumberVal: // Is it a numbered definition?
720 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
721 CurFun.NumberedBlocks.resize(ID.Num+1);
722 BB = CurFun.NumberedBlocks[ID.Num];
724 case ValID::NameVal: // Is it a named definition?
726 if (Value *N = CurFun.CurrentFunction->
727 getSymbolTable().lookup(Type::LabelTy, Name))
728 BB = cast<BasicBlock>(N);
732 // See if the block has already been defined.
734 // If this is the definition of the block, make sure the existing value was
735 // just a forward reference. If it was a forward reference, there will be
736 // an entry for it in the PlaceHolderInfo map.
737 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
738 // The existing value was a definition, not a forward reference.
739 GenerateError("Redefinition of label " + ID.getName());
743 ID.destroy(); // Free strdup'd memory.
747 // Otherwise this block has not been seen before.
748 BB = new BasicBlock("", CurFun.CurrentFunction);
749 if (ID.Type == ValID::NameVal) {
750 BB->setName(ID.Name);
752 CurFun.NumberedBlocks[ID.Num] = BB;
755 // If this is not a definition, keep track of it so we can use it as a forward
758 // Remember where this forward reference came from.
759 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
761 // The forward declaration could have been inserted anywhere in the
762 // function: insert it into the correct place now.
763 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
764 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
771 //===----------------------------------------------------------------------===//
772 // Code to handle forward references in instructions
773 //===----------------------------------------------------------------------===//
775 // This code handles the late binding needed with statements that reference
776 // values not defined yet... for example, a forward branch, or the PHI node for
779 // This keeps a table (CurFun.LateResolveValues) of all such forward references
780 // and back patchs after we are done.
783 // ResolveDefinitions - If we could not resolve some defs at parsing
784 // time (forward branches, phi functions for loops, etc...) resolve the
788 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
789 std::map<const Type*,ValueList> *FutureLateResolvers) {
790 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
791 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
792 E = LateResolvers.end(); LRI != E; ++LRI) {
793 ValueList &List = LRI->second;
794 while (!List.empty()) {
795 Value *V = List.back();
798 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
799 CurModule.PlaceHolderInfo.find(V);
800 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
802 ValID &DID = PHI->second.first;
804 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
808 V->replaceAllUsesWith(TheRealValue);
810 CurModule.PlaceHolderInfo.erase(PHI);
811 } else if (FutureLateResolvers) {
812 // Functions have their unresolved items forwarded to the module late
814 InsertValue(V, *FutureLateResolvers);
816 if (DID.Type == ValID::NameVal) {
817 GenerateError("Reference to an invalid definition: '" +DID.getName()+
818 "' of type '" + V->getType()->getDescription() + "'",
822 GenerateError("Reference to an invalid definition: #" +
823 itostr(DID.Num) + " of type '" +
824 V->getType()->getDescription() + "'",
832 LateResolvers.clear();
835 // ResolveTypeTo - A brand new type was just declared. This means that (if
836 // name is not null) things referencing Name can be resolved. Otherwise, things
837 // refering to the number can be resolved. Do this now.
839 static void ResolveTypeTo(char *Name, const Type *ToTy) {
841 if (Name) D = ValID::create(Name);
842 else D = ValID::create((int)CurModule.Types.size());
844 std::map<ValID, PATypeHolder>::iterator I =
845 CurModule.LateResolveTypes.find(D);
846 if (I != CurModule.LateResolveTypes.end()) {
847 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
848 CurModule.LateResolveTypes.erase(I);
852 // setValueName - Set the specified value to the name given. The name may be
853 // null potentially, in which case this is a noop. The string passed in is
854 // assumed to be a malloc'd string buffer, and is free'd by this function.
856 static void setValueName(Value *V, char *NameStr) {
858 std::string Name(NameStr); // Copy string
859 free(NameStr); // Free old string
861 if (V->getType() == Type::VoidTy) {
862 GenerateError("Can't assign name '" + Name+"' to value with void type!");
866 assert(inFunctionScope() && "Must be in function scope!");
867 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
868 if (ST.lookup(V->getType(), Name)) {
869 GenerateError("Redefinition of value named '" + Name + "' in the '" +
870 V->getType()->getDescription() + "' type plane!");
879 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
880 /// this is a declaration, otherwise it is a definition.
881 static GlobalVariable *
882 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
883 bool isConstantGlobal, const Type *Ty,
884 Constant *Initializer) {
885 if (isa<FunctionType>(Ty)) {
886 GenerateError("Cannot declare global vars of function type!");
890 const PointerType *PTy = PointerType::get(Ty);
894 Name = NameStr; // Copy string
895 free(NameStr); // Free old string
898 // See if this global value was forward referenced. If so, recycle the
902 ID = ValID::create((char*)Name.c_str());
904 ID = ValID::create((int)CurModule.Values[PTy].size());
907 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
908 // Move the global to the end of the list, from whereever it was
909 // previously inserted.
910 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
911 CurModule.CurrentModule->getGlobalList().remove(GV);
912 CurModule.CurrentModule->getGlobalList().push_back(GV);
913 GV->setInitializer(Initializer);
914 GV->setLinkage(Linkage);
915 GV->setConstant(isConstantGlobal);
916 InsertValue(GV, CurModule.Values);
920 // If this global has a name, check to see if there is already a definition
921 // of this global in the module. If so, merge as appropriate. Note that
922 // this is really just a hack around problems in the CFE. :(
924 // We are a simple redefinition of a value, check to see if it is defined
925 // the same as the old one.
926 if (GlobalVariable *EGV =
927 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
928 // We are allowed to redefine a global variable in two circumstances:
929 // 1. If at least one of the globals is uninitialized or
930 // 2. If both initializers have the same value.
932 if (!EGV->hasInitializer() || !Initializer ||
933 EGV->getInitializer() == Initializer) {
935 // Make sure the existing global version gets the initializer! Make
936 // sure that it also gets marked const if the new version is.
937 if (Initializer && !EGV->hasInitializer())
938 EGV->setInitializer(Initializer);
939 if (isConstantGlobal)
940 EGV->setConstant(true);
941 EGV->setLinkage(Linkage);
945 GenerateError("Redefinition of global variable named '" + Name +
946 "' in the '" + Ty->getDescription() + "' type plane!");
951 // Otherwise there is no existing GV to use, create one now.
953 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
954 CurModule.CurrentModule);
955 InsertValue(GV, CurModule.Values);
959 // setTypeName - Set the specified type to the name given. The name may be
960 // null potentially, in which case this is a noop. The string passed in is
961 // assumed to be a malloc'd string buffer, and is freed by this function.
963 // This function returns true if the type has already been defined, but is
964 // allowed to be redefined in the specified context. If the name is a new name
965 // for the type plane, it is inserted and false is returned.
966 static bool setTypeName(const Type *T, char *NameStr) {
967 assert(!inFunctionScope() && "Can't give types function-local names!");
968 if (NameStr == 0) return false;
970 std::string Name(NameStr); // Copy string
971 free(NameStr); // Free old string
973 // We don't allow assigning names to void type
974 if (T == Type::VoidTy) {
975 GenerateError("Can't assign name '" + Name + "' to the void type!");
979 // Set the type name, checking for conflicts as we do so.
980 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
982 if (AlreadyExists) { // Inserting a name that is already defined???
983 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
984 assert(Existing && "Conflict but no matching type?");
986 // There is only one case where this is allowed: when we are refining an
987 // opaque type. In this case, Existing will be an opaque type.
988 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
989 // We ARE replacing an opaque type!
990 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
994 // Otherwise, this is an attempt to redefine a type. That's okay if
995 // the redefinition is identical to the original. This will be so if
996 // Existing and T point to the same Type object. In this one case we
997 // allow the equivalent redefinition.
998 if (Existing == T) return true; // Yes, it's equal.
1000 // Any other kind of (non-equivalent) redefinition is an error.
1001 GenerateError("Redefinition of type named '" + Name + "' in the '" +
1002 T->getDescription() + "' type plane!");
1008 //===----------------------------------------------------------------------===//
1009 // Code for handling upreferences in type names...
1012 // TypeContains - Returns true if Ty directly contains E in it.
1014 static bool TypeContains(const Type *Ty, const Type *E) {
1015 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1016 E) != Ty->subtype_end();
1020 struct UpRefRecord {
1021 // NestingLevel - The number of nesting levels that need to be popped before
1022 // this type is resolved.
1023 unsigned NestingLevel;
1025 // LastContainedTy - This is the type at the current binding level for the
1026 // type. Every time we reduce the nesting level, this gets updated.
1027 const Type *LastContainedTy;
1029 // UpRefTy - This is the actual opaque type that the upreference is
1030 // represented with.
1031 OpaqueType *UpRefTy;
1033 UpRefRecord(unsigned NL, OpaqueType *URTy)
1034 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1038 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1039 static std::vector<UpRefRecord> UpRefs;
1041 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1042 /// called. It loops through the UpRefs vector, which is a list of the
1043 /// currently active types. For each type, if the up reference is contained in
1044 /// the newly completed type, we decrement the level count. When the level
1045 /// count reaches zero, the upreferenced type is the type that is passed in:
1046 /// thus we can complete the cycle.
1048 static PATypeHolder HandleUpRefs(const Type *ty) {
1049 // If Ty isn't abstract, or if there are no up-references in it, then there is
1050 // nothing to resolve here.
1051 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1053 PATypeHolder Ty(ty);
1054 UR_OUT("Type '" << Ty->getDescription() <<
1055 "' newly formed. Resolving upreferences.\n" <<
1056 UpRefs.size() << " upreferences active!\n");
1058 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1059 // to zero), we resolve them all together before we resolve them to Ty. At
1060 // the end of the loop, if there is anything to resolve to Ty, it will be in
1062 OpaqueType *TypeToResolve = 0;
1064 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1065 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1066 << UpRefs[i].second->getDescription() << ") = "
1067 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1068 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1069 // Decrement level of upreference
1070 unsigned Level = --UpRefs[i].NestingLevel;
1071 UpRefs[i].LastContainedTy = Ty;
1072 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1073 if (Level == 0) { // Upreference should be resolved!
1074 if (!TypeToResolve) {
1075 TypeToResolve = UpRefs[i].UpRefTy;
1077 UR_OUT(" * Resolving upreference for "
1078 << UpRefs[i].second->getDescription() << "\n";
1079 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1080 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1081 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1082 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1084 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1085 --i; // Do not skip the next element...
1090 if (TypeToResolve) {
1091 UR_OUT(" * Resolving upreference for "
1092 << UpRefs[i].second->getDescription() << "\n";
1093 std::string OldName = TypeToResolve->getDescription());
1094 TypeToResolve->refineAbstractTypeTo(Ty);
1100 /// This function is used to obtain the correct opcode for an instruction when
1101 /// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both
1102 /// an opcode and an "obsolete" flag. These are generated by the lexer and
1103 /// the "obsolete" member will be true when the lexer encounters the token for
1104 /// an obsolete opcode. For example, "div" was replaced by [usf]div but we need
1105 /// to maintain backwards compatibility for asm files that still have the "div"
1106 /// instruction. This function handles converting div -> [usf]div appropriately.
1107 /// @brief Convert obsolete BinaryOps opcodes to new values
1109 sanitizeOpCode(OpcodeInfo<Instruction::BinaryOps> &OI, const PATypeHolder& PATy)
1111 // If its not obsolete, don't do anything
1115 // If its a packed type we want to use the element type
1116 const Type* Ty = PATy;
1117 if (const PackedType* PTy = dyn_cast<PackedType>(Ty))
1118 Ty = PTy->getElementType();
1120 // Depending on the opcode ..
1121 switch (OI.opcode) {
1123 GenerateError("Invalid obsolete opCode (check Lexer.l)");
1125 case Instruction::UDiv:
1126 // Handle cases where the opcode needs to change
1127 if (Ty->isFloatingPoint())
1128 OI.opcode = Instruction::FDiv;
1129 else if (Ty->isSigned())
1130 OI.opcode = Instruction::SDiv;
1132 case Instruction::URem:
1133 if (Ty->isFloatingPoint())
1134 OI.opcode = Instruction::FRem;
1135 else if (Ty->isSigned())
1136 OI.opcode = Instruction::SRem;
1139 // Its not obsolete any more, we fixed it.
1140 OI.obsolete = false;
1143 /// This function is similar to the previous overload of sanitizeOpCode but
1144 /// operates on Instruction::OtherOps instead of Instruction::BinaryOps.
1145 /// @brief Convert obsolete OtherOps opcodes to new values
1147 sanitizeOpCode(OpcodeInfo<Instruction::OtherOps> &OI, const PATypeHolder& PATy)
1149 // If its not obsolete, don't do anything
1153 const Type* Ty = PATy; // type conversion
1154 switch (OI.opcode) {
1156 GenerateError("Invalid obsolete opcode (check Lexer.l)");
1158 case Instruction::LShr:
1160 OI.opcode = Instruction::AShr;
1163 // Its not obsolete any more, we fixed it.
1164 OI.obsolete = false;
1167 // common code from the two 'RunVMAsmParser' functions
1168 static Module* RunParser(Module * M) {
1170 llvmAsmlineno = 1; // Reset the current line number...
1171 ObsoleteVarArgs = false;
1173 CurModule.CurrentModule = M;
1175 // Check to make sure the parser succeeded
1178 delete ParserResult;
1182 // Check to make sure that parsing produced a result
1186 // Reset ParserResult variable while saving its value for the result.
1187 Module *Result = ParserResult;
1190 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1193 if ((F = Result->getNamedFunction("llvm.va_start"))
1194 && F->getFunctionType()->getNumParams() == 0)
1195 ObsoleteVarArgs = true;
1196 if((F = Result->getNamedFunction("llvm.va_copy"))
1197 && F->getFunctionType()->getNumParams() == 1)
1198 ObsoleteVarArgs = true;
1201 if (ObsoleteVarArgs && NewVarArgs) {
1203 "This file is corrupt: it uses both new and old style varargs");
1207 if(ObsoleteVarArgs) {
1208 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1209 if (F->arg_size() != 0) {
1210 GenerateError("Obsolete va_start takes 0 argument!");
1216 //bar = alloca typeof(foo)
1220 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1221 const Type* ArgTy = F->getFunctionType()->getReturnType();
1222 const Type* ArgTyPtr = PointerType::get(ArgTy);
1223 Function* NF = Result->getOrInsertFunction("llvm.va_start",
1224 RetTy, ArgTyPtr, (Type *)0);
1226 while (!F->use_empty()) {
1227 CallInst* CI = cast<CallInst>(F->use_back());
1228 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1229 new CallInst(NF, bar, "", CI);
1230 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1231 CI->replaceAllUsesWith(foo);
1232 CI->getParent()->getInstList().erase(CI);
1234 Result->getFunctionList().erase(F);
1237 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1238 if(F->arg_size() != 1) {
1239 GenerateError("Obsolete va_end takes 1 argument!");
1245 //bar = alloca 1 of typeof(foo)
1247 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1248 const Type* ArgTy = F->getFunctionType()->getParamType(0);
1249 const Type* ArgTyPtr = PointerType::get(ArgTy);
1250 Function* NF = Result->getOrInsertFunction("llvm.va_end",
1251 RetTy, ArgTyPtr, (Type *)0);
1253 while (!F->use_empty()) {
1254 CallInst* CI = cast<CallInst>(F->use_back());
1255 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1256 new StoreInst(CI->getOperand(1), bar, CI);
1257 new CallInst(NF, bar, "", CI);
1258 CI->getParent()->getInstList().erase(CI);
1260 Result->getFunctionList().erase(F);
1263 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1264 if(F->arg_size() != 1) {
1265 GenerateError("Obsolete va_copy takes 1 argument!");
1270 //a = alloca 1 of typeof(foo)
1271 //b = alloca 1 of typeof(foo)
1276 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1277 const Type* ArgTy = F->getFunctionType()->getReturnType();
1278 const Type* ArgTyPtr = PointerType::get(ArgTy);
1279 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
1280 RetTy, ArgTyPtr, ArgTyPtr,
1283 while (!F->use_empty()) {
1284 CallInst* CI = cast<CallInst>(F->use_back());
1285 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1286 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1287 new StoreInst(CI->getOperand(1), b, CI);
1288 new CallInst(NF, a, b, "", CI);
1289 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1290 CI->replaceAllUsesWith(foo);
1291 CI->getParent()->getInstList().erase(CI);
1293 Result->getFunctionList().erase(F);
1300 //===----------------------------------------------------------------------===//
1301 // RunVMAsmParser - Define an interface to this parser
1302 //===----------------------------------------------------------------------===//
1304 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1307 CurFilename = Filename;
1308 return RunParser(new Module(CurFilename));
1311 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1312 set_scan_string(AsmString);
1314 CurFilename = "from_memory";
1316 return RunParser(new Module (CurFilename));
1318 return RunParser(M);
1324 /* Enabling traces. */
1329 /* Enabling verbose error messages. */
1330 #ifdef YYERROR_VERBOSE
1331 # undef YYERROR_VERBOSE
1332 # define YYERROR_VERBOSE 1
1334 # define YYERROR_VERBOSE 0
1337 /* Enabling the token table. */
1338 #ifndef YYTOKEN_TABLE
1339 # define YYTOKEN_TABLE 0
1342 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1343 #line 1040 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
1344 typedef union YYSTYPE {
1345 llvm::Module *ModuleVal;
1346 llvm::Function *FunctionVal;
1347 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
1348 llvm::BasicBlock *BasicBlockVal;
1349 llvm::TerminatorInst *TermInstVal;
1350 llvm::Instruction *InstVal;
1351 llvm::Constant *ConstVal;
1353 const llvm::Type *PrimType;
1354 llvm::PATypeHolder *TypeVal;
1355 llvm::Value *ValueVal;
1357 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1358 std::vector<llvm::Value*> *ValueList;
1359 std::list<llvm::PATypeHolder> *TypeList;
1360 // Represent the RHS of PHI node
1361 std::list<std::pair<llvm::Value*,
1362 llvm::BasicBlock*> > *PHIList;
1363 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1364 std::vector<llvm::Constant*> *ConstVector;
1366 llvm::GlobalValue::LinkageTypes Linkage;
1374 char *StrVal; // This memory is strdup'd!
1375 llvm::ValID ValIDVal; // strdup'd memory maybe!
1377 BinaryOpInfo BinaryOpVal;
1378 TermOpInfo TermOpVal;
1380 OtherOpInfo OtherOpVal;
1381 llvm::Module::Endianness Endianness;
1383 /* Line 196 of yacc.c. */
1384 #line 1385 "llvmAsmParser.tab.c"
1385 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1386 # define YYSTYPE_IS_DECLARED 1
1387 # define YYSTYPE_IS_TRIVIAL 1
1392 /* Copy the second part of user declarations. */
1395 /* Line 219 of yacc.c. */
1396 #line 1397 "llvmAsmParser.tab.c"
1398 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1399 # define YYSIZE_T __SIZE_TYPE__
1401 #if ! defined (YYSIZE_T) && defined (size_t)
1402 # define YYSIZE_T size_t
1404 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1405 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1406 # define YYSIZE_T size_t
1408 #if ! defined (YYSIZE_T)
1409 # define YYSIZE_T unsigned int
1415 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1416 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1420 # define YY_(msgid) msgid
1424 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1426 /* The parser invokes alloca or malloc; define the necessary symbols. */
1428 # ifdef YYSTACK_USE_ALLOCA
1429 # if YYSTACK_USE_ALLOCA
1431 # define YYSTACK_ALLOC __builtin_alloca
1433 # define YYSTACK_ALLOC alloca
1434 # if defined (__STDC__) || defined (__cplusplus)
1435 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1436 # define YYINCLUDED_STDLIB_H
1442 # ifdef YYSTACK_ALLOC
1443 /* Pacify GCC's `empty if-body' warning. */
1444 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1445 # ifndef YYSTACK_ALLOC_MAXIMUM
1446 /* The OS might guarantee only one guard page at the bottom of the stack,
1447 and a page size can be as small as 4096 bytes. So we cannot safely
1448 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1449 to allow for a few compiler-allocated temporary stack slots. */
1450 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1453 # define YYSTACK_ALLOC YYMALLOC
1454 # define YYSTACK_FREE YYFREE
1455 # ifndef YYSTACK_ALLOC_MAXIMUM
1456 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1462 # define YYMALLOC malloc
1463 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1464 && (defined (__STDC__) || defined (__cplusplus)))
1465 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1469 # define YYFREE free
1470 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1471 && (defined (__STDC__) || defined (__cplusplus)))
1472 void free (void *); /* INFRINGES ON USER NAME SPACE */
1479 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1482 #if (! defined (yyoverflow) \
1483 && (! defined (__cplusplus) \
1484 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1486 /* A type that is properly aligned for any stack member. */
1493 /* The size of the maximum gap between one aligned stack and the next. */
1494 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1496 /* The size of an array large to enough to hold all stacks, each with
1498 # define YYSTACK_BYTES(N) \
1499 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1500 + YYSTACK_GAP_MAXIMUM)
1502 /* Copy COUNT objects from FROM to TO. The source and destination do
1505 # if defined (__GNUC__) && 1 < __GNUC__
1506 # define YYCOPY(To, From, Count) \
1507 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1509 # define YYCOPY(To, From, Count) \
1513 for (yyi = 0; yyi < (Count); yyi++) \
1514 (To)[yyi] = (From)[yyi]; \
1520 /* Relocate STACK from its old location to the new one. The
1521 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1522 elements in the stack, and YYPTR gives the new location of the
1523 stack. Advance YYPTR to a properly aligned location for the next
1525 # define YYSTACK_RELOCATE(Stack) \
1528 YYSIZE_T yynewbytes; \
1529 YYCOPY (&yyptr->Stack, Stack, yysize); \
1530 Stack = &yyptr->Stack; \
1531 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1532 yyptr += yynewbytes / sizeof (*yyptr); \
1538 #if defined (__STDC__) || defined (__cplusplus)
1539 typedef signed char yysigned_char;
1541 typedef short int yysigned_char;
1544 /* YYFINAL -- State number of the termination state. */
1546 /* YYLAST -- Last index in YYTABLE. */
1549 /* YYNTOKENS -- Number of terminals. */
1550 #define YYNTOKENS 128
1551 /* YYNNTS -- Number of nonterminals. */
1553 /* YYNRULES -- Number of rules. */
1554 #define YYNRULES 257
1555 /* YYNRULES -- Number of states. */
1556 #define YYNSTATES 522
1558 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1559 #define YYUNDEFTOK 2
1560 #define YYMAXUTOK 368
1562 #define YYTRANSLATE(YYX) \
1563 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1565 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1566 static const unsigned char yytranslate[] =
1568 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1572 117, 118, 126, 2, 115, 2, 2, 2, 2, 2,
1573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1574 122, 114, 123, 2, 2, 2, 2, 2, 2, 2,
1575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1577 2, 119, 116, 121, 2, 2, 2, 2, 2, 127,
1578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1580 120, 2, 2, 124, 2, 125, 2, 2, 2, 2,
1581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1593 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1594 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1595 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1596 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1597 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1598 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1599 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1600 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1601 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1602 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1603 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1604 105, 106, 107, 108, 109, 110, 111, 112, 113
1608 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1610 static const unsigned short int yyprhs[] =
1612 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1613 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1614 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1615 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1616 80, 81, 83, 85, 87, 89, 91, 93, 95, 96,
1617 97, 99, 101, 103, 105, 107, 109, 112, 113, 116,
1618 117, 121, 124, 125, 127, 128, 132, 134, 137, 139,
1619 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1620 161, 163, 165, 167, 169, 171, 173, 175, 177, 179,
1621 182, 187, 193, 199, 203, 206, 209, 211, 215, 217,
1622 221, 223, 224, 229, 233, 237, 242, 247, 251, 254,
1623 257, 260, 263, 266, 269, 272, 275, 278, 281, 288,
1624 294, 303, 310, 317, 324, 331, 338, 347, 356, 360,
1625 362, 364, 366, 368, 371, 374, 379, 382, 384, 389,
1626 392, 397, 398, 406, 407, 415, 416, 424, 425, 433,
1627 437, 442, 443, 445, 447, 449, 453, 457, 461, 465,
1628 469, 473, 475, 476, 478, 480, 482, 483, 486, 490,
1629 492, 494, 498, 500, 501, 510, 512, 514, 518, 520,
1630 522, 525, 526, 528, 530, 531, 536, 537, 539, 541,
1631 543, 545, 547, 549, 551, 553, 555, 559, 561, 567,
1632 569, 571, 573, 575, 578, 581, 584, 588, 591, 592,
1633 594, 597, 600, 604, 614, 624, 633, 647, 649, 651,
1634 658, 664, 667, 674, 682, 684, 688, 690, 691, 694,
1635 696, 702, 708, 714, 717, 722, 727, 734, 739, 744,
1636 749, 754, 761, 768, 771, 779, 781, 784, 785, 787,
1637 788, 792, 799, 803, 810, 813, 818, 825
1640 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1641 static const short int yyrhs[] =
1643 159, 0, -1, 5, -1, 6, -1, 3, -1, 4,
1644 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1645 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1646 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
1647 -1, 93, -1, 94, -1, 95, -1, 105, -1, 106,
1648 -1, 107, -1, 16, -1, 14, -1, 12, -1, 10,
1649 -1, 17, -1, 15, -1, 13, -1, 11, -1, 135,
1650 -1, 136, -1, 18, -1, 19, -1, 171, 114, -1,
1651 -1, 41, -1, 42, -1, 43, -1, 44, -1, 45,
1652 -1, 46, -1, 47, -1, -1, -1, 65, -1, 66,
1653 -1, 67, -1, 68, -1, 69, -1, 70, -1, 64,
1654 4, -1, -1, 57, 4, -1, -1, 115, 57, 4,
1655 -1, 34, 24, -1, -1, 144, -1, -1, 115, 147,
1656 146, -1, 144, -1, 57, 4, -1, 150, -1, 8,
1657 -1, 152, -1, 8, -1, 152, -1, 9, -1, 10,
1658 -1, 11, -1, 12, -1, 13, -1, 14, -1, 15,
1659 -1, 16, -1, 17, -1, 18, -1, 19, -1, 20,
1660 -1, 21, -1, 48, -1, 151, -1, 186, -1, 116,
1661 4, -1, 149, 117, 154, 118, -1, 119, 4, 120,
1662 152, 121, -1, 122, 4, 120, 152, 123, -1, 124,
1663 153, 125, -1, 124, 125, -1, 152, 126, -1, 152,
1664 -1, 153, 115, 152, -1, 153, -1, 153, 115, 37,
1665 -1, 37, -1, -1, 150, 119, 157, 121, -1, 150,
1666 119, 121, -1, 150, 127, 24, -1, 150, 122, 157,
1667 123, -1, 150, 124, 157, 125, -1, 150, 124, 125,
1668 -1, 150, 38, -1, 150, 39, -1, 150, 186, -1,
1669 150, 156, -1, 150, 26, -1, 135, 130, -1, 136,
1670 4, -1, 9, 27, -1, 9, 28, -1, 138, 7,
1671 -1, 103, 117, 155, 36, 150, 118, -1, 101, 117,
1672 155, 200, 118, -1, 104, 117, 155, 115, 155, 115,
1673 155, 118, -1, 131, 117, 155, 115, 155, 118, -1,
1674 132, 117, 155, 115, 155, 118, -1, 133, 117, 155,
1675 115, 155, 118, -1, 134, 117, 155, 115, 155, 118,
1676 -1, 109, 117, 155, 115, 155, 118, -1, 110, 117,
1677 155, 115, 155, 115, 155, 118, -1, 111, 117, 155,
1678 115, 155, 115, 155, 118, -1, 157, 115, 155, -1,
1679 155, -1, 32, -1, 33, -1, 160, -1, 160, 180,
1680 -1, 160, 182, -1, 160, 62, 61, 166, -1, 160,
1681 25, -1, 161, -1, 161, 139, 20, 148, -1, 161,
1682 182, -1, 161, 62, 61, 166, -1, -1, 161, 139,
1683 140, 158, 155, 162, 146, -1, -1, 161, 139, 50,
1684 158, 150, 163, 146, -1, -1, 161, 139, 45, 158,
1685 150, 164, 146, -1, -1, 161, 139, 47, 158, 150,
1686 165, 146, -1, 161, 51, 168, -1, 161, 58, 114,
1687 169, -1, -1, 24, -1, 56, -1, 55, -1, 53,
1688 114, 167, -1, 54, 114, 4, -1, 52, 114, 24,
1689 -1, 71, 114, 24, -1, 119, 170, 121, -1, 170,
1690 115, 24, -1, 24, -1, -1, 22, -1, 24, -1,
1691 171, -1, -1, 150, 172, -1, 174, 115, 173, -1,
1692 173, -1, 174, -1, 174, 115, 37, -1, 37, -1,
1693 -1, 141, 148, 171, 117, 175, 118, 145, 142, -1,
1694 29, -1, 124, -1, 140, 176, 177, -1, 30, -1,
1695 125, -1, 189, 179, -1, -1, 45, -1, 47, -1,
1696 -1, 31, 183, 181, 176, -1, -1, 63, -1, 3,
1697 -1, 4, -1, 7, -1, 27, -1, 28, -1, 38,
1698 -1, 39, -1, 26, -1, 122, 157, 123, -1, 156,
1699 -1, 61, 184, 24, 115, 24, -1, 129, -1, 171,
1700 -1, 186, -1, 185, -1, 150, 187, -1, 189, 190,
1701 -1, 178, 190, -1, 191, 139, 192, -1, 191, 194,
1702 -1, -1, 23, -1, 72, 188, -1, 72, 8, -1,
1703 73, 21, 187, -1, 73, 9, 187, 115, 21, 187,
1704 115, 21, 187, -1, 74, 137, 187, 115, 21, 187,
1705 119, 193, 121, -1, 74, 137, 187, 115, 21, 187,
1706 119, 121, -1, 75, 141, 148, 187, 117, 197, 118,
1707 36, 21, 187, 76, 21, 187, -1, 76, -1, 77,
1708 -1, 193, 137, 185, 115, 21, 187, -1, 137, 185,
1709 115, 21, 187, -1, 139, 199, -1, 150, 119, 187,
1710 115, 187, 121, -1, 195, 115, 119, 187, 115, 187,
1711 121, -1, 188, -1, 196, 115, 188, -1, 196, -1,
1712 -1, 60, 59, -1, 59, -1, 131, 150, 187, 115,
1713 187, -1, 132, 150, 187, 115, 187, -1, 133, 150,
1714 187, 115, 187, -1, 49, 188, -1, 134, 188, 115,
1715 188, -1, 103, 188, 36, 150, -1, 104, 188, 115,
1716 188, 115, 188, -1, 108, 188, 115, 150, -1, 112,
1717 188, 115, 150, -1, 113, 188, 115, 150, -1, 109,
1718 188, 115, 188, -1, 110, 188, 115, 188, 115, 188,
1719 -1, 111, 188, 115, 188, 115, 188, -1, 102, 195,
1720 -1, 198, 141, 148, 187, 117, 197, 118, -1, 202,
1721 -1, 115, 196, -1, -1, 35, -1, -1, 96, 150,
1722 143, -1, 96, 150, 115, 15, 187, 143, -1, 97,
1723 150, 143, -1, 97, 150, 115, 15, 187, 143, -1,
1724 98, 188, -1, 201, 99, 150, 187, -1, 201, 100,
1725 188, 115, 150, 187, -1, 101, 150, 187, 200, -1
1728 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1729 static const unsigned short int yyrline[] =
1731 0, 1163, 1163, 1164, 1172, 1173, 1183, 1183, 1183, 1183,
1732 1183, 1183, 1183, 1183, 1183, 1184, 1184, 1184, 1185, 1185,
1733 1185, 1185, 1185, 1185, 1187, 1187, 1187, 1191, 1191, 1191,
1734 1191, 1192, 1192, 1192, 1192, 1193, 1193, 1194, 1194, 1197,
1735 1201, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1215,
1736 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1231, 1232, 1238,
1737 1239, 1247, 1255, 1256, 1261, 1262, 1263, 1268, 1282, 1282,
1738 1283, 1283, 1285, 1295, 1295, 1295, 1295, 1295, 1295, 1295,
1739 1296, 1296, 1296, 1296, 1296, 1296, 1297, 1301, 1305, 1313,
1740 1321, 1334, 1339, 1351, 1361, 1365, 1376, 1381, 1387, 1388,
1741 1392, 1396, 1407, 1433, 1447, 1477, 1503, 1524, 1537, 1547,
1742 1552, 1613, 1620, 1629, 1635, 1641, 1645, 1649, 1657, 1668,
1743 1700, 1708, 1735, 1746, 1752, 1763, 1769, 1775, 1784, 1788,
1744 1796, 1796, 1806, 1814, 1819, 1823, 1827, 1831, 1846, 1868,
1745 1871, 1874, 1874, 1882, 1882, 1890, 1890, 1898, 1898, 1907,
1746 1910, 1913, 1917, 1930, 1931, 1933, 1937, 1946, 1950, 1955,
1747 1957, 1962, 1967, 1976, 1976, 1977, 1977, 1979, 1986, 1992,
1748 1999, 2003, 2009, 2014, 2019, 2114, 2114, 2116, 2124, 2124,
1749 2126, 2131, 2132, 2133, 2135, 2135, 2145, 2149, 2154, 2158,
1750 2162, 2166, 2170, 2174, 2178, 2182, 2186, 2211, 2215, 2229,
1751 2233, 2239, 2239, 2245, 2250, 2254, 2263, 2274, 2279, 2291,
1752 2304, 2308, 2312, 2317, 2326, 2345, 2354, 2410, 2414, 2421,
1753 2432, 2445, 2454, 2463, 2473, 2477, 2484, 2484, 2486, 2490,
1754 2495, 2517, 2532, 2546, 2559, 2570, 2578, 2586, 2592, 2612,
1755 2635, 2641, 2647, 2653, 2668, 2727, 2734, 2737, 2742, 2746,
1756 2753, 2758, 2764, 2769, 2775, 2783, 2795, 2810
1760 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1761 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1762 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1763 static const char *const yytname[] =
1765 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1766 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1767 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1768 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1769 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1770 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1771 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1772 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1773 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1774 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1775 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1776 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1777 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1778 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1779 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC",
1780 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", "CAST",
1781 "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1782 "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='",
1783 "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1784 "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps",
1785 "LogicalOps", "SetCondOps", "ShiftOps", "SIntType", "UIntType",
1786 "IntType", "FPType", "OptAssign", "OptLinkage", "OptCallingConv",
1787 "OptAlign", "OptCAlign", "SectionString", "OptSection",
1788 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV",
1789 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal",
1790 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList",
1791 "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle",
1792 "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName",
1793 "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1794 "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto",
1795 "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1796 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1797 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1798 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1804 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1806 static const unsigned short int yytoknum[] =
1808 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1809 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1810 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1811 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1812 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1813 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1814 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1815 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1816 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1817 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1818 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1819 365, 366, 367, 368, 61, 44, 92, 40, 41, 91,
1820 120, 93, 60, 62, 123, 125, 42, 99
1824 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1825 static const unsigned char yyr1[] =
1827 0, 128, 129, 129, 130, 130, 131, 131, 131, 131,
1828 131, 131, 131, 131, 131, 132, 132, 132, 133, 133,
1829 133, 133, 133, 133, 134, 134, 134, 135, 135, 135,
1830 135, 136, 136, 136, 136, 137, 137, 138, 138, 139,
1831 139, 140, 140, 140, 140, 140, 140, 140, 140, 141,
1832 141, 141, 141, 141, 141, 141, 141, 142, 142, 143,
1833 143, 144, 145, 145, 146, 146, 147, 147, 148, 148,
1834 149, 149, 150, 151, 151, 151, 151, 151, 151, 151,
1835 151, 151, 151, 151, 151, 151, 152, 152, 152, 152,
1836 152, 152, 152, 152, 152, 152, 153, 153, 154, 154,
1837 154, 154, 155, 155, 155, 155, 155, 155, 155, 155,
1838 155, 155, 155, 155, 155, 155, 155, 155, 156, 156,
1839 156, 156, 156, 156, 156, 156, 156, 156, 157, 157,
1840 158, 158, 159, 160, 160, 160, 160, 160, 161, 161,
1841 161, 162, 161, 163, 161, 164, 161, 165, 161, 161,
1842 161, 161, 166, 167, 167, 168, 168, 168, 168, 169,
1843 170, 170, 170, 171, 171, 172, 172, 173, 174, 174,
1844 175, 175, 175, 175, 176, 177, 177, 178, 179, 179,
1845 180, 181, 181, 181, 183, 182, 184, 184, 185, 185,
1846 185, 185, 185, 185, 185, 185, 185, 185, 185, 186,
1847 186, 187, 187, 188, 189, 189, 190, 191, 191, 191,
1848 192, 192, 192, 192, 192, 192, 192, 192, 192, 193,
1849 193, 194, 195, 195, 196, 196, 197, 197, 198, 198,
1850 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
1851 199, 199, 199, 199, 199, 199, 200, 200, 201, 201,
1852 202, 202, 202, 202, 202, 202, 202, 202
1855 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1856 static const unsigned char yyr2[] =
1858 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1859 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1860 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1861 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1862 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1863 1, 1, 1, 1, 1, 1, 2, 0, 2, 0,
1864 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1865 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1866 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1867 4, 5, 5, 3, 2, 2, 1, 3, 1, 3,
1868 1, 0, 4, 3, 3, 4, 4, 3, 2, 2,
1869 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1870 8, 6, 6, 6, 6, 6, 8, 8, 3, 1,
1871 1, 1, 1, 2, 2, 4, 2, 1, 4, 2,
1872 4, 0, 7, 0, 7, 0, 7, 0, 7, 3,
1873 4, 0, 1, 1, 1, 3, 3, 3, 3, 3,
1874 3, 1, 0, 1, 1, 1, 0, 2, 3, 1,
1875 1, 3, 1, 0, 8, 1, 1, 3, 1, 1,
1876 2, 0, 1, 1, 0, 4, 0, 1, 1, 1,
1877 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1878 1, 1, 1, 2, 2, 2, 3, 2, 0, 1,
1879 2, 2, 3, 9, 9, 8, 13, 1, 1, 6,
1880 5, 2, 6, 7, 1, 3, 1, 0, 2, 1,
1881 5, 5, 5, 2, 4, 4, 6, 4, 4, 4,
1882 4, 6, 6, 2, 7, 1, 2, 0, 1, 0,
1883 3, 6, 3, 6, 2, 4, 6, 4
1886 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1887 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1888 means the default is an error. */
1889 static const unsigned short int yydefact[] =
1891 151, 0, 48, 137, 1, 136, 184, 41, 42, 43,
1892 44, 45, 46, 47, 0, 49, 208, 133, 134, 208,
1893 163, 164, 0, 0, 0, 48, 0, 139, 181, 0,
1894 0, 50, 51, 52, 53, 54, 55, 0, 0, 209,
1895 205, 40, 178, 179, 180, 204, 0, 0, 0, 0,
1896 149, 0, 0, 0, 0, 0, 0, 0, 39, 182,
1897 183, 49, 152, 135, 56, 2, 3, 69, 73, 74,
1898 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1899 85, 86, 0, 0, 0, 0, 199, 0, 0, 68,
1900 87, 72, 200, 88, 175, 176, 177, 249, 207, 0,
1901 0, 0, 0, 162, 150, 140, 138, 130, 131, 0,
1902 0, 0, 0, 185, 89, 0, 0, 71, 94, 96,
1903 0, 0, 101, 95, 248, 0, 229, 0, 0, 0,
1904 0, 49, 217, 218, 6, 7, 8, 9, 10, 11,
1905 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1906 22, 23, 0, 0, 0, 0, 0, 0, 0, 24,
1907 25, 26, 0, 0, 0, 0, 0, 0, 0, 0,
1908 0, 0, 206, 49, 221, 0, 245, 157, 154, 153,
1909 155, 156, 158, 161, 0, 145, 147, 143, 73, 74,
1910 75, 76, 77, 78, 79, 80, 81, 82, 83, 0,
1911 0, 0, 0, 141, 0, 0, 0, 93, 173, 100,
1912 98, 0, 0, 233, 228, 211, 210, 0, 0, 30,
1913 34, 29, 33, 28, 32, 27, 31, 35, 36, 0,
1914 0, 59, 59, 254, 0, 0, 243, 0, 0, 0,
1915 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1916 0, 0, 0, 159, 64, 64, 64, 115, 116, 4,
1917 5, 113, 114, 117, 112, 108, 109, 0, 0, 0,
1918 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1919 0, 111, 110, 64, 70, 70, 97, 172, 166, 169,
1920 170, 0, 0, 90, 188, 189, 190, 195, 191, 192,
1921 193, 194, 186, 0, 197, 202, 201, 203, 0, 212,
1922 0, 0, 0, 250, 0, 252, 247, 0, 0, 0,
1923 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1924 0, 0, 0, 0, 160, 0, 146, 148, 144, 0,
1925 0, 0, 0, 0, 0, 103, 129, 0, 0, 107,
1926 0, 104, 0, 0, 0, 0, 142, 91, 92, 165,
1927 167, 0, 62, 99, 187, 0, 0, 0, 0, 0,
1928 0, 0, 0, 0, 257, 0, 0, 235, 0, 237,
1929 240, 0, 0, 238, 239, 0, 0, 0, 234, 0,
1930 255, 0, 0, 0, 66, 64, 247, 0, 0, 0,
1931 0, 0, 0, 102, 105, 106, 0, 0, 0, 0,
1932 171, 168, 63, 57, 0, 196, 0, 0, 227, 59,
1933 60, 59, 224, 246, 0, 0, 0, 0, 0, 230,
1934 231, 232, 227, 0, 61, 67, 65, 0, 0, 0,
1935 0, 0, 0, 128, 0, 0, 0, 0, 0, 174,
1936 0, 0, 0, 226, 0, 0, 251, 253, 0, 0,
1937 0, 236, 241, 242, 0, 256, 119, 0, 0, 0,
1938 0, 0, 0, 0, 0, 0, 58, 198, 0, 0,
1939 0, 225, 222, 0, 244, 118, 0, 125, 0, 0,
1940 121, 122, 123, 124, 0, 215, 0, 0, 0, 223,
1941 0, 0, 0, 213, 0, 214, 0, 0, 120, 126,
1942 127, 0, 0, 0, 0, 0, 0, 220, 0, 0,
1946 /* YYDEFGOTO[NTERM-NUM]. */
1947 static const short int yydefgoto[] =
1949 -1, 86, 261, 277, 278, 279, 280, 199, 200, 229,
1950 201, 25, 15, 37, 449, 313, 394, 413, 336, 395,
1951 87, 88, 202, 90, 91, 120, 211, 346, 304, 347,
1952 109, 1, 2, 3, 283, 256, 254, 255, 63, 180,
1953 50, 104, 184, 92, 360, 289, 290, 291, 38, 96,
1954 16, 44, 17, 61, 18, 28, 365, 305, 93, 307,
1955 422, 19, 40, 41, 172, 497, 98, 236, 453, 454,
1956 173, 174, 374, 175, 176
1959 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1961 #define YYPACT_NINF -463
1962 static const short int yypact[] =
1964 -463, 19, 202, 739, -463, -463, -463, -463, -463, -463,
1965 -463, -463, -463, -463, -23, 340, 60, -463, -463, -12,
1966 -463, -463, -8, 40, 115, 123, 66, -463, 67, 158,
1967 179, -463, -463, -463, -463, -463, -463, 1021, -14, -463,
1968 -463, 120, -463, -463, -463, -463, 70, 71, 73, 77,
1969 -463, 76, 158, 1021, 36, 36, 36, 36, -463, -463,
1970 -463, 340, -463, -463, -463, -463, -463, 75, -463, -463,
1971 -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,
1972 -463, -463, 193, 194, 195, 577, -463, 120, 84, -463,
1973 -463, -84, -463, -463, -463, -463, -463, 1197, -463, 180,
1974 31, 201, 183, 192, -463, -463, -463, -463, -463, 1062,
1975 1062, 1062, 1103, -463, -463, 100, 101, -463, -463, -84,
1976 -91, 105, 853, -463, -463, 1062, -463, 164, 1144, 30,
1977 255, 340, -463, -463, -463, -463, -463, -463, -463, -463,
1978 -463, -463, -463, -463, -463, -463, -463, -463, -463, -463,
1979 -463, -463, 1062, 1062, 1062, 1062, 1062, 1062, 1062, -463,
1980 -463, -463, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
1981 1062, 1062, -463, 340, -463, 51, -463, -463, -463, -463,
1982 -463, -463, -463, -463, -74, -463, -463, -463, 125, 153,
1983 220, 155, 222, 159, 224, 171, 225, 223, 227, 175,
1984 228, 229, 420, -463, 1062, 1062, 1062, -463, 894, -463,
1985 116, 117, 645, -463, -463, 75, -463, 645, 645, -463,
1986 -463, -463, -463, -463, -463, -463, -463, -463, -463, 645,
1987 1021, 140, 141, -463, 645, 138, 143, 226, 144, 146,
1988 148, 161, 162, 163, 166, 645, 645, 645, 177, 1021,
1989 1062, 1062, 249, -463, 182, 182, 182, -463, -463, -463,
1990 -463, -463, -463, -463, -463, -463, -463, 178, 181, 184,
1991 185, 186, 187, 87, 1103, 597, 270, 188, 189, 197,
1992 199, -463, -463, 182, -36, -56, -84, -463, 120, -463,
1993 196, 200, 939, -463, -463, -463, -463, -463, -463, -463,
1994 -463, -463, 236, 1103, -463, -463, -463, -463, 205, -463,
1995 210, 645, -9, -463, -3, -463, 211, 645, 191, 1062,
1996 1062, 1062, 1062, 1062, 1062, 1062, 1062, 212, 216, 217,
1997 1062, 645, 645, 218, -463, -20, -463, -463, -463, 1103,
1998 1103, 1103, 1103, 1103, 1103, -463, -463, -50, -59, -463,
1999 -31, -463, 1103, 1103, 1103, 1103, -463, -463, -463, -463,
2000 -463, 980, 278, -463, -463, 293, 26, 313, 314, 230,
2001 645, 337, 645, 1062, -463, 231, 645, -463, 233, -463,
2002 -463, 234, 237, -463, -463, 645, 645, 645, -463, 238,
2003 -463, 1062, 332, 353, -463, 182, 211, 322, 246, 247,
2004 248, 250, 1103, -463, -463, -463, 251, 256, 257, 259,
2005 -463, -463, -463, 307, 260, -463, 645, 645, 1062, 262,
2006 -463, 262, -463, 263, 645, 265, 1062, 1062, 1062, -463,
2007 -463, -463, 1062, 645, -463, -463, -463, 252, 1062, 1103,
2008 1103, 1103, 1103, -463, 1103, 1103, 1103, 1103, 378, -463,
2009 359, 273, 266, 263, 274, 339, -463, -463, 1062, 276,
2010 645, -463, -463, -463, 280, -463, -463, 281, 285, 284,
2011 296, 297, 295, 298, 299, 300, -463, -463, 393, 15,
2012 379, -463, -463, 301, -463, -463, 1103, -463, 1103, 1103,
2013 -463, -463, -463, -463, 645, -463, 738, 65, 398, -463,
2014 302, 305, 306, -463, 312, -463, 738, 645, -463, -463,
2015 -463, 407, 315, 355, 645, 408, 412, -463, 645, 645,
2019 /* YYPGOTO[NTERM-NUM]. */
2020 static const short int yypgoto[] =
2022 -463, -463, -463, 338, 342, 343, 344, -129, -128, -462,
2023 -463, 395, 418, -118, -463, -225, 89, -463, -247, -463,
2024 -49, -463, -37, -463, -82, 323, -463, -102, 253, -253,
2025 83, -463, -463, -463, -463, -463, -463, -463, 400, -463,
2026 -463, -463, -463, 2, -463, 92, -463, -463, 399, -463,
2027 -463, -463, -463, -463, 451, -463, -463, -359, -57, 62,
2028 -105, -463, 437, -463, -463, -463, -463, -463, 90, 32,
2029 -463, -463, 69, -463, -463
2032 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2033 positive, shift that token. If negative, reduce the rule which
2034 number is the opposite. If zero, do what YYDEFACT says.
2035 If YYTABLE_NINF, syntax error. */
2036 #define YYTABLE_NINF -133
2037 static const short int yytable[] =
2039 89, 227, 228, 119, 106, 26, 370, 315, 337, 338,
2040 203, 39, 372, 230, 392, 94, 89, 496, 42, 4,
2041 213, 348, 350, 216, 206, 219, 220, 221, 222, 223,
2042 224, 225, 226, -70, 207, 506, 356, 393, 29, 217,
2043 119, 252, 123, 26, 46, 47, 48, 253, 371, 233,
2044 366, 218, 237, 238, 371, 249, 402, 239, 240, 241,
2045 242, 243, 244, 49, 404, 402, 248, 358, 107, 108,
2046 123, 403, 185, 186, 187, 219, 220, 221, 222, 223,
2047 224, 225, 226, 39, 402, 357, 178, 179, 212, 121,
2048 123, 212, 65, 66, 405, 117, 188, 189, 190, 191,
2049 192, 193, 194, 195, 196, 197, 198, 79, 80, 20,
2050 95, 21, 59, 43, 60, 231, 232, 212, 234, 235,
2051 212, 212, 284, 285, 286, 212, 212, 212, 212, 212,
2052 212, 245, 246, 247, 212, 81, 495, 504, 110, 111,
2053 112, 402, 20, 53, 21, 282, 333, 512, 436, 415,
2054 250, 251, 257, 258, 51, 306, -30, -30, -29, -29,
2055 306, 306, -28, -28, 7, 8, 9, 10, 54, 12,
2056 55, 288, 306, 56, -27, -27, 52, 306, 259, 260,
2057 58, 311, 62, 64, 99, 100, 505, 101, 306, 306,
2058 306, 102, -71, 89, 456, 103, 457, 114, 115, 116,
2059 331, 122, -132, 82, 177, 181, 83, 182, 345, 84,
2060 286, 85, 89, 332, 212, 378, 183, 380, 381, 382,
2061 204, 205, 208, 214, -34, 388, -33, 5, -32, -31,
2062 -37, 292, 262, 6, -38, 293, 263, 396, 397, 398,
2063 399, 400, 401, 7, 8, 9, 10, 11, 12, 13,
2064 406, 407, 408, 409, 306, 312, 314, 317, 318, 320,
2065 306, 321, 319, 322, 14, 219, 220, 221, 222, 223,
2066 224, 225, 226, 334, 306, 306, 323, 324, 325, 308,
2067 309, 326, 377, 212, 379, 212, 212, 212, 383, 384,
2068 359, 310, 330, 212, 351, 339, 316, 335, 340, 364,
2069 443, 341, 342, 343, 344, 352, 353, 327, 328, 329,
2070 376, 361, 392, 306, 354, 306, 355, 414, 362, 306,
2071 367, 461, 462, 463, 288, 368, 373, 385, 306, 306,
2072 306, 386, 387, 391, 416, 417, 212, 468, 469, 470,
2073 471, 420, 472, 473, 474, 475, 424, 418, 426, 427,
2074 227, 228, 428, 481, 433, 432, 434, 435, 438, 306,
2075 306, 439, 440, 441, 448, 442, 444, 306, 227, 228,
2076 466, 445, 446, 369, 447, 450, 306, 455, 458, 375,
2077 460, 212, 476, 477, 500, 479, 501, 502, 478, 212,
2078 212, 212, 480, 389, 390, 212, 371, 482, 484, 485,
2079 486, 467, 487, 306, 30, 31, 32, 33, 34, 35,
2080 36, 488, 489, 490, 494, 498, 491, 492, 493, 507,
2081 508, 212, 499, 509, 510, 65, 66, 511, 514, 518,
2082 515, 516, 419, 519, 421, 168, 97, 306, 425, 169,
2083 170, 171, 20, 57, 21, 210, 264, 429, 430, 431,
2084 306, 412, 105, 411, 27, 281, 45, 306, 265, 266,
2085 113, 306, 306, 423, 464, 437, 0, 0, 0, 0,
2086 0, 0, 0, 0, 0, 0, 0, 0, 451, 452,
2087 0, 0, 0, 0, 0, 0, 459, 0, 0, 0,
2088 0, 0, 0, 0, 0, 465, 0, 0, 134, 135,
2089 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2090 146, 147, 148, 149, 150, 151, 0, 0, 0, 0,
2091 0, 267, 483, 268, 269, 159, 160, 161, 0, 270,
2092 271, 272, 0, 0, 0, 0, 0, 0, 0, 273,
2093 0, 0, 274, 0, 275, 0, 0, 276, 0, 0,
2094 0, 0, 0, 0, 0, 0, 503, 0, 0, 0,
2095 0, 0, 0, 0, 0, 0, 0, 0, 0, 513,
2096 0, 0, 0, 0, 0, 0, 517, 0, 0, 0,
2097 520, 521, 65, 66, 0, 117, 68, 69, 70, 71,
2098 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
2099 0, 21, 65, 66, 0, 117, 188, 189, 190, 191,
2100 192, 193, 194, 195, 196, 197, 198, 79, 80, 20,
2101 0, 21, 0, 0, 0, 81, 0, 0, 0, 0,
2102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2103 0, 0, 0, 0, 0, 81, 0, 0, 294, 295,
2104 65, 66, 296, 0, 0, 0, 0, 0, 0, 0,
2105 0, 0, 0, 0, 0, 0, 0, 20, 0, 21,
2106 0, 297, 298, 299, 0, 0, 0, 0, 0, 0,
2107 0, 0, 0, 300, 301, 0, 0, 0, 0, 0,
2108 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2109 0, 85, 118, 0, 0, 0, 302, 0, 0, 0,
2110 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2111 0, 85, 349, 134, 135, 136, 137, 138, 139, 140,
2112 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2113 151, 294, 295, 0, 0, 296, 267, 0, 268, 269,
2114 159, 160, 161, 0, 270, 271, 272, 0, 0, -40,
2115 0, 20, 0, 21, 297, 298, 299, 303, 0, 0,
2116 6, -40, -40, 0, 0, 0, 300, 301, 0, 0,
2117 -40, -40, -40, -40, -40, -40, -40, 0, 0, -40,
2118 22, 0, 0, 0, 0, 0, 0, 23, 0, 302,
2119 0, 24, 0, 0, 0, 0, 0, 0, 0, 0,
2120 0, 0, 0, 0, 0, 0, 134, 135, 136, 137,
2121 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
2122 148, 149, 150, 151, 0, 0, 0, 0, 0, 267,
2123 0, 268, 269, 159, 160, 161, 0, 270, 271, 272,
2124 0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
2125 303, 117, 68, 69, 70, 71, 72, 73, 74, 75,
2126 76, 77, 78, 79, 80, 20, 0, 21, 0, 0,
2127 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2128 209, 0, 0, 0, 0, 0, 0, 0, 0, 65,
2129 66, 81, 117, 68, 69, 70, 71, 72, 73, 74,
2130 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 287, 0, 0, 0, 0, 0, 0, 0, 0,
2133 0, 0, 81, 0, 65, 66, 0, 117, 68, 69,
2134 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2135 80, 20, 0, 21, 0, 0, 0, 0, 0, 82,
2136 0, 0, 83, 0, 0, 84, 363, 85, 0, 0,
2137 0, 0, 0, 0, 0, 65, 66, 81, 117, 68,
2138 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2139 79, 80, 20, 0, 21, 0, 0, 0, 0, 0,
2140 82, 0, 0, 83, 0, 0, 84, 410, 85, 0,
2141 0, 0, 0, 0, 0, 0, 65, 66, 81, 67,
2142 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2143 78, 79, 80, 20, 0, 21, 0, 0, 0, 0,
2144 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
2145 0, 84, 0, 85, 0, 0, 0, 65, 66, 81,
2146 117, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2147 77, 78, 79, 80, 20, 0, 21, 0, 0, 0,
2148 0, 0, 0, 0, 0, 0, 82, 0, 0, 83,
2149 0, 0, 84, 0, 85, 0, 0, 0, 65, 66,
2150 81, 117, 188, 189, 190, 191, 192, 193, 194, 195,
2151 196, 197, 198, 79, 80, 20, 0, 21, 0, 0,
2152 0, 0, 0, 0, 0, 0, 0, 82, 0, 0,
2153 83, 0, 0, 84, 0, 85, 0, 0, 0, 65,
2154 66, 81, 215, 68, 69, 70, 71, 72, 73, 74,
2155 75, 76, 77, 78, 79, 80, 20, 0, 21, 0,
2156 0, 0, 0, 0, 0, 0, 0, 0, 82, 0,
2157 0, 83, 0, 0, 84, 0, 85, 0, 0, 0,
2158 0, 0, 81, 0, 0, 0, 0, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2160 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
2161 0, 0, 83, 0, 0, 84, 0, 85, 0, 0,
2162 0, 0, 124, 0, 0, 0, 0, 0, 0, 0,
2163 0, 0, 0, 0, 0, 0, 125, 0, 0, 0,
2164 0, 0, 0, 0, 0, 0, 126, 127, 0, 0,
2165 82, 0, 0, 83, 0, 0, 84, 0, 85, 128,
2166 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
2167 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
2168 149, 150, 151, 152, 153, 154, 0, 0, 155, 156,
2169 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
2173 static const short int yycheck[] =
2175 37, 130, 130, 85, 53, 3, 15, 232, 255, 256,
2176 112, 23, 15, 131, 34, 29, 53, 479, 30, 0,
2177 125, 274, 275, 128, 115, 10, 11, 12, 13, 14,
2178 15, 16, 17, 117, 125, 497, 283, 57, 61, 9,
2179 122, 115, 126, 41, 52, 53, 54, 121, 57, 154,
2180 303, 21, 157, 158, 57, 173, 115, 162, 163, 164,
2181 165, 166, 167, 71, 123, 115, 171, 123, 32, 33,
2182 126, 121, 109, 110, 111, 10, 11, 12, 13, 14,
2183 15, 16, 17, 23, 115, 121, 55, 56, 125, 87,
2184 126, 128, 5, 6, 125, 8, 9, 10, 11, 12,
2185 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2186 124, 24, 45, 125, 47, 152, 153, 154, 155, 156,
2187 157, 158, 204, 205, 206, 162, 163, 164, 165, 166,
2188 167, 168, 169, 170, 171, 48, 121, 496, 55, 56,
2189 57, 115, 22, 20, 24, 202, 251, 506, 395, 123,
2190 99, 100, 27, 28, 114, 212, 3, 4, 3, 4,
2191 217, 218, 3, 4, 41, 42, 43, 44, 45, 46,
2192 47, 208, 229, 50, 3, 4, 61, 234, 3, 4,
2193 114, 230, 24, 4, 114, 114, 121, 114, 245, 246,
2194 247, 114, 117, 230, 419, 119, 421, 4, 4, 4,
2195 249, 117, 0, 116, 24, 4, 119, 24, 121, 122,
2196 292, 124, 249, 250, 251, 320, 24, 322, 323, 324,
2197 120, 120, 117, 59, 4, 330, 4, 25, 4, 4,
2198 7, 115, 4, 31, 7, 118, 7, 339, 340, 341,
2199 342, 343, 344, 41, 42, 43, 44, 45, 46, 47,
2200 352, 353, 354, 355, 311, 115, 115, 119, 115, 115,
2201 317, 115, 36, 115, 62, 10, 11, 12, 13, 14,
2202 15, 16, 17, 24, 331, 332, 115, 115, 115, 217,
2203 218, 115, 319, 320, 321, 322, 323, 324, 325, 326,
2204 288, 229, 115, 330, 24, 117, 234, 115, 117, 63,
2205 402, 117, 117, 117, 117, 117, 117, 245, 246, 247,
2206 119, 115, 34, 370, 117, 372, 117, 24, 118, 376,
2207 115, 426, 427, 428, 361, 115, 115, 115, 385, 386,
2208 387, 115, 115, 115, 21, 21, 373, 439, 440, 441,
2209 442, 4, 444, 445, 446, 447, 115, 117, 115, 115,
2210 479, 479, 115, 458, 391, 117, 24, 4, 36, 416,
2211 417, 115, 115, 115, 57, 115, 115, 424, 497, 497,
2212 118, 115, 115, 311, 115, 115, 433, 115, 115, 317,
2213 115, 418, 4, 24, 486, 119, 488, 489, 115, 426,
2214 427, 428, 118, 331, 332, 432, 57, 121, 118, 118,
2215 115, 438, 118, 460, 64, 65, 66, 67, 68, 69,
2216 70, 115, 115, 118, 21, 36, 118, 118, 118, 21,
2217 118, 458, 121, 118, 118, 5, 6, 115, 21, 21,
2218 115, 76, 370, 21, 372, 97, 41, 494, 376, 97,
2219 97, 97, 22, 25, 24, 122, 26, 385, 386, 387,
2220 507, 362, 52, 361, 3, 202, 19, 514, 38, 39,
2221 61, 518, 519, 373, 432, 396, -1, -1, -1, -1,
2222 -1, -1, -1, -1, -1, -1, -1, -1, 416, 417,
2223 -1, -1, -1, -1, -1, -1, 424, -1, -1, -1,
2224 -1, -1, -1, -1, -1, 433, -1, -1, 78, 79,
2225 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2226 90, 91, 92, 93, 94, 95, -1, -1, -1, -1,
2227 -1, 101, 460, 103, 104, 105, 106, 107, -1, 109,
2228 110, 111, -1, -1, -1, -1, -1, -1, -1, 119,
2229 -1, -1, 122, -1, 124, -1, -1, 127, -1, -1,
2230 -1, -1, -1, -1, -1, -1, 494, -1, -1, -1,
2231 -1, -1, -1, -1, -1, -1, -1, -1, -1, 507,
2232 -1, -1, -1, -1, -1, -1, 514, -1, -1, -1,
2233 518, 519, 5, 6, -1, 8, 9, 10, 11, 12,
2234 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2235 -1, 24, 5, 6, -1, 8, 9, 10, 11, 12,
2236 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2237 -1, 24, -1, -1, -1, 48, -1, -1, -1, -1,
2238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2239 -1, -1, -1, -1, -1, 48, -1, -1, 3, 4,
2240 5, 6, 7, -1, -1, -1, -1, -1, -1, -1,
2241 -1, -1, -1, -1, -1, -1, -1, 22, -1, 24,
2242 -1, 26, 27, 28, -1, -1, -1, -1, -1, -1,
2243 -1, -1, -1, 38, 39, -1, -1, -1, -1, -1,
2244 -1, -1, -1, 116, -1, -1, 119, -1, -1, 122,
2245 -1, 124, 125, -1, -1, -1, 61, -1, -1, -1,
2246 -1, -1, -1, 116, -1, -1, 119, -1, -1, 122,
2247 -1, 124, 125, 78, 79, 80, 81, 82, 83, 84,
2248 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2249 95, 3, 4, -1, -1, 7, 101, -1, 103, 104,
2250 105, 106, 107, -1, 109, 110, 111, -1, -1, 20,
2251 -1, 22, -1, 24, 26, 27, 28, 122, -1, -1,
2252 31, 32, 33, -1, -1, -1, 38, 39, -1, -1,
2253 41, 42, 43, 44, 45, 46, 47, -1, -1, 50,
2254 51, -1, -1, -1, -1, -1, -1, 58, -1, 61,
2255 -1, 62, -1, -1, -1, -1, -1, -1, -1, -1,
2256 -1, -1, -1, -1, -1, -1, 78, 79, 80, 81,
2257 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2258 92, 93, 94, 95, -1, -1, -1, -1, -1, 101,
2259 -1, 103, 104, 105, 106, 107, -1, 109, 110, 111,
2260 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2261 122, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2262 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2263 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2264 37, -1, -1, -1, -1, -1, -1, -1, -1, 5,
2265 6, 48, 8, 9, 10, 11, 12, 13, 14, 15,
2266 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2268 -1, 37, -1, -1, -1, -1, -1, -1, -1, -1,
2269 -1, -1, 48, -1, 5, 6, -1, 8, 9, 10,
2270 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2271 21, 22, -1, 24, -1, -1, -1, -1, -1, 116,
2272 -1, -1, 119, -1, -1, 122, 37, 124, -1, -1,
2273 -1, -1, -1, -1, -1, 5, 6, 48, 8, 9,
2274 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2275 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
2276 116, -1, -1, 119, -1, -1, 122, 37, 124, -1,
2277 -1, -1, -1, -1, -1, -1, 5, 6, 48, 8,
2278 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2279 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
2280 -1, -1, -1, -1, -1, 116, -1, -1, 119, -1,
2281 -1, 122, -1, 124, -1, -1, -1, 5, 6, 48,
2282 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2283 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
2284 -1, -1, -1, -1, -1, -1, 116, -1, -1, 119,
2285 -1, -1, 122, -1, 124, -1, -1, -1, 5, 6,
2286 48, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2287 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
2288 -1, -1, -1, -1, -1, -1, -1, 116, -1, -1,
2289 119, -1, -1, 122, -1, 124, -1, -1, -1, 5,
2290 6, 48, 8, 9, 10, 11, 12, 13, 14, 15,
2291 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
2292 -1, -1, -1, -1, -1, -1, -1, -1, 116, -1,
2293 -1, 119, -1, -1, 122, -1, 124, -1, -1, -1,
2294 -1, -1, 48, -1, -1, -1, -1, -1, -1, -1,
2295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2296 -1, -1, -1, -1, -1, -1, -1, -1, -1, 116,
2297 -1, -1, 119, -1, -1, 122, -1, 124, -1, -1,
2298 -1, -1, 35, -1, -1, -1, -1, -1, -1, -1,
2299 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2300 -1, -1, -1, -1, -1, -1, 59, 60, -1, -1,
2301 116, -1, -1, 119, -1, -1, 122, -1, 124, 72,
2302 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2303 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2304 93, 94, 95, 96, 97, 98, -1, -1, 101, 102,
2305 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
2309 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2310 symbol of state STATE-NUM. */
2311 static const unsigned char yystos[] =
2313 0, 159, 160, 161, 0, 25, 31, 41, 42, 43,
2314 44, 45, 46, 47, 62, 140, 178, 180, 182, 189,
2315 22, 24, 51, 58, 62, 139, 171, 182, 183, 61,
2316 64, 65, 66, 67, 68, 69, 70, 141, 176, 23,
2317 190, 191, 30, 125, 179, 190, 52, 53, 54, 71,
2318 168, 114, 61, 20, 45, 47, 50, 140, 114, 45,
2319 47, 181, 24, 166, 4, 5, 6, 8, 9, 10,
2320 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
2321 21, 48, 116, 119, 122, 124, 129, 148, 149, 150,
2322 151, 152, 171, 186, 29, 124, 177, 139, 194, 114,
2323 114, 114, 114, 119, 169, 166, 148, 32, 33, 158,
2324 158, 158, 158, 176, 4, 4, 4, 8, 125, 152,
2325 153, 171, 117, 126, 35, 49, 59, 60, 72, 73,
2326 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2327 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2328 94, 95, 96, 97, 98, 101, 102, 103, 104, 105,
2329 106, 107, 108, 109, 110, 111, 112, 113, 131, 132,
2330 133, 134, 192, 198, 199, 201, 202, 24, 55, 56,
2331 167, 4, 24, 24, 170, 150, 150, 150, 9, 10,
2332 11, 12, 13, 14, 15, 16, 17, 18, 19, 135,
2333 136, 138, 150, 155, 120, 120, 115, 125, 117, 37,
2334 153, 154, 150, 188, 59, 8, 188, 9, 21, 10,
2335 11, 12, 13, 14, 15, 16, 17, 135, 136, 137,
2336 141, 150, 150, 188, 150, 150, 195, 188, 188, 188,
2337 188, 188, 188, 188, 188, 150, 150, 150, 188, 141,
2338 99, 100, 115, 121, 164, 165, 163, 27, 28, 3,
2339 4, 130, 4, 7, 26, 38, 39, 101, 103, 104,
2340 109, 110, 111, 119, 122, 124, 127, 131, 132, 133,
2341 134, 156, 186, 162, 152, 152, 152, 37, 150, 173,
2342 174, 175, 115, 118, 3, 4, 7, 26, 27, 28,
2343 38, 39, 61, 122, 156, 185, 186, 187, 187, 187,
2344 187, 148, 115, 143, 115, 143, 187, 119, 115, 36,
2345 115, 115, 115, 115, 115, 115, 115, 187, 187, 187,
2346 115, 148, 150, 188, 24, 115, 146, 146, 146, 117,
2347 117, 117, 117, 117, 117, 121, 155, 157, 157, 125,
2348 157, 24, 117, 117, 117, 117, 146, 121, 123, 171,
2349 172, 115, 118, 37, 63, 184, 157, 115, 115, 187,
2350 15, 57, 15, 115, 200, 187, 119, 150, 188, 150,
2351 188, 188, 188, 150, 150, 115, 115, 115, 188, 187,
2352 187, 115, 34, 57, 144, 147, 155, 155, 155, 155,
2353 155, 155, 115, 121, 123, 125, 155, 155, 155, 155,
2354 37, 173, 144, 145, 24, 123, 21, 21, 117, 187,
2355 4, 187, 188, 196, 115, 187, 115, 115, 115, 187,
2356 187, 187, 117, 150, 24, 4, 146, 200, 36, 115,
2357 115, 115, 115, 155, 115, 115, 115, 115, 57, 142,
2358 115, 187, 187, 196, 197, 115, 143, 143, 115, 187,
2359 115, 188, 188, 188, 197, 187, 118, 150, 155, 155,
2360 155, 155, 155, 155, 155, 155, 4, 24, 115, 119,
2361 118, 188, 121, 187, 118, 118, 115, 118, 115, 115,
2362 118, 118, 118, 118, 21, 121, 137, 193, 36, 121,
2363 155, 155, 155, 187, 185, 121, 137, 21, 118, 118,
2364 118, 115, 185, 187, 21, 115, 76, 187, 21, 21,
2368 #define yyerrok (yyerrstatus = 0)
2369 #define yyclearin (yychar = YYEMPTY)
2370 #define YYEMPTY (-2)
2373 #define YYACCEPT goto yyacceptlab
2374 #define YYABORT goto yyabortlab
2375 #define YYERROR goto yyerrorlab
2378 /* Like YYERROR except do call yyerror. This remains here temporarily
2379 to ease the transition to the new meaning of YYERROR, for GCC.
2380 Once GCC version 2 has supplanted version 1, this can go. */
2382 #define YYFAIL goto yyerrlab
2384 #define YYRECOVERING() (!!yyerrstatus)
2386 #define YYBACKUP(Token, Value) \
2388 if (yychar == YYEMPTY && yylen == 1) \
2392 yytoken = YYTRANSLATE (yychar); \
2398 yyerror (YY_("syntax error: cannot back up")); \
2405 #define YYERRCODE 256
2408 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2409 If N is 0, then set CURRENT to the empty location which ends
2410 the previous symbol: RHS[0] (always defined). */
2412 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2413 #ifndef YYLLOC_DEFAULT
2414 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2418 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2419 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2420 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2421 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2425 (Current).first_line = (Current).last_line = \
2426 YYRHSLOC (Rhs, 0).last_line; \
2427 (Current).first_column = (Current).last_column = \
2428 YYRHSLOC (Rhs, 0).last_column; \
2434 /* YY_LOCATION_PRINT -- Print the location on the stream.
2435 This macro was not mandated originally: define only if we know
2436 we won't break user code: when these are the locations we know. */
2438 #ifndef YY_LOCATION_PRINT
2439 # if YYLTYPE_IS_TRIVIAL
2440 # define YY_LOCATION_PRINT(File, Loc) \
2441 fprintf (File, "%d.%d-%d.%d", \
2442 (Loc).first_line, (Loc).first_column, \
2443 (Loc).last_line, (Loc).last_column)
2445 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2450 /* YYLEX -- calling `yylex' with the right arguments. */
2453 # define YYLEX yylex (YYLEX_PARAM)
2455 # define YYLEX yylex ()
2458 /* Enable debugging if requested. */
2462 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2463 # define YYFPRINTF fprintf
2466 # define YYDPRINTF(Args) \
2472 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2476 YYFPRINTF (stderr, "%s ", Title); \
2477 yysymprint (stderr, \
2479 YYFPRINTF (stderr, "\n"); \
2483 /*------------------------------------------------------------------.
2484 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2486 `------------------------------------------------------------------*/
2488 #if defined (__STDC__) || defined (__cplusplus)
2490 yy_stack_print (short int *bottom, short int *top)
2493 yy_stack_print (bottom, top)
2498 YYFPRINTF (stderr, "Stack now");
2499 for (/* Nothing. */; bottom <= top; ++bottom)
2500 YYFPRINTF (stderr, " %d", *bottom);
2501 YYFPRINTF (stderr, "\n");
2504 # define YY_STACK_PRINT(Bottom, Top) \
2507 yy_stack_print ((Bottom), (Top)); \
2511 /*------------------------------------------------.
2512 | Report that the YYRULE is going to be reduced. |
2513 `------------------------------------------------*/
2515 #if defined (__STDC__) || defined (__cplusplus)
2517 yy_reduce_print (int yyrule)
2520 yy_reduce_print (yyrule)
2525 unsigned long int yylno = yyrline[yyrule];
2526 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2528 /* Print the symbols being reduced, and their result. */
2529 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2530 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2531 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2534 # define YY_REDUCE_PRINT(Rule) \
2537 yy_reduce_print (Rule); \
2540 /* Nonzero means print parse trace. It is left uninitialized so that
2541 multiple parsers can coexist. */
2543 #else /* !YYDEBUG */
2544 # define YYDPRINTF(Args)
2545 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2546 # define YY_STACK_PRINT(Bottom, Top)
2547 # define YY_REDUCE_PRINT(Rule)
2548 #endif /* !YYDEBUG */
2551 /* YYINITDEPTH -- initial size of the parser's stacks. */
2553 # define YYINITDEPTH 200
2556 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2557 if the built-in stack extension method is used).
2559 Do not make this value too large; the results are undefined if
2560 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2561 evaluated with infinite-precision integer arithmetic. */
2564 # define YYMAXDEPTH 10000
2572 # if defined (__GLIBC__) && defined (_STRING_H)
2573 # define yystrlen strlen
2575 /* Return the length of YYSTR. */
2577 # if defined (__STDC__) || defined (__cplusplus)
2578 yystrlen (const char *yystr)
2584 const char *yys = yystr;
2586 while (*yys++ != '\0')
2589 return yys - yystr - 1;
2595 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2596 # define yystpcpy stpcpy
2598 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2601 # if defined (__STDC__) || defined (__cplusplus)
2602 yystpcpy (char *yydest, const char *yysrc)
2604 yystpcpy (yydest, yysrc)
2610 const char *yys = yysrc;
2612 while ((*yyd++ = *yys++) != '\0')
2621 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2622 quotes and backslashes, so that it's suitable for yyerror. The
2623 heuristic is that double-quoting is unnecessary unless the string
2624 contains an apostrophe, a comma, or backslash (other than
2625 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2626 null, do not copy; instead, return the length of what the result
2629 yytnamerr (char *yyres, const char *yystr)
2634 char const *yyp = yystr;
2641 goto do_not_strip_quotes;
2645 goto do_not_strip_quotes;
2658 do_not_strip_quotes: ;
2662 return yystrlen (yystr);
2664 return yystpcpy (yyres, yystr) - yyres;
2668 #endif /* YYERROR_VERBOSE */
2673 /*--------------------------------.
2674 | Print this symbol on YYOUTPUT. |
2675 `--------------------------------*/
2677 #if defined (__STDC__) || defined (__cplusplus)
2679 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2682 yysymprint (yyoutput, yytype, yyvaluep)
2688 /* Pacify ``unused variable'' warnings. */
2691 if (yytype < YYNTOKENS)
2692 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2694 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2698 if (yytype < YYNTOKENS)
2699 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2706 YYFPRINTF (yyoutput, ")");
2709 #endif /* ! YYDEBUG */
2710 /*-----------------------------------------------.
2711 | Release the memory associated to this symbol. |
2712 `-----------------------------------------------*/
2714 #if defined (__STDC__) || defined (__cplusplus)
2716 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2719 yydestruct (yymsg, yytype, yyvaluep)
2725 /* Pacify ``unused variable'' warnings. */
2730 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2741 /* Prevent warnings from -Wmissing-prototypes. */
2743 #ifdef YYPARSE_PARAM
2744 # if defined (__STDC__) || defined (__cplusplus)
2745 int yyparse (void *YYPARSE_PARAM);
2749 #else /* ! YYPARSE_PARAM */
2750 #if defined (__STDC__) || defined (__cplusplus)
2755 #endif /* ! YYPARSE_PARAM */
2759 /* The look-ahead symbol. */
2762 /* The semantic value of the look-ahead symbol. */
2765 /* Number of syntax errors so far. */
2774 #ifdef YYPARSE_PARAM
2775 # if defined (__STDC__) || defined (__cplusplus)
2776 int yyparse (void *YYPARSE_PARAM)
2778 int yyparse (YYPARSE_PARAM)
2779 void *YYPARSE_PARAM;
2781 #else /* ! YYPARSE_PARAM */
2782 #if defined (__STDC__) || defined (__cplusplus)
2796 /* Number of tokens to shift before error messages enabled. */
2798 /* Look-ahead token as an internal (translated) token number. */
2801 /* Three stacks and their tools:
2802 `yyss': related to states,
2803 `yyvs': related to semantic values,
2804 `yyls': related to locations.
2806 Refer to the stacks thru separate pointers, to allow yyoverflow
2807 to reallocate them elsewhere. */
2809 /* The state stack. */
2810 short int yyssa[YYINITDEPTH];
2811 short int *yyss = yyssa;
2814 /* The semantic value stack. */
2815 YYSTYPE yyvsa[YYINITDEPTH];
2816 YYSTYPE *yyvs = yyvsa;
2821 #define YYPOPSTACK (yyvsp--, yyssp--)
2823 YYSIZE_T yystacksize = YYINITDEPTH;
2825 /* The variables used to return semantic value and location from the
2830 /* When reducing, the number of symbols on the RHS of the reduced
2834 YYDPRINTF ((stderr, "Starting parse\n"));
2839 yychar = YYEMPTY; /* Cause a token to be read. */
2841 /* Initialize stack pointers.
2842 Waste one element of value and location stack
2843 so that they stay on the same level as the state stack.
2844 The wasted elements are never initialized. */
2851 /*------------------------------------------------------------.
2852 | yynewstate -- Push a new state, which is found in yystate. |
2853 `------------------------------------------------------------*/
2855 /* In all cases, when you get here, the value and location stacks
2856 have just been pushed. so pushing a state here evens the stacks.
2863 if (yyss + yystacksize - 1 <= yyssp)
2865 /* Get the current used size of the three stacks, in elements. */
2866 YYSIZE_T yysize = yyssp - yyss + 1;
2870 /* Give user a chance to reallocate the stack. Use copies of
2871 these so that the &'s don't force the real ones into
2873 YYSTYPE *yyvs1 = yyvs;
2874 short int *yyss1 = yyss;
2877 /* Each stack pointer address is followed by the size of the
2878 data in use in that stack, in bytes. This used to be a
2879 conditional around just the two extra args, but that might
2880 be undefined if yyoverflow is a macro. */
2881 yyoverflow (YY_("memory exhausted"),
2882 &yyss1, yysize * sizeof (*yyssp),
2883 &yyvs1, yysize * sizeof (*yyvsp),
2890 #else /* no yyoverflow */
2891 # ifndef YYSTACK_RELOCATE
2892 goto yyexhaustedlab;
2894 /* Extend the stack our own way. */
2895 if (YYMAXDEPTH <= yystacksize)
2896 goto yyexhaustedlab;
2898 if (YYMAXDEPTH < yystacksize)
2899 yystacksize = YYMAXDEPTH;
2902 short int *yyss1 = yyss;
2903 union yyalloc *yyptr =
2904 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2906 goto yyexhaustedlab;
2907 YYSTACK_RELOCATE (yyss);
2908 YYSTACK_RELOCATE (yyvs);
2910 # undef YYSTACK_RELOCATE
2912 YYSTACK_FREE (yyss1);
2915 #endif /* no yyoverflow */
2917 yyssp = yyss + yysize - 1;
2918 yyvsp = yyvs + yysize - 1;
2921 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2922 (unsigned long int) yystacksize));
2924 if (yyss + yystacksize - 1 <= yyssp)
2928 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2937 /* Do appropriate processing given the current state. */
2938 /* Read a look-ahead token if we need one and don't already have one. */
2941 /* First try to decide what to do without reference to look-ahead token. */
2943 yyn = yypact[yystate];
2944 if (yyn == YYPACT_NINF)
2947 /* Not known => get a look-ahead token if don't already have one. */
2949 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
2950 if (yychar == YYEMPTY)
2952 YYDPRINTF ((stderr, "Reading a token: "));
2956 if (yychar <= YYEOF)
2958 yychar = yytoken = YYEOF;
2959 YYDPRINTF ((stderr, "Now at end of input.\n"));
2963 yytoken = YYTRANSLATE (yychar);
2964 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2967 /* If the proper action on seeing token YYTOKEN is to reduce or to
2968 detect an error, take that action. */
2970 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2975 if (yyn == 0 || yyn == YYTABLE_NINF)
2984 /* Shift the look-ahead token. */
2985 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2987 /* Discard the token being shifted unless it is eof. */
2988 if (yychar != YYEOF)
2994 /* Count tokens shifted since error; after three, turn off error
3003 /*-----------------------------------------------------------.
3004 | yydefault -- do the default action for the current state. |
3005 `-----------------------------------------------------------*/
3007 yyn = yydefact[yystate];
3013 /*-----------------------------.
3014 | yyreduce -- Do a reduction. |
3015 `-----------------------------*/
3017 /* yyn is the number of a rule to reduce with. */
3020 /* If YYLEN is nonzero, implement the default value of the action:
3023 Otherwise, the following line sets YYVAL to garbage.
3024 This behavior is undocumented and Bison
3025 users should not rely upon it. Assigning to YYVAL
3026 unconditionally makes the parser a bit smaller, and it avoids a
3027 GCC warning that YYVAL may be used uninitialized. */
3028 yyval = yyvsp[1-yylen];
3031 YY_REDUCE_PRINT (yyn);
3035 #line 1164 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3037 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
3038 GEN_ERROR("Value too large for type!");
3039 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3045 #line 1173 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3047 if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range!
3048 GEN_ERROR("Value too large for type!");
3049 (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3055 #line 1197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3057 (yyval.StrVal) = (yyvsp[-1].StrVal);
3063 #line 1201 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3071 #line 1206 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3072 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3076 #line 1207 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3077 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3081 #line 1208 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3082 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3086 #line 1209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3087 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3091 #line 1210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3092 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3096 #line 1211 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3097 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3101 #line 1212 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3102 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3106 #line 1213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3107 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3111 #line 1215 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3112 { (yyval.UIntVal) = CallingConv::C; ;}
3116 #line 1216 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3117 { (yyval.UIntVal) = CallingConv::C; ;}
3121 #line 1217 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3122 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3126 #line 1218 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3127 { (yyval.UIntVal) = CallingConv::Fast; ;}
3131 #line 1219 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3132 { (yyval.UIntVal) = CallingConv::Cold; ;}
3136 #line 1220 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3137 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3141 #line 1221 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3142 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3146 #line 1222 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3148 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3149 GEN_ERROR("Calling conv too large!");
3150 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3156 #line 1231 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3157 { (yyval.UIntVal) = 0; ;}
3161 #line 1232 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3163 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3164 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3165 GEN_ERROR("Alignment must be a power of two!");
3171 #line 1238 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3172 { (yyval.UIntVal) = 0; ;}
3176 #line 1239 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3178 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3179 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3180 GEN_ERROR("Alignment must be a power of two!");
3186 #line 1247 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3188 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3189 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3190 GEN_ERROR("Invalid character in section name!");
3191 (yyval.StrVal) = (yyvsp[0].StrVal);
3197 #line 1255 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3198 { (yyval.StrVal) = 0; ;}
3202 #line 1256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3203 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3207 #line 1261 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3212 #line 1262 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3217 #line 1263 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3219 CurGV->setSection((yyvsp[0].StrVal));
3220 free((yyvsp[0].StrVal));
3226 #line 1268 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3228 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3229 GEN_ERROR("Alignment must be a power of two!");
3230 CurGV->setAlignment((yyvsp[0].UInt64Val));
3236 #line 1282 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3237 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3241 #line 1283 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3242 { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3246 #line 1285 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3248 if (!UpRefs.empty())
3249 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3250 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3256 #line 1297 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3258 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3264 #line 1301 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3266 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3272 #line 1305 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3273 { // Named types are also simple types...
3274 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3276 (yyval.TypeVal) = new PATypeHolder(tmp);
3281 #line 1313 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3282 { // Type UpReference
3283 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3284 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3285 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3286 (yyval.TypeVal) = new PATypeHolder(OT);
3287 UR_OUT("New Upreference!\n");
3293 #line 1321 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3294 { // Function derived type?
3295 std::vector<const Type*> Params;
3296 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3297 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3298 Params.push_back(*I);
3299 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3300 if (isVarArg) Params.pop_back();
3302 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3303 delete (yyvsp[-1].TypeList); // Delete the argument list
3304 delete (yyvsp[-3].TypeVal); // Delete the return type handle
3310 #line 1334 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3311 { // Sized array type?
3312 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3313 delete (yyvsp[-1].TypeVal);
3319 #line 1339 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3320 { // Packed array type?
3321 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3322 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3323 GEN_ERROR("Unsigned result not equal to signed result");
3324 if (!ElemTy->isPrimitiveType())
3325 GEN_ERROR("Elemental type of a PackedType must be primitive");
3326 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3327 GEN_ERROR("Vector length should be a power of 2!");
3328 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3329 delete (yyvsp[-1].TypeVal);
3335 #line 1351 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3336 { // Structure type?
3337 std::vector<const Type*> Elements;
3338 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3339 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3340 Elements.push_back(*I);
3342 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3343 delete (yyvsp[-1].TypeList);
3349 #line 1361 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3350 { // Empty structure type?
3351 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3357 #line 1365 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3359 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3360 GEN_ERROR("Cannot form a pointer to a basic block");
3361 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3362 delete (yyvsp[-1].TypeVal);
3368 #line 1376 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3370 (yyval.TypeList) = new std::list<PATypeHolder>();
3371 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3377 #line 1381 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3379 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3385 #line 1388 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3387 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3393 #line 1392 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3395 ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3401 #line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3403 (yyval.TypeList) = new std::list<PATypeHolder>();
3409 #line 1407 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3410 { // Nonempty unsized arr
3411 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3413 GEN_ERROR("Cannot make array constant with type: '" +
3414 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3415 const Type *ETy = ATy->getElementType();
3416 int NumElements = ATy->getNumElements();
3418 // Verify that we have the correct size...
3419 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3420 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3421 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3422 itostr(NumElements) + "!");
3424 // Verify all elements are correct type!
3425 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3426 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3427 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3428 ETy->getDescription() +"' as required!\nIt is of type '"+
3429 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3432 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3433 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3439 #line 1433 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3441 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3443 GEN_ERROR("Cannot make array constant with type: '" +
3444 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3446 int NumElements = ATy->getNumElements();
3447 if (NumElements != -1 && NumElements != 0)
3448 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3449 " arguments, but has size of " + itostr(NumElements) +"!");
3450 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3451 delete (yyvsp[-2].TypeVal);
3457 #line 1447 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3459 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3461 GEN_ERROR("Cannot make array constant with type: '" +
3462 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3464 int NumElements = ATy->getNumElements();
3465 const Type *ETy = ATy->getElementType();
3466 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3467 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3468 GEN_ERROR("Can't build string constant of size " +
3469 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3470 " when array has size " + itostr(NumElements) + "!");
3471 std::vector<Constant*> Vals;
3472 if (ETy == Type::SByteTy) {
3473 for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3474 Vals.push_back(ConstantInt::get(ETy, *C));
3475 } else if (ETy == Type::UByteTy) {
3476 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3477 C != (unsigned char*)EndStr; ++C)
3478 Vals.push_back(ConstantInt::get(ETy, *C));
3480 free((yyvsp[0].StrVal));
3481 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3483 free((yyvsp[0].StrVal));
3484 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3485 delete (yyvsp[-2].TypeVal);
3491 #line 1477 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3492 { // Nonempty unsized arr
3493 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3495 GEN_ERROR("Cannot make packed constant with type: '" +
3496 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3497 const Type *ETy = PTy->getElementType();
3498 int NumElements = PTy->getNumElements();
3500 // Verify that we have the correct size...
3501 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3502 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3503 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3504 itostr(NumElements) + "!");
3506 // Verify all elements are correct type!
3507 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3508 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3509 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3510 ETy->getDescription() +"' as required!\nIt is of type '"+
3511 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3514 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3515 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3521 #line 1503 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3523 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3525 GEN_ERROR("Cannot make struct constant with type: '" +
3526 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3528 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3529 GEN_ERROR("Illegal number of initializers for structure type!");
3531 // Check to ensure that constants are compatible with the type initializer!
3532 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3533 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3534 GEN_ERROR("Expected type '" +
3535 STy->getElementType(i)->getDescription() +
3536 "' for element #" + utostr(i) +
3537 " of structure initializer!");
3539 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3540 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3546 #line 1524 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3548 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3550 GEN_ERROR("Cannot make struct constant with type: '" +
3551 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3553 if (STy->getNumContainedTypes() != 0)
3554 GEN_ERROR("Illegal number of initializers for structure type!");
3556 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3557 delete (yyvsp[-2].TypeVal);
3563 #line 1537 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3565 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3567 GEN_ERROR("Cannot make null pointer constant with type: '" +
3568 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3570 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3571 delete (yyvsp[-1].TypeVal);
3577 #line 1547 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3579 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3580 delete (yyvsp[-1].TypeVal);
3586 #line 1552 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3588 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3590 GEN_ERROR("Global const reference must be a pointer type!");
3592 // ConstExprs can exist in the body of a function, thus creating
3593 // GlobalValues whenever they refer to a variable. Because we are in
3594 // the context of a function, getValNonImprovising will search the functions
3595 // symbol table instead of the module symbol table for the global symbol,
3596 // which throws things all off. To get around this, we just tell
3597 // getValNonImprovising that we are at global scope here.
3599 Function *SavedCurFn = CurFun.CurrentFunction;
3600 CurFun.CurrentFunction = 0;
3602 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3605 CurFun.CurrentFunction = SavedCurFn;
3607 // If this is an initializer for a constant pointer, which is referencing a
3608 // (currently) undefined variable, create a stub now that shall be replaced
3609 // in the future with the right type of variable.
3612 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3613 const PointerType *PT = cast<PointerType>(Ty);
3615 // First check to see if the forward references value is already created!
3616 PerModuleInfo::GlobalRefsType::iterator I =
3617 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3619 if (I != CurModule.GlobalRefs.end()) {
3620 V = I->second; // Placeholder already exists, use it...
3621 (yyvsp[0].ValIDVal).destroy();
3624 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3626 // Create the forward referenced global.
3628 if (const FunctionType *FTy =
3629 dyn_cast<FunctionType>(PT->getElementType())) {
3630 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3631 CurModule.CurrentModule);
3633 GV = new GlobalVariable(PT->getElementType(), false,
3634 GlobalValue::ExternalLinkage, 0,
3635 Name, CurModule.CurrentModule);
3638 // Keep track of the fact that we have a forward ref to recycle it
3639 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3644 (yyval.ConstVal) = cast<GlobalValue>(V);
3645 delete (yyvsp[-1].TypeVal); // Free the type handle
3651 #line 1613 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3653 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3654 GEN_ERROR("Mismatched types for constant expression!");
3655 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3656 delete (yyvsp[-1].TypeVal);
3662 #line 1620 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3664 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3665 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3666 GEN_ERROR("Cannot create a null initialized value of this type!");
3667 (yyval.ConstVal) = Constant::getNullValue(Ty);
3668 delete (yyvsp[-1].TypeVal);
3674 #line 1629 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3675 { // integral constants
3676 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3677 GEN_ERROR("Constant value doesn't fit in type!");
3678 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3684 #line 1635 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3685 { // integral constants
3686 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3687 GEN_ERROR("Constant value doesn't fit in type!");
3688 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3694 #line 1641 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3695 { // Boolean constants
3696 (yyval.ConstVal) = ConstantBool::getTrue();
3702 #line 1645 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3703 { // Boolean constants
3704 (yyval.ConstVal) = ConstantBool::getFalse();
3710 #line 1649 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3711 { // Float & Double constants
3712 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3713 GEN_ERROR("Floating point constant invalid for type!!");
3714 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3720 #line 1657 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3722 if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType())
3723 GEN_ERROR("cast constant expression from a non-primitive type: '" +
3724 (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!");
3725 if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType())
3726 GEN_ERROR("cast constant expression to a non-primitive type: '" +
3727 (yyvsp[-1].TypeVal)->get()->getDescription() + "'!");
3728 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3729 delete (yyvsp[-1].TypeVal);
3735 #line 1668 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3737 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3738 GEN_ERROR("GetElementPtr requires a pointer operand!");
3740 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3741 // indices to uint struct indices for compatibility.
3742 generic_gep_type_iterator<std::vector<Value*>::iterator>
3743 GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3744 GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3745 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3746 if (isa<StructType>(*GTI)) // Only change struct indices
3747 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[-1].ValueList))[i]))
3748 if (CUI->getType() == Type::UByteTy)
3749 (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3752 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3754 GEN_ERROR("Index list invalid for constant getelementptr!");
3756 std::vector<Constant*> IdxVec;
3757 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3758 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3759 IdxVec.push_back(C);
3761 GEN_ERROR("Indices to constant getelementptr must be constants!");
3763 delete (yyvsp[-1].ValueList);
3765 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3771 #line 1700 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3773 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
3774 GEN_ERROR("Select condition must be of boolean type!");
3775 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3776 GEN_ERROR("Select operand types must match!");
3777 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3783 #line 1708 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3785 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3786 GEN_ERROR("Binary operator types must match!");
3787 // First, make sure we're dealing with the right opcode by upgrading from
3788 // obsolete versions.
3789 sanitizeOpCode((yyvsp[-5].BinaryOpVal),(yyvsp[-3].ConstVal)->getType());
3792 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3793 // To retain backward compatibility with these early compilers, we emit a
3794 // cast to the appropriate integer type automatically if we are in the
3795 // broken case. See PR424 for more information.
3796 if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
3797 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3799 const Type *IntPtrTy = 0;
3800 switch (CurModule.CurrentModule->getPointerSize()) {
3801 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
3802 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
3803 default: GEN_ERROR("invalid pointer binary constant expr!");
3805 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
3806 ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
3807 (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
3814 #line 1735 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3816 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3817 GEN_ERROR("Logical operator types must match!");
3818 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
3819 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
3820 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
3821 GEN_ERROR("Logical operator requires integral operands!");
3823 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3829 #line 1746 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3831 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
3832 GEN_ERROR("setcc operand types must match!");
3833 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3839 #line 1752 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3841 if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
3842 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3843 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
3844 GEN_ERROR("Shift constant expression requires integer operand!");
3845 // Handle opcode upgrade situations
3846 sanitizeOpCode((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal)->getType());
3848 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3854 #line 1763 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3856 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3857 GEN_ERROR("Invalid extractelement operands!");
3858 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3864 #line 1769 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3866 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3867 GEN_ERROR("Invalid insertelement operands!");
3868 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3874 #line 1775 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3876 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
3877 GEN_ERROR("Invalid shufflevector operands!");
3878 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
3884 #line 1784 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3886 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
3892 #line 1788 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3894 (yyval.ConstVector) = new std::vector<Constant*>();
3895 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
3901 #line 1796 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3902 { (yyval.BoolVal) = false; ;}
3906 #line 1796 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3907 { (yyval.BoolVal) = true; ;}
3911 #line 1806 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3913 (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
3914 CurModule.ModuleDone();
3920 #line 1814 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3922 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3923 CurFun.FunctionDone();
3929 #line 1819 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3931 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3937 #line 1823 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3939 (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
3945 #line 1827 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3947 (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
3953 #line 1831 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3955 (yyval.ModuleVal) = CurModule.CurrentModule;
3956 // Emit an error if there are any unresolved types left.
3957 if (!CurModule.LateResolveTypes.empty()) {
3958 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
3959 if (DID.Type == ValID::NameVal) {
3960 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
3962 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
3970 #line 1846 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3972 // Eagerly resolve types. This is not an optimization, this is a
3973 // requirement that is due to the fact that we could have this:
3975 // %list = type { %list * }
3976 // %list = type { %list * } ; repeated type decl
3978 // If types are not resolved eagerly, then the two types will not be
3979 // determined to be the same type!
3981 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
3983 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
3985 // If this is a named type that is not a redefinition, add it to the slot
3987 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
3990 delete (yyvsp[0].TypeVal);
3996 #line 1868 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
3997 { // Function prototypes can be in const pool
4003 #line 1871 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4004 { // Asm blocks can be in the const pool
4010 #line 1874 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4012 if ((yyvsp[0].ConstVal) == 0)
4013 GEN_ERROR("Global value initializer is not a constant!");
4014 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4020 #line 1879 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4027 #line 1882 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4029 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4031 delete (yyvsp[0].TypeVal);
4036 #line 1886 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4044 #line 1890 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4046 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4048 delete (yyvsp[0].TypeVal);
4053 #line 1894 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4061 #line 1898 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4064 ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4066 delete (yyvsp[0].TypeVal);
4071 #line 1903 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4079 #line 1907 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4086 #line 1910 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4093 #line 1913 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4099 #line 1917 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4101 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4102 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4103 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4104 free((yyvsp[0].StrVal));
4106 if (AsmSoFar.empty())
4107 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4109 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4115 #line 1930 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4116 { (yyval.Endianness) = Module::BigEndian; ;}
4120 #line 1931 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4121 { (yyval.Endianness) = Module::LittleEndian; ;}
4125 #line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4127 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4133 #line 1937 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4135 if ((yyvsp[0].UInt64Val) == 32)
4136 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4137 else if ((yyvsp[0].UInt64Val) == 64)
4138 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4140 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4146 #line 1946 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4148 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4149 free((yyvsp[0].StrVal));
4154 #line 1950 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4156 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4157 free((yyvsp[0].StrVal));
4162 #line 1957 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4164 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4165 free((yyvsp[0].StrVal));
4171 #line 1962 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4173 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4174 free((yyvsp[0].StrVal));
4180 #line 1967 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4187 #line 1977 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4188 { (yyval.StrVal) = 0; ;}
4192 #line 1979 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4194 if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4195 GEN_ERROR("void typed arguments are invalid!");
4196 (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4202 #line 1986 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4204 (yyval.ArgList) = (yyvsp[-2].ArgList);
4205 (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4206 delete (yyvsp[0].ArgVal);
4212 #line 1992 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4214 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4215 (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4216 delete (yyvsp[0].ArgVal);
4222 #line 1999 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4224 (yyval.ArgList) = (yyvsp[0].ArgList);
4230 #line 2003 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4232 (yyval.ArgList) = (yyvsp[-2].ArgList);
4233 (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4234 char*>(new PATypeHolder(Type::VoidTy), 0));
4240 #line 2009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4242 (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4243 (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4249 #line 2014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4251 (yyval.ArgList) = 0;
4257 #line 2020 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4259 UnEscapeLexed((yyvsp[-5].StrVal));
4260 std::string FunctionName((yyvsp[-5].StrVal));
4261 free((yyvsp[-5].StrVal)); // Free strdup'd memory!
4263 if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4264 GEN_ERROR("LLVM functions cannot return aggregate types!");
4266 std::vector<const Type*> ParamTypeList;
4267 if ((yyvsp[-3].ArgList)) { // If there are arguments...
4268 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4269 I != (yyvsp[-3].ArgList)->end(); ++I)
4270 ParamTypeList.push_back(I->first->get());
4273 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4274 if (isVarArg) ParamTypeList.pop_back();
4276 const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4277 const PointerType *PFT = PointerType::get(FT);
4278 delete (yyvsp[-6].TypeVal);
4281 if (!FunctionName.empty()) {
4282 ID = ValID::create((char*)FunctionName.c_str());
4284 ID = ValID::create((int)CurModule.Values[PFT].size());
4288 // See if this function was forward referenced. If so, recycle the object.
4289 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4290 // Move the function to the end of the list, from whereever it was
4291 // previously inserted.
4292 Fn = cast<Function>(FWRef);
4293 CurModule.CurrentModule->getFunctionList().remove(Fn);
4294 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4295 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4296 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4297 // If this is the case, either we need to be a forward decl, or it needs
4299 if (!CurFun.isDeclare && !Fn->isExternal())
4300 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4302 // Make sure to strip off any argument names so we can't get conflicts.
4303 if (Fn->isExternal())
4304 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4307 } else { // Not already defined?
4308 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4309 CurModule.CurrentModule);
4311 InsertValue(Fn, CurModule.Values);
4314 CurFun.FunctionStart(Fn);
4316 if (CurFun.isDeclare) {
4317 // If we have declaration, always overwrite linkage. This will allow us to
4318 // correctly handle cases, when pointer to function is passed as argument to
4319 // another function.
4320 Fn->setLinkage(CurFun.Linkage);
4322 Fn->setCallingConv((yyvsp[-7].UIntVal));
4323 Fn->setAlignment((yyvsp[0].UIntVal));
4324 if ((yyvsp[-1].StrVal)) {
4325 Fn->setSection((yyvsp[-1].StrVal));
4326 free((yyvsp[-1].StrVal));
4329 // Add all of the arguments we parsed to the function...
4330 if ((yyvsp[-3].ArgList)) { // Is null if empty...
4331 if (isVarArg) { // Nuke the last entry
4332 assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4333 "Not a varargs marker!");
4334 delete (yyvsp[-3].ArgList)->back().first;
4335 (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry
4337 Function::arg_iterator ArgIt = Fn->arg_begin();
4338 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4339 I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4340 delete I->first; // Delete the typeholder...
4342 setValueName(ArgIt, I->second); // Insert arg into symtab...
4347 delete (yyvsp[-3].ArgList); // We're now done with the argument list
4354 #line 2116 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4356 (yyval.FunctionVal) = CurFun.CurrentFunction;
4358 // Make sure that we keep track of the linkage type even if there was a
4359 // previous "declare".
4360 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4365 #line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4367 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4373 #line 2132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4374 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4378 #line 2133 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4379 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4383 #line 2135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4384 { CurFun.isDeclare = true; ;}
4388 #line 2135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4390 (yyval.FunctionVal) = CurFun.CurrentFunction;
4391 CurFun.FunctionDone();
4397 #line 2145 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4399 (yyval.BoolVal) = false;
4405 #line 2149 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4407 (yyval.BoolVal) = true;
4413 #line 2154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4414 { // A reference to a direct constant
4415 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4421 #line 2158 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4423 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4429 #line 2162 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4430 { // Perhaps it's an FP constant?
4431 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4437 #line 2166 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4439 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4445 #line 2170 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4447 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4453 #line 2174 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4455 (yyval.ValIDVal) = ValID::createNull();
4461 #line 2178 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4463 (yyval.ValIDVal) = ValID::createUndef();
4469 #line 2182 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4470 { // A vector zero constant.
4471 (yyval.ValIDVal) = ValID::createZeroInit();
4477 #line 2186 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4478 { // Nonempty unsized packed vector
4479 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4480 int NumElements = (yyvsp[-1].ConstVector)->size();
4482 PackedType* pt = PackedType::get(ETy, NumElements);
4483 PATypeHolder* PTy = new PATypeHolder(
4491 // Verify all elements are correct type!
4492 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4493 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4494 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4495 ETy->getDescription() +"' as required!\nIt is of type '" +
4496 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4499 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4500 delete PTy; delete (yyvsp[-1].ConstVector);
4506 #line 2211 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4508 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4514 #line 2215 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4516 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4517 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4518 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4519 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4520 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4521 free((yyvsp[-2].StrVal));
4522 free((yyvsp[0].StrVal));
4528 #line 2229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4529 { // Is it an integer reference...?
4530 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4536 #line 2233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4537 { // Is it a named reference...?
4538 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4544 #line 2245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4546 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4552 #line 2250 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4554 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4560 #line 2254 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4561 { // Do not allow functions with 0 basic blocks
4562 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4568 #line 2263 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4570 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4572 InsertValue((yyvsp[0].TermInstVal));
4574 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4575 InsertValue((yyvsp[-2].BasicBlockVal));
4576 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4582 #line 2274 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4584 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4585 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4591 #line 2279 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4593 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4596 // Make sure to move the basic block to the correct location in the
4597 // function, instead of leaving it inserted wherever it was first
4599 Function::BasicBlockListType &BBL =
4600 CurFun.CurrentFunction->getBasicBlockList();
4601 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4607 #line 2291 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4609 (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4612 // Make sure to move the basic block to the correct location in the
4613 // function, instead of leaving it inserted wherever it was first
4615 Function::BasicBlockListType &BBL =
4616 CurFun.CurrentFunction->getBasicBlockList();
4617 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4623 #line 2304 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4624 { // Return with a result...
4625 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4631 #line 2308 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4632 { // Return with no result...
4633 (yyval.TermInstVal) = new ReturnInst();
4639 #line 2312 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4640 { // Unconditional Branch...
4641 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4643 (yyval.TermInstVal) = new BranchInst(tmpBB);
4648 #line 2317 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4650 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4652 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4654 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4656 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4661 #line 2326 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4663 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4665 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4667 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4668 (yyval.TermInstVal) = S;
4670 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4671 E = (yyvsp[-1].JumpTable)->end();
4672 for (; I != E; ++I) {
4673 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4674 S->addCase(CI, I->second);
4676 GEN_ERROR("Switch case is constant, but not a simple integer!");
4678 delete (yyvsp[-1].JumpTable);
4684 #line 2345 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4686 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4688 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4690 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4691 (yyval.TermInstVal) = S;
4697 #line 2355 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4699 const PointerType *PFTy;
4700 const FunctionType *Ty;
4702 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4703 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4704 // Pull out the types of all of the arguments...
4705 std::vector<const Type*> ParamTypes;
4706 if ((yyvsp[-7].ValueList)) {
4707 for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4709 ParamTypes.push_back((*I)->getType());
4712 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4713 if (isVarArg) ParamTypes.pop_back();
4715 Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4716 PFTy = PointerType::get(Ty);
4719 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling...
4721 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4723 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4726 // Create the call node...
4727 if (!(yyvsp[-7].ValueList)) { // Has no arguments?
4728 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4729 } else { // Has arguments?
4730 // Loop through FunctionType's arguments and ensure they are specified
4733 FunctionType::param_iterator I = Ty->param_begin();
4734 FunctionType::param_iterator E = Ty->param_end();
4735 std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4737 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4738 if ((*ArgI)->getType() != *I)
4739 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4740 (*I)->getDescription() + "'!");
4742 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4743 GEN_ERROR("Invalid number of parameters detected!");
4745 (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4747 cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4749 delete (yyvsp[-10].TypeVal);
4750 delete (yyvsp[-7].ValueList);
4756 #line 2410 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4758 (yyval.TermInstVal) = new UnwindInst();
4764 #line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4766 (yyval.TermInstVal) = new UnreachableInst();
4772 #line 2421 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4774 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4775 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4778 GEN_ERROR("May only switch on a constant pool value!");
4780 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4782 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4787 #line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4789 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
4790 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
4794 GEN_ERROR("May only switch on a constant pool value!");
4796 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4798 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
4803 #line 2445 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4805 // Is this definition named?? if so, assign the name...
4806 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
4808 InsertValue((yyvsp[0].InstVal));
4809 (yyval.InstVal) = (yyvsp[0].InstVal);
4815 #line 2454 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4816 { // Used for PHI nodes
4817 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
4818 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
4820 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4822 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4823 delete (yyvsp[-5].TypeVal);
4828 #line 2463 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4830 (yyval.PHIList) = (yyvsp[-6].PHIList);
4831 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
4833 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
4835 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
4840 #line 2473 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4841 { // Used for call statements, and memory insts...
4842 (yyval.ValueList) = new std::vector<Value*>();
4843 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
4848 #line 2477 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4850 (yyval.ValueList) = (yyvsp[-2].ValueList);
4851 (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
4857 #line 2484 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4858 { (yyval.ValueList) = 0; ;}
4862 #line 2486 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4864 (yyval.BoolVal) = true;
4870 #line 2490 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4872 (yyval.BoolVal) = false;
4878 #line 2495 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4880 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
4881 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
4883 "Arithmetic operator requires integer, FP, or packed operands!");
4884 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
4885 ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem ||
4886 (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem ||
4887 (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem))
4888 GEN_ERROR("U/S/FRem not supported on packed types!");
4889 // Upgrade the opcode from obsolete versions before we do anything with it.
4890 sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal));
4892 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4894 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4896 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, val1, val2);
4897 if ((yyval.InstVal) == 0)
4898 GEN_ERROR("binary operator returned null!");
4899 delete (yyvsp[-3].TypeVal);
4904 #line 2517 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4906 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
4907 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
4908 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
4909 GEN_ERROR("Logical operator requires integral operands!");
4911 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4913 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4915 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2);
4916 if ((yyval.InstVal) == 0)
4917 GEN_ERROR("binary operator returned null!");
4918 delete (yyvsp[-3].TypeVal);
4923 #line 2532 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4925 if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
4927 "PackedTypes currently not supported in setcc instructions!");
4929 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
4931 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
4933 (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2);
4934 if ((yyval.InstVal) == 0)
4935 GEN_ERROR("binary operator returned null!");
4936 delete (yyvsp[-3].TypeVal);
4941 #line 2546 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4943 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
4944 << " Replacing with 'xor'.\n";
4946 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
4948 GEN_ERROR("Expected integral type for not instruction!");
4950 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
4951 if ((yyval.InstVal) == 0)
4952 GEN_ERROR("Could not create a xor instruction!");
4958 #line 2559 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4960 if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
4961 GEN_ERROR("Shift amount must be ubyte!");
4962 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
4963 GEN_ERROR("Shift constant expression requires integer operand!");
4964 // Handle opcode upgrade situations
4965 sanitizeOpCode((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal)->getType());
4967 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal).opcode, (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4973 #line 2570 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4975 if (!(yyvsp[0].TypeVal)->get()->isFirstClassType())
4976 GEN_ERROR("cast instruction to a non-primitive type: '" +
4977 (yyvsp[0].TypeVal)->get()->getDescription() + "'!");
4978 (yyval.InstVal) = new CastInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
4979 delete (yyvsp[0].TypeVal);
4985 #line 2578 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
4987 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
4988 GEN_ERROR("select condition must be boolean!");
4989 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
4990 GEN_ERROR("select value types should match!");
4991 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
4997 #line 2586 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5000 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5001 delete (yyvsp[0].TypeVal);
5007 #line 2592 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5009 ObsoleteVarArgs = true;
5010 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5011 Function* NF = CurModule.CurrentModule->
5012 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5015 //foo = alloca 1 of t
5019 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
5020 CurBB->getInstList().push_back(foo);
5021 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5022 CurBB->getInstList().push_back(bar);
5023 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5024 (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5025 delete (yyvsp[0].TypeVal);
5031 #line 2612 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5033 ObsoleteVarArgs = true;
5034 const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5035 Function* NF = CurModule.CurrentModule->
5036 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5038 //b = vanext a, t ->
5039 //foo = alloca 1 of t
5042 //tmp = vaarg foo, t
5044 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
5045 CurBB->getInstList().push_back(foo);
5046 CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5047 CurBB->getInstList().push_back(bar);
5048 CurBB->getInstList().push_back(new StoreInst(bar, foo));
5049 Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5050 CurBB->getInstList().push_back(tmp);
5051 (yyval.InstVal) = new LoadInst(foo);
5052 delete (yyvsp[0].TypeVal);
5058 #line 2635 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5060 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5061 GEN_ERROR("Invalid extractelement operands!");
5062 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5068 #line 2641 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5070 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5071 GEN_ERROR("Invalid insertelement operands!");
5072 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5078 #line 2647 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5080 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5081 GEN_ERROR("Invalid shufflevector operands!");
5082 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5088 #line 2653 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5090 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5091 if (!Ty->isFirstClassType())
5092 GEN_ERROR("PHI node operands must be of first class type!");
5093 (yyval.InstVal) = new PHINode(Ty);
5094 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5095 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5096 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5097 GEN_ERROR("All elements of a PHI node must be of the same type!");
5098 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5099 (yyvsp[0].PHIList)->pop_front();
5101 delete (yyvsp[0].PHIList); // Free the list...
5107 #line 2668 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5109 const PointerType *PFTy;
5110 const FunctionType *Ty;
5112 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5113 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5114 // Pull out the types of all of the arguments...
5115 std::vector<const Type*> ParamTypes;
5116 if ((yyvsp[-1].ValueList)) {
5117 for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5119 ParamTypes.push_back((*I)->getType());
5122 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5123 if (isVarArg) ParamTypes.pop_back();
5125 if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5126 GEN_ERROR("LLVM functions cannot return aggregate types!");
5128 Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5129 PFTy = PointerType::get(Ty);
5132 Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling...
5135 // Create the call node...
5136 if (!(yyvsp[-1].ValueList)) { // Has no arguments?
5137 // Make sure no arguments is a good thing!
5138 if (Ty->getNumParams() != 0)
5139 GEN_ERROR("No arguments passed to a function that "
5140 "expects arguments!");
5142 (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5143 } else { // Has arguments?
5144 // Loop through FunctionType's arguments and ensure they are specified
5147 FunctionType::param_iterator I = Ty->param_begin();
5148 FunctionType::param_iterator E = Ty->param_end();
5149 std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5151 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5152 if ((*ArgI)->getType() != *I)
5153 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5154 (*I)->getDescription() + "'!");
5156 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5157 GEN_ERROR("Invalid number of parameters detected!");
5159 (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5161 cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5162 cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5163 delete (yyvsp[-4].TypeVal);
5164 delete (yyvsp[-1].ValueList);
5170 #line 2727 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5172 (yyval.InstVal) = (yyvsp[0].InstVal);
5178 #line 2734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5180 (yyval.ValueList) = (yyvsp[0].ValueList);
5186 #line 2737 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5188 (yyval.ValueList) = new std::vector<Value*>();
5194 #line 2742 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5196 (yyval.BoolVal) = true;
5202 #line 2746 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5204 (yyval.BoolVal) = false;
5210 #line 2753 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5212 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5213 delete (yyvsp[-1].TypeVal);
5219 #line 2758 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5221 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5223 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5224 delete (yyvsp[-4].TypeVal);
5229 #line 2764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5231 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5232 delete (yyvsp[-1].TypeVal);
5238 #line 2769 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5240 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5242 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5243 delete (yyvsp[-4].TypeVal);
5248 #line 2775 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5250 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5251 GEN_ERROR("Trying to free nonpointer type " +
5252 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5253 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5259 #line 2783 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5261 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5262 GEN_ERROR("Can't load from nonpointer type: " +
5263 (*(yyvsp[-1].TypeVal))->getDescription());
5264 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5265 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5266 (*(yyvsp[-1].TypeVal))->getDescription());
5267 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5269 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5270 delete (yyvsp[-1].TypeVal);
5275 #line 2795 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5277 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5279 GEN_ERROR("Can't store to a nonpointer type: " +
5280 (*(yyvsp[-1].TypeVal))->getDescription());
5281 const Type *ElTy = PT->getElementType();
5282 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5283 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5284 "' into space of type '" + ElTy->getDescription() + "'!");
5286 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5288 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5289 delete (yyvsp[-1].TypeVal);
5294 #line 2810 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5296 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5297 GEN_ERROR("getelementptr insn requires pointer operand!");
5299 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
5300 // indices to uint struct indices for compatibility.
5301 generic_gep_type_iterator<std::vector<Value*>::iterator>
5302 GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
5303 GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
5304 for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
5305 if (isa<StructType>(*GTI)) // Only change struct indices
5306 if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[0].ValueList))[i]))
5307 if (CUI->getType() == Type::UByteTy)
5308 (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
5310 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5311 GEN_ERROR("Invalid getelementptr indices for type '" +
5312 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5313 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5315 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5316 delete (yyvsp[-2].TypeVal);
5317 delete (yyvsp[0].ValueList);
5325 /* Line 1126 of yacc.c. */
5326 #line 5327 "llvmAsmParser.tab.c"
5332 YY_STACK_PRINT (yyss, yyssp);
5337 /* Now `shift' the result of the reduction. Determine what state
5338 that goes to, based on the state we popped back to and the rule
5339 number reduced by. */
5343 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5344 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5345 yystate = yytable[yystate];
5347 yystate = yydefgoto[yyn - YYNTOKENS];
5352 /*------------------------------------.
5353 | yyerrlab -- here on detecting error |
5354 `------------------------------------*/
5356 /* If not already recovering from an error, report this error. */
5361 yyn = yypact[yystate];
5363 if (YYPACT_NINF < yyn && yyn < YYLAST)
5365 int yytype = YYTRANSLATE (yychar);
5366 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5367 YYSIZE_T yysize = yysize0;
5369 int yysize_overflow = 0;
5371 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5372 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5376 /* This is so xgettext sees the translatable formats that are
5377 constructed on the fly. */
5378 YY_("syntax error, unexpected %s");
5379 YY_("syntax error, unexpected %s, expecting %s");
5380 YY_("syntax error, unexpected %s, expecting %s or %s");
5381 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5382 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5386 static char const yyunexpected[] = "syntax error, unexpected %s";
5387 static char const yyexpecting[] = ", expecting %s";
5388 static char const yyor[] = " or %s";
5389 char yyformat[sizeof yyunexpected
5390 + sizeof yyexpecting - 1
5391 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5392 * (sizeof yyor - 1))];
5393 char const *yyprefix = yyexpecting;
5395 /* Start YYX at -YYN if negative to avoid negative indexes in
5397 int yyxbegin = yyn < 0 ? -yyn : 0;
5399 /* Stay within bounds of both yycheck and yytname. */
5400 int yychecklim = YYLAST - yyn;
5401 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5404 yyarg[0] = yytname[yytype];
5405 yyfmt = yystpcpy (yyformat, yyunexpected);
5407 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5408 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5410 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5414 yyformat[sizeof yyunexpected - 1] = '\0';
5417 yyarg[yycount++] = yytname[yyx];
5418 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5419 yysize_overflow |= yysize1 < yysize;
5421 yyfmt = yystpcpy (yyfmt, yyprefix);
5425 yyf = YY_(yyformat);
5426 yysize1 = yysize + yystrlen (yyf);
5427 yysize_overflow |= yysize1 < yysize;
5430 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5431 yymsg = (char *) YYSTACK_ALLOC (yysize);
5434 /* Avoid sprintf, as that infringes on the user's name space.
5435 Don't have undefined behavior even if the translation
5436 produced a string with the wrong number of "%s"s. */
5439 while ((*yyp = *yyf))
5441 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5443 yyp += yytnamerr (yyp, yyarg[yyi++]);
5453 YYSTACK_FREE (yymsg);
5457 yyerror (YY_("syntax error"));
5458 goto yyexhaustedlab;
5462 #endif /* YYERROR_VERBOSE */
5463 yyerror (YY_("syntax error"));
5468 if (yyerrstatus == 3)
5470 /* If just tried and failed to reuse look-ahead token after an
5471 error, discard it. */
5473 if (yychar <= YYEOF)
5475 /* Return failure if at end of input. */
5476 if (yychar == YYEOF)
5481 yydestruct ("Error: discarding", yytoken, &yylval);
5486 /* Else will try to reuse look-ahead token after shifting the error
5491 /*---------------------------------------------------.
5492 | yyerrorlab -- error raised explicitly by YYERROR. |
5493 `---------------------------------------------------*/
5496 /* Pacify compilers like GCC when the user code never invokes
5497 YYERROR and the label yyerrorlab therefore never appears in user
5508 /*-------------------------------------------------------------.
5509 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5510 `-------------------------------------------------------------*/
5512 yyerrstatus = 3; /* Each real token shifted decrements this. */
5516 yyn = yypact[yystate];
5517 if (yyn != YYPACT_NINF)
5520 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5528 /* Pop the current state because it cannot handle the error token. */
5533 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5536 YY_STACK_PRINT (yyss, yyssp);
5545 /* Shift the error token. */
5546 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5552 /*-------------------------------------.
5553 | yyacceptlab -- YYACCEPT comes here. |
5554 `-------------------------------------*/
5559 /*-----------------------------------.
5560 | yyabortlab -- YYABORT comes here. |
5561 `-----------------------------------*/
5567 /*-------------------------------------------------.
5568 | yyexhaustedlab -- memory exhaustion comes here. |
5569 `-------------------------------------------------*/
5571 yyerror (YY_("memory exhausted"));
5577 if (yychar != YYEOF && yychar != YYEMPTY)
5578 yydestruct ("Cleanup: discarding lookahead",
5580 while (yyssp != yyss)
5582 yydestruct ("Cleanup: popping",
5583 yystos[*yyssp], yyvsp);
5588 YYSTACK_FREE (yyss);
5594 #line 2836 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
5597 void llvm::GenerateError(const std::string &message, int LineNo) {
5598 if (LineNo == -1) LineNo = llvmAsmlineno;
5599 // TODO: column number in exception
5601 TheParseError->setError(CurFilename, message, LineNo);
5605 int yyerror(const char *ErrorMsg) {
5607 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5608 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5609 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5610 if (yychar == YYEMPTY || yychar == 0)
5611 errMsg += "end-of-file.";
5613 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5614 GenerateError(errMsg);