1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse llvmAsmparse
53 #define yylex llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval llvmAsmlval
56 #define yychar llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
84 ATSTRINGCONSTANT = 275,
85 PCTSTRINGCONSTANT = 276,
86 ZEROINITIALIZER = 277,
125 X86_STDCALLCC_TOK = 316,
126 X86_FASTCALLCC_TOK = 317,
192 EXTRACTELEMENT = 383,
205 #define ESINT64VAL 258
206 #define EUINT64VAL 259
207 #define ESAPINTVAL 260
208 #define EUAPINTVAL 261
209 #define LOCALVAL_ID 262
210 #define GLOBALVAL_ID 263
219 #define GLOBALVAR 272
221 #define STRINGCONSTANT 274
222 #define ATSTRINGCONSTANT 275
223 #define PCTSTRINGCONSTANT 276
224 #define ZEROINITIALIZER 277
236 #define THREAD_LOCAL 289
238 #define DOTDOTDOT 291
244 #define APPENDING 297
245 #define DLLIMPORT 298
246 #define DLLEXPORT 299
247 #define EXTERN_WEAK 300
258 #define SIDEEFFECT 311
261 #define FASTCC_TOK 314
262 #define COLDCC_TOK 315
263 #define X86_STDCALLCC_TOK 316
264 #define X86_FASTCALLCC_TOK 317
265 #define DATALAYOUT 318
271 #define UNREACHABLE 324
314 #define GETELEMENTPTR 367
330 #define EXTRACTELEMENT 383
331 #define INSERTELEMENT 384
332 #define SHUFFLEVECTOR 385
339 #define PROTECTED 392
344 /* Copy the first part of user declarations. */
345 #line 14 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
347 #include "ParserInternals.h"
348 #include "llvm/CallingConv.h"
349 #include "llvm/InlineAsm.h"
350 #include "llvm/Instructions.h"
351 #include "llvm/Module.h"
352 #include "llvm/ValueSymbolTable.h"
353 #include "llvm/Support/GetElementPtrTypeIterator.h"
354 #include "llvm/Support/CommandLine.h"
355 #include "llvm/ADT/SmallVector.h"
356 #include "llvm/ADT/STLExtras.h"
357 #include "llvm/Support/MathExtras.h"
358 #include "llvm/Support/Streams.h"
367 // The following is a gross hack. In order to rid the libAsmParser library of
368 // exceptions, we have to have a way of getting the yyparse function to go into
369 // an error situation. So, whenever we want an error to occur, the GenerateError
370 // function (see bottom of file) sets TriggerError. Then, at the end of each
371 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
372 // (a goto) to put YACC in error state. Furthermore, several calls to
373 // GenerateError are made from inside productions and they must simulate the
374 // previous exception behavior by exiting the production immediately. We have
375 // replaced these with the GEN_ERROR macro which calls GeneratError and then
376 // immediately invokes YYERROR. This would be so much cleaner if it was a
377 // recursive descent parser.
378 static bool TriggerError = false;
379 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
380 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
382 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
383 int yylex(); // declaration" of xxx warnings.
387 std::string CurFilename;
390 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
391 cl::Hidden, cl::init(false));
394 using namespace llvm;
396 static Module *ParserResult;
398 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
399 // relating to upreferences in the input stream.
401 //#define DEBUG_UPREFS 1
403 #define UR_OUT(X) cerr << X
408 #define YYERROR_VERBOSE 1
410 static GlobalVariable *CurGV;
413 // This contains info used when building the body of a function. It is
414 // destroyed when the function is completed.
416 typedef std::vector<Value *> ValueList; // Numbered defs
419 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
421 static struct PerModuleInfo {
422 Module *CurrentModule;
423 ValueList Values; // Module level numbered definitions
424 ValueList LateResolveValues;
425 std::vector<PATypeHolder> Types;
426 std::map<ValID, PATypeHolder> LateResolveTypes;
428 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
429 /// how they were referenced and on which line of the input they came from so
430 /// that we can resolve them later and print error messages as appropriate.
431 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
433 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
434 // references to global values. Global values may be referenced before they
435 // are defined, and if so, the temporary object that they represent is held
436 // here. This is used for forward references of GlobalValues.
438 typedef std::map<std::pair<const PointerType *,
439 ValID>, GlobalValue*> GlobalRefsType;
440 GlobalRefsType GlobalRefs;
443 // If we could not resolve some functions at function compilation time
444 // (calls to functions before they are defined), resolve them now... Types
445 // are resolved when the constant pool has been completely parsed.
447 ResolveDefinitions(LateResolveValues);
451 // Check to make sure that all global value forward references have been
454 if (!GlobalRefs.empty()) {
455 std::string UndefinedReferences = "Unresolved global references exist:\n";
457 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
459 UndefinedReferences += " " + I->first.first->getDescription() + " " +
460 I->first.second.getName() + "\n";
462 GenerateError(UndefinedReferences);
466 Values.clear(); // Clear out function local definitions
471 // GetForwardRefForGlobal - Check to see if there is a forward reference
472 // for this global. If so, remove it from the GlobalRefs map and return it.
473 // If not, just return null.
474 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
475 // Check to see if there is a forward reference to this global variable...
476 // if there is, eliminate it and patch the reference to use the new def'n.
477 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
478 GlobalValue *Ret = 0;
479 if (I != GlobalRefs.end()) {
486 bool TypeIsUnresolved(PATypeHolder* PATy) {
487 // If it isn't abstract, its resolved
488 const Type* Ty = PATy->get();
489 if (!Ty->isAbstract())
491 // Traverse the type looking for abstract types. If it isn't abstract then
492 // we don't need to traverse that leg of the type.
493 std::vector<const Type*> WorkList, SeenList;
494 WorkList.push_back(Ty);
495 while (!WorkList.empty()) {
496 const Type* Ty = WorkList.back();
497 SeenList.push_back(Ty);
499 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
500 // Check to see if this is an unresolved type
501 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
502 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
503 for ( ; I != E; ++I) {
504 if (I->second.get() == OpTy)
507 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
508 const Type* TheTy = SeqTy->getElementType();
509 if (TheTy->isAbstract() && TheTy != Ty) {
510 std::vector<const Type*>::iterator I = SeenList.begin(),
516 WorkList.push_back(TheTy);
518 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
519 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
520 const Type* TheTy = StrTy->getElementType(i);
521 if (TheTy->isAbstract() && TheTy != Ty) {
522 std::vector<const Type*>::iterator I = SeenList.begin(),
528 WorkList.push_back(TheTy);
537 static struct PerFunctionInfo {
538 Function *CurrentFunction; // Pointer to current function being created
540 ValueList Values; // Keep track of #'d definitions
542 ValueList LateResolveValues;
543 bool isDeclare; // Is this function a forward declararation?
544 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
545 GlobalValue::VisibilityTypes Visibility;
547 /// BBForwardRefs - When we see forward references to basic blocks, keep
548 /// track of them here.
549 std::map<ValID, BasicBlock*> BBForwardRefs;
551 inline PerFunctionInfo() {
554 Linkage = GlobalValue::ExternalLinkage;
555 Visibility = GlobalValue::DefaultVisibility;
558 inline void FunctionStart(Function *M) {
563 void FunctionDone() {
564 // Any forward referenced blocks left?
565 if (!BBForwardRefs.empty()) {
566 GenerateError("Undefined reference to label " +
567 BBForwardRefs.begin()->second->getName());
571 // Resolve all forward references now.
572 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
574 Values.clear(); // Clear out function local definitions
575 BBForwardRefs.clear();
578 Linkage = GlobalValue::ExternalLinkage;
579 Visibility = GlobalValue::DefaultVisibility;
581 } CurFun; // Info for the current function...
583 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
586 //===----------------------------------------------------------------------===//
587 // Code to handle definitions of all the types
588 //===----------------------------------------------------------------------===//
590 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
591 // Things that have names or are void typed don't get slot numbers
592 if (V->hasName() || (V->getType() == Type::VoidTy))
595 // In the case of function values, we have to allow for the forward reference
596 // of basic blocks, which are included in the numbering. Consequently, we keep
597 // track of the next insertion location with NextValNum. When a BB gets
598 // inserted, it could change the size of the CurFun.Values vector.
599 if (&ValueTab == &CurFun.Values) {
600 if (ValueTab.size() <= CurFun.NextValNum)
601 ValueTab.resize(CurFun.NextValNum+1);
602 ValueTab[CurFun.NextValNum++] = V;
605 // For all other lists, its okay to just tack it on the back of the vector.
606 ValueTab.push_back(V);
609 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
611 case ValID::LocalID: // Is it a numbered definition?
612 // Module constants occupy the lowest numbered slots...
613 if (D.Num < CurModule.Types.size())
614 return CurModule.Types[D.Num];
616 case ValID::LocalName: // Is it a named definition?
617 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
618 D.destroy(); // Free old strdup'd memory...
623 GenerateError("Internal parser error: Invalid symbol type reference");
627 // If we reached here, we referenced either a symbol that we don't know about
628 // or an id number that hasn't been read yet. We may be referencing something
629 // forward, so just create an entry to be resolved later and get to it...
631 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
634 if (inFunctionScope()) {
635 if (D.Type == ValID::LocalName) {
636 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
639 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
644 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
645 if (I != CurModule.LateResolveTypes.end())
648 Type *Typ = OpaqueType::get();
649 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
653 // getExistingVal - Look up the value specified by the provided type and
654 // the provided ValID. If the value exists and has already been defined, return
655 // it. Otherwise return null.
657 static Value *getExistingVal(const Type *Ty, const ValID &D) {
658 if (isa<FunctionType>(Ty)) {
659 GenerateError("Functions are not values and "
660 "must be referenced as pointers");
665 case ValID::LocalID: { // Is it a numbered definition?
666 // Check that the number is within bounds.
667 if (D.Num >= CurFun.Values.size())
669 Value *Result = CurFun.Values[D.Num];
670 if (Ty != Result->getType()) {
671 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
672 Result->getType()->getDescription() + "' does not match "
673 "expected type, '" + Ty->getDescription() + "'");
678 case ValID::GlobalID: { // Is it a numbered definition?
679 if (D.Num >= CurModule.Values.size())
681 Value *Result = CurModule.Values[D.Num];
682 if (Ty != Result->getType()) {
683 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
684 Result->getType()->getDescription() + "' does not match "
685 "expected type, '" + Ty->getDescription() + "'");
691 case ValID::LocalName: { // Is it a named definition?
692 if (!inFunctionScope())
694 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
695 Value *N = SymTab.lookup(D.Name);
698 if (N->getType() != Ty)
701 D.destroy(); // Free old strdup'd memory...
704 case ValID::GlobalName: { // Is it a named definition?
705 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
706 Value *N = SymTab.lookup(D.Name);
709 if (N->getType() != Ty)
712 D.destroy(); // Free old strdup'd memory...
716 // Check to make sure that "Ty" is an integral type, and that our
717 // value will fit into the specified type...
718 case ValID::ConstSIntVal: // Is it a constant pool reference??
719 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
720 GenerateError("Signed integral constant '" +
721 itostr(D.ConstPool64) + "' is invalid for type '" +
722 Ty->getDescription() + "'");
725 return ConstantInt::get(Ty, D.ConstPool64, true);
727 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
728 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
729 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
730 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
731 "' is invalid or out of range");
733 } else { // This is really a signed reference. Transmogrify.
734 return ConstantInt::get(Ty, D.ConstPool64, true);
737 return ConstantInt::get(Ty, D.UConstPool64);
740 case ValID::ConstFPVal: // Is it a floating point const pool reference?
741 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
742 GenerateError("FP constant invalid for type");
745 return ConstantFP::get(Ty, D.ConstPoolFP);
747 case ValID::ConstNullVal: // Is it a null value?
748 if (!isa<PointerType>(Ty)) {
749 GenerateError("Cannot create a a non pointer null");
752 return ConstantPointerNull::get(cast<PointerType>(Ty));
754 case ValID::ConstUndefVal: // Is it an undef value?
755 return UndefValue::get(Ty);
757 case ValID::ConstZeroVal: // Is it a zero value?
758 return Constant::getNullValue(Ty);
760 case ValID::ConstantVal: // Fully resolved constant?
761 if (D.ConstantValue->getType() != Ty) {
762 GenerateError("Constant expression type different from required type");
765 return D.ConstantValue;
767 case ValID::InlineAsmVal: { // Inline asm expression
768 const PointerType *PTy = dyn_cast<PointerType>(Ty);
769 const FunctionType *FTy =
770 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
771 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
772 GenerateError("Invalid type for asm constraint string");
775 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
776 D.IAD->HasSideEffects);
777 D.destroy(); // Free InlineAsmDescriptor.
781 assert(0 && "Unhandled case!");
785 assert(0 && "Unhandled case!");
789 // getVal - This function is identical to getExistingVal, except that if a
790 // value is not already defined, it "improvises" by creating a placeholder var
791 // that looks and acts just like the requested variable. When the value is
792 // defined later, all uses of the placeholder variable are replaced with the
795 static Value *getVal(const Type *Ty, const ValID &ID) {
796 if (Ty == Type::LabelTy) {
797 GenerateError("Cannot use a basic block here");
801 // See if the value has already been defined.
802 Value *V = getExistingVal(Ty, ID);
804 if (TriggerError) return 0;
806 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
807 GenerateError("Invalid use of a composite type");
811 // If we reached here, we referenced either a symbol that we don't know about
812 // or an id number that hasn't been read yet. We may be referencing something
813 // forward, so just create an entry to be resolved later and get to it...
816 case ValID::GlobalName:
817 case ValID::GlobalID: {
818 const PointerType *PTy = dyn_cast<PointerType>(Ty);
820 GenerateError("Invalid type for reference to global" );
823 const Type* ElTy = PTy->getElementType();
824 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
825 V = new Function(FTy, GlobalValue::ExternalLinkage);
827 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
831 V = new Argument(Ty);
834 // Remember where this forward reference came from. FIXME, shouldn't we try
835 // to recycle these things??
836 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
839 if (inFunctionScope())
840 InsertValue(V, CurFun.LateResolveValues);
842 InsertValue(V, CurModule.LateResolveValues);
846 /// defineBBVal - This is a definition of a new basic block with the specified
847 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
848 static BasicBlock *defineBBVal(const ValID &ID) {
849 assert(inFunctionScope() && "Can't get basic block at global scope!");
853 // First, see if this was forward referenced
855 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
856 if (BBI != CurFun.BBForwardRefs.end()) {
858 // The forward declaration could have been inserted anywhere in the
859 // function: insert it into the correct place now.
860 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
861 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
863 // We're about to erase the entry, save the key so we can clean it up.
864 ValID Tmp = BBI->first;
866 // Erase the forward ref from the map as its no longer "forward"
867 CurFun.BBForwardRefs.erase(ID);
869 // The key has been removed from the map but so we don't want to leave
870 // strdup'd memory around so destroy it too.
873 // If its a numbered definition, bump the number and set the BB value.
874 if (ID.Type == ValID::LocalID) {
875 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
883 // We haven't seen this BB before and its first mention is a definition.
884 // Just create it and return it.
885 std::string Name (ID.Type == ValID::LocalName ? ID.Name : "");
886 BB = new BasicBlock(Name, CurFun.CurrentFunction);
887 if (ID.Type == ValID::LocalID) {
888 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
892 ID.destroy(); // Free strdup'd memory
896 /// getBBVal - get an existing BB value or create a forward reference for it.
898 static BasicBlock *getBBVal(const ValID &ID) {
899 assert(inFunctionScope() && "Can't get basic block at global scope!");
903 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
904 if (BBI != CurFun.BBForwardRefs.end()) {
906 } if (ID.Type == ValID::LocalName) {
907 std::string Name = ID.Name;
908 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
910 if (N->getType()->getTypeID() == Type::LabelTyID)
911 BB = cast<BasicBlock>(N);
913 GenerateError("Reference to label '" + Name + "' is actually of type '"+
914 N->getType()->getDescription() + "'");
915 } else if (ID.Type == ValID::LocalID) {
916 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
917 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
918 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
920 GenerateError("Reference to label '%" + utostr(ID.Num) +
921 "' is actually of type '"+
922 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
925 GenerateError("Illegal label reference " + ID.getName());
929 // If its already been defined, return it now.
931 ID.destroy(); // Free strdup'd memory.
935 // Otherwise, this block has not been seen before, create it.
937 if (ID.Type == ValID::LocalName)
939 BB = new BasicBlock(Name, CurFun.CurrentFunction);
941 // Insert it in the forward refs map.
942 CurFun.BBForwardRefs[ID] = BB;
948 //===----------------------------------------------------------------------===//
949 // Code to handle forward references in instructions
950 //===----------------------------------------------------------------------===//
952 // This code handles the late binding needed with statements that reference
953 // values not defined yet... for example, a forward branch, or the PHI node for
956 // This keeps a table (CurFun.LateResolveValues) of all such forward references
957 // and back patchs after we are done.
960 // ResolveDefinitions - If we could not resolve some defs at parsing
961 // time (forward branches, phi functions for loops, etc...) resolve the
965 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
966 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
967 while (!LateResolvers.empty()) {
968 Value *V = LateResolvers.back();
969 LateResolvers.pop_back();
971 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
972 CurModule.PlaceHolderInfo.find(V);
973 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
975 ValID &DID = PHI->second.first;
977 Value *TheRealValue = getExistingVal(V->getType(), DID);
981 V->replaceAllUsesWith(TheRealValue);
983 CurModule.PlaceHolderInfo.erase(PHI);
984 } else if (FutureLateResolvers) {
985 // Functions have their unresolved items forwarded to the module late
987 InsertValue(V, *FutureLateResolvers);
989 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
990 GenerateError("Reference to an invalid definition: '" +DID.getName()+
991 "' of type '" + V->getType()->getDescription() + "'",
995 GenerateError("Reference to an invalid definition: #" +
996 itostr(DID.Num) + " of type '" +
997 V->getType()->getDescription() + "'",
1003 LateResolvers.clear();
1006 // ResolveTypeTo - A brand new type was just declared. This means that (if
1007 // name is not null) things referencing Name can be resolved. Otherwise, things
1008 // refering to the number can be resolved. Do this now.
1010 static void ResolveTypeTo(char *Name, const Type *ToTy) {
1012 if (Name) D = ValID::createLocalName(Name);
1013 else D = ValID::createLocalID(CurModule.Types.size());
1015 std::map<ValID, PATypeHolder>::iterator I =
1016 CurModule.LateResolveTypes.find(D);
1017 if (I != CurModule.LateResolveTypes.end()) {
1018 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1019 CurModule.LateResolveTypes.erase(I);
1023 // setValueName - Set the specified value to the name given. The name may be
1024 // null potentially, in which case this is a noop. The string passed in is
1025 // assumed to be a malloc'd string buffer, and is free'd by this function.
1027 static void setValueName(Value *V, char *NameStr) {
1028 if (!NameStr) return;
1029 std::string Name(NameStr); // Copy string
1030 free(NameStr); // Free old string
1032 if (V->getType() == Type::VoidTy) {
1033 GenerateError("Can't assign name '" + Name+"' to value with void type");
1037 assert(inFunctionScope() && "Must be in function scope!");
1038 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1039 if (ST.lookup(Name)) {
1040 GenerateError("Redefinition of value '" + Name + "' of type '" +
1041 V->getType()->getDescription() + "'");
1049 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1050 /// this is a declaration, otherwise it is a definition.
1051 static GlobalVariable *
1052 ParseGlobalVariable(char *NameStr,
1053 GlobalValue::LinkageTypes Linkage,
1054 GlobalValue::VisibilityTypes Visibility,
1055 bool isConstantGlobal, const Type *Ty,
1056 Constant *Initializer, bool IsThreadLocal) {
1057 if (isa<FunctionType>(Ty)) {
1058 GenerateError("Cannot declare global vars of function type");
1062 const PointerType *PTy = PointerType::get(Ty);
1066 Name = NameStr; // Copy string
1067 free(NameStr); // Free old string
1070 // See if this global value was forward referenced. If so, recycle the
1073 if (!Name.empty()) {
1074 ID = ValID::createGlobalName((char*)Name.c_str());
1076 ID = ValID::createGlobalID(CurModule.Values.size());
1079 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1080 // Move the global to the end of the list, from whereever it was
1081 // previously inserted.
1082 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1083 CurModule.CurrentModule->getGlobalList().remove(GV);
1084 CurModule.CurrentModule->getGlobalList().push_back(GV);
1085 GV->setInitializer(Initializer);
1086 GV->setLinkage(Linkage);
1087 GV->setVisibility(Visibility);
1088 GV->setConstant(isConstantGlobal);
1089 GV->setThreadLocal(IsThreadLocal);
1090 InsertValue(GV, CurModule.Values);
1094 // If this global has a name
1095 if (!Name.empty()) {
1096 // if the global we're parsing has an initializer (is a definition) and
1097 // has external linkage.
1098 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1099 // If there is already a global with external linkage with this name
1100 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1101 // If we allow this GVar to get created, it will be renamed in the
1102 // symbol table because it conflicts with an existing GVar. We can't
1103 // allow redefinition of GVars whose linking indicates that their name
1104 // must stay the same. Issue the error.
1105 GenerateError("Redefinition of global variable named '" + Name +
1106 "' of type '" + Ty->getDescription() + "'");
1111 // Otherwise there is no existing GV to use, create one now.
1112 GlobalVariable *GV =
1113 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1114 CurModule.CurrentModule, IsThreadLocal);
1115 GV->setVisibility(Visibility);
1116 InsertValue(GV, CurModule.Values);
1120 // setTypeName - Set the specified type to the name given. The name may be
1121 // null potentially, in which case this is a noop. The string passed in is
1122 // assumed to be a malloc'd string buffer, and is freed by this function.
1124 // This function returns true if the type has already been defined, but is
1125 // allowed to be redefined in the specified context. If the name is a new name
1126 // for the type plane, it is inserted and false is returned.
1127 static bool setTypeName(const Type *T, char *NameStr) {
1128 assert(!inFunctionScope() && "Can't give types function-local names!");
1129 if (NameStr == 0) return false;
1131 std::string Name(NameStr); // Copy string
1132 free(NameStr); // Free old string
1134 // We don't allow assigning names to void type
1135 if (T == Type::VoidTy) {
1136 GenerateError("Can't assign name '" + Name + "' to the void type");
1140 // Set the type name, checking for conflicts as we do so.
1141 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1143 if (AlreadyExists) { // Inserting a name that is already defined???
1144 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1145 assert(Existing && "Conflict but no matching type?!");
1147 // There is only one case where this is allowed: when we are refining an
1148 // opaque type. In this case, Existing will be an opaque type.
1149 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1150 // We ARE replacing an opaque type!
1151 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1155 // Otherwise, this is an attempt to redefine a type. That's okay if
1156 // the redefinition is identical to the original. This will be so if
1157 // Existing and T point to the same Type object. In this one case we
1158 // allow the equivalent redefinition.
1159 if (Existing == T) return true; // Yes, it's equal.
1161 // Any other kind of (non-equivalent) redefinition is an error.
1162 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1163 T->getDescription() + "'");
1169 //===----------------------------------------------------------------------===//
1170 // Code for handling upreferences in type names...
1173 // TypeContains - Returns true if Ty directly contains E in it.
1175 static bool TypeContains(const Type *Ty, const Type *E) {
1176 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1177 E) != Ty->subtype_end();
1181 struct UpRefRecord {
1182 // NestingLevel - The number of nesting levels that need to be popped before
1183 // this type is resolved.
1184 unsigned NestingLevel;
1186 // LastContainedTy - This is the type at the current binding level for the
1187 // type. Every time we reduce the nesting level, this gets updated.
1188 const Type *LastContainedTy;
1190 // UpRefTy - This is the actual opaque type that the upreference is
1191 // represented with.
1192 OpaqueType *UpRefTy;
1194 UpRefRecord(unsigned NL, OpaqueType *URTy)
1195 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1199 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1200 static std::vector<UpRefRecord> UpRefs;
1202 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1203 /// called. It loops through the UpRefs vector, which is a list of the
1204 /// currently active types. For each type, if the up reference is contained in
1205 /// the newly completed type, we decrement the level count. When the level
1206 /// count reaches zero, the upreferenced type is the type that is passed in:
1207 /// thus we can complete the cycle.
1209 static PATypeHolder HandleUpRefs(const Type *ty) {
1210 // If Ty isn't abstract, or if there are no up-references in it, then there is
1211 // nothing to resolve here.
1212 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1214 PATypeHolder Ty(ty);
1215 UR_OUT("Type '" << Ty->getDescription() <<
1216 "' newly formed. Resolving upreferences.\n" <<
1217 UpRefs.size() << " upreferences active!\n");
1219 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1220 // to zero), we resolve them all together before we resolve them to Ty. At
1221 // the end of the loop, if there is anything to resolve to Ty, it will be in
1223 OpaqueType *TypeToResolve = 0;
1225 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1226 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1227 << UpRefs[i].second->getDescription() << ") = "
1228 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1229 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1230 // Decrement level of upreference
1231 unsigned Level = --UpRefs[i].NestingLevel;
1232 UpRefs[i].LastContainedTy = Ty;
1233 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1234 if (Level == 0) { // Upreference should be resolved!
1235 if (!TypeToResolve) {
1236 TypeToResolve = UpRefs[i].UpRefTy;
1238 UR_OUT(" * Resolving upreference for "
1239 << UpRefs[i].second->getDescription() << "\n";
1240 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1241 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1242 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1243 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1245 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1246 --i; // Do not skip the next element...
1251 if (TypeToResolve) {
1252 UR_OUT(" * Resolving upreference for "
1253 << UpRefs[i].second->getDescription() << "\n";
1254 std::string OldName = TypeToResolve->getDescription());
1255 TypeToResolve->refineAbstractTypeTo(Ty);
1261 //===----------------------------------------------------------------------===//
1262 // RunVMAsmParser - Define an interface to this parser
1263 //===----------------------------------------------------------------------===//
1265 static Module* RunParser(Module * M);
1267 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1270 CurFilename = Filename;
1271 return RunParser(new Module(CurFilename));
1274 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1275 set_scan_string(AsmString);
1277 CurFilename = "from_memory";
1279 return RunParser(new Module (CurFilename));
1281 return RunParser(M);
1287 /* Enabling traces. */
1292 /* Enabling verbose error messages. */
1293 #ifdef YYERROR_VERBOSE
1294 # undef YYERROR_VERBOSE
1295 # define YYERROR_VERBOSE 1
1297 # define YYERROR_VERBOSE 0
1300 /* Enabling the token table. */
1301 #ifndef YYTOKEN_TABLE
1302 # define YYTOKEN_TABLE 0
1305 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1306 #line 955 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
1307 typedef union YYSTYPE {
1308 llvm::Module *ModuleVal;
1309 llvm::Function *FunctionVal;
1310 llvm::BasicBlock *BasicBlockVal;
1311 llvm::TerminatorInst *TermInstVal;
1312 llvm::Instruction *InstVal;
1313 llvm::Constant *ConstVal;
1315 const llvm::Type *PrimType;
1316 std::list<llvm::PATypeHolder> *TypeList;
1317 llvm::PATypeHolder *TypeVal;
1318 llvm::Value *ValueVal;
1319 std::vector<llvm::Value*> *ValueList;
1320 llvm::ArgListType *ArgList;
1321 llvm::TypeWithAttrs TypeWithAttrs;
1322 llvm::TypeWithAttrsList *TypeWithAttrsList;
1323 llvm::ValueRefList *ValueRefList;
1325 // Represent the RHS of PHI node
1326 std::list<std::pair<llvm::Value*,
1327 llvm::BasicBlock*> > *PHIList;
1328 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1329 std::vector<llvm::Constant*> *ConstVector;
1331 llvm::GlobalValue::LinkageTypes Linkage;
1332 llvm::GlobalValue::VisibilityTypes Visibility;
1333 uint16_t ParamAttrs;
1334 llvm::APInt *APIntVal;
1342 char *StrVal; // This memory is strdup'd!
1343 llvm::ValID ValIDVal; // strdup'd memory maybe!
1345 llvm::Instruction::BinaryOps BinaryOpVal;
1346 llvm::Instruction::TermOps TermOpVal;
1347 llvm::Instruction::MemoryOps MemOpVal;
1348 llvm::Instruction::CastOps CastOpVal;
1349 llvm::Instruction::OtherOps OtherOpVal;
1350 llvm::ICmpInst::Predicate IPredicate;
1351 llvm::FCmpInst::Predicate FPredicate;
1353 /* Line 196 of yacc.c. */
1354 #line 1355 "llvmAsmParser.tab.c"
1355 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1356 # define YYSTYPE_IS_DECLARED 1
1357 # define YYSTYPE_IS_TRIVIAL 1
1362 /* Copy the second part of user declarations. */
1365 /* Line 219 of yacc.c. */
1366 #line 1367 "llvmAsmParser.tab.c"
1368 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1369 # define YYSIZE_T __SIZE_TYPE__
1371 #if ! defined (YYSIZE_T) && defined (size_t)
1372 # define YYSIZE_T size_t
1374 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1375 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1376 # define YYSIZE_T size_t
1378 #if ! defined (YYSIZE_T)
1379 # define YYSIZE_T unsigned int
1385 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1386 # define YY_(msgid) dgettext ("bison-runtime", msgid)
1390 # define YY_(msgid) msgid
1394 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1396 /* The parser invokes alloca or malloc; define the necessary symbols. */
1398 # ifdef YYSTACK_USE_ALLOCA
1399 # if YYSTACK_USE_ALLOCA
1401 # define YYSTACK_ALLOC __builtin_alloca
1403 # define YYSTACK_ALLOC alloca
1404 # if defined (__STDC__) || defined (__cplusplus)
1405 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1406 # define YYINCLUDED_STDLIB_H
1412 # ifdef YYSTACK_ALLOC
1413 /* Pacify GCC's `empty if-body' warning. */
1414 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1415 # ifndef YYSTACK_ALLOC_MAXIMUM
1416 /* The OS might guarantee only one guard page at the bottom of the stack,
1417 and a page size can be as small as 4096 bytes. So we cannot safely
1418 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1419 to allow for a few compiler-allocated temporary stack slots. */
1420 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1423 # define YYSTACK_ALLOC YYMALLOC
1424 # define YYSTACK_FREE YYFREE
1425 # ifndef YYSTACK_ALLOC_MAXIMUM
1426 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1432 # define YYMALLOC malloc
1433 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1434 && (defined (__STDC__) || defined (__cplusplus)))
1435 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1439 # define YYFREE free
1440 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1441 && (defined (__STDC__) || defined (__cplusplus)))
1442 void free (void *); /* INFRINGES ON USER NAME SPACE */
1449 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1452 #if (! defined (yyoverflow) \
1453 && (! defined (__cplusplus) \
1454 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1456 /* A type that is properly aligned for any stack member. */
1463 /* The size of the maximum gap between one aligned stack and the next. */
1464 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1466 /* The size of an array large to enough to hold all stacks, each with
1468 # define YYSTACK_BYTES(N) \
1469 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1470 + YYSTACK_GAP_MAXIMUM)
1472 /* Copy COUNT objects from FROM to TO. The source and destination do
1475 # if defined (__GNUC__) && 1 < __GNUC__
1476 # define YYCOPY(To, From, Count) \
1477 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1479 # define YYCOPY(To, From, Count) \
1483 for (yyi = 0; yyi < (Count); yyi++) \
1484 (To)[yyi] = (From)[yyi]; \
1490 /* Relocate STACK from its old location to the new one. The
1491 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1492 elements in the stack, and YYPTR gives the new location of the
1493 stack. Advance YYPTR to a properly aligned location for the next
1495 # define YYSTACK_RELOCATE(Stack) \
1498 YYSIZE_T yynewbytes; \
1499 YYCOPY (&yyptr->Stack, Stack, yysize); \
1500 Stack = &yyptr->Stack; \
1501 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1502 yyptr += yynewbytes / sizeof (*yyptr); \
1508 #if defined (__STDC__) || defined (__cplusplus)
1509 typedef signed char yysigned_char;
1511 typedef short int yysigned_char;
1514 /* YYFINAL -- State number of the termination state. */
1516 /* YYLAST -- Last index in YYTABLE. */
1519 /* YYNTOKENS -- Number of terminals. */
1520 #define YYNTOKENS 152
1521 /* YYNNTS -- Number of nonterminals. */
1523 /* YYNRULES -- Number of rules. */
1524 #define YYNRULES 298
1525 /* YYNRULES -- Number of states. */
1526 #define YYNSTATES 582
1528 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1529 #define YYUNDEFTOK 2
1530 #define YYMAXUTOK 392
1532 #define YYTRANSLATE(YYX) \
1533 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1535 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1536 static const unsigned char yytranslate[] =
1538 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1542 142, 143, 140, 2, 139, 2, 2, 2, 2, 2,
1543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1544 147, 138, 148, 2, 2, 2, 2, 2, 2, 2,
1545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1547 2, 144, 141, 146, 2, 2, 2, 2, 2, 151,
1548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1550 145, 2, 2, 149, 2, 150, 2, 2, 2, 2,
1551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1563 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1564 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1565 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1566 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1567 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1568 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1569 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1570 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1571 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1572 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1573 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1574 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1575 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1576 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1581 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1583 static const unsigned short int yyprhs[] =
1585 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1586 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1587 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1588 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1589 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1590 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1591 119, 121, 123, 124, 127, 128, 130, 132, 134, 135,
1592 138, 140, 142, 144, 146, 148, 150, 152, 154, 155,
1593 157, 159, 161, 162, 164, 166, 167, 169, 171, 173,
1594 175, 176, 178, 180, 181, 183, 185, 187, 189, 191,
1595 194, 196, 198, 200, 202, 203, 206, 208, 210, 212,
1596 213, 216, 217, 220, 221, 225, 228, 229, 231, 232,
1597 236, 238, 241, 243, 245, 247, 249, 251, 253, 256,
1598 258, 261, 267, 273, 279, 285, 289, 292, 298, 303,
1599 306, 308, 310, 312, 316, 318, 322, 324, 325, 327,
1600 331, 336, 340, 344, 349, 354, 358, 365, 371, 374,
1601 377, 380, 383, 386, 389, 392, 395, 398, 401, 404,
1602 407, 414, 420, 429, 436, 443, 451, 459, 466, 475,
1603 484, 488, 490, 492, 494, 496, 497, 500, 507, 509,
1604 510, 512, 515, 516, 520, 521, 525, 529, 533, 537,
1605 538, 546, 547, 556, 557, 566, 572, 575, 579, 581,
1606 585, 589, 593, 597, 599, 600, 606, 610, 612, 616,
1607 618, 619, 629, 631, 633, 638, 640, 642, 645, 649,
1608 650, 652, 654, 656, 658, 660, 662, 664, 666, 668,
1609 672, 674, 680, 682, 684, 686, 688, 690, 692, 695,
1610 698, 701, 705, 708, 709, 711, 714, 717, 721, 731,
1611 741, 750, 765, 767, 769, 776, 782, 785, 792, 800,
1612 804, 810, 811, 812, 816, 819, 821, 827, 833, 840,
1613 847, 852, 859, 864, 869, 876, 883, 886, 895, 897,
1614 899, 900, 904, 911, 915, 922, 925, 931, 939
1617 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1618 static const short int yyrhs[] =
1620 196, 0, -1, 70, -1, 71, -1, 72, -1, 73,
1621 -1, 74, -1, 75, -1, 76, -1, 77, -1, 78,
1622 -1, 82, -1, 83, -1, 84, -1, 79, -1, 80,
1623 -1, 81, -1, 113, -1, 114, -1, 115, -1, 116,
1624 -1, 117, -1, 118, -1, 119, -1, 120, -1, 121,
1625 -1, 122, -1, 123, -1, 124, -1, 87, -1, 88,
1626 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1627 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1628 -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
1629 -1, 104, -1, 105, -1, 106, -1, 93, -1, 94,
1630 -1, 95, -1, 96, -1, 23, -1, 24, -1, 11,
1631 -1, 12, -1, 13, -1, 16, -1, 19, -1, 21,
1632 -1, 160, -1, -1, 160, 138, -1, -1, 17, -1,
1633 20, -1, 165, -1, -1, 163, 138, -1, 39, -1,
1634 41, -1, 40, -1, 42, -1, 44, -1, 43, -1,
1635 45, -1, 47, -1, -1, 135, -1, 136, -1, 137,
1636 -1, -1, 43, -1, 45, -1, -1, 39, -1, 40,
1637 -1, 41, -1, 44, -1, -1, 41, -1, 39, -1,
1638 -1, 58, -1, 59, -1, 60, -1, 61, -1, 62,
1639 -1, 57, 4, -1, 114, -1, 115, -1, 132, -1,
1640 133, -1, -1, 174, 173, -1, 131, -1, 134, -1,
1641 173, -1, -1, 176, 175, -1, -1, 50, 4, -1,
1642 -1, 139, 50, 4, -1, 31, 19, -1, -1, 179,
1643 -1, -1, 139, 182, 181, -1, 179, -1, 50, 4,
1644 -1, 11, -1, 12, -1, 13, -1, 14, -1, 46,
1645 -1, 183, -1, 184, 140, -1, 218, -1, 141, 4,
1646 -1, 184, 142, 188, 143, 176, -1, 10, 142, 188,
1647 143, 176, -1, 144, 4, 145, 184, 146, -1, 147,
1648 4, 145, 184, 148, -1, 149, 189, 150, -1, 149,
1649 150, -1, 147, 149, 189, 150, 148, -1, 147, 149,
1650 150, 148, -1, 184, 174, -1, 184, -1, 10, -1,
1651 185, -1, 187, 139, 185, -1, 187, -1, 187, 139,
1652 36, -1, 36, -1, -1, 184, -1, 189, 139, 184,
1653 -1, 184, 144, 192, 146, -1, 184, 144, 146, -1,
1654 184, 151, 19, -1, 184, 147, 192, 148, -1, 184,
1655 149, 192, 150, -1, 184, 149, 150, -1, 184, 147,
1656 149, 192, 150, 148, -1, 184, 147, 149, 150, 148,
1657 -1, 184, 37, -1, 184, 38, -1, 184, 218, -1,
1658 184, 191, -1, 184, 22, -1, 158, 3, -1, 158,
1659 5, -1, 158, 4, -1, 158, 6, -1, 11, 23,
1660 -1, 11, 24, -1, 159, 9, -1, 155, 142, 190,
1661 35, 184, 143, -1, 112, 142, 190, 229, 143, -1,
1662 126, 142, 190, 139, 190, 139, 190, 143, -1, 153,
1663 142, 190, 139, 190, 143, -1, 154, 142, 190, 139,
1664 190, 143, -1, 85, 156, 142, 190, 139, 190, 143,
1665 -1, 86, 157, 142, 190, 139, 190, 143, -1, 128,
1666 142, 190, 139, 190, 143, -1, 129, 142, 190, 139,
1667 190, 139, 190, 143, -1, 130, 142, 190, 139, 190,
1668 139, 190, 143, -1, 192, 139, 190, -1, 190, -1,
1669 29, -1, 30, -1, 34, -1, -1, 186, 218, -1,
1670 118, 142, 195, 35, 184, 143, -1, 197, -1, -1,
1671 198, -1, 197, 198, -1, -1, 28, 199, 214, -1,
1672 -1, 27, 200, 215, -1, 55, 54, 204, -1, 162,
1673 15, 184, -1, 162, 15, 10, -1, -1, 164, 168,
1674 194, 193, 190, 201, 181, -1, -1, 164, 166, 168,
1675 194, 193, 190, 202, 181, -1, -1, 164, 167, 168,
1676 194, 193, 184, 203, 181, -1, 164, 168, 32, 171,
1677 195, -1, 48, 205, -1, 51, 138, 206, -1, 19,
1678 -1, 49, 138, 19, -1, 63, 138, 19, -1, 144,
1679 207, 146, -1, 207, 139, 19, -1, 19, -1, -1,
1680 208, 139, 184, 174, 161, -1, 184, 174, 161, -1,
1681 208, -1, 208, 139, 36, -1, 36, -1, -1, 172,
1682 186, 163, 142, 209, 143, 176, 180, 177, -1, 25,
1683 -1, 149, -1, 170, 168, 210, 211, -1, 26, -1,
1684 150, -1, 221, 213, -1, 169, 168, 210, -1, -1,
1685 56, -1, 3, -1, 4, -1, 9, -1, 23, -1,
1686 24, -1, 37, -1, 38, -1, 22, -1, 147, 192,
1687 148, -1, 191, -1, 54, 216, 19, 139, 19, -1,
1688 7, -1, 8, -1, 160, -1, 163, -1, 218, -1,
1689 217, -1, 184, 219, -1, 221, 222, -1, 212, 222,
1690 -1, 223, 162, 224, -1, 223, 226, -1, -1, 18,
1691 -1, 64, 220, -1, 64, 10, -1, 65, 14, 219,
1692 -1, 65, 11, 219, 139, 14, 219, 139, 14, 219,
1693 -1, 66, 158, 219, 139, 14, 219, 144, 225, 146,
1694 -1, 66, 158, 219, 139, 14, 219, 144, 146, -1,
1695 67, 172, 186, 219, 142, 228, 143, 176, 35, 14,
1696 219, 68, 14, 219, -1, 68, -1, 69, -1, 225,
1697 158, 217, 139, 14, 219, -1, 158, 217, 139, 14,
1698 219, -1, 162, 231, -1, 184, 144, 219, 139, 219,
1699 146, -1, 227, 139, 144, 219, 139, 219, 146, -1,
1700 184, 219, 174, -1, 228, 139, 184, 219, 174, -1,
1701 -1, -1, 229, 139, 220, -1, 53, 52, -1, 52,
1702 -1, 153, 184, 219, 139, 219, -1, 154, 184, 219,
1703 139, 219, -1, 85, 156, 184, 219, 139, 219, -1,
1704 86, 157, 184, 219, 139, 219, -1, 155, 220, 35,
1705 184, -1, 126, 220, 139, 220, 139, 220, -1, 127,
1706 220, 139, 184, -1, 128, 220, 139, 220, -1, 129,
1707 220, 139, 220, 139, 220, -1, 130, 220, 139, 220,
1708 139, 220, -1, 125, 227, -1, 230, 172, 186, 219,
1709 142, 228, 143, 176, -1, 233, -1, 33, -1, -1,
1710 107, 184, 178, -1, 107, 184, 139, 11, 219, 178,
1711 -1, 108, 184, 178, -1, 108, 184, 139, 11, 219,
1712 178, -1, 109, 220, -1, 232, 110, 184, 219, 178,
1713 -1, 232, 111, 220, 139, 184, 219, 178, -1, 112,
1717 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1718 static const unsigned short int yyrline[] =
1720 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
1721 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
1722 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118,
1723 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126,
1724 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131,
1725 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1142, 1142,
1726 1142, 1143, 1143, 1147, 1151, 1156, 1156, 1158, 1159, 1164,
1727 1170, 1171, 1172, 1173, 1174, 1178, 1179, 1180, 1184, 1185,
1728 1186, 1187, 1191, 1192, 1193, 1197, 1198, 1199, 1200, 1201,
1729 1205, 1206, 1207, 1210, 1211, 1212, 1213, 1214, 1215, 1216,
1730 1223, 1224, 1225, 1226, 1229, 1230, 1235, 1236, 1237, 1240,
1731 1241, 1248, 1249, 1255, 1256, 1264, 1272, 1273, 1278, 1279,
1732 1280, 1285, 1298, 1298, 1298, 1298, 1301, 1305, 1309, 1316,
1733 1321, 1329, 1359, 1390, 1395, 1407, 1417, 1421, 1431, 1438,
1734 1445, 1452, 1457, 1462, 1469, 1470, 1477, 1484, 1492, 1498,
1735 1510, 1538, 1554, 1583, 1611, 1637, 1657, 1683, 1703, 1715,
1736 1722, 1788, 1798, 1808, 1814, 1824, 1830, 1840, 1845, 1850,
1737 1858, 1870, 1892, 1900, 1906, 1917, 1922, 1927, 1933, 1939,
1738 1948, 1952, 1960, 1960, 1963, 1963, 1966, 1977, 1998, 2003,
1739 2011, 2012, 2016, 2016, 2020, 2020, 2023, 2026, 2050, 2061,
1740 2061, 2072, 2071, 2081, 2080, 2091, 2106, 2109, 2115, 2128,
1741 2132, 2137, 2139, 2144, 2149, 2158, 2168, 2179, 2183, 2192,
1742 2201, 2206, 2328, 2328, 2330, 2339, 2339, 2341, 2346, 2358,
1743 2362, 2367, 2371, 2375, 2379, 2383, 2387, 2391, 2395, 2399,
1744 2424, 2428, 2442, 2446, 2450, 2454, 2460, 2460, 2466, 2475,
1745 2479, 2488, 2497, 2506, 2510, 2515, 2519, 2523, 2528, 2538,
1746 2557, 2566, 2646, 2650, 2657, 2668, 2681, 2691, 2702, 2712,
1747 2721, 2730, 2733, 2734, 2741, 2745, 2750, 2771, 2788, 2802,
1748 2816, 2828, 2836, 2843, 2849, 2855, 2861, 2876, 2961, 2966,
1749 2970, 2977, 2984, 2992, 2999, 3007, 3015, 3029, 3046
1753 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1754 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1755 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1756 static const char *const yytname[] =
1758 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1759 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1760 "FLOAT", "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1761 "STRINGCONSTANT", "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT",
1762 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1763 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "ALIAS",
1764 "VOLATILE", "THREAD_LOCAL", "TO", "DOTDOTDOT", "NULL_TOK", "UNDEF",
1765 "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT",
1766 "EXTERN_WEAK", "OPAQUE", "EXTERNAL", "TARGET", "TRIPLE", "ALIGN",
1767 "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK",
1768 "CCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1769 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1770 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1771 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1772 "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT",
1773 "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO",
1774 "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1775 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1776 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1777 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1778 "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "NOUNWIND", "DEFAULT",
1779 "HIDDEN", "PROTECTED", "'='", "','", "'*'", "'\\\\'", "'('", "')'",
1780 "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept",
1781 "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", "FPredicates",
1782 "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign",
1783 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1784 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1785 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1786 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign",
1787 "SectionString", "OptSection", "GlobalVarAttributes",
1788 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1789 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1790 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1791 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1792 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1793 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1794 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1795 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1796 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1797 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1798 "OptVolatile", "MemoryInst", 0
1803 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1805 static const unsigned short int yytoknum[] =
1807 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1808 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1809 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1810 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1811 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1812 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1813 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1814 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1815 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1816 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1817 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1818 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1819 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1820 385, 386, 387, 388, 389, 390, 391, 392, 61, 44,
1821 42, 92, 40, 41, 91, 120, 93, 60, 62, 123,
1826 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1827 static const unsigned char yyr1[] =
1829 0, 152, 153, 153, 153, 153, 153, 153, 153, 153,
1830 153, 154, 154, 154, 154, 154, 154, 155, 155, 155,
1831 155, 155, 155, 155, 155, 155, 155, 155, 155, 156,
1832 156, 156, 156, 156, 156, 156, 156, 156, 156, 157,
1833 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1834 157, 157, 157, 157, 157, 158, 159, 159, 160, 160,
1835 160, 161, 161, 162, 162, 163, 163, 164, 164, 165,
1836 166, 166, 166, 166, 166, 167, 167, 167, 168, 168,
1837 168, 168, 169, 169, 169, 170, 170, 170, 170, 170,
1838 171, 171, 171, 172, 172, 172, 172, 172, 172, 172,
1839 173, 173, 173, 173, 174, 174, 175, 175, 175, 176,
1840 176, 177, 177, 178, 178, 179, 180, 180, 181, 181,
1841 182, 182, 183, 183, 183, 183, 184, 184, 184, 184,
1842 184, 184, 184, 184, 184, 184, 184, 184, 184, 185,
1843 186, 186, 187, 187, 188, 188, 188, 188, 189, 189,
1844 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
1845 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
1846 191, 191, 191, 191, 191, 191, 191, 191, 191, 191,
1847 192, 192, 193, 193, 194, 194, 195, 195, 196, 196,
1848 197, 197, 199, 198, 200, 198, 198, 198, 198, 201,
1849 198, 202, 198, 203, 198, 198, 198, 198, 204, 205,
1850 205, 206, 207, 207, 207, 208, 208, 209, 209, 209,
1851 209, 210, 211, 211, 212, 213, 213, 214, 215, 216,
1852 216, 217, 217, 217, 217, 217, 217, 217, 217, 217,
1853 217, 217, 218, 218, 218, 218, 219, 219, 220, 221,
1854 221, 222, 223, 223, 223, 224, 224, 224, 224, 224,
1855 224, 224, 224, 224, 225, 225, 226, 227, 227, 228,
1856 228, 228, 229, 229, 230, 230, 231, 231, 231, 231,
1857 231, 231, 231, 231, 231, 231, 231, 231, 231, 232,
1858 232, 233, 233, 233, 233, 233, 233, 233, 233
1861 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1862 static const unsigned char yyr2[] =
1864 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1865 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1866 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1867 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1868 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1869 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1870 1, 1, 0, 2, 0, 1, 1, 1, 0, 2,
1871 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
1872 1, 1, 0, 1, 1, 0, 1, 1, 1, 1,
1873 0, 1, 1, 0, 1, 1, 1, 1, 1, 2,
1874 1, 1, 1, 1, 0, 2, 1, 1, 1, 0,
1875 2, 0, 2, 0, 3, 2, 0, 1, 0, 3,
1876 1, 2, 1, 1, 1, 1, 1, 1, 2, 1,
1877 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1878 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1879 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1880 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1881 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1882 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1883 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1884 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1885 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1886 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1887 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1888 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1889 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1890 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1891 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1892 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1893 0, 3, 6, 3, 6, 2, 5, 7, 4
1896 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1897 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1898 means the default is an error. */
1899 static const unsigned short int yydefact[] =
1901 68, 58, 65, 59, 66, 60, 194, 192, 0, 0,
1902 0, 0, 0, 0, 78, 67, 0, 68, 190, 82,
1903 85, 0, 0, 206, 0, 0, 63, 0, 69, 70,
1904 72, 71, 73, 75, 74, 76, 77, 79, 80, 81,
1905 78, 78, 185, 1, 191, 83, 84, 78, 195, 86,
1906 87, 88, 89, 78, 253, 193, 253, 0, 0, 214,
1907 207, 208, 196, 242, 243, 198, 122, 123, 124, 125,
1908 126, 0, 0, 0, 0, 244, 245, 127, 197, 129,
1909 185, 185, 90, 184, 0, 93, 93, 254, 250, 64,
1910 225, 226, 227, 249, 209, 210, 213, 0, 147, 130,
1911 0, 0, 0, 0, 136, 148, 0, 128, 147, 0,
1912 0, 92, 91, 0, 182, 183, 0, 0, 94, 95,
1913 96, 97, 98, 0, 228, 0, 290, 252, 0, 211,
1914 146, 104, 142, 144, 0, 0, 0, 0, 0, 0,
1915 135, 0, 0, 0, 141, 0, 140, 0, 205, 122,
1916 123, 124, 0, 0, 0, 199, 99, 0, 222, 223,
1917 224, 289, 275, 0, 0, 0, 0, 93, 262, 263,
1918 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
1919 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
1920 0, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1921 26, 27, 28, 0, 0, 0, 0, 0, 0, 0,
1922 0, 0, 251, 93, 266, 0, 288, 212, 139, 0,
1923 109, 0, 0, 138, 0, 149, 109, 201, 203, 0,
1924 186, 167, 168, 163, 165, 164, 166, 169, 162, 158,
1925 159, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1926 0, 0, 0, 0, 0, 161, 160, 118, 0, 274,
1927 256, 0, 255, 0, 0, 55, 0, 0, 29, 30,
1928 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
1929 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
1930 44, 45, 46, 47, 48, 0, 113, 113, 295, 0,
1931 0, 286, 0, 0, 0, 0, 0, 0, 0, 0,
1932 0, 0, 0, 100, 101, 102, 103, 105, 145, 143,
1933 132, 133, 134, 137, 131, 118, 118, 0, 0, 0,
1934 0, 0, 0, 0, 0, 151, 181, 0, 0, 0,
1935 155, 0, 152, 0, 0, 0, 0, 200, 220, 231,
1936 232, 233, 238, 234, 235, 236, 237, 229, 0, 240,
1937 247, 246, 248, 0, 257, 0, 0, 0, 0, 0,
1938 291, 0, 293, 272, 0, 0, 0, 0, 0, 0,
1939 0, 0, 0, 0, 0, 0, 0, 106, 107, 108,
1940 110, 202, 204, 0, 0, 0, 272, 0, 0, 0,
1941 0, 0, 150, 136, 148, 0, 153, 154, 0, 0,
1942 0, 0, 0, 120, 118, 219, 104, 217, 0, 230,
1943 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1944 298, 0, 0, 0, 282, 283, 0, 0, 0, 0,
1945 280, 0, 113, 0, 0, 0, 0, 0, 0, 0,
1946 0, 0, 180, 157, 0, 0, 0, 0, 115, 121,
1947 119, 62, 0, 109, 0, 239, 0, 0, 271, 0,
1948 0, 113, 114, 113, 0, 0, 0, 0, 0, 0,
1949 276, 277, 271, 0, 296, 0, 187, 0, 0, 171,
1950 0, 0, 0, 0, 156, 0, 0, 0, 61, 216,
1951 218, 104, 116, 0, 0, 0, 0, 0, 278, 279,
1952 292, 294, 273, 0, 0, 281, 284, 285, 0, 113,
1953 0, 0, 0, 177, 0, 0, 173, 174, 170, 62,
1954 117, 111, 241, 0, 0, 104, 0, 109, 267, 0,
1955 109, 297, 175, 176, 0, 0, 0, 215, 0, 221,
1956 0, 260, 0, 0, 269, 0, 0, 268, 287, 172,
1957 178, 179, 112, 258, 0, 259, 0, 104, 0, 0,
1958 0, 270, 0, 0, 0, 0, 265, 0, 0, 264,
1962 /* YYDEFGOTO[NTERM-NUM]. */
1963 static const short int yydefgoto[] =
1965 -1, 252, 253, 254, 278, 295, 152, 153, 75, 499,
1966 12, 76, 14, 15, 40, 41, 42, 47, 53, 113,
1967 123, 317, 218, 390, 320, 549, 370, 413, 531, 347,
1968 414, 77, 154, 132, 147, 133, 134, 106, 336, 359,
1969 337, 116, 84, 148, 16, 17, 18, 20, 19, 257,
1970 325, 326, 62, 23, 60, 97, 417, 418, 124, 160,
1971 54, 92, 55, 48, 420, 360, 79, 362, 262, 56,
1972 88, 89, 212, 553, 127, 301, 507, 430, 213, 214,
1976 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1978 #define YYPACT_NINF -509
1979 static const short int yypact[] =
1981 47, -509, -509, -509, -509, -509, -509, -509, -8, -120,
1982 -11, -110, 58, -77, 432, -509, 79, 240, -509, 204,
1983 64, -50, -32, -509, -17, 114, -509, 1280, -509, -509,
1984 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1985 102, 102, 286, -509, -509, -509, -509, 102, -509, -509,
1986 -509, -509, -509, 102, 122, -509, 1, 130, 141, 157,
1987 -509, -509, -509, -509, -509, 62, -509, -509, -509, -509,
1988 -509, 191, 239, 5, 365, -509, -509, -509, 181, -509,
1989 196, 196, 292, -509, 170, 220, 220, -509, -509, 118,
1990 -509, -509, -509, -509, -509, -509, -509, -93, 1082, -509,
1991 101, 106, 566, 62, -509, 181, -94, -509, 1082, 170,
1992 170, -509, -509, 1122, -509, -509, 1327, 250, -509, -509,
1993 -509, -509, -509, 1342, -509, -14, 1480, -509, 251, -509,
1994 -509, 181, -509, 119, 140, 1379, 1379, 125, -58, 1379,
1995 -509, 147, 1327, 1379, 62, 151, 181, 255, -509, 28,
1996 302, 308, 219, 315, 863, -509, -509, 149, -509, -509,
1997 -509, -509, -509, 273, 1394, 222, 317, 220, -509, -509,
1998 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1999 -509, -509, -509, -509, -509, 395, 443, 1379, 1379, 1379,
2000 1379, -509, -509, -509, -509, -509, -509, -509, -509, -509,
2001 -509, -509, -509, 1379, 1379, 1379, 1379, 1379, 1379, 1379,
2002 1379, 1379, -509, 220, -509, 155, -509, -509, 14, 1137,
2003 -509, -10, -41, -509, 184, 181, -509, -509, 181, 1122,
2004 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
2005 -509, 395, 443, 192, 194, 195, 197, 198, 1168, 1431,
2006 820, 319, 199, 200, 201, -509, -509, 205, 206, -509,
2007 62, 610, -509, 739, 739, -509, 739, 1342, -509, -509,
2008 -509, -509, -509, -509, -509, -509, -509, -509, 1379, -509,
2009 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
2010 -509, -509, -509, -509, -509, 1379, 2, 66, -509, 610,
2011 46, 207, 208, 210, 216, 217, 224, 610, 610, 323,
2012 1342, 1379, 1379, -509, -509, -509, -509, -509, -509, -509,
2013 41, -509, -509, -509, 41, 205, 205, 326, 227, 238,
2014 1327, 1327, 1327, 1327, 1327, -509, -509, -46, 904, -99,
2015 -509, -56, -509, 1327, 1327, 1327, 19, -509, 1184, -509,
2016 -509, -509, -509, -509, -509, -509, -509, 312, 1327, -509,
2017 -509, -509, -509, 244, -509, 248, 739, 610, 610, 10,
2018 -509, 15, -509, -509, 739, 246, 1379, 1379, 1379, 1379,
2019 1379, 249, 252, 1379, 739, 610, 253, -509, -509, -509,
2020 -509, -509, -509, 1379, 1327, 1327, -509, 254, 257, 258,
2021 259, 1327, -509, 260, 863, -54, -509, -509, 261, 262,
2022 359, 380, 398, -509, 205, -509, 181, 266, 263, -509,
2023 388, -68, 399, 400, 267, 277, 283, 739, 408, 739,
2024 284, 285, 739, 288, 181, -509, 289, 290, 739, 739,
2025 181, 293, 291, 1379, 89, 295, 299, -24, 1327, 1327,
2026 1327, 1327, -509, -509, 296, 1327, 1327, 1379, -509, -509,
2027 -509, 38, 1231, -509, 300, -509, 739, 739, 1379, 739,
2028 739, 291, -509, 291, 1379, 739, 304, 1379, 1379, 1379,
2029 -509, -509, 1379, 391, -509, 610, -509, 1327, 1327, -509,
2030 306, 303, 310, 311, -509, 316, 322, 154, -509, -509,
2031 -509, 181, 83, 428, 321, 324, 610, -23, -509, -509,
2032 -509, -509, -509, 309, 739, -509, -509, -509, 53, 291,
2033 335, 350, 1327, -509, 1327, 1327, -509, -509, -509, 38,
2034 -509, 404, -509, 455, -1, -509, 1379, -509, -509, 351,
2035 -509, -509, -509, -509, 353, 355, 356, -509, 496, -509,
2036 739, -509, 993, 4, 14, 610, 87, -509, 41, -509,
2037 -509, -509, -509, -509, 362, -509, 993, -509, 488, 489,
2038 366, 14, 739, 739, 490, 439, -509, 739, 494, -509,
2042 /* YYPGOTO[NTERM-NUM]. */
2043 static const short int yypgoto[] =
2045 -509, 385, 387, 390, 276, 278, -164, -509, 0, -7,
2046 429, 8, -509, -509, -509, -509, 37, -509, -509, -509,
2047 -143, -308, -410, -509, -221, -509, -284, 17, -509, -296,
2048 -509, -509, -26, 305, -119, -509, 413, 424, -30, -151,
2049 -227, 103, 226, 298, -509, -509, 513, -509, -509, -509,
2050 -509, -509, -509, -509, -509, -509, -509, -509, 445, -509,
2051 -509, -509, -509, -509, -509, -508, -140, 96, -169, -509,
2052 476, -509, -509, -509, -509, -509, 51, 156, -509, -509,
2056 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2057 positive, shift that token. If negative, reduce the rule which
2058 number is the opposite. If zero, do what YYDEFACT says.
2059 If YYTABLE_NINF, syntax error. */
2060 #define YYTABLE_NINF -190
2061 static const short int yytable[] =
2063 11, 78, 266, 255, 157, 324, 461, 230, 13, 101,
2064 265, 158, 389, 372, 256, 265, 389, 11, 24, 87,
2065 298, 427, 339, 341, 267, 13, 429, 90, 26, 391,
2066 392, -55, -55, -55, -55, 302, 303, 304, 305, 306,
2067 401, 21, 309, 25, 564, 139, 128, -189, 105, 406,
2068 411, 231, 232, 129, 1, 22, 140, 3, 570, 5,
2069 428, 28, -64, 1, 2, 428, 3, 4, 5, 412,
2070 310, 401, 131, 27, 6, 7, 105, 80, 81, 43,
2071 465, 139, 131, 401, 85, 401, 155, 146, 57, 11,
2072 86, 529, 224, 401, 407, 8, 454, 146, 9, 107,
2073 402, 108, 10, 49, 50, 51, 58, 322, 52, 221,
2074 222, 405, 227, 225, 411, 474, 536, 228, 460, 489,
2075 537, 361, 568, 361, 361, 554, 361, 59, 313, 314,
2076 107, 421, 108, 61, 1, 159, 321, 3, 261, 5,
2077 87, 369, 107, 386, 108, 551, 315, 316, 366, 94,
2078 565, 91, 313, 314, 102, 313, 314, 571, 484, 361,
2079 95, 296, 297, 261, 299, 258, 2, 361, 361, 4,
2080 315, 316, 387, 315, 316, 388, 96, 300, 261, 261,
2081 261, 261, 261, 307, 308, 261, 107, 510, 108, 511,
2082 374, 384, 536, 131, 389, 99, 540, 313, 314, 114,
2083 115, 313, 314, 146, 98, 371, 107, 433, 108, 435,
2084 436, 437, 142, 143, 387, 315, 316, 388, 387, 315,
2085 316, 388, 233, 234, 235, 236, 361, 361, 361, 107,
2086 83, 108, 486, 263, 361, 541, 264, 37, 38, 39,
2087 -188, 146, 502, 100, 361, 361, 135, 45, 389, 46,
2088 389, 136, 367, 255, 156, -64, 1, 2, 219, 3,
2089 4, 5, 63, 64, 256, 311, 312, 6, 7, 368,
2090 217, 1, 2, 223, 3, 4, 5, 117, 118, 119,
2091 120, 121, 122, 220, 146, 385, 261, 361, 8, 361,
2092 226, 9, 361, 229, 107, 10, 108, 528, 361, 361,
2093 396, 397, 398, 399, 400, 512, 109, 110, 515, 516,
2094 517, -56, 404, 408, 409, 410, 556, -57, 82, 558,
2095 83, 107, 416, 108, 237, 259, 361, 361, 265, 361,
2096 361, 111, 323, 112, 330, 361, 331, 332, 342, 333,
2097 334, 343, 344, 345, 346, 361, 375, 376, 348, 377,
2098 261, 434, 261, 261, 261, 378, 379, 440, 383, 363,
2099 364, 393, 365, 380, 445, 446, 361, 444, 419, 394,
2100 552, 452, 63, 64, 361, 103, 66, 67, 68, 69,
2101 395, 1, 2, 422, 3, 4, 5, 423, 438, 566,
2102 432, 439, 443, 448, 457, 373, 449, 450, 451, 458,
2103 455, 456, 459, 381, 382, 462, 463, 464, 453, 468,
2104 361, 70, 472, 466, 467, 361, 469, 485, 490, 491,
2105 492, 493, 470, 474, 475, 495, 496, 477, 478, 479,
2106 483, 497, 361, 361, 487, 482, 501, 361, 488, 503,
2107 361, 428, 506, 514, 494, 522, 523, 532, 261, 524,
2108 525, 261, 261, 261, 548, 538, 506, 520, 521, 526,
2109 533, 498, 424, 425, 426, 527, 279, 280, 534, 550,
2110 431, 29, 30, 31, 32, 33, 34, 35, 542, 36,
2111 441, 442, 268, 269, 270, 271, 272, 273, 274, 275,
2112 276, 277, 544, 543, 545, 546, 559, 557, 560, 561,
2113 562, 569, 572, 573, 577, 574, 71, 578, 580, 72,
2114 555, 209, 73, 210, 74, 104, 211, 328, 126, 530,
2115 329, 141, 547, 471, 319, 473, 138, 327, 476, 498,
2116 44, 125, 93, 518, 480, 481, 281, 282, 283, 284,
2117 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
2118 0, 0, 447, 0, 0, 0, 0, 0, 0, 0,
2119 0, 0, 504, 505, 0, 508, 509, 37, 38, 39,
2120 0, 513, 0, 63, 64, 0, 103, 66, 67, 68,
2121 69, 519, 1, 2, 0, 3, 4, 5, 0, 0,
2122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2123 0, 0, 535, 0, 0, 0, 0, 0, 0, 0,
2124 539, 0, 70, 349, 350, 0, 0, 63, 64, 351,
2125 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2126 4, 5, 352, 353, 354, 0, 0, 0, 0, 0,
2127 0, 0, 0, 0, 0, 0, 563, 355, 356, 0,
2128 0, 567, 0, 0, 0, 0, 0, 0, 0, 0,
2129 0, 0, 0, 0, 357, 0, 0, 0, 575, 576,
2130 0, 0, 0, 579, 0, 0, 581, 0, 0, 0,
2131 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
2132 180, 181, 182, 183, 184, 241, 242, 0, 0, 0,
2133 0, 0, 0, 0, 0, 0, 0, 71, 0, 0,
2134 72, 0, 0, 73, 0, 74, 137, 0, 0, 0,
2135 0, 0, 243, 191, 192, 193, 194, 195, 196, 197,
2136 198, 199, 200, 201, 202, 0, 244, 0, 245, 246,
2137 247, 0, 349, 350, 0, 0, 63, 64, 351, 0,
2138 107, 0, 108, 0, 0, 1, 2, 358, 3, 4,
2139 5, 352, 353, 354, 0, 0, 0, 0, 0, 0,
2140 0, 0, 0, 0, 0, 0, 355, 356, 0, 0,
2141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2142 0, 0, 0, 357, 0, 0, 0, 0, 0, 0,
2143 0, 0, 0, 0, 0, 0, 0, 0, 0, 170,
2144 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
2145 181, 182, 183, 184, 241, 242, 0, 63, 64, 0,
2146 103, 149, 150, 151, 69, 0, 1, 2, 0, 3,
2147 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2148 0, 243, 191, 192, 193, 194, 195, 196, 197, 198,
2149 199, 200, 201, 202, 0, 244, 70, 245, 246, 247,
2150 63, 64, 0, 0, 0, 0, 0, 0, 0, 1,
2151 2, 0, 3, 4, 5, 238, 358, 0, 0, 0,
2152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2153 239, 240, 0, 0, 0, 0, 0, 0, 0, 0,
2154 0, 63, 64, 0, 103, 149, 150, 151, 69, 0,
2155 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2156 0, 0, 0, 170, 171, 172, 173, 174, 175, 176,
2157 177, 178, 179, 180, 181, 182, 183, 184, 241, 242,
2158 70, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2159 0, 71, 0, 0, 72, 0, 0, 73, 0, 74,
2160 340, 0, 0, 0, 0, 243, 191, 192, 193, 194,
2161 195, 196, 197, 198, 199, 200, 201, 202, 0, 244,
2162 0, 245, 246, 247, 0, 0, 349, 350, 0, 0,
2163 0, 0, 351, 107, 0, 108, 0, 248, 0, 0,
2164 249, 0, 250, 0, 251, 352, 353, 354, 0, 0,
2165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2166 355, 356, 0, 0, 0, 0, 0, 0, 0, 0,
2167 0, 0, 0, 0, 0, 71, 0, 357, 72, 0,
2168 0, 73, 0, 74, 403, 0, 0, 0, 0, 0,
2169 0, 0, 0, 170, 171, 172, 173, 174, 175, 176,
2170 177, 178, 179, 180, 181, 182, 183, 184, 241, 242,
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
2172 64, 0, 103, 66, 67, 68, 69, 0, 1, 2,
2173 0, 3, 4, 5, 0, 243, 191, 192, 193, 194,
2174 195, 196, 197, 198, 199, 200, 201, 202, 130, 244,
2175 0, 245, 246, 247, 0, 0, 0, 0, 70, 63,
2176 64, 0, 144, 66, 67, 68, 69, 0, 1, 2,
2177 358, 3, 4, 5, 63, 64, 0, 103, 66, 67,
2178 68, 69, 0, 1, 2, 0, 3, 4, 5, 0,
2179 0, 0, 0, 0, 0, 0, 0, 0, 70, 0,
2180 0, 0, 0, 318, 0, 63, 64, 0, 103, 149,
2181 150, 151, 69, 70, 1, 2, 0, 3, 4, 5,
2182 0, 63, 64, 0, 103, 66, 67, 68, 69, 0,
2183 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2184 0, 0, 0, 0, 70, 0, 0, 0, 0, 0,
2185 415, 0, 0, 71, 0, 0, 72, 0, 0, 73,
2186 70, 74, 0, 0, 0, 0, 0, 0, 63, 64,
2187 145, 103, 66, 67, 68, 69, 0, 1, 2, 0,
2188 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2189 0, 0, 0, 71, 0, 0, 72, 500, 0, 73,
2190 0, 74, 0, 0, 0, 0, 0, 70, 71, 0,
2191 0, 72, 0, 0, 73, 0, 74, 63, 64, 0,
2192 65, 66, 67, 68, 69, 0, 1, 2, 0, 3,
2193 4, 5, 0, 0, 0, 0, 0, 0, 0, 71,
2194 0, 0, 72, 0, 335, 73, 0, 74, 0, 0,
2195 0, 0, 0, 0, 0, 71, 70, 0, 72, 0,
2196 0, 73, 0, 74, 63, 64, 0, 103, 149, 150,
2197 151, 69, 0, 1, 2, 0, 3, 4, 5, 63,
2198 64, 0, 144, 66, 67, 68, 69, 0, 1, 2,
2199 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2200 0, 0, 71, 70, 0, 72, 0, 0, 73, 0,
2201 74, 0, 0, 0, 0, 0, 63, 64, 70, 103,
2202 66, 67, 68, 69, 0, 1, 2, 0, 3, 4,
2203 5, 63, 64, 0, 260, 66, 67, 68, 69, 0,
2204 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2205 0, 71, 0, 0, 72, 70, 0, 73, 0, 74,
2206 0, 0, 0, 0, 0, 0, 0, 0, 63, 64,
2207 70, 103, 149, 150, 151, 69, 0, 1, 2, 0,
2208 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2209 0, 0, 0, 0, 0, 0, 0, 0, 71, 0,
2210 0, 72, 0, 0, 73, 0, 74, 70, 0, 0,
2211 0, 0, 0, 71, 0, 0, 72, 0, 0, 73,
2212 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2214 0, 0, 0, 161, 0, 0, 0, 0, 0, 0,
2215 71, 0, 0, 72, 0, 0, 73, 0, 74, 0,
2216 0, 0, 162, 163, 0, 71, 0, 0, 72, 0,
2217 0, 73, 0, 74, 164, 165, 166, 167, 168, 169,
2218 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
2219 180, 181, 182, 183, 184, 185, 186, 0, 0, 0,
2220 0, 0, 71, 0, 0, 72, 0, 0, 73, 0,
2221 338, 0, 0, 0, 0, 0, 0, 187, 188, 189,
2222 0, 0, 190, 191, 192, 193, 194, 195, 196, 197,
2223 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2227 static const short int yycheck[] =
2229 0, 27, 166, 154, 123, 226, 416, 147, 0, 4,
2230 11, 25, 320, 297, 154, 11, 324, 17, 138, 18,
2231 189, 11, 249, 250, 167, 17, 11, 26, 138, 325,
2232 326, 3, 4, 5, 6, 204, 205, 206, 207, 208,
2233 139, 49, 211, 54, 552, 139, 139, 0, 74, 148,
2234 31, 23, 24, 146, 16, 63, 150, 19, 566, 21,
2235 50, 138, 15, 16, 17, 50, 19, 20, 21, 50,
2236 213, 139, 98, 15, 27, 28, 102, 40, 41, 0,
2237 148, 139, 108, 139, 47, 139, 116, 113, 138, 89,
2238 53, 501, 150, 139, 150, 48, 150, 123, 51, 140,
2239 146, 142, 55, 39, 40, 41, 138, 148, 44, 135,
2240 136, 338, 142, 139, 31, 139, 139, 143, 414, 143,
2241 143, 261, 35, 263, 264, 535, 266, 144, 114, 115,
2242 140, 358, 142, 19, 16, 149, 146, 19, 164, 21,
2243 18, 139, 140, 312, 142, 146, 132, 133, 267, 19,
2244 146, 150, 114, 115, 149, 114, 115, 567, 442, 299,
2245 19, 187, 188, 189, 190, 157, 17, 307, 308, 20,
2246 132, 133, 131, 132, 133, 134, 19, 203, 204, 205,
2247 206, 207, 208, 209, 210, 211, 140, 471, 142, 473,
2248 144, 310, 139, 219, 502, 4, 143, 114, 115, 29,
2249 30, 114, 115, 229, 142, 139, 140, 376, 142, 378,
2250 379, 380, 109, 110, 131, 132, 133, 134, 131, 132,
2251 133, 134, 3, 4, 5, 6, 366, 367, 368, 140,
2252 34, 142, 143, 11, 374, 519, 14, 135, 136, 137,
2253 0, 267, 463, 4, 384, 385, 145, 43, 556, 45,
2254 558, 145, 278, 404, 4, 15, 16, 17, 139, 19,
2255 20, 21, 7, 8, 404, 110, 111, 27, 28, 295,
2256 19, 16, 17, 148, 19, 20, 21, 57, 58, 59,
2257 60, 61, 62, 143, 310, 311, 312, 427, 48, 429,
2258 143, 51, 432, 142, 140, 55, 142, 143, 438, 439,
2259 330, 331, 332, 333, 334, 474, 80, 81, 477, 478,
2260 479, 9, 338, 343, 344, 345, 537, 9, 32, 540,
2261 34, 140, 348, 142, 9, 52, 466, 467, 11, 469,
2262 470, 39, 148, 41, 142, 475, 142, 142, 19, 142,
2263 142, 142, 142, 142, 139, 485, 139, 139, 142, 139,
2264 376, 377, 378, 379, 380, 139, 139, 383, 35, 263,
2265 264, 35, 266, 139, 394, 395, 506, 393, 56, 142,
2266 534, 401, 7, 8, 514, 10, 11, 12, 13, 14,
2267 142, 16, 17, 139, 19, 20, 21, 139, 139, 553,
2268 144, 139, 139, 139, 35, 299, 139, 139, 139, 19,
2269 139, 139, 4, 307, 308, 139, 143, 19, 148, 142,
2270 550, 46, 4, 14, 14, 555, 139, 443, 448, 449,
2271 450, 451, 139, 139, 139, 455, 456, 139, 139, 139,
2272 139, 457, 572, 573, 139, 142, 462, 577, 139, 139,
2273 580, 50, 468, 139, 148, 139, 143, 19, 474, 139,
2274 139, 477, 478, 479, 50, 146, 482, 487, 488, 143,
2275 139, 461, 366, 367, 368, 143, 23, 24, 144, 14,
2276 374, 39, 40, 41, 42, 43, 44, 45, 143, 47,
2277 384, 385, 87, 88, 89, 90, 91, 92, 93, 94,
2278 95, 96, 522, 143, 524, 525, 143, 146, 143, 143,
2279 4, 139, 14, 14, 14, 139, 141, 68, 14, 144,
2280 536, 126, 147, 126, 149, 150, 126, 241, 89, 502,
2281 242, 108, 529, 427, 219, 429, 102, 229, 432, 529,
2282 17, 86, 56, 482, 438, 439, 93, 94, 95, 96,
2283 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2284 -1, -1, 396, -1, -1, -1, -1, -1, -1, -1,
2285 -1, -1, 466, 467, -1, 469, 470, 135, 136, 137,
2286 -1, 475, -1, 7, 8, -1, 10, 11, 12, 13,
2287 14, 485, 16, 17, -1, 19, 20, 21, -1, -1,
2288 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2289 -1, -1, 506, -1, -1, -1, -1, -1, -1, -1,
2290 514, -1, 46, 3, 4, -1, -1, 7, 8, 9,
2291 -1, -1, -1, -1, -1, -1, 16, 17, -1, 19,
2292 20, 21, 22, 23, 24, -1, -1, -1, -1, -1,
2293 -1, -1, -1, -1, -1, -1, 550, 37, 38, -1,
2294 -1, 555, -1, -1, -1, -1, -1, -1, -1, -1,
2295 -1, -1, -1, -1, 54, -1, -1, -1, 572, 573,
2296 -1, -1, -1, 577, -1, -1, 580, -1, -1, -1,
2297 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2298 80, 81, 82, 83, 84, 85, 86, -1, -1, -1,
2299 -1, -1, -1, -1, -1, -1, -1, 141, -1, -1,
2300 144, -1, -1, 147, -1, 149, 150, -1, -1, -1,
2301 -1, -1, 112, 113, 114, 115, 116, 117, 118, 119,
2302 120, 121, 122, 123, 124, -1, 126, -1, 128, 129,
2303 130, -1, 3, 4, -1, -1, 7, 8, 9, -1,
2304 140, -1, 142, -1, -1, 16, 17, 147, 19, 20,
2305 21, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2306 -1, -1, -1, -1, -1, -1, 37, 38, -1, -1,
2307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2308 -1, -1, -1, 54, -1, -1, -1, -1, -1, -1,
2309 -1, -1, -1, -1, -1, -1, -1, -1, -1, 70,
2310 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2311 81, 82, 83, 84, 85, 86, -1, 7, 8, -1,
2312 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2313 20, 21, -1, -1, -1, -1, -1, -1, -1, -1,
2314 -1, 112, 113, 114, 115, 116, 117, 118, 119, 120,
2315 121, 122, 123, 124, -1, 126, 46, 128, 129, 130,
2316 7, 8, -1, -1, -1, -1, -1, -1, -1, 16,
2317 17, -1, 19, 20, 21, 22, 147, -1, -1, -1,
2318 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2319 37, 38, -1, -1, -1, -1, -1, -1, -1, -1,
2320 -1, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2321 16, 17, -1, 19, 20, 21, -1, -1, -1, -1,
2322 -1, -1, -1, 70, 71, 72, 73, 74, 75, 76,
2323 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2324 46, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2325 -1, 141, -1, -1, 144, -1, -1, 147, -1, 149,
2326 150, -1, -1, -1, -1, 112, 113, 114, 115, 116,
2327 117, 118, 119, 120, 121, 122, 123, 124, -1, 126,
2328 -1, 128, 129, 130, -1, -1, 3, 4, -1, -1,
2329 -1, -1, 9, 140, -1, 142, -1, 144, -1, -1,
2330 147, -1, 149, -1, 151, 22, 23, 24, -1, -1,
2331 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2332 37, 38, -1, -1, -1, -1, -1, -1, -1, -1,
2333 -1, -1, -1, -1, -1, 141, -1, 54, 144, -1,
2334 -1, 147, -1, 149, 150, -1, -1, -1, -1, -1,
2335 -1, -1, -1, 70, 71, 72, 73, 74, 75, 76,
2336 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2337 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2338 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2339 -1, 19, 20, 21, -1, 112, 113, 114, 115, 116,
2340 117, 118, 119, 120, 121, 122, 123, 124, 36, 126,
2341 -1, 128, 129, 130, -1, -1, -1, -1, 46, 7,
2342 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2343 147, 19, 20, 21, 7, 8, -1, 10, 11, 12,
2344 13, 14, -1, 16, 17, -1, 19, 20, 21, -1,
2345 -1, -1, -1, -1, -1, -1, -1, -1, 46, -1,
2346 -1, -1, -1, 36, -1, 7, 8, -1, 10, 11,
2347 12, 13, 14, 46, 16, 17, -1, 19, 20, 21,
2348 -1, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2349 16, 17, -1, 19, 20, 21, -1, -1, -1, -1,
2350 -1, -1, -1, -1, 46, -1, -1, -1, -1, -1,
2351 36, -1, -1, 141, -1, -1, 144, -1, -1, 147,
2352 46, 149, -1, -1, -1, -1, -1, -1, 7, 8,
2353 118, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2354 19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
2355 -1, -1, -1, 141, -1, -1, 144, 36, -1, 147,
2356 -1, 149, -1, -1, -1, -1, -1, 46, 141, -1,
2357 -1, 144, -1, -1, 147, -1, 149, 7, 8, -1,
2358 10, 11, 12, 13, 14, -1, 16, 17, -1, 19,
2359 20, 21, -1, -1, -1, -1, -1, -1, -1, 141,
2360 -1, -1, 144, -1, 146, 147, -1, 149, -1, -1,
2361 -1, -1, -1, -1, -1, 141, 46, -1, 144, -1,
2362 -1, 147, -1, 149, 7, 8, -1, 10, 11, 12,
2363 13, 14, -1, 16, 17, -1, 19, 20, 21, 7,
2364 8, -1, 10, 11, 12, 13, 14, -1, 16, 17,
2365 -1, 19, 20, 21, -1, -1, -1, -1, -1, -1,
2366 -1, -1, 141, 46, -1, 144, -1, -1, 147, -1,
2367 149, -1, -1, -1, -1, -1, 7, 8, 46, 10,
2368 11, 12, 13, 14, -1, 16, 17, -1, 19, 20,
2369 21, 7, 8, -1, 10, 11, 12, 13, 14, -1,
2370 16, 17, -1, 19, 20, 21, -1, -1, -1, -1,
2371 -1, 141, -1, -1, 144, 46, -1, 147, -1, 149,
2372 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2373 46, 10, 11, 12, 13, 14, -1, 16, 17, -1,
2374 19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
2375 -1, -1, -1, -1, -1, -1, -1, -1, 141, -1,
2376 -1, 144, -1, -1, 147, -1, 149, 46, -1, -1,
2377 -1, -1, -1, 141, -1, -1, 144, -1, -1, 147,
2378 -1, 149, -1, -1, -1, -1, -1, -1, -1, -1,
2379 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2380 -1, -1, -1, 33, -1, -1, -1, -1, -1, -1,
2381 141, -1, -1, 144, -1, -1, 147, -1, 149, -1,
2382 -1, -1, 52, 53, -1, 141, -1, -1, 144, -1,
2383 -1, 147, -1, 149, 64, 65, 66, 67, 68, 69,
2384 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2385 80, 81, 82, 83, 84, 85, 86, -1, -1, -1,
2386 -1, -1, 141, -1, -1, 144, -1, -1, 147, -1,
2387 149, -1, -1, -1, -1, -1, -1, 107, 108, 109,
2388 -1, -1, 112, 113, 114, 115, 116, 117, 118, 119,
2389 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2393 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2394 symbol of state STATE-NUM. */
2395 static const unsigned char yystos[] =
2397 0, 16, 17, 19, 20, 21, 27, 28, 48, 51,
2398 55, 160, 162, 163, 164, 165, 196, 197, 198, 200,
2399 199, 49, 63, 205, 138, 54, 138, 15, 138, 39,
2400 40, 41, 42, 43, 44, 45, 47, 135, 136, 137,
2401 166, 167, 168, 0, 198, 43, 45, 169, 215, 39,
2402 40, 41, 44, 170, 212, 214, 221, 138, 138, 144,
2403 206, 19, 204, 7, 8, 10, 11, 12, 13, 14,
2404 46, 141, 144, 147, 149, 160, 163, 183, 184, 218,
2405 168, 168, 32, 34, 194, 168, 168, 18, 222, 223,
2406 26, 150, 213, 222, 19, 19, 19, 207, 142, 4,
2407 4, 4, 149, 10, 150, 184, 189, 140, 142, 194,
2408 194, 39, 41, 171, 29, 30, 193, 57, 58, 59,
2409 60, 61, 62, 172, 210, 210, 162, 226, 139, 146,
2410 36, 184, 185, 187, 188, 145, 145, 150, 189, 139,
2411 150, 188, 193, 193, 10, 118, 184, 186, 195, 11,
2412 12, 13, 158, 159, 184, 190, 4, 186, 25, 149,
2413 211, 33, 52, 53, 64, 65, 66, 67, 68, 69,
2414 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2415 80, 81, 82, 83, 84, 85, 86, 107, 108, 109,
2416 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2417 122, 123, 124, 125, 126, 127, 128, 129, 130, 153,
2418 154, 155, 224, 230, 231, 232, 233, 19, 174, 139,
2419 143, 184, 184, 148, 150, 184, 143, 190, 184, 142,
2420 218, 23, 24, 3, 4, 5, 6, 9, 22, 37,
2421 38, 85, 86, 112, 126, 128, 129, 130, 144, 147,
2422 149, 151, 153, 154, 155, 191, 218, 201, 163, 52,
2423 10, 184, 220, 11, 14, 11, 158, 172, 87, 88,
2424 89, 90, 91, 92, 93, 94, 95, 96, 156, 23,
2425 24, 93, 94, 95, 96, 97, 98, 99, 100, 101,
2426 102, 103, 104, 105, 106, 157, 184, 184, 220, 184,
2427 184, 227, 220, 220, 220, 220, 220, 184, 184, 220,
2428 172, 110, 111, 114, 115, 132, 133, 173, 36, 185,
2429 176, 146, 148, 148, 176, 202, 203, 195, 156, 157,
2430 142, 142, 142, 142, 142, 146, 190, 192, 149, 192,
2431 150, 192, 19, 142, 142, 142, 139, 181, 142, 3,
2432 4, 9, 22, 23, 24, 37, 38, 54, 147, 191,
2433 217, 218, 219, 219, 219, 219, 186, 184, 184, 139,
2434 178, 139, 178, 219, 144, 139, 139, 139, 139, 139,
2435 139, 219, 219, 35, 186, 184, 220, 131, 134, 173,
2436 175, 181, 181, 35, 142, 142, 190, 190, 190, 190,
2437 190, 139, 146, 150, 184, 192, 148, 150, 190, 190,
2438 190, 31, 50, 179, 182, 36, 184, 208, 209, 56,
2439 216, 192, 139, 139, 219, 219, 219, 11, 50, 11,
2440 229, 219, 144, 220, 184, 220, 220, 220, 139, 139,
2441 184, 219, 219, 139, 184, 190, 190, 229, 139, 139,
2442 139, 139, 190, 148, 150, 139, 139, 35, 19, 4,
2443 181, 174, 139, 143, 19, 148, 14, 14, 142, 139,
2444 139, 219, 4, 219, 139, 139, 219, 139, 139, 139,
2445 219, 219, 142, 139, 178, 184, 143, 139, 139, 143,
2446 190, 190, 190, 190, 148, 190, 190, 184, 160, 161,
2447 36, 184, 176, 139, 219, 219, 184, 228, 219, 219,
2448 178, 178, 220, 219, 139, 220, 220, 220, 228, 219,
2449 190, 190, 139, 143, 139, 139, 143, 143, 143, 174,
2450 179, 180, 19, 139, 144, 219, 139, 143, 146, 219,
2451 143, 178, 143, 143, 190, 190, 190, 161, 50, 177,
2452 14, 146, 158, 225, 174, 184, 176, 146, 176, 143,
2453 143, 143, 4, 219, 217, 146, 158, 219, 35, 139,
2454 217, 174, 14, 14, 139, 219, 219, 14, 68, 219,
2458 #define yyerrok (yyerrstatus = 0)
2459 #define yyclearin (yychar = YYEMPTY)
2460 #define YYEMPTY (-2)
2463 #define YYACCEPT goto yyacceptlab
2464 #define YYABORT goto yyabortlab
2465 #define YYERROR goto yyerrorlab
2468 /* Like YYERROR except do call yyerror. This remains here temporarily
2469 to ease the transition to the new meaning of YYERROR, for GCC.
2470 Once GCC version 2 has supplanted version 1, this can go. */
2472 #define YYFAIL goto yyerrlab
2474 #define YYRECOVERING() (!!yyerrstatus)
2476 #define YYBACKUP(Token, Value) \
2478 if (yychar == YYEMPTY && yylen == 1) \
2482 yytoken = YYTRANSLATE (yychar); \
2488 yyerror (YY_("syntax error: cannot back up")); \
2495 #define YYERRCODE 256
2498 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2499 If N is 0, then set CURRENT to the empty location which ends
2500 the previous symbol: RHS[0] (always defined). */
2502 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2503 #ifndef YYLLOC_DEFAULT
2504 # define YYLLOC_DEFAULT(Current, Rhs, N) \
2508 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2509 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2510 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2511 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2515 (Current).first_line = (Current).last_line = \
2516 YYRHSLOC (Rhs, 0).last_line; \
2517 (Current).first_column = (Current).last_column = \
2518 YYRHSLOC (Rhs, 0).last_column; \
2524 /* YY_LOCATION_PRINT -- Print the location on the stream.
2525 This macro was not mandated originally: define only if we know
2526 we won't break user code: when these are the locations we know. */
2528 #ifndef YY_LOCATION_PRINT
2529 # if YYLTYPE_IS_TRIVIAL
2530 # define YY_LOCATION_PRINT(File, Loc) \
2531 fprintf (File, "%d.%d-%d.%d", \
2532 (Loc).first_line, (Loc).first_column, \
2533 (Loc).last_line, (Loc).last_column)
2535 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2540 /* YYLEX -- calling `yylex' with the right arguments. */
2543 # define YYLEX yylex (YYLEX_PARAM)
2545 # define YYLEX yylex ()
2548 /* Enable debugging if requested. */
2552 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2553 # define YYFPRINTF fprintf
2556 # define YYDPRINTF(Args) \
2562 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2566 YYFPRINTF (stderr, "%s ", Title); \
2567 yysymprint (stderr, \
2569 YYFPRINTF (stderr, "\n"); \
2573 /*------------------------------------------------------------------.
2574 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2576 `------------------------------------------------------------------*/
2578 #if defined (__STDC__) || defined (__cplusplus)
2580 yy_stack_print (short int *bottom, short int *top)
2583 yy_stack_print (bottom, top)
2588 YYFPRINTF (stderr, "Stack now");
2589 for (/* Nothing. */; bottom <= top; ++bottom)
2590 YYFPRINTF (stderr, " %d", *bottom);
2591 YYFPRINTF (stderr, "\n");
2594 # define YY_STACK_PRINT(Bottom, Top) \
2597 yy_stack_print ((Bottom), (Top)); \
2601 /*------------------------------------------------.
2602 | Report that the YYRULE is going to be reduced. |
2603 `------------------------------------------------*/
2605 #if defined (__STDC__) || defined (__cplusplus)
2607 yy_reduce_print (int yyrule)
2610 yy_reduce_print (yyrule)
2615 unsigned long int yylno = yyrline[yyrule];
2616 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2618 /* Print the symbols being reduced, and their result. */
2619 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2620 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2621 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2624 # define YY_REDUCE_PRINT(Rule) \
2627 yy_reduce_print (Rule); \
2630 /* Nonzero means print parse trace. It is left uninitialized so that
2631 multiple parsers can coexist. */
2633 #else /* !YYDEBUG */
2634 # define YYDPRINTF(Args)
2635 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2636 # define YY_STACK_PRINT(Bottom, Top)
2637 # define YY_REDUCE_PRINT(Rule)
2638 #endif /* !YYDEBUG */
2641 /* YYINITDEPTH -- initial size of the parser's stacks. */
2643 # define YYINITDEPTH 200
2646 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2647 if the built-in stack extension method is used).
2649 Do not make this value too large; the results are undefined if
2650 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2651 evaluated with infinite-precision integer arithmetic. */
2654 # define YYMAXDEPTH 10000
2662 # if defined (__GLIBC__) && defined (_STRING_H)
2663 # define yystrlen strlen
2665 /* Return the length of YYSTR. */
2667 # if defined (__STDC__) || defined (__cplusplus)
2668 yystrlen (const char *yystr)
2674 const char *yys = yystr;
2676 while (*yys++ != '\0')
2679 return yys - yystr - 1;
2685 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2686 # define yystpcpy stpcpy
2688 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2691 # if defined (__STDC__) || defined (__cplusplus)
2692 yystpcpy (char *yydest, const char *yysrc)
2694 yystpcpy (yydest, yysrc)
2700 const char *yys = yysrc;
2702 while ((*yyd++ = *yys++) != '\0')
2711 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2712 quotes and backslashes, so that it's suitable for yyerror. The
2713 heuristic is that double-quoting is unnecessary unless the string
2714 contains an apostrophe, a comma, or backslash (other than
2715 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2716 null, do not copy; instead, return the length of what the result
2719 yytnamerr (char *yyres, const char *yystr)
2724 char const *yyp = yystr;
2731 goto do_not_strip_quotes;
2735 goto do_not_strip_quotes;
2748 do_not_strip_quotes: ;
2752 return yystrlen (yystr);
2754 return yystpcpy (yyres, yystr) - yyres;
2758 #endif /* YYERROR_VERBOSE */
2763 /*--------------------------------.
2764 | Print this symbol on YYOUTPUT. |
2765 `--------------------------------*/
2767 #if defined (__STDC__) || defined (__cplusplus)
2769 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2772 yysymprint (yyoutput, yytype, yyvaluep)
2778 /* Pacify ``unused variable'' warnings. */
2781 if (yytype < YYNTOKENS)
2782 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2784 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2788 if (yytype < YYNTOKENS)
2789 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2796 YYFPRINTF (yyoutput, ")");
2799 #endif /* ! YYDEBUG */
2800 /*-----------------------------------------------.
2801 | Release the memory associated to this symbol. |
2802 `-----------------------------------------------*/
2804 #if defined (__STDC__) || defined (__cplusplus)
2806 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2809 yydestruct (yymsg, yytype, yyvaluep)
2815 /* Pacify ``unused variable'' warnings. */
2820 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2831 /* Prevent warnings from -Wmissing-prototypes. */
2833 #ifdef YYPARSE_PARAM
2834 # if defined (__STDC__) || defined (__cplusplus)
2835 int yyparse (void *YYPARSE_PARAM);
2839 #else /* ! YYPARSE_PARAM */
2840 #if defined (__STDC__) || defined (__cplusplus)
2845 #endif /* ! YYPARSE_PARAM */
2849 /* The look-ahead symbol. */
2852 /* The semantic value of the look-ahead symbol. */
2855 /* Number of syntax errors so far. */
2864 #ifdef YYPARSE_PARAM
2865 # if defined (__STDC__) || defined (__cplusplus)
2866 int yyparse (void *YYPARSE_PARAM)
2868 int yyparse (YYPARSE_PARAM)
2869 void *YYPARSE_PARAM;
2871 #else /* ! YYPARSE_PARAM */
2872 #if defined (__STDC__) || defined (__cplusplus)
2886 /* Number of tokens to shift before error messages enabled. */
2888 /* Look-ahead token as an internal (translated) token number. */
2891 /* Three stacks and their tools:
2892 `yyss': related to states,
2893 `yyvs': related to semantic values,
2894 `yyls': related to locations.
2896 Refer to the stacks thru separate pointers, to allow yyoverflow
2897 to reallocate them elsewhere. */
2899 /* The state stack. */
2900 short int yyssa[YYINITDEPTH];
2901 short int *yyss = yyssa;
2904 /* The semantic value stack. */
2905 YYSTYPE yyvsa[YYINITDEPTH];
2906 YYSTYPE *yyvs = yyvsa;
2911 #define YYPOPSTACK (yyvsp--, yyssp--)
2913 YYSIZE_T yystacksize = YYINITDEPTH;
2915 /* The variables used to return semantic value and location from the
2920 /* When reducing, the number of symbols on the RHS of the reduced
2924 YYDPRINTF ((stderr, "Starting parse\n"));
2929 yychar = YYEMPTY; /* Cause a token to be read. */
2931 /* Initialize stack pointers.
2932 Waste one element of value and location stack
2933 so that they stay on the same level as the state stack.
2934 The wasted elements are never initialized. */
2941 /*------------------------------------------------------------.
2942 | yynewstate -- Push a new state, which is found in yystate. |
2943 `------------------------------------------------------------*/
2945 /* In all cases, when you get here, the value and location stacks
2946 have just been pushed. so pushing a state here evens the stacks.
2953 if (yyss + yystacksize - 1 <= yyssp)
2955 /* Get the current used size of the three stacks, in elements. */
2956 YYSIZE_T yysize = yyssp - yyss + 1;
2960 /* Give user a chance to reallocate the stack. Use copies of
2961 these so that the &'s don't force the real ones into
2963 YYSTYPE *yyvs1 = yyvs;
2964 short int *yyss1 = yyss;
2967 /* Each stack pointer address is followed by the size of the
2968 data in use in that stack, in bytes. This used to be a
2969 conditional around just the two extra args, but that might
2970 be undefined if yyoverflow is a macro. */
2971 yyoverflow (YY_("memory exhausted"),
2972 &yyss1, yysize * sizeof (*yyssp),
2973 &yyvs1, yysize * sizeof (*yyvsp),
2980 #else /* no yyoverflow */
2981 # ifndef YYSTACK_RELOCATE
2982 goto yyexhaustedlab;
2984 /* Extend the stack our own way. */
2985 if (YYMAXDEPTH <= yystacksize)
2986 goto yyexhaustedlab;
2988 if (YYMAXDEPTH < yystacksize)
2989 yystacksize = YYMAXDEPTH;
2992 short int *yyss1 = yyss;
2993 union yyalloc *yyptr =
2994 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2996 goto yyexhaustedlab;
2997 YYSTACK_RELOCATE (yyss);
2998 YYSTACK_RELOCATE (yyvs);
3000 # undef YYSTACK_RELOCATE
3002 YYSTACK_FREE (yyss1);
3005 #endif /* no yyoverflow */
3007 yyssp = yyss + yysize - 1;
3008 yyvsp = yyvs + yysize - 1;
3011 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3012 (unsigned long int) yystacksize));
3014 if (yyss + yystacksize - 1 <= yyssp)
3018 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3027 /* Do appropriate processing given the current state. */
3028 /* Read a look-ahead token if we need one and don't already have one. */
3031 /* First try to decide what to do without reference to look-ahead token. */
3033 yyn = yypact[yystate];
3034 if (yyn == YYPACT_NINF)
3037 /* Not known => get a look-ahead token if don't already have one. */
3039 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
3040 if (yychar == YYEMPTY)
3042 YYDPRINTF ((stderr, "Reading a token: "));
3046 if (yychar <= YYEOF)
3048 yychar = yytoken = YYEOF;
3049 YYDPRINTF ((stderr, "Now at end of input.\n"));
3053 yytoken = YYTRANSLATE (yychar);
3054 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3057 /* If the proper action on seeing token YYTOKEN is to reduce or to
3058 detect an error, take that action. */
3060 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3065 if (yyn == 0 || yyn == YYTABLE_NINF)
3074 /* Shift the look-ahead token. */
3075 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3077 /* Discard the token being shifted unless it is eof. */
3078 if (yychar != YYEOF)
3084 /* Count tokens shifted since error; after three, turn off error
3093 /*-----------------------------------------------------------.
3094 | yydefault -- do the default action for the current state. |
3095 `-----------------------------------------------------------*/
3097 yyn = yydefact[yystate];
3103 /*-----------------------------.
3104 | yyreduce -- Do a reduction. |
3105 `-----------------------------*/
3107 /* yyn is the number of a rule to reduce with. */
3110 /* If YYLEN is nonzero, implement the default value of the action:
3113 Otherwise, the following line sets YYVAL to garbage.
3114 This behavior is undocumented and Bison
3115 users should not rely upon it. Assigning to YYVAL
3116 unconditionally makes the parser a bit smaller, and it avoids a
3117 GCC warning that YYVAL may be used uninitialized. */
3118 yyval = yyvsp[1-yylen];
3121 YY_REDUCE_PRINT (yyn);
3125 #line 1118 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3126 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3130 #line 1118 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3131 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3135 #line 1119 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3136 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3140 #line 1119 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3141 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3145 #line 1120 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3146 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3150 #line 1120 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3151 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3155 #line 1121 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3156 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3160 #line 1121 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3161 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3165 #line 1122 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3166 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3170 #line 1122 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3171 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3175 #line 1126 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3176 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3180 #line 1126 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3181 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3185 #line 1127 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3186 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3190 #line 1127 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3191 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3195 #line 1128 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3196 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3200 #line 1128 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3201 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3205 #line 1129 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3206 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3210 #line 1129 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3211 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3215 #line 1130 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3216 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3220 #line 1130 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3221 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3225 #line 1131 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3226 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3230 #line 1131 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3231 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3235 #line 1132 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3236 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3240 #line 1132 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3241 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3245 #line 1133 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3246 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3250 #line 1134 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3251 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3255 #line 1143 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3256 { (yyval.StrVal) = 0; ;}
3260 #line 1147 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3262 (yyval.StrVal) = (yyvsp[-1].StrVal);
3268 #line 1151 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3276 #line 1159 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3284 #line 1164 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3286 (yyval.StrVal) = (yyvsp[-1].StrVal);
3292 #line 1170 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3293 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3297 #line 1171 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3298 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3302 #line 1172 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3303 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3307 #line 1173 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3308 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3312 #line 1174 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3313 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3317 #line 1178 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3318 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3322 #line 1179 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3323 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3327 #line 1180 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3328 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3332 #line 1184 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3333 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3337 #line 1185 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3338 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3342 #line 1186 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3343 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3347 #line 1187 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3348 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3352 #line 1191 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3353 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3357 #line 1192 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3358 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3362 #line 1193 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3363 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3367 #line 1197 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3368 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3372 #line 1198 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3373 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3377 #line 1199 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3378 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3382 #line 1200 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3383 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3387 #line 1201 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3388 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3392 #line 1205 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3393 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3397 #line 1206 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3398 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3402 #line 1207 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3403 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3407 #line 1210 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3408 { (yyval.UIntVal) = CallingConv::C; ;}
3412 #line 1211 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3413 { (yyval.UIntVal) = CallingConv::C; ;}
3417 #line 1212 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3418 { (yyval.UIntVal) = CallingConv::Fast; ;}
3422 #line 1213 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3423 { (yyval.UIntVal) = CallingConv::Cold; ;}
3427 #line 1214 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3428 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3432 #line 1215 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3433 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3437 #line 1216 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3439 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3440 GEN_ERROR("Calling conv too large");
3441 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3447 #line 1223 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3448 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3452 #line 1224 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3453 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3457 #line 1225 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3458 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3462 #line 1226 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3463 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3467 #line 1229 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3468 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3472 #line 1230 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3474 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3479 #line 1235 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3480 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3484 #line 1236 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3485 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3489 #line 1240 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3490 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3494 #line 1241 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3496 (yyval.ParamAttrs) = (yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs);
3501 #line 1248 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3502 { (yyval.UIntVal) = 0; ;}
3506 #line 1249 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3508 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3509 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3510 GEN_ERROR("Alignment must be a power of two");
3516 #line 1255 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3517 { (yyval.UIntVal) = 0; ;}
3521 #line 1256 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3523 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3524 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3525 GEN_ERROR("Alignment must be a power of two");
3531 #line 1264 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3533 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3534 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3535 GEN_ERROR("Invalid character in section name");
3536 (yyval.StrVal) = (yyvsp[0].StrVal);
3542 #line 1272 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3543 { (yyval.StrVal) = 0; ;}
3547 #line 1273 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3548 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3552 #line 1278 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3557 #line 1279 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3562 #line 1280 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3564 CurGV->setSection((yyvsp[0].StrVal));
3565 free((yyvsp[0].StrVal));
3571 #line 1285 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3573 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3574 GEN_ERROR("Alignment must be a power of two");
3575 CurGV->setAlignment((yyvsp[0].UInt64Val));
3581 #line 1301 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3583 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3589 #line 1305 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3591 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3597 #line 1309 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3599 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3600 GEN_ERROR("Cannot form a pointer to a basic block");
3601 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3602 delete (yyvsp[-1].TypeVal);
3608 #line 1316 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3609 { // Named types are also simple types...
3610 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3612 (yyval.TypeVal) = new PATypeHolder(tmp);
3617 #line 1321 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3618 { // Type UpReference
3619 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
3620 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
3621 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3622 (yyval.TypeVal) = new PATypeHolder(OT);
3623 UR_OUT("New Upreference!\n");
3629 #line 1329 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3631 std::vector<const Type*> Params;
3632 ParamAttrsVector Attrs;
3633 if ((yyvsp[0].ParamAttrs) != ParamAttr::None) {
3634 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs);
3638 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3639 for (; I != E; ++I, ++index) {
3640 const Type *Ty = I->Ty->get();
3641 Params.push_back(Ty);
3642 if (Ty != Type::VoidTy)
3643 if (I->Attrs != ParamAttr::None) {
3644 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3648 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3649 if (isVarArg) Params.pop_back();
3651 ParamAttrsList *ActualAttrs = 0;
3653 ActualAttrs = ParamAttrsList::get(Attrs);
3654 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, ActualAttrs);
3655 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3656 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3657 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3663 #line 1359 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3665 std::vector<const Type*> Params;
3666 ParamAttrsVector Attrs;
3667 if ((yyvsp[0].ParamAttrs) != ParamAttr::None) {
3668 ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[0].ParamAttrs);
3671 TypeWithAttrsList::iterator I = (yyvsp[-2].TypeWithAttrsList)->begin(), E = (yyvsp[-2].TypeWithAttrsList)->end();
3673 for ( ; I != E; ++I, ++index) {
3674 const Type* Ty = I->Ty->get();
3675 Params.push_back(Ty);
3676 if (Ty != Type::VoidTy)
3677 if (I->Attrs != ParamAttr::None) {
3678 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3682 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3683 if (isVarArg) Params.pop_back();
3685 ParamAttrsList *ActualAttrs = 0;
3687 ActualAttrs = ParamAttrsList::get(Attrs);
3689 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, ActualAttrs);
3690 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3691 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3697 #line 1390 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3698 { // Sized array type?
3699 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3700 delete (yyvsp[-1].TypeVal);
3706 #line 1395 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3708 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3709 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3710 GEN_ERROR("Unsigned result not equal to signed result");
3711 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3712 GEN_ERROR("Element type of a VectorType must be primitive");
3713 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3714 GEN_ERROR("Vector length should be a power of 2");
3715 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3716 delete (yyvsp[-1].TypeVal);
3722 #line 1407 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3723 { // Structure type?
3724 std::vector<const Type*> Elements;
3725 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3726 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3727 Elements.push_back(*I);
3729 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3730 delete (yyvsp[-1].TypeList);
3736 #line 1417 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3737 { // Empty structure type?
3738 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3744 #line 1421 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3746 std::vector<const Type*> Elements;
3747 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3748 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3749 Elements.push_back(*I);
3751 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3752 delete (yyvsp[-2].TypeList);
3758 #line 1431 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3759 { // Empty structure type?
3760 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3766 #line 1438 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3768 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3769 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3774 #line 1445 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3776 if (!UpRefs.empty())
3777 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3778 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3779 GEN_ERROR("LLVM functions cannot return aggregate types");
3780 (yyval.TypeVal) = (yyvsp[0].TypeVal);
3785 #line 1452 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3787 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3792 #line 1457 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3794 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3795 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3801 #line 1462 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3803 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3809 #line 1470 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3811 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3812 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3813 TWA.Ty = new PATypeHolder(Type::VoidTy);
3814 (yyval.TypeWithAttrsList)->push_back(TWA);
3820 #line 1477 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3822 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3823 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3824 TWA.Ty = new PATypeHolder(Type::VoidTy);
3825 (yyval.TypeWithAttrsList)->push_back(TWA);
3831 #line 1484 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3833 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3839 #line 1492 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3841 (yyval.TypeList) = new std::list<PATypeHolder>();
3842 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal));
3843 delete (yyvsp[0].TypeVal);
3849 #line 1498 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3851 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal));
3852 delete (yyvsp[0].TypeVal);
3858 #line 1510 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3859 { // Nonempty unsized arr
3860 if (!UpRefs.empty())
3861 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3862 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3864 GEN_ERROR("Cannot make array constant with type: '" +
3865 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3866 const Type *ETy = ATy->getElementType();
3867 int NumElements = ATy->getNumElements();
3869 // Verify that we have the correct size...
3870 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3871 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3872 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3873 itostr(NumElements) + "");
3875 // Verify all elements are correct type!
3876 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3877 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3878 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3879 ETy->getDescription() +"' as required!\nIt is of type '"+
3880 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3883 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3884 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3890 #line 1538 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3892 if (!UpRefs.empty())
3893 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3894 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3896 GEN_ERROR("Cannot make array constant with type: '" +
3897 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3899 int NumElements = ATy->getNumElements();
3900 if (NumElements != -1 && NumElements != 0)
3901 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3902 " arguments, but has size of " + itostr(NumElements) +"");
3903 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3904 delete (yyvsp[-2].TypeVal);
3910 #line 1554 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3912 if (!UpRefs.empty())
3913 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3914 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3916 GEN_ERROR("Cannot make array constant with type: '" +
3917 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
3919 int NumElements = ATy->getNumElements();
3920 const Type *ETy = ATy->getElementType();
3921 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3922 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3923 GEN_ERROR("Can't build string constant of size " +
3924 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3925 " when array has size " + itostr(NumElements) + "");
3926 std::vector<Constant*> Vals;
3927 if (ETy == Type::Int8Ty) {
3928 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
3929 C != (unsigned char*)EndStr; ++C)
3930 Vals.push_back(ConstantInt::get(ETy, *C));
3932 free((yyvsp[0].StrVal));
3933 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3935 free((yyvsp[0].StrVal));
3936 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3937 delete (yyvsp[-2].TypeVal);
3943 #line 1583 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3944 { // Nonempty unsized arr
3945 if (!UpRefs.empty())
3946 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3947 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[-3].TypeVal)->get());
3949 GEN_ERROR("Cannot make packed constant with type: '" +
3950 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3951 const Type *ETy = PTy->getElementType();
3952 int NumElements = PTy->getNumElements();
3954 // Verify that we have the correct size...
3955 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3956 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3957 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3958 itostr(NumElements) + "");
3960 // Verify all elements are correct type!
3961 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3962 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3963 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3964 ETy->getDescription() +"' as required!\nIt is of type '"+
3965 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3968 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[-1].ConstVector));
3969 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3975 #line 1611 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
3977 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3979 GEN_ERROR("Cannot make struct constant with type: '" +
3980 (*(yyvsp[-3].TypeVal))->getDescription() + "'");
3982 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3983 GEN_ERROR("Illegal number of initializers for structure type");
3985 // Check to ensure that constants are compatible with the type initializer!
3986 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3987 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3988 GEN_ERROR("Expected type '" +
3989 STy->getElementType(i)->getDescription() +
3990 "' for element #" + utostr(i) +
3991 " of structure initializer");
3993 // Check to ensure that Type is not packed
3994 if (STy->isPacked())
3995 GEN_ERROR("Unpacked Initializer to vector type '" +
3996 STy->getDescription() + "'");
3998 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3999 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
4005 #line 1637 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4007 if (!UpRefs.empty())
4008 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4009 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
4011 GEN_ERROR("Cannot make struct constant with type: '" +
4012 (*(yyvsp[-2].TypeVal))->getDescription() + "'");
4014 if (STy->getNumContainedTypes() != 0)
4015 GEN_ERROR("Illegal number of initializers for structure type");
4017 // Check to ensure that Type is not packed
4018 if (STy->isPacked())
4019 GEN_ERROR("Unpacked Initializer to vector type '" +
4020 STy->getDescription() + "'");
4022 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4023 delete (yyvsp[-2].TypeVal);
4029 #line 1657 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4031 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
4033 GEN_ERROR("Cannot make struct constant with type: '" +
4034 (*(yyvsp[-5].TypeVal))->getDescription() + "'");
4036 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
4037 GEN_ERROR("Illegal number of initializers for structure type");
4039 // Check to ensure that constants are compatible with the type initializer!
4040 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
4041 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
4042 GEN_ERROR("Expected type '" +
4043 STy->getElementType(i)->getDescription() +
4044 "' for element #" + utostr(i) +
4045 " of structure initializer");
4047 // Check to ensure that Type is packed
4048 if (!STy->isPacked())
4049 GEN_ERROR("Vector initializer to non-vector type '" +
4050 STy->getDescription() + "'");
4052 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
4053 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
4059 #line 1683 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4061 if (!UpRefs.empty())
4062 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
4063 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
4065 GEN_ERROR("Cannot make struct constant with type: '" +
4066 (*(yyvsp[-4].TypeVal))->getDescription() + "'");
4068 if (STy->getNumContainedTypes() != 0)
4069 GEN_ERROR("Illegal number of initializers for structure type");
4071 // Check to ensure that Type is packed
4072 if (!STy->isPacked())
4073 GEN_ERROR("Vector initializer to non-vector type '" +
4074 STy->getDescription() + "'");
4076 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4077 delete (yyvsp[-4].TypeVal);
4083 #line 1703 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4085 if (!UpRefs.empty())
4086 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4087 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
4089 GEN_ERROR("Cannot make null pointer constant with type: '" +
4090 (*(yyvsp[-1].TypeVal))->getDescription() + "'");
4092 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4093 delete (yyvsp[-1].TypeVal);
4099 #line 1715 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4101 if (!UpRefs.empty())
4102 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4103 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
4104 delete (yyvsp[-1].TypeVal);
4110 #line 1722 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4112 if (!UpRefs.empty())
4113 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4114 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
4116 GEN_ERROR("Global const reference must be a pointer type");
4118 // ConstExprs can exist in the body of a function, thus creating
4119 // GlobalValues whenever they refer to a variable. Because we are in
4120 // the context of a function, getExistingVal will search the functions
4121 // symbol table instead of the module symbol table for the global symbol,
4122 // which throws things all off. To get around this, we just tell
4123 // getExistingVal that we are at global scope here.
4125 Function *SavedCurFn = CurFun.CurrentFunction;
4126 CurFun.CurrentFunction = 0;
4128 Value *V = getExistingVal(Ty, (yyvsp[0].ValIDVal));
4131 CurFun.CurrentFunction = SavedCurFn;
4133 // If this is an initializer for a constant pointer, which is referencing a
4134 // (currently) undefined variable, create a stub now that shall be replaced
4135 // in the future with the right type of variable.
4138 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4139 const PointerType *PT = cast<PointerType>(Ty);
4141 // First check to see if the forward references value is already created!
4142 PerModuleInfo::GlobalRefsType::iterator I =
4143 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
4145 if (I != CurModule.GlobalRefs.end()) {
4146 V = I->second; // Placeholder already exists, use it...
4147 (yyvsp[0].ValIDVal).destroy();
4150 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
4151 Name = (yyvsp[0].ValIDVal).Name;
4152 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
4153 GEN_ERROR("Invalid reference to global");
4155 // Create the forward referenced global.
4157 if (const FunctionType *FTy =
4158 dyn_cast<FunctionType>(PT->getElementType())) {
4159 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4160 CurModule.CurrentModule);
4162 GV = new GlobalVariable(PT->getElementType(), false,
4163 GlobalValue::ExternalWeakLinkage, 0,
4164 Name, CurModule.CurrentModule);
4167 // Keep track of the fact that we have a forward ref to recycle it
4168 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
4173 (yyval.ConstVal) = cast<GlobalValue>(V);
4174 delete (yyvsp[-1].TypeVal); // Free the type handle
4180 #line 1788 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4182 if (!UpRefs.empty())
4183 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4184 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
4185 GEN_ERROR("Mismatched types for constant expression: " +
4186 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
4187 (yyval.ConstVal) = (yyvsp[0].ConstVal);
4188 delete (yyvsp[-1].TypeVal);
4194 #line 1798 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4196 if (!UpRefs.empty())
4197 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4198 const Type *Ty = (yyvsp[-1].TypeVal)->get();
4199 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4200 GEN_ERROR("Cannot create a null initialized value of this type");
4201 (yyval.ConstVal) = Constant::getNullValue(Ty);
4202 delete (yyvsp[-1].TypeVal);
4208 #line 1808 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4209 { // integral constants
4210 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
4211 GEN_ERROR("Constant value doesn't fit in type");
4212 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val), true);
4218 #line 1814 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4219 { // arbitrary precision integer constants
4220 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4221 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4222 GEN_ERROR("Constant value does not fit in type");
4224 (yyvsp[0].APIntVal)->sextOrTrunc(BitWidth);
4225 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4226 delete (yyvsp[0].APIntVal);
4232 #line 1824 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4233 { // integral constants
4234 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
4235 GEN_ERROR("Constant value doesn't fit in type");
4236 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val), false);
4242 #line 1830 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4243 { // arbitrary precision integer constants
4244 uint32_t BitWidth = cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth();
4245 if ((yyvsp[0].APIntVal)->getBitWidth() > BitWidth) {
4246 GEN_ERROR("Constant value does not fit in type");
4248 (yyvsp[0].APIntVal)->zextOrTrunc(BitWidth);
4249 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[0].APIntVal));
4250 delete (yyvsp[0].APIntVal);
4256 #line 1840 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4257 { // Boolean constants
4258 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4259 (yyval.ConstVal) = ConstantInt::getTrue();
4265 #line 1845 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4266 { // Boolean constants
4267 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
4268 (yyval.ConstVal) = ConstantInt::getFalse();
4274 #line 1850 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4275 { // Float & Double constants
4276 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
4277 GEN_ERROR("Floating point constant invalid for type");
4278 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
4284 #line 1858 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4286 if (!UpRefs.empty())
4287 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4288 Constant *Val = (yyvsp[-3].ConstVal);
4289 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4290 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4291 GEN_ERROR("invalid cast opcode for cast from '" +
4292 Val->getType()->getDescription() + "' to '" +
4293 DestTy->getDescription() + "'");
4294 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4295 delete (yyvsp[-1].TypeVal);
4300 #line 1870 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4302 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
4303 GEN_ERROR("GetElementPtr requires a pointer operand");
4306 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), &(*(yyvsp[-1].ValueList))[0], (yyvsp[-1].ValueList)->size(),
4309 GEN_ERROR("Index list invalid for constant getelementptr");
4311 SmallVector<Constant*, 8> IdxVec;
4312 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4313 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
4314 IdxVec.push_back(C);
4316 GEN_ERROR("Indices to constant getelementptr must be constants");
4318 delete (yyvsp[-1].ValueList);
4320 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), &IdxVec[0], IdxVec.size());
4326 #line 1892 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4328 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
4329 GEN_ERROR("Select condition must be of boolean type");
4330 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4331 GEN_ERROR("Select operand types must match");
4332 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4338 #line 1900 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4340 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4341 GEN_ERROR("Binary operator types must match");
4343 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4348 #line 1906 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4350 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4351 GEN_ERROR("Logical operator types must match");
4352 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4353 if (Instruction::isShift((yyvsp[-5].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].ConstVal)->getType()) ||
4354 !cast<VectorType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
4355 GEN_ERROR("Logical operator requires integral operands");
4357 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4363 #line 1917 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4365 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4366 GEN_ERROR("icmp operand types must match");
4367 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4372 #line 1922 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4374 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4375 GEN_ERROR("fcmp operand types must match");
4376 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4381 #line 1927 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4383 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4384 GEN_ERROR("Invalid extractelement operands");
4385 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4391 #line 1933 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4393 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4394 GEN_ERROR("Invalid insertelement operands");
4395 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4401 #line 1939 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4403 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4404 GEN_ERROR("Invalid shufflevector operands");
4405 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4411 #line 1948 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4413 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4419 #line 1952 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4421 (yyval.ConstVector) = new std::vector<Constant*>();
4422 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4428 #line 1960 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4429 { (yyval.BoolVal) = false; ;}
4433 #line 1960 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4434 { (yyval.BoolVal) = true; ;}
4438 #line 1963 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4439 { (yyval.BoolVal) = true; ;}
4443 #line 1963 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4444 { (yyval.BoolVal) = false; ;}
4448 #line 1966 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4450 const Type* VTy = (yyvsp[-1].TypeVal)->get();
4451 Value *V = getVal(VTy, (yyvsp[0].ValIDVal));
4452 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4454 GEN_ERROR("Aliases can be created only to global values");
4456 (yyval.ConstVal) = Aliasee;
4458 delete (yyvsp[-1].TypeVal);
4463 #line 1977 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4465 Constant *Val = (yyvsp[-3].ConstVal);
4466 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4467 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
4468 GEN_ERROR("invalid cast opcode for cast from '" +
4469 Val->getType()->getDescription() + "' to '" +
4470 DestTy->getDescription() + "'");
4472 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4474 delete (yyvsp[-1].TypeVal);
4479 #line 1998 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4481 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4482 CurModule.ModuleDone();
4488 #line 2003 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4490 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4491 CurModule.ModuleDone();
4497 #line 2016 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4498 { CurFun.isDeclare = false; ;}
4502 #line 2016 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4504 CurFun.FunctionDone();
4510 #line 2020 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4511 { CurFun.isDeclare = true; ;}
4515 #line 2020 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4522 #line 2023 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4529 #line 2026 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4531 if (!UpRefs.empty())
4532 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4533 // Eagerly resolve types. This is not an optimization, this is a
4534 // requirement that is due to the fact that we could have this:
4536 // %list = type { %list * }
4537 // %list = type { %list * } ; repeated type decl
4539 // If types are not resolved eagerly, then the two types will not be
4540 // determined to be the same type!
4542 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4544 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4546 // If this is a named type that is not a redefinition, add it to the slot
4548 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4551 delete (yyvsp[0].TypeVal);
4557 #line 2050 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4559 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4561 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4563 // If this is a named type that is not a redefinition, add it to the slot
4565 CurModule.Types.push_back((yyvsp[0].PrimType));
4572 #line 2061 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4574 /* "Externally Visible" Linkage */
4575 if ((yyvsp[0].ConstVal) == 0)
4576 GEN_ERROR("Global value initializer is not a constant");
4577 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), GlobalValue::ExternalLinkage,
4578 (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal));
4584 #line 2068 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4591 #line 2072 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4593 if ((yyvsp[0].ConstVal) == 0)
4594 GEN_ERROR("Global value initializer is not a constant");
4595 CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal), (yyvsp[-2].BoolVal));
4601 #line 2077 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4608 #line 2081 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4610 if (!UpRefs.empty())
4611 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4612 CurGV = ParseGlobalVariable((yyvsp[-5].StrVal), (yyvsp[-4].Linkage), (yyvsp[-3].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0, (yyvsp[-2].BoolVal));
4614 delete (yyvsp[0].TypeVal);
4619 #line 2087 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4627 #line 2091 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4629 std::string Name((yyvsp[-4].StrVal));
4631 GEN_ERROR("Alias name cannot be empty");
4633 Constant* Aliasee = (yyvsp[0].ConstVal);
4635 GEN_ERROR(std::string("Invalid aliasee for alias: ") + (yyvsp[-4].StrVal));
4637 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[-1].Linkage), Name, Aliasee,
4638 CurModule.CurrentModule);
4639 GA->setVisibility((yyvsp[-3].Visibility));
4640 InsertValue(GA, CurModule.Values);
4646 #line 2106 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4653 #line 2109 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4660 #line 2115 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4662 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4663 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4664 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4665 free((yyvsp[0].StrVal));
4667 if (AsmSoFar.empty())
4668 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4670 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4676 #line 2128 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4678 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4679 free((yyvsp[0].StrVal));
4684 #line 2132 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4686 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4687 free((yyvsp[0].StrVal));
4692 #line 2139 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4694 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4695 free((yyvsp[0].StrVal));
4701 #line 2144 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4703 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4704 free((yyvsp[0].StrVal));
4710 #line 2149 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4717 #line 2158 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4719 if (!UpRefs.empty())
4720 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4721 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4722 GEN_ERROR("void typed arguments are invalid");
4723 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4724 (yyval.ArgList) = (yyvsp[-4].ArgList);
4725 (yyvsp[-4].ArgList)->push_back(E);
4731 #line 2168 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4733 if (!UpRefs.empty())
4734 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4735 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4736 GEN_ERROR("void typed arguments are invalid");
4737 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4738 (yyval.ArgList) = new ArgListType;
4739 (yyval.ArgList)->push_back(E);
4745 #line 2179 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4747 (yyval.ArgList) = (yyvsp[0].ArgList);
4753 #line 2183 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4755 (yyval.ArgList) = (yyvsp[-2].ArgList);
4756 struct ArgListEntry E;
4757 E.Ty = new PATypeHolder(Type::VoidTy);
4759 E.Attrs = ParamAttr::None;
4760 (yyval.ArgList)->push_back(E);
4766 #line 2192 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4768 (yyval.ArgList) = new ArgListType;
4769 struct ArgListEntry E;
4770 E.Ty = new PATypeHolder(Type::VoidTy);
4772 E.Attrs = ParamAttr::None;
4773 (yyval.ArgList)->push_back(E);
4779 #line 2201 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4781 (yyval.ArgList) = 0;
4787 #line 2207 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4789 UnEscapeLexed((yyvsp[-6].StrVal));
4790 std::string FunctionName((yyvsp[-6].StrVal));
4791 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
4793 // Check the function result for abstractness if this is a define. We should
4794 // have no abstract types at this point
4795 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4796 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
4798 std::vector<const Type*> ParamTypeList;
4799 ParamAttrsVector Attrs;
4800 if ((yyvsp[-2].ParamAttrs) != ParamAttr::None) {
4801 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-2].ParamAttrs);
4802 Attrs.push_back(PAWI);
4804 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4806 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++index) {
4807 const Type* Ty = I->Ty->get();
4808 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4809 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4810 ParamTypeList.push_back(Ty);
4811 if (Ty != Type::VoidTy)
4812 if (I->Attrs != ParamAttr::None) {
4813 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4814 Attrs.push_back(PAWI);
4819 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4820 if (isVarArg) ParamTypeList.pop_back();
4822 ParamAttrsList *PAL = 0;
4824 PAL = ParamAttrsList::get(Attrs);
4826 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg, PAL);
4827 const PointerType *PFT = PointerType::get(FT);
4828 delete (yyvsp[-7].TypeVal);
4831 if (!FunctionName.empty()) {
4832 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4834 ID = ValID::createGlobalID(CurModule.Values.size());
4838 // See if this function was forward referenced. If so, recycle the object.
4839 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4840 // Move the function to the end of the list, from whereever it was
4841 // previously inserted.
4842 Fn = cast<Function>(FWRef);
4843 CurModule.CurrentModule->getFunctionList().remove(Fn);
4844 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4845 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4846 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4847 if (Fn->getFunctionType() != FT) {
4848 // The existing function doesn't have the same type. This is an overload
4850 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4851 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4852 // Neither the existing or the current function is a declaration and they
4853 // have the same name and same type. Clearly this is a redefinition.
4854 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4855 } if (Fn->isDeclaration()) {
4856 // Make sure to strip off any argument names so we can't get conflicts.
4857 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4861 } else { // Not already defined?
4862 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4863 CurModule.CurrentModule);
4865 InsertValue(Fn, CurModule.Values);
4868 CurFun.FunctionStart(Fn);
4870 if (CurFun.isDeclare) {
4871 // If we have declaration, always overwrite linkage. This will allow us to
4872 // correctly handle cases, when pointer to function is passed as argument to
4873 // another function.
4874 Fn->setLinkage(CurFun.Linkage);
4875 Fn->setVisibility(CurFun.Visibility);
4877 Fn->setCallingConv((yyvsp[-8].UIntVal));
4878 Fn->setAlignment((yyvsp[0].UIntVal));
4879 if ((yyvsp[-1].StrVal)) {
4880 Fn->setSection((yyvsp[-1].StrVal));
4881 free((yyvsp[-1].StrVal));
4884 // Add all of the arguments we parsed to the function...
4885 if ((yyvsp[-4].ArgList)) { // Is null if empty...
4886 if (isVarArg) { // Nuke the last entry
4887 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0 &&
4888 "Not a varargs marker!");
4889 delete (yyvsp[-4].ArgList)->back().Ty;
4890 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
4892 Function::arg_iterator ArgIt = Fn->arg_begin();
4893 Function::arg_iterator ArgEnd = Fn->arg_end();
4895 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin();
4896 I != (yyvsp[-4].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4897 delete I->Ty; // Delete the typeholder...
4898 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4904 delete (yyvsp[-4].ArgList); // We're now done with the argument list
4911 #line 2330 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4913 (yyval.FunctionVal) = CurFun.CurrentFunction;
4915 // Make sure that we keep track of the linkage type even if there was a
4916 // previous "declare".
4917 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4918 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
4923 #line 2341 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4925 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4931 #line 2346 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4933 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4934 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
4935 (yyval.FunctionVal) = CurFun.CurrentFunction;
4936 CurFun.FunctionDone();
4942 #line 2358 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4944 (yyval.BoolVal) = false;
4950 #line 2362 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4952 (yyval.BoolVal) = true;
4958 #line 2367 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4959 { // A reference to a direct constant
4960 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4966 #line 2371 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4968 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4974 #line 2375 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4975 { // Perhaps it's an FP constant?
4976 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4982 #line 2379 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4984 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
4990 #line 2383 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
4992 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
4998 #line 2387 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5000 (yyval.ValIDVal) = ValID::createNull();
5006 #line 2391 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5008 (yyval.ValIDVal) = ValID::createUndef();
5014 #line 2395 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5015 { // A vector zero constant.
5016 (yyval.ValIDVal) = ValID::createZeroInit();
5022 #line 2399 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5023 { // Nonempty unsized packed vector
5024 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
5025 int NumElements = (yyvsp[-1].ConstVector)->size();
5027 VectorType* pt = VectorType::get(ETy, NumElements);
5028 PATypeHolder* PTy = new PATypeHolder(
5036 // Verify all elements are correct type!
5037 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
5038 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
5039 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5040 ETy->getDescription() +"' as required!\nIt is of type '" +
5041 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
5044 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[-1].ConstVector)));
5045 delete PTy; delete (yyvsp[-1].ConstVector);
5051 #line 2424 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5053 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
5059 #line 2428 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5061 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
5062 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
5063 End = UnEscapeLexed((yyvsp[0].StrVal), true);
5064 std::string Constraints = std::string((yyvsp[0].StrVal), End);
5065 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
5066 free((yyvsp[-2].StrVal));
5067 free((yyvsp[0].StrVal));
5073 #line 2442 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5074 { // Is it an integer reference...?
5075 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
5081 #line 2446 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5083 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
5089 #line 2450 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5090 { // Is it a named reference...?
5091 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
5097 #line 2454 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5098 { // Is it a named reference...?
5099 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
5105 #line 2466 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5107 if (!UpRefs.empty())
5108 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5109 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5110 delete (yyvsp[-1].TypeVal);
5116 #line 2475 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5118 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
5124 #line 2479 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5125 { // Do not allow functions with 0 basic blocks
5126 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
5132 #line 2488 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5134 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
5136 InsertValue((yyvsp[0].TermInstVal));
5137 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
5138 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
5144 #line 2497 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5146 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
5147 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5148 if (CI2->getParent() == 0)
5149 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
5150 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
5151 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
5157 #line 2506 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5158 { // Empty space between instruction lists
5159 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5165 #line 2510 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5166 { // Labelled (named) basic block
5167 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName((yyvsp[0].StrVal)));
5173 #line 2515 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5174 { // Return with a result...
5175 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
5181 #line 2519 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5182 { // Return with no result...
5183 (yyval.TermInstVal) = new ReturnInst();
5189 #line 2523 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5190 { // Unconditional Branch...
5191 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5193 (yyval.TermInstVal) = new BranchInst(tmpBB);
5198 #line 2528 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5200 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
5201 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
5203 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
5205 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
5207 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5212 #line 2538 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5214 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
5216 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
5218 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
5219 (yyval.TermInstVal) = S;
5221 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
5222 E = (yyvsp[-1].JumpTable)->end();
5223 for (; I != E; ++I) {
5224 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5225 S->addCase(CI, I->second);
5227 GEN_ERROR("Switch case is constant, but not a simple integer");
5229 delete (yyvsp[-1].JumpTable);
5235 #line 2557 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5237 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
5239 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
5241 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
5242 (yyval.TermInstVal) = S;
5248 #line 2567 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5251 // Handle the short syntax
5252 const PointerType *PFTy = 0;
5253 const FunctionType *Ty = 0;
5254 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
5255 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5256 // Pull out the types of all of the arguments...
5257 std::vector<const Type*> ParamTypes;
5258 ParamAttrsVector Attrs;
5259 if ((yyvsp[-6].ParamAttrs) != ParamAttr::None) {
5260 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[-6].ParamAttrs);
5261 Attrs.push_back(PAWI);
5263 ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end();
5265 for (; I != E; ++I, ++index) {
5266 const Type *Ty = I->Val->getType();
5267 if (Ty == Type::VoidTy)
5268 GEN_ERROR("Short call syntax cannot be used with varargs");
5269 ParamTypes.push_back(Ty);
5270 if (I->Attrs != ParamAttr::None) {
5271 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5272 Attrs.push_back(PAWI);
5276 ParamAttrsList *PAL = 0;
5278 PAL = ParamAttrsList::get(Attrs);
5279 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, PAL);
5280 PFTy = PointerType::get(Ty);
5283 delete (yyvsp[-11].TypeVal);
5285 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
5287 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
5289 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
5292 // Check the arguments
5294 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
5295 // Make sure no arguments is a good thing!
5296 if (Ty->getNumParams() != 0)
5297 GEN_ERROR("No arguments passed to a function that "
5298 "expects arguments");
5299 } else { // Has arguments?
5300 // Loop through FunctionType's arguments and ensure they are specified
5302 FunctionType::param_iterator I = Ty->param_begin();
5303 FunctionType::param_iterator E = Ty->param_end();
5304 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
5306 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5307 if (ArgI->Val->getType() != *I)
5308 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5309 (*I)->getDescription() + "'");
5310 Args.push_back(ArgI->Val);
5313 if (Ty->isVarArg()) {
5315 for (; ArgI != ArgE; ++ArgI)
5316 Args.push_back(ArgI->Val); // push the remaining varargs
5317 } else if (I != E || ArgI != ArgE)
5318 GEN_ERROR("Invalid number of parameters detected");
5321 // Create the InvokeInst
5322 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
5323 II->setCallingConv((yyvsp[-12].UIntVal));
5324 (yyval.TermInstVal) = II;
5325 delete (yyvsp[-8].ValueRefList);
5331 #line 2646 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5333 (yyval.TermInstVal) = new UnwindInst();
5339 #line 2650 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5341 (yyval.TermInstVal) = new UnreachableInst();
5347 #line 2657 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5349 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5350 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5353 GEN_ERROR("May only switch on a constant pool value");
5355 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5357 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5362 #line 2668 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5364 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5365 Constant *V = cast<Constant>(getExistingVal((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5369 GEN_ERROR("May only switch on a constant pool value");
5371 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5373 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5378 #line 2681 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5380 // Is this definition named?? if so, assign the name...
5381 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5383 InsertValue((yyvsp[0].InstVal));
5384 (yyval.InstVal) = (yyvsp[0].InstVal);
5390 #line 2691 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5391 { // Used for PHI nodes
5392 if (!UpRefs.empty())
5393 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
5394 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5395 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5397 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5399 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5400 delete (yyvsp[-5].TypeVal);
5405 #line 2702 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5407 (yyval.PHIList) = (yyvsp[-6].PHIList);
5408 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5410 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5412 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5417 #line 2712 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5419 if (!UpRefs.empty())
5420 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5421 // Used for call and invoke instructions
5422 (yyval.ValueRefList) = new ValueRefList();
5423 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5424 (yyval.ValueRefList)->push_back(E);
5425 delete (yyvsp[-2].TypeVal);
5430 #line 2721 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5432 if (!UpRefs.empty())
5433 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5434 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5435 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5436 (yyval.ValueRefList)->push_back(E);
5437 delete (yyvsp[-2].TypeVal);
5443 #line 2730 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5444 { (yyval.ValueRefList) = new ValueRefList(); ;}
5448 #line 2733 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5449 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5453 #line 2734 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5455 (yyval.ValueList) = (yyvsp[-2].ValueList);
5456 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5462 #line 2741 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5464 (yyval.BoolVal) = true;
5470 #line 2745 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5472 (yyval.BoolVal) = false;
5478 #line 2750 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5480 if (!UpRefs.empty())
5481 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5482 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5483 !isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5485 "Arithmetic operator requires integer, FP, or packed operands");
5486 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()) &&
5487 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5488 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5489 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5490 GEN_ERROR("Remainder not supported on vector types");
5491 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5493 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5495 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5496 if ((yyval.InstVal) == 0)
5497 GEN_ERROR("binary operator returned null");
5498 delete (yyvsp[-3].TypeVal);
5503 #line 2771 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5505 if (!UpRefs.empty())
5506 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5507 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5508 if (Instruction::isShift((yyvsp[-4].BinaryOpVal)) || !isa<VectorType>((yyvsp[-3].TypeVal)->get()) ||
5509 !cast<VectorType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
5510 GEN_ERROR("Logical operator requires integral operands");
5512 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5514 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5516 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5517 if ((yyval.InstVal) == 0)
5518 GEN_ERROR("binary operator returned null");
5519 delete (yyvsp[-3].TypeVal);
5524 #line 2788 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5526 if (!UpRefs.empty())
5527 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5528 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5529 GEN_ERROR("Vector types not supported by icmp instruction");
5530 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5532 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5534 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5535 if ((yyval.InstVal) == 0)
5536 GEN_ERROR("icmp operator returned null");
5537 delete (yyvsp[-3].TypeVal);
5542 #line 2802 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5544 if (!UpRefs.empty())
5545 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5546 if (isa<VectorType>((*(yyvsp[-3].TypeVal)).get()))
5547 GEN_ERROR("Vector types not supported by fcmp instruction");
5548 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5550 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5552 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5553 if ((yyval.InstVal) == 0)
5554 GEN_ERROR("fcmp operator returned null");
5555 delete (yyvsp[-3].TypeVal);
5560 #line 2816 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5562 if (!UpRefs.empty())
5563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5564 Value* Val = (yyvsp[-2].ValueVal);
5565 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5566 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
5567 GEN_ERROR("invalid cast opcode for cast from '" +
5568 Val->getType()->getDescription() + "' to '" +
5569 DestTy->getDescription() + "'");
5570 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5571 delete (yyvsp[0].TypeVal);
5576 #line 2828 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5578 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
5579 GEN_ERROR("select condition must be boolean");
5580 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5581 GEN_ERROR("select value types should match");
5582 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5588 #line 2836 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5590 if (!UpRefs.empty())
5591 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5592 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5593 delete (yyvsp[0].TypeVal);
5599 #line 2843 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5601 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5602 GEN_ERROR("Invalid extractelement operands");
5603 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5609 #line 2849 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5611 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5612 GEN_ERROR("Invalid insertelement operands");
5613 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5619 #line 2855 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5621 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5622 GEN_ERROR("Invalid shufflevector operands");
5623 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5629 #line 2861 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5631 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5632 if (!Ty->isFirstClassType())
5633 GEN_ERROR("PHI node operands must be of first class type");
5634 (yyval.InstVal) = new PHINode(Ty);
5635 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5636 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5637 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
5638 GEN_ERROR("All elements of a PHI node must be of the same type");
5639 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5640 (yyvsp[0].PHIList)->pop_front();
5642 delete (yyvsp[0].PHIList); // Free the list...
5648 #line 2877 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5651 // Handle the short syntax
5652 const PointerType *PFTy = 0;
5653 const FunctionType *Ty = 0;
5654 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
5655 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5656 // Pull out the types of all of the arguments...
5657 std::vector<const Type*> ParamTypes;
5658 ParamAttrsVector Attrs;
5659 if ((yyvsp[0].ParamAttrs) != ParamAttr::None) {
5660 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[0].ParamAttrs);
5661 Attrs.push_back(PAWI);
5664 ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end();
5665 for (; I != E; ++I, ++index) {
5666 const Type *Ty = I->Val->getType();
5667 if (Ty == Type::VoidTy)
5668 GEN_ERROR("Short call syntax cannot be used with varargs");
5669 ParamTypes.push_back(Ty);
5670 if (I->Attrs != ParamAttr::None) {
5671 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
5672 Attrs.push_back(PAWI);
5676 ParamAttrsList *PAL = 0;
5678 PAL = ParamAttrsList::get(Attrs);
5680 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, PAL);
5681 PFTy = PointerType::get(Ty);
5684 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
5687 // Check for call to invalid intrinsic to avoid crashing later.
5688 if (Function *theF = dyn_cast<Function>(V)) {
5689 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
5690 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
5691 !theF->getIntrinsicID(true))
5692 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
5693 theF->getName() + "'");
5696 // Check the arguments
5698 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
5699 // Make sure no arguments is a good thing!
5700 if (Ty->getNumParams() != 0)
5701 GEN_ERROR("No arguments passed to a function that "
5702 "expects arguments");
5703 } else { // Has arguments?
5704 // Loop through FunctionType's arguments and ensure they are specified
5707 FunctionType::param_iterator I = Ty->param_begin();
5708 FunctionType::param_iterator E = Ty->param_end();
5709 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
5711 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5712 if (ArgI->Val->getType() != *I)
5713 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5714 (*I)->getDescription() + "'");
5715 Args.push_back(ArgI->Val);
5717 if (Ty->isVarArg()) {
5719 for (; ArgI != ArgE; ++ArgI)
5720 Args.push_back(ArgI->Val); // push the remaining varargs
5721 } else if (I != E || ArgI != ArgE)
5722 GEN_ERROR("Invalid number of parameters detected");
5724 // Create the call node
5725 CallInst *CI = new CallInst(V, &Args[0], Args.size());
5726 CI->setTailCall((yyvsp[-7].BoolVal));
5727 CI->setCallingConv((yyvsp[-6].UIntVal));
5728 (yyval.InstVal) = CI;
5729 delete (yyvsp[-2].ValueRefList);
5730 delete (yyvsp[-5].TypeVal);
5736 #line 2961 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5738 (yyval.InstVal) = (yyvsp[0].InstVal);
5744 #line 2966 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5746 (yyval.BoolVal) = true;
5752 #line 2970 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5754 (yyval.BoolVal) = false;
5760 #line 2977 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5762 if (!UpRefs.empty())
5763 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5764 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5765 delete (yyvsp[-1].TypeVal);
5771 #line 2984 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5773 if (!UpRefs.empty())
5774 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5775 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5777 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5778 delete (yyvsp[-4].TypeVal);
5783 #line 2992 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5785 if (!UpRefs.empty())
5786 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5787 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5788 delete (yyvsp[-1].TypeVal);
5794 #line 2999 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5796 if (!UpRefs.empty())
5797 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5798 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5800 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5801 delete (yyvsp[-4].TypeVal);
5806 #line 3007 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5808 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5809 GEN_ERROR("Trying to free nonpointer type " +
5810 (yyvsp[0].ValueVal)->getType()->getDescription() + "");
5811 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5817 #line 3015 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5819 if (!UpRefs.empty())
5820 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5821 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5822 GEN_ERROR("Can't load from nonpointer type: " +
5823 (*(yyvsp[-2].TypeVal))->getDescription());
5824 if (!cast<PointerType>((yyvsp[-2].TypeVal)->get())->getElementType()->isFirstClassType())
5825 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5826 (*(yyvsp[-2].TypeVal))->getDescription());
5827 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5829 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-4].BoolVal), (yyvsp[0].UIntVal));
5830 delete (yyvsp[-2].TypeVal);
5835 #line 3029 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5837 if (!UpRefs.empty())
5838 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5839 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-2].TypeVal)->get());
5841 GEN_ERROR("Can't store to a nonpointer type: " +
5842 (*(yyvsp[-2].TypeVal))->getDescription());
5843 const Type *ElTy = PT->getElementType();
5844 if (ElTy != (yyvsp[-4].ValueVal)->getType())
5845 GEN_ERROR("Can't store '" + (yyvsp[-4].ValueVal)->getType()->getDescription() +
5846 "' into space of type '" + ElTy->getDescription() + "'");
5848 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5850 (yyval.InstVal) = new StoreInst((yyvsp[-4].ValueVal), tmpVal, (yyvsp[-6].BoolVal), (yyvsp[0].UIntVal));
5851 delete (yyvsp[-2].TypeVal);
5856 #line 3046 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
5858 if (!UpRefs.empty())
5859 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5860 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5861 GEN_ERROR("getelementptr insn requires pointer operand");
5863 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size(), true))
5864 GEN_ERROR("Invalid getelementptr indices for type '" +
5865 (*(yyvsp[-2].TypeVal))->getDescription()+ "'");
5866 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5868 (yyval.InstVal) = new GetElementPtrInst(tmpVal, &(*(yyvsp[0].ValueList))[0], (yyvsp[0].ValueList)->size());
5869 delete (yyvsp[-2].TypeVal);
5870 delete (yyvsp[0].ValueList);
5878 /* Line 1126 of yacc.c. */
5879 #line 5880 "llvmAsmParser.tab.c"
5885 YY_STACK_PRINT (yyss, yyssp);
5890 /* Now `shift' the result of the reduction. Determine what state
5891 that goes to, based on the state we popped back to and the rule
5892 number reduced by. */
5896 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5897 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5898 yystate = yytable[yystate];
5900 yystate = yydefgoto[yyn - YYNTOKENS];
5905 /*------------------------------------.
5906 | yyerrlab -- here on detecting error |
5907 `------------------------------------*/
5909 /* If not already recovering from an error, report this error. */
5914 yyn = yypact[yystate];
5916 if (YYPACT_NINF < yyn && yyn < YYLAST)
5918 int yytype = YYTRANSLATE (yychar);
5919 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5920 YYSIZE_T yysize = yysize0;
5922 int yysize_overflow = 0;
5924 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5925 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5929 /* This is so xgettext sees the translatable formats that are
5930 constructed on the fly. */
5931 YY_("syntax error, unexpected %s");
5932 YY_("syntax error, unexpected %s, expecting %s");
5933 YY_("syntax error, unexpected %s, expecting %s or %s");
5934 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5935 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5939 static char const yyunexpected[] = "syntax error, unexpected %s";
5940 static char const yyexpecting[] = ", expecting %s";
5941 static char const yyor[] = " or %s";
5942 char yyformat[sizeof yyunexpected
5943 + sizeof yyexpecting - 1
5944 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5945 * (sizeof yyor - 1))];
5946 char const *yyprefix = yyexpecting;
5948 /* Start YYX at -YYN if negative to avoid negative indexes in
5950 int yyxbegin = yyn < 0 ? -yyn : 0;
5952 /* Stay within bounds of both yycheck and yytname. */
5953 int yychecklim = YYLAST - yyn;
5954 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5957 yyarg[0] = yytname[yytype];
5958 yyfmt = yystpcpy (yyformat, yyunexpected);
5960 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5961 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5963 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5967 yyformat[sizeof yyunexpected - 1] = '\0';
5970 yyarg[yycount++] = yytname[yyx];
5971 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5972 yysize_overflow |= yysize1 < yysize;
5974 yyfmt = yystpcpy (yyfmt, yyprefix);
5978 yyf = YY_(yyformat);
5979 yysize1 = yysize + yystrlen (yyf);
5980 yysize_overflow |= yysize1 < yysize;
5983 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5984 yymsg = (char *) YYSTACK_ALLOC (yysize);
5987 /* Avoid sprintf, as that infringes on the user's name space.
5988 Don't have undefined behavior even if the translation
5989 produced a string with the wrong number of "%s"s. */
5992 while ((*yyp = *yyf))
5994 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5996 yyp += yytnamerr (yyp, yyarg[yyi++]);
6006 YYSTACK_FREE (yymsg);
6010 yyerror (YY_("syntax error"));
6011 goto yyexhaustedlab;
6015 #endif /* YYERROR_VERBOSE */
6016 yyerror (YY_("syntax error"));
6021 if (yyerrstatus == 3)
6023 /* If just tried and failed to reuse look-ahead token after an
6024 error, discard it. */
6026 if (yychar <= YYEOF)
6028 /* Return failure if at end of input. */
6029 if (yychar == YYEOF)
6034 yydestruct ("Error: discarding", yytoken, &yylval);
6039 /* Else will try to reuse look-ahead token after shifting the error
6044 /*---------------------------------------------------.
6045 | yyerrorlab -- error raised explicitly by YYERROR. |
6046 `---------------------------------------------------*/
6049 /* Pacify compilers like GCC when the user code never invokes
6050 YYERROR and the label yyerrorlab therefore never appears in user
6061 /*-------------------------------------------------------------.
6062 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6063 `-------------------------------------------------------------*/
6065 yyerrstatus = 3; /* Each real token shifted decrements this. */
6069 yyn = yypact[yystate];
6070 if (yyn != YYPACT_NINF)
6073 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6081 /* Pop the current state because it cannot handle the error token. */
6086 yydestruct ("Error: popping", yystos[yystate], yyvsp);
6089 YY_STACK_PRINT (yyss, yyssp);
6098 /* Shift the error token. */
6099 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6105 /*-------------------------------------.
6106 | yyacceptlab -- YYACCEPT comes here. |
6107 `-------------------------------------*/
6112 /*-----------------------------------.
6113 | yyabortlab -- YYABORT comes here. |
6114 `-----------------------------------*/
6120 /*-------------------------------------------------.
6121 | yyexhaustedlab -- memory exhaustion comes here. |
6122 `-------------------------------------------------*/
6124 yyerror (YY_("memory exhausted"));
6130 if (yychar != YYEOF && yychar != YYEMPTY)
6131 yydestruct ("Cleanup: discarding lookahead",
6133 while (yyssp != yyss)
6135 yydestruct ("Cleanup: popping",
6136 yystos[*yyssp], yyvsp);
6141 YYSTACK_FREE (yyss);
6147 #line 3063 "/proj/llvm/llvm-2/lib/AsmParser/llvmAsmParser.y"
6150 // common code from the two 'RunVMAsmParser' functions
6151 static Module* RunParser(Module * M) {
6153 llvmAsmlineno = 1; // Reset the current line number...
6154 CurModule.CurrentModule = M;
6159 // Check to make sure the parser succeeded
6162 delete ParserResult;
6166 // Emit an error if there are any unresolved types left.
6167 if (!CurModule.LateResolveTypes.empty()) {
6168 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6169 if (DID.Type == ValID::LocalName) {
6170 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6172 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6175 delete ParserResult;
6179 // Emit an error if there are any unresolved values left.
6180 if (!CurModule.LateResolveValues.empty()) {
6181 Value *V = CurModule.LateResolveValues.back();
6182 std::map<Value*, std::pair<ValID, int> >::iterator I =
6183 CurModule.PlaceHolderInfo.find(V);
6185 if (I != CurModule.PlaceHolderInfo.end()) {
6186 ValID &DID = I->second.first;
6187 if (DID.Type == ValID::LocalName) {
6188 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6190 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6193 delete ParserResult;
6198 // Check to make sure that parsing produced a result
6202 // Reset ParserResult variable while saving its value for the result.
6203 Module *Result = ParserResult;
6209 void llvm::GenerateError(const std::string &message, int LineNo) {
6210 if (LineNo == -1) LineNo = llvmAsmlineno;
6211 // TODO: column number in exception
6213 TheParseError->setError(CurFilename, message, LineNo);
6217 int yyerror(const char *ErrorMsg) {
6219 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6220 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6221 std::string errMsg = where + "error: " + std::string(ErrorMsg);
6222 if (yychar != YYEMPTY && yychar != 0)
6223 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
6225 GenerateError(errMsg);