2 /* A Bison parser, made from /Volumes/ProjectsDisk/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
61 #define POINTERSIZE 304
70 #define FASTCC_TOK 313
71 #define COLDCC_TOK 314
77 #define UNREACHABLE 320
97 #define GETELEMENTPTR 340
104 #define VAARG_old 347
105 #define VANEXT_old 348
107 #line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
109 #include "ParserInternals.h"
110 #include "llvm/CallingConv.h"
111 #include "llvm/Instructions.h"
112 #include "llvm/Module.h"
113 #include "llvm/SymbolTable.h"
114 #include "llvm/Support/GetElementPtrTypeIterator.h"
115 #include "llvm/ADT/STLExtras.h"
116 #include "llvm/Support/MathExtras.h"
122 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
123 int yylex(); // declaration" of xxx warnings.
127 std::string CurFilename;
129 using namespace llvm;
131 static Module *ParserResult;
133 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
134 // relating to upreferences in the input stream.
136 //#define DEBUG_UPREFS 1
138 #define UR_OUT(X) std::cerr << X
143 #define YYERROR_VERBOSE 1
145 static bool ObsoleteVarArgs;
146 static bool NewVarArgs;
147 static BasicBlock* CurBB;
150 // This contains info used when building the body of a function. It is
151 // destroyed when the function is completed.
153 typedef std::vector<Value *> ValueList; // Numbered defs
155 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
156 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
158 static struct PerModuleInfo {
159 Module *CurrentModule;
160 std::map<const Type *, ValueList> Values; // Module level numbered definitions
161 std::map<const Type *,ValueList> LateResolveValues;
162 std::vector<PATypeHolder> Types;
163 std::map<ValID, PATypeHolder> LateResolveTypes;
165 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
166 /// how they were referenced and one which line of the input they came from so
167 /// that we can resolve them later and print error messages as appropriate.
168 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
170 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
171 // references to global values. Global values may be referenced before they
172 // are defined, and if so, the temporary object that they represent is held
173 // here. This is used for forward references of GlobalValues.
175 typedef std::map<std::pair<const PointerType *,
176 ValID>, GlobalValue*> GlobalRefsType;
177 GlobalRefsType GlobalRefs;
180 // If we could not resolve some functions at function compilation time
181 // (calls to functions before they are defined), resolve them now... Types
182 // are resolved when the constant pool has been completely parsed.
184 ResolveDefinitions(LateResolveValues);
186 // Check to make sure that all global value forward references have been
189 if (!GlobalRefs.empty()) {
190 std::string UndefinedReferences = "Unresolved global references exist:\n";
192 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
194 UndefinedReferences += " " + I->first.first->getDescription() + " " +
195 I->first.second.getName() + "\n";
197 ThrowException(UndefinedReferences);
200 Values.clear(); // Clear out function local definitions
206 // GetForwardRefForGlobal - Check to see if there is a forward reference
207 // for this global. If so, remove it from the GlobalRefs map and return it.
208 // If not, just return null.
209 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
210 // Check to see if there is a forward reference to this global variable...
211 // if there is, eliminate it and patch the reference to use the new def'n.
212 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
213 GlobalValue *Ret = 0;
214 if (I != GlobalRefs.end()) {
222 static struct PerFunctionInfo {
223 Function *CurrentFunction; // Pointer to current function being created
225 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
226 std::map<const Type*, ValueList> LateResolveValues;
227 bool isDeclare; // Is this function a forward declararation?
229 /// BBForwardRefs - When we see forward references to basic blocks, keep
230 /// track of them here.
231 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
232 std::vector<BasicBlock*> NumberedBlocks;
235 inline PerFunctionInfo() {
240 inline void FunctionStart(Function *M) {
245 void FunctionDone() {
246 NumberedBlocks.clear();
248 // Any forward referenced blocks left?
249 if (!BBForwardRefs.empty())
250 ThrowException("Undefined reference to label " +
251 BBForwardRefs.begin()->first->getName());
253 // Resolve all forward references now.
254 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
256 Values.clear(); // Clear out function local definitions
260 } CurFun; // Info for the current function...
262 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
265 //===----------------------------------------------------------------------===//
266 // Code to handle definitions of all the types
267 //===----------------------------------------------------------------------===//
269 static int InsertValue(Value *V,
270 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
271 if (V->hasName()) return -1; // Is this a numbered definition?
273 // Yes, insert the value into the value table...
274 ValueList &List = ValueTab[V->getType()];
276 return List.size()-1;
279 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
281 case ValID::NumberVal: // Is it a numbered definition?
282 // Module constants occupy the lowest numbered slots...
283 if ((unsigned)D.Num < CurModule.Types.size())
284 return CurModule.Types[(unsigned)D.Num];
286 case ValID::NameVal: // Is it a named definition?
287 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
288 D.destroy(); // Free old strdup'd memory...
293 ThrowException("Internal parser error: Invalid symbol type reference!");
296 // If we reached here, we referenced either a symbol that we don't know about
297 // or an id number that hasn't been read yet. We may be referencing something
298 // forward, so just create an entry to be resolved later and get to it...
300 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
303 if (inFunctionScope()) {
304 if (D.Type == ValID::NameVal)
305 ThrowException("Reference to an undefined type: '" + D.getName() + "'");
307 ThrowException("Reference to an undefined type: #" + itostr(D.Num));
310 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
311 if (I != CurModule.LateResolveTypes.end())
314 Type *Typ = OpaqueType::get();
315 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
319 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
320 SymbolTable &SymTab =
321 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
322 CurModule.CurrentModule->getSymbolTable();
323 return SymTab.lookup(Ty, Name);
326 // getValNonImprovising - Look up the value specified by the provided type and
327 // the provided ValID. If the value exists and has already been defined, return
328 // it. Otherwise return null.
330 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
331 if (isa<FunctionType>(Ty))
332 ThrowException("Functions are not values and "
333 "must be referenced as pointers");
336 case ValID::NumberVal: { // Is it a numbered definition?
337 unsigned Num = (unsigned)D.Num;
339 // Module constants occupy the lowest numbered slots...
340 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
341 if (VI != CurModule.Values.end()) {
342 if (Num < VI->second.size())
343 return VI->second[Num];
344 Num -= VI->second.size();
347 // Make sure that our type is within bounds
348 VI = CurFun.Values.find(Ty);
349 if (VI == CurFun.Values.end()) return 0;
351 // Check that the number is within bounds...
352 if (VI->second.size() <= Num) return 0;
354 return VI->second[Num];
357 case ValID::NameVal: { // Is it a named definition?
358 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
359 if (N == 0) return 0;
361 D.destroy(); // Free old strdup'd memory...
365 // Check to make sure that "Ty" is an integral type, and that our
366 // value will fit into the specified type...
367 case ValID::ConstSIntVal: // Is it a constant pool reference??
368 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64))
369 ThrowException("Signed integral constant '" +
370 itostr(D.ConstPool64) + "' is invalid for type '" +
371 Ty->getDescription() + "'!");
372 return ConstantSInt::get(Ty, D.ConstPool64);
374 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
375 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
376 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
377 ThrowException("Integral constant '" + utostr(D.UConstPool64) +
378 "' is invalid or out of range!");
379 } else { // This is really a signed reference. Transmogrify.
380 return ConstantSInt::get(Ty, D.ConstPool64);
383 return ConstantUInt::get(Ty, D.UConstPool64);
386 case ValID::ConstFPVal: // Is it a floating point const pool reference?
387 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
388 ThrowException("FP constant invalid for type!!");
389 return ConstantFP::get(Ty, D.ConstPoolFP);
391 case ValID::ConstNullVal: // Is it a null value?
392 if (!isa<PointerType>(Ty))
393 ThrowException("Cannot create a a non pointer null!");
394 return ConstantPointerNull::get(cast<PointerType>(Ty));
396 case ValID::ConstUndefVal: // Is it an undef value?
397 return UndefValue::get(Ty);
399 case ValID::ConstantVal: // Fully resolved constant?
400 if (D.ConstantValue->getType() != Ty)
401 ThrowException("Constant expression type different from required type!");
402 return D.ConstantValue;
405 assert(0 && "Unhandled case!");
409 assert(0 && "Unhandled case!");
413 // getVal - This function is identical to getValNonImprovising, except that if a
414 // value is not already defined, it "improvises" by creating a placeholder var
415 // that looks and acts just like the requested variable. When the value is
416 // defined later, all uses of the placeholder variable are replaced with the
419 static Value *getVal(const Type *Ty, const ValID &ID) {
420 if (Ty == Type::LabelTy)
421 ThrowException("Cannot use a basic block here");
423 // See if the value has already been defined.
424 Value *V = getValNonImprovising(Ty, ID);
427 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty))
428 ThrowException("Invalid use of a composite type!");
430 // If we reached here, we referenced either a symbol that we don't know about
431 // or an id number that hasn't been read yet. We may be referencing something
432 // forward, so just create an entry to be resolved later and get to it...
434 V = new Argument(Ty);
436 // Remember where this forward reference came from. FIXME, shouldn't we try
437 // to recycle these things??
438 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
441 if (inFunctionScope())
442 InsertValue(V, CurFun.LateResolveValues);
444 InsertValue(V, CurModule.LateResolveValues);
448 /// getBBVal - This is used for two purposes:
449 /// * If isDefinition is true, a new basic block with the specified ID is being
451 /// * If isDefinition is true, this is a reference to a basic block, which may
452 /// or may not be a forward reference.
454 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
455 assert(inFunctionScope() && "Can't get basic block at global scope!");
460 default: ThrowException("Illegal label reference " + ID.getName());
461 case ValID::NumberVal: // Is it a numbered definition?
462 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
463 CurFun.NumberedBlocks.resize(ID.Num+1);
464 BB = CurFun.NumberedBlocks[ID.Num];
466 case ValID::NameVal: // Is it a named definition?
468 if (Value *N = CurFun.CurrentFunction->
469 getSymbolTable().lookup(Type::LabelTy, Name))
470 BB = cast<BasicBlock>(N);
474 // See if the block has already been defined.
476 // If this is the definition of the block, make sure the existing value was
477 // just a forward reference. If it was a forward reference, there will be
478 // an entry for it in the PlaceHolderInfo map.
479 if (isDefinition && !CurFun.BBForwardRefs.erase(BB))
480 // The existing value was a definition, not a forward reference.
481 ThrowException("Redefinition of label " + ID.getName());
483 ID.destroy(); // Free strdup'd memory.
487 // Otherwise this block has not been seen before.
488 BB = new BasicBlock("", CurFun.CurrentFunction);
489 if (ID.Type == ValID::NameVal) {
490 BB->setName(ID.Name);
492 CurFun.NumberedBlocks[ID.Num] = BB;
495 // If this is not a definition, keep track of it so we can use it as a forward
498 // Remember where this forward reference came from.
499 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
501 // The forward declaration could have been inserted anywhere in the
502 // function: insert it into the correct place now.
503 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
504 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
511 //===----------------------------------------------------------------------===//
512 // Code to handle forward references in instructions
513 //===----------------------------------------------------------------------===//
515 // This code handles the late binding needed with statements that reference
516 // values not defined yet... for example, a forward branch, or the PHI node for
519 // This keeps a table (CurFun.LateResolveValues) of all such forward references
520 // and back patchs after we are done.
523 // ResolveDefinitions - If we could not resolve some defs at parsing
524 // time (forward branches, phi functions for loops, etc...) resolve the
528 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
529 std::map<const Type*,ValueList> *FutureLateResolvers) {
530 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
531 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
532 E = LateResolvers.end(); LRI != E; ++LRI) {
533 ValueList &List = LRI->second;
534 while (!List.empty()) {
535 Value *V = List.back();
538 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
539 CurModule.PlaceHolderInfo.find(V);
540 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
542 ValID &DID = PHI->second.first;
544 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
546 V->replaceAllUsesWith(TheRealValue);
548 CurModule.PlaceHolderInfo.erase(PHI);
549 } else if (FutureLateResolvers) {
550 // Functions have their unresolved items forwarded to the module late
552 InsertValue(V, *FutureLateResolvers);
554 if (DID.Type == ValID::NameVal)
555 ThrowException("Reference to an invalid definition: '" +DID.getName()+
556 "' of type '" + V->getType()->getDescription() + "'",
559 ThrowException("Reference to an invalid definition: #" +
560 itostr(DID.Num) + " of type '" +
561 V->getType()->getDescription() + "'",
567 LateResolvers.clear();
570 // ResolveTypeTo - A brand new type was just declared. This means that (if
571 // name is not null) things referencing Name can be resolved. Otherwise, things
572 // refering to the number can be resolved. Do this now.
574 static void ResolveTypeTo(char *Name, const Type *ToTy) {
576 if (Name) D = ValID::create(Name);
577 else D = ValID::create((int)CurModule.Types.size());
579 std::map<ValID, PATypeHolder>::iterator I =
580 CurModule.LateResolveTypes.find(D);
581 if (I != CurModule.LateResolveTypes.end()) {
582 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
583 CurModule.LateResolveTypes.erase(I);
587 // setValueName - Set the specified value to the name given. The name may be
588 // null potentially, in which case this is a noop. The string passed in is
589 // assumed to be a malloc'd string buffer, and is free'd by this function.
591 static void setValueName(Value *V, char *NameStr) {
593 std::string Name(NameStr); // Copy string
594 free(NameStr); // Free old string
596 if (V->getType() == Type::VoidTy)
597 ThrowException("Can't assign name '" + Name+"' to value with void type!");
599 assert(inFunctionScope() && "Must be in function scope!");
600 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
601 if (ST.lookup(V->getType(), Name))
602 ThrowException("Redefinition of value named '" + Name + "' in the '" +
603 V->getType()->getDescription() + "' type plane!");
610 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
611 /// this is a declaration, otherwise it is a definition.
612 static void ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
613 bool isConstantGlobal, const Type *Ty,
614 Constant *Initializer, unsigned Align) {
615 if (Align != 0 && !isPowerOf2_32(Align))
616 ThrowException("Global alignment must be a power of two!");
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 GV->setAlignment(Align);
648 InsertValue(GV, CurModule.Values);
652 // If this global has a name, check to see if there is already a definition
653 // of this global in the module. If so, merge as appropriate. Note that
654 // this is really just a hack around problems in the CFE. :(
656 // We are a simple redefinition of a value, check to see if it is defined
657 // the same as the old one.
658 if (GlobalVariable *EGV =
659 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
660 // We are allowed to redefine a global variable in two circumstances:
661 // 1. If at least one of the globals is uninitialized or
662 // 2. If both initializers have the same value.
664 if (!EGV->hasInitializer() || !Initializer ||
665 EGV->getInitializer() == Initializer) {
667 // Make sure the existing global version gets the initializer! Make
668 // sure that it also gets marked const if the new version is.
669 if (Initializer && !EGV->hasInitializer())
670 EGV->setInitializer(Initializer);
671 if (isConstantGlobal)
672 EGV->setConstant(true);
673 EGV->setLinkage(Linkage);
674 EGV->setAlignment(Align);
678 ThrowException("Redefinition of global variable named '" + Name +
679 "' in the '" + Ty->getDescription() + "' type plane!");
683 // Otherwise there is no existing GV to use, create one now.
685 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
686 CurModule.CurrentModule);
687 GV->setAlignment(Align);
688 InsertValue(GV, CurModule.Values);
691 // setTypeName - Set the specified type to the name given. The name may be
692 // null potentially, in which case this is a noop. The string passed in is
693 // assumed to be a malloc'd string buffer, and is freed by this function.
695 // This function returns true if the type has already been defined, but is
696 // allowed to be redefined in the specified context. If the name is a new name
697 // for the type plane, it is inserted and false is returned.
698 static bool setTypeName(const Type *T, char *NameStr) {
699 assert(!inFunctionScope() && "Can't give types function-local names!");
700 if (NameStr == 0) return false;
702 std::string Name(NameStr); // Copy string
703 free(NameStr); // Free old string
705 // We don't allow assigning names to void type
706 if (T == Type::VoidTy)
707 ThrowException("Can't assign name '" + Name + "' to the void type!");
709 // Set the type name, checking for conflicts as we do so.
710 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
712 if (AlreadyExists) { // Inserting a name that is already defined???
713 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
714 assert(Existing && "Conflict but no matching type?");
716 // There is only one case where this is allowed: when we are refining an
717 // opaque type. In this case, Existing will be an opaque type.
718 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
719 // We ARE replacing an opaque type!
720 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
724 // Otherwise, this is an attempt to redefine a type. That's okay if
725 // the redefinition is identical to the original. This will be so if
726 // Existing and T point to the same Type object. In this one case we
727 // allow the equivalent redefinition.
728 if (Existing == T) return true; // Yes, it's equal.
730 // Any other kind of (non-equivalent) redefinition is an error.
731 ThrowException("Redefinition of type named '" + Name + "' in the '" +
732 T->getDescription() + "' type plane!");
738 //===----------------------------------------------------------------------===//
739 // Code for handling upreferences in type names...
742 // TypeContains - Returns true if Ty directly contains E in it.
744 static bool TypeContains(const Type *Ty, const Type *E) {
745 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
746 E) != Ty->subtype_end();
751 // NestingLevel - The number of nesting levels that need to be popped before
752 // this type is resolved.
753 unsigned NestingLevel;
755 // LastContainedTy - This is the type at the current binding level for the
756 // type. Every time we reduce the nesting level, this gets updated.
757 const Type *LastContainedTy;
759 // UpRefTy - This is the actual opaque type that the upreference is
763 UpRefRecord(unsigned NL, OpaqueType *URTy)
764 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
768 // UpRefs - A list of the outstanding upreferences that need to be resolved.
769 static std::vector<UpRefRecord> UpRefs;
771 /// HandleUpRefs - Every time we finish a new layer of types, this function is
772 /// called. It loops through the UpRefs vector, which is a list of the
773 /// currently active types. For each type, if the up reference is contained in
774 /// the newly completed type, we decrement the level count. When the level
775 /// count reaches zero, the upreferenced type is the type that is passed in:
776 /// thus we can complete the cycle.
778 static PATypeHolder HandleUpRefs(const Type *ty) {
779 if (!ty->isAbstract()) return ty;
781 UR_OUT("Type '" << Ty->getDescription() <<
782 "' newly formed. Resolving upreferences.\n" <<
783 UpRefs.size() << " upreferences active!\n");
785 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
786 // to zero), we resolve them all together before we resolve them to Ty. At
787 // the end of the loop, if there is anything to resolve to Ty, it will be in
789 OpaqueType *TypeToResolve = 0;
791 for (unsigned i = 0; i != UpRefs.size(); ++i) {
792 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
793 << UpRefs[i].second->getDescription() << ") = "
794 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
795 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
796 // Decrement level of upreference
797 unsigned Level = --UpRefs[i].NestingLevel;
798 UpRefs[i].LastContainedTy = Ty;
799 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
800 if (Level == 0) { // Upreference should be resolved!
801 if (!TypeToResolve) {
802 TypeToResolve = UpRefs[i].UpRefTy;
804 UR_OUT(" * Resolving upreference for "
805 << UpRefs[i].second->getDescription() << "\n";
806 std::string OldName = UpRefs[i].UpRefTy->getDescription());
807 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
808 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
809 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
811 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
812 --i; // Do not skip the next element...
818 UR_OUT(" * Resolving upreference for "
819 << UpRefs[i].second->getDescription() << "\n";
820 std::string OldName = TypeToResolve->getDescription());
821 TypeToResolve->refineAbstractTypeTo(Ty);
828 // common code from the two 'RunVMAsmParser' functions
829 static Module * RunParser(Module * M) {
831 llvmAsmlineno = 1; // Reset the current line number...
832 ObsoleteVarArgs = false;
835 CurModule.CurrentModule = M;
836 yyparse(); // Parse the file, potentially throwing exception
838 Module *Result = ParserResult;
841 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
844 if ((F = Result->getNamedFunction("llvm.va_start"))
845 && F->getFunctionType()->getNumParams() == 0)
846 ObsoleteVarArgs = true;
847 if((F = Result->getNamedFunction("llvm.va_copy"))
848 && F->getFunctionType()->getNumParams() == 1)
849 ObsoleteVarArgs = true;
852 if (ObsoleteVarArgs && NewVarArgs)
853 ThrowException("This file is corrupt: it uses both new and old style varargs");
855 if(ObsoleteVarArgs) {
856 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
857 if (F->arg_size() != 0)
858 ThrowException("Obsolete va_start takes 0 argument!");
862 //bar = alloca typeof(foo)
866 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
867 const Type* ArgTy = F->getFunctionType()->getReturnType();
868 const Type* ArgTyPtr = PointerType::get(ArgTy);
869 Function* NF = Result->getOrInsertFunction("llvm.va_start",
870 RetTy, ArgTyPtr, (Type *)0);
872 while (!F->use_empty()) {
873 CallInst* CI = cast<CallInst>(F->use_back());
874 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
875 new CallInst(NF, bar, "", CI);
876 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
877 CI->replaceAllUsesWith(foo);
878 CI->getParent()->getInstList().erase(CI);
880 Result->getFunctionList().erase(F);
883 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
884 if(F->arg_size() != 1)
885 ThrowException("Obsolete va_end takes 1 argument!");
889 //bar = alloca 1 of typeof(foo)
891 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
892 const Type* ArgTy = F->getFunctionType()->getParamType(0);
893 const Type* ArgTyPtr = PointerType::get(ArgTy);
894 Function* NF = Result->getOrInsertFunction("llvm.va_end",
895 RetTy, ArgTyPtr, (Type *)0);
897 while (!F->use_empty()) {
898 CallInst* CI = cast<CallInst>(F->use_back());
899 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
900 new StoreInst(CI->getOperand(1), bar, CI);
901 new CallInst(NF, bar, "", CI);
902 CI->getParent()->getInstList().erase(CI);
904 Result->getFunctionList().erase(F);
907 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
908 if(F->arg_size() != 1)
909 ThrowException("Obsolete va_copy takes 1 argument!");
912 //a = alloca 1 of typeof(foo)
913 //b = alloca 1 of typeof(foo)
918 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
919 const Type* ArgTy = F->getFunctionType()->getReturnType();
920 const Type* ArgTyPtr = PointerType::get(ArgTy);
921 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
922 RetTy, ArgTyPtr, ArgTyPtr,
925 while (!F->use_empty()) {
926 CallInst* CI = cast<CallInst>(F->use_back());
927 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
928 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
929 new StoreInst(CI->getOperand(1), b, CI);
930 new CallInst(NF, a, b, "", CI);
931 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
932 CI->replaceAllUsesWith(foo);
933 CI->getParent()->getInstList().erase(CI);
935 Result->getFunctionList().erase(F);
943 //===----------------------------------------------------------------------===//
944 // RunVMAsmParser - Define an interface to this parser
945 //===----------------------------------------------------------------------===//
947 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
950 CurFilename = Filename;
951 return RunParser(new Module(CurFilename));
954 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
955 set_scan_string(AsmString);
957 CurFilename = "from_memory";
959 return RunParser(new Module (CurFilename));
966 #line 873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
968 llvm::Module *ModuleVal;
969 llvm::Function *FunctionVal;
970 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
971 llvm::BasicBlock *BasicBlockVal;
972 llvm::TerminatorInst *TermInstVal;
973 llvm::Instruction *InstVal;
974 llvm::Constant *ConstVal;
976 const llvm::Type *PrimType;
977 llvm::PATypeHolder *TypeVal;
978 llvm::Value *ValueVal;
980 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
981 std::vector<llvm::Value*> *ValueList;
982 std::list<llvm::PATypeHolder> *TypeList;
983 // Represent the RHS of PHI node
984 std::list<std::pair<llvm::Value*,
985 llvm::BasicBlock*> > *PHIList;
986 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
987 std::vector<llvm::Constant*> *ConstVector;
989 llvm::GlobalValue::LinkageTypes Linkage;
997 char *StrVal; // This memory is strdup'd!
998 llvm::ValID ValIDVal; // strdup'd memory maybe!
1000 llvm::Instruction::BinaryOps BinaryOpVal;
1001 llvm::Instruction::TermOps TermOpVal;
1002 llvm::Instruction::MemoryOps MemOpVal;
1003 llvm::Instruction::OtherOps OtherOpVal;
1004 llvm::Module::Endianness Endianness;
1017 #define YYFLAG -32768
1018 #define YYNTBASE 109
1020 #define YYTRANSLATE(x) ((unsigned)(x) <= 348 ? yytranslate[x] : 172)
1022 static const char yytranslate[] = { 0,
1023 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1024 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1025 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1026 2, 2, 2, 2, 2, 2, 2, 2, 2, 98,
1027 99, 107, 2, 96, 2, 2, 2, 2, 2, 2,
1028 2, 2, 2, 2, 2, 2, 2, 2, 2, 103,
1029 95, 104, 2, 2, 2, 2, 2, 2, 2, 2,
1030 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1032 100, 97, 102, 2, 2, 2, 2, 2, 108, 2,
1033 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1034 2, 2, 2, 2, 2, 2, 2, 2, 2, 101,
1035 2, 2, 105, 2, 106, 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, 2, 2, 2, 2, 2,
1047 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1048 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1049 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1050 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1051 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1052 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1053 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1054 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1055 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1056 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1057 87, 88, 89, 90, 91, 92, 93, 94
1061 static const short yyprhs[] = { 0,
1062 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1063 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1064 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1065 60, 62, 64, 67, 68, 70, 72, 74, 76, 77,
1066 78, 80, 82, 84, 87, 88, 91, 92, 96, 98,
1067 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1068 120, 122, 124, 126, 128, 130, 132, 134, 136, 138,
1069 141, 146, 152, 158, 162, 165, 168, 170, 174, 176,
1070 180, 182, 183, 188, 192, 196, 201, 206, 210, 213,
1071 216, 219, 222, 225, 228, 231, 234, 237, 240, 247,
1072 253, 262, 269, 276, 283, 290, 294, 296, 298, 300,
1073 302, 305, 308, 311, 313, 318, 321, 328, 335, 339,
1074 344, 345, 347, 349, 353, 357, 361, 365, 369, 371,
1075 372, 374, 376, 378, 379, 382, 386, 388, 390, 394,
1076 396, 397, 405, 407, 409, 413, 415, 417, 420, 421,
1077 425, 427, 429, 431, 433, 435, 437, 439, 443, 445,
1078 447, 449, 451, 453, 456, 459, 462, 466, 469, 470,
1079 472, 475, 478, 482, 492, 502, 511, 525, 527, 529,
1080 536, 542, 545, 552, 560, 562, 566, 568, 569, 572,
1081 574, 580, 586, 592, 595, 600, 605, 612, 617, 622,
1082 627, 630, 638, 640, 643, 644, 646, 647, 651, 658,
1083 662, 669, 672, 677, 684
1086 static const short yyrhs[] = { 5,
1087 0, 6, 0, 3, 0, 4, 0, 67, 0, 68,
1088 0, 69, 0, 70, 0, 71, 0, 72, 0, 73,
1089 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1090 0, 79, 0, 80, 0, 90, 0, 91, 0, 16,
1091 0, 14, 0, 12, 0, 10, 0, 17, 0, 15,
1092 0, 13, 0, 11, 0, 115, 0, 116, 0, 18,
1093 0, 19, 0, 142, 95, 0, 0, 40, 0, 41,
1094 0, 42, 0, 43, 0, 0, 0, 58, 0, 59,
1095 0, 60, 0, 57, 4, 0, 0, 53, 4, 0,
1096 0, 96, 53, 4, 0, 126, 0, 8, 0, 128,
1097 0, 8, 0, 128, 0, 9, 0, 10, 0, 11,
1098 0, 12, 0, 13, 0, 14, 0, 15, 0, 16,
1099 0, 17, 0, 18, 0, 19, 0, 20, 0, 21,
1100 0, 44, 0, 127, 0, 155, 0, 97, 4, 0,
1101 125, 98, 130, 99, 0, 100, 4, 101, 128, 102,
1102 0, 103, 4, 101, 128, 104, 0, 105, 129, 106,
1103 0, 105, 106, 0, 128, 107, 0, 128, 0, 129,
1104 96, 128, 0, 129, 0, 129, 96, 36, 0, 36,
1105 0, 0, 126, 100, 133, 102, 0, 126, 100, 102,
1106 0, 126, 108, 24, 0, 126, 103, 133, 104, 0,
1107 126, 105, 133, 106, 0, 126, 105, 106, 0, 126,
1108 37, 0, 126, 38, 0, 126, 155, 0, 126, 132,
1109 0, 126, 26, 0, 115, 110, 0, 116, 4, 0,
1110 9, 27, 0, 9, 28, 0, 118, 7, 0, 88,
1111 98, 131, 35, 126, 99, 0, 86, 98, 131, 169,
1112 99, 0, 89, 98, 131, 96, 131, 96, 131, 99,
1113 0, 111, 98, 131, 96, 131, 99, 0, 112, 98,
1114 131, 96, 131, 99, 0, 113, 98, 131, 96, 131,
1115 99, 0, 114, 98, 131, 96, 131, 99, 0, 133,
1116 96, 131, 0, 131, 0, 32, 0, 33, 0, 136,
1117 0, 136, 151, 0, 136, 152, 0, 136, 25, 0,
1118 137, 0, 137, 119, 20, 124, 0, 137, 152, 0,
1119 137, 119, 120, 134, 131, 123, 0, 137, 119, 46,
1120 134, 126, 123, 0, 137, 47, 139, 0, 137, 54,
1121 95, 140, 0, 0, 52, 0, 51, 0, 49, 95,
1122 138, 0, 50, 95, 4, 0, 48, 95, 24, 0,
1123 100, 141, 102, 0, 141, 96, 24, 0, 24, 0,
1124 0, 22, 0, 24, 0, 142, 0, 0, 126, 143,
1125 0, 145, 96, 144, 0, 144, 0, 145, 0, 145,
1126 96, 36, 0, 36, 0, 0, 121, 124, 142, 98,
1127 146, 99, 122, 0, 29, 0, 105, 0, 120, 147,
1128 148, 0, 30, 0, 106, 0, 158, 150, 0, 0,
1129 31, 153, 147, 0, 3, 0, 4, 0, 7, 0,
1130 27, 0, 28, 0, 37, 0, 38, 0, 103, 133,
1131 104, 0, 132, 0, 109, 0, 142, 0, 155, 0,
1132 154, 0, 126, 156, 0, 158, 159, 0, 149, 159,
1133 0, 160, 119, 161, 0, 160, 163, 0, 0, 23,
1134 0, 61, 157, 0, 61, 8, 0, 62, 21, 156,
1135 0, 62, 9, 156, 96, 21, 156, 96, 21, 156,
1136 0, 63, 117, 156, 96, 21, 156, 100, 162, 102,
1137 0, 63, 117, 156, 96, 21, 156, 100, 102, 0,
1138 64, 121, 124, 156, 98, 166, 99, 35, 21, 156,
1139 65, 21, 156, 0, 65, 0, 66, 0, 162, 117,
1140 154, 96, 21, 156, 0, 117, 154, 96, 21, 156,
1141 0, 119, 168, 0, 126, 100, 156, 96, 156, 102,
1142 0, 164, 96, 100, 156, 96, 156, 102, 0, 157,
1143 0, 165, 96, 157, 0, 165, 0, 0, 56, 55,
1144 0, 55, 0, 111, 126, 156, 96, 156, 0, 112,
1145 126, 156, 96, 156, 0, 113, 126, 156, 96, 156,
1146 0, 45, 157, 0, 114, 157, 96, 157, 0, 88,
1147 157, 35, 126, 0, 89, 157, 96, 157, 96, 157,
1148 0, 92, 157, 96, 126, 0, 93, 157, 96, 126,
1149 0, 94, 157, 96, 126, 0, 87, 164, 0, 167,
1150 121, 124, 156, 98, 166, 99, 0, 171, 0, 96,
1151 165, 0, 0, 34, 0, 0, 81, 126, 123, 0,
1152 81, 126, 96, 15, 156, 123, 0, 82, 126, 123,
1153 0, 82, 126, 96, 15, 156, 123, 0, 83, 157,
1154 0, 170, 84, 126, 156, 0, 170, 85, 157, 96,
1155 126, 156, 0, 86, 126, 156, 169, 0
1161 static const short yyrline[] = { 0,
1162 990, 991, 998, 999, 1008, 1008, 1008, 1008, 1008, 1009,
1163 1009, 1009, 1010, 1010, 1010, 1010, 1010, 1010, 1012, 1012,
1164 1016, 1016, 1016, 1016, 1017, 1017, 1017, 1017, 1018, 1018,
1165 1019, 1019, 1022, 1025, 1029, 1029, 1030, 1031, 1032, 1035,
1166 1035, 1036, 1037, 1038, 1047, 1047, 1049, 1049, 1059, 1059,
1167 1060, 1060, 1062, 1071, 1071, 1071, 1071, 1071, 1071, 1071,
1168 1072, 1072, 1072, 1072, 1072, 1072, 1073, 1076, 1079, 1085,
1169 1092, 1104, 1108, 1119, 1128, 1131, 1139, 1143, 1148, 1149,
1170 1152, 1155, 1165, 1190, 1203, 1231, 1256, 1276, 1288, 1297,
1171 1301, 1360, 1366, 1374, 1379, 1384, 1387, 1390, 1397, 1407,
1172 1438, 1445, 1466, 1473, 1478, 1488, 1491, 1498, 1498, 1508,
1173 1515, 1519, 1522, 1525, 1538, 1558, 1560, 1564, 1568, 1570,
1174 1572, 1577, 1578, 1580, 1583, 1591, 1596, 1598, 1602, 1606,
1175 1614, 1614, 1615, 1615, 1617, 1623, 1628, 1634, 1637, 1642,
1176 1646, 1650, 1733, 1733, 1735, 1743, 1743, 1745, 1749, 1749,
1177 1758, 1761, 1764, 1767, 1770, 1773, 1776, 1779, 1803, 1810,
1178 1813, 1818, 1818, 1824, 1828, 1831, 1839, 1848, 1852, 1862,
1179 1873, 1876, 1879, 1882, 1885, 1899, 1903, 1956, 1959, 1965,
1180 1973, 1983, 1990, 1995, 2002, 2006, 2012, 2012, 2014, 2017,
1181 2023, 2035, 2043, 2053, 2065, 2072, 2079, 2086, 2091, 2110,
1182 2132, 2146, 2203, 2209, 2211, 2215, 2218, 2224, 2231, 2238,
1183 2245, 2252, 2259, 2269, 2282
1188 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1190 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1191 "EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT",
1192 "USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID",
1193 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK",
1194 "BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","VOLATILE","TO","DOTDOTDOT",
1195 "NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING","OPAQUE",
1196 "NOT","EXTERNAL","TARGET","TRIPLE","ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN",
1197 "DEPLIBS","CALL","TAIL","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK","RET","BR",
1198 "SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","DIV","REM","AND",
1199 "OR","XOR","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA",
1200 "FREE","LOAD","STORE","GETELEMENTPTR","PHI_TOK","CAST","SELECT","SHL","SHR",
1201 "VAARG","VAARG_old","VANEXT_old","'='","','","'\\\\'","'('","')'","'['","'x'",
1202 "']'","'<'","'>'","'{'","'}'","'*'","'c'","INTVAL","EINT64VAL","ArithmeticOps",
1203 "LogicalOps","SetCondOps","ShiftOps","SIntType","UIntType","IntType","FPType",
1204 "OptAssign","OptLinkage","OptCallingConv","OptAlign","OptCAlign","TypesV","UpRTypesV",
1205 "Types","PrimType","UpRTypes","TypeListI","ArgTypeListI","ConstVal","ConstExpr",
1206 "ConstVector","GlobalType","Module","FunctionList","ConstPool","BigOrLittle",
1207 "TargetDefinition","LibrariesDefinition","LibList","Name","OptName","ArgVal",
1208 "ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END","Function",
1209 "FunctionProto","@1","ConstValueRef","SymbolicValueRef","ValueRef","ResolvedVal",
1210 "BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst","JumpTable",
1211 "Inst","PHIList","ValueRefList","ValueRefListE","OptTailCall","InstVal","IndexList",
1212 "OptVolatile","MemoryInst", NULL
1216 static const short yyr1[] = { 0,
1217 109, 109, 110, 110, 111, 111, 111, 111, 111, 112,
1218 112, 112, 113, 113, 113, 113, 113, 113, 114, 114,
1219 115, 115, 115, 115, 116, 116, 116, 116, 117, 117,
1220 118, 118, 119, 119, 120, 120, 120, 120, 120, 121,
1221 121, 121, 121, 121, 122, 122, 123, 123, 124, 124,
1222 125, 125, 126, 127, 127, 127, 127, 127, 127, 127,
1223 127, 127, 127, 127, 127, 127, 128, 128, 128, 128,
1224 128, 128, 128, 128, 128, 128, 129, 129, 130, 130,
1225 130, 130, 131, 131, 131, 131, 131, 131, 131, 131,
1226 131, 131, 131, 131, 131, 131, 131, 131, 132, 132,
1227 132, 132, 132, 132, 132, 133, 133, 134, 134, 135,
1228 136, 136, 136, 136, 137, 137, 137, 137, 137, 137,
1229 137, 138, 138, 139, 139, 139, 140, 141, 141, 141,
1230 142, 142, 143, 143, 144, 145, 145, 146, 146, 146,
1231 146, 147, 148, 148, 149, 150, 150, 151, 153, 152,
1232 154, 154, 154, 154, 154, 154, 154, 154, 154, 155,
1233 155, 156, 156, 157, 158, 158, 159, 160, 160, 160,
1234 161, 161, 161, 161, 161, 161, 161, 161, 161, 162,
1235 162, 163, 164, 164, 165, 165, 166, 166, 167, 167,
1236 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1237 168, 168, 168, 169, 169, 170, 170, 171, 171, 171,
1238 171, 171, 171, 171, 171
1241 static const short yyr2[] = { 0,
1242 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1243 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1244 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1245 1, 1, 2, 0, 1, 1, 1, 1, 0, 0,
1246 1, 1, 1, 2, 0, 2, 0, 3, 1, 1,
1247 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1248 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1249 4, 5, 5, 3, 2, 2, 1, 3, 1, 3,
1250 1, 0, 4, 3, 3, 4, 4, 3, 2, 2,
1251 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1252 8, 6, 6, 6, 6, 3, 1, 1, 1, 1,
1253 2, 2, 2, 1, 4, 2, 6, 6, 3, 4,
1254 0, 1, 1, 3, 3, 3, 3, 3, 1, 0,
1255 1, 1, 1, 0, 2, 3, 1, 1, 3, 1,
1256 0, 7, 1, 1, 3, 1, 1, 2, 0, 3,
1257 1, 1, 1, 1, 1, 1, 1, 3, 1, 1,
1258 1, 1, 1, 2, 2, 2, 3, 2, 0, 1,
1259 2, 2, 3, 9, 9, 8, 13, 1, 1, 6,
1260 5, 2, 6, 7, 1, 3, 1, 0, 2, 1,
1261 5, 5, 5, 2, 4, 4, 6, 4, 4, 4,
1262 2, 7, 1, 2, 0, 1, 0, 3, 6, 3,
1266 static const short yydefact[] = { 121,
1267 39, 114, 113, 149, 35, 36, 37, 38, 40, 169,
1268 111, 112, 169, 131, 132, 0, 0, 39, 0, 116,
1269 40, 0, 41, 42, 43, 0, 0, 170, 166, 34,
1270 146, 147, 148, 165, 0, 0, 0, 119, 0, 0,
1271 0, 0, 33, 150, 44, 1, 2, 50, 54, 55,
1272 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1273 66, 67, 0, 0, 0, 0, 160, 0, 0, 49,
1274 68, 53, 161, 69, 143, 144, 145, 207, 168, 0,
1275 0, 0, 130, 120, 115, 108, 109, 0, 0, 70,
1276 0, 0, 52, 75, 77, 0, 0, 82, 76, 206,
1277 0, 190, 0, 0, 0, 0, 40, 178, 179, 5,
1278 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1279 16, 17, 18, 0, 0, 0, 0, 0, 0, 0,
1280 19, 20, 0, 0, 0, 0, 0, 0, 0, 167,
1281 40, 182, 0, 203, 126, 123, 122, 124, 125, 129,
1282 0, 47, 54, 55, 56, 57, 58, 59, 60, 61,
1283 62, 63, 64, 0, 0, 0, 0, 47, 0, 0,
1284 0, 74, 141, 81, 79, 0, 0, 194, 189, 172,
1285 171, 0, 0, 24, 28, 23, 27, 22, 26, 21,
1286 25, 29, 30, 0, 0, 47, 47, 212, 0, 0,
1287 201, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1288 0, 0, 0, 0, 127, 0, 118, 96, 97, 3,
1289 4, 94, 95, 98, 93, 89, 90, 0, 0, 0,
1290 0, 0, 0, 0, 0, 0, 0, 0, 92, 91,
1291 117, 51, 51, 78, 140, 134, 137, 138, 0, 0,
1292 71, 151, 152, 153, 154, 155, 156, 157, 0, 159,
1293 163, 162, 164, 0, 173, 0, 0, 0, 208, 0,
1294 210, 205, 0, 0, 0, 0, 0, 0, 0, 0,
1295 0, 0, 0, 0, 0, 0, 128, 0, 0, 0,
1296 0, 84, 107, 0, 0, 88, 0, 85, 0, 0,
1297 0, 0, 72, 73, 133, 135, 0, 45, 80, 0,
1298 0, 0, 0, 0, 0, 0, 215, 0, 0, 196,
1299 0, 198, 199, 200, 0, 0, 0, 195, 0, 213,
1300 0, 48, 205, 0, 0, 0, 83, 86, 87, 0,
1301 0, 0, 0, 139, 136, 0, 142, 158, 0, 0,
1302 188, 47, 47, 185, 204, 0, 0, 0, 191, 192,
1303 193, 188, 0, 0, 0, 0, 106, 0, 0, 0,
1304 0, 46, 0, 0, 187, 0, 209, 211, 0, 0,
1305 0, 197, 0, 214, 100, 0, 0, 0, 0, 0,
1306 0, 0, 0, 0, 186, 183, 0, 202, 99, 0,
1307 102, 103, 104, 105, 0, 176, 0, 0, 0, 184,
1308 0, 174, 0, 175, 0, 0, 101, 0, 0, 0,
1309 0, 0, 0, 181, 0, 0, 180, 177, 0, 0,
1313 static const short yydefgoto[] = { 67,
1314 222, 235, 236, 237, 238, 164, 165, 194, 166, 18,
1315 9, 26, 347, 217, 68, 69, 167, 71, 72, 96,
1316 176, 293, 260, 294, 88, 429, 1, 2, 148, 38,
1317 84, 151, 73, 306, 247, 248, 249, 27, 77, 10,
1318 33, 11, 12, 21, 261, 74, 263, 354, 13, 29,
1319 30, 140, 408, 79, 201, 375, 376, 141, 142, 317,
1323 static const short yypact[] = {-32768,
1324 191, 336,-32768,-32768,-32768,-32768,-32768,-32768, 37, 19,
1325 -32768,-32768, -17,-32768,-32768, 101, -32, 31, -25,-32768,
1326 37, 53,-32768,-32768,-32768, 896, -13,-32768,-32768, 130,
1327 -32768,-32768,-32768,-32768, -19, -16, 33,-32768, 26, 896,
1328 58, 58,-32768,-32768,-32768,-32768,-32768, 55,-32768,-32768,
1329 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1330 -32768,-32768, 127, 156, 166, 124,-32768, 130, 82,-32768,
1331 -32768, -81,-32768,-32768,-32768,-32768,-32768, 1053,-32768, 157,
1332 54, 178, 160,-32768,-32768,-32768,-32768, 933, 970,-32768,
1333 88, 91,-32768,-32768, -81, -42, 85, 711,-32768,-32768,
1334 933,-32768, 141, 1007, 0, 104, 37,-32768,-32768,-32768,
1335 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1336 -32768,-32768,-32768, 933, 933, 933, 933, 933, 933, 933,
1337 -32768,-32768, 933, 933, 933, 933, 933, 933, 933,-32768,
1338 37,-32768, 71,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1339 -77, 102, 131, 159, 195, 161, 196, 163, 201, 171,
1340 202, 203, 204, 175, 208, 206, 387, 102, 933, 933,
1341 933,-32768, 748,-32768, 118, 116, 560,-32768,-32768, 55,
1342 -32768, 560, 560,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1343 -32768,-32768,-32768, 560, 896, 129, 132,-32768, 560, 123,
1344 139, 205, 140, 142, 143, 145, 560, 560, 560, 146,
1345 896, 933, 933, 213,-32768, 173,-32768,-32768,-32768,-32768,
1346 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 148, 149, 150,
1347 785, 970, 511, 219, 158, 162, 164, 165,-32768,-32768,
1348 -32768, -14, -48, -81,-32768, 130,-32768, 168, 167, 822,
1349 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 970,-32768,
1350 -32768,-32768,-32768, 169,-32768, 172, 560, -12,-32768, -7,
1351 -32768, 174, 560, 144, 933, 933, 933, 933, 933, 177,
1352 179, 180, 933, 560, 560, 181,-32768, 251, 970, 970,
1353 970,-32768,-32768, -74, -36,-32768, -41,-32768, 970, 970,
1354 970, 970,-32768,-32768,-32768,-32768, 859, 216,-32768, -35,
1355 237, 238, 176, 560, 560, 933,-32768, 184, 560,-32768,
1356 186,-32768,-32768,-32768, 560, 560, 560,-32768, 185,-32768,
1357 933,-32768, 174, 236, 189, 970,-32768,-32768,-32768, 198,
1358 199, 200, 207,-32768,-32768, 293,-32768,-32768, 560, 560,
1359 933, 102, 102,-32768, 214, 560, 215, 933,-32768,-32768,
1360 -32768, 933, 560, 217, 933, 970,-32768, 970, 970, 970,
1361 970,-32768, 218, 212, 214, 223,-32768,-32768, 933, 197,
1362 560,-32768, 224,-32768,-32768, 225, 221, 227, 228, 229,
1363 230, 277, 20, 265,-32768,-32768, 231,-32768,-32768, 970,
1364 -32768,-32768,-32768,-32768, 560,-32768, 615, 70, 280,-32768,
1365 232,-32768, 234,-32768, 615, 560,-32768, 281, 239, 250,
1366 560, 283, 313,-32768, 560, 560,-32768,-32768, 340, 341,
1370 static const short yypgoto[] = {-32768,
1371 -32768, 264, 267, 268, 269, -102, -101, -381,-32768, 318,
1372 333, -96,-32768, -158, -38,-32768, -26,-32768, -46, 254,
1373 -32768, -82, 188, -209, 317,-32768,-32768,-32768,-32768,-32768,
1374 -32768,-32768, -1,-32768, 59,-32768,-32768, 344,-32768,-32768,
1375 -32768,-32768, 359,-32768, -349, -6, 155, -86,-32768, 357,
1376 -32768,-32768,-32768,-32768,-32768, 56, 9,-32768,-32768, 40,
1384 static const short yytable[] = { 70,
1385 19, 85, 314, 192, 193, 28, 168, 315, 182, 241,
1386 195, 407, 31, 70, 178, 75, -51, 181, 214, 95,
1387 183, 336, 295, 297, 215, 99, 415, 337, 19, 184,
1388 185, 186, 187, 188, 189, 190, 191, 269, 271, 198,
1389 288, 28, 202, 203, 211, 288, 204, 205, 206, 310,
1390 40, 95, 210, 171, 336, 304, 45, 413, 99, 336,
1391 336, 152, 39, 172, 339, 419, 97, 338, 348, 43,
1392 5, 6, 7, 8, 177, 80, 41, 177, 81, 184,
1393 185, 186, 187, 188, 189, 190, 191, 303, 32, 86,
1394 87, 76, 99, 22, 23, 24, 25, 196, 197, 177,
1395 199, 200, 177, 177, 146, 147, 177, 177, 177, 207,
1396 208, 209, 177, 184, 185, 186, 187, 188, 189, 190,
1397 191, 406, 242, 243, 244, 83, 286, 82, 46, 47,
1398 90, 93, 49, 50, 51, 52, 53, 54, 55, 56,
1399 57, 58, 59, 60, 61, 14, 246, 15, 35, 36,
1400 37, 14, -52, 15, 212, 213, 267, 218, 219, 91,
1401 240, -24, -24, -23, -23, -22, -22, 62, 70, 92,
1402 262, 414, 284, -21, -21, 262, 262, 220, 221, 98,
1403 145, 149, 173, 150, 70, 285, 177, 262, 169, 321,
1404 -110, 170, 262, 377, 378, 179, 328, 216, -28, -27,
1405 262, 262, 262, 244, -26, -25, 333, 334, 335, -31,
1406 -32, 223, 224, 250, 251, 3, 340, 341, 342, 343,
1407 63, 4, 273, 64, 268, 288, 65, 270, 66, 94,
1408 5, 6, 7, 8, 274, 276, 287, 277, 278, 275,
1409 279, 283, 298, 319, 305, 289, 290, 291, 320, 177,
1410 322, 323, 324, 367, 332, 299, 177, 349, 350, 300,
1411 262, 301, 302, 307, 311, 308, 262, 312, 346, 316,
1412 365, 382, 325, 351, 326, 327, 331, 262, 262, 356,
1413 246, 358, 362, 387, 366, 388, 389, 390, 391, 177,
1414 192, 193, 395, 368, 369, 370, 372, 405, 396, 409,
1415 416, 421, 371, 425, 363, 192, 193, 262, 262, 379,
1416 381, 393, 262, 392, 423, 385, 400, 411, 262, 262,
1417 262, 394, 398, 399, 177, 401, 402, 403, 404, 418,
1418 417, 177, 410, 426, 422, 177, 264, 265, 386, 430,
1419 431, 136, 262, 262, 137, 138, 139, 78, 266, 262,
1420 42, 175, 177, 272, 239, -34, 262, 14, 89, 15,
1421 20, 280, 281, 282, 44, 345, 4, -34, -34, 34,
1422 383, 355, 364, 0, 262, -34, -34, -34, -34, 0,
1423 0, -34, 16, 0, 0, 0, 0, 0, 0, 17,
1424 0, 46, 47, 0, 0, 0, 0, 0, 262, 0,
1425 0, 0, 0, 0, 0, 0, 0, 0, 14, 262,
1426 15, 0, 225, 0, 262, 0, 0, 0, 262, 262,
1427 0, 313, 0, 226, 227, 0, 0, 318, 0, 0,
1428 0, 0, 0, 0, 0, 0, 0, 0, 329, 330,
1429 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1430 0, 0, 0, 110, 111, 112, 113, 114, 115, 116,
1431 117, 118, 119, 120, 121, 122, 123, 0, 352, 353,
1432 0, 0, 228, 357, 229, 230, 131, 132, 0, 359,
1433 360, 361, 0, 0, 0, 0, 231, 0, 0, 232,
1434 0, 233, 0, 0, 234, 0, 0, 0, 0, 0,
1435 0, 0, 0, 373, 374, 0, 0, 0, 0, 0,
1436 380, 0, 0, 0, 0, 46, 47, 384, 93, 153,
1437 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
1438 60, 61, 14, 0, 15, 397, 0, 0, 0, 0,
1439 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1440 0, 0, 0, 0, 62, 0, 0, 0, 0, 412,
1441 0, 0, 252, 253, 46, 47, 254, 0, 0, 0,
1442 420, 0, 0, 0, 0, 424, 0, 0, 0, 427,
1443 428, 14, 0, 15, 0, 0, 255, 256, 0, 0,
1444 0, 0, 0, 0, 0, 0, 257, 258, 0, 0,
1445 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,
1446 64, 0, 0, 65, 0, 66, 296, 252, 253, 0,
1447 0, 254, 0, 0, 0, 0, 110, 111, 112, 113,
1448 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
1449 0, 255, 256, 0, 0, 228, 0, 229, 230, 131,
1450 132, 257, 258, 0, 0, 0, 0, 0, 0, 0,
1451 0, 0, 259, 0, 0, 0, 0, 0, 0, 0,
1452 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1453 0, 110, 111, 112, 113, 114, 115, 116, 117, 118,
1454 119, 120, 121, 122, 123, 0, 0, 0, 0, 0,
1455 228, 0, 229, 230, 131, 132, 0, 0, 0, 0,
1456 0, 0, 0, 0, 0, 46, 47, 259, 93, 49,
1457 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1458 60, 61, 14, 0, 15, 0, 0, 0, 0, 0,
1459 0, 0, 0, 0, 0, 0, 174, 0, 0, 0,
1460 0, 0, 46, 47, 62, 93, 49, 50, 51, 52,
1461 53, 54, 55, 56, 57, 58, 59, 60, 61, 14,
1462 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
1463 0, 0, 0, 245, 0, 0, 0, 0, 0, 46,
1464 47, 62, 93, 153, 154, 155, 156, 157, 158, 159,
1465 160, 161, 162, 163, 60, 61, 14, 63, 15, 0,
1466 64, 0, 0, 65, 0, 66, 0, 0, 0, 0,
1467 0, 0, 0, 0, 0, 0, 46, 47, 62, 93,
1468 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
1469 59, 60, 61, 14, 63, 15, 0, 64, 0, 0,
1470 65, 0, 66, 0, 0, 0, 0, 309, 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, 63, 15, 0, 64, 0, 292, 65, 0, 66,
1474 0, 0, 0, 0, 344, 0, 0, 0, 0, 0,
1475 46, 47, 62, 48, 49, 50, 51, 52, 53, 54,
1476 55, 56, 57, 58, 59, 60, 61, 14, 63, 15,
1477 0, 64, 0, 0, 65, 0, 66, 0, 0, 0,
1478 0, 0, 0, 0, 0, 0, 0, 46, 47, 62,
1479 93, 49, 50, 51, 52, 53, 54, 55, 56, 57,
1480 58, 59, 60, 61, 14, 63, 15, 0, 64, 0,
1481 0, 65, 0, 66, 0, 0, 0, 0, 0, 0,
1482 0, 0, 0, 0, 46, 47, 62, 93, 153, 154,
1483 155, 156, 157, 158, 159, 160, 161, 162, 163, 60,
1484 61, 14, 63, 15, 0, 64, 0, 0, 65, 0,
1485 66, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1486 0, 46, 47, 62, 180, 49, 50, 51, 52, 53,
1487 54, 55, 56, 57, 58, 59, 60, 61, 14, 63,
1488 15, 0, 64, 0, 0, 65, 0, 66, 0, 0,
1489 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1490 62, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1491 0, 0, 0, 0, 0, 0, 63, 0, 0, 64,
1492 0, 0, 65, 0, 66, 0, 0, 0, 0, 0,
1493 0, 0, 0, 0, 0, 0, 100, 0, 0, 0,
1494 0, 0, 0, 0, 0, 0, 0, 101, 0, 0,
1495 0, 0, 0, 63, 0, 0, 64, 102, 103, 65,
1496 0, 66, 0, 104, 105, 106, 107, 108, 109, 110,
1497 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
1498 121, 122, 123, 124, 125, 126, 0, 0, 127, 128,
1499 129, 130, 131, 132, 133, 134, 135
1502 static const short yycheck[] = { 26,
1503 2, 40, 15, 106, 106, 23, 89, 15, 9, 168,
1504 107, 393, 30, 40, 101, 29, 98, 104, 96, 66,
1505 21, 96, 232, 233, 102, 107, 408, 102, 30, 10,
1506 11, 12, 13, 14, 15, 16, 17, 196, 197, 126,
1507 53, 23, 129, 130, 141, 53, 133, 134, 135, 259,
1508 20, 98, 139, 96, 96, 104, 4, 407, 107, 96,
1509 96, 88, 95, 106, 106, 415, 68, 104, 104, 95,
1510 40, 41, 42, 43, 101, 95, 46, 104, 95, 10,
1511 11, 12, 13, 14, 15, 16, 17, 102, 106, 32,
1512 33, 105, 107, 57, 58, 59, 60, 124, 125, 126,
1513 127, 128, 129, 130, 51, 52, 133, 134, 135, 136,
1514 137, 138, 139, 10, 11, 12, 13, 14, 15, 16,
1515 17, 102, 169, 170, 171, 100, 213, 95, 5, 6,
1516 4, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1517 17, 18, 19, 20, 21, 22, 173, 24, 48, 49,
1518 50, 22, 98, 24, 84, 85, 195, 27, 28, 4,
1519 167, 3, 4, 3, 4, 3, 4, 44, 195, 4,
1520 177, 102, 211, 3, 4, 182, 183, 3, 4, 98,
1521 24, 4, 98, 24, 211, 212, 213, 194, 101, 276,
1522 0, 101, 199, 352, 353, 55, 283, 96, 4, 4,
1523 207, 208, 209, 250, 4, 4, 289, 290, 291, 7,
1524 7, 4, 7, 96, 99, 25, 299, 300, 301, 302,
1525 97, 31, 100, 100, 96, 53, 103, 96, 105, 106,
1526 40, 41, 42, 43, 96, 96, 24, 96, 96, 35,
1527 96, 96, 24, 100, 246, 98, 98, 98, 275, 276,
1528 277, 278, 279, 336, 4, 98, 283, 21, 21, 98,
1529 267, 98, 98, 96, 96, 99, 273, 96, 53, 96,
1530 35, 358, 96, 98, 96, 96, 96, 284, 285, 96,
1531 307, 96, 98, 366, 96, 368, 369, 370, 371, 316,
1532 393, 393, 379, 96, 96, 96, 4, 21, 102, 35,
1533 21, 21, 96, 21, 331, 408, 408, 314, 315, 96,
1534 96, 100, 319, 96, 65, 99, 96, 400, 325, 326,
1535 327, 99, 99, 99, 351, 99, 99, 99, 99, 96,
1536 99, 358, 102, 21, 96, 362, 182, 183, 365, 0,
1537 0, 78, 349, 350, 78, 78, 78, 30, 194, 356,
1538 18, 98, 379, 199, 167, 20, 363, 22, 42, 24,
1539 2, 207, 208, 209, 21, 307, 31, 32, 33, 13,
1540 362, 316, 333, -1, 381, 40, 41, 42, 43, -1,
1541 -1, 46, 47, -1, -1, -1, -1, -1, -1, 54,
1542 -1, 5, 6, -1, -1, -1, -1, -1, 405, -1,
1543 -1, -1, -1, -1, -1, -1, -1, -1, 22, 416,
1544 24, -1, 26, -1, 421, -1, -1, -1, 425, 426,
1545 -1, 267, -1, 37, 38, -1, -1, 273, -1, -1,
1546 -1, -1, -1, -1, -1, -1, -1, -1, 284, 285,
1547 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1548 -1, -1, -1, 67, 68, 69, 70, 71, 72, 73,
1549 74, 75, 76, 77, 78, 79, 80, -1, 314, 315,
1550 -1, -1, 86, 319, 88, 89, 90, 91, -1, 325,
1551 326, 327, -1, -1, -1, -1, 100, -1, -1, 103,
1552 -1, 105, -1, -1, 108, -1, -1, -1, -1, -1,
1553 -1, -1, -1, 349, 350, -1, -1, -1, -1, -1,
1554 356, -1, -1, -1, -1, 5, 6, 363, 8, 9,
1555 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1556 20, 21, 22, -1, 24, 381, -1, -1, -1, -1,
1557 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1558 -1, -1, -1, -1, 44, -1, -1, -1, -1, 405,
1559 -1, -1, 3, 4, 5, 6, 7, -1, -1, -1,
1560 416, -1, -1, -1, -1, 421, -1, -1, -1, 425,
1561 426, 22, -1, 24, -1, -1, 27, 28, -1, -1,
1562 -1, -1, -1, -1, -1, -1, 37, 38, -1, -1,
1563 -1, -1, -1, -1, -1, -1, -1, 97, -1, -1,
1564 100, -1, -1, 103, -1, 105, 106, 3, 4, -1,
1565 -1, 7, -1, -1, -1, -1, 67, 68, 69, 70,
1566 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1567 -1, 27, 28, -1, -1, 86, -1, 88, 89, 90,
1568 91, 37, 38, -1, -1, -1, -1, -1, -1, -1,
1569 -1, -1, 103, -1, -1, -1, -1, -1, -1, -1,
1570 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1571 -1, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1572 76, 77, 78, 79, 80, -1, -1, -1, -1, -1,
1573 86, -1, 88, 89, 90, 91, -1, -1, -1, -1,
1574 -1, -1, -1, -1, -1, 5, 6, 103, 8, 9,
1575 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1576 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
1577 -1, -1, -1, -1, -1, -1, 36, -1, -1, -1,
1578 -1, -1, 5, 6, 44, 8, 9, 10, 11, 12,
1579 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1580 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1581 -1, -1, -1, 36, -1, -1, -1, -1, -1, 5,
1582 6, 44, 8, 9, 10, 11, 12, 13, 14, 15,
1583 16, 17, 18, 19, 20, 21, 22, 97, 24, -1,
1584 100, -1, -1, 103, -1, 105, -1, -1, -1, -1,
1585 -1, -1, -1, -1, -1, -1, 5, 6, 44, 8,
1586 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
1587 19, 20, 21, 22, 97, 24, -1, 100, -1, -1,
1588 103, -1, 105, -1, -1, -1, -1, 36, -1, -1,
1589 -1, -1, -1, 5, 6, 44, 8, 9, 10, 11,
1590 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1591 22, 97, 24, -1, 100, -1, 102, 103, -1, 105,
1592 -1, -1, -1, -1, 36, -1, -1, -1, -1, -1,
1593 5, 6, 44, 8, 9, 10, 11, 12, 13, 14,
1594 15, 16, 17, 18, 19, 20, 21, 22, 97, 24,
1595 -1, 100, -1, -1, 103, -1, 105, -1, -1, -1,
1596 -1, -1, -1, -1, -1, -1, -1, 5, 6, 44,
1597 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
1598 18, 19, 20, 21, 22, 97, 24, -1, 100, -1,
1599 -1, 103, -1, 105, -1, -1, -1, -1, -1, -1,
1600 -1, -1, -1, -1, 5, 6, 44, 8, 9, 10,
1601 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1602 21, 22, 97, 24, -1, 100, -1, -1, 103, -1,
1603 105, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1604 -1, 5, 6, 44, 8, 9, 10, 11, 12, 13,
1605 14, 15, 16, 17, 18, 19, 20, 21, 22, 97,
1606 24, -1, 100, -1, -1, 103, -1, 105, -1, -1,
1607 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1608 44, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1609 -1, -1, -1, -1, -1, -1, 97, -1, -1, 100,
1610 -1, -1, 103, -1, 105, -1, -1, -1, -1, -1,
1611 -1, -1, -1, -1, -1, -1, 34, -1, -1, -1,
1612 -1, -1, -1, -1, -1, -1, -1, 45, -1, -1,
1613 -1, -1, -1, 97, -1, -1, 100, 55, 56, 103,
1614 -1, 105, -1, 61, 62, 63, 64, 65, 66, 67,
1615 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
1616 78, 79, 80, 81, 82, 83, -1, -1, 86, 87,
1617 88, 89, 90, 91, 92, 93, 94
1619 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1620 #line 3 "/usr/share/bison.simple"
1621 /* This file comes from bison-1.28. */
1623 /* Skeleton output parser for bison,
1624 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1626 This program is free software; you can redistribute it and/or modify
1627 it under the terms of the GNU General Public License as published by
1628 the Free Software Foundation; either version 2, or (at your option)
1631 This program is distributed in the hope that it will be useful,
1632 but WITHOUT ANY WARRANTY; without even the implied warranty of
1633 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1634 GNU General Public License for more details.
1636 You should have received a copy of the GNU General Public License
1637 along with this program; if not, write to the Free Software
1638 Foundation, Inc., 59 Temple Place - Suite 330,
1639 Boston, MA 02111-1307, USA. */
1641 /* As a special exception, when this file is copied by Bison into a
1642 Bison output file, you may use that output file without restriction.
1643 This special exception was added by the Free Software Foundation
1644 in version 1.24 of Bison. */
1646 /* This is the parser code that is written into each bison parser
1647 when the %semantic_parser declaration is not specified in the grammar.
1648 It was written by Richard Stallman by simplifying the hairy parser
1649 used when %semantic_parser is specified. */
1651 #ifndef YYSTACK_USE_ALLOCA
1653 #define YYSTACK_USE_ALLOCA
1654 #else /* alloca not defined */
1656 #define YYSTACK_USE_ALLOCA
1657 #define alloca __builtin_alloca
1658 #else /* not GNU C. */
1659 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
1660 #define YYSTACK_USE_ALLOCA
1662 #else /* not sparc */
1663 /* We think this test detects Watcom and Microsoft C. */
1664 /* This used to test MSDOS, but that is a bad idea
1665 since that symbol is in the user namespace. */
1666 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
1667 #if 0 /* No need for malloc.h, which pollutes the namespace;
1668 instead, just don't use alloca. */
1671 #else /* not MSDOS, or __TURBOC__ */
1673 /* I don't know what this was needed for, but it pollutes the namespace.
1674 So I turned it off. rms, 2 May 1997. */
1675 /* #include <malloc.h> */
1677 #define YYSTACK_USE_ALLOCA
1678 #else /* not MSDOS, or __TURBOC__, or _AIX */
1680 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
1681 and on HPUX 10. Eventually we can turn this on. */
1682 #define YYSTACK_USE_ALLOCA
1683 #define alloca __builtin_alloca
1686 #endif /* not _AIX */
1687 #endif /* not MSDOS, or __TURBOC__ */
1688 #endif /* not sparc */
1689 #endif /* not GNU C */
1690 #endif /* alloca not defined */
1691 #endif /* YYSTACK_USE_ALLOCA not defined */
1693 #ifdef YYSTACK_USE_ALLOCA
1694 #define YYSTACK_ALLOC alloca
1696 #define YYSTACK_ALLOC malloc
1699 /* Note: there must be only one dollar sign in this file.
1700 It is replaced by the list of actions, each action
1701 as one case of the switch. */
1703 #define yyerrok (yyerrstatus = 0)
1704 #define yyclearin (yychar = YYEMPTY)
1707 #define YYACCEPT goto yyacceptlab
1708 #define YYABORT goto yyabortlab
1709 #define YYERROR goto yyerrlab1
1710 /* Like YYERROR except do call yyerror.
1711 This remains here temporarily to ease the
1712 transition to the new meaning of YYERROR, for GCC.
1713 Once GCC version 2 has supplanted version 1, this can go. */
1714 #define YYFAIL goto yyerrlab
1715 #define YYRECOVERING() (!!yyerrstatus)
1716 #define YYBACKUP(token, value) \
1718 if (yychar == YYEMPTY && yylen == 1) \
1719 { yychar = (token), yylval = (value); \
1720 yychar1 = YYTRANSLATE (yychar); \
1725 { yyerror ("syntax error: cannot back up"); YYERROR; } \
1729 #define YYERRCODE 256
1732 #define YYLEX yylex()
1738 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
1740 #define YYLEX yylex(&yylval, &yylloc)
1742 #else /* not YYLSP_NEEDED */
1744 #define YYLEX yylex(&yylval, YYLEX_PARAM)
1746 #define YYLEX yylex(&yylval)
1748 #endif /* not YYLSP_NEEDED */
1751 /* If nonreentrant, generate the variables here */
1755 int yychar; /* the lookahead symbol */
1756 YYSTYPE yylval; /* the semantic value of the */
1757 /* lookahead symbol */
1760 YYLTYPE yylloc; /* location data for the lookahead */
1764 int yynerrs; /* number of parse errors so far */
1765 #endif /* not YYPURE */
1768 int yydebug; /* nonzero means print parse trace */
1769 /* Since this is uninitialized, it does not stop multiple parsers
1773 /* YYINITDEPTH indicates the initial size of the parser's stacks */
1776 #define YYINITDEPTH 200
1779 /* YYMAXDEPTH is the maximum size the stacks can grow to
1780 (effective only if the built-in stack extension method is used). */
1787 #define YYMAXDEPTH 10000
1790 /* Define __yy_memcpy. Note that the size argument
1791 should be passed with type unsigned int, because that is what the non-GCC
1792 definitions require. With GCC, __builtin_memcpy takes an arg
1793 of type size_t, but it can handle unsigned int. */
1795 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
1796 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
1797 #else /* not GNU C or C++ */
1800 /* This is the most reliable way to avoid incompatibilities
1801 in available built-in functions on various systems. */
1803 __yy_memcpy (to, from, count)
1808 register char *f = from;
1809 register char *t = to;
1810 register int i = count;
1816 #else /* __cplusplus */
1818 /* This is the most reliable way to avoid incompatibilities
1819 in available built-in functions on various systems. */
1821 __yy_memcpy (char *to, char *from, unsigned int count)
1823 register char *t = to;
1824 register char *f = from;
1825 register int i = count;
1834 #line 217 "/usr/share/bison.simple"
1836 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
1837 into yyparse. The argument should have type void *.
1838 It should actually point to an object.
1839 Grammar actions can access the variable by casting it
1840 to the proper pointer type. */
1842 #ifdef YYPARSE_PARAM
1844 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1845 #define YYPARSE_PARAM_DECL
1846 #else /* not __cplusplus */
1847 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
1848 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1849 #endif /* not __cplusplus */
1850 #else /* not YYPARSE_PARAM */
1851 #define YYPARSE_PARAM_ARG
1852 #define YYPARSE_PARAM_DECL
1853 #endif /* not YYPARSE_PARAM */
1855 /* Prevent warning if -Wstrict-prototypes. */
1857 #ifdef YYPARSE_PARAM
1858 int yyparse (void *);
1865 yyparse(YYPARSE_PARAM_ARG)
1868 register int yystate;
1870 register short *yyssp;
1871 register YYSTYPE *yyvsp;
1872 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1873 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1875 short yyssa[YYINITDEPTH]; /* the state stack */
1876 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1878 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1879 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1882 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1883 YYLTYPE *yyls = yylsa;
1886 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1888 #define YYPOPSTACK (yyvsp--, yyssp--)
1891 int yystacksize = YYINITDEPTH;
1892 int yyfree_stacks = 0;
1903 YYSTYPE yyval; /* the variable used to return */
1904 /* semantic values from the action */
1911 fprintf(stderr, "Starting parse\n");
1917 yychar = YYEMPTY; /* Cause a token to be read. */
1919 /* Initialize stack pointers.
1920 Waste one element of value and location stack
1921 so that they stay on the same level as the state stack.
1922 The wasted elements are never initialized. */
1930 /* Push a new state, which is found in yystate . */
1931 /* In all cases, when you get here, the value and location stacks
1932 have just been pushed. so pushing a state here evens the stacks. */
1937 if (yyssp >= yyss + yystacksize - 1)
1939 /* Give user a chance to reallocate the stack */
1940 /* Use copies of these so that the &'s don't force the real ones into memory. */
1941 YYSTYPE *yyvs1 = yyvs;
1942 short *yyss1 = yyss;
1944 YYLTYPE *yyls1 = yyls;
1947 /* Get the current used size of the three stacks, in elements. */
1948 int size = yyssp - yyss + 1;
1951 /* Each stack pointer address is followed by the size of
1952 the data in use in that stack, in bytes. */
1954 /* This used to be a conditional around just the two extra args,
1955 but that might be undefined if yyoverflow is a macro. */
1956 yyoverflow("parser stack overflow",
1957 &yyss1, size * sizeof (*yyssp),
1958 &yyvs1, size * sizeof (*yyvsp),
1959 &yyls1, size * sizeof (*yylsp),
1962 yyoverflow("parser stack overflow",
1963 &yyss1, size * sizeof (*yyssp),
1964 &yyvs1, size * sizeof (*yyvsp),
1968 yyss = yyss1; yyvs = yyvs1;
1972 #else /* no yyoverflow */
1973 /* Extend the stack our own way. */
1974 if (yystacksize >= YYMAXDEPTH)
1976 yyerror("parser stack overflow");
1988 if (yystacksize > YYMAXDEPTH)
1989 yystacksize = YYMAXDEPTH;
1990 #ifndef YYSTACK_USE_ALLOCA
1993 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1994 __yy_memcpy ((char *)yyss, (char *)yyss1,
1995 size * (unsigned int) sizeof (*yyssp));
1996 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1997 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1998 size * (unsigned int) sizeof (*yyvsp));
2000 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2001 __yy_memcpy ((char *)yyls, (char *)yyls1,
2002 size * (unsigned int) sizeof (*yylsp));
2004 #endif /* no yyoverflow */
2006 yyssp = yyss + size - 1;
2007 yyvsp = yyvs + size - 1;
2009 yylsp = yyls + size - 1;
2014 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2017 if (yyssp >= yyss + yystacksize - 1)
2023 fprintf(stderr, "Entering state %d\n", yystate);
2029 /* Do appropriate processing given the current state. */
2030 /* Read a lookahead token if we need one and don't already have one. */
2033 /* First try to decide what to do without reference to lookahead token. */
2035 yyn = yypact[yystate];
2039 /* Not known => get a lookahead token if don't already have one. */
2041 /* yychar is either YYEMPTY or YYEOF
2042 or a valid token in external form. */
2044 if (yychar == YYEMPTY)
2048 fprintf(stderr, "Reading a token: ");
2053 /* Convert token to internal form (in yychar1) for indexing tables with */
2055 if (yychar <= 0) /* This means end of input. */
2058 yychar = YYEOF; /* Don't call YYLEX any more */
2062 fprintf(stderr, "Now at end of input.\n");
2067 yychar1 = YYTRANSLATE(yychar);
2072 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2073 /* Give the individual parser a way to print the precise meaning
2074 of a token, for further debugging info. */
2076 YYPRINT (stderr, yychar, yylval);
2078 fprintf (stderr, ")\n");
2084 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2089 /* yyn is what to do for this token type in this state.
2090 Negative => reduce, -yyn is rule number.
2091 Positive => shift, yyn is new state.
2092 New state is final state => don't bother to shift,
2093 just return success.
2094 0, or most negative number => error. */
2109 /* Shift the lookahead token. */
2113 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2116 /* Discard the token being shifted unless it is eof. */
2117 if (yychar != YYEOF)
2125 /* count tokens shifted since error; after three, turn off error status. */
2126 if (yyerrstatus) yyerrstatus--;
2131 /* Do the default action for the current state. */
2134 yyn = yydefact[yystate];
2138 /* Do a reduction. yyn is the number of a rule to reduce with. */
2142 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2149 fprintf (stderr, "Reducing via rule %d (line %d), ",
2152 /* Print the symbols being reduced, and their result. */
2153 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2154 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2155 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2163 #line 991 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2165 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
2166 ThrowException("Value too large for type!");
2167 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
2171 #line 999 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2173 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
2174 ThrowException("Value too large for type!");
2175 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
2179 #line 1022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2181 yyval.StrVal = yyvsp[-1].StrVal;
2185 #line 1025 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2191 #line 1029 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2192 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2195 #line 1030 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2196 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2199 #line 1031 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2200 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2203 #line 1032 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2204 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2207 #line 1033 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2208 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2211 #line 1035 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2212 { yyval.UIntVal = CallingConv::C; ;
2215 #line 1036 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2216 { yyval.UIntVal = CallingConv::C; ;
2219 #line 1037 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2220 { yyval.UIntVal = CallingConv::Fast; ;
2223 #line 1038 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2224 { yyval.UIntVal = CallingConv::Cold; ;
2227 #line 1039 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2229 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2230 ThrowException("Calling conv too large!");
2231 yyval.UIntVal = yyvsp[0].UInt64Val;
2235 #line 1047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2236 { yyval.UIntVal = 0; ;
2239 #line 1048 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2240 { yyval.UIntVal = yyvsp[0].UInt64Val; ;
2243 #line 1049 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2244 { yyval.UIntVal = 0; ;
2247 #line 1050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2248 { yyval.UIntVal = yyvsp[0].UInt64Val; ;
2251 #line 1059 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2252 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2255 #line 1060 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2256 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2259 #line 1062 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2261 if (!UpRefs.empty())
2262 ThrowException("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
2263 yyval.TypeVal = yyvsp[0].TypeVal;
2267 #line 1073 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2269 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2273 #line 1076 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2275 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2279 #line 1079 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2280 { // Named types are also simple types...
2281 yyval.TypeVal = new PATypeHolder(getTypeVal(yyvsp[0].ValIDVal));
2285 #line 1085 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2286 { // Type UpReference
2287 if (yyvsp[0].UInt64Val > (uint64_t)~0U) ThrowException("Value out of range!");
2288 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2289 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2290 yyval.TypeVal = new PATypeHolder(OT);
2291 UR_OUT("New Upreference!\n");
2295 #line 1092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2296 { // Function derived type?
2297 std::vector<const Type*> Params;
2298 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2299 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2300 Params.push_back(*I);
2301 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2302 if (isVarArg) Params.pop_back();
2304 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg)));
2305 delete yyvsp[-1].TypeList; // Delete the argument list
2306 delete yyvsp[-3].TypeVal; // Delete the return type handle
2310 #line 1104 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2311 { // Sized array type?
2312 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2313 delete yyvsp[-1].TypeVal;
2317 #line 1108 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2318 { // Packed array type?
2319 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
2320 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
2321 ThrowException("Unsigned result not equal to signed result");
2322 if (!ElemTy->isPrimitiveType())
2323 ThrowException("Elemental type of a PackedType must be primitive");
2324 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
2325 ThrowException("Vector length should be a power of 2!");
2326 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2327 delete yyvsp[-1].TypeVal;
2331 #line 1119 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2332 { // Structure type?
2333 std::vector<const Type*> Elements;
2334 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2335 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2336 Elements.push_back(*I);
2338 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
2339 delete yyvsp[-1].TypeList;
2343 #line 1128 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2344 { // Empty structure type?
2345 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
2349 #line 1131 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2351 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2352 delete yyvsp[-1].TypeVal;
2356 #line 1139 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2358 yyval.TypeList = new std::list<PATypeHolder>();
2359 yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2363 #line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2365 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2369 #line 1149 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2371 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy);
2375 #line 1152 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2377 (yyval.TypeList = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
2381 #line 1155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2383 yyval.TypeList = new std::list<PATypeHolder>();
2387 #line 1165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2388 { // Nonempty unsized arr
2389 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
2391 ThrowException("Cannot make array constant with type: '" +
2392 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2393 const Type *ETy = ATy->getElementType();
2394 int NumElements = ATy->getNumElements();
2396 // Verify that we have the correct size...
2397 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2398 ThrowException("Type mismatch: constant sized array initialized with " +
2399 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
2400 itostr(NumElements) + "!");
2402 // Verify all elements are correct type!
2403 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2404 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2405 ThrowException("Element #" + utostr(i) + " is not of type '" +
2406 ETy->getDescription() +"' as required!\nIt is of type '"+
2407 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2410 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
2411 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2415 #line 1190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2417 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2419 ThrowException("Cannot make array constant with type: '" +
2420 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2422 int NumElements = ATy->getNumElements();
2423 if (NumElements != -1 && NumElements != 0)
2424 ThrowException("Type mismatch: constant sized array initialized with 0"
2425 " arguments, but has size of " + itostr(NumElements) +"!");
2426 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
2427 delete yyvsp[-2].TypeVal;
2431 #line 1203 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2433 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2435 ThrowException("Cannot make array constant with type: '" +
2436 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2438 int NumElements = ATy->getNumElements();
2439 const Type *ETy = ATy->getElementType();
2440 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
2441 if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
2442 ThrowException("Can't build string constant of size " +
2443 itostr((int)(EndStr-yyvsp[0].StrVal)) +
2444 " when array has size " + itostr(NumElements) + "!");
2445 std::vector<Constant*> Vals;
2446 if (ETy == Type::SByteTy) {
2447 for (char *C = yyvsp[0].StrVal; C != EndStr; ++C)
2448 Vals.push_back(ConstantSInt::get(ETy, *C));
2449 } else if (ETy == Type::UByteTy) {
2450 for (char *C = yyvsp[0].StrVal; C != EndStr; ++C)
2451 Vals.push_back(ConstantUInt::get(ETy, (unsigned char)*C));
2453 free(yyvsp[0].StrVal);
2454 ThrowException("Cannot build string arrays of non byte sized elements!");
2456 free(yyvsp[0].StrVal);
2457 yyval.ConstVal = ConstantArray::get(ATy, Vals);
2458 delete yyvsp[-2].TypeVal;
2462 #line 1231 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2463 { // Nonempty unsized arr
2464 const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get());
2466 ThrowException("Cannot make packed constant with type: '" +
2467 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2468 const Type *ETy = PTy->getElementType();
2469 int NumElements = PTy->getNumElements();
2471 // Verify that we have the correct size...
2472 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2473 ThrowException("Type mismatch: constant sized packed initialized with " +
2474 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
2475 itostr(NumElements) + "!");
2477 // Verify all elements are correct type!
2478 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2479 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2480 ThrowException("Element #" + utostr(i) + " is not of type '" +
2481 ETy->getDescription() +"' as required!\nIt is of type '"+
2482 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2485 yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector);
2486 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2490 #line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2492 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
2494 ThrowException("Cannot make struct constant with type: '" +
2495 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2497 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
2498 ThrowException("Illegal number of initializers for structure type!");
2500 // Check to ensure that constants are compatible with the type initializer!
2501 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
2502 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
2503 ThrowException("Expected type '" +
2504 STy->getElementType(i)->getDescription() +
2505 "' for element #" + utostr(i) +
2506 " of structure initializer!");
2508 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
2509 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2513 #line 1276 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2515 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
2517 ThrowException("Cannot make struct constant with type: '" +
2518 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2520 if (STy->getNumContainedTypes() != 0)
2521 ThrowException("Illegal number of initializers for structure type!");
2523 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
2524 delete yyvsp[-2].TypeVal;
2528 #line 1288 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2530 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2532 ThrowException("Cannot make null pointer constant with type: '" +
2533 (*yyvsp[-1].TypeVal)->getDescription() + "'!");
2535 yyval.ConstVal = ConstantPointerNull::get(PTy);
2536 delete yyvsp[-1].TypeVal;
2540 #line 1297 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2542 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
2543 delete yyvsp[-1].TypeVal;
2547 #line 1301 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2549 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2551 ThrowException("Global const reference must be a pointer type!");
2553 // ConstExprs can exist in the body of a function, thus creating
2554 // GlobalValues whenever they refer to a variable. Because we are in
2555 // the context of a function, getValNonImprovising will search the functions
2556 // symbol table instead of the module symbol table for the global symbol,
2557 // which throws things all off. To get around this, we just tell
2558 // getValNonImprovising that we are at global scope here.
2560 Function *SavedCurFn = CurFun.CurrentFunction;
2561 CurFun.CurrentFunction = 0;
2563 Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal);
2565 CurFun.CurrentFunction = SavedCurFn;
2567 // If this is an initializer for a constant pointer, which is referencing a
2568 // (currently) undefined variable, create a stub now that shall be replaced
2569 // in the future with the right type of variable.
2572 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
2573 const PointerType *PT = cast<PointerType>(Ty);
2575 // First check to see if the forward references value is already created!
2576 PerModuleInfo::GlobalRefsType::iterator I =
2577 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
2579 if (I != CurModule.GlobalRefs.end()) {
2580 V = I->second; // Placeholder already exists, use it...
2581 yyvsp[0].ValIDVal.destroy();
2584 if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name;
2586 // Create the forward referenced global.
2588 if (const FunctionType *FTy =
2589 dyn_cast<FunctionType>(PT->getElementType())) {
2590 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
2591 CurModule.CurrentModule);
2593 GV = new GlobalVariable(PT->getElementType(), false,
2594 GlobalValue::ExternalLinkage, 0,
2595 Name, CurModule.CurrentModule);
2598 // Keep track of the fact that we have a forward ref to recycle it
2599 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
2604 yyval.ConstVal = cast<GlobalValue>(V);
2605 delete yyvsp[-1].TypeVal; // Free the type handle
2609 #line 1360 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2611 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
2612 ThrowException("Mismatched types for constant expression!");
2613 yyval.ConstVal = yyvsp[0].ConstVal;
2614 delete yyvsp[-1].TypeVal;
2618 #line 1366 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2620 const Type *Ty = yyvsp[-1].TypeVal->get();
2621 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
2622 ThrowException("Cannot create a null initialized value of this type!");
2623 yyval.ConstVal = Constant::getNullValue(Ty);
2624 delete yyvsp[-1].TypeVal;
2628 #line 1374 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2629 { // integral constants
2630 if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
2631 ThrowException("Constant value doesn't fit in type!");
2632 yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val);
2636 #line 1379 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2637 { // integral constants
2638 if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
2639 ThrowException("Constant value doesn't fit in type!");
2640 yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val);
2644 #line 1384 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2645 { // Boolean constants
2646 yyval.ConstVal = ConstantBool::True;
2650 #line 1387 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2651 { // Boolean constants
2652 yyval.ConstVal = ConstantBool::False;
2656 #line 1390 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2657 { // Float & Double constants
2658 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
2659 ThrowException("Floating point constant invalid for type!!");
2660 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
2664 #line 1397 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2666 if (!yyvsp[-3].ConstVal->getType()->isFirstClassType())
2667 ThrowException("cast constant expression from a non-primitive type: '" +
2668 yyvsp[-3].ConstVal->getType()->getDescription() + "'!");
2669 if (!yyvsp[-1].TypeVal->get()->isFirstClassType())
2670 ThrowException("cast constant expression to a non-primitive type: '" +
2671 yyvsp[-1].TypeVal->get()->getDescription() + "'!");
2672 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get());
2673 delete yyvsp[-1].TypeVal;
2677 #line 1407 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2679 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
2680 ThrowException("GetElementPtr requires a pointer operand!");
2682 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
2683 // indices to uint struct indices for compatibility.
2684 generic_gep_type_iterator<std::vector<Value*>::iterator>
2685 GTI = gep_type_begin(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()),
2686 GTE = gep_type_end(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
2687 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
2688 if (isa<StructType>(*GTI)) // Only change struct indices
2689 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[-1].ValueList)[i]))
2690 if (CUI->getType() == Type::UByteTy)
2691 (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
2694 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true);
2696 ThrowException("Index list invalid for constant getelementptr!");
2698 std::vector<Constant*> IdxVec;
2699 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
2700 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
2701 IdxVec.push_back(C);
2703 ThrowException("Indices to constant getelementptr must be constants!");
2705 delete yyvsp[-1].ValueList;
2707 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec);
2711 #line 1438 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2713 if (yyvsp[-5].ConstVal->getType() != Type::BoolTy)
2714 ThrowException("Select condition must be of boolean type!");
2715 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2716 ThrowException("Select operand types must match!");
2717 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2721 #line 1445 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2723 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2724 ThrowException("Binary operator types must match!");
2725 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
2726 // To retain backward compatibility with these early compilers, we emit a
2727 // cast to the appropriate integer type automatically if we are in the
2728 // broken case. See PR424 for more information.
2729 if (!isa<PointerType>(yyvsp[-3].ConstVal->getType())) {
2730 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2732 const Type *IntPtrTy = 0;
2733 switch (CurModule.CurrentModule->getPointerSize()) {
2734 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
2735 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
2736 default: ThrowException("invalid pointer binary constant expr!");
2738 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, ConstantExpr::getCast(yyvsp[-3].ConstVal, IntPtrTy),
2739 ConstantExpr::getCast(yyvsp[-1].ConstVal, IntPtrTy));
2740 yyval.ConstVal = ConstantExpr::getCast(yyval.ConstVal, yyvsp[-3].ConstVal->getType());
2745 #line 1466 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2747 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2748 ThrowException("Logical operator types must match!");
2749 if (!yyvsp[-3].ConstVal->getType()->isIntegral())
2750 ThrowException("Logical operands must have integral types!");
2751 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2755 #line 1473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2757 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2758 ThrowException("setcc operand types must match!");
2759 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2763 #line 1478 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2765 if (yyvsp[-1].ConstVal->getType() != Type::UByteTy)
2766 ThrowException("Shift count for shift constant must be unsigned byte!");
2767 if (!yyvsp[-3].ConstVal->getType()->isInteger())
2768 ThrowException("Shift constant expression requires integer operand!");
2769 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2773 #line 1488 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2775 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
2779 #line 1491 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2781 yyval.ConstVector = new std::vector<Constant*>();
2782 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
2786 #line 1498 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2787 { yyval.BoolVal = false; ;
2790 #line 1498 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2791 { yyval.BoolVal = true; ;
2794 #line 1508 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2796 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
2797 CurModule.ModuleDone();
2801 #line 1515 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2803 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2804 CurFun.FunctionDone();
2808 #line 1519 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2810 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2814 #line 1522 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2816 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2820 #line 1525 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2822 yyval.ModuleVal = CurModule.CurrentModule;
2823 // Emit an error if there are any unresolved types left.
2824 if (!CurModule.LateResolveTypes.empty()) {
2825 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
2826 if (DID.Type == ValID::NameVal)
2827 ThrowException("Reference to an undefined type: '"+DID.getName() + "'");
2829 ThrowException("Reference to an undefined type: #" + itostr(DID.Num));
2834 #line 1538 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2836 // Eagerly resolve types. This is not an optimization, this is a
2837 // requirement that is due to the fact that we could have this:
2839 // %list = type { %list * }
2840 // %list = type { %list * } ; repeated type decl
2842 // If types are not resolved eagerly, then the two types will not be
2843 // determined to be the same type!
2845 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
2847 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
2848 // If this is a named type that is not a redefinition, add it to the slot
2850 CurModule.Types.push_back(*yyvsp[0].TypeVal);
2853 delete yyvsp[0].TypeVal;
2857 #line 1558 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2858 { // Function prototypes can be in const pool
2862 #line 1560 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2864 if (yyvsp[-1].ConstVal == 0) ThrowException("Global value initializer is not a constant!");
2865 ParseGlobalVariable(yyvsp[-4].StrVal, yyvsp[-3].Linkage, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[0].UIntVal);
2869 #line 1564 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2871 ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage, yyvsp[-2].BoolVal, *yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
2872 delete yyvsp[-1].TypeVal;
2876 #line 1568 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2881 #line 1570 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2886 #line 1572 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2891 #line 1577 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2892 { yyval.Endianness = Module::BigEndian; ;
2895 #line 1578 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2896 { yyval.Endianness = Module::LittleEndian; ;
2899 #line 1580 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2901 CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness);
2905 #line 1583 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2907 if (yyvsp[0].UInt64Val == 32)
2908 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
2909 else if (yyvsp[0].UInt64Val == 64)
2910 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
2912 ThrowException("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!");
2916 #line 1591 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2918 CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
2919 free(yyvsp[0].StrVal);
2923 #line 1598 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2925 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
2926 free(yyvsp[0].StrVal);
2930 #line 1602 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2932 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
2933 free(yyvsp[0].StrVal);
2937 #line 1606 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2942 #line 1615 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2943 { yyval.StrVal = 0; ;
2946 #line 1617 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2948 if (*yyvsp[-1].TypeVal == Type::VoidTy)
2949 ThrowException("void typed arguments are invalid!");
2950 yyval.ArgVal = new std::pair<PATypeHolder*, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
2954 #line 1623 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2956 yyval.ArgList = yyvsp[-2].ArgList;
2957 yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal);
2958 delete yyvsp[0].ArgVal;
2962 #line 1628 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2964 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
2965 yyval.ArgList->push_back(*yyvsp[0].ArgVal);
2966 delete yyvsp[0].ArgVal;
2970 #line 1634 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2972 yyval.ArgList = yyvsp[0].ArgList;
2976 #line 1637 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2978 yyval.ArgList = yyvsp[-2].ArgList;
2979 yyval.ArgList->push_back(std::pair<PATypeHolder*,
2980 char*>(new PATypeHolder(Type::VoidTy), 0));
2984 #line 1642 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2986 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
2987 yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
2991 #line 1646 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2997 #line 1650 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
2999 UnEscapeLexed(yyvsp[-4].StrVal);
3000 std::string FunctionName(yyvsp[-4].StrVal);
3001 free(yyvsp[-4].StrVal); // Free strdup'd memory!
3003 if (!(*yyvsp[-5].TypeVal)->isFirstClassType() && *yyvsp[-5].TypeVal != Type::VoidTy)
3004 ThrowException("LLVM functions cannot return aggregate types!");
3005 if (yyvsp[0].UIntVal != 0 && !isPowerOf2_32(yyvsp[0].UIntVal))
3006 ThrowException("Function alignment must be a power of two!");
3008 std::vector<const Type*> ParamTypeList;
3009 if (yyvsp[-2].ArgList) { // If there are arguments...
3010 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-2].ArgList->begin();
3011 I != yyvsp[-2].ArgList->end(); ++I)
3012 ParamTypeList.push_back(I->first->get());
3015 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
3016 if (isVarArg) ParamTypeList.pop_back();
3018 const FunctionType *FT = FunctionType::get(*yyvsp[-5].TypeVal, ParamTypeList, isVarArg);
3019 const PointerType *PFT = PointerType::get(FT);
3020 delete yyvsp[-5].TypeVal;
3023 if (!FunctionName.empty()) {
3024 ID = ValID::create((char*)FunctionName.c_str());
3026 ID = ValID::create((int)CurModule.Values[PFT].size());
3030 // See if this function was forward referenced. If so, recycle the object.
3031 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
3032 // Move the function to the end of the list, from whereever it was
3033 // previously inserted.
3034 Fn = cast<Function>(FWRef);
3035 CurModule.CurrentModule->getFunctionList().remove(Fn);
3036 CurModule.CurrentModule->getFunctionList().push_back(Fn);
3037 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
3038 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
3039 // If this is the case, either we need to be a forward decl, or it needs
3041 if (!CurFun.isDeclare && !Fn->isExternal())
3042 ThrowException("Redefinition of function '" + FunctionName + "'!");
3044 // Make sure to strip off any argument names so we can't get conflicts.
3045 if (Fn->isExternal())
3046 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
3050 } else { // Not already defined?
3051 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
3052 CurModule.CurrentModule);
3053 InsertValue(Fn, CurModule.Values);
3056 CurFun.FunctionStart(Fn);
3057 Fn->setCallingConv(yyvsp[-6].UIntVal);
3058 Fn->setAlignment(yyvsp[0].UIntVal);
3060 // Add all of the arguments we parsed to the function...
3061 if (yyvsp[-2].ArgList) { // Is null if empty...
3062 if (isVarArg) { // Nuke the last entry
3063 assert(yyvsp[-2].ArgList->back().first->get() == Type::VoidTy && yyvsp[-2].ArgList->back().second == 0&&
3064 "Not a varargs marker!");
3065 delete yyvsp[-2].ArgList->back().first;
3066 yyvsp[-2].ArgList->pop_back(); // Delete the last entry
3068 Function::arg_iterator ArgIt = Fn->arg_begin();
3069 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-2].ArgList->begin();
3070 I != yyvsp[-2].ArgList->end(); ++I, ++ArgIt) {
3071 delete I->first; // Delete the typeholder...
3073 setValueName(ArgIt, I->second); // Insert arg into symtab...
3077 delete yyvsp[-2].ArgList; // We're now done with the argument list
3082 #line 1735 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3084 yyval.FunctionVal = CurFun.CurrentFunction;
3086 // Make sure that we keep track of the linkage type even if there was a
3087 // previous "declare".
3088 yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage);
3092 #line 1745 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3094 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3098 #line 1749 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3099 { CurFun.isDeclare = true; ;
3102 #line 1749 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3104 yyval.FunctionVal = CurFun.CurrentFunction;
3105 CurFun.FunctionDone();
3109 #line 1758 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3110 { // A reference to a direct constant
3111 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
3115 #line 1761 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3117 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
3121 #line 1764 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3122 { // Perhaps it's an FP constant?
3123 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
3127 #line 1767 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3129 yyval.ValIDVal = ValID::create(ConstantBool::True);
3133 #line 1770 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3135 yyval.ValIDVal = ValID::create(ConstantBool::False);
3139 #line 1773 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3141 yyval.ValIDVal = ValID::createNull();
3145 #line 1776 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3147 yyval.ValIDVal = ValID::createUndef();
3151 #line 1779 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3152 { // Nonempty unsized packed vector
3153 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
3154 int NumElements = yyvsp[-1].ConstVector->size();
3156 PackedType* pt = PackedType::get(ETy, NumElements);
3157 PATypeHolder* PTy = new PATypeHolder(
3165 // Verify all elements are correct type!
3166 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3167 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3168 ThrowException("Element #" + utostr(i) + " is not of type '" +
3169 ETy->getDescription() +"' as required!\nIt is of type '" +
3170 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3173 yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector));
3174 delete PTy; delete yyvsp[-1].ConstVector;
3178 #line 1803 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3180 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
3184 #line 1810 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3185 { // Is it an integer reference...?
3186 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
3190 #line 1813 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3191 { // Is it a named reference...?
3192 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
3196 #line 1824 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3198 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal;
3202 #line 1828 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3204 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3208 #line 1831 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3209 { // Do not allow functions with 0 basic blocks
3210 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3214 #line 1839 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3216 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
3217 InsertValue(yyvsp[0].TermInstVal);
3219 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
3220 InsertValue(yyvsp[-2].BasicBlockVal);
3221 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
3225 #line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3227 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
3228 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
3232 #line 1852 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3234 yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
3236 // Make sure to move the basic block to the correct location in the
3237 // function, instead of leaving it inserted wherever it was first
3239 Function::BasicBlockListType &BBL =
3240 CurFun.CurrentFunction->getBasicBlockList();
3241 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3245 #line 1862 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3247 yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true);
3249 // Make sure to move the basic block to the correct location in the
3250 // function, instead of leaving it inserted wherever it was first
3252 Function::BasicBlockListType &BBL =
3253 CurFun.CurrentFunction->getBasicBlockList();
3254 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3258 #line 1873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3259 { // Return with a result...
3260 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
3264 #line 1876 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3265 { // Return with no result...
3266 yyval.TermInstVal = new ReturnInst();
3270 #line 1879 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3271 { // Unconditional Branch...
3272 yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[0].ValIDVal));
3276 #line 1882 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3278 yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[-3].ValIDVal), getBBVal(yyvsp[0].ValIDVal), getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
3282 #line 1885 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3284 SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal), getBBVal(yyvsp[-3].ValIDVal), yyvsp[-1].JumpTable->size());
3285 yyval.TermInstVal = S;
3287 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
3288 E = yyvsp[-1].JumpTable->end();
3289 for (; I != E; ++I) {
3290 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
3291 S->addCase(CI, I->second);
3293 ThrowException("Switch case is constant, but not a simple integer!");
3295 delete yyvsp[-1].JumpTable;
3299 #line 1899 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3301 SwitchInst *S = new SwitchInst(getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal), getBBVal(yyvsp[-2].ValIDVal), 0);
3302 yyval.TermInstVal = S;
3306 #line 1904 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3308 const PointerType *PFTy;
3309 const FunctionType *Ty;
3311 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal->get())) ||
3312 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3313 // Pull out the types of all of the arguments...
3314 std::vector<const Type*> ParamTypes;
3315 if (yyvsp[-7].ValueList) {
3316 for (std::vector<Value*>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
3318 ParamTypes.push_back((*I)->getType());
3321 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3322 if (isVarArg) ParamTypes.pop_back();
3324 Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg);
3325 PFTy = PointerType::get(Ty);
3328 Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling...
3330 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
3331 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
3333 // Create the call node...
3334 if (!yyvsp[-7].ValueList) { // Has no arguments?
3335 yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector<Value*>());
3336 } else { // Has arguments?
3337 // Loop through FunctionType's arguments and ensure they are specified
3340 FunctionType::param_iterator I = Ty->param_begin();
3341 FunctionType::param_iterator E = Ty->param_end();
3342 std::vector<Value*>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
3344 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3345 if ((*ArgI)->getType() != *I)
3346 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3347 (*I)->getDescription() + "'!");
3349 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3350 ThrowException("Invalid number of parameters detected!");
3352 yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList);
3354 cast<InvokeInst>(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal);
3356 delete yyvsp[-10].TypeVal;
3357 delete yyvsp[-7].ValueList;
3361 #line 1956 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3363 yyval.TermInstVal = new UnwindInst();
3367 #line 1959 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3369 yyval.TermInstVal = new UnreachableInst();
3373 #line 1965 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3375 yyval.JumpTable = yyvsp[-5].JumpTable;
3376 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3378 ThrowException("May only switch on a constant pool value!");
3380 yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal)));
3384 #line 1973 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3386 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
3387 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3390 ThrowException("May only switch on a constant pool value!");
3392 yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal)));
3396 #line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3398 // Is this definition named?? if so, assign the name...
3399 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
3400 InsertValue(yyvsp[0].InstVal);
3401 yyval.InstVal = yyvsp[0].InstVal;
3405 #line 1990 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3406 { // Used for PHI nodes
3407 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
3408 yyval.PHIList->push_back(std::make_pair(getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal), getBBVal(yyvsp[-1].ValIDVal)));
3409 delete yyvsp[-5].TypeVal;
3413 #line 1995 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3415 yyval.PHIList = yyvsp[-6].PHIList;
3416 yyvsp[-6].PHIList->push_back(std::make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal),
3417 getBBVal(yyvsp[-1].ValIDVal)));
3421 #line 2002 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3422 { // Used for call statements, and memory insts...
3423 yyval.ValueList = new std::vector<Value*>();
3424 yyval.ValueList->push_back(yyvsp[0].ValueVal);
3428 #line 2006 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3430 yyval.ValueList = yyvsp[-2].ValueList;
3431 yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
3435 #line 2012 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3436 { yyval.ValueList = 0; ;
3439 #line 2014 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3441 yyval.BoolVal = true;
3445 #line 2017 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3447 yyval.BoolVal = false;
3451 #line 2023 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3453 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
3454 !isa<PackedType>((*yyvsp[-3].TypeVal).get()))
3456 "Arithmetic operator requires integer, FP, or packed operands!");
3457 if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem)
3458 ThrowException("Rem not supported on packed types!");
3459 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3460 if (yyval.InstVal == 0)
3461 ThrowException("binary operator returned null!");
3462 delete yyvsp[-3].TypeVal;
3466 #line 2035 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3468 if (!(*yyvsp[-3].TypeVal)->isIntegral())
3469 ThrowException("Logical operator requires integral operands!");
3470 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3471 if (yyval.InstVal == 0)
3472 ThrowException("binary operator returned null!");
3473 delete yyvsp[-3].TypeVal;
3477 #line 2043 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3479 if(isa<PackedType>((*yyvsp[-3].TypeVal).get())) {
3481 "PackedTypes currently not supported in setcc instructions!");
3483 yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3484 if (yyval.InstVal == 0)
3485 ThrowException("binary operator returned null!");
3486 delete yyvsp[-3].TypeVal;
3490 #line 2053 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3492 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
3493 << " Replacing with 'xor'.\n";
3495 Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType());
3497 ThrowException("Expected integral type for not instruction!");
3499 yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones);
3500 if (yyval.InstVal == 0)
3501 ThrowException("Could not create a xor instruction!");
3505 #line 2065 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3507 if (yyvsp[0].ValueVal->getType() != Type::UByteTy)
3508 ThrowException("Shift amount must be ubyte!");
3509 if (!yyvsp[-2].ValueVal->getType()->isInteger())
3510 ThrowException("Shift constant expression requires integer operand!");
3511 yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3515 #line 2072 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3517 if (!yyvsp[0].TypeVal->get()->isFirstClassType())
3518 ThrowException("cast instruction to a non-primitive type: '" +
3519 yyvsp[0].TypeVal->get()->getDescription() + "'!");
3520 yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
3521 delete yyvsp[0].TypeVal;
3525 #line 2079 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3527 if (yyvsp[-4].ValueVal->getType() != Type::BoolTy)
3528 ThrowException("select condition must be boolean!");
3529 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
3530 ThrowException("select value types should match!");
3531 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3535 #line 2086 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3538 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
3539 delete yyvsp[0].TypeVal;
3543 #line 2091 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3545 ObsoleteVarArgs = true;
3546 const Type* ArgTy = yyvsp[-2].ValueVal->getType();
3547 Function* NF = CurModule.CurrentModule->
3548 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
3551 //foo = alloca 1 of t
3555 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
3556 CurBB->getInstList().push_back(foo);
3557 CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
3558 CurBB->getInstList().push_back(bar);
3559 CurBB->getInstList().push_back(new StoreInst(bar, foo));
3560 yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal);
3561 delete yyvsp[0].TypeVal;
3565 #line 2110 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3567 ObsoleteVarArgs = true;
3568 const Type* ArgTy = yyvsp[-2].ValueVal->getType();
3569 Function* NF = CurModule.CurrentModule->
3570 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
3572 //b = vanext a, t ->
3573 //foo = alloca 1 of t
3576 //tmp = vaarg foo, t
3578 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
3579 CurBB->getInstList().push_back(foo);
3580 CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
3581 CurBB->getInstList().push_back(bar);
3582 CurBB->getInstList().push_back(new StoreInst(bar, foo));
3583 Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal);
3584 CurBB->getInstList().push_back(tmp);
3585 yyval.InstVal = new LoadInst(foo);
3586 delete yyvsp[0].TypeVal;
3590 #line 2132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3592 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
3593 if (!Ty->isFirstClassType())
3594 ThrowException("PHI node operands must be of first class type!");
3595 yyval.InstVal = new PHINode(Ty);
3596 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
3597 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
3598 if (yyvsp[0].PHIList->front().first->getType() != Ty)
3599 ThrowException("All elements of a PHI node must be of the same type!");
3600 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
3601 yyvsp[0].PHIList->pop_front();
3603 delete yyvsp[0].PHIList; // Free the list...
3607 #line 2146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3609 const PointerType *PFTy;
3610 const FunctionType *Ty;
3612 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal->get())) ||
3613 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3614 // Pull out the types of all of the arguments...
3615 std::vector<const Type*> ParamTypes;
3616 if (yyvsp[-1].ValueList) {
3617 for (std::vector<Value*>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
3619 ParamTypes.push_back((*I)->getType());
3622 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3623 if (isVarArg) ParamTypes.pop_back();
3625 if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy)
3626 ThrowException("LLVM functions cannot return aggregate types!");
3628 Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg);
3629 PFTy = PointerType::get(Ty);
3632 Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling...
3634 // Create the call node...
3635 if (!yyvsp[-1].ValueList) { // Has no arguments?
3636 // Make sure no arguments is a good thing!
3637 if (Ty->getNumParams() != 0)
3638 ThrowException("No arguments passed to a function that "
3639 "expects arguments!");
3641 yyval.InstVal = new CallInst(V, std::vector<Value*>());
3642 } else { // Has arguments?
3643 // Loop through FunctionType's arguments and ensure they are specified
3646 FunctionType::param_iterator I = Ty->param_begin();
3647 FunctionType::param_iterator E = Ty->param_end();
3648 std::vector<Value*>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
3650 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3651 if ((*ArgI)->getType() != *I)
3652 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3653 (*I)->getDescription() + "'!");
3655 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3656 ThrowException("Invalid number of parameters detected!");
3658 yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList);
3660 cast<CallInst>(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal);
3661 cast<CallInst>(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal);
3662 delete yyvsp[-4].TypeVal;
3663 delete yyvsp[-1].ValueList;
3667 #line 2203 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3669 yyval.InstVal = yyvsp[0].InstVal;
3673 #line 2209 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3675 yyval.ValueList = yyvsp[0].ValueList;
3679 #line 2211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3681 yyval.ValueList = new std::vector<Value*>();
3685 #line 2215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3687 yyval.BoolVal = true;
3691 #line 2218 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3693 yyval.BoolVal = false;
3697 #line 2224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3699 if (yyvsp[0].UIntVal != 0 && !isPowerOf2_32(yyvsp[0].UIntVal))
3700 ThrowException("Alignment amount '" + utostr(yyvsp[0].UIntVal) +
3701 "' is not a power of 2!");
3702 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
3703 delete yyvsp[-1].TypeVal;
3707 #line 2231 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3709 if (yyvsp[0].UIntVal != 0 && !isPowerOf2_32(yyvsp[0].UIntVal))
3710 ThrowException("Alignment amount '" + utostr(yyvsp[0].UIntVal) +
3711 "' is not a power of 2!");
3712 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
3713 delete yyvsp[-4].TypeVal;
3717 #line 2238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3719 if (yyvsp[0].UIntVal != 0 && !isPowerOf2_32(yyvsp[0].UIntVal))
3720 ThrowException("Alignment amount '" + utostr(yyvsp[0].UIntVal) +
3721 "' is not a power of 2!");
3722 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
3723 delete yyvsp[-1].TypeVal;
3727 #line 2245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3729 if (yyvsp[0].UIntVal != 0 && !isPowerOf2_32(yyvsp[0].UIntVal))
3730 ThrowException("Alignment amount '" + utostr(yyvsp[0].UIntVal) +
3731 "' is not a power of 2!");
3732 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
3733 delete yyvsp[-4].TypeVal;
3737 #line 2252 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3739 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
3740 ThrowException("Trying to free nonpointer type " +
3741 yyvsp[0].ValueVal->getType()->getDescription() + "!");
3742 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
3746 #line 2259 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3748 if (!isa<PointerType>(yyvsp[-1].TypeVal->get()))
3749 ThrowException("Can't load from nonpointer type: " +
3750 (*yyvsp[-1].TypeVal)->getDescription());
3751 if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType())
3752 ThrowException("Can't load from pointer of non-first-class type: " +
3753 (*yyvsp[-1].TypeVal)->getDescription());
3754 yyval.InstVal = new LoadInst(getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), "", yyvsp[-3].BoolVal);
3755 delete yyvsp[-1].TypeVal;
3759 #line 2269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3761 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3763 ThrowException("Can't store to a nonpointer type: " +
3764 (*yyvsp[-1].TypeVal)->getDescription());
3765 const Type *ElTy = PT->getElementType();
3766 if (ElTy != yyvsp[-3].ValueVal->getType())
3767 ThrowException("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() +
3768 "' into space of type '" + ElTy->getDescription() + "'!");
3770 yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), yyvsp[-5].BoolVal);
3771 delete yyvsp[-1].TypeVal;
3775 #line 2282 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
3777 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
3778 ThrowException("getelementptr insn requires pointer operand!");
3780 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3781 // indices to uint struct indices for compatibility.
3782 generic_gep_type_iterator<std::vector<Value*>::iterator>
3783 GTI = gep_type_begin(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()),
3784 GTE = gep_type_end(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
3785 for (unsigned i = 0, e = yyvsp[0].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
3786 if (isa<StructType>(*GTI)) // Only change struct indices
3787 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[0].ValueList)[i]))
3788 if (CUI->getType() == Type::UByteTy)
3789 (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3791 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true))
3792 ThrowException("Invalid getelementptr indices for type '" +
3793 (*yyvsp[-2].TypeVal)->getDescription()+ "'!");
3794 yyval.InstVal = new GetElementPtrInst(getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ValueList);
3795 delete yyvsp[-2].TypeVal; delete yyvsp[0].ValueList;
3799 /* the action file gets copied in in place of this dollarsign */
3800 #line 543 "/usr/share/bison.simple"
3811 short *ssp1 = yyss - 1;
3812 fprintf (stderr, "state stack now");
3813 while (ssp1 != yyssp)
3814 fprintf (stderr, " %d", *++ssp1);
3815 fprintf (stderr, "\n");
3825 yylsp->first_line = yylloc.first_line;
3826 yylsp->first_column = yylloc.first_column;
3827 yylsp->last_line = (yylsp-1)->last_line;
3828 yylsp->last_column = (yylsp-1)->last_column;
3833 yylsp->last_line = (yylsp+yylen-1)->last_line;
3834 yylsp->last_column = (yylsp+yylen-1)->last_column;
3838 /* Now "shift" the result of the reduction.
3839 Determine what state that goes to,
3840 based on the state we popped back to
3841 and the rule number reduced by. */
3845 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
3846 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3847 yystate = yytable[yystate];
3849 yystate = yydefgoto[yyn - YYNTBASE];
3853 yyerrlab: /* here on detecting error */
3856 /* If not already recovering from an error, report this error. */
3860 #ifdef YYERROR_VERBOSE
3861 yyn = yypact[yystate];
3863 if (yyn > YYFLAG && yyn < YYLAST)
3870 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
3871 for (x = (yyn < 0 ? -yyn : 0);
3872 x < (sizeof(yytname) / sizeof(char *)); x++)
3873 if (yycheck[x + yyn] == x)
3874 size += strlen(yytname[x]) + 15, count++;
3875 msg = (char *) malloc(size + 15);
3878 strcpy(msg, "parse error");
3883 for (x = (yyn < 0 ? -yyn : 0);
3884 x < (sizeof(yytname) / sizeof(char *)); x++)
3885 if (yycheck[x + yyn] == x)
3887 strcat(msg, count == 0 ? ", expecting `" : " or `");
3888 strcat(msg, yytname[x]);
3897 yyerror ("parse error; also virtual memory exceeded");
3900 #endif /* YYERROR_VERBOSE */
3901 yyerror("parse error");
3905 yyerrlab1: /* here on error raised explicitly by an action */
3907 if (yyerrstatus == 3)
3909 /* if just tried and failed to reuse lookahead token after an error, discard it. */
3911 /* return failure if at end of input */
3912 if (yychar == YYEOF)
3917 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
3923 /* Else will try to reuse lookahead token
3924 after shifting the error token. */
3926 yyerrstatus = 3; /* Each real token shifted decrements this */
3930 yyerrdefault: /* current state does not do anything special for the error token. */
3933 /* This is wrong; only states that explicitly want error tokens
3934 should shift them. */
3935 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
3936 if (yyn) goto yydefault;
3939 yyerrpop: /* pop the current state because it cannot handle the error token */
3941 if (yyssp == yyss) YYABORT;
3951 short *ssp1 = yyss - 1;
3952 fprintf (stderr, "Error: state stack now");
3953 while (ssp1 != yyssp)
3954 fprintf (stderr, " %d", *++ssp1);
3955 fprintf (stderr, "\n");
3961 yyn = yypact[yystate];
3966 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
3985 fprintf(stderr, "Shifting error token, ");
3997 /* YYACCEPT comes here. */
4009 /* YYABORT comes here. */
4020 #line 2305 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
4022 int yyerror(const char *ErrorMsg) {
4024 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4025 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
4026 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
4027 if (yychar == YYEMPTY || yychar == 0)
4028 errMsg += "end-of-file.";
4030 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
4031 ThrowException(errMsg);