2 /* A Bison parser, made from /Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
35 #define STRINGCONSTANT 278
36 #define IMPLEMENTATION 279
37 #define ZEROINITIALIZER 280
62 #define POINTERSIZE 305
71 #define FASTCC_TOK 314
72 #define COLDCC_TOK 315
78 #define UNREACHABLE 321
98 #define GETELEMENTPTR 341
105 #define EXTRACTELEMENT 348
106 #define INSERTELEMENT 349
107 #define VAARG_old 350
108 #define VANEXT_old 351
110 #line 14 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
112 #include "ParserInternals.h"
113 #include "llvm/CallingConv.h"
114 #include "llvm/Instructions.h"
115 #include "llvm/Module.h"
116 #include "llvm/SymbolTable.h"
117 #include "llvm/Assembly/AutoUpgrade.h"
118 #include "llvm/Support/GetElementPtrTypeIterator.h"
119 #include "llvm/ADT/STLExtras.h"
120 #include "llvm/Support/MathExtras.h"
126 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
127 int yylex(); // declaration" of xxx warnings.
131 std::string CurFilename;
133 using namespace llvm;
135 static Module *ParserResult;
137 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
138 // relating to upreferences in the input stream.
140 //#define DEBUG_UPREFS 1
142 #define UR_OUT(X) std::cerr << X
147 #define YYERROR_VERBOSE 1
149 static bool ObsoleteVarArgs;
150 static bool NewVarArgs;
151 static BasicBlock *CurBB;
152 static GlobalVariable *CurGV;
155 // This contains info used when building the body of a function. It is
156 // destroyed when the function is completed.
158 typedef std::vector<Value *> ValueList; // Numbered defs
160 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
161 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
163 static struct PerModuleInfo {
164 Module *CurrentModule;
165 std::map<const Type *, ValueList> Values; // Module level numbered definitions
166 std::map<const Type *,ValueList> LateResolveValues;
167 std::vector<PATypeHolder> Types;
168 std::map<ValID, PATypeHolder> LateResolveTypes;
170 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
171 /// how they were referenced and one which line of the input they came from so
172 /// that we can resolve them later and print error messages as appropriate.
173 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
175 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
176 // references to global values. Global values may be referenced before they
177 // are defined, and if so, the temporary object that they represent is held
178 // here. This is used for forward references of GlobalValues.
180 typedef std::map<std::pair<const PointerType *,
181 ValID>, GlobalValue*> GlobalRefsType;
182 GlobalRefsType GlobalRefs;
185 // If we could not resolve some functions at function compilation time
186 // (calls to functions before they are defined), resolve them now... Types
187 // are resolved when the constant pool has been completely parsed.
189 ResolveDefinitions(LateResolveValues);
191 // Check to make sure that all global value forward references have been
194 if (!GlobalRefs.empty()) {
195 std::string UndefinedReferences = "Unresolved global references exist:\n";
197 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
199 UndefinedReferences += " " + I->first.first->getDescription() + " " +
200 I->first.second.getName() + "\n";
202 ThrowException(UndefinedReferences);
205 // Rename any overloaded intrinsic functions.
206 for (Module::iterator FI = CurrentModule->begin(), FE =
207 CurrentModule->end(); FI != FE; ++FI)
208 UpgradeIntrinsicFunction(&(*FI));
210 Values.clear(); // Clear out function local definitions
215 // GetForwardRefForGlobal - Check to see if there is a forward reference
216 // for this global. If so, remove it from the GlobalRefs map and return it.
217 // If not, just return null.
218 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
219 // Check to see if there is a forward reference to this global variable...
220 // if there is, eliminate it and patch the reference to use the new def'n.
221 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
222 GlobalValue *Ret = 0;
223 if (I != GlobalRefs.end()) {
231 static struct PerFunctionInfo {
232 Function *CurrentFunction; // Pointer to current function being created
234 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
235 std::map<const Type*, ValueList> LateResolveValues;
236 bool isDeclare; // Is this function a forward declararation?
238 /// BBForwardRefs - When we see forward references to basic blocks, keep
239 /// track of them here.
240 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
241 std::vector<BasicBlock*> NumberedBlocks;
244 inline PerFunctionInfo() {
249 inline void FunctionStart(Function *M) {
254 void FunctionDone() {
255 NumberedBlocks.clear();
257 // Any forward referenced blocks left?
258 if (!BBForwardRefs.empty())
259 ThrowException("Undefined reference to label " +
260 BBForwardRefs.begin()->first->getName());
262 // Resolve all forward references now.
263 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
265 Values.clear(); // Clear out function local definitions
269 } CurFun; // Info for the current function...
271 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
274 //===----------------------------------------------------------------------===//
275 // Code to handle definitions of all the types
276 //===----------------------------------------------------------------------===//
278 static int InsertValue(Value *V,
279 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
280 if (V->hasName()) return -1; // Is this a numbered definition?
282 // Yes, insert the value into the value table...
283 ValueList &List = ValueTab[V->getType()];
285 return List.size()-1;
288 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
290 case ValID::NumberVal: // Is it a numbered definition?
291 // Module constants occupy the lowest numbered slots...
292 if ((unsigned)D.Num < CurModule.Types.size())
293 return CurModule.Types[(unsigned)D.Num];
295 case ValID::NameVal: // Is it a named definition?
296 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
297 D.destroy(); // Free old strdup'd memory...
302 ThrowException("Internal parser error: Invalid symbol type reference!");
305 // If we reached here, we referenced either a symbol that we don't know about
306 // or an id number that hasn't been read yet. We may be referencing something
307 // forward, so just create an entry to be resolved later and get to it...
309 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
312 if (inFunctionScope()) {
313 if (D.Type == ValID::NameVal)
314 ThrowException("Reference to an undefined type: '" + D.getName() + "'");
316 ThrowException("Reference to an undefined type: #" + itostr(D.Num));
319 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
320 if (I != CurModule.LateResolveTypes.end())
323 Type *Typ = OpaqueType::get();
324 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
328 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
329 SymbolTable &SymTab =
330 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
331 CurModule.CurrentModule->getSymbolTable();
332 return SymTab.lookup(Ty, Name);
335 // getValNonImprovising - Look up the value specified by the provided type and
336 // the provided ValID. If the value exists and has already been defined, return
337 // it. Otherwise return null.
339 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
340 if (isa<FunctionType>(Ty))
341 ThrowException("Functions are not values and "
342 "must be referenced as pointers");
345 case ValID::NumberVal: { // Is it a numbered definition?
346 unsigned Num = (unsigned)D.Num;
348 // Module constants occupy the lowest numbered slots...
349 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
350 if (VI != CurModule.Values.end()) {
351 if (Num < VI->second.size())
352 return VI->second[Num];
353 Num -= VI->second.size();
356 // Make sure that our type is within bounds
357 VI = CurFun.Values.find(Ty);
358 if (VI == CurFun.Values.end()) return 0;
360 // Check that the number is within bounds...
361 if (VI->second.size() <= Num) return 0;
363 return VI->second[Num];
366 case ValID::NameVal: { // Is it a named definition?
367 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
368 if (N == 0) return 0;
370 D.destroy(); // Free old strdup'd memory...
374 // Check to make sure that "Ty" is an integral type, and that our
375 // value will fit into the specified type...
376 case ValID::ConstSIntVal: // Is it a constant pool reference??
377 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64))
378 ThrowException("Signed integral constant '" +
379 itostr(D.ConstPool64) + "' is invalid for type '" +
380 Ty->getDescription() + "'!");
381 return ConstantSInt::get(Ty, D.ConstPool64);
383 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
384 if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
385 if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
386 ThrowException("Integral constant '" + utostr(D.UConstPool64) +
387 "' is invalid or out of range!");
388 } else { // This is really a signed reference. Transmogrify.
389 return ConstantSInt::get(Ty, D.ConstPool64);
392 return ConstantUInt::get(Ty, D.UConstPool64);
395 case ValID::ConstFPVal: // Is it a floating point const pool reference?
396 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
397 ThrowException("FP constant invalid for type!!");
398 return ConstantFP::get(Ty, D.ConstPoolFP);
400 case ValID::ConstNullVal: // Is it a null value?
401 if (!isa<PointerType>(Ty))
402 ThrowException("Cannot create a a non pointer null!");
403 return ConstantPointerNull::get(cast<PointerType>(Ty));
405 case ValID::ConstUndefVal: // Is it an undef value?
406 return UndefValue::get(Ty);
408 case ValID::ConstZeroVal: // Is it a zero value?
409 return Constant::getNullValue(Ty);
411 case ValID::ConstantVal: // Fully resolved constant?
412 if (D.ConstantValue->getType() != Ty)
413 ThrowException("Constant expression type different from required type!");
414 return D.ConstantValue;
417 assert(0 && "Unhandled case!");
421 assert(0 && "Unhandled case!");
425 // getVal - This function is identical to getValNonImprovising, except that if a
426 // value is not already defined, it "improvises" by creating a placeholder var
427 // that looks and acts just like the requested variable. When the value is
428 // defined later, all uses of the placeholder variable are replaced with the
431 static Value *getVal(const Type *Ty, const ValID &ID) {
432 if (Ty == Type::LabelTy)
433 ThrowException("Cannot use a basic block here");
435 // See if the value has already been defined.
436 Value *V = getValNonImprovising(Ty, ID);
439 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty))
440 ThrowException("Invalid use of a composite type!");
442 // If we reached here, we referenced either a symbol that we don't know about
443 // or an id number that hasn't been read yet. We may be referencing something
444 // forward, so just create an entry to be resolved later and get to it...
446 V = new Argument(Ty);
448 // Remember where this forward reference came from. FIXME, shouldn't we try
449 // to recycle these things??
450 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
453 if (inFunctionScope())
454 InsertValue(V, CurFun.LateResolveValues);
456 InsertValue(V, CurModule.LateResolveValues);
460 /// getBBVal - This is used for two purposes:
461 /// * If isDefinition is true, a new basic block with the specified ID is being
463 /// * If isDefinition is true, this is a reference to a basic block, which may
464 /// or may not be a forward reference.
466 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
467 assert(inFunctionScope() && "Can't get basic block at global scope!");
472 default: ThrowException("Illegal label reference " + ID.getName());
473 case ValID::NumberVal: // Is it a numbered definition?
474 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
475 CurFun.NumberedBlocks.resize(ID.Num+1);
476 BB = CurFun.NumberedBlocks[ID.Num];
478 case ValID::NameVal: // Is it a named definition?
480 if (Value *N = CurFun.CurrentFunction->
481 getSymbolTable().lookup(Type::LabelTy, Name))
482 BB = cast<BasicBlock>(N);
486 // See if the block has already been defined.
488 // If this is the definition of the block, make sure the existing value was
489 // just a forward reference. If it was a forward reference, there will be
490 // an entry for it in the PlaceHolderInfo map.
491 if (isDefinition && !CurFun.BBForwardRefs.erase(BB))
492 // The existing value was a definition, not a forward reference.
493 ThrowException("Redefinition of label " + ID.getName());
495 ID.destroy(); // Free strdup'd memory.
499 // Otherwise this block has not been seen before.
500 BB = new BasicBlock("", CurFun.CurrentFunction);
501 if (ID.Type == ValID::NameVal) {
502 BB->setName(ID.Name);
504 CurFun.NumberedBlocks[ID.Num] = BB;
507 // If this is not a definition, keep track of it so we can use it as a forward
510 // Remember where this forward reference came from.
511 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
513 // The forward declaration could have been inserted anywhere in the
514 // function: insert it into the correct place now.
515 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
516 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
523 //===----------------------------------------------------------------------===//
524 // Code to handle forward references in instructions
525 //===----------------------------------------------------------------------===//
527 // This code handles the late binding needed with statements that reference
528 // values not defined yet... for example, a forward branch, or the PHI node for
531 // This keeps a table (CurFun.LateResolveValues) of all such forward references
532 // and back patchs after we are done.
535 // ResolveDefinitions - If we could not resolve some defs at parsing
536 // time (forward branches, phi functions for loops, etc...) resolve the
540 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
541 std::map<const Type*,ValueList> *FutureLateResolvers) {
542 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
543 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
544 E = LateResolvers.end(); LRI != E; ++LRI) {
545 ValueList &List = LRI->second;
546 while (!List.empty()) {
547 Value *V = List.back();
550 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
551 CurModule.PlaceHolderInfo.find(V);
552 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
554 ValID &DID = PHI->second.first;
556 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
558 V->replaceAllUsesWith(TheRealValue);
560 CurModule.PlaceHolderInfo.erase(PHI);
561 } else if (FutureLateResolvers) {
562 // Functions have their unresolved items forwarded to the module late
564 InsertValue(V, *FutureLateResolvers);
566 if (DID.Type == ValID::NameVal)
567 ThrowException("Reference to an invalid definition: '" +DID.getName()+
568 "' of type '" + V->getType()->getDescription() + "'",
571 ThrowException("Reference to an invalid definition: #" +
572 itostr(DID.Num) + " of type '" +
573 V->getType()->getDescription() + "'",
579 LateResolvers.clear();
582 // ResolveTypeTo - A brand new type was just declared. This means that (if
583 // name is not null) things referencing Name can be resolved. Otherwise, things
584 // refering to the number can be resolved. Do this now.
586 static void ResolveTypeTo(char *Name, const Type *ToTy) {
588 if (Name) D = ValID::create(Name);
589 else D = ValID::create((int)CurModule.Types.size());
591 std::map<ValID, PATypeHolder>::iterator I =
592 CurModule.LateResolveTypes.find(D);
593 if (I != CurModule.LateResolveTypes.end()) {
594 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
595 CurModule.LateResolveTypes.erase(I);
599 // setValueName - Set the specified value to the name given. The name may be
600 // null potentially, in which case this is a noop. The string passed in is
601 // assumed to be a malloc'd string buffer, and is free'd by this function.
603 static void setValueName(Value *V, char *NameStr) {
605 std::string Name(NameStr); // Copy string
606 free(NameStr); // Free old string
608 if (V->getType() == Type::VoidTy)
609 ThrowException("Can't assign name '" + Name+"' to value with void type!");
611 assert(inFunctionScope() && "Must be in function scope!");
612 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
613 if (ST.lookup(V->getType(), Name))
614 ThrowException("Redefinition of value named '" + Name + "' in the '" +
615 V->getType()->getDescription() + "' type plane!");
622 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
623 /// this is a declaration, otherwise it is a definition.
624 static GlobalVariable *
625 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
626 bool isConstantGlobal, const Type *Ty,
627 Constant *Initializer) {
628 if (isa<FunctionType>(Ty))
629 ThrowException("Cannot declare global vars of function type!");
631 const PointerType *PTy = PointerType::get(Ty);
635 Name = NameStr; // Copy string
636 free(NameStr); // Free old string
639 // See if this global value was forward referenced. If so, recycle the
643 ID = ValID::create((char*)Name.c_str());
645 ID = ValID::create((int)CurModule.Values[PTy].size());
648 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
649 // Move the global to the end of the list, from whereever it was
650 // previously inserted.
651 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
652 CurModule.CurrentModule->getGlobalList().remove(GV);
653 CurModule.CurrentModule->getGlobalList().push_back(GV);
654 GV->setInitializer(Initializer);
655 GV->setLinkage(Linkage);
656 GV->setConstant(isConstantGlobal);
657 InsertValue(GV, CurModule.Values);
661 // If this global has a name, check to see if there is already a definition
662 // of this global in the module. If so, merge as appropriate. Note that
663 // this is really just a hack around problems in the CFE. :(
665 // We are a simple redefinition of a value, check to see if it is defined
666 // the same as the old one.
667 if (GlobalVariable *EGV =
668 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
669 // We are allowed to redefine a global variable in two circumstances:
670 // 1. If at least one of the globals is uninitialized or
671 // 2. If both initializers have the same value.
673 if (!EGV->hasInitializer() || !Initializer ||
674 EGV->getInitializer() == Initializer) {
676 // Make sure the existing global version gets the initializer! Make
677 // sure that it also gets marked const if the new version is.
678 if (Initializer && !EGV->hasInitializer())
679 EGV->setInitializer(Initializer);
680 if (isConstantGlobal)
681 EGV->setConstant(true);
682 EGV->setLinkage(Linkage);
686 ThrowException("Redefinition of global variable named '" + Name +
687 "' in the '" + Ty->getDescription() + "' type plane!");
691 // Otherwise there is no existing GV to use, create one now.
693 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
694 CurModule.CurrentModule);
695 InsertValue(GV, CurModule.Values);
699 // setTypeName - Set the specified type to the name given. The name may be
700 // null potentially, in which case this is a noop. The string passed in is
701 // assumed to be a malloc'd string buffer, and is freed by this function.
703 // This function returns true if the type has already been defined, but is
704 // allowed to be redefined in the specified context. If the name is a new name
705 // for the type plane, it is inserted and false is returned.
706 static bool setTypeName(const Type *T, char *NameStr) {
707 assert(!inFunctionScope() && "Can't give types function-local names!");
708 if (NameStr == 0) return false;
710 std::string Name(NameStr); // Copy string
711 free(NameStr); // Free old string
713 // We don't allow assigning names to void type
714 if (T == Type::VoidTy)
715 ThrowException("Can't assign name '" + Name + "' to the void type!");
717 // Set the type name, checking for conflicts as we do so.
718 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
720 if (AlreadyExists) { // Inserting a name that is already defined???
721 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
722 assert(Existing && "Conflict but no matching type?");
724 // There is only one case where this is allowed: when we are refining an
725 // opaque type. In this case, Existing will be an opaque type.
726 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
727 // We ARE replacing an opaque type!
728 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
732 // Otherwise, this is an attempt to redefine a type. That's okay if
733 // the redefinition is identical to the original. This will be so if
734 // Existing and T point to the same Type object. In this one case we
735 // allow the equivalent redefinition.
736 if (Existing == T) return true; // Yes, it's equal.
738 // Any other kind of (non-equivalent) redefinition is an error.
739 ThrowException("Redefinition of type named '" + Name + "' in the '" +
740 T->getDescription() + "' type plane!");
746 //===----------------------------------------------------------------------===//
747 // Code for handling upreferences in type names...
750 // TypeContains - Returns true if Ty directly contains E in it.
752 static bool TypeContains(const Type *Ty, const Type *E) {
753 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
754 E) != Ty->subtype_end();
759 // NestingLevel - The number of nesting levels that need to be popped before
760 // this type is resolved.
761 unsigned NestingLevel;
763 // LastContainedTy - This is the type at the current binding level for the
764 // type. Every time we reduce the nesting level, this gets updated.
765 const Type *LastContainedTy;
767 // UpRefTy - This is the actual opaque type that the upreference is
771 UpRefRecord(unsigned NL, OpaqueType *URTy)
772 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
776 // UpRefs - A list of the outstanding upreferences that need to be resolved.
777 static std::vector<UpRefRecord> UpRefs;
779 /// HandleUpRefs - Every time we finish a new layer of types, this function is
780 /// called. It loops through the UpRefs vector, which is a list of the
781 /// currently active types. For each type, if the up reference is contained in
782 /// the newly completed type, we decrement the level count. When the level
783 /// count reaches zero, the upreferenced type is the type that is passed in:
784 /// thus we can complete the cycle.
786 static PATypeHolder HandleUpRefs(const Type *ty) {
787 if (!ty->isAbstract()) return ty;
789 UR_OUT("Type '" << Ty->getDescription() <<
790 "' newly formed. Resolving upreferences.\n" <<
791 UpRefs.size() << " upreferences active!\n");
793 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
794 // to zero), we resolve them all together before we resolve them to Ty. At
795 // the end of the loop, if there is anything to resolve to Ty, it will be in
797 OpaqueType *TypeToResolve = 0;
799 for (unsigned i = 0; i != UpRefs.size(); ++i) {
800 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
801 << UpRefs[i].second->getDescription() << ") = "
802 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
803 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
804 // Decrement level of upreference
805 unsigned Level = --UpRefs[i].NestingLevel;
806 UpRefs[i].LastContainedTy = Ty;
807 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
808 if (Level == 0) { // Upreference should be resolved!
809 if (!TypeToResolve) {
810 TypeToResolve = UpRefs[i].UpRefTy;
812 UR_OUT(" * Resolving upreference for "
813 << UpRefs[i].second->getDescription() << "\n";
814 std::string OldName = UpRefs[i].UpRefTy->getDescription());
815 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
816 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
817 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
819 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
820 --i; // Do not skip the next element...
826 UR_OUT(" * Resolving upreference for "
827 << UpRefs[i].second->getDescription() << "\n";
828 std::string OldName = TypeToResolve->getDescription());
829 TypeToResolve->refineAbstractTypeTo(Ty);
836 // common code from the two 'RunVMAsmParser' functions
837 static Module * RunParser(Module * M) {
839 llvmAsmlineno = 1; // Reset the current line number...
840 ObsoleteVarArgs = false;
843 CurModule.CurrentModule = M;
844 yyparse(); // Parse the file, potentially throwing exception
846 Module *Result = ParserResult;
849 //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
852 if ((F = Result->getNamedFunction("llvm.va_start"))
853 && F->getFunctionType()->getNumParams() == 0)
854 ObsoleteVarArgs = true;
855 if((F = Result->getNamedFunction("llvm.va_copy"))
856 && F->getFunctionType()->getNumParams() == 1)
857 ObsoleteVarArgs = true;
860 if (ObsoleteVarArgs && NewVarArgs)
861 ThrowException("This file is corrupt: it uses both new and old style varargs");
863 if(ObsoleteVarArgs) {
864 if(Function* F = Result->getNamedFunction("llvm.va_start")) {
865 if (F->arg_size() != 0)
866 ThrowException("Obsolete va_start takes 0 argument!");
870 //bar = alloca typeof(foo)
874 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
875 const Type* ArgTy = F->getFunctionType()->getReturnType();
876 const Type* ArgTyPtr = PointerType::get(ArgTy);
877 Function* NF = Result->getOrInsertFunction("llvm.va_start",
878 RetTy, ArgTyPtr, (Type *)0);
880 while (!F->use_empty()) {
881 CallInst* CI = cast<CallInst>(F->use_back());
882 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
883 new CallInst(NF, bar, "", CI);
884 Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
885 CI->replaceAllUsesWith(foo);
886 CI->getParent()->getInstList().erase(CI);
888 Result->getFunctionList().erase(F);
891 if(Function* F = Result->getNamedFunction("llvm.va_end")) {
892 if(F->arg_size() != 1)
893 ThrowException("Obsolete va_end takes 1 argument!");
897 //bar = alloca 1 of typeof(foo)
899 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
900 const Type* ArgTy = F->getFunctionType()->getParamType(0);
901 const Type* ArgTyPtr = PointerType::get(ArgTy);
902 Function* NF = Result->getOrInsertFunction("llvm.va_end",
903 RetTy, ArgTyPtr, (Type *)0);
905 while (!F->use_empty()) {
906 CallInst* CI = cast<CallInst>(F->use_back());
907 AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
908 new StoreInst(CI->getOperand(1), bar, CI);
909 new CallInst(NF, bar, "", CI);
910 CI->getParent()->getInstList().erase(CI);
912 Result->getFunctionList().erase(F);
915 if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
916 if(F->arg_size() != 1)
917 ThrowException("Obsolete va_copy takes 1 argument!");
920 //a = alloca 1 of typeof(foo)
921 //b = alloca 1 of typeof(foo)
926 const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
927 const Type* ArgTy = F->getFunctionType()->getReturnType();
928 const Type* ArgTyPtr = PointerType::get(ArgTy);
929 Function* NF = Result->getOrInsertFunction("llvm.va_copy",
930 RetTy, ArgTyPtr, ArgTyPtr,
933 while (!F->use_empty()) {
934 CallInst* CI = cast<CallInst>(F->use_back());
935 AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
936 AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
937 new StoreInst(CI->getOperand(1), b, CI);
938 new CallInst(NF, a, b, "", CI);
939 Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
940 CI->replaceAllUsesWith(foo);
941 CI->getParent()->getInstList().erase(CI);
943 Result->getFunctionList().erase(F);
951 //===----------------------------------------------------------------------===//
952 // RunVMAsmParser - Define an interface to this parser
953 //===----------------------------------------------------------------------===//
955 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
958 CurFilename = Filename;
959 return RunParser(new Module(CurFilename));
962 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
963 set_scan_string(AsmString);
965 CurFilename = "from_memory";
967 return RunParser(new Module (CurFilename));
974 #line 878 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
976 llvm::Module *ModuleVal;
977 llvm::Function *FunctionVal;
978 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
979 llvm::BasicBlock *BasicBlockVal;
980 llvm::TerminatorInst *TermInstVal;
981 llvm::Instruction *InstVal;
982 llvm::Constant *ConstVal;
984 const llvm::Type *PrimType;
985 llvm::PATypeHolder *TypeVal;
986 llvm::Value *ValueVal;
988 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
989 std::vector<llvm::Value*> *ValueList;
990 std::list<llvm::PATypeHolder> *TypeList;
991 // Represent the RHS of PHI node
992 std::list<std::pair<llvm::Value*,
993 llvm::BasicBlock*> > *PHIList;
994 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
995 std::vector<llvm::Constant*> *ConstVector;
997 llvm::GlobalValue::LinkageTypes Linkage;
1005 char *StrVal; // This memory is strdup'd!
1006 llvm::ValID ValIDVal; // strdup'd memory maybe!
1008 llvm::Instruction::BinaryOps BinaryOpVal;
1009 llvm::Instruction::TermOps TermOpVal;
1010 llvm::Instruction::MemoryOps MemOpVal;
1011 llvm::Instruction::OtherOps OtherOpVal;
1012 llvm::Module::Endianness Endianness;
1025 #define YYFLAG -32768
1026 #define YYNTBASE 112
1028 #define YYTRANSLATE(x) ((unsigned)(x) <= 351 ? yytranslate[x] : 181)
1030 static const char yytranslate[] = { 0,
1031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1032 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1033 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1034 2, 2, 2, 2, 2, 2, 2, 2, 2, 101,
1035 102, 110, 2, 99, 2, 2, 2, 2, 2, 2,
1036 2, 2, 2, 2, 2, 2, 2, 2, 2, 106,
1037 98, 107, 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 103, 100, 105, 2, 2, 2, 2, 2, 111, 2,
1041 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1042 2, 2, 2, 2, 2, 2, 2, 2, 2, 104,
1043 2, 2, 108, 2, 109, 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, 2, 2, 2, 2, 2,
1049 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1050 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1051 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1052 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1053 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1054 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1055 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1056 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1057 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1058 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1059 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1060 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1061 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1062 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1063 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1064 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1065 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1070 static const short yyprhs[] = { 0,
1071 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1072 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1073 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1074 60, 62, 64, 67, 68, 70, 72, 74, 76, 77,
1075 78, 80, 82, 84, 87, 88, 91, 92, 96, 99,
1076 100, 102, 103, 107, 109, 112, 114, 116, 118, 120,
1077 122, 124, 126, 128, 130, 132, 134, 136, 138, 140,
1078 142, 144, 146, 148, 150, 152, 154, 157, 162, 168,
1079 174, 178, 181, 184, 186, 190, 192, 196, 198, 199,
1080 204, 208, 212, 217, 222, 226, 229, 232, 235, 238,
1081 241, 244, 247, 250, 253, 256, 263, 269, 278, 285,
1082 292, 299, 306, 313, 317, 319, 321, 323, 325, 328,
1083 331, 334, 336, 341, 344, 345, 353, 354, 362, 366,
1084 371, 372, 374, 376, 380, 384, 388, 392, 396, 398,
1085 399, 401, 403, 405, 406, 409, 413, 415, 417, 421,
1086 423, 424, 433, 435, 437, 441, 443, 445, 448, 449,
1087 453, 455, 457, 459, 461, 463, 465, 467, 469, 473,
1088 475, 477, 479, 481, 483, 486, 489, 492, 496, 499,
1089 500, 502, 505, 508, 512, 522, 532, 541, 555, 557,
1090 559, 566, 572, 575, 582, 590, 592, 596, 598, 599,
1091 602, 604, 610, 616, 622, 625, 630, 635, 642, 647,
1092 652, 657, 662, 669, 672, 680, 682, 685, 686, 688,
1093 689, 693, 700, 704, 711, 714, 719, 726
1096 static const short yyrhs[] = { 5,
1097 0, 6, 0, 3, 0, 4, 0, 68, 0, 69,
1098 0, 70, 0, 71, 0, 72, 0, 73, 0, 74,
1099 0, 75, 0, 76, 0, 77, 0, 78, 0, 79,
1100 0, 80, 0, 81, 0, 91, 0, 92, 0, 16,
1101 0, 14, 0, 12, 0, 10, 0, 17, 0, 15,
1102 0, 13, 0, 11, 0, 118, 0, 119, 0, 18,
1103 0, 19, 0, 151, 98, 0, 0, 41, 0, 42,
1104 0, 43, 0, 44, 0, 0, 0, 59, 0, 60,
1105 0, 61, 0, 58, 4, 0, 0, 54, 4, 0,
1106 0, 99, 54, 4, 0, 34, 24, 0, 0, 127,
1107 0, 0, 99, 130, 129, 0, 127, 0, 54, 4,
1108 0, 133, 0, 8, 0, 135, 0, 8, 0, 135,
1109 0, 9, 0, 10, 0, 11, 0, 12, 0, 13,
1110 0, 14, 0, 15, 0, 16, 0, 17, 0, 18,
1111 0, 19, 0, 20, 0, 21, 0, 45, 0, 134,
1112 0, 164, 0, 100, 4, 0, 132, 101, 137, 102,
1113 0, 103, 4, 104, 135, 105, 0, 106, 4, 104,
1114 135, 107, 0, 108, 136, 109, 0, 108, 109, 0,
1115 135, 110, 0, 135, 0, 136, 99, 135, 0, 136,
1116 0, 136, 99, 37, 0, 37, 0, 0, 133, 103,
1117 140, 105, 0, 133, 103, 105, 0, 133, 111, 24,
1118 0, 133, 106, 140, 107, 0, 133, 108, 140, 109,
1119 0, 133, 108, 109, 0, 133, 38, 0, 133, 39,
1120 0, 133, 164, 0, 133, 139, 0, 133, 26, 0,
1121 118, 113, 0, 119, 4, 0, 9, 27, 0, 9,
1122 28, 0, 121, 7, 0, 89, 101, 138, 36, 133,
1123 102, 0, 87, 101, 138, 178, 102, 0, 90, 101,
1124 138, 99, 138, 99, 138, 102, 0, 114, 101, 138,
1125 99, 138, 102, 0, 115, 101, 138, 99, 138, 102,
1126 0, 116, 101, 138, 99, 138, 102, 0, 117, 101,
1127 138, 99, 138, 102, 0, 94, 101, 138, 99, 138,
1128 102, 0, 140, 99, 138, 0, 138, 0, 32, 0,
1129 33, 0, 143, 0, 143, 160, 0, 143, 161, 0,
1130 143, 25, 0, 144, 0, 144, 122, 20, 131, 0,
1131 144, 161, 0, 0, 144, 122, 123, 141, 138, 145,
1132 129, 0, 0, 144, 122, 47, 141, 133, 146, 129,
1133 0, 144, 48, 148, 0, 144, 55, 98, 149, 0,
1134 0, 53, 0, 52, 0, 50, 98, 147, 0, 51,
1135 98, 4, 0, 49, 98, 24, 0, 103, 150, 105,
1136 0, 150, 99, 24, 0, 24, 0, 0, 22, 0,
1137 24, 0, 151, 0, 0, 133, 152, 0, 154, 99,
1138 153, 0, 153, 0, 154, 0, 154, 99, 37, 0,
1139 37, 0, 0, 124, 131, 151, 101, 155, 102, 128,
1140 125, 0, 29, 0, 108, 0, 123, 156, 157, 0,
1141 30, 0, 109, 0, 167, 159, 0, 0, 31, 162,
1142 156, 0, 3, 0, 4, 0, 7, 0, 27, 0,
1143 28, 0, 38, 0, 39, 0, 26, 0, 106, 140,
1144 107, 0, 139, 0, 112, 0, 151, 0, 164, 0,
1145 163, 0, 133, 165, 0, 167, 168, 0, 158, 168,
1146 0, 169, 122, 170, 0, 169, 172, 0, 0, 23,
1147 0, 62, 166, 0, 62, 8, 0, 63, 21, 165,
1148 0, 63, 9, 165, 99, 21, 165, 99, 21, 165,
1149 0, 64, 120, 165, 99, 21, 165, 103, 171, 105,
1150 0, 64, 120, 165, 99, 21, 165, 103, 105, 0,
1151 65, 124, 131, 165, 101, 175, 102, 36, 21, 165,
1152 66, 21, 165, 0, 66, 0, 67, 0, 171, 120,
1153 163, 99, 21, 165, 0, 120, 163, 99, 21, 165,
1154 0, 122, 177, 0, 133, 103, 165, 99, 165, 105,
1155 0, 173, 99, 103, 165, 99, 165, 105, 0, 166,
1156 0, 174, 99, 166, 0, 174, 0, 0, 57, 56,
1157 0, 56, 0, 114, 133, 165, 99, 165, 0, 115,
1158 133, 165, 99, 165, 0, 116, 133, 165, 99, 165,
1159 0, 46, 166, 0, 117, 166, 99, 166, 0, 89,
1160 166, 36, 133, 0, 90, 166, 99, 166, 99, 166,
1161 0, 93, 166, 99, 133, 0, 96, 166, 99, 133,
1162 0, 97, 166, 99, 133, 0, 94, 166, 99, 166,
1163 0, 95, 166, 99, 166, 99, 166, 0, 88, 173,
1164 0, 176, 124, 131, 165, 101, 175, 102, 0, 180,
1165 0, 99, 174, 0, 0, 35, 0, 0, 82, 133,
1166 126, 0, 82, 133, 99, 15, 165, 126, 0, 83,
1167 133, 126, 0, 83, 133, 99, 15, 165, 126, 0,
1168 84, 166, 0, 179, 85, 133, 165, 0, 179, 86,
1169 166, 99, 133, 165, 0, 87, 133, 165, 178, 0
1175 static const short yyrline[] = { 0,
1176 997, 998, 1005, 1006, 1015, 1015, 1015, 1015, 1015, 1016,
1177 1016, 1016, 1017, 1017, 1017, 1017, 1017, 1017, 1019, 1019,
1178 1023, 1023, 1023, 1023, 1024, 1024, 1024, 1024, 1025, 1025,
1179 1026, 1026, 1029, 1032, 1036, 1036, 1037, 1038, 1039, 1042,
1180 1042, 1043, 1044, 1045, 1054, 1054, 1060, 1060, 1068, 1075,
1181 1075, 1081, 1081, 1083, 1087, 1100, 1100, 1101, 1101, 1103,
1182 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1183 1113, 1113, 1113, 1114, 1117, 1120, 1126, 1133, 1145, 1149,
1184 1160, 1169, 1172, 1180, 1184, 1189, 1190, 1193, 1196, 1206,
1185 1231, 1244, 1272, 1297, 1317, 1329, 1338, 1342, 1401, 1407,
1186 1415, 1420, 1425, 1428, 1431, 1438, 1448, 1479, 1486, 1507,
1187 1517, 1522, 1529, 1539, 1542, 1549, 1549, 1559, 1566, 1570,
1188 1573, 1576, 1589, 1609, 1611, 1614, 1617, 1621, 1624, 1626,
1189 1628, 1633, 1634, 1636, 1639, 1647, 1652, 1654, 1658, 1662,
1190 1670, 1670, 1671, 1671, 1673, 1679, 1684, 1690, 1693, 1698,
1191 1702, 1706, 1792, 1792, 1794, 1802, 1802, 1804, 1808, 1808,
1192 1817, 1820, 1823, 1826, 1829, 1832, 1835, 1838, 1841, 1865,
1193 1872, 1875, 1880, 1880, 1886, 1890, 1893, 1901, 1910, 1914,
1194 1924, 1935, 1938, 1941, 1944, 1947, 1961, 1965, 2018, 2021,
1195 2027, 2035, 2045, 2052, 2057, 2064, 2068, 2074, 2074, 2076,
1196 2079, 2085, 2097, 2108, 2118, 2130, 2137, 2144, 2151, 2156,
1197 2175, 2197, 2205, 2217, 2231, 2288, 2294, 2296, 2300, 2303,
1198 2309, 2313, 2317, 2321, 2325, 2332, 2342, 2355
1203 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1205 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1206 "EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT",
1207 "USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID",
1208 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK",
1209 "BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO",
1210 "DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING",
1211 "OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE","ENDIAN","POINTERSIZE","LITTLE",
1212 "BIG","ALIGN","DEPLIBS","CALL","TAIL","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1213 "RET","BR","SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","DIV",
1214 "REM","AND","OR","XOR","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC",
1215 "ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","PHI_TOK","CAST","SELECT","SHL",
1216 "SHR","VAARG","EXTRACTELEMENT","INSERTELEMENT","VAARG_old","VANEXT_old","'='",
1217 "','","'\\\\'","'('","')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'*'","'c'",
1218 "INTVAL","EINT64VAL","ArithmeticOps","LogicalOps","SetCondOps","ShiftOps","SIntType",
1219 "UIntType","IntType","FPType","OptAssign","OptLinkage","OptCallingConv","OptAlign",
1220 "OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1221 "TypesV","UpRTypesV","Types","PrimType","UpRTypes","TypeListI","ArgTypeListI",
1222 "ConstVal","ConstExpr","ConstVector","GlobalType","Module","FunctionList","ConstPool",
1223 "@1","@2","BigOrLittle","TargetDefinition","LibrariesDefinition","LibList","Name",
1224 "OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader",
1225 "END","Function","FunctionProto","@3","ConstValueRef","SymbolicValueRef","ValueRef",
1226 "ResolvedVal","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst",
1227 "JumpTable","Inst","PHIList","ValueRefList","ValueRefListE","OptTailCall","InstVal",
1228 "IndexList","OptVolatile","MemoryInst", NULL
1232 static const short yyr1[] = { 0,
1233 112, 112, 113, 113, 114, 114, 114, 114, 114, 115,
1234 115, 115, 116, 116, 116, 116, 116, 116, 117, 117,
1235 118, 118, 118, 118, 119, 119, 119, 119, 120, 120,
1236 121, 121, 122, 122, 123, 123, 123, 123, 123, 124,
1237 124, 124, 124, 124, 125, 125, 126, 126, 127, 128,
1238 128, 129, 129, 130, 130, 131, 131, 132, 132, 133,
1239 134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
1240 134, 134, 134, 135, 135, 135, 135, 135, 135, 135,
1241 135, 135, 135, 136, 136, 137, 137, 137, 137, 138,
1242 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
1243 138, 138, 138, 138, 138, 139, 139, 139, 139, 139,
1244 139, 139, 139, 140, 140, 141, 141, 142, 143, 143,
1245 143, 143, 144, 144, 145, 144, 146, 144, 144, 144,
1246 144, 147, 147, 148, 148, 148, 149, 150, 150, 150,
1247 151, 151, 152, 152, 153, 154, 154, 155, 155, 155,
1248 155, 156, 157, 157, 158, 159, 159, 160, 162, 161,
1249 163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
1250 164, 164, 165, 165, 166, 167, 167, 168, 169, 169,
1251 169, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1252 171, 171, 172, 173, 173, 174, 174, 175, 175, 176,
1253 176, 177, 177, 177, 177, 177, 177, 177, 177, 177,
1254 177, 177, 177, 177, 177, 177, 178, 178, 179, 179,
1255 180, 180, 180, 180, 180, 180, 180, 180
1258 static const short yyr2[] = { 0,
1259 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1260 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1261 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1262 1, 1, 2, 0, 1, 1, 1, 1, 0, 0,
1263 1, 1, 1, 2, 0, 2, 0, 3, 2, 0,
1264 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1265 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1266 1, 1, 1, 1, 1, 1, 2, 4, 5, 5,
1267 3, 2, 2, 1, 3, 1, 3, 1, 0, 4,
1268 3, 3, 4, 4, 3, 2, 2, 2, 2, 2,
1269 2, 2, 2, 2, 2, 6, 5, 8, 6, 6,
1270 6, 6, 6, 3, 1, 1, 1, 1, 2, 2,
1271 2, 1, 4, 2, 0, 7, 0, 7, 3, 4,
1272 0, 1, 1, 3, 3, 3, 3, 3, 1, 0,
1273 1, 1, 1, 0, 2, 3, 1, 1, 3, 1,
1274 0, 8, 1, 1, 3, 1, 1, 2, 0, 3,
1275 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1276 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1277 1, 2, 2, 3, 9, 9, 8, 13, 1, 1,
1278 6, 5, 2, 6, 7, 1, 3, 1, 0, 2,
1279 1, 5, 5, 5, 2, 4, 4, 6, 4, 4,
1280 4, 4, 6, 2, 7, 1, 2, 0, 1, 0,
1281 3, 6, 3, 6, 2, 4, 6, 4
1284 static const short yydefact[] = { 131,
1285 39, 122, 121, 159, 35, 36, 37, 38, 40, 180,
1286 119, 120, 180, 141, 142, 0, 0, 39, 0, 124,
1287 40, 0, 41, 42, 43, 0, 0, 181, 177, 34,
1288 156, 157, 158, 176, 0, 0, 0, 129, 0, 0,
1289 0, 0, 33, 160, 44, 1, 2, 57, 61, 62,
1290 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1291 73, 74, 0, 0, 0, 0, 171, 0, 0, 56,
1292 75, 60, 172, 76, 153, 154, 155, 220, 179, 0,
1293 0, 0, 140, 130, 123, 116, 117, 0, 0, 77,
1294 0, 0, 59, 82, 84, 0, 0, 89, 83, 219,
1295 0, 201, 0, 0, 0, 0, 40, 189, 190, 5,
1296 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1297 16, 17, 18, 0, 0, 0, 0, 0, 0, 0,
1298 19, 20, 0, 0, 0, 0, 0, 0, 0, 0,
1299 0, 178, 40, 193, 0, 216, 136, 133, 132, 134,
1300 135, 139, 0, 127, 61, 62, 63, 64, 65, 66,
1301 67, 68, 69, 70, 71, 0, 0, 0, 0, 125,
1302 0, 0, 0, 81, 151, 88, 86, 0, 0, 205,
1303 200, 183, 182, 0, 0, 24, 28, 23, 27, 22,
1304 26, 21, 25, 29, 30, 0, 0, 47, 47, 225,
1305 0, 0, 214, 0, 0, 0, 0, 0, 0, 0,
1306 0, 0, 0, 0, 0, 0, 0, 0, 137, 52,
1307 103, 104, 3, 4, 101, 102, 105, 100, 96, 97,
1308 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1309 0, 0, 99, 98, 52, 58, 58, 85, 150, 144,
1310 147, 148, 0, 0, 78, 161, 162, 163, 168, 164,
1311 165, 166, 167, 0, 170, 174, 173, 175, 0, 184,
1312 0, 0, 0, 221, 0, 223, 218, 0, 0, 0,
1313 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1314 0, 0, 0, 138, 0, 128, 0, 0, 0, 0,
1315 91, 115, 0, 0, 95, 0, 92, 0, 0, 0,
1316 0, 126, 79, 80, 143, 145, 0, 50, 87, 0,
1317 0, 0, 0, 0, 0, 0, 0, 228, 0, 0,
1318 207, 0, 209, 212, 0, 210, 211, 0, 0, 0,
1319 206, 0, 226, 0, 0, 0, 54, 52, 218, 0,
1320 0, 0, 0, 90, 93, 94, 0, 0, 0, 0,
1321 149, 146, 51, 45, 169, 0, 0, 199, 47, 48,
1322 47, 196, 217, 0, 0, 0, 0, 202, 203, 204,
1323 199, 0, 49, 55, 53, 0, 0, 0, 0, 114,
1324 0, 0, 0, 0, 0, 152, 0, 0, 198, 0,
1325 0, 222, 224, 0, 0, 0, 208, 213, 0, 227,
1326 107, 0, 0, 0, 0, 0, 0, 0, 46, 0,
1327 0, 0, 197, 194, 0, 215, 106, 0, 113, 109,
1328 110, 111, 112, 0, 187, 0, 0, 0, 195, 0,
1329 185, 0, 186, 0, 0, 108, 0, 0, 0, 0,
1330 0, 0, 192, 0, 0, 191, 188, 0, 0, 0
1333 static const short yydefgoto[] = { 67,
1334 225, 239, 240, 241, 242, 166, 167, 196, 168, 18,
1335 9, 26, 396, 274, 347, 364, 296, 348, 68, 69,
1336 179, 71, 72, 96, 178, 302, 265, 303, 88, 458,
1337 1, 2, 245, 220, 150, 38, 84, 153, 73, 316,
1338 251, 252, 253, 27, 77, 10, 33, 11, 12, 21,
1339 266, 74, 268, 372, 13, 29, 30, 142, 437, 79,
1340 203, 399, 400, 143, 144, 328, 145, 146
1343 static const short yypact[] = {-32768,
1344 94, 198,-32768,-32768,-32768,-32768,-32768,-32768, 100, 26,
1345 -32768,-32768, -14,-32768,-32768, 96, -77, 80, -47,-32768,
1346 100, 104,-32768,-32768,-32768, 976, -16,-32768,-32768, 67,
1347 -32768,-32768,-32768,-32768, 22, 35, 69,-32768, 62, 976,
1348 3, 3,-32768,-32768,-32768,-32768,-32768, 76,-32768,-32768,
1349 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1350 -32768,-32768, 166, 175, 182, 66,-32768, 67, 86,-32768,
1351 -32768, -67,-32768,-32768,-32768,-32768,-32768, 1095,-32768, 164,
1352 -34, 187, 169,-32768,-32768,-32768,-32768, 998, 1042,-32768,
1353 92, 93,-32768,-32768, -67, -3, 98, 729,-32768,-32768,
1354 998,-32768, 144, 1102, -1, 369, 100,-32768,-32768,-32768,
1355 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1356 -32768,-32768,-32768, 998, 998, 998, 998, 998, 998, 998,
1357 -32768,-32768, 998, 998, 998, 998, 998, 998, 998, 998,
1358 998,-32768, 100,-32768, 19,-32768,-32768,-32768,-32768,-32768,
1359 -32768,-32768, 4,-32768, 102, 139, 199, 149, 200, 151,
1360 201, 160, 202, 195, 209, 178, 203, 210, 371,-32768,
1361 998, 998, 998,-32768, 767,-32768, 109, 117, 549,-32768,
1362 -32768, 76,-32768, 549, 549,-32768,-32768,-32768,-32768,-32768,
1363 -32768,-32768,-32768,-32768,-32768, 549, 976, 122, 128,-32768,
1364 549, 125, 133, 197, 135, 136, 137, 138, 148, 150,
1365 549, 549, 549, 153, 976, 998, 998, 219,-32768, 156,
1366 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1367 147, 157, 161, 165, 833, 1042, 504, 233, 168, 174,
1368 176, 177,-32768,-32768, 156, -40, -43, -67,-32768, 67,
1369 -32768, 162, 163, 871,-32768,-32768,-32768,-32768,-32768,-32768,
1370 -32768,-32768,-32768, 1042,-32768,-32768,-32768,-32768, 171,-32768,
1371 180, 549, -4,-32768, 7,-32768, 181, 549, 173, 998,
1372 998, 998, 998, 998, 998, 998, 190, 191, 193, 998,
1373 549, 549, 194,-32768, 39,-32768, 1042, 1042, 1042, 1042,
1374 -32768,-32768, 45, 27,-32768, -2,-32768, 1042, 1042, 1042,
1375 1042,-32768,-32768,-32768,-32768,-32768, 938, 247,-32768, 32,
1376 246, 265, 196, 549, 290, 549, 998,-32768, 206, 549,
1377 -32768, 220,-32768,-32768, 221,-32768,-32768, 549, 549, 549,
1378 -32768, 222,-32768, 998, 271, 295,-32768, 156, 181, 264,
1379 223, 225, 1042,-32768,-32768,-32768, 227, 229, 230, 232,
1380 -32768,-32768,-32768, 267,-32768, 549, 549, 998, 235,-32768,
1381 235,-32768, 236, 549, 237, 998, 998,-32768,-32768,-32768,
1382 998, 549,-32768,-32768,-32768, 242, 998, 1042, 1042,-32768,
1383 1042, 1042, 1042, 1042, 297,-32768, 238, 244, 236, 243,
1384 294,-32768,-32768, 998, 245, 549,-32768,-32768, 249,-32768,
1385 -32768, 250, 254, 253, 255, 256, 257, 258,-32768, 328,
1386 13, 320,-32768,-32768, 259,-32768,-32768, 1042,-32768,-32768,
1387 -32768,-32768,-32768, 549,-32768, 630, 43, 348,-32768, 268,
1388 -32768, 272,-32768, 630, 549,-32768, 351, 274, 308, 549,
1389 354, 366,-32768, 549, 549,-32768,-32768, 388, 389,-32768
1392 static const short yypgoto[] = {-32768,
1393 -32768, 312, 313, 314, 316, -105, -104, -404,-32768, 368,
1394 378, -75,-32768, -193, 81,-32768, -238,-32768, -35,-32768,
1395 -26,-32768, -56, 302,-32768, -85, 234, -198, 362,-32768,
1396 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1,-32768,
1397 88,-32768,-32768, 387,-32768,-32768,-32768,-32768, 409,-32768,
1398 -304, -28, 129, -89,-32768, 399,-32768,-32768,-32768,-32768,
1399 -32768, 87, 34,-32768,-32768, 64,-32768,-32768
1406 static const short yytable[] = { 70,
1407 194, 195, 19, 170, 85, 276, 312, 184, 28, 95,
1408 324, 180, 75, 70, 183, 31, 436, 148, 149, 185,
1409 39, 326, 186, 187, 188, 189, 190, 191, 192, 193,
1410 19, 197, 444, -58, 86, 87, 200, 304, 306, 204,
1411 205, 95, 99, 206, 207, 208, 209, 210, 28, 325,
1412 43, 214, 186, 187, 188, 189, 190, 191, 192, 193,
1413 325, 154, 169, 314, 313, 320, 99, 215, 97, 99,
1414 46, 47, 345, 93, 49, 50, 51, 52, 53, 54,
1415 55, 56, 57, 58, 59, 60, 61, 14, 14, 15,
1416 15, 76, 346, -118, 32, 173, 353, 198, 199, 40,
1417 201, 202, 218, 216, 217, 174, 356, 45, 219, 385,
1418 62, 211, 212, 213, 246, 247, 248, 435, 3, 80,
1419 5, 6, 7, 8, 4, 353, 41, 293, 221, 222,
1420 353, 442, 81, 355, 5, 6, 7, 8, 365, 448,
1421 244, -24, -24, 353, 35, 36, 37, 443, 250, 354,
1422 267, -23, -23, -22, -22, 267, 267, 22, 23, 24,
1423 25, 272, -21, -21, 83, 63, 82, 267, 64, 90,
1424 70, 65, 267, 66, 94, 402, -59, 403, 91, 291,
1425 223, 224, 267, 267, 267, 92, 98, 147, 70, 292,
1426 151, 332, 152, 334, 335, 171, 172, 248, 175, 181,
1427 341, -31, -28, -27, -26, -25, 226, 254, 169, 169,
1428 169, 349, 350, 351, 352, -32, 227, -34, 255, 14,
1429 273, 15, 357, 358, 359, 360, 275, 278, 4, -34,
1430 -34, 279, 280, 281, 282, 283, 284, 169, -34, -34,
1431 -34, -34, 294, 267, -34, 16, 285, 297, 286, 267,
1432 315, 290, 17, 331, 295, 333, 307, 298, 336, 337,
1433 317, 299, 267, 267, 318, 300, 366, 390, 308, 321,
1434 169, 169, 169, 169, 309, 330, 310, 311, 322, 327,
1435 345, 169, 169, 169, 169, 367, 407, 408, 338, 339,
1436 250, 340, 344, 370, 383, 267, 368, 267, 384, 387,
1437 419, 267, 413, 414, 374, 415, 416, 417, 418, 267,
1438 267, 267, 269, 270, 423, 194, 195, 382, 376, 377,
1439 395, 388, 381, 389, 271, 391, 169, 392, 393, 277,
1440 394, 194, 195, 401, 404, 406, 420, 267, 267, 287,
1441 288, 289, 440, 411, 422, 267, 421, 325, 434, 424,
1442 426, 427, 428, 267, 429, 438, 430, 431, 432, 433,
1443 412, 169, 169, 439, 169, 169, 169, 169, 445, 446,
1444 447, 450, 451, 452, 454, 46, 47, 267, 186, 187,
1445 188, 189, 190, 191, 192, 193, 455, 459, 460, 138,
1446 139, 140, 14, 141, 15, 42, 228, 78, 363, 177,
1447 323, 169, 243, 89, 362, 267, 329, 44, 229, 230,
1448 20, 34, 386, 373, 409, 0, 267, 0, 0, 342,
1449 343, 267, 0, 0, 0, 267, 267, 0, 0, 0,
1450 0, 0, 0, 0, 0, 0, 0, 0, 110, 111,
1451 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
1452 122, 123, 369, 0, 371, 0, 0, 231, 375, 232,
1453 233, 131, 132, 0, 234, 0, 378, 379, 380, 0,
1454 0, 0, 0, 235, 0, 0, 236, 0, 237, 0,
1455 0, 238, 0, 0, 0, 0, 0, 0, 0, 0,
1456 0, 0, 0, 0, 397, 398, 0, 0, 0, 0,
1457 0, 0, 405, 0, 0, 0, 0, 0, 46, 47,
1458 410, 93, 155, 156, 157, 158, 159, 160, 161, 162,
1459 163, 164, 165, 60, 61, 14, 0, 15, 0, 0,
1460 0, 0, 0, 0, 425, 0, 0, 0, 0, 0,
1461 0, 0, 0, 0, 0, 0, 0, 0, 62, 0,
1462 0, 256, 257, 46, 47, 258, 0, 0, 0, 0,
1463 0, 0, 441, 0, 0, 0, 0, 0, 0, 0,
1464 14, 0, 15, 449, 259, 260, 261, 0, 453, 0,
1465 0, 0, 456, 457, 0, 0, 262, 263, 0, 0,
1466 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1467 0, 0, 0, 63, 0, 0, 64, 0, 0, 65,
1468 0, 66, 305, 0, 0, 0, 110, 111, 112, 113,
1469 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
1470 0, 0, 256, 257, 0, 231, 258, 232, 233, 131,
1471 132, 0, 234, 0, 0, 0, 0, 0, 0, 0,
1472 0, 0, 0, 0, 264, 259, 260, 261, 0, 0,
1473 0, 0, 0, 0, 0, 0, 0, 262, 263, 0,
1474 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1475 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1476 0, 0, 0, 0, 0, 0, 0, 110, 111, 112,
1477 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
1478 123, 0, 0, 0, 0, 0, 231, 0, 232, 233,
1479 131, 132, 0, 234, 0, 0, 0, 0, 0, 0,
1480 0, 0, 0, 46, 47, 264, 93, 49, 50, 51,
1481 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
1482 14, 0, 15, 0, 0, 0, 0, 0, 0, 0,
1483 0, 0, 0, 0, 0, 176, 0, 0, 0, 0,
1484 0, 46, 47, 62, 93, 49, 50, 51, 52, 53,
1485 54, 55, 56, 57, 58, 59, 60, 61, 14, 0,
1486 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1487 0, 0, 0, 249, 0, 0, 0, 0, 0, 0,
1488 0, 62, 0, 0, 0, 0, 0, 0, 0, 0,
1489 0, 0, 0, 0, 0, 0, 0, 0, 63, 0,
1490 0, 64, 0, 0, 65, 0, 66, 46, 47, 0,
1491 93, 155, 156, 157, 158, 159, 160, 161, 162, 163,
1492 164, 165, 60, 61, 14, 0, 15, 0, 0, 0,
1493 0, 0, 0, 0, 0, 0, 63, 0, 0, 64,
1494 0, 0, 65, 0, 66, 46, 47, 62, 93, 49,
1495 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
1496 60, 61, 14, 0, 15, 0, 0, 0, 0, 0,
1497 0, 0, 0, 0, 0, 0, 0, 319, 0, 0,
1498 0, 0, 0, 0, 0, 62, 0, 0, 0, 0,
1499 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1500 0, 0, 63, 0, 0, 64, 0, 301, 65, 0,
1501 66, 0, 46, 47, 0, 93, 49, 50, 51, 52,
1502 53, 54, 55, 56, 57, 58, 59, 60, 61, 14,
1503 0, 15, 0, 0, 0, 0, 0, 0, 0, 0,
1504 63, 0, 0, 64, 361, 0, 65, 0, 66, 0,
1505 46, 47, 62, 48, 49, 50, 51, 52, 53, 54,
1506 55, 56, 57, 58, 59, 60, 61, 14, 0, 15,
1507 0, 0, 46, 47, 0, 93, 49, 50, 51, 52,
1508 53, 54, 55, 56, 57, 58, 59, 60, 61, 14,
1509 62, 15, 0, 0, 0, 0, 0, 0, 0, 0,
1510 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,
1511 64, 0, 62, 65, 0, 66, 46, 47, 0, 93,
1512 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
1513 165, 60, 61, 14, 0, 15, 0, 0, 0, 0,
1514 0, 0, 0, 0, 0, 63, 0, 0, 64, 0,
1515 0, 65, 0, 66, 0, 0, 62, 0, 0, 0,
1516 0, 0, 0, 0, 0, 0, 0, 63, 0, 0,
1517 64, 0, 0, 65, 0, 66, 46, 47, 0, 182,
1518 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
1519 59, 60, 61, 14, 0, 15, 0, 0, 0, 100,
1520 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1521 101, 63, 0, 0, 64, 0, 62, 65, 0, 66,
1522 102, 103, 0, 0, 0, 0, 104, 105, 106, 107,
1523 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
1524 118, 119, 120, 121, 122, 123, 124, 125, 126, 0,
1525 0, 127, 128, 129, 130, 131, 132, 133, 134, 135,
1526 136, 137, 0, 0, 0, 0, 0, 0, 0, 0,
1527 0, 63, 0, 0, 64, 0, 0, 65, 0, 66
1530 static const short yycheck[] = { 26,
1531 106, 106, 2, 89, 40, 199, 245, 9, 23, 66,
1532 15, 101, 29, 40, 104, 30, 421, 52, 53, 21,
1533 98, 15, 10, 11, 12, 13, 14, 15, 16, 17,
1534 30, 107, 437, 101, 32, 33, 126, 236, 237, 129,
1535 130, 98, 110, 133, 134, 135, 136, 137, 23, 54,
1536 98, 141, 10, 11, 12, 13, 14, 15, 16, 17,
1537 54, 88, 89, 107, 105, 264, 110, 143, 68, 110,
1538 5, 6, 34, 8, 9, 10, 11, 12, 13, 14,
1539 15, 16, 17, 18, 19, 20, 21, 22, 22, 24,
1540 24, 108, 54, 0, 109, 99, 99, 124, 125, 20,
1541 127, 128, 99, 85, 86, 109, 109, 4, 105, 348,
1542 45, 138, 139, 140, 171, 172, 173, 105, 25, 98,
1543 41, 42, 43, 44, 31, 99, 47, 217, 27, 28,
1544 99, 436, 98, 107, 41, 42, 43, 44, 107, 444,
1545 169, 3, 4, 99, 49, 50, 51, 105, 175, 105,
1546 179, 3, 4, 3, 4, 184, 185, 58, 59, 60,
1547 61, 197, 3, 4, 103, 100, 98, 196, 103, 4,
1548 197, 106, 201, 108, 109, 369, 101, 371, 4, 215,
1549 3, 4, 211, 212, 213, 4, 101, 24, 215, 216,
1550 4, 281, 24, 283, 284, 104, 104, 254, 101, 56,
1551 290, 7, 4, 4, 4, 4, 4, 99, 235, 236,
1552 237, 297, 298, 299, 300, 7, 7, 20, 102, 22,
1553 99, 24, 308, 309, 310, 311, 99, 103, 31, 32,
1554 33, 99, 36, 99, 99, 99, 99, 264, 41, 42,
1555 43, 44, 24, 272, 47, 48, 99, 101, 99, 278,
1556 250, 99, 55, 280, 99, 282, 24, 101, 285, 286,
1557 99, 101, 291, 292, 102, 101, 21, 353, 101, 99,
1558 297, 298, 299, 300, 101, 103, 101, 101, 99, 99,
1559 34, 308, 309, 310, 311, 21, 376, 377, 99, 99,
1560 317, 99, 99, 4, 24, 324, 101, 326, 4, 36,
1561 4, 330, 388, 389, 99, 391, 392, 393, 394, 338,
1562 339, 340, 184, 185, 404, 421, 421, 344, 99, 99,
1563 54, 99, 101, 99, 196, 99, 353, 99, 99, 201,
1564 99, 437, 437, 99, 99, 99, 99, 366, 367, 211,
1565 212, 213, 428, 102, 102, 374, 103, 54, 21, 105,
1566 102, 102, 99, 382, 102, 36, 102, 102, 102, 102,
1567 387, 388, 389, 105, 391, 392, 393, 394, 21, 102,
1568 99, 21, 99, 66, 21, 5, 6, 406, 10, 11,
1569 12, 13, 14, 15, 16, 17, 21, 0, 0, 78,
1570 78, 78, 22, 78, 24, 18, 26, 30, 318, 98,
1571 272, 428, 169, 42, 317, 434, 278, 21, 38, 39,
1572 2, 13, 349, 327, 381, -1, 445, -1, -1, 291,
1573 292, 450, -1, -1, -1, 454, 455, -1, -1, -1,
1574 -1, -1, -1, -1, -1, -1, -1, -1, 68, 69,
1575 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
1576 80, 81, 324, -1, 326, -1, -1, 87, 330, 89,
1577 90, 91, 92, -1, 94, -1, 338, 339, 340, -1,
1578 -1, -1, -1, 103, -1, -1, 106, -1, 108, -1,
1579 -1, 111, -1, -1, -1, -1, -1, -1, -1, -1,
1580 -1, -1, -1, -1, 366, 367, -1, -1, -1, -1,
1581 -1, -1, 374, -1, -1, -1, -1, -1, 5, 6,
1582 382, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1583 17, 18, 19, 20, 21, 22, -1, 24, -1, -1,
1584 -1, -1, -1, -1, 406, -1, -1, -1, -1, -1,
1585 -1, -1, -1, -1, -1, -1, -1, -1, 45, -1,
1586 -1, 3, 4, 5, 6, 7, -1, -1, -1, -1,
1587 -1, -1, 434, -1, -1, -1, -1, -1, -1, -1,
1588 22, -1, 24, 445, 26, 27, 28, -1, 450, -1,
1589 -1, -1, 454, 455, -1, -1, 38, 39, -1, -1,
1590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1591 -1, -1, -1, 100, -1, -1, 103, -1, -1, 106,
1592 -1, 108, 109, -1, -1, -1, 68, 69, 70, 71,
1593 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1594 -1, -1, 3, 4, -1, 87, 7, 89, 90, 91,
1595 92, -1, 94, -1, -1, -1, -1, -1, -1, -1,
1596 -1, -1, -1, -1, 106, 26, 27, 28, -1, -1,
1597 -1, -1, -1, -1, -1, -1, -1, 38, 39, -1,
1598 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1599 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1600 -1, -1, -1, -1, -1, -1, -1, 68, 69, 70,
1601 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
1602 81, -1, -1, -1, -1, -1, 87, -1, 89, 90,
1603 91, 92, -1, 94, -1, -1, -1, -1, -1, -1,
1604 -1, -1, -1, 5, 6, 106, 8, 9, 10, 11,
1605 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1606 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
1607 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
1608 -1, 5, 6, 45, 8, 9, 10, 11, 12, 13,
1609 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
1610 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1611 -1, -1, -1, 37, -1, -1, -1, -1, -1, -1,
1612 -1, 45, -1, -1, -1, -1, -1, -1, -1, -1,
1613 -1, -1, -1, -1, -1, -1, -1, -1, 100, -1,
1614 -1, 103, -1, -1, 106, -1, 108, 5, 6, -1,
1615 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
1616 18, 19, 20, 21, 22, -1, 24, -1, -1, -1,
1617 -1, -1, -1, -1, -1, -1, 100, -1, -1, 103,
1618 -1, -1, 106, -1, 108, 5, 6, 45, 8, 9,
1619 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1620 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
1621 -1, -1, -1, -1, -1, -1, -1, 37, -1, -1,
1622 -1, -1, -1, -1, -1, 45, -1, -1, -1, -1,
1623 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1624 -1, -1, 100, -1, -1, 103, -1, 105, 106, -1,
1625 108, -1, 5, 6, -1, 8, 9, 10, 11, 12,
1626 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1627 -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1628 100, -1, -1, 103, 37, -1, 106, -1, 108, -1,
1629 5, 6, 45, 8, 9, 10, 11, 12, 13, 14,
1630 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
1631 -1, -1, 5, 6, -1, 8, 9, 10, 11, 12,
1632 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1633 45, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1634 -1, -1, -1, -1, -1, -1, -1, 100, -1, -1,
1635 103, -1, 45, 106, -1, 108, 5, 6, -1, 8,
1636 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
1637 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
1638 -1, -1, -1, -1, -1, 100, -1, -1, 103, -1,
1639 -1, 106, -1, 108, -1, -1, 45, -1, -1, -1,
1640 -1, -1, -1, -1, -1, -1, -1, 100, -1, -1,
1641 103, -1, -1, 106, -1, 108, 5, 6, -1, 8,
1642 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
1643 19, 20, 21, 22, -1, 24, -1, -1, -1, 35,
1644 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1645 46, 100, -1, -1, 103, -1, 45, 106, -1, 108,
1646 56, 57, -1, -1, -1, -1, 62, 63, 64, 65,
1647 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1648 76, 77, 78, 79, 80, 81, 82, 83, 84, -1,
1649 -1, 87, 88, 89, 90, 91, 92, 93, 94, 95,
1650 96, 97, -1, -1, -1, -1, -1, -1, -1, -1,
1651 -1, 100, -1, -1, 103, -1, -1, 106, -1, 108
1653 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1654 #line 3 "/usr/share/bison.simple"
1655 /* This file comes from bison-1.28. */
1657 /* Skeleton output parser for bison,
1658 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1660 This program is free software; you can redistribute it and/or modify
1661 it under the terms of the GNU General Public License as published by
1662 the Free Software Foundation; either version 2, or (at your option)
1665 This program is distributed in the hope that it will be useful,
1666 but WITHOUT ANY WARRANTY; without even the implied warranty of
1667 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1668 GNU General Public License for more details.
1670 You should have received a copy of the GNU General Public License
1671 along with this program; if not, write to the Free Software
1672 Foundation, Inc., 59 Temple Place - Suite 330,
1673 Boston, MA 02111-1307, USA. */
1675 /* As a special exception, when this file is copied by Bison into a
1676 Bison output file, you may use that output file without restriction.
1677 This special exception was added by the Free Software Foundation
1678 in version 1.24 of Bison. */
1680 /* This is the parser code that is written into each bison parser
1681 when the %semantic_parser declaration is not specified in the grammar.
1682 It was written by Richard Stallman by simplifying the hairy parser
1683 used when %semantic_parser is specified. */
1685 #ifndef YYSTACK_USE_ALLOCA
1687 #define YYSTACK_USE_ALLOCA
1688 #else /* alloca not defined */
1690 #define YYSTACK_USE_ALLOCA
1691 #define alloca __builtin_alloca
1692 #else /* not GNU C. */
1693 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
1694 #define YYSTACK_USE_ALLOCA
1696 #else /* not sparc */
1697 /* We think this test detects Watcom and Microsoft C. */
1698 /* This used to test MSDOS, but that is a bad idea
1699 since that symbol is in the user namespace. */
1700 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
1701 #if 0 /* No need for malloc.h, which pollutes the namespace;
1702 instead, just don't use alloca. */
1705 #else /* not MSDOS, or __TURBOC__ */
1707 /* I don't know what this was needed for, but it pollutes the namespace.
1708 So I turned it off. rms, 2 May 1997. */
1709 /* #include <malloc.h> */
1711 #define YYSTACK_USE_ALLOCA
1712 #else /* not MSDOS, or __TURBOC__, or _AIX */
1714 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
1715 and on HPUX 10. Eventually we can turn this on. */
1716 #define YYSTACK_USE_ALLOCA
1717 #define alloca __builtin_alloca
1720 #endif /* not _AIX */
1721 #endif /* not MSDOS, or __TURBOC__ */
1722 #endif /* not sparc */
1723 #endif /* not GNU C */
1724 #endif /* alloca not defined */
1725 #endif /* YYSTACK_USE_ALLOCA not defined */
1727 #ifdef YYSTACK_USE_ALLOCA
1728 #define YYSTACK_ALLOC alloca
1730 #define YYSTACK_ALLOC malloc
1733 /* Note: there must be only one dollar sign in this file.
1734 It is replaced by the list of actions, each action
1735 as one case of the switch. */
1737 #define yyerrok (yyerrstatus = 0)
1738 #define yyclearin (yychar = YYEMPTY)
1741 #define YYACCEPT goto yyacceptlab
1742 #define YYABORT goto yyabortlab
1743 #define YYERROR goto yyerrlab1
1744 /* Like YYERROR except do call yyerror.
1745 This remains here temporarily to ease the
1746 transition to the new meaning of YYERROR, for GCC.
1747 Once GCC version 2 has supplanted version 1, this can go. */
1748 #define YYFAIL goto yyerrlab
1749 #define YYRECOVERING() (!!yyerrstatus)
1750 #define YYBACKUP(token, value) \
1752 if (yychar == YYEMPTY && yylen == 1) \
1753 { yychar = (token), yylval = (value); \
1754 yychar1 = YYTRANSLATE (yychar); \
1759 { yyerror ("syntax error: cannot back up"); YYERROR; } \
1763 #define YYERRCODE 256
1766 #define YYLEX yylex()
1772 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
1774 #define YYLEX yylex(&yylval, &yylloc)
1776 #else /* not YYLSP_NEEDED */
1778 #define YYLEX yylex(&yylval, YYLEX_PARAM)
1780 #define YYLEX yylex(&yylval)
1782 #endif /* not YYLSP_NEEDED */
1785 /* If nonreentrant, generate the variables here */
1789 int yychar; /* the lookahead symbol */
1790 YYSTYPE yylval; /* the semantic value of the */
1791 /* lookahead symbol */
1794 YYLTYPE yylloc; /* location data for the lookahead */
1798 int yynerrs; /* number of parse errors so far */
1799 #endif /* not YYPURE */
1802 int yydebug; /* nonzero means print parse trace */
1803 /* Since this is uninitialized, it does not stop multiple parsers
1807 /* YYINITDEPTH indicates the initial size of the parser's stacks */
1810 #define YYINITDEPTH 200
1813 /* YYMAXDEPTH is the maximum size the stacks can grow to
1814 (effective only if the built-in stack extension method is used). */
1821 #define YYMAXDEPTH 10000
1824 /* Define __yy_memcpy. Note that the size argument
1825 should be passed with type unsigned int, because that is what the non-GCC
1826 definitions require. With GCC, __builtin_memcpy takes an arg
1827 of type size_t, but it can handle unsigned int. */
1829 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
1830 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
1831 #else /* not GNU C or C++ */
1834 /* This is the most reliable way to avoid incompatibilities
1835 in available built-in functions on various systems. */
1837 __yy_memcpy (to, from, count)
1842 register char *f = from;
1843 register char *t = to;
1844 register int i = count;
1850 #else /* __cplusplus */
1852 /* This is the most reliable way to avoid incompatibilities
1853 in available built-in functions on various systems. */
1855 __yy_memcpy (char *to, char *from, unsigned int count)
1857 register char *t = to;
1858 register char *f = from;
1859 register int i = count;
1868 #line 217 "/usr/share/bison.simple"
1870 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
1871 into yyparse. The argument should have type void *.
1872 It should actually point to an object.
1873 Grammar actions can access the variable by casting it
1874 to the proper pointer type. */
1876 #ifdef YYPARSE_PARAM
1878 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1879 #define YYPARSE_PARAM_DECL
1880 #else /* not __cplusplus */
1881 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
1882 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1883 #endif /* not __cplusplus */
1884 #else /* not YYPARSE_PARAM */
1885 #define YYPARSE_PARAM_ARG
1886 #define YYPARSE_PARAM_DECL
1887 #endif /* not YYPARSE_PARAM */
1889 /* Prevent warning if -Wstrict-prototypes. */
1891 #ifdef YYPARSE_PARAM
1892 int yyparse (void *);
1899 yyparse(YYPARSE_PARAM_ARG)
1902 register int yystate;
1904 register short *yyssp;
1905 register YYSTYPE *yyvsp;
1906 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1907 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1909 short yyssa[YYINITDEPTH]; /* the state stack */
1910 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1912 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1913 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1916 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1917 YYLTYPE *yyls = yylsa;
1920 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1922 #define YYPOPSTACK (yyvsp--, yyssp--)
1925 int yystacksize = YYINITDEPTH;
1926 int yyfree_stacks = 0;
1937 YYSTYPE yyval; /* the variable used to return */
1938 /* semantic values from the action */
1945 fprintf(stderr, "Starting parse\n");
1951 yychar = YYEMPTY; /* Cause a token to be read. */
1953 /* Initialize stack pointers.
1954 Waste one element of value and location stack
1955 so that they stay on the same level as the state stack.
1956 The wasted elements are never initialized. */
1964 /* Push a new state, which is found in yystate . */
1965 /* In all cases, when you get here, the value and location stacks
1966 have just been pushed. so pushing a state here evens the stacks. */
1971 if (yyssp >= yyss + yystacksize - 1)
1973 /* Give user a chance to reallocate the stack */
1974 /* Use copies of these so that the &'s don't force the real ones into memory. */
1975 YYSTYPE *yyvs1 = yyvs;
1976 short *yyss1 = yyss;
1978 YYLTYPE *yyls1 = yyls;
1981 /* Get the current used size of the three stacks, in elements. */
1982 int size = yyssp - yyss + 1;
1985 /* Each stack pointer address is followed by the size of
1986 the data in use in that stack, in bytes. */
1988 /* This used to be a conditional around just the two extra args,
1989 but that might be undefined if yyoverflow is a macro. */
1990 yyoverflow("parser stack overflow",
1991 &yyss1, size * sizeof (*yyssp),
1992 &yyvs1, size * sizeof (*yyvsp),
1993 &yyls1, size * sizeof (*yylsp),
1996 yyoverflow("parser stack overflow",
1997 &yyss1, size * sizeof (*yyssp),
1998 &yyvs1, size * sizeof (*yyvsp),
2002 yyss = yyss1; yyvs = yyvs1;
2006 #else /* no yyoverflow */
2007 /* Extend the stack our own way. */
2008 if (yystacksize >= YYMAXDEPTH)
2010 yyerror("parser stack overflow");
2022 if (yystacksize > YYMAXDEPTH)
2023 yystacksize = YYMAXDEPTH;
2024 #ifndef YYSTACK_USE_ALLOCA
2027 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2028 __yy_memcpy ((char *)yyss, (char *)yyss1,
2029 size * (unsigned int) sizeof (*yyssp));
2030 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2031 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2032 size * (unsigned int) sizeof (*yyvsp));
2034 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2035 __yy_memcpy ((char *)yyls, (char *)yyls1,
2036 size * (unsigned int) sizeof (*yylsp));
2038 #endif /* no yyoverflow */
2040 yyssp = yyss + size - 1;
2041 yyvsp = yyvs + size - 1;
2043 yylsp = yyls + size - 1;
2048 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2051 if (yyssp >= yyss + yystacksize - 1)
2057 fprintf(stderr, "Entering state %d\n", yystate);
2063 /* Do appropriate processing given the current state. */
2064 /* Read a lookahead token if we need one and don't already have one. */
2067 /* First try to decide what to do without reference to lookahead token. */
2069 yyn = yypact[yystate];
2073 /* Not known => get a lookahead token if don't already have one. */
2075 /* yychar is either YYEMPTY or YYEOF
2076 or a valid token in external form. */
2078 if (yychar == YYEMPTY)
2082 fprintf(stderr, "Reading a token: ");
2087 /* Convert token to internal form (in yychar1) for indexing tables with */
2089 if (yychar <= 0) /* This means end of input. */
2092 yychar = YYEOF; /* Don't call YYLEX any more */
2096 fprintf(stderr, "Now at end of input.\n");
2101 yychar1 = YYTRANSLATE(yychar);
2106 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2107 /* Give the individual parser a way to print the precise meaning
2108 of a token, for further debugging info. */
2110 YYPRINT (stderr, yychar, yylval);
2112 fprintf (stderr, ")\n");
2118 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2123 /* yyn is what to do for this token type in this state.
2124 Negative => reduce, -yyn is rule number.
2125 Positive => shift, yyn is new state.
2126 New state is final state => don't bother to shift,
2127 just return success.
2128 0, or most negative number => error. */
2143 /* Shift the lookahead token. */
2147 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2150 /* Discard the token being shifted unless it is eof. */
2151 if (yychar != YYEOF)
2159 /* count tokens shifted since error; after three, turn off error status. */
2160 if (yyerrstatus) yyerrstatus--;
2165 /* Do the default action for the current state. */
2168 yyn = yydefact[yystate];
2172 /* Do a reduction. yyn is the number of a rule to reduce with. */
2176 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2183 fprintf (stderr, "Reducing via rule %d (line %d), ",
2186 /* Print the symbols being reduced, and their result. */
2187 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2188 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2189 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2197 #line 998 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2199 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
2200 ThrowException("Value too large for type!");
2201 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
2205 #line 1006 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2207 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
2208 ThrowException("Value too large for type!");
2209 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
2213 #line 1029 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2215 yyval.StrVal = yyvsp[-1].StrVal;
2219 #line 1032 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2225 #line 1036 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2226 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2229 #line 1037 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2230 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2233 #line 1038 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2234 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2237 #line 1039 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2238 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2241 #line 1040 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2242 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2245 #line 1042 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2246 { yyval.UIntVal = CallingConv::C; ;
2249 #line 1043 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2250 { yyval.UIntVal = CallingConv::C; ;
2253 #line 1044 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2254 { yyval.UIntVal = CallingConv::Fast; ;
2257 #line 1045 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2258 { yyval.UIntVal = CallingConv::Cold; ;
2261 #line 1046 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2263 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2264 ThrowException("Calling conv too large!");
2265 yyval.UIntVal = yyvsp[0].UInt64Val;
2269 #line 1054 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2270 { yyval.UIntVal = 0; ;
2273 #line 1055 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2275 yyval.UIntVal = yyvsp[0].UInt64Val;
2276 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2277 ThrowException("Alignment must be a power of two!");
2281 #line 1060 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2282 { yyval.UIntVal = 0; ;
2285 #line 1061 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2287 yyval.UIntVal = yyvsp[0].UInt64Val;
2288 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2289 ThrowException("Alignment must be a power of two!");
2293 #line 1068 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2295 for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i)
2296 if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\')
2297 ThrowException("Invalid character in section name!");
2298 yyval.StrVal = yyvsp[0].StrVal;
2302 #line 1075 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2303 { yyval.StrVal = 0; ;
2306 #line 1076 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2307 { yyval.StrVal = yyvsp[0].StrVal; ;
2310 #line 1081 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2314 #line 1082 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2318 #line 1083 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2320 CurGV->setSection(yyvsp[0].StrVal);
2321 free(yyvsp[0].StrVal);
2325 #line 1087 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2327 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2328 ThrowException("Alignment must be a power of two!");
2329 CurGV->setAlignment(yyvsp[0].UInt64Val);
2333 #line 1100 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2334 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2337 #line 1101 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2338 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2341 #line 1103 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2343 if (!UpRefs.empty())
2344 ThrowException("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
2345 yyval.TypeVal = yyvsp[0].TypeVal;
2349 #line 1114 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2351 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2355 #line 1117 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2357 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2361 #line 1120 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2362 { // Named types are also simple types...
2363 yyval.TypeVal = new PATypeHolder(getTypeVal(yyvsp[0].ValIDVal));
2367 #line 1126 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2368 { // Type UpReference
2369 if (yyvsp[0].UInt64Val > (uint64_t)~0U) ThrowException("Value out of range!");
2370 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2371 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2372 yyval.TypeVal = new PATypeHolder(OT);
2373 UR_OUT("New Upreference!\n");
2377 #line 1133 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2378 { // Function derived type?
2379 std::vector<const Type*> Params;
2380 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2381 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2382 Params.push_back(*I);
2383 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2384 if (isVarArg) Params.pop_back();
2386 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg)));
2387 delete yyvsp[-1].TypeList; // Delete the argument list
2388 delete yyvsp[-3].TypeVal; // Delete the return type handle
2392 #line 1145 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2393 { // Sized array type?
2394 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2395 delete yyvsp[-1].TypeVal;
2399 #line 1149 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2400 { // Packed array type?
2401 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
2402 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
2403 ThrowException("Unsigned result not equal to signed result");
2404 if (!ElemTy->isPrimitiveType())
2405 ThrowException("Elemental type of a PackedType must be primitive");
2406 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
2407 ThrowException("Vector length should be a power of 2!");
2408 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2409 delete yyvsp[-1].TypeVal;
2413 #line 1160 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2414 { // Structure type?
2415 std::vector<const Type*> Elements;
2416 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2417 E = yyvsp[-1].TypeList->end(); I != E; ++I)
2418 Elements.push_back(*I);
2420 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
2421 delete yyvsp[-1].TypeList;
2425 #line 1169 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2426 { // Empty structure type?
2427 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
2431 #line 1172 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2433 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2434 delete yyvsp[-1].TypeVal;
2438 #line 1180 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2440 yyval.TypeList = new std::list<PATypeHolder>();
2441 yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2445 #line 1184 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2447 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2451 #line 1190 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2453 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy);
2457 #line 1193 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2459 (yyval.TypeList = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
2463 #line 1196 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2465 yyval.TypeList = new std::list<PATypeHolder>();
2469 #line 1206 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2470 { // Nonempty unsized arr
2471 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
2473 ThrowException("Cannot make array constant with type: '" +
2474 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2475 const Type *ETy = ATy->getElementType();
2476 int NumElements = ATy->getNumElements();
2478 // Verify that we have the correct size...
2479 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2480 ThrowException("Type mismatch: constant sized array initialized with " +
2481 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
2482 itostr(NumElements) + "!");
2484 // Verify all elements are correct type!
2485 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2486 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2487 ThrowException("Element #" + utostr(i) + " is not of type '" +
2488 ETy->getDescription() +"' as required!\nIt is of type '"+
2489 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2492 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
2493 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2497 #line 1231 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2499 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2501 ThrowException("Cannot make array constant with type: '" +
2502 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2504 int NumElements = ATy->getNumElements();
2505 if (NumElements != -1 && NumElements != 0)
2506 ThrowException("Type mismatch: constant sized array initialized with 0"
2507 " arguments, but has size of " + itostr(NumElements) +"!");
2508 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
2509 delete yyvsp[-2].TypeVal;
2513 #line 1244 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2515 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2517 ThrowException("Cannot make array constant with type: '" +
2518 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2520 int NumElements = ATy->getNumElements();
2521 const Type *ETy = ATy->getElementType();
2522 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
2523 if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
2524 ThrowException("Can't build string constant of size " +
2525 itostr((int)(EndStr-yyvsp[0].StrVal)) +
2526 " when array has size " + itostr(NumElements) + "!");
2527 std::vector<Constant*> Vals;
2528 if (ETy == Type::SByteTy) {
2529 for (char *C = yyvsp[0].StrVal; C != EndStr; ++C)
2530 Vals.push_back(ConstantSInt::get(ETy, *C));
2531 } else if (ETy == Type::UByteTy) {
2532 for (char *C = yyvsp[0].StrVal; C != EndStr; ++C)
2533 Vals.push_back(ConstantUInt::get(ETy, (unsigned char)*C));
2535 free(yyvsp[0].StrVal);
2536 ThrowException("Cannot build string arrays of non byte sized elements!");
2538 free(yyvsp[0].StrVal);
2539 yyval.ConstVal = ConstantArray::get(ATy, Vals);
2540 delete yyvsp[-2].TypeVal;
2544 #line 1272 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2545 { // Nonempty unsized arr
2546 const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get());
2548 ThrowException("Cannot make packed constant with type: '" +
2549 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2550 const Type *ETy = PTy->getElementType();
2551 int NumElements = PTy->getNumElements();
2553 // Verify that we have the correct size...
2554 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2555 ThrowException("Type mismatch: constant sized packed initialized with " +
2556 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
2557 itostr(NumElements) + "!");
2559 // Verify all elements are correct type!
2560 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2561 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2562 ThrowException("Element #" + utostr(i) + " is not of type '" +
2563 ETy->getDescription() +"' as required!\nIt is of type '"+
2564 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2567 yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector);
2568 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2572 #line 1297 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2574 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
2576 ThrowException("Cannot make struct constant with type: '" +
2577 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2579 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
2580 ThrowException("Illegal number of initializers for structure type!");
2582 // Check to ensure that constants are compatible with the type initializer!
2583 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
2584 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
2585 ThrowException("Expected type '" +
2586 STy->getElementType(i)->getDescription() +
2587 "' for element #" + utostr(i) +
2588 " of structure initializer!");
2590 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
2591 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2595 #line 1317 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2597 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
2599 ThrowException("Cannot make struct constant with type: '" +
2600 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2602 if (STy->getNumContainedTypes() != 0)
2603 ThrowException("Illegal number of initializers for structure type!");
2605 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
2606 delete yyvsp[-2].TypeVal;
2610 #line 1329 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2612 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2614 ThrowException("Cannot make null pointer constant with type: '" +
2615 (*yyvsp[-1].TypeVal)->getDescription() + "'!");
2617 yyval.ConstVal = ConstantPointerNull::get(PTy);
2618 delete yyvsp[-1].TypeVal;
2622 #line 1338 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2624 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
2625 delete yyvsp[-1].TypeVal;
2629 #line 1342 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2631 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2633 ThrowException("Global const reference must be a pointer type!");
2635 // ConstExprs can exist in the body of a function, thus creating
2636 // GlobalValues whenever they refer to a variable. Because we are in
2637 // the context of a function, getValNonImprovising will search the functions
2638 // symbol table instead of the module symbol table for the global symbol,
2639 // which throws things all off. To get around this, we just tell
2640 // getValNonImprovising that we are at global scope here.
2642 Function *SavedCurFn = CurFun.CurrentFunction;
2643 CurFun.CurrentFunction = 0;
2645 Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal);
2647 CurFun.CurrentFunction = SavedCurFn;
2649 // If this is an initializer for a constant pointer, which is referencing a
2650 // (currently) undefined variable, create a stub now that shall be replaced
2651 // in the future with the right type of variable.
2654 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
2655 const PointerType *PT = cast<PointerType>(Ty);
2657 // First check to see if the forward references value is already created!
2658 PerModuleInfo::GlobalRefsType::iterator I =
2659 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
2661 if (I != CurModule.GlobalRefs.end()) {
2662 V = I->second; // Placeholder already exists, use it...
2663 yyvsp[0].ValIDVal.destroy();
2666 if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name;
2668 // Create the forward referenced global.
2670 if (const FunctionType *FTy =
2671 dyn_cast<FunctionType>(PT->getElementType())) {
2672 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
2673 CurModule.CurrentModule);
2675 GV = new GlobalVariable(PT->getElementType(), false,
2676 GlobalValue::ExternalLinkage, 0,
2677 Name, CurModule.CurrentModule);
2680 // Keep track of the fact that we have a forward ref to recycle it
2681 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
2686 yyval.ConstVal = cast<GlobalValue>(V);
2687 delete yyvsp[-1].TypeVal; // Free the type handle
2691 #line 1401 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2693 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
2694 ThrowException("Mismatched types for constant expression!");
2695 yyval.ConstVal = yyvsp[0].ConstVal;
2696 delete yyvsp[-1].TypeVal;
2700 #line 1407 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2702 const Type *Ty = yyvsp[-1].TypeVal->get();
2703 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
2704 ThrowException("Cannot create a null initialized value of this type!");
2705 yyval.ConstVal = Constant::getNullValue(Ty);
2706 delete yyvsp[-1].TypeVal;
2710 #line 1415 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2711 { // integral constants
2712 if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
2713 ThrowException("Constant value doesn't fit in type!");
2714 yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val);
2718 #line 1420 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2719 { // integral constants
2720 if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
2721 ThrowException("Constant value doesn't fit in type!");
2722 yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val);
2726 #line 1425 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2727 { // Boolean constants
2728 yyval.ConstVal = ConstantBool::True;
2732 #line 1428 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2733 { // Boolean constants
2734 yyval.ConstVal = ConstantBool::False;
2738 #line 1431 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2739 { // Float & Double constants
2740 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
2741 ThrowException("Floating point constant invalid for type!!");
2742 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
2746 #line 1438 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2748 if (!yyvsp[-3].ConstVal->getType()->isFirstClassType())
2749 ThrowException("cast constant expression from a non-primitive type: '" +
2750 yyvsp[-3].ConstVal->getType()->getDescription() + "'!");
2751 if (!yyvsp[-1].TypeVal->get()->isFirstClassType())
2752 ThrowException("cast constant expression to a non-primitive type: '" +
2753 yyvsp[-1].TypeVal->get()->getDescription() + "'!");
2754 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get());
2755 delete yyvsp[-1].TypeVal;
2759 #line 1448 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2761 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
2762 ThrowException("GetElementPtr requires a pointer operand!");
2764 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
2765 // indices to uint struct indices for compatibility.
2766 generic_gep_type_iterator<std::vector<Value*>::iterator>
2767 GTI = gep_type_begin(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()),
2768 GTE = gep_type_end(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
2769 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
2770 if (isa<StructType>(*GTI)) // Only change struct indices
2771 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[-1].ValueList)[i]))
2772 if (CUI->getType() == Type::UByteTy)
2773 (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
2776 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true);
2778 ThrowException("Index list invalid for constant getelementptr!");
2780 std::vector<Constant*> IdxVec;
2781 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
2782 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
2783 IdxVec.push_back(C);
2785 ThrowException("Indices to constant getelementptr must be constants!");
2787 delete yyvsp[-1].ValueList;
2789 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec);
2793 #line 1479 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2795 if (yyvsp[-5].ConstVal->getType() != Type::BoolTy)
2796 ThrowException("Select condition must be of boolean type!");
2797 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2798 ThrowException("Select operand types must match!");
2799 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2803 #line 1486 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2805 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2806 ThrowException("Binary operator types must match!");
2807 // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
2808 // To retain backward compatibility with these early compilers, we emit a
2809 // cast to the appropriate integer type automatically if we are in the
2810 // broken case. See PR424 for more information.
2811 if (!isa<PointerType>(yyvsp[-3].ConstVal->getType())) {
2812 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2814 const Type *IntPtrTy = 0;
2815 switch (CurModule.CurrentModule->getPointerSize()) {
2816 case Module::Pointer32: IntPtrTy = Type::IntTy; break;
2817 case Module::Pointer64: IntPtrTy = Type::LongTy; break;
2818 default: ThrowException("invalid pointer binary constant expr!");
2820 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, ConstantExpr::getCast(yyvsp[-3].ConstVal, IntPtrTy),
2821 ConstantExpr::getCast(yyvsp[-1].ConstVal, IntPtrTy));
2822 yyval.ConstVal = ConstantExpr::getCast(yyval.ConstVal, yyvsp[-3].ConstVal->getType());
2827 #line 1507 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2829 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2830 ThrowException("Logical operator types must match!");
2831 if (!yyvsp[-3].ConstVal->getType()->isIntegral()) {
2832 if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) ||
2833 !cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral())
2834 ThrowException("Logical operator requires integral operands!");
2836 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2840 #line 1517 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2842 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
2843 ThrowException("setcc operand types must match!");
2844 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2848 #line 1522 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2850 if (yyvsp[-1].ConstVal->getType() != Type::UByteTy)
2851 ThrowException("Shift count for shift constant must be unsigned byte!");
2852 if (!yyvsp[-3].ConstVal->getType()->isInteger())
2853 ThrowException("Shift constant expression requires integer operand!");
2854 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2858 #line 1529 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2860 if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()))
2861 ThrowException("First operand of extractelement must be "
2863 if (yyvsp[-1].ConstVal->getType() != Type::UIntTy)
2864 ThrowException("Second operand of extractelement must be uint!");
2865 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
2869 #line 1539 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2871 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
2875 #line 1542 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2877 yyval.ConstVector = new std::vector<Constant*>();
2878 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
2882 #line 1549 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2883 { yyval.BoolVal = false; ;
2886 #line 1549 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2887 { yyval.BoolVal = true; ;
2890 #line 1559 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2892 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
2893 CurModule.ModuleDone();
2897 #line 1566 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2899 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2900 CurFun.FunctionDone();
2904 #line 1570 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2906 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2910 #line 1573 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2912 yyval.ModuleVal = yyvsp[-1].ModuleVal;
2916 #line 1576 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2918 yyval.ModuleVal = CurModule.CurrentModule;
2919 // Emit an error if there are any unresolved types left.
2920 if (!CurModule.LateResolveTypes.empty()) {
2921 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
2922 if (DID.Type == ValID::NameVal)
2923 ThrowException("Reference to an undefined type: '"+DID.getName() + "'");
2925 ThrowException("Reference to an undefined type: #" + itostr(DID.Num));
2930 #line 1589 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2932 // Eagerly resolve types. This is not an optimization, this is a
2933 // requirement that is due to the fact that we could have this:
2935 // %list = type { %list * }
2936 // %list = type { %list * } ; repeated type decl
2938 // If types are not resolved eagerly, then the two types will not be
2939 // determined to be the same type!
2941 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
2943 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
2944 // If this is a named type that is not a redefinition, add it to the slot
2946 CurModule.Types.push_back(*yyvsp[0].TypeVal);
2949 delete yyvsp[0].TypeVal;
2953 #line 1609 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2954 { // Function prototypes can be in const pool
2958 #line 1611 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2960 if (yyvsp[0].ConstVal == 0) ThrowException("Global value initializer is not a constant!");
2961 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal);
2965 #line 1614 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2971 #line 1617 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2973 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage,
2974 yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
2975 delete yyvsp[0].TypeVal;
2979 #line 1621 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2985 #line 1624 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2990 #line 1626 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
2995 #line 1628 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3000 #line 1633 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3001 { yyval.Endianness = Module::BigEndian; ;
3004 #line 1634 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3005 { yyval.Endianness = Module::LittleEndian; ;
3008 #line 1636 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3010 CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness);
3014 #line 1639 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3016 if (yyvsp[0].UInt64Val == 32)
3017 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
3018 else if (yyvsp[0].UInt64Val == 64)
3019 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
3021 ThrowException("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!");
3025 #line 1647 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3027 CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
3028 free(yyvsp[0].StrVal);
3032 #line 1654 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3034 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
3035 free(yyvsp[0].StrVal);
3039 #line 1658 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3041 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
3042 free(yyvsp[0].StrVal);
3046 #line 1662 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3051 #line 1671 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3052 { yyval.StrVal = 0; ;
3055 #line 1673 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3057 if (*yyvsp[-1].TypeVal == Type::VoidTy)
3058 ThrowException("void typed arguments are invalid!");
3059 yyval.ArgVal = new std::pair<PATypeHolder*, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
3063 #line 1679 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3065 yyval.ArgList = yyvsp[-2].ArgList;
3066 yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal);
3067 delete yyvsp[0].ArgVal;
3071 #line 1684 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3073 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
3074 yyval.ArgList->push_back(*yyvsp[0].ArgVal);
3075 delete yyvsp[0].ArgVal;
3079 #line 1690 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3081 yyval.ArgList = yyvsp[0].ArgList;
3085 #line 1693 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3087 yyval.ArgList = yyvsp[-2].ArgList;
3088 yyval.ArgList->push_back(std::pair<PATypeHolder*,
3089 char*>(new PATypeHolder(Type::VoidTy), 0));
3093 #line 1698 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3095 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
3096 yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
3100 #line 1702 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3106 #line 1707 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3108 UnEscapeLexed(yyvsp[-5].StrVal);
3109 std::string FunctionName(yyvsp[-5].StrVal);
3110 free(yyvsp[-5].StrVal); // Free strdup'd memory!
3112 if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy)
3113 ThrowException("LLVM functions cannot return aggregate types!");
3115 std::vector<const Type*> ParamTypeList;
3116 if (yyvsp[-3].ArgList) { // If there are arguments...
3117 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
3118 I != yyvsp[-3].ArgList->end(); ++I)
3119 ParamTypeList.push_back(I->first->get());
3122 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
3123 if (isVarArg) ParamTypeList.pop_back();
3125 const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg);
3126 const PointerType *PFT = PointerType::get(FT);
3127 delete yyvsp[-6].TypeVal;
3130 if (!FunctionName.empty()) {
3131 ID = ValID::create((char*)FunctionName.c_str());
3133 ID = ValID::create((int)CurModule.Values[PFT].size());
3137 // See if this function was forward referenced. If so, recycle the object.
3138 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
3139 // Move the function to the end of the list, from whereever it was
3140 // previously inserted.
3141 Fn = cast<Function>(FWRef);
3142 CurModule.CurrentModule->getFunctionList().remove(Fn);
3143 CurModule.CurrentModule->getFunctionList().push_back(Fn);
3144 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
3145 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
3146 // If this is the case, either we need to be a forward decl, or it needs
3148 if (!CurFun.isDeclare && !Fn->isExternal())
3149 ThrowException("Redefinition of function '" + FunctionName + "'!");
3151 // Make sure to strip off any argument names so we can't get conflicts.
3152 if (Fn->isExternal())
3153 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
3157 } else { // Not already defined?
3158 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
3159 CurModule.CurrentModule);
3160 InsertValue(Fn, CurModule.Values);
3163 CurFun.FunctionStart(Fn);
3164 Fn->setCallingConv(yyvsp[-7].UIntVal);
3165 Fn->setAlignment(yyvsp[0].UIntVal);
3166 if (yyvsp[-1].StrVal) {
3167 Fn->setSection(yyvsp[-1].StrVal);
3168 free(yyvsp[-1].StrVal);
3171 // Add all of the arguments we parsed to the function...
3172 if (yyvsp[-3].ArgList) { // Is null if empty...
3173 if (isVarArg) { // Nuke the last entry
3174 assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&&
3175 "Not a varargs marker!");
3176 delete yyvsp[-3].ArgList->back().first;
3177 yyvsp[-3].ArgList->pop_back(); // Delete the last entry
3179 Function::arg_iterator ArgIt = Fn->arg_begin();
3180 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
3181 I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) {
3182 delete I->first; // Delete the typeholder...
3184 setValueName(ArgIt, I->second); // Insert arg into symtab...
3188 delete yyvsp[-3].ArgList; // We're now done with the argument list
3193 #line 1794 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3195 yyval.FunctionVal = CurFun.CurrentFunction;
3197 // Make sure that we keep track of the linkage type even if there was a
3198 // previous "declare".
3199 yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage);
3203 #line 1804 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3205 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3209 #line 1808 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3210 { CurFun.isDeclare = true; ;
3213 #line 1808 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3215 yyval.FunctionVal = CurFun.CurrentFunction;
3216 CurFun.FunctionDone();
3220 #line 1817 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3221 { // A reference to a direct constant
3222 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
3226 #line 1820 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3228 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
3232 #line 1823 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3233 { // Perhaps it's an FP constant?
3234 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
3238 #line 1826 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3240 yyval.ValIDVal = ValID::create(ConstantBool::True);
3244 #line 1829 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3246 yyval.ValIDVal = ValID::create(ConstantBool::False);
3250 #line 1832 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3252 yyval.ValIDVal = ValID::createNull();
3256 #line 1835 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3258 yyval.ValIDVal = ValID::createUndef();
3262 #line 1838 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3263 { // A vector zero constant.
3264 yyval.ValIDVal = ValID::createZeroInit();
3268 #line 1841 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3269 { // Nonempty unsized packed vector
3270 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
3271 int NumElements = yyvsp[-1].ConstVector->size();
3273 PackedType* pt = PackedType::get(ETy, NumElements);
3274 PATypeHolder* PTy = new PATypeHolder(
3282 // Verify all elements are correct type!
3283 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3284 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3285 ThrowException("Element #" + utostr(i) + " is not of type '" +
3286 ETy->getDescription() +"' as required!\nIt is of type '" +
3287 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3290 yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector));
3291 delete PTy; delete yyvsp[-1].ConstVector;
3295 #line 1865 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3297 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
3301 #line 1872 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3302 { // Is it an integer reference...?
3303 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
3307 #line 1875 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3308 { // Is it a named reference...?
3309 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
3313 #line 1886 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3315 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal;
3319 #line 1890 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3321 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3325 #line 1893 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3326 { // Do not allow functions with 0 basic blocks
3327 yyval.FunctionVal = yyvsp[-1].FunctionVal;
3331 #line 1901 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3333 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
3334 InsertValue(yyvsp[0].TermInstVal);
3336 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
3337 InsertValue(yyvsp[-2].BasicBlockVal);
3338 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
3342 #line 1910 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3344 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
3345 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
3349 #line 1914 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3351 yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
3353 // Make sure to move the basic block to the correct location in the
3354 // function, instead of leaving it inserted wherever it was first
3356 Function::BasicBlockListType &BBL =
3357 CurFun.CurrentFunction->getBasicBlockList();
3358 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3362 #line 1924 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3364 yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true);
3366 // Make sure to move the basic block to the correct location in the
3367 // function, instead of leaving it inserted wherever it was first
3369 Function::BasicBlockListType &BBL =
3370 CurFun.CurrentFunction->getBasicBlockList();
3371 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3375 #line 1935 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3376 { // Return with a result...
3377 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
3381 #line 1938 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3382 { // Return with no result...
3383 yyval.TermInstVal = new ReturnInst();
3387 #line 1941 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3388 { // Unconditional Branch...
3389 yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[0].ValIDVal));
3393 #line 1944 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3395 yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[-3].ValIDVal), getBBVal(yyvsp[0].ValIDVal), getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
3399 #line 1947 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3401 SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal), getBBVal(yyvsp[-3].ValIDVal), yyvsp[-1].JumpTable->size());
3402 yyval.TermInstVal = S;
3404 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
3405 E = yyvsp[-1].JumpTable->end();
3406 for (; I != E; ++I) {
3407 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
3408 S->addCase(CI, I->second);
3410 ThrowException("Switch case is constant, but not a simple integer!");
3412 delete yyvsp[-1].JumpTable;
3416 #line 1961 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3418 SwitchInst *S = new SwitchInst(getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal), getBBVal(yyvsp[-2].ValIDVal), 0);
3419 yyval.TermInstVal = S;
3423 #line 1966 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3425 const PointerType *PFTy;
3426 const FunctionType *Ty;
3428 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal->get())) ||
3429 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3430 // Pull out the types of all of the arguments...
3431 std::vector<const Type*> ParamTypes;
3432 if (yyvsp[-7].ValueList) {
3433 for (std::vector<Value*>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
3435 ParamTypes.push_back((*I)->getType());
3438 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3439 if (isVarArg) ParamTypes.pop_back();
3441 Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg);
3442 PFTy = PointerType::get(Ty);
3445 Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling...
3447 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
3448 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
3450 // Create the call node...
3451 if (!yyvsp[-7].ValueList) { // Has no arguments?
3452 yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector<Value*>());
3453 } else { // Has arguments?
3454 // Loop through FunctionType's arguments and ensure they are specified
3457 FunctionType::param_iterator I = Ty->param_begin();
3458 FunctionType::param_iterator E = Ty->param_end();
3459 std::vector<Value*>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
3461 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3462 if ((*ArgI)->getType() != *I)
3463 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3464 (*I)->getDescription() + "'!");
3466 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3467 ThrowException("Invalid number of parameters detected!");
3469 yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList);
3471 cast<InvokeInst>(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal);
3473 delete yyvsp[-10].TypeVal;
3474 delete yyvsp[-7].ValueList;
3478 #line 2018 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3480 yyval.TermInstVal = new UnwindInst();
3484 #line 2021 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3486 yyval.TermInstVal = new UnreachableInst();
3490 #line 2027 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3492 yyval.JumpTable = yyvsp[-5].JumpTable;
3493 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3495 ThrowException("May only switch on a constant pool value!");
3497 yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal)));
3501 #line 2035 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3503 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
3504 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3507 ThrowException("May only switch on a constant pool value!");
3509 yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal)));
3513 #line 2045 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3515 // Is this definition named?? if so, assign the name...
3516 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
3517 InsertValue(yyvsp[0].InstVal);
3518 yyval.InstVal = yyvsp[0].InstVal;
3522 #line 2052 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3523 { // Used for PHI nodes
3524 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
3525 yyval.PHIList->push_back(std::make_pair(getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal), getBBVal(yyvsp[-1].ValIDVal)));
3526 delete yyvsp[-5].TypeVal;
3530 #line 2057 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3532 yyval.PHIList = yyvsp[-6].PHIList;
3533 yyvsp[-6].PHIList->push_back(std::make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal),
3534 getBBVal(yyvsp[-1].ValIDVal)));
3538 #line 2064 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3539 { // Used for call statements, and memory insts...
3540 yyval.ValueList = new std::vector<Value*>();
3541 yyval.ValueList->push_back(yyvsp[0].ValueVal);
3545 #line 2068 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3547 yyval.ValueList = yyvsp[-2].ValueList;
3548 yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
3552 #line 2074 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3553 { yyval.ValueList = 0; ;
3556 #line 2076 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3558 yyval.BoolVal = true;
3562 #line 2079 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3564 yyval.BoolVal = false;
3568 #line 2085 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3570 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
3571 !isa<PackedType>((*yyvsp[-3].TypeVal).get()))
3573 "Arithmetic operator requires integer, FP, or packed operands!");
3574 if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem)
3575 ThrowException("Rem not supported on packed types!");
3576 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3577 if (yyval.InstVal == 0)
3578 ThrowException("binary operator returned null!");
3579 delete yyvsp[-3].TypeVal;
3583 #line 2097 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3585 if (!(*yyvsp[-3].TypeVal)->isIntegral()) {
3586 if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) ||
3587 !cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral())
3588 ThrowException("Logical operator requires integral operands!");
3590 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3591 if (yyval.InstVal == 0)
3592 ThrowException("binary operator returned null!");
3593 delete yyvsp[-3].TypeVal;
3597 #line 2108 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3599 if(isa<PackedType>((*yyvsp[-3].TypeVal).get())) {
3601 "PackedTypes currently not supported in setcc instructions!");
3603 yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
3604 if (yyval.InstVal == 0)
3605 ThrowException("binary operator returned null!");
3606 delete yyvsp[-3].TypeVal;
3610 #line 2118 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3612 std::cerr << "WARNING: Use of eliminated 'not' instruction:"
3613 << " Replacing with 'xor'.\n";
3615 Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType());
3617 ThrowException("Expected integral type for not instruction!");
3619 yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones);
3620 if (yyval.InstVal == 0)
3621 ThrowException("Could not create a xor instruction!");
3625 #line 2130 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3627 if (yyvsp[0].ValueVal->getType() != Type::UByteTy)
3628 ThrowException("Shift amount must be ubyte!");
3629 if (!yyvsp[-2].ValueVal->getType()->isInteger())
3630 ThrowException("Shift constant expression requires integer operand!");
3631 yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3635 #line 2137 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3637 if (!yyvsp[0].TypeVal->get()->isFirstClassType())
3638 ThrowException("cast instruction to a non-primitive type: '" +
3639 yyvsp[0].TypeVal->get()->getDescription() + "'!");
3640 yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
3641 delete yyvsp[0].TypeVal;
3645 #line 2144 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3647 if (yyvsp[-4].ValueVal->getType() != Type::BoolTy)
3648 ThrowException("select condition must be boolean!");
3649 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
3650 ThrowException("select value types should match!");
3651 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3655 #line 2151 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3658 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
3659 delete yyvsp[0].TypeVal;
3663 #line 2156 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3665 ObsoleteVarArgs = true;
3666 const Type* ArgTy = yyvsp[-2].ValueVal->getType();
3667 Function* NF = CurModule.CurrentModule->
3668 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
3671 //foo = alloca 1 of t
3675 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
3676 CurBB->getInstList().push_back(foo);
3677 CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
3678 CurBB->getInstList().push_back(bar);
3679 CurBB->getInstList().push_back(new StoreInst(bar, foo));
3680 yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal);
3681 delete yyvsp[0].TypeVal;
3685 #line 2175 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3687 ObsoleteVarArgs = true;
3688 const Type* ArgTy = yyvsp[-2].ValueVal->getType();
3689 Function* NF = CurModule.CurrentModule->
3690 getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
3692 //b = vanext a, t ->
3693 //foo = alloca 1 of t
3696 //tmp = vaarg foo, t
3698 AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
3699 CurBB->getInstList().push_back(foo);
3700 CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
3701 CurBB->getInstList().push_back(bar);
3702 CurBB->getInstList().push_back(new StoreInst(bar, foo));
3703 Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal);
3704 CurBB->getInstList().push_back(tmp);
3705 yyval.InstVal = new LoadInst(foo);
3706 delete yyvsp[0].TypeVal;
3710 #line 2197 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3712 if (!isa<PackedType>(yyvsp[-2].ValueVal->getType()))
3713 ThrowException("First operand of extractelement must be "
3715 if (yyvsp[0].ValueVal->getType() != Type::UIntTy)
3716 ThrowException("Second operand of extractelement must be uint!");
3717 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3721 #line 2205 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3723 if (!isa<PackedType>(yyvsp[-4].ValueVal->getType()))
3724 ThrowException("First operand of insertelement must be "
3726 if (yyvsp[-2].ValueVal->getType() !=
3727 cast<PackedType>(yyvsp[-4].ValueVal->getType())->getElementType())
3728 ThrowException("Second operand of insertelement must be "
3729 "packed element type!");
3730 if (yyvsp[0].ValueVal->getType() != Type::UIntTy)
3731 ThrowException("Third operand of insertelement must be uint!");
3732 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
3736 #line 2217 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3738 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
3739 if (!Ty->isFirstClassType())
3740 ThrowException("PHI node operands must be of first class type!");
3741 yyval.InstVal = new PHINode(Ty);
3742 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
3743 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
3744 if (yyvsp[0].PHIList->front().first->getType() != Ty)
3745 ThrowException("All elements of a PHI node must be of the same type!");
3746 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
3747 yyvsp[0].PHIList->pop_front();
3749 delete yyvsp[0].PHIList; // Free the list...
3753 #line 2231 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3755 const PointerType *PFTy;
3756 const FunctionType *Ty;
3758 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal->get())) ||
3759 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3760 // Pull out the types of all of the arguments...
3761 std::vector<const Type*> ParamTypes;
3762 if (yyvsp[-1].ValueList) {
3763 for (std::vector<Value*>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
3765 ParamTypes.push_back((*I)->getType());
3768 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3769 if (isVarArg) ParamTypes.pop_back();
3771 if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy)
3772 ThrowException("LLVM functions cannot return aggregate types!");
3774 Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg);
3775 PFTy = PointerType::get(Ty);
3778 Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling...
3780 // Create the call node...
3781 if (!yyvsp[-1].ValueList) { // Has no arguments?
3782 // Make sure no arguments is a good thing!
3783 if (Ty->getNumParams() != 0)
3784 ThrowException("No arguments passed to a function that "
3785 "expects arguments!");
3787 yyval.InstVal = new CallInst(V, std::vector<Value*>());
3788 } else { // Has arguments?
3789 // Loop through FunctionType's arguments and ensure they are specified
3792 FunctionType::param_iterator I = Ty->param_begin();
3793 FunctionType::param_iterator E = Ty->param_end();
3794 std::vector<Value*>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
3796 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3797 if ((*ArgI)->getType() != *I)
3798 ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3799 (*I)->getDescription() + "'!");
3801 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3802 ThrowException("Invalid number of parameters detected!");
3804 yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList);
3806 cast<CallInst>(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal);
3807 cast<CallInst>(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal);
3808 delete yyvsp[-4].TypeVal;
3809 delete yyvsp[-1].ValueList;
3813 #line 2288 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3815 yyval.InstVal = yyvsp[0].InstVal;
3819 #line 2294 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3821 yyval.ValueList = yyvsp[0].ValueList;
3825 #line 2296 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3827 yyval.ValueList = new std::vector<Value*>();
3831 #line 2300 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3833 yyval.BoolVal = true;
3837 #line 2303 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3839 yyval.BoolVal = false;
3843 #line 2309 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3845 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
3846 delete yyvsp[-1].TypeVal;
3850 #line 2313 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3852 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
3853 delete yyvsp[-4].TypeVal;
3857 #line 2317 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3859 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
3860 delete yyvsp[-1].TypeVal;
3864 #line 2321 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3866 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
3867 delete yyvsp[-4].TypeVal;
3871 #line 2325 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3873 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
3874 ThrowException("Trying to free nonpointer type " +
3875 yyvsp[0].ValueVal->getType()->getDescription() + "!");
3876 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
3880 #line 2332 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3882 if (!isa<PointerType>(yyvsp[-1].TypeVal->get()))
3883 ThrowException("Can't load from nonpointer type: " +
3884 (*yyvsp[-1].TypeVal)->getDescription());
3885 if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType())
3886 ThrowException("Can't load from pointer of non-first-class type: " +
3887 (*yyvsp[-1].TypeVal)->getDescription());
3888 yyval.InstVal = new LoadInst(getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), "", yyvsp[-3].BoolVal);
3889 delete yyvsp[-1].TypeVal;
3893 #line 2342 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3895 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3897 ThrowException("Can't store to a nonpointer type: " +
3898 (*yyvsp[-1].TypeVal)->getDescription());
3899 const Type *ElTy = PT->getElementType();
3900 if (ElTy != yyvsp[-3].ValueVal->getType())
3901 ThrowException("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() +
3902 "' into space of type '" + ElTy->getDescription() + "'!");
3904 yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), yyvsp[-5].BoolVal);
3905 delete yyvsp[-1].TypeVal;
3909 #line 2355 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
3911 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
3912 ThrowException("getelementptr insn requires pointer operand!");
3914 // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct
3915 // indices to uint struct indices for compatibility.
3916 generic_gep_type_iterator<std::vector<Value*>::iterator>
3917 GTI = gep_type_begin(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()),
3918 GTE = gep_type_end(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
3919 for (unsigned i = 0, e = yyvsp[0].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
3920 if (isa<StructType>(*GTI)) // Only change struct indices
3921 if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[0].ValueList)[i]))
3922 if (CUI->getType() == Type::UByteTy)
3923 (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3925 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true))
3926 ThrowException("Invalid getelementptr indices for type '" +
3927 (*yyvsp[-2].TypeVal)->getDescription()+ "'!");
3928 yyval.InstVal = new GetElementPtrInst(getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ValueList);
3929 delete yyvsp[-2].TypeVal; delete yyvsp[0].ValueList;
3933 /* the action file gets copied in in place of this dollarsign */
3934 #line 543 "/usr/share/bison.simple"
3945 short *ssp1 = yyss - 1;
3946 fprintf (stderr, "state stack now");
3947 while (ssp1 != yyssp)
3948 fprintf (stderr, " %d", *++ssp1);
3949 fprintf (stderr, "\n");
3959 yylsp->first_line = yylloc.first_line;
3960 yylsp->first_column = yylloc.first_column;
3961 yylsp->last_line = (yylsp-1)->last_line;
3962 yylsp->last_column = (yylsp-1)->last_column;
3967 yylsp->last_line = (yylsp+yylen-1)->last_line;
3968 yylsp->last_column = (yylsp+yylen-1)->last_column;
3972 /* Now "shift" the result of the reduction.
3973 Determine what state that goes to,
3974 based on the state we popped back to
3975 and the rule number reduced by. */
3979 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
3980 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3981 yystate = yytable[yystate];
3983 yystate = yydefgoto[yyn - YYNTBASE];
3987 yyerrlab: /* here on detecting error */
3990 /* If not already recovering from an error, report this error. */
3994 #ifdef YYERROR_VERBOSE
3995 yyn = yypact[yystate];
3997 if (yyn > YYFLAG && yyn < YYLAST)
4004 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4005 for (x = (yyn < 0 ? -yyn : 0);
4006 x < (sizeof(yytname) / sizeof(char *)); x++)
4007 if (yycheck[x + yyn] == x)
4008 size += strlen(yytname[x]) + 15, count++;
4009 msg = (char *) malloc(size + 15);
4012 strcpy(msg, "parse error");
4017 for (x = (yyn < 0 ? -yyn : 0);
4018 x < (sizeof(yytname) / sizeof(char *)); x++)
4019 if (yycheck[x + yyn] == x)
4021 strcat(msg, count == 0 ? ", expecting `" : " or `");
4022 strcat(msg, yytname[x]);
4031 yyerror ("parse error; also virtual memory exceeded");
4034 #endif /* YYERROR_VERBOSE */
4035 yyerror("parse error");
4039 yyerrlab1: /* here on error raised explicitly by an action */
4041 if (yyerrstatus == 3)
4043 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4045 /* return failure if at end of input */
4046 if (yychar == YYEOF)
4051 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4057 /* Else will try to reuse lookahead token
4058 after shifting the error token. */
4060 yyerrstatus = 3; /* Each real token shifted decrements this */
4064 yyerrdefault: /* current state does not do anything special for the error token. */
4067 /* This is wrong; only states that explicitly want error tokens
4068 should shift them. */
4069 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4070 if (yyn) goto yydefault;
4073 yyerrpop: /* pop the current state because it cannot handle the error token */
4075 if (yyssp == yyss) YYABORT;
4085 short *ssp1 = yyss - 1;
4086 fprintf (stderr, "Error: state stack now");
4087 while (ssp1 != yyssp)
4088 fprintf (stderr, " %d", *++ssp1);
4089 fprintf (stderr, "\n");
4095 yyn = yypact[yystate];
4100 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
4119 fprintf(stderr, "Shifting error token, ");
4131 /* YYACCEPT comes here. */
4143 /* YYABORT comes here. */
4154 #line 2378 "/Users/bocchino/llvm-checkin/src/lib/AsmParser/llvmAsmParser.y"
4156 int yyerror(const char *ErrorMsg) {
4158 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4159 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
4160 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
4161 if (yychar == YYEMPTY || yychar == 0)
4162 errMsg += "end-of-file.";
4164 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
4165 ThrowException(errMsg);