2 /* A Bison parser, made from /Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
35 #define STRINGCONSTANT 278
36 #define IMPLEMENTATION 279
37 #define ZEROINITIALIZER 280
62 #define POINTERSIZE 305
71 #define FASTCC_TOK 314
72 #define COLDCC_TOK 315
78 #define UNREACHABLE 321
98 #define GETELEMENTPTR 341
105 #define VAARG_old 348
106 #define VANEXT_old 349
108 #line 14 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
110 #include "ParserInternals.h"
111 #include "llvm/CallingConv.h"
112 #include "llvm/Instructions.h"
113 #include "llvm/Module.h"
114 #include "llvm/SymbolTable.h"
115 #include "llvm/Support/GetElementPtrTypeIterator.h"
116 #include "llvm/ADT/STLExtras.h"
117 #include "llvm/Support/MathExtras.h"
123 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
124 int yylex(); // declaration" of xxx warnings.
128 std::string CurFilename;
130 using namespace llvm;
132 static Module *ParserResult;
134 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
135 // relating to upreferences in the input stream.
137 //#define DEBUG_UPREFS 1
139 #define UR_OUT(X) std::cerr << X
144 #define YYERROR_VERBOSE 1
146 static bool ObsoleteVarArgs;
147 static bool NewVarArgs;
148 static BasicBlock *CurBB;
149 static GlobalVariable *CurGV;
152 // This contains info used when building the body of a function. It is
153 // destroyed when the function is completed.
155 typedef std::vector<Value *> ValueList; // Numbered defs
157 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
158 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
160 static struct PerModuleInfo {
161 Module *CurrentModule;
162 std::map<const Type *, ValueList> Values; // Module level numbered definitions
163 std::map<const Type *,ValueList> LateResolveValues;
164 std::vector<PATypeHolder> Types;
165 std::map<ValID, PATypeHolder> LateResolveTypes;
167 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
168 /// how they were referenced and one which line of the input they came from so
169 /// that we can resolve them later and print error messages as appropriate.
170 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
172 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
173 // references to global values. Global values may be referenced before they
174 // are defined, and if so, the temporary object that they represent is held
175 // here. This is used for forward references of GlobalValues.
177 typedef std::map<std::pair<const PointerType *,
178 ValID>, GlobalValue*> GlobalRefsType;
179 GlobalRefsType GlobalRefs;
182 // If we could not resolve some functions at function compilation time
183 // (calls to functions before they are defined), resolve them now... Types
184 // are resolved when the constant pool has been completely parsed.
186 ResolveDefinitions(LateResolveValues);
188 // Check to make sure that all global value forward references have been
191 if (!GlobalRefs.empty()) {
192 std::string UndefinedReferences = "Unresolved global references exist:\n";
194 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
196 UndefinedReferences += " " + I->first.first->getDescription() + " " +
197 I->first.second.getName() + "\n";
199 ThrowException(UndefinedReferences);
202 Values.clear(); // Clear out function local definitions
208 // GetForwardRefForGlobal - Check to see if there is a forward reference
209 // for this global. If so, remove it from the GlobalRefs map and return it.
210 // If not, just return null.
211 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
212 // Check to see if there is a forward reference to this global variable...
213 // if there is, eliminate it and patch the reference to use the new def'n.
214 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
215 GlobalValue *Ret = 0;
216 if (I != GlobalRefs.end()) {
224 static struct PerFunctionInfo {
225 Function *CurrentFunction; // Pointer to current function being created
227 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
228 std::map<const Type*, ValueList> LateResolveValues;
229 bool isDeclare; // Is this function a forward declararation?
231 /// BBForwardRefs - When we see forward references to basic blocks, keep
232 /// track of them here.
233 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
234 std::vector<BasicBlock*> NumberedBlocks;
237 inline PerFunctionInfo() {
242 inline void FunctionStart(Function *M) {
247 void FunctionDone() {
248 NumberedBlocks.clear();
250 // Any forward referenced blocks left?
251 if (!BBForwardRefs.empty())
252 ThrowException("Undefined reference to label " +
253 BBForwardRefs.begin()->first->getName());
255 // Resolve all forward references now.
256 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
258 Values.clear(); // Clear out function local definitions
262 } CurFun; // Info for the current function...
264 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
267 //===----------------------------------------------------------------------===//
268 // Code to handle definitions of all the types
269 //===----------------------------------------------------------------------===//
271 static int InsertValue(Value *V,
272 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
273 if (V->hasName()) return -1; // Is this a numbered definition?
275 // Yes, insert the value into the value table...
276 ValueList &List = ValueTab[V->getType()];
278 return List.size()-1;
281 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
283 case ValID::NumberVal: // Is it a numbered definition?
284 // Module constants occupy the lowest numbered slots...
285 if ((unsigned)D.Num < CurModule.Types.size())
286 return CurModule.Types[(unsigned)D.Num];
288 case ValID::NameVal: // Is it a named definition?
289 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
290 D.destroy(); // Free old strdup'd memory...
295 ThrowException("Internal parser error: Invalid symbol type reference!");
298 // If we reached here, we referenced either a symbol that we don't know about
299 // or an id number that hasn't been read yet. We may be referencing something
300 // forward, so just create an entry to be resolved later and get to it...
302 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
305 if (inFunctionScope()) {
306 if (D.Type == ValID::NameVal)
307 ThrowException("Reference to an undefined type: '" + D.getName() + "'");
309 ThrowException("Reference to an undefined type: #" + itostr(D.Num));
312 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
313 if (I != CurModule.LateResolveTypes.end())
316 Type *Typ = OpaqueType::get();
317 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
321 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
322 SymbolTable &SymTab =
323 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
324 CurModule.CurrentModule->getSymbolTable();
325 return SymTab.lookup(Ty, Name);
328 // getValNonImprovising - Look up the value specified by the provided type and
329 // the provided ValID. If the value exists and has already been defined, return
330 // it. Otherwise return null.
332 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
333 if (isa<FunctionType>(Ty))
334 ThrowException("Functions are not values and "
335 "must be referenced as pointers");
338 case ValID::NumberVal: { // Is it a numbered definition?
339 unsigned Num = (unsigned)D.Num;
341 // Module constants occupy the lowest numbered slots...
342 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
343 if (VI != CurModule.Values.end()) {
344 if (Num < VI->second.size())
345 return VI->second[Num];
346 Num -= VI->second.size();
349 // Make sure that our type is within bounds
350 VI = CurFun.Values.find(Ty);
351 if (VI == CurFun.Values.end()) return 0;
353 // Check that the number is within bounds...
354 if (VI->second.size() <= Num) return 0;
356 return VI->second[Num];
359 case ValID::NameVal: { // Is it a named definition?
360 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
361 if (N == 0) return 0;
363 D.destroy(); // Free old strdup'd memory...
367 // Check to make sure that "Ty" is an integral type, and that our
368 // value will fit into the specified type...
369 case ValID::ConstSIntVal: // Is it a constant pool reference??
370 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64))
371 ThrowException("Signed integral constant '" +
372 itostr(D.ConstPool64) + "' is invalid for type '" +
373 Ty->getDescription() + "'!");
374 return ConstantSInt::get(Ty, D.ConstPool64);
376 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
377 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
378 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
379 ThrowException("Integral constant '" + utostr(D.UConstPool64) +
380 "' is invalid or out of range!");
381 } else { // This is really a signed reference. Transmogrify.
382 return ConstantSInt::get(Ty, D.ConstPool64);
385 return ConstantUInt::get(Ty, D.UConstPool64);
388 case ValID::ConstFPVal: // Is it a floating point const pool reference?
389 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
390 ThrowException("FP constant invalid for type!!");
391 return ConstantFP::get(Ty, D.ConstPoolFP);
393 case ValID::ConstNullVal: // Is it a null value?
394 if (!isa<PointerType>(Ty))
395 ThrowException("Cannot create a a non pointer null!");
396 return ConstantPointerNull::get(cast<PointerType>(Ty));
398 case ValID::ConstUndefVal: // Is it an undef value?
399 return UndefValue::get(Ty);
401 case ValID::ConstantVal: // Fully resolved constant?
402 if (D.ConstantValue->getType() != Ty)
403 ThrowException("Constant expression type different from required type!");
404 return D.ConstantValue;
407 assert(0 && "Unhandled case!");
411 assert(0 && "Unhandled case!");
415 // getVal - This function is identical to getValNonImprovising, except that if a
416 // value is not already defined, it "improvises" by creating a placeholder var
417 // that looks and acts just like the requested variable. When the value is
418 // defined later, all uses of the placeholder variable are replaced with the
421 static Value *getVal(const Type *Ty, const ValID &ID) {
422 if (Ty == Type::LabelTy)
423 ThrowException("Cannot use a basic block here");
425 // See if the value has already been defined.
426 Value *V = getValNonImprovising(Ty, ID);
429 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty))
430 ThrowException("Invalid use of a composite type!");
432 // If we reached here, we referenced either a symbol that we don't know about
433 // or an id number that hasn't been read yet. We may be referencing something
434 // forward, so just create an entry to be resolved later and get to it...
436 V = new Argument(Ty);
438 // Remember where this forward reference came from. FIXME, shouldn't we try
439 // to recycle these things??
440 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
443 if (inFunctionScope())
444 InsertValue(V, CurFun.LateResolveValues);
446 InsertValue(V, CurModule.LateResolveValues);
450 /// getBBVal - This is used for two purposes:
451 /// * If isDefinition is true, a new basic block with the specified ID is being
453 /// * If isDefinition is true, this is a reference to a basic block, which may
454 /// or may not be a forward reference.
456 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
457 assert(inFunctionScope() && "Can't get basic block at global scope!");
462 default: ThrowException("Illegal label reference " + ID.getName());
463 case ValID::NumberVal: // Is it a numbered definition?
464 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
465 CurFun.NumberedBlocks.resize(ID.Num+1);
466 BB = CurFun.NumberedBlocks[ID.Num];
468 case ValID::NameVal: // Is it a named definition?
470 if (Value *N = CurFun.CurrentFunction->
471 getSymbolTable().lookup(Type::LabelTy, Name))
472 BB = cast<BasicBlock>(N);
476 // See if the block has already been defined.
478 // If this is the definition of the block, make sure the existing value was
479 // just a forward reference. If it was a forward reference, there will be
480 // an entry for it in the PlaceHolderInfo map.
481 if (isDefinition && !CurFun.BBForwardRefs.erase(BB))
482 // The existing value was a definition, not a forward reference.
483 ThrowException("Redefinition of label " + ID.getName());
485 ID.destroy(); // Free strdup'd memory.
489 // Otherwise this block has not been seen before.
490 BB = new BasicBlock("", CurFun.CurrentFunction);
491 if (ID.Type == ValID::NameVal) {
492 BB->setName(ID.Name);
494 CurFun.NumberedBlocks[ID.Num] = BB;
497 // If this is not a definition, keep track of it so we can use it as a forward
500 // Remember where this forward reference came from.
501 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
503 // The forward declaration could have been inserted anywhere in the
504 // function: insert it into the correct place now.
505 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
506 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
513 //===----------------------------------------------------------------------===//
514 // Code to handle forward references in instructions
515 //===----------------------------------------------------------------------===//
517 // This code handles the late binding needed with statements that reference
518 // values not defined yet... for example, a forward branch, or the PHI node for
521 // This keeps a table (CurFun.LateResolveValues) of all such forward references
522 // and back patchs after we are done.
525 // ResolveDefinitions - If we could not resolve some defs at parsing
526 // time (forward branches, phi functions for loops, etc...) resolve the
530 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
531 std::map<const Type*,ValueList> *FutureLateResolvers) {
532 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
533 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
534 E = LateResolvers.end(); LRI != E; ++LRI) {
535 ValueList &List = LRI->second;
536 while (!List.empty()) {
537 Value *V = List.back();
540 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
541 CurModule.PlaceHolderInfo.find(V);
542 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
544 ValID &DID = PHI->second.first;
546 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
548 V->replaceAllUsesWith(TheRealValue);
550 CurModule.PlaceHolderInfo.erase(PHI);
551 } else if (FutureLateResolvers) {
552 // Functions have their unresolved items forwarded to the module late
554 InsertValue(V, *FutureLateResolvers);
556 if (DID.Type == ValID::NameVal)
557 ThrowException("Reference to an invalid definition: '" +DID.getName()+
558 "' of type '" + V->getType()->getDescription() + "'",
561 ThrowException("Reference to an invalid definition: #" +
562 itostr(DID.Num) + " of type '" +
563 V->getType()->getDescription() + "'",
569 LateResolvers.clear();
572 // ResolveTypeTo - A brand new type was just declared. This means that (if
573 // name is not null) things referencing Name can be resolved. Otherwise, things
574 // refering to the number can be resolved. Do this now.
576 static void ResolveTypeTo(char *Name, const Type *ToTy) {
578 if (Name) D = ValID::create(Name);
579 else D = ValID::create((int)CurModule.Types.size());
581 std::map<ValID, PATypeHolder>::iterator I =
582 CurModule.LateResolveTypes.find(D);
583 if (I != CurModule.LateResolveTypes.end()) {
584 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
585 CurModule.LateResolveTypes.erase(I);
589 // setValueName - Set the specified value to the name given. The name may be
590 // null potentially, in which case this is a noop. The string passed in is
591 // assumed to be a malloc'd string buffer, and is free'd by this function.
593 static void setValueName(Value *V, char *NameStr) {
595 std::string Name(NameStr); // Copy string
596 free(NameStr); // Free old string
598 if (V->getType() == Type::VoidTy)
599 ThrowException("Can't assign name '" + Name+"' to value with void type!");
601 assert(inFunctionScope() && "Must be in function scope!");
602 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
603 if (ST.lookup(V->getType(), Name))
604 ThrowException("Redefinition of value named '" + Name + "' in the '" +
605 V->getType()->getDescription() + "' type plane!");
612 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
613 /// this is a declaration, otherwise it is a definition.
614 static GlobalVariable *
615 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
616 bool isConstantGlobal, const Type *Ty,
617 Constant *Initializer) {
618 if (isa<FunctionType>(Ty))
619 ThrowException("Cannot declare global vars of function type!");
621 const PointerType *PTy = PointerType::get(Ty);
625 Name = NameStr; // Copy string
626 free(NameStr); // Free old string
629 // See if this global value was forward referenced. If so, recycle the
633 ID = ValID::create((char*)Name.c_str());
635 ID = ValID::create((int)CurModule.Values[PTy].size());
638 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
639 // Move the global to the end of the list, from whereever it was
640 // previously inserted.
641 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
642 CurModule.CurrentModule->getGlobalList().remove(GV);
643 CurModule.CurrentModule->getGlobalList().push_back(GV);
644 GV->setInitializer(Initializer);
645 GV->setLinkage(Linkage);
646 GV->setConstant(isConstantGlobal);
647 InsertValue(GV, CurModule.Values);
651 // If this global has a name, check to see if there is already a definition
652 // of this global in the module. If so, merge as appropriate. Note that
653 // this is really just a hack around problems in the CFE. :(
655 // We are a simple redefinition of a value, check to see if it is defined
656 // the same as the old one.
657 if (GlobalVariable *EGV =
658 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
659 // We are allowed to redefine a global variable in two circumstances:
660 // 1. If at least one of the globals is uninitialized or
661 // 2. If both initializers have the same value.
663 if (!EGV->hasInitializer() || !Initializer ||
664 EGV->getInitializer() == Initializer) {
666 // Make sure the existing global version gets the initializer! Make
667 // sure that it also gets marked const if the new version is.
668 if (Initializer && !EGV->hasInitializer())
669 EGV->setInitializer(Initializer);
670 if (isConstantGlobal)
671 EGV->setConstant(true);
672 EGV->setLinkage(Linkage);
676 ThrowException("Redefinition of global variable named '" + Name +
677 "' in the '" + Ty->getDescription() + "' type plane!");
681 // Otherwise there is no existing GV to use, create one now.
683 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
684 CurModule.CurrentModule);
685 InsertValue(GV, CurModule.Values);
689 // setTypeName - Set the specified type to the name given. The name may be
690 // null potentially, in which case this is a noop. The string passed in is
691 // assumed to be a malloc'd string buffer, and is freed by this function.
693 // This function returns true if the type has already been defined, but is
694 // allowed to be redefined in the specified context. If the name is a new name
695 // for the type plane, it is inserted and false is returned.
696 static bool setTypeName(const Type *T, char *NameStr) {
697 assert(!inFunctionScope() && "Can't give types function-local names!");
698 if (NameStr == 0) return false;
700 std::string Name(NameStr); // Copy string
701 free(NameStr); // Free old string
703 // We don't allow assigning names to void type
704 if (T == Type::VoidTy)
705 ThrowException("Can't assign name '" + Name + "' to the void type!");
707 // Set the type name, checking for conflicts as we do so.
708 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
710 if (AlreadyExists) { // Inserting a name that is already defined???
711 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
712 assert(Existing && "Conflict but no matching type?");
714 // There is only one case where this is allowed: when we are refining an
715 // opaque type. In this case, Existing will be an opaque type.
716 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
717 // We ARE replacing an opaque type!
718 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
722 // Otherwise, this is an attempt to redefine a type. That's okay if
723 // the redefinition is identical to the original. This will be so if
724 // Existing and T point to the same Type object. In this one case we
725 // allow the equivalent redefinition.
726 if (Existing == T) return true; // Yes, it's equal.
728 // Any other kind of (non-equivalent) redefinition is an error.
729 ThrowException("Redefinition of type named '" + Name + "' in the '" +
730 T->getDescription() + "' type plane!");
736 //===----------------------------------------------------------------------===//
737 // Code for handling upreferences in type names...
740 // TypeContains - Returns true if Ty directly contains E in it.
742 static bool TypeContains(const Type *Ty, const Type *E) {
743 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
744 E) != Ty->subtype_end();
749 // NestingLevel - The number of nesting levels that need to be popped before
750 // this type is resolved.
751 unsigned NestingLevel;
753 // LastContainedTy - This is the type at the current binding level for the
754 // type. Every time we reduce the nesting level, this gets updated.
755 const Type *LastContainedTy;
757 // UpRefTy - This is the actual opaque type that the upreference is
761 UpRefRecord(unsigned NL, OpaqueType *URTy)
762 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
766 // UpRefs - A list of the outstanding upreferences that need to be resolved.
767 static std::vector<UpRefRecord> UpRefs;
769 /// HandleUpRefs - Every time we finish a new layer of types, this function is
770 /// called. It loops through the UpRefs vector, which is a list of the
771 /// currently active types. For each type, if the up reference is contained in
772 /// the newly completed type, we decrement the level count. When the level
773 /// count reaches zero, the upreferenced type is the type that is passed in:
774 /// thus we can complete the cycle.
776 static PATypeHolder HandleUpRefs(const Type *ty) {
777 if (!ty->isAbstract()) return ty;
779 UR_OUT("Type '" << Ty->getDescription() <<
780 "' newly formed. Resolving upreferences.\n" <<
781 UpRefs.size() << " upreferences active!\n");
783 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
784 // to zero), we resolve them all together before we resolve them to Ty. At
785 // the end of the loop, if there is anything to resolve to Ty, it will be in
787 OpaqueType *TypeToResolve = 0;
789 for (unsigned i = 0; i != UpRefs.size(); ++i) {
790 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
791 << UpRefs[i].second->getDescription() << ") = "
792 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
793 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
794 // Decrement level of upreference
795 unsigned Level = --UpRefs[i].NestingLevel;
796 UpRefs[i].LastContainedTy = Ty;
797 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
798 if (Level == 0) { // Upreference should be resolved!
799 if (!TypeToResolve) {
800 TypeToResolve = UpRefs[i].UpRefTy;
802 UR_OUT(" * Resolving upreference for "
803 << UpRefs[i].second->getDescription() << "\n";
804 std::string OldName = UpRefs[i].UpRefTy->getDescription());
805 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
806 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
807 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
809 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
810 --i; // Do not skip the next element...
816 UR_OUT(" * Resolving upreference for "
817 << UpRefs[i].second->getDescription() << "\n";
818 std::string OldName = TypeToResolve->getDescription());
819 TypeToResolve->refineAbstractTypeTo(Ty);
826 // common code from the two 'RunVMAsmParser' functions
827 static Module * RunParser(Module * M) {
829 llvmAsmlineno = 1; // Reset the current line number...
830 ObsoleteVarArgs = false;
833 CurModule.CurrentModule = M;
834 yyparse(); // Parse the file, potentially throwing exception
836 Module *Result = ParserResult;
839 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
842 if ((F = Result->getNamedFunction("llvm.va_start"))
843 && F->getFunctionType()->getNumParams() == 0)
844 ObsoleteVarArgs = true;
845 if((F = Result->getNamedFunction("llvm.va_copy"))
846 && F->getFunctionType()->getNumParams() == 1)
847 ObsoleteVarArgs = true;
850 if (ObsoleteVarArgs && NewVarArgs)
851 ThrowException("This file is corrupt: it uses both new and old style varargs");
853 if(ObsoleteVarArgs) {
854 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
855 if (F->arg_size() != 0)
856 ThrowException("Obsolete va_start takes 0 argument!");
860 //bar = alloca typeof(foo)
864 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
865 const Type* ArgTy = F->getFunctionType()->getReturnType();
866 const Type* ArgTyPtr = PointerType::get(ArgTy);
867 Function* NF = Result->getOrInsertFunction("llvm.va_start",
868 RetTy, ArgTyPtr, (Type *)0);
870 while (!F->use_empty()) {
871 CallInst* CI = cast<CallInst>(F->use_back());
872 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
873 new CallInst(NF, bar, "", CI);
874 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
875 CI->replaceAllUsesWith(foo);
876 CI->getParent()->getInstList().erase(CI);
878 Result->getFunctionList().erase(F);
881 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
882 if(F->arg_size() != 1)
883 ThrowException("Obsolete va_end takes 1 argument!");
887 //bar = alloca 1 of typeof(foo)
889 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
890 const Type* ArgTy = F->getFunctionType()->getParamType(0);
891 const Type* ArgTyPtr = PointerType::get(ArgTy);
892 Function* NF = Result->getOrInsertFunction("llvm.va_end",
893 RetTy, ArgTyPtr, (Type *)0);
895 while (!F->use_empty()) {
896 CallInst* CI = cast<CallInst>(F->use_back());
897 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
898 new StoreInst(CI->getOperand(1), bar, CI);
899 new CallInst(NF, bar, "", CI);
900 CI->getParent()->getInstList().erase(CI);
902 Result->getFunctionList().erase(F);
905 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
906 if(F->arg_size() != 1)
907 ThrowException("Obsolete va_copy takes 1 argument!");
910 //a = alloca 1 of typeof(foo)
911 //b = alloca 1 of typeof(foo)
916 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
917 const Type* ArgTy = F->getFunctionType()->getReturnType();
918 const Type* ArgTyPtr = PointerType::get(ArgTy);
919 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
920 RetTy, ArgTyPtr, ArgTyPtr,
923 while (!F->use_empty()) {
924 CallInst* CI = cast<CallInst>(F->use_back());
925 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
926 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
927 new StoreInst(CI->getOperand(1), b, CI);
928 new CallInst(NF, a, b, "", CI);
929 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
930 CI->replaceAllUsesWith(foo);
931 CI->getParent()->getInstList().erase(CI);
933 Result->getFunctionList().erase(F);
941 //===----------------------------------------------------------------------===//
942 // RunVMAsmParser - Define an interface to this parser
943 //===----------------------------------------------------------------------===//
945 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
948 CurFilename = Filename;
949 return RunParser(new Module(CurFilename));
952 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
953 set_scan_string(AsmString);
955 CurFilename = "from_memory";
957 return RunParser(new Module (CurFilename));
964 #line 870 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
966 llvm::Module *ModuleVal;
967 llvm::Function *FunctionVal;
968 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
969 llvm::BasicBlock *BasicBlockVal;
970 llvm::TerminatorInst *TermInstVal;
971 llvm::Instruction *InstVal;
972 llvm::Constant *ConstVal;
974 const llvm::Type *PrimType;
975 llvm::PATypeHolder *TypeVal;
976 llvm::Value *ValueVal;
978 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
979 std::vector<llvm::Value*> *ValueList;
980 std::list<llvm::PATypeHolder> *TypeList;
981 // Represent the RHS of PHI node
982 std::list<std::pair<llvm::Value*,
983 llvm::BasicBlock*> > *PHIList;
984 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
985 std::vector<llvm::Constant*> *ConstVector;
987 llvm::GlobalValue::LinkageTypes Linkage;
995 char *StrVal; // This memory is strdup'd!
996 llvm::ValID ValIDVal; // strdup'd memory maybe!
998 llvm::Instruction::BinaryOps BinaryOpVal;
999 llvm::Instruction::TermOps TermOpVal;
1000 llvm::Instruction::MemoryOps MemOpVal;
1001 llvm::Instruction::OtherOps OtherOpVal;
1002 llvm::Module::Endianness Endianness;
1015 #define YYFLAG -32768
1016 #define YYNTBASE 110
1018 #define YYTRANSLATE(x) ((unsigned)(x) <= 349 ? yytranslate[x] : 179)
1020 static const char yytranslate[] = { 0,
1021 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1022 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1023 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1024 2, 2, 2, 2, 2, 2, 2, 2, 2, 99,
1025 100, 108, 2, 97, 2, 2, 2, 2, 2, 2,
1026 2, 2, 2, 2, 2, 2, 2, 2, 2, 104,
1027 96, 105, 2, 2, 2, 2, 2, 2, 2, 2,
1028 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1029 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1030 101, 98, 103, 2, 2, 2, 2, 2, 109, 2,
1031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1032 2, 2, 2, 2, 2, 2, 2, 2, 2, 102,
1033 2, 2, 106, 2, 107, 2, 2, 2, 2, 2,
1034 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1035 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1036 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1037 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1038 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1039 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1040 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1041 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1042 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1043 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1044 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1045 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1046 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1047 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1048 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1049 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1050 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1051 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1052 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1053 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1054 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1055 87, 88, 89, 90, 91, 92, 93, 94, 95
1059 static const short yyprhs[] = { 0,
1060 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1061 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1062 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1063 60, 62, 64, 67, 68, 70, 72, 74, 76, 77,
1064 78, 80, 82, 84, 87, 88, 91, 92, 96, 99,
1065 100, 102, 103, 107, 109, 112, 114, 116, 118, 120,
1066 122, 124, 126, 128, 130, 132, 134, 136, 138, 140,
1067 142, 144, 146, 148, 150, 152, 154, 157, 162, 168,
1068 174, 178, 181, 184, 186, 190, 192, 196, 198, 199,
1069 204, 208, 212, 217, 222, 226, 229, 232, 235, 238,
1070 241, 244, 247, 250, 253, 256, 263, 269, 278, 285,
1071 292, 299, 306, 310, 312, 314, 316, 318, 321, 324,
1072 327, 329, 334, 337, 338, 346, 347, 355, 359, 364,
1073 365, 367, 369, 373, 377, 381, 385, 389, 391, 392,
1074 394, 396, 398, 399, 402, 406, 408, 410, 414, 416,
1075 417, 426, 428, 430, 434, 436, 438, 441, 442, 446,
1076 448, 450, 452, 454, 456, 458, 460, 464, 466, 468,
1077 470, 472, 474, 477, 480, 483, 487, 490, 491, 493,
1078 496, 499, 503, 513, 523, 532, 546, 548, 550, 557,
1079 563, 566, 573, 581, 583, 587, 589, 590, 593, 595,
1080 601, 607, 613, 616, 621, 626, 633, 638, 643, 648,
1081 651, 659, 661, 664, 665, 667, 668, 672, 679, 683,
1085 static const short yyrhs[] = { 5,
1086 0, 6, 0, 3, 0, 4, 0, 68, 0, 69,
1087 0, 70, 0, 71, 0, 72, 0, 73, 0, 74,
1088 0, 75, 0, 76, 0, 77, 0, 78, 0, 79,
1089 0, 80, 0, 81, 0, 91, 0, 92, 0, 16,
1090 0, 14, 0, 12, 0, 10, 0, 17, 0, 15,
1091 0, 13, 0, 11, 0, 116, 0, 117, 0, 18,
1092 0, 19, 0, 149, 96, 0, 0, 41, 0, 42,
1093 0, 43, 0, 44, 0, 0, 0, 59, 0, 60,
1094 0, 61, 0, 58, 4, 0, 0, 54, 4, 0,
1095 0, 97, 54, 4, 0, 34, 24, 0, 0, 125,
1096 0, 0, 97, 128, 127, 0, 125, 0, 54, 4,
1097 0, 131, 0, 8, 0, 133, 0, 8, 0, 133,
1098 0, 9, 0, 10, 0, 11, 0, 12, 0, 13,
1099 0, 14, 0, 15, 0, 16, 0, 17, 0, 18,
1100 0, 19, 0, 20, 0, 21, 0, 45, 0, 132,
1101 0, 162, 0, 98, 4, 0, 130, 99, 135, 100,
1102 0, 101, 4, 102, 133, 103, 0, 104, 4, 102,
1103 133, 105, 0, 106, 134, 107, 0, 106, 107, 0,
1104 133, 108, 0, 133, 0, 134, 97, 133, 0, 134,
1105 0, 134, 97, 37, 0, 37, 0, 0, 131, 101,
1106 138, 103, 0, 131, 101, 103, 0, 131, 109, 24,
1107 0, 131, 104, 138, 105, 0, 131, 106, 138, 107,
1108 0, 131, 106, 107, 0, 131, 38, 0, 131, 39,
1109 0, 131, 162, 0, 131, 137, 0, 131, 26, 0,
1110 116, 111, 0, 117, 4, 0, 9, 27, 0, 9,
1111 28, 0, 119, 7, 0, 89, 99, 136, 36, 131,
1112 100, 0, 87, 99, 136, 176, 100, 0, 90, 99,
1113 136, 97, 136, 97, 136, 100, 0, 112, 99, 136,
1114 97, 136, 100, 0, 113, 99, 136, 97, 136, 100,
1115 0, 114, 99, 136, 97, 136, 100, 0, 115, 99,
1116 136, 97, 136, 100, 0, 138, 97, 136, 0, 136,
1117 0, 32, 0, 33, 0, 141, 0, 141, 158, 0,
1118 141, 159, 0, 141, 25, 0, 142, 0, 142, 120,
1119 20, 129, 0, 142, 159, 0, 0, 142, 120, 121,
1120 139, 136, 143, 127, 0, 0, 142, 120, 47, 139,
1121 131, 144, 127, 0, 142, 48, 146, 0, 142, 55,
1122 96, 147, 0, 0, 53, 0, 52, 0, 50, 96,
1123 145, 0, 51, 96, 4, 0, 49, 96, 24, 0,
1124 101, 148, 103, 0, 148, 97, 24, 0, 24, 0,
1125 0, 22, 0, 24, 0, 149, 0, 0, 131, 150,
1126 0, 152, 97, 151, 0, 151, 0, 152, 0, 152,
1127 97, 37, 0, 37, 0, 0, 122, 129, 149, 99,
1128 153, 100, 126, 123, 0, 29, 0, 106, 0, 121,
1129 154, 155, 0, 30, 0, 107, 0, 165, 157, 0,
1130 0, 31, 160, 154, 0, 3, 0, 4, 0, 7,
1131 0, 27, 0, 28, 0, 38, 0, 39, 0, 104,
1132 138, 105, 0, 137, 0, 110, 0, 149, 0, 162,
1133 0, 161, 0, 131, 163, 0, 165, 166, 0, 156,
1134 166, 0, 167, 120, 168, 0, 167, 170, 0, 0,
1135 23, 0, 62, 164, 0, 62, 8, 0, 63, 21,
1136 163, 0, 63, 9, 163, 97, 21, 163, 97, 21,
1137 163, 0, 64, 118, 163, 97, 21, 163, 101, 169,
1138 103, 0, 64, 118, 163, 97, 21, 163, 101, 103,
1139 0, 65, 122, 129, 163, 99, 173, 100, 36, 21,
1140 163, 66, 21, 163, 0, 66, 0, 67, 0, 169,
1141 118, 161, 97, 21, 163, 0, 118, 161, 97, 21,
1142 163, 0, 120, 175, 0, 131, 101, 163, 97, 163,
1143 103, 0, 171, 97, 101, 163, 97, 163, 103, 0,
1144 164, 0, 172, 97, 164, 0, 172, 0, 0, 57,
1145 56, 0, 56, 0, 112, 131, 163, 97, 163, 0,
1146 113, 131, 163, 97, 163, 0, 114, 131, 163, 97,
1147 163, 0, 46, 164, 0, 115, 164, 97, 164, 0,
1148 89, 164, 36, 131, 0, 90, 164, 97, 164, 97,
1149 164, 0, 93, 164, 97, 131, 0, 94, 164, 97,
1150 131, 0, 95, 164, 97, 131, 0, 88, 171, 0,
1151 174, 122, 129, 163, 99, 173, 100, 0, 178, 0,
1152 97, 172, 0, 0, 35, 0, 0, 82, 131, 124,
1153 0, 82, 131, 97, 15, 163, 124, 0, 83, 131,
1154 124, 0, 83, 131, 97, 15, 163, 124, 0, 84,
1155 164, 0, 177, 85, 131, 163, 0, 177, 86, 164,
1156 97, 131, 163, 0, 87, 131, 163, 176, 0
1162 static const short yyrline[] = { 0,
1163 988, 989, 996, 997, 1006, 1006, 1006, 1006, 1006, 1007,
1164 1007, 1007, 1008, 1008, 1008, 1008, 1008, 1008, 1010, 1010,
1165 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1015, 1016, 1016,
1166 1017, 1017, 1020, 1023, 1027, 1027, 1028, 1029, 1030, 1033,
1167 1033, 1034, 1035, 1036, 1045, 1045, 1051, 1051, 1059, 1066,
1168 1066, 1072, 1072, 1074, 1078, 1089, 1089, 1090, 1090, 1092,
1169 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1102, 1102, 1102,
1170 1102, 1102, 1102, 1103, 1106, 1109, 1115, 1122, 1134, 1138,
1171 1149, 1158, 1161, 1169, 1173, 1178, 1179, 1182, 1185, 1195,
1172 1220, 1233, 1261, 1286, 1306, 1318, 1327, 1331, 1390, 1396,
1173 1404, 1409, 1414, 1417, 1420, 1427, 1437, 1468, 1475, 1496,
1174 1503, 1508, 1518, 1521, 1528, 1528, 1538, 1545, 1549, 1552,
1175 1555, 1568, 1588, 1590, 1593, 1596, 1600, 1603, 1605, 1607,
1176 1612, 1613, 1615, 1618, 1626, 1631, 1633, 1637, 1641, 1649,
1177 1649, 1650, 1650, 1652, 1658, 1663, 1669, 1672, 1677, 1681,
1178 1685, 1771, 1771, 1773, 1781, 1781, 1783, 1787, 1787, 1796,
1179 1799, 1802, 1805, 1808, 1811, 1814, 1817, 1841, 1848, 1851,
1180 1856, 1856, 1862, 1866, 1869, 1877, 1886, 1890, 1900, 1911,
1181 1914, 1917, 1920, 1923, 1937, 1941, 1994, 1997, 2003, 2011,
1182 2021, 2028, 2033, 2040, 2044, 2050, 2050, 2052, 2055, 2061,
1183 2073, 2081, 2091, 2103, 2110, 2117, 2124, 2129, 2148, 2170,
1184 2184, 2241, 2247, 2249, 2253, 2256, 2262, 2266, 2270, 2274,
1185 2278, 2285, 2295, 2308
1190 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1192 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1193 "EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT",
1194 "USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID",
1195 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK",
1196 "BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO",
1197 "DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING",
1198 "OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE","ENDIAN","POINTERSIZE","LITTLE",
1199 "BIG","ALIGN","DEPLIBS","CALL","TAIL","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1200 "RET","BR","SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","DIV",
1201 "REM","AND","OR","XOR","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC",
1202 "ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","PHI_TOK","CAST","SELECT","SHL",
1203 "SHR","VAARG","VAARG_old","VANEXT_old","'='","','","'\\\\'","'('","')'","'['",
1204 "'x'","']'","'<'","'>'","'{'","'}'","'*'","'c'","INTVAL","EINT64VAL","ArithmeticOps",
1205 "LogicalOps","SetCondOps","ShiftOps","SIntType","UIntType","IntType","FPType",
1206 "OptAssign","OptLinkage","OptCallingConv","OptAlign","OptCAlign","SectionString",
1207 "OptSection","GlobalVarAttributes","GlobalVarAttribute","TypesV","UpRTypesV",
1208 "Types","PrimType","UpRTypes","TypeListI","ArgTypeListI","ConstVal","ConstExpr",
1209 "ConstVector","GlobalType","Module","FunctionList","ConstPool","@1","@2","BigOrLittle",
1210 "TargetDefinition","LibrariesDefinition","LibList","Name","OptName","ArgVal",
1211 "ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END","Function",
1212 "FunctionProto","@3","ConstValueRef","SymbolicValueRef","ValueRef","ResolvedVal",
1213 "BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst","JumpTable",
1214 "Inst","PHIList","ValueRefList","ValueRefListE","OptTailCall","InstVal","IndexList",
1215 "OptVolatile","MemoryInst", NULL
1219 static const short yyr1[] = { 0,
1220 110, 110, 111, 111, 112, 112, 112, 112, 112, 113,
1221 113, 113, 114, 114, 114, 114, 114, 114, 115, 115,
1222 116, 116, 116, 116, 117, 117, 117, 117, 118, 118,
1223 119, 119, 120, 120, 121, 121, 121, 121, 121, 122,
1224 122, 122, 122, 122, 123, 123, 124, 124, 125, 126,
1225 126, 127, 127, 128, 128, 129, 129, 130, 130, 131,
1226 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
1227 132, 132, 132, 133, 133, 133, 133, 133, 133, 133,
1228 133, 133, 133, 134, 134, 135, 135, 135, 135, 136,
1229 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
1230 136, 136, 136, 136, 136, 137, 137, 137, 137, 137,
1231 137, 137, 138, 138, 139, 139, 140, 141, 141, 141,
1232 141, 142, 142, 143, 142, 144, 142, 142, 142, 142,
1233 145, 145, 146, 146, 146, 147, 148, 148, 148, 149,
1234 149, 150, 150, 151, 152, 152, 153, 153, 153, 153,
1235 154, 155, 155, 156, 157, 157, 158, 160, 159, 161,
1236 161, 161, 161, 161, 161, 161, 161, 161, 162, 162,
1237 163, 163, 164, 165, 165, 166, 167, 167, 167, 168,
1238 168, 168, 168, 168, 168, 168, 168, 168, 169, 169,
1239 170, 171, 171, 172, 172, 173, 173, 174, 174, 175,
1240 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1241 175, 175, 176, 176, 177, 177, 178, 178, 178, 178,
1245 static const short yyr2[] = { 0,
1246 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1247 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1248 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1249 1, 1, 2, 0, 1, 1, 1, 1, 0, 0,
1250 1, 1, 1, 2, 0, 2, 0, 3, 2, 0,
1251 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1252 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1253 1, 1, 1, 1, 1, 1, 2, 4, 5, 5,
1254 3, 2, 2, 1, 3, 1, 3, 1, 0, 4,
1255 3, 3, 4, 4, 3, 2, 2, 2, 2, 2,
1256 2, 2, 2, 2, 2, 6, 5, 8, 6, 6,
1257 6, 6, 3, 1, 1, 1, 1, 2, 2, 2,
1258 1, 4, 2, 0, 7, 0, 7, 3, 4, 0,
1259 1, 1, 3, 3, 3, 3, 3, 1, 0, 1,
1260 1, 1, 0, 2, 3, 1, 1, 3, 1, 0,
1261 8, 1, 1, 3, 1, 1, 2, 0, 3, 1,
1262 1, 1, 1, 1, 1, 1, 3, 1, 1, 1,
1263 1, 1, 2, 2, 2, 3, 2, 0, 1, 2,
1264 2, 3, 9, 9, 8, 13, 1, 1, 6, 5,
1265 2, 6, 7, 1, 3, 1, 0, 2, 1, 5,
1266 5, 5, 2, 4, 4, 6, 4, 4, 4, 2,
1267 7, 1, 2, 0, 1, 0, 3, 6, 3, 6,
1271 static const short yydefact[] = { 130,
1272 39, 121, 120, 158, 35, 36, 37, 38, 40, 178,
1273 118, 119, 178, 140, 141, 0, 0, 39, 0, 123,
1274 40, 0, 41, 42, 43, 0, 0, 179, 175, 34,
1275 155, 156, 157, 174, 0, 0, 0, 128, 0, 0,
1276 0, 0, 33, 159, 44, 1, 2, 57, 61, 62,
1277 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1278 73, 74, 0, 0, 0, 0, 169, 0, 0, 56,
1279 75, 60, 170, 76, 152, 153, 154, 216, 177, 0,
1280 0, 0, 139, 129, 122, 115, 116, 0, 0, 77,
1281 0, 0, 59, 82, 84, 0, 0, 89, 83, 215,
1282 0, 199, 0, 0, 0, 0, 40, 187, 188, 5,
1283 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1284 16, 17, 18, 0, 0, 0, 0, 0, 0, 0,
1285 19, 20, 0, 0, 0, 0, 0, 0, 0, 176,
1286 40, 191, 0, 212, 135, 132, 131, 133, 134, 138,
1287 0, 126, 61, 62, 63, 64, 65, 66, 67, 68,
1288 69, 70, 71, 0, 0, 0, 0, 124, 0, 0,
1289 0, 81, 150, 88, 86, 0, 0, 203, 198, 181,
1290 180, 0, 0, 24, 28, 23, 27, 22, 26, 21,
1291 25, 29, 30, 0, 0, 47, 47, 221, 0, 0,
1292 210, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1293 0, 0, 0, 0, 136, 52, 103, 104, 3, 4,
1294 101, 102, 105, 100, 96, 97, 0, 0, 0, 0,
1295 0, 0, 0, 0, 0, 0, 0, 99, 98, 52,
1296 58, 58, 85, 149, 143, 146, 147, 0, 0, 78,
1297 160, 161, 162, 163, 164, 165, 166, 0, 168, 172,
1298 171, 173, 0, 182, 0, 0, 0, 217, 0, 219,
1299 214, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1300 0, 0, 0, 0, 0, 137, 0, 127, 0, 0,
1301 0, 91, 114, 0, 0, 95, 0, 92, 0, 0,
1302 0, 0, 125, 79, 80, 142, 144, 0, 50, 87,
1303 0, 0, 0, 0, 0, 0, 0, 0, 224, 0,
1304 0, 205, 0, 207, 208, 209, 0, 0, 0, 204,
1305 0, 222, 0, 0, 0, 54, 52, 214, 0, 0,
1306 0, 90, 93, 94, 0, 0, 0, 0, 148, 145,
1307 51, 45, 167, 0, 0, 197, 47, 48, 47, 194,
1308 213, 0, 0, 0, 200, 201, 202, 197, 0, 49,
1309 55, 53, 0, 0, 0, 113, 0, 0, 0, 0,
1310 0, 151, 0, 0, 196, 0, 0, 218, 220, 0,
1311 0, 0, 206, 0, 223, 107, 0, 0, 0, 0,
1312 0, 0, 46, 0, 0, 0, 195, 192, 0, 211,
1313 106, 0, 109, 110, 111, 112, 0, 185, 0, 0,
1314 0, 193, 0, 183, 0, 184, 0, 0, 108, 0,
1315 0, 0, 0, 0, 0, 190, 0, 0, 189, 186,
1319 static const short yydefgoto[] = { 67,
1320 221, 234, 235, 236, 237, 164, 165, 194, 166, 18,
1321 9, 26, 382, 268, 336, 352, 288, 337, 68, 69,
1322 167, 71, 72, 96, 176, 293, 259, 294, 88, 441,
1323 1, 2, 240, 216, 148, 38, 84, 151, 73, 307,
1324 246, 247, 248, 27, 77, 10, 33, 11, 12, 21,
1325 260, 74, 262, 360, 13, 29, 30, 140, 420, 79,
1326 201, 385, 386, 141, 142, 319, 143, 144
1329 static const short yypact[] = {-32768,
1330 43, 303,-32768,-32768,-32768,-32768,-32768,-32768, 71, -3,
1331 -32768,-32768, 34,-32768,-32768, 86, -30, 47, -19,-32768,
1332 71, 76,-32768,-32768,-32768, 994, -25,-32768,-32768, -6,
1333 -32768,-32768,-32768,-32768, -14, 26, 37,-32768, 49, 994,
1334 -1, -1,-32768,-32768,-32768,-32768,-32768, -4,-32768,-32768,
1335 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1336 -32768,-32768, 134, 153, 157, 511,-32768, -6, 63,-32768,
1337 -32768, -16,-32768,-32768,-32768,-32768,-32768, 1109,-32768, 139,
1338 -5, 163, 144,-32768,-32768,-32768,-32768, 1014, 1058,-32768,
1339 68, 69,-32768,-32768, -16, -90, 73, 751,-32768,-32768,
1340 1014,-32768, 120, 1116, 51, 186, 71,-32768,-32768,-32768,
1341 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1342 -32768,-32768,-32768, 1014, 1014, 1014, 1014, 1014, 1014, 1014,
1343 -32768,-32768, 1014, 1014, 1014, 1014, 1014, 1014, 1014,-32768,
1344 71,-32768, -15,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1345 22,-32768, 116, 142, 173, 145, 174, 149, 175, 151,
1346 176, 177, 181, 156, 179, 183, 409,-32768, 1014, 1014,
1347 1014,-32768, 789,-32768, 84, 91, 575,-32768,-32768, -4,
1348 -32768, 575, 575,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1349 -32768,-32768,-32768, 575, 994, 95, 96,-32768, 575, 93,
1350 107, 172, 112, 113, 114, 115, 575, 575, 575, 117,
1351 994, 1014, 1014, 189,-32768, 122,-32768,-32768,-32768,-32768,
1352 -32768,-32768,-32768,-32768,-32768,-32768, 123, 125, 126, 853,
1353 1058, 531, 202, 128, 129, 131, 132,-32768,-32768, 122,
1354 20, -12, -16,-32768, -6,-32768, 136, 135, 891,-32768,
1355 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 1058,-32768,-32768,
1356 -32768,-32768, 137,-32768, 141, 575, -9,-32768, 4,-32768,
1357 146, 575, 138, 1014, 1014, 1014, 1014, 1014, 147, 158,
1358 161, 1014, 575, 575, 162,-32768, 5,-32768, 1058, 1058,
1359 1058,-32768,-32768, 24, -32,-32768, -28,-32768, 1058, 1058,
1360 1058, 1058,-32768,-32768,-32768,-32768,-32768, 956, 208,-32768,
1361 0, 215, 233, 164, 575, 256, 575, 1014,-32768, 165,
1362 575,-32768, 167,-32768,-32768,-32768, 575, 575, 575,-32768,
1363 166,-32768, 1014, 237, 262,-32768, 122, 146, 231, 171,
1364 1058,-32768,-32768,-32768, 178, 180, 182, 184,-32768,-32768,
1365 -32768, 216,-32768, 575, 575, 1014, 190,-32768, 190,-32768,
1366 191, 575, 192, 1014,-32768,-32768,-32768, 1014, 575,-32768,
1367 -32768,-32768, 169, 1014, 1058,-32768, 1058, 1058, 1058, 1058,
1368 269,-32768, 193, 197, 191, 199, 222,-32768,-32768, 1014,
1369 200, 575,-32768, 205,-32768,-32768, 206, 211, 209, 213,
1370 214, 217,-32768, 259, 11, 247,-32768,-32768, 221,-32768,
1371 -32768, 1058,-32768,-32768,-32768,-32768, 575,-32768, 654, 39,
1372 281,-32768, 218,-32768, 223,-32768, 654, 575,-32768, 308,
1373 234, 266, 575, 312, 316,-32768, 575, 575,-32768,-32768,
1377 static const short yypgoto[] = {-32768,
1378 -32768, 263, 265, 274, 276, -105, -104, -390,-32768, 326,
1379 342, -78,-32768, -184, 48,-32768, -231,-32768, -37,-32768,
1380 -26,-32768, -54, 264,-32768, -84, 194, -197, 321,-32768,
1381 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 8,-32768,
1382 60,-32768,-32768, 348,-32768,-32768,-32768,-32768, 368,-32768,
1383 -301, -43, 38, -93,-32768, 358,-32768,-32768,-32768,-32768,
1384 -32768, 54, 7,-32768,-32768, 35,-32768,-32768
1391 static const short yytable[] = { 70,
1392 192, 193, 85, 75, 168, 315, 171, 178, 303, 19,
1393 181, 95, 270, 70, 419, 14, 172, 15, 317, 28,
1394 184, 185, 186, 187, 188, 189, 190, 191, 195, 427,
1395 86, 87, 198, 295, 297, 202, 203, 19, 334, 204,
1396 205, 206, -117, 95, 316, 210, 146, 147, 184, 185,
1397 186, 187, 188, 189, 190, 191, 28, 316, 335, 182,
1398 311, 152, 211, 31, 341, 39, 40, 3, 341, 212,
1399 213, 183, 343, 4, 177, 97, 43, 177, 344, 45,
1400 76, 80, -58, 5, 6, 7, 8, 5, 6, 7,
1401 8, 99, 305, 41, -59, 99, 341, 196, 197, 177,
1402 199, 200, 177, 177, 353, 372, 177, 177, 177, 207,
1403 208, 209, 177, 418, 241, 242, 243, 425, 214, 285,
1404 341, 81, 304, 239, 215, 431, 342, 99, 22, 23,
1405 24, 25, 82, 261, 35, 36, 37, 90, 261, 261,
1406 32, 426, 217, 218, -24, -24, 245, -23, -23, 83,
1407 261, -22, -22, -21, -21, 261, 91, 266, 219, 220,
1408 92, 98, 145, 261, 261, 261, 149, 150, 70, 169,
1409 170, 173, 388, 283, 389, 179, -28, -27, -26, -25,
1410 249, 323, 222, -31, 70, 284, 177, -32, 330, 223,
1411 250, 267, 269, 272, 243, 184, 185, 186, 187, 188,
1412 189, 190, 191, 273, 338, 339, 340, 274, 275, 276,
1413 277, 278, 286, 282, 345, 346, 347, 348, 287, 263,
1414 264, 289, 261, 290, 291, 298, 299, 300, 261, 301,
1415 302, 265, 308, 312, 309, 354, 271, 313, 321, 261,
1416 261, 334, 318, 327, 279, 280, 281, 322, 177, 324,
1417 325, 326, 306, 355, 328, 177, 376, 329, 333, 358,
1418 370, 362, 356, 364, 368, 371, 374, 375, 396, 381,
1419 393, 261, 403, 261, 377, 316, 378, 261, 379, 417,
1420 380, 245, 421, 261, 261, 261, 387, 390, 392, 404,
1421 398, 177, 399, 400, 401, 402, 407, 405, 406, 192,
1422 193, 428, 408, 314, 410, 411, 369, 412, 413, 320,
1423 261, 261, 414, 415, 192, 193, 416, 429, 261, 430,
1424 331, 332, -34, 422, 14, 261, 15, 423, 433, 177,
1425 434, 435, 437, 4, -34, -34, 438, 177, 442, 443,
1426 136, 177, 137, -34, -34, -34, -34, 397, 261, -34,
1427 16, 138, 357, 139, 359, 78, 351, 17, 363, 42,
1428 238, 175, 89, 177, 365, 366, 367, 350, 44, 20,
1429 34, 361, 373, 261, 394, 0, 0, 0, 0, 0,
1430 0, 0, 0, 0, 261, 0, 0, 0, 0, 261,
1431 0, 383, 384, 261, 261, 0, 0, 0, 0, 391,
1432 0, 0, 0, 0, 0, 0, 395, 0, 0, 0,
1433 0, 0, 0, 46, 47, 0, 0, 0, 0, 0,
1434 0, 0, 0, 0, 0, 0, 0, 0, 0, 409,
1435 14, 0, 15, 0, 224, 0, 0, 0, 0, 0,
1436 0, 0, 0, 0, 0, 0, 225, 226, 0, 0,
1437 0, 0, 0, 0, 424, 0, 0, 0, 0, 0,
1438 0, 0, 0, 0, 0, 432, 0, 0, 0, 0,
1439 436, 0, 0, 0, 439, 440, 110, 111, 112, 113,
1440 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
1441 0, 0, 0, 0, 0, 227, 0, 228, 229, 131,
1442 132, 0, 0, 0, 0, 0, 0, 0, 0, 230,
1443 0, 0, 231, 0, 232, 46, 47, 233, 93, 49,
1444 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1445 60, 61, 14, 0, 15, 46, 47, 0, 93, 153,
1446 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
1447 60, 61, 14, 0, 15, 62, 0, 0, 0, 0,
1448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1449 0, 0, 0, 0, 0, 62, 0, 251, 252, 46,
1450 47, 253, 0, 0, 0, 0, 0, 0, 0, 0,
1451 0, 0, 0, 0, 0, 0, 14, 0, 15, 0,
1452 0, 254, 255, 0, 0, 0, 0, 0, 63, 0,
1453 0, 64, 256, 257, 65, 0, 66, 94, 0, 0,
1454 0, 0, 0, 0, 0, 0, 0, 0, 63, 0,
1455 0, 64, 0, 0, 65, 0, 66, 296, 0, 0,
1456 0, 0, 110, 111, 112, 113, 114, 115, 116, 117,
1457 118, 119, 120, 121, 122, 123, 251, 252, 0, 0,
1458 253, 227, 0, 228, 229, 131, 132, 0, 0, 0,
1459 0, 0, 0, 0, 0, 0, 0, 0, 258, 0,
1460 254, 255, 0, 0, 0, 0, 0, 0, 0, 0,
1461 0, 256, 257, 0, 0, 0, 0, 0, 0, 0,
1462 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1463 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1464 0, 110, 111, 112, 113, 114, 115, 116, 117, 118,
1465 119, 120, 121, 122, 123, 0, 0, 0, 0, 0,
1466 227, 0, 228, 229, 131, 132, 0, 0, 0, 0,
1467 0, 0, 0, 0, 0, 46, 47, 258, 93, 49,
1468 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1469 60, 61, 14, 0, 15, 0, 0, 0, 0, 0,
1470 0, 0, 0, 0, 0, 0, 0, 174, 0, 0,
1471 0, 0, 0, 46, 47, 62, 93, 49, 50, 51,
1472 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
1473 14, 0, 15, 0, 0, 0, 0, 0, 0, 0,
1474 0, 0, 0, 0, 0, 244, 0, 0, 0, 0,
1475 0, 0, 0, 62, 0, 0, 0, 0, 0, 0,
1476 0, 0, 0, 0, 0, 0, 0, 0, 63, 0,
1477 0, 64, 0, 0, 65, 0, 66, 46, 47, 0,
1478 93, 153, 154, 155, 156, 157, 158, 159, 160, 161,
1479 162, 163, 60, 61, 14, 0, 15, 0, 0, 0,
1480 0, 0, 0, 0, 0, 0, 63, 0, 0, 64,
1481 0, 0, 65, 0, 66, 46, 47, 62, 93, 49,
1482 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1483 60, 61, 14, 0, 15, 0, 0, 0, 0, 0,
1484 0, 0, 0, 0, 0, 0, 0, 310, 0, 0,
1485 0, 0, 0, 0, 0, 62, 0, 0, 0, 0,
1486 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1487 63, 0, 0, 64, 0, 292, 65, 0, 66, 0,
1488 46, 47, 0, 93, 49, 50, 51, 52, 53, 54,
1489 55, 56, 57, 58, 59, 60, 61, 14, 0, 15,
1490 0, 0, 0, 0, 0, 0, 0, 0, 63, 0,
1491 0, 64, 349, 0, 65, 0, 66, 0, 46, 47,
1492 62, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1493 57, 58, 59, 60, 61, 14, 0, 15, 46, 47,
1494 0, 93, 49, 50, 51, 52, 53, 54, 55, 56,
1495 57, 58, 59, 60, 61, 14, 0, 15, 62, 0,
1496 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1497 0, 0, 0, 63, 0, 0, 64, 0, 62, 65,
1498 0, 66, 46, 47, 0, 93, 153, 154, 155, 156,
1499 157, 158, 159, 160, 161, 162, 163, 60, 61, 14,
1500 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
1501 0, 63, 0, 0, 64, 0, 0, 65, 0, 66,
1502 0, 0, 62, 0, 0, 0, 0, 0, 0, 0,
1503 0, 63, 0, 0, 64, 0, 0, 65, 0, 66,
1504 46, 47, 0, 180, 49, 50, 51, 52, 53, 54,
1505 55, 56, 57, 58, 59, 60, 61, 14, 0, 15,
1506 0, 0, 0, 100, 0, 0, 0, 0, 0, 0,
1507 0, 0, 0, 0, 101, 63, 0, 0, 64, 0,
1508 62, 65, 0, 66, 102, 103, 0, 0, 0, 0,
1509 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
1510 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
1511 124, 125, 126, 0, 0, 127, 128, 129, 130, 131,
1512 132, 133, 134, 135, 0, 0, 0, 0, 0, 0,
1513 0, 0, 0, 63, 0, 0, 64, 0, 0, 65,
1517 static const short yycheck[] = { 26,
1518 106, 106, 40, 29, 89, 15, 97, 101, 240, 2,
1519 104, 66, 197, 40, 405, 22, 107, 24, 15, 23,
1520 10, 11, 12, 13, 14, 15, 16, 17, 107, 420,
1521 32, 33, 126, 231, 232, 129, 130, 30, 34, 133,
1522 134, 135, 0, 98, 54, 139, 52, 53, 10, 11,
1523 12, 13, 14, 15, 16, 17, 23, 54, 54, 9,
1524 258, 88, 141, 30, 97, 96, 20, 25, 97, 85,
1525 86, 21, 105, 31, 101, 68, 96, 104, 107, 4,
1526 106, 96, 99, 41, 42, 43, 44, 41, 42, 43,
1527 44, 108, 105, 47, 99, 108, 97, 124, 125, 126,
1528 127, 128, 129, 130, 105, 337, 133, 134, 135, 136,
1529 137, 138, 139, 103, 169, 170, 171, 419, 97, 213,
1530 97, 96, 103, 167, 103, 427, 103, 108, 58, 59,
1531 60, 61, 96, 177, 49, 50, 51, 4, 182, 183,
1532 107, 103, 27, 28, 3, 4, 173, 3, 4, 101,
1533 194, 3, 4, 3, 4, 199, 4, 195, 3, 4,
1534 4, 99, 24, 207, 208, 209, 4, 24, 195, 102,
1535 102, 99, 357, 211, 359, 56, 4, 4, 4, 4,
1536 97, 275, 4, 7, 211, 212, 213, 7, 282, 7,
1537 100, 97, 97, 101, 249, 10, 11, 12, 13, 14,
1538 15, 16, 17, 97, 289, 290, 291, 36, 97, 97,
1539 97, 97, 24, 97, 299, 300, 301, 302, 97, 182,
1540 183, 99, 266, 99, 99, 24, 99, 99, 272, 99,
1541 99, 194, 97, 97, 100, 21, 199, 97, 101, 283,
1542 284, 34, 97, 97, 207, 208, 209, 274, 275, 276,
1543 277, 278, 245, 21, 97, 282, 341, 97, 97, 4,
1544 24, 97, 99, 97, 99, 4, 36, 97, 100, 54,
1545 364, 315, 4, 317, 97, 54, 97, 321, 97, 21,
1546 97, 308, 36, 327, 328, 329, 97, 97, 97, 97,
1547 375, 318, 377, 378, 379, 380, 390, 101, 100, 405,
1548 405, 21, 103, 266, 100, 100, 333, 97, 100, 272,
1549 354, 355, 100, 100, 420, 420, 100, 100, 362, 97,
1550 283, 284, 20, 103, 22, 369, 24, 412, 21, 356,
1551 97, 66, 21, 31, 32, 33, 21, 364, 0, 0,
1552 78, 368, 78, 41, 42, 43, 44, 374, 392, 47,
1553 48, 78, 315, 78, 317, 30, 309, 55, 321, 18,
1554 167, 98, 42, 390, 327, 328, 329, 308, 21, 2,
1555 13, 318, 338, 417, 368, -1, -1, -1, -1, -1,
1556 -1, -1, -1, -1, 428, -1, -1, -1, -1, 433,
1557 -1, 354, 355, 437, 438, -1, -1, -1, -1, 362,
1558 -1, -1, -1, -1, -1, -1, 369, -1, -1, -1,
1559 -1, -1, -1, 5, 6, -1, -1, -1, -1, -1,
1560 -1, -1, -1, -1, -1, -1, -1, -1, -1, 392,
1561 22, -1, 24, -1, 26, -1, -1, -1, -1, -1,
1562 -1, -1, -1, -1, -1, -1, 38, 39, -1, -1,
1563 -1, -1, -1, -1, 417, -1, -1, -1, -1, -1,
1564 -1, -1, -1, -1, -1, 428, -1, -1, -1, -1,
1565 433, -1, -1, -1, 437, 438, 68, 69, 70, 71,
1566 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1567 -1, -1, -1, -1, -1, 87, -1, 89, 90, 91,
1568 92, -1, -1, -1, -1, -1, -1, -1, -1, 101,
1569 -1, -1, 104, -1, 106, 5, 6, 109, 8, 9,
1570 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1571 20, 21, 22, -1, 24, 5, 6, -1, 8, 9,
1572 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1573 20, 21, 22, -1, 24, 45, -1, -1, -1, -1,
1574 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1575 -1, -1, -1, -1, -1, 45, -1, 3, 4, 5,
1576 6, 7, -1, -1, -1, -1, -1, -1, -1, -1,
1577 -1, -1, -1, -1, -1, -1, 22, -1, 24, -1,
1578 -1, 27, 28, -1, -1, -1, -1, -1, 98, -1,
1579 -1, 101, 38, 39, 104, -1, 106, 107, -1, -1,
1580 -1, -1, -1, -1, -1, -1, -1, -1, 98, -1,
1581 -1, 101, -1, -1, 104, -1, 106, 107, -1, -1,
1582 -1, -1, 68, 69, 70, 71, 72, 73, 74, 75,
1583 76, 77, 78, 79, 80, 81, 3, 4, -1, -1,
1584 7, 87, -1, 89, 90, 91, 92, -1, -1, -1,
1585 -1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
1586 27, 28, -1, -1, -1, -1, -1, -1, -1, -1,
1587 -1, 38, 39, -1, -1, -1, -1, -1, -1, -1,
1588 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1589 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1590 -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1591 77, 78, 79, 80, 81, -1, -1, -1, -1, -1,
1592 87, -1, 89, 90, 91, 92, -1, -1, -1, -1,
1593 -1, -1, -1, -1, -1, 5, 6, 104, 8, 9,
1594 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1595 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
1596 -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
1597 -1, -1, -1, 5, 6, 45, 8, 9, 10, 11,
1598 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1599 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
1600 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
1601 -1, -1, -1, 45, -1, -1, -1, -1, -1, -1,
1602 -1, -1, -1, -1, -1, -1, -1, -1, 98, -1,
1603 -1, 101, -1, -1, 104, -1, 106, 5, 6, -1,
1604 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
1605 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
1606 -1, -1, -1, -1, -1, -1, 98, -1, -1, 101,
1607 -1, -1, 104, -1, 106, 5, 6, 45, 8, 9,
1608 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1609 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
1610 -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
1611 -1, -1, -1, -1, -1, 45, -1, -1, -1, -1,
1612 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1613 98, -1, -1, 101, -1, 103, 104, -1, 106, -1,
1614 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
1615 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
1616 -1, -1, -1, -1, -1, -1, -1, -1, 98, -1,
1617 -1, 101, 37, -1, 104, -1, 106, -1, 5, 6,
1618 45, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1619 17, 18, 19, 20, 21, 22, -1, 24, 5, 6,
1620 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1621 17, 18, 19, 20, 21, 22, -1, 24, 45, -1,
1622 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1623 -1, -1, -1, 98, -1, -1, 101, -1, 45, 104,
1624 -1, 106, 5, 6, -1, 8, 9, 10, 11, 12,
1625 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1626 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1627 -1, 98, -1, -1, 101, -1, -1, 104, -1, 106,
1628 -1, -1, 45, -1, -1, -1, -1, -1, -1, -1,
1629 -1, 98, -1, -1, 101, -1, -1, 104, -1, 106,
1630 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
1631 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
1632 -1, -1, -1, 35, -1, -1, -1, -1, -1, -1,
1633 -1, -1, -1, -1, 46, 98, -1, -1, 101, -1,
1634 45, 104, -1, 106, 56, 57, -1, -1, -1, -1,
1635 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1636 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1637 82, 83, 84, -1, -1, 87, 88, 89, 90, 91,
1638 92, 93, 94, 95, -1, -1, -1, -1, -1, -1,
1639 -1, -1, -1, 98, -1, -1, 101, -1, -1, 104,
1642 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1643 #line 3 "/usr/share/bison.simple"
1644 /* This file comes from bison-1.28. */
1646 /* Skeleton output parser for bison,
1647 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1649 This program is free software; you can redistribute it and/or modify
1650 it under the terms of the GNU General Public License as published by
1651 the Free Software Foundation; either version 2, or (at your option)
1654 This program is distributed in the hope that it will be useful,
1655 but WITHOUT ANY WARRANTY; without even the implied warranty of
1656 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1657 GNU General Public License for more details.
1659 You should have received a copy of the GNU General Public License
1660 along with this program; if not, write to the Free Software
1661 Foundation, Inc., 59 Temple Place - Suite 330,
1662 Boston, MA 02111-1307, USA. */
1664 /* As a special exception, when this file is copied by Bison into a
1665 Bison output file, you may use that output file without restriction.
1666 This special exception was added by the Free Software Foundation
1667 in version 1.24 of Bison. */
1669 /* This is the parser code that is written into each bison parser
1670 when the %semantic_parser declaration is not specified in the grammar.
1671 It was written by Richard Stallman by simplifying the hairy parser
1672 used when %semantic_parser is specified. */
1674 #ifndef YYSTACK_USE_ALLOCA
1676 #define YYSTACK_USE_ALLOCA
1677 #else /* alloca not defined */
1679 #define YYSTACK_USE_ALLOCA
1680 #define alloca __builtin_alloca
1681 #else /* not GNU C. */
1682 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
1683 #define YYSTACK_USE_ALLOCA
1685 #else /* not sparc */
1686 /* We think this test detects Watcom and Microsoft C. */
1687 /* This used to test MSDOS, but that is a bad idea
1688 since that symbol is in the user namespace. */
1689 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
1690 #if 0 /* No need for malloc.h, which pollutes the namespace;
1691 instead, just don't use alloca. */
1694 #else /* not MSDOS, or __TURBOC__ */
1696 /* I don't know what this was needed for, but it pollutes the namespace.
1697 So I turned it off. rms, 2 May 1997. */
1698 /* #include <malloc.h> */
1700 #define YYSTACK_USE_ALLOCA
1701 #else /* not MSDOS, or __TURBOC__, or _AIX */
1703 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
1704 and on HPUX 10. Eventually we can turn this on. */
1705 #define YYSTACK_USE_ALLOCA
1706 #define alloca __builtin_alloca
1709 #endif /* not _AIX */
1710 #endif /* not MSDOS, or __TURBOC__ */
1711 #endif /* not sparc */
1712 #endif /* not GNU C */
1713 #endif /* alloca not defined */
1714 #endif /* YYSTACK_USE_ALLOCA not defined */
1716 #ifdef YYSTACK_USE_ALLOCA
1717 #define YYSTACK_ALLOC alloca
1719 #define YYSTACK_ALLOC malloc
1722 /* Note: there must be only one dollar sign in this file.
1723 It is replaced by the list of actions, each action
1724 as one case of the switch. */
1726 #define yyerrok (yyerrstatus = 0)
1727 #define yyclearin (yychar = YYEMPTY)
1730 #define YYACCEPT goto yyacceptlab
1731 #define YYABORT goto yyabortlab
1732 #define YYERROR goto yyerrlab1
1733 /* Like YYERROR except do call yyerror.
1734 This remains here temporarily to ease the
1735 transition to the new meaning of YYERROR, for GCC.
1736 Once GCC version 2 has supplanted version 1, this can go. */
1737 #define YYFAIL goto yyerrlab
1738 #define YYRECOVERING() (!!yyerrstatus)
1739 #define YYBACKUP(token, value) \
1741 if (yychar == YYEMPTY && yylen == 1) \
1742 { yychar = (token), yylval = (value); \
1743 yychar1 = YYTRANSLATE (yychar); \
1748 { yyerror ("syntax error: cannot back up"); YYERROR; } \
1752 #define YYERRCODE 256
1755 #define YYLEX yylex()
1761 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
1763 #define YYLEX yylex(&yylval, &yylloc)
1765 #else /* not YYLSP_NEEDED */
1767 #define YYLEX yylex(&yylval, YYLEX_PARAM)
1769 #define YYLEX yylex(&yylval)
1771 #endif /* not YYLSP_NEEDED */
1774 /* If nonreentrant, generate the variables here */
1778 int yychar; /* the lookahead symbol */
1779 YYSTYPE yylval; /* the semantic value of the */
1780 /* lookahead symbol */
1783 YYLTYPE yylloc; /* location data for the lookahead */
1787 int yynerrs; /* number of parse errors so far */
1788 #endif /* not YYPURE */
1791 int yydebug; /* nonzero means print parse trace */
1792 /* Since this is uninitialized, it does not stop multiple parsers
1796 /* YYINITDEPTH indicates the initial size of the parser's stacks */
1799 #define YYINITDEPTH 200
1802 /* YYMAXDEPTH is the maximum size the stacks can grow to
1803 (effective only if the built-in stack extension method is used). */
1810 #define YYMAXDEPTH 10000
1813 /* Define __yy_memcpy. Note that the size argument
1814 should be passed with type unsigned int, because that is what the non-GCC
1815 definitions require. With GCC, __builtin_memcpy takes an arg
1816 of type size_t, but it can handle unsigned int. */
1818 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
1819 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
1820 #else /* not GNU C or C++ */
1823 /* This is the most reliable way to avoid incompatibilities
1824 in available built-in functions on various systems. */
1826 __yy_memcpy (to, from, count)
1831 register char *f = from;
1832 register char *t = to;
1833 register int i = count;
1839 #else /* __cplusplus */
1841 /* This is the most reliable way to avoid incompatibilities
1842 in available built-in functions on various systems. */
1844 __yy_memcpy (char *to, char *from, unsigned int count)
1846 register char *t = to;
1847 register char *f = from;
1848 register int i = count;
1857 #line 217 "/usr/share/bison.simple"
1859 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
1860 into yyparse. The argument should have type void *.
1861 It should actually point to an object.
1862 Grammar actions can access the variable by casting it
1863 to the proper pointer type. */
1865 #ifdef YYPARSE_PARAM
1867 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1868 #define YYPARSE_PARAM_DECL
1869 #else /* not __cplusplus */
1870 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
1871 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1872 #endif /* not __cplusplus */
1873 #else /* not YYPARSE_PARAM */
1874 #define YYPARSE_PARAM_ARG
1875 #define YYPARSE_PARAM_DECL
1876 #endif /* not YYPARSE_PARAM */
1878 /* Prevent warning if -Wstrict-prototypes. */
1880 #ifdef YYPARSE_PARAM
1881 int yyparse (void *);
1888 yyparse(YYPARSE_PARAM_ARG)
1891 register int yystate;
1893 register short *yyssp;
1894 register YYSTYPE *yyvsp;
1895 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1896 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1898 short yyssa[YYINITDEPTH]; /* the state stack */
1899 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1901 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1902 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1905 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1906 YYLTYPE *yyls = yylsa;
1909 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1911 #define YYPOPSTACK (yyvsp--, yyssp--)
1914 int yystacksize = YYINITDEPTH;
1915 int yyfree_stacks = 0;
1926 YYSTYPE yyval; /* the variable used to return */
1927 /* semantic values from the action */
1934 fprintf(stderr, "Starting parse\n");
1940 yychar = YYEMPTY; /* Cause a token to be read. */
1942 /* Initialize stack pointers.
1943 Waste one element of value and location stack
1944 so that they stay on the same level as the state stack.
1945 The wasted elements are never initialized. */
1953 /* Push a new state, which is found in yystate . */
1954 /* In all cases, when you get here, the value and location stacks
1955 have just been pushed. so pushing a state here evens the stacks. */
1960 if (yyssp >= yyss + yystacksize - 1)
1962 /* Give user a chance to reallocate the stack */
1963 /* Use copies of these so that the &'s don't force the real ones into memory. */
1964 YYSTYPE *yyvs1 = yyvs;
1965 short *yyss1 = yyss;
1967 YYLTYPE *yyls1 = yyls;
1970 /* Get the current used size of the three stacks, in elements. */
1971 int size = yyssp - yyss + 1;
1974 /* Each stack pointer address is followed by the size of
1975 the data in use in that stack, in bytes. */
1977 /* This used to be a conditional around just the two extra args,
1978 but that might be undefined if yyoverflow is a macro. */
1979 yyoverflow("parser stack overflow",
1980 &yyss1, size * sizeof (*yyssp),
1981 &yyvs1, size * sizeof (*yyvsp),
1982 &yyls1, size * sizeof (*yylsp),
1985 yyoverflow("parser stack overflow",
1986 &yyss1, size * sizeof (*yyssp),
1987 &yyvs1, size * sizeof (*yyvsp),
1991 yyss = yyss1; yyvs = yyvs1;
1995 #else /* no yyoverflow */
1996 /* Extend the stack our own way. */
1997 if (yystacksize >= YYMAXDEPTH)
1999 yyerror("parser stack overflow");
2011 if (yystacksize > YYMAXDEPTH)
2012 yystacksize = YYMAXDEPTH;
2013 #ifndef YYSTACK_USE_ALLOCA
2016 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2017 __yy_memcpy ((char *)yyss, (char *)yyss1,
2018 size * (unsigned int) sizeof (*yyssp));
2019 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2020 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2021 size * (unsigned int) sizeof (*yyvsp));
2023 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2024 __yy_memcpy ((char *)yyls, (char *)yyls1,
2025 size * (unsigned int) sizeof (*yylsp));
2027 #endif /* no yyoverflow */
2029 yyssp = yyss + size - 1;
2030 yyvsp = yyvs + size - 1;
2032 yylsp = yyls + size - 1;
2037 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2040 if (yyssp >= yyss + yystacksize - 1)
2046 fprintf(stderr, "Entering state %d\n", yystate);
2052 /* Do appropriate processing given the current state. */
2053 /* Read a lookahead token if we need one and don't already have one. */
2056 /* First try to decide what to do without reference to lookahead token. */
2058 yyn = yypact[yystate];
2062 /* Not known => get a lookahead token if don't already have one. */
2064 /* yychar is either YYEMPTY or YYEOF
2065 or a valid token in external form. */
2067 if (yychar == YYEMPTY)
2071 fprintf(stderr, "Reading a token: ");
2076 /* Convert token to internal form (in yychar1) for indexing tables with */
2078 if (yychar <= 0) /* This means end of input. */
2081 yychar = YYEOF; /* Don't call YYLEX any more */
2085 fprintf(stderr, "Now at end of input.\n");
2090 yychar1 = YYTRANSLATE(yychar);
2095 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2096 /* Give the individual parser a way to print the precise meaning
2097 of a token, for further debugging info. */
2099 YYPRINT (stderr, yychar, yylval);
2101 fprintf (stderr, ")\n");
2107 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2112 /* yyn is what to do for this token type in this state.
2113 Negative => reduce, -yyn is rule number.
2114 Positive => shift, yyn is new state.
2115 New state is final state => don't bother to shift,
2116 just return success.
2117 0, or most negative number => error. */
2132 /* Shift the lookahead token. */
2136 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2139 /* Discard the token being shifted unless it is eof. */
2140 if (yychar != YYEOF)
2148 /* count tokens shifted since error; after three, turn off error status. */
2149 if (yyerrstatus) yyerrstatus--;
2154 /* Do the default action for the current state. */
2157 yyn = yydefact[yystate];
2161 /* Do a reduction. yyn is the number of a rule to reduce with. */
2165 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2172 fprintf (stderr, "Reducing via rule %d (line %d), ",
2175 /* Print the symbols being reduced, and their result. */
2176 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2177 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2178 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2186 #line 989 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2188 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
2189 ThrowException("Value too large for type!");
2190 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
2194 #line 997 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2196 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
2197 ThrowException("Value too large for type!");
2198 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
2202 #line 1020 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2204 yyval.StrVal = yyvsp[-1].StrVal;
2208 #line 1023 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2214 #line 1027 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2215 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2218 #line 1028 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2219 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2222 #line 1029 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2223 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2226 #line 1030 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2227 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2230 #line 1031 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2231 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2234 #line 1033 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2235 { yyval.UIntVal = CallingConv::C; ;
2238 #line 1034 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2239 { yyval.UIntVal = CallingConv::C; ;
2242 #line 1035 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2243 { yyval.UIntVal = CallingConv::Fast; ;
2246 #line 1036 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2247 { yyval.UIntVal = CallingConv::Cold; ;
2250 #line 1037 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2252 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2253 ThrowException("Calling conv too large!");
2254 yyval.UIntVal = yyvsp[0].UInt64Val;
2258 #line 1045 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2259 { yyval.UIntVal = 0; ;
2262 #line 1046 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2264 yyval.UIntVal = yyvsp[0].UInt64Val;
2265 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2266 ThrowException("Alignment must be a power of two!");
2270 #line 1051 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2271 { yyval.UIntVal = 0; ;
2274 #line 1052 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2276 yyval.UIntVal = yyvsp[0].UInt64Val;
2277 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2278 ThrowException("Alignment must be a power of two!");
2282 #line 1059 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2284 for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i)
2285 if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\')
2286 ThrowException("Invalid character in section name!");
2287 yyval.StrVal = yyvsp[0].StrVal;
2291 #line 1066 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2292 { yyval.StrVal = 0; ;
2295 #line 1067 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2296 { yyval.StrVal = yyvsp[0].StrVal; ;
2299 #line 1072 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2303 #line 1073 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2307 #line 1074 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2309 CurGV->setSection(yyvsp[0].StrVal);
2310 free(yyvsp[0].StrVal);
2314 #line 1078 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2316 CurGV->setAlignment(yyvsp[0].UInt64Val);
2320 #line 1089 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2321 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2324 #line 1090 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2325 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2328 #line 1092 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2330 if (!UpRefs.empty())
2331 ThrowException("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
2332 yyval.TypeVal = yyvsp[0].TypeVal;
2336 #line 1103 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2338 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2342 #line 1106 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2344 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2348 #line 1109 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2349 { // Named types are also simple types...
2350 yyval.TypeVal = new PATypeHolder(getTypeVal(yyvsp[0].ValIDVal));
2354 #line 1115 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2355 { // Type UpReference
2356 if (yyvsp[0].UInt64Val > (uint64_t)~0U) ThrowException("Value out of range!");
2357 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2358 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2359 yyval.TypeVal = new PATypeHolder(OT);
2360 UR_OUT("New Upreference!\n");
2364 #line 1122 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2365 { // Function derived type?
2366 std::vector<const Type*> Params;
2367 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2368 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2369 Params.push_back(*I);
2370 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2371 if (isVarArg) Params.pop_back();
2373 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg)));
2374 delete yyvsp[-1].TypeList; // Delete the argument list
2375 delete yyvsp[-3].TypeVal; // Delete the return type handle
2379 #line 1134 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2380 { // Sized array type?
2381 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2382 delete yyvsp[-1].TypeVal;
2386 #line 1138 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2387 { // Packed array type?
2388 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
2389 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
2390 ThrowException("Unsigned result not equal to signed result");
2391 if (!ElemTy->isPrimitiveType())
2392 ThrowException("Elemental type of a PackedType must be primitive");
2393 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
2394 ThrowException("Vector length should be a power of 2!");
2395 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2396 delete yyvsp[-1].TypeVal;
2400 #line 1149 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2401 { // Structure type?
2402 std::vector<const Type*> Elements;
2403 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2404 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2405 Elements.push_back(*I);
2407 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
2408 delete yyvsp[-1].TypeList;
2412 #line 1158 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2413 { // Empty structure type?
2414 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
2418 #line 1161 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2420 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2421 delete yyvsp[-1].TypeVal;
2425 #line 1169 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2427 yyval.TypeList = new std::list<PATypeHolder>();
2428 yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2432 #line 1173 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2434 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2438 #line 1179 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2440 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy);
2444 #line 1182 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2446 (yyval.TypeList = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
2450 #line 1185 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2452 yyval.TypeList = new std::list<PATypeHolder>();
2456 #line 1195 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2457 { // Nonempty unsized arr
2458 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
2460 ThrowException("Cannot make array constant with type: '" +
2461 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2462 const Type *ETy = ATy->getElementType();
2463 int NumElements = ATy->getNumElements();
2465 // Verify that we have the correct size...
2466 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2467 ThrowException("Type mismatch: constant sized array initialized with " +
2468 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
2469 itostr(NumElements) + "!");
2471 // Verify all elements are correct type!
2472 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2473 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2474 ThrowException("Element #" + utostr(i) + " is not of type '" +
2475 ETy->getDescription() +"' as required!\nIt is of type '"+
2476 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2479 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
2480 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2484 #line 1220 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2486 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2488 ThrowException("Cannot make array constant with type: '" +
2489 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2491 int NumElements = ATy->getNumElements();
2492 if (NumElements != -1 && NumElements != 0)
2493 ThrowException("Type mismatch: constant sized array initialized with 0"
2494 " arguments, but has size of " + itostr(NumElements) +"!");
2495 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
2496 delete yyvsp[-2].TypeVal;
2500 #line 1233 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2502 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2504 ThrowException("Cannot make array constant with type: '" +
2505 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2507 int NumElements = ATy->getNumElements();
2508 const Type *ETy = ATy->getElementType();
2509 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
2510 if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
2511 ThrowException("Can't build string constant of size " +
2512 itostr((int)(EndStr-yyvsp[0].StrVal)) +
2513 " when array has size " + itostr(NumElements) + "!");
2514 std::vector<Constant*> Vals;
2515 if (ETy == Type::SByteTy) {
2516 for (char *C = yyvsp[0].StrVal; C != EndStr; ++C)
2517 Vals.push_back(ConstantSInt::get(ETy, *C));
2518 } else if (ETy == Type::UByteTy) {
2519 for (char *C = yyvsp[0].StrVal; C != EndStr; ++C)
2520 Vals.push_back(ConstantUInt::get(ETy, (unsigned char)*C));
2522 free(yyvsp[0].StrVal);
2523 ThrowException("Cannot build string arrays of non byte sized elements!");
2525 free(yyvsp[0].StrVal);
2526 yyval.ConstVal = ConstantArray::get(ATy, Vals);
2527 delete yyvsp[-2].TypeVal;
2531 #line 1261 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2532 { // Nonempty unsized arr
2533 const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get());
2535 ThrowException("Cannot make packed constant with type: '" +
2536 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2537 const Type *ETy = PTy->getElementType();
2538 int NumElements = PTy->getNumElements();
2540 // Verify that we have the correct size...
2541 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2542 ThrowException("Type mismatch: constant sized packed initialized with " +
2543 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
2544 itostr(NumElements) + "!");
2546 // Verify all elements are correct type!
2547 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2548 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2549 ThrowException("Element #" + utostr(i) + " is not of type '" +
2550 ETy->getDescription() +"' as required!\nIt is of type '"+
2551 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2554 yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector);
2555 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2559 #line 1286 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2561 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
2563 ThrowException("Cannot make struct constant with type: '" +
2564 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2566 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
2567 ThrowException("Illegal number of initializers for structure type!");
2569 // Check to ensure that constants are compatible with the type initializer!
2570 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
2571 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
2572 ThrowException("Expected type '" +
2573 STy->getElementType(i)->getDescription() +
2574 "' for element #" + utostr(i) +
2575 " of structure initializer!");
2577 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
2578 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2582 #line 1306 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2584 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
2586 ThrowException("Cannot make struct constant with type: '" +
2587 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2589 if (STy->getNumContainedTypes() != 0)
2590 ThrowException("Illegal number of initializers for structure type!");
2592 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
2593 delete yyvsp[-2].TypeVal;
2597 #line 1318 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2599 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2601 ThrowException("Cannot make null pointer constant with type: '" +
2602 (*yyvsp[-1].TypeVal)->getDescription() + "'!");
2604 yyval.ConstVal = ConstantPointerNull::get(PTy);
2605 delete yyvsp[-1].TypeVal;
2609 #line 1327 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2611 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
2612 delete yyvsp[-1].TypeVal;
2616 #line 1331 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2618 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2620 ThrowException("Global const reference must be a pointer type!");
2622 // ConstExprs can exist in the body of a function, thus creating
2623 // GlobalValues whenever they refer to a variable. Because we are in
2624 // the context of a function, getValNonImprovising will search the functions
2625 // symbol table instead of the module symbol table for the global symbol,
2626 // which throws things all off. To get around this, we just tell
2627 // getValNonImprovising that we are at global scope here.
2629 Function *SavedCurFn = CurFun.CurrentFunction;
2630 CurFun.CurrentFunction = 0;
2632 Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal);
2634 CurFun.CurrentFunction = SavedCurFn;
2636 // If this is an initializer for a constant pointer, which is referencing a
2637 // (currently) undefined variable, create a stub now that shall be replaced
2638 // in the future with the right type of variable.
2641 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
2642 const PointerType *PT = cast<PointerType>(Ty);
2644 // First check to see if the forward references value is already created!
2645 PerModuleInfo::GlobalRefsType::iterator I =
2646 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
2648 if (I != CurModule.GlobalRefs.end()) {
2649 V = I->second; // Placeholder already exists, use it...
2650 yyvsp[0].ValIDVal.destroy();
2653 if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name;
2655 // Create the forward referenced global.
2657 if (const FunctionType *FTy =
2658 dyn_cast<FunctionType>(PT->getElementType())) {
2659 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
2660 CurModule.CurrentModule);
2662 GV = new GlobalVariable(PT->getElementType(), false,
2663 GlobalValue::ExternalLinkage, 0,
2664 Name, CurModule.CurrentModule);
2667 // Keep track of the fact that we have a forward ref to recycle it
2668 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
2673 yyval.ConstVal = cast<GlobalValue>(V);
2674 delete yyvsp[-1].TypeVal; // Free the type handle
2678 #line 1390 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2680 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
2681 ThrowException("Mismatched types for constant expression!");
2682 yyval.ConstVal = yyvsp[0].ConstVal;
2683 delete yyvsp[-1].TypeVal;
2687 #line 1396 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2689 const Type *Ty = yyvsp[-1].TypeVal->get();
2690 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
2691 ThrowException("Cannot create a null initialized value of this type!");
2692 yyval.ConstVal = Constant::getNullValue(Ty);
2693 delete yyvsp[-1].TypeVal;
2697 #line 1404 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2698 { // integral constants
2699 if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
2700 ThrowException("Constant value doesn't fit in type!");
2701 yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val);
2705 #line 1409 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2706 { // integral constants
2707 if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
2708 ThrowException("Constant value doesn't fit in type!");
2709 yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val);
2713 #line 1414 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2714 { // Boolean constants
2715 yyval.ConstVal = ConstantBool::True;
2719 #line 1417 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2720 { // Boolean constants
2721 yyval.ConstVal = ConstantBool::False;
2725 #line 1420 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2726 { // Float & Double constants
2727 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
2728 ThrowException("Floating point constant invalid for type!!");
2729 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
2733 #line 1427 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2735 if (!yyvsp[-3].ConstVal->getType()->isFirstClassType())
2736 ThrowException("cast constant expression from a non-primitive type: '" +
2737 yyvsp[-3].ConstVal->getType()->getDescription() + "'!");
2738 if (!yyvsp[-1].TypeVal->get()->isFirstClassType())
2739 ThrowException("cast constant expression to a non-primitive type: '" +
2740 yyvsp[-1].TypeVal->get()->getDescription() + "'!");
2741 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get());
2742 delete yyvsp[-1].TypeVal;
2746 #line 1437 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2748 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
2749 ThrowException("GetElementPtr requires a pointer operand!");
2751 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
2752 // indices to uint struct indices for compatibility.
2753 generic_gep_type_iterator<std::vector<Value*>::iterator>
2754 GTI = gep_type_begin(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()),
2755 GTE = gep_type_end(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
2756 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
2757 if (isa<StructType>(*GTI)) // Only change struct indices
2758 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[-1].ValueList)[i]))
2759 if (CUI->getType() == Type::UByteTy)
2760 (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
2763 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true);
2765 ThrowException("Index list invalid for constant getelementptr!");
2767 std::vector<Constant*> IdxVec;
2768 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
2769 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
2770 IdxVec.push_back(C);
2772 ThrowException("Indices to constant getelementptr must be constants!");
2774 delete yyvsp[-1].ValueList;
2776 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec);
2780 #line 1468 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2782 if (yyvsp[-5].ConstVal->getType() != Type::BoolTy)
2783 ThrowException("Select condition must be of boolean type!");
2784 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2785 ThrowException("Select operand types must match!");
2786 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2790 #line 1475 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2792 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2793 ThrowException("Binary operator types must match!");
2794 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
2795 // To retain backward compatibility with these early compilers, we emit a
2796 // cast to the appropriate integer type automatically if we are in the
2797 // broken case. See PR424 for more information.
2798 if (!isa<PointerType>(yyvsp[-3].ConstVal->getType())) {
2799 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2801 const Type *IntPtrTy = 0;
2802 switch (CurModule.CurrentModule->getPointerSize()) {
2803 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
2804 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
2805 default: ThrowException("invalid pointer binary constant expr!");
2807 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, ConstantExpr::getCast(yyvsp[-3].ConstVal, IntPtrTy),
2808 ConstantExpr::getCast(yyvsp[-1].ConstVal, IntPtrTy));
2809 yyval.ConstVal = ConstantExpr::getCast(yyval.ConstVal, yyvsp[-3].ConstVal->getType());
2814 #line 1496 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2816 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2817 ThrowException("Logical operator types must match!");
2818 if (!yyvsp[-3].ConstVal->getType()->isIntegral())
2819 ThrowException("Logical operands must have integral types!");
2820 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2824 #line 1503 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2826 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2827 ThrowException("setcc operand types must match!");
2828 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2832 #line 1508 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2834 if (yyvsp[-1].ConstVal->getType() != Type::UByteTy)
2835 ThrowException("Shift count for shift constant must be unsigned byte!");
2836 if (!yyvsp[-3].ConstVal->getType()->isInteger())
2837 ThrowException("Shift constant expression requires integer operand!");
2838 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2842 #line 1518 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2844 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
2848 #line 1521 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2850 yyval.ConstVector = new std::vector<Constant*>();
2851 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
2855 #line 1528 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2856 { yyval.BoolVal = false; ;
2859 #line 1528 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2860 { yyval.BoolVal = true; ;
2863 #line 1538 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2865 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
2866 CurModule.ModuleDone();
2870 #line 1545 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2872 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2873 CurFun.FunctionDone();
2877 #line 1549 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2879 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2883 #line 1552 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2885 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2889 #line 1555 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2891 yyval.ModuleVal = CurModule.CurrentModule;
2892 // Emit an error if there are any unresolved types left.
2893 if (!CurModule.LateResolveTypes.empty()) {
2894 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
2895 if (DID.Type == ValID::NameVal)
2896 ThrowException("Reference to an undefined type: '"+DID.getName() + "'");
2898 ThrowException("Reference to an undefined type: #" + itostr(DID.Num));
2903 #line 1568 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2905 // Eagerly resolve types. This is not an optimization, this is a
2906 // requirement that is due to the fact that we could have this:
2908 // %list = type { %list * }
2909 // %list = type { %list * } ; repeated type decl
2911 // If types are not resolved eagerly, then the two types will not be
2912 // determined to be the same type!
2914 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
2916 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
2917 // If this is a named type that is not a redefinition, add it to the slot
2919 CurModule.Types.push_back(*yyvsp[0].TypeVal);
2922 delete yyvsp[0].TypeVal;
2926 #line 1588 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2927 { // Function prototypes can be in const pool
2931 #line 1590 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2933 if (yyvsp[0].ConstVal == 0) ThrowException("Global value initializer is not a constant!");
2934 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal);
2938 #line 1593 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2944 #line 1596 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2946 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage,
2947 yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
2948 delete yyvsp[0].TypeVal;
2952 #line 1600 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2958 #line 1603 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2963 #line 1605 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2968 #line 1607 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2973 #line 1612 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2974 { yyval.Endianness = Module::BigEndian; ;
2977 #line 1613 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2978 { yyval.Endianness = Module::LittleEndian; ;
2981 #line 1615 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2983 CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness);
2987 #line 1618 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2989 if (yyvsp[0].UInt64Val == 32)
2990 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
2991 else if (yyvsp[0].UInt64Val == 64)
2992 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
2994 ThrowException("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!");
2998 #line 1626 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3000 CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
3001 free(yyvsp[0].StrVal);
3005 #line 1633 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3007 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
3008 free(yyvsp[0].StrVal);
3012 #line 1637 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3014 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
3015 free(yyvsp[0].StrVal);
3019 #line 1641 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3024 #line 1650 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3025 { yyval.StrVal = 0; ;
3028 #line 1652 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3030 if (*yyvsp[-1].TypeVal == Type::VoidTy)
3031 ThrowException("void typed arguments are invalid!");
3032 yyval.ArgVal = new std::pair<PATypeHolder*, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
3036 #line 1658 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3038 yyval.ArgList = yyvsp[-2].ArgList;
3039 yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal);
3040 delete yyvsp[0].ArgVal;
3044 #line 1663 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3046 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
3047 yyval.ArgList->push_back(*yyvsp[0].ArgVal);
3048 delete yyvsp[0].ArgVal;
3052 #line 1669 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3054 yyval.ArgList = yyvsp[0].ArgList;
3058 #line 1672 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3060 yyval.ArgList = yyvsp[-2].ArgList;
3061 yyval.ArgList->push_back(std::pair<PATypeHolder*,
3062 char*>(new PATypeHolder(Type::VoidTy), 0));
3066 #line 1677 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3068 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
3069 yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
3073 #line 1681 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3079 #line 1686 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3081 UnEscapeLexed(yyvsp[-5].StrVal);
3082 std::string FunctionName(yyvsp[-5].StrVal);
3083 free(yyvsp[-5].StrVal); // Free strdup'd memory!
3085 if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy)
3086 ThrowException("LLVM functions cannot return aggregate types!");
3088 std::vector<const Type*> ParamTypeList;
3089 if (yyvsp[-3].ArgList) { // If there are arguments...
3090 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
3091 I != yyvsp[-3].ArgList->end(); ++I)
3092 ParamTypeList.push_back(I->first->get());
3095 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
3096 if (isVarArg) ParamTypeList.pop_back();
3098 const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg);
3099 const PointerType *PFT = PointerType::get(FT);
3100 delete yyvsp[-6].TypeVal;
3103 if (!FunctionName.empty()) {
3104 ID = ValID::create((char*)FunctionName.c_str());
3106 ID = ValID::create((int)CurModule.Values[PFT].size());
3110 // See if this function was forward referenced. If so, recycle the object.
3111 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
3112 // Move the function to the end of the list, from whereever it was
3113 // previously inserted.
3114 Fn = cast<Function>(FWRef);
3115 CurModule.CurrentModule->getFunctionList().remove(Fn);
3116 CurModule.CurrentModule->getFunctionList().push_back(Fn);
3117 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
3118 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
3119 // If this is the case, either we need to be a forward decl, or it needs
3121 if (!CurFun.isDeclare && !Fn->isExternal())
3122 ThrowException("Redefinition of function '" + FunctionName + "'!");
3124 // Make sure to strip off any argument names so we can't get conflicts.
3125 if (Fn->isExternal())
3126 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
3130 } else { // Not already defined?
3131 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
3132 CurModule.CurrentModule);
3133 InsertValue(Fn, CurModule.Values);
3136 CurFun.FunctionStart(Fn);
3137 Fn->setCallingConv(yyvsp[-7].UIntVal);
3138 Fn->setAlignment(yyvsp[0].UIntVal);
3139 if (yyvsp[-1].StrVal) {
3140 Fn->setSection(yyvsp[-1].StrVal);
3141 free(yyvsp[-1].StrVal);
3144 // Add all of the arguments we parsed to the function...
3145 if (yyvsp[-3].ArgList) { // Is null if empty...
3146 if (isVarArg) { // Nuke the last entry
3147 assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&&
3148 "Not a varargs marker!");
3149 delete yyvsp[-3].ArgList->back().first;
3150 yyvsp[-3].ArgList->pop_back(); // Delete the last entry
3152 Function::arg_iterator ArgIt = Fn->arg_begin();
3153 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
3154 I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) {
3155 delete I->first; // Delete the typeholder...
3157 setValueName(ArgIt, I->second); // Insert arg into symtab...
3161 delete yyvsp[-3].ArgList; // We're now done with the argument list
3166 #line 1773 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3168 yyval.FunctionVal = CurFun.CurrentFunction;
3170 // Make sure that we keep track of the linkage type even if there was a
3171 // previous "declare".
3172 yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage);
3176 #line 1783 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3178 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3182 #line 1787 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3183 { CurFun.isDeclare = true; ;
3186 #line 1787 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3188 yyval.FunctionVal = CurFun.CurrentFunction;
3189 CurFun.FunctionDone();
3193 #line 1796 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3194 { // A reference to a direct constant
3195 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
3199 #line 1799 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3201 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
3205 #line 1802 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3206 { // Perhaps it's an FP constant?
3207 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
3211 #line 1805 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3213 yyval.ValIDVal = ValID::create(ConstantBool::True);
3217 #line 1808 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3219 yyval.ValIDVal = ValID::create(ConstantBool::False);
3223 #line 1811 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3225 yyval.ValIDVal = ValID::createNull();
3229 #line 1814 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3231 yyval.ValIDVal = ValID::createUndef();
3235 #line 1817 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3236 { // Nonempty unsized packed vector
3237 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
3238 int NumElements = yyvsp[-1].ConstVector->size();
3240 PackedType* pt = PackedType::get(ETy, NumElements);
3241 PATypeHolder* PTy = new PATypeHolder(
3249 // Verify all elements are correct type!
3250 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3251 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3252 ThrowException("Element #" + utostr(i) + " is not of type '" +
3253 ETy->getDescription() +"' as required!\nIt is of type '" +
3254 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3257 yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector));
3258 delete PTy; delete yyvsp[-1].ConstVector;
3262 #line 1841 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3264 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
3268 #line 1848 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3269 { // Is it an integer reference...?
3270 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
3274 #line 1851 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3275 { // Is it a named reference...?
3276 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
3280 #line 1862 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3282 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal;
3286 #line 1866 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3288 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3292 #line 1869 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3293 { // Do not allow functions with 0 basic blocks
3294 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3298 #line 1877 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3300 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
3301 InsertValue(yyvsp[0].TermInstVal);
3303 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
3304 InsertValue(yyvsp[-2].BasicBlockVal);
3305 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
3309 #line 1886 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3311 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
3312 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
3316 #line 1890 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3318 yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
3320 // Make sure to move the basic block to the correct location in the
3321 // function, instead of leaving it inserted wherever it was first
3323 Function::BasicBlockListType &BBL =
3324 CurFun.CurrentFunction->getBasicBlockList();
3325 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3329 #line 1900 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3331 yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true);
3333 // Make sure to move the basic block to the correct location in the
3334 // function, instead of leaving it inserted wherever it was first
3336 Function::BasicBlockListType &BBL =
3337 CurFun.CurrentFunction->getBasicBlockList();
3338 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3342 #line 1911 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3343 { // Return with a result...
3344 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
3348 #line 1914 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3349 { // Return with no result...
3350 yyval.TermInstVal = new ReturnInst();
3354 #line 1917 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3355 { // Unconditional Branch...
3356 yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[0].ValIDVal));
3360 #line 1920 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3362 yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[-3].ValIDVal), getBBVal(yyvsp[0].ValIDVal), getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
3366 #line 1923 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3368 SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal), getBBVal(yyvsp[-3].ValIDVal), yyvsp[-1].JumpTable->size());
3369 yyval.TermInstVal = S;
3371 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
3372 E = yyvsp[-1].JumpTable->end();
3373 for (; I != E; ++I) {
3374 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
3375 S->addCase(CI, I->second);
3377 ThrowException("Switch case is constant, but not a simple integer!");
3379 delete yyvsp[-1].JumpTable;
3383 #line 1937 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3385 SwitchInst *S = new SwitchInst(getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal), getBBVal(yyvsp[-2].ValIDVal), 0);
3386 yyval.TermInstVal = S;
3390 #line 1942 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3392 const PointerType *PFTy;
3393 const FunctionType *Ty;
3395 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal->get())) ||
3396 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3397 // Pull out the types of all of the arguments...
3398 std::vector<const Type*> ParamTypes;
3399 if (yyvsp[-7].ValueList) {
3400 for (std::vector<Value*>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
3402 ParamTypes.push_back((*I)->getType());
3405 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3406 if (isVarArg) ParamTypes.pop_back();
3408 Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg);
3409 PFTy = PointerType::get(Ty);
3412 Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling...
3414 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
3415 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
3417 // Create the call node...
3418 if (!yyvsp[-7].ValueList) { // Has no arguments?
3419 yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector<Value*>());
3420 } else { // Has arguments?
3421 // Loop through FunctionType's arguments and ensure they are specified
3424 FunctionType::param_iterator I = Ty->param_begin();
3425 FunctionType::param_iterator E = Ty->param_end();
3426 std::vector<Value*>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
3428 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3429 if ((*ArgI)->getType() != *I)
3430 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3431 (*I)->getDescription() + "'!");
3433 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3434 ThrowException("Invalid number of parameters detected!");
3436 yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList);
3438 cast<InvokeInst>(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal);
3440 delete yyvsp[-10].TypeVal;
3441 delete yyvsp[-7].ValueList;
3445 #line 1994 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3447 yyval.TermInstVal = new UnwindInst();
3451 #line 1997 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3453 yyval.TermInstVal = new UnreachableInst();
3457 #line 2003 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3459 yyval.JumpTable = yyvsp[-5].JumpTable;
3460 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3462 ThrowException("May only switch on a constant pool value!");
3464 yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal)));
3468 #line 2011 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3470 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
3471 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3474 ThrowException("May only switch on a constant pool value!");
3476 yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal)));
3480 #line 2021 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3482 // Is this definition named?? if so, assign the name...
3483 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
3484 InsertValue(yyvsp[0].InstVal);
3485 yyval.InstVal = yyvsp[0].InstVal;
3489 #line 2028 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3490 { // Used for PHI nodes
3491 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
3492 yyval.PHIList->push_back(std::make_pair(getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal), getBBVal(yyvsp[-1].ValIDVal)));
3493 delete yyvsp[-5].TypeVal;
3497 #line 2033 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3499 yyval.PHIList = yyvsp[-6].PHIList;
3500 yyvsp[-6].PHIList->push_back(std::make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal),
3501 getBBVal(yyvsp[-1].ValIDVal)));
3505 #line 2040 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3506 { // Used for call statements, and memory insts...
3507 yyval.ValueList = new std::vector<Value*>();
3508 yyval.ValueList->push_back(yyvsp[0].ValueVal);
3512 #line 2044 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3514 yyval.ValueList = yyvsp[-2].ValueList;
3515 yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
3519 #line 2050 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3520 { yyval.ValueList = 0; ;
3523 #line 2052 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3525 yyval.BoolVal = true;
3529 #line 2055 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3531 yyval.BoolVal = false;
3535 #line 2061 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3537 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
3538 !isa<PackedType>((*yyvsp[-3].TypeVal).get()))
3540 "Arithmetic operator requires integer, FP, or packed operands!");
3541 if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem)
3542 ThrowException("Rem not supported on packed types!");
3543 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3544 if (yyval.InstVal == 0)
3545 ThrowException("binary operator returned null!");
3546 delete yyvsp[-3].TypeVal;
3550 #line 2073 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3552 if (!(*yyvsp[-3].TypeVal)->isIntegral())
3553 ThrowException("Logical operator requires integral operands!");
3554 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3555 if (yyval.InstVal == 0)
3556 ThrowException("binary operator returned null!");
3557 delete yyvsp[-3].TypeVal;
3561 #line 2081 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3563 if(isa<PackedType>((*yyvsp[-3].TypeVal).get())) {
3565 "PackedTypes currently not supported in setcc instructions!");
3567 yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3568 if (yyval.InstVal == 0)
3569 ThrowException("binary operator returned null!");
3570 delete yyvsp[-3].TypeVal;
3574 #line 2091 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3576 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
3577 << " Replacing with 'xor'.\n";
3579 Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType());
3581 ThrowException("Expected integral type for not instruction!");
3583 yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones);
3584 if (yyval.InstVal == 0)
3585 ThrowException("Could not create a xor instruction!");
3589 #line 2103 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3591 if (yyvsp[0].ValueVal->getType() != Type::UByteTy)
3592 ThrowException("Shift amount must be ubyte!");
3593 if (!yyvsp[-2].ValueVal->getType()->isInteger())
3594 ThrowException("Shift constant expression requires integer operand!");
3595 yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3599 #line 2110 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3601 if (!yyvsp[0].TypeVal->get()->isFirstClassType())
3602 ThrowException("cast instruction to a non-primitive type: '" +
3603 yyvsp[0].TypeVal->get()->getDescription() + "'!");
3604 yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
3605 delete yyvsp[0].TypeVal;
3609 #line 2117 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3611 if (yyvsp[-4].ValueVal->getType() != Type::BoolTy)
3612 ThrowException("select condition must be boolean!");
3613 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
3614 ThrowException("select value types should match!");
3615 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3619 #line 2124 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3622 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
3623 delete yyvsp[0].TypeVal;
3627 #line 2129 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3629 ObsoleteVarArgs = true;
3630 const Type* ArgTy = yyvsp[-2].ValueVal->getType();
3631 Function* NF = CurModule.CurrentModule->
3632 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
3635 //foo = alloca 1 of t
3639 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
3640 CurBB->getInstList().push_back(foo);
3641 CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
3642 CurBB->getInstList().push_back(bar);
3643 CurBB->getInstList().push_back(new StoreInst(bar, foo));
3644 yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal);
3645 delete yyvsp[0].TypeVal;
3649 #line 2148 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3651 ObsoleteVarArgs = true;
3652 const Type* ArgTy = yyvsp[-2].ValueVal->getType();
3653 Function* NF = CurModule.CurrentModule->
3654 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
3656 //b = vanext a, t ->
3657 //foo = alloca 1 of t
3660 //tmp = vaarg foo, t
3662 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
3663 CurBB->getInstList().push_back(foo);
3664 CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
3665 CurBB->getInstList().push_back(bar);
3666 CurBB->getInstList().push_back(new StoreInst(bar, foo));
3667 Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal);
3668 CurBB->getInstList().push_back(tmp);
3669 yyval.InstVal = new LoadInst(foo);
3670 delete yyvsp[0].TypeVal;
3674 #line 2170 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3676 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
3677 if (!Ty->isFirstClassType())
3678 ThrowException("PHI node operands must be of first class type!");
3679 yyval.InstVal = new PHINode(Ty);
3680 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
3681 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
3682 if (yyvsp[0].PHIList->front().first->getType() != Ty)
3683 ThrowException("All elements of a PHI node must be of the same type!");
3684 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
3685 yyvsp[0].PHIList->pop_front();
3687 delete yyvsp[0].PHIList; // Free the list...
3691 #line 2184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3693 const PointerType *PFTy;
3694 const FunctionType *Ty;
3696 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal->get())) ||
3697 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3698 // Pull out the types of all of the arguments...
3699 std::vector<const Type*> ParamTypes;
3700 if (yyvsp[-1].ValueList) {
3701 for (std::vector<Value*>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
3703 ParamTypes.push_back((*I)->getType());
3706 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3707 if (isVarArg) ParamTypes.pop_back();
3709 if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy)
3710 ThrowException("LLVM functions cannot return aggregate types!");
3712 Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg);
3713 PFTy = PointerType::get(Ty);
3716 Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling...
3718 // Create the call node...
3719 if (!yyvsp[-1].ValueList) { // Has no arguments?
3720 // Make sure no arguments is a good thing!
3721 if (Ty->getNumParams() != 0)
3722 ThrowException("No arguments passed to a function that "
3723 "expects arguments!");
3725 yyval.InstVal = new CallInst(V, std::vector<Value*>());
3726 } else { // Has arguments?
3727 // Loop through FunctionType's arguments and ensure they are specified
3730 FunctionType::param_iterator I = Ty->param_begin();
3731 FunctionType::param_iterator E = Ty->param_end();
3732 std::vector<Value*>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
3734 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3735 if ((*ArgI)->getType() != *I)
3736 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3737 (*I)->getDescription() + "'!");
3739 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3740 ThrowException("Invalid number of parameters detected!");
3742 yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList);
3744 cast<CallInst>(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal);
3745 cast<CallInst>(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal);
3746 delete yyvsp[-4].TypeVal;
3747 delete yyvsp[-1].ValueList;
3751 #line 2241 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3753 yyval.InstVal = yyvsp[0].InstVal;
3757 #line 2247 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3759 yyval.ValueList = yyvsp[0].ValueList;
3763 #line 2249 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3765 yyval.ValueList = new std::vector<Value*>();
3769 #line 2253 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3771 yyval.BoolVal = true;
3775 #line 2256 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3777 yyval.BoolVal = false;
3781 #line 2262 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3783 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
3784 delete yyvsp[-1].TypeVal;
3788 #line 2266 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3790 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
3791 delete yyvsp[-4].TypeVal;
3795 #line 2270 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3797 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
3798 delete yyvsp[-1].TypeVal;
3802 #line 2274 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3804 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
3805 delete yyvsp[-4].TypeVal;
3809 #line 2278 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3811 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
3812 ThrowException("Trying to free nonpointer type " +
3813 yyvsp[0].ValueVal->getType()->getDescription() + "!");
3814 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
3818 #line 2285 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3820 if (!isa<PointerType>(yyvsp[-1].TypeVal->get()))
3821 ThrowException("Can't load from nonpointer type: " +
3822 (*yyvsp[-1].TypeVal)->getDescription());
3823 if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType())
3824 ThrowException("Can't load from pointer of non-first-class type: " +
3825 (*yyvsp[-1].TypeVal)->getDescription());
3826 yyval.InstVal = new LoadInst(getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), "", yyvsp[-3].BoolVal);
3827 delete yyvsp[-1].TypeVal;
3831 #line 2295 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3833 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3835 ThrowException("Can't store to a nonpointer type: " +
3836 (*yyvsp[-1].TypeVal)->getDescription());
3837 const Type *ElTy = PT->getElementType();
3838 if (ElTy != yyvsp[-3].ValueVal->getType())
3839 ThrowException("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() +
3840 "' into space of type '" + ElTy->getDescription() + "'!");
3842 yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), yyvsp[-5].BoolVal);
3843 delete yyvsp[-1].TypeVal;
3847 #line 2308 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3849 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
3850 ThrowException("getelementptr insn requires pointer operand!");
3852 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3853 // indices to uint struct indices for compatibility.
3854 generic_gep_type_iterator<std::vector<Value*>::iterator>
3855 GTI = gep_type_begin(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()),
3856 GTE = gep_type_end(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
3857 for (unsigned i = 0, e = yyvsp[0].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
3858 if (isa<StructType>(*GTI)) // Only change struct indices
3859 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[0].ValueList)[i]))
3860 if (CUI->getType() == Type::UByteTy)
3861 (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3863 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true))
3864 ThrowException("Invalid getelementptr indices for type '" +
3865 (*yyvsp[-2].TypeVal)->getDescription()+ "'!");
3866 yyval.InstVal = new GetElementPtrInst(getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ValueList);
3867 delete yyvsp[-2].TypeVal; delete yyvsp[0].ValueList;
3871 /* the action file gets copied in in place of this dollarsign */
3872 #line 543 "/usr/share/bison.simple"
3883 short *ssp1 = yyss - 1;
3884 fprintf (stderr, "state stack now");
3885 while (ssp1 != yyssp)
3886 fprintf (stderr, " %d", *++ssp1);
3887 fprintf (stderr, "\n");
3897 yylsp->first_line = yylloc.first_line;
3898 yylsp->first_column = yylloc.first_column;
3899 yylsp->last_line = (yylsp-1)->last_line;
3900 yylsp->last_column = (yylsp-1)->last_column;
3905 yylsp->last_line = (yylsp+yylen-1)->last_line;
3906 yylsp->last_column = (yylsp+yylen-1)->last_column;
3910 /* Now "shift" the result of the reduction.
3911 Determine what state that goes to,
3912 based on the state we popped back to
3913 and the rule number reduced by. */
3917 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
3918 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3919 yystate = yytable[yystate];
3921 yystate = yydefgoto[yyn - YYNTBASE];
3925 yyerrlab: /* here on detecting error */
3928 /* If not already recovering from an error, report this error. */
3932 #ifdef YYERROR_VERBOSE
3933 yyn = yypact[yystate];
3935 if (yyn > YYFLAG && yyn < YYLAST)
3942 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
3943 for (x = (yyn < 0 ? -yyn : 0);
3944 x < (sizeof(yytname) / sizeof(char *)); x++)
3945 if (yycheck[x + yyn] == x)
3946 size += strlen(yytname[x]) + 15, count++;
3947 msg = (char *) malloc(size + 15);
3950 strcpy(msg, "parse error");
3955 for (x = (yyn < 0 ? -yyn : 0);
3956 x < (sizeof(yytname) / sizeof(char *)); x++)
3957 if (yycheck[x + yyn] == x)
3959 strcat(msg, count == 0 ? ", expecting `" : " or `");
3960 strcat(msg, yytname[x]);
3969 yyerror ("parse error; also virtual memory exceeded");
3972 #endif /* YYERROR_VERBOSE */
3973 yyerror("parse error");
3977 yyerrlab1: /* here on error raised explicitly by an action */
3979 if (yyerrstatus == 3)
3981 /* if just tried and failed to reuse lookahead token after an error, discard it. */
3983 /* return failure if at end of input */
3984 if (yychar == YYEOF)
3989 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
3995 /* Else will try to reuse lookahead token
3996 after shifting the error token. */
3998 yyerrstatus = 3; /* Each real token shifted decrements this */
4002 yyerrdefault: /* current state does not do anything special for the error token. */
4005 /* This is wrong; only states that explicitly want error tokens
4006 should shift them. */
4007 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4008 if (yyn) goto yydefault;
4011 yyerrpop: /* pop the current state because it cannot handle the error token */
4013 if (yyssp == yyss) YYABORT;
4023 short *ssp1 = yyss - 1;
4024 fprintf (stderr, "Error: state stack now");
4025 while (ssp1 != yyssp)
4026 fprintf (stderr, " %d", *++ssp1);
4027 fprintf (stderr, "\n");
4033 yyn = yypact[yystate];
4038 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
4057 fprintf(stderr, "Shifting error token, ");
4069 /* YYACCEPT comes here. */
4081 /* YYABORT comes here. */
4092 #line 2331 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4094 int yyerror(const char *ErrorMsg) {
4096 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4097 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
4098 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
4099 if (yychar == YYEMPTY || yychar == 0)
4100 errMsg += "end-of-file.";
4102 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
4103 ThrowException(errMsg);