2 /* A Bison parser, made from /Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
16 #define ESAPINTVAL 259
17 #define EUAPINTVAL 260
18 #define LOCALVAL_ID 261
19 #define GLOBALVAL_ID 262
33 #define STRINGCONSTANT 276
34 #define ATSTRINGCONSTANT 277
35 #define PCTSTRINGCONSTANT 278
36 #define ZEROINITIALIZER 279
48 #define THREAD_LOCAL 291
59 #define EXTERN_WEAK 302
70 #define SIDEEFFECT 313
73 #define FASTCC_TOK 316
74 #define COLDCC_TOK 317
75 #define X86_STDCALLCC_TOK 318
76 #define X86_FASTCALLCC_TOK 319
77 #define DATALAYOUT 320
83 #define UNREACHABLE 326
126 #define GETELEMENTPTR 369
142 #define EXTRACTELEMENT 385
143 #define INSERTELEMENT 386
144 #define SHUFFLEVECTOR 387
156 #define PROTECTED 399
158 #line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
160 #include "ParserInternals.h"
161 #include "llvm/CallingConv.h"
162 #include "llvm/InlineAsm.h"
163 #include "llvm/Instructions.h"
164 #include "llvm/Module.h"
165 #include "llvm/ValueSymbolTable.h"
166 #include "llvm/Support/GetElementPtrTypeIterator.h"
167 #include "llvm/Support/CommandLine.h"
168 #include "llvm/ADT/SmallVector.h"
169 #include "llvm/ADT/STLExtras.h"
170 #include "llvm/Support/MathExtras.h"
171 #include "llvm/Support/Streams.h"
180 // The following is a gross hack. In order to rid the libAsmParser library of
181 // exceptions, we have to have a way of getting the yyparse function to go into
182 // an error situation. So, whenever we want an error to occur, the GenerateError
183 // function (see bottom of file) sets TriggerError. Then, at the end of each
184 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
185 // (a goto) to put YACC in error state. Furthermore, several calls to
186 // GenerateError are made from inside productions and they must simulate the
187 // previous exception behavior by exiting the production immediately. We have
188 // replaced these with the GEN_ERROR macro which calls GeneratError and then
189 // immediately invokes YYERROR. This would be so much cleaner if it was a
190 // recursive descent parser.
191 static bool TriggerError = false;
192 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
193 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
195 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
196 int yylex(); // declaration" of xxx warnings.
200 std::string CurFilename;
203 Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
204 cl::Hidden, cl::init(false));
207 using namespace llvm;
209 static Module *ParserResult;
211 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
212 // relating to upreferences in the input stream.
214 //#define DEBUG_UPREFS 1
216 #define UR_OUT(X) cerr << X
221 #define YYERROR_VERBOSE 1
223 static GlobalVariable *CurGV;
226 // This contains info used when building the body of a function. It is
227 // destroyed when the function is completed.
229 typedef std::vector<Value *> ValueList; // Numbered defs
232 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
234 static struct PerModuleInfo {
235 Module *CurrentModule;
236 ValueList Values; // Module level numbered definitions
237 ValueList LateResolveValues;
238 std::vector<PATypeHolder> Types;
239 std::map<ValID, PATypeHolder> LateResolveTypes;
241 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
242 /// how they were referenced and on which line of the input they came from so
243 /// that we can resolve them later and print error messages as appropriate.
244 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
246 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
247 // references to global values. Global values may be referenced before they
248 // are defined, and if so, the temporary object that they represent is held
249 // here. This is used for forward references of GlobalValues.
251 typedef std::map<std::pair<const PointerType *,
252 ValID>, GlobalValue*> GlobalRefsType;
253 GlobalRefsType GlobalRefs;
256 // If we could not resolve some functions at function compilation time
257 // (calls to functions before they are defined), resolve them now... Types
258 // are resolved when the constant pool has been completely parsed.
260 ResolveDefinitions(LateResolveValues);
264 // Check to make sure that all global value forward references have been
267 if (!GlobalRefs.empty()) {
268 std::string UndefinedReferences = "Unresolved global references exist:\n";
270 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
272 UndefinedReferences += " " + I->first.first->getDescription() + " " +
273 I->first.second.getName() + "\n";
275 GenerateError(UndefinedReferences);
279 Values.clear(); // Clear out function local definitions
284 // GetForwardRefForGlobal - Check to see if there is a forward reference
285 // for this global. If so, remove it from the GlobalRefs map and return it.
286 // If not, just return null.
287 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
288 // Check to see if there is a forward reference to this global variable...
289 // if there is, eliminate it and patch the reference to use the new def'n.
290 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
291 GlobalValue *Ret = 0;
292 if (I != GlobalRefs.end()) {
299 bool TypeIsUnresolved(PATypeHolder* PATy) {
300 // If it isn't abstract, its resolved
301 const Type* Ty = PATy->get();
302 if (!Ty->isAbstract())
304 // Traverse the type looking for abstract types. If it isn't abstract then
305 // we don't need to traverse that leg of the type.
306 std::vector<const Type*> WorkList, SeenList;
307 WorkList.push_back(Ty);
308 while (!WorkList.empty()) {
309 const Type* Ty = WorkList.back();
310 SeenList.push_back(Ty);
312 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
313 // Check to see if this is an unresolved type
314 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
315 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
316 for ( ; I != E; ++I) {
317 if (I->second.get() == OpTy)
320 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
321 const Type* TheTy = SeqTy->getElementType();
322 if (TheTy->isAbstract() && TheTy != Ty) {
323 std::vector<const Type*>::iterator I = SeenList.begin(),
329 WorkList.push_back(TheTy);
331 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
332 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
333 const Type* TheTy = StrTy->getElementType(i);
334 if (TheTy->isAbstract() && TheTy != Ty) {
335 std::vector<const Type*>::iterator I = SeenList.begin(),
341 WorkList.push_back(TheTy);
350 static struct PerFunctionInfo {
351 Function *CurrentFunction; // Pointer to current function being created
353 ValueList Values; // Keep track of #'d definitions
355 ValueList LateResolveValues;
356 bool isDeclare; // Is this function a forward declararation?
357 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
358 GlobalValue::VisibilityTypes Visibility;
360 /// BBForwardRefs - When we see forward references to basic blocks, keep
361 /// track of them here.
362 std::map<ValID, BasicBlock*> BBForwardRefs;
364 inline PerFunctionInfo() {
367 Linkage = GlobalValue::ExternalLinkage;
368 Visibility = GlobalValue::DefaultVisibility;
371 inline void FunctionStart(Function *M) {
376 void FunctionDone() {
377 // Any forward referenced blocks left?
378 if (!BBForwardRefs.empty()) {
379 GenerateError("Undefined reference to label " +
380 BBForwardRefs.begin()->second->getName());
384 // Resolve all forward references now.
385 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
387 Values.clear(); // Clear out function local definitions
388 BBForwardRefs.clear();
391 Linkage = GlobalValue::ExternalLinkage;
392 Visibility = GlobalValue::DefaultVisibility;
394 } CurFun; // Info for the current function...
396 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
399 //===----------------------------------------------------------------------===//
400 // Code to handle definitions of all the types
401 //===----------------------------------------------------------------------===//
403 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
404 // Things that have names or are void typed don't get slot numbers
405 if (V->hasName() || (V->getType() == Type::VoidTy))
408 // In the case of function values, we have to allow for the forward reference
409 // of basic blocks, which are included in the numbering. Consequently, we keep
410 // track of the next insertion location with NextValNum. When a BB gets
411 // inserted, it could change the size of the CurFun.Values vector.
412 if (&ValueTab == &CurFun.Values) {
413 if (ValueTab.size() <= CurFun.NextValNum)
414 ValueTab.resize(CurFun.NextValNum+1);
415 ValueTab[CurFun.NextValNum++] = V;
418 // For all other lists, its okay to just tack it on the back of the vector.
419 ValueTab.push_back(V);
422 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
424 case ValID::LocalID: // Is it a numbered definition?
425 // Module constants occupy the lowest numbered slots...
426 if (D.Num < CurModule.Types.size())
427 return CurModule.Types[D.Num];
429 case ValID::LocalName: // Is it a named definition?
430 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
431 D.destroy(); // Free old strdup'd memory...
436 GenerateError("Internal parser error: Invalid symbol type reference");
440 // If we reached here, we referenced either a symbol that we don't know about
441 // or an id number that hasn't been read yet. We may be referencing something
442 // forward, so just create an entry to be resolved later and get to it...
444 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
447 if (inFunctionScope()) {
448 if (D.Type == ValID::LocalName) {
449 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
452 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
457 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
458 if (I != CurModule.LateResolveTypes.end())
461 Type *Typ = OpaqueType::get();
462 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
466 // getExistingVal - Look up the value specified by the provided type and
467 // the provided ValID. If the value exists and has already been defined, return
468 // it. Otherwise return null.
470 static Value *getExistingVal(const Type *Ty, const ValID &D) {
471 if (isa<FunctionType>(Ty)) {
472 GenerateError("Functions are not values and "
473 "must be referenced as pointers");
478 case ValID::LocalID: { // Is it a numbered definition?
479 // Check that the number is within bounds.
480 if (D.Num >= CurFun.Values.size())
482 Value *Result = CurFun.Values[D.Num];
483 if (Ty != Result->getType()) {
484 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
485 Result->getType()->getDescription() + "' does not match "
486 "expected type, '" + Ty->getDescription() + "'");
491 case ValID::GlobalID: { // Is it a numbered definition?
492 if (D.Num >= CurModule.Values.size())
494 Value *Result = CurModule.Values[D.Num];
495 if (Ty != Result->getType()) {
496 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
497 Result->getType()->getDescription() + "' does not match "
498 "expected type, '" + Ty->getDescription() + "'");
504 case ValID::LocalName: { // Is it a named definition?
505 if (!inFunctionScope())
507 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
508 Value *N = SymTab.lookup(D.getName());
511 if (N->getType() != Ty)
514 D.destroy(); // Free old strdup'd memory...
517 case ValID::GlobalName: { // Is it a named definition?
518 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
519 Value *N = SymTab.lookup(D.getName());
522 if (N->getType() != Ty)
525 D.destroy(); // Free old strdup'd memory...
529 // Check to make sure that "Ty" is an integral type, and that our
530 // value will fit into the specified type...
531 case ValID::ConstSIntVal: // Is it a constant pool reference??
532 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
533 GenerateError("Signed integral constant '" +
534 itostr(D.ConstPool64) + "' is invalid for type '" +
535 Ty->getDescription() + "'");
538 return ConstantInt::get(Ty, D.ConstPool64, true);
540 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
541 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
542 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
543 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
544 "' is invalid or out of range");
546 } else { // This is really a signed reference. Transmogrify.
547 return ConstantInt::get(Ty, D.ConstPool64, true);
550 return ConstantInt::get(Ty, D.UConstPool64);
553 case ValID::ConstFPVal: // Is it a floating point const pool reference?
554 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
555 GenerateError("FP constant invalid for type");
558 return ConstantFP::get(Ty, D.ConstPoolFP);
560 case ValID::ConstNullVal: // Is it a null value?
561 if (!isa<PointerType>(Ty)) {
562 GenerateError("Cannot create a a non pointer null");
565 return ConstantPointerNull::get(cast<PointerType>(Ty));
567 case ValID::ConstUndefVal: // Is it an undef value?
568 return UndefValue::get(Ty);
570 case ValID::ConstZeroVal: // Is it a zero value?
571 return Constant::getNullValue(Ty);
573 case ValID::ConstantVal: // Fully resolved constant?
574 if (D.ConstantValue->getType() != Ty) {
575 GenerateError("Constant expression type different from required type");
578 return D.ConstantValue;
580 case ValID::InlineAsmVal: { // Inline asm expression
581 const PointerType *PTy = dyn_cast<PointerType>(Ty);
582 const FunctionType *FTy =
583 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
584 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
585 GenerateError("Invalid type for asm constraint string");
588 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
589 D.IAD->HasSideEffects);
590 D.destroy(); // Free InlineAsmDescriptor.
594 assert(0 && "Unhandled case!");
598 assert(0 && "Unhandled case!");
602 // getVal - This function is identical to getExistingVal, except that if a
603 // value is not already defined, it "improvises" by creating a placeholder var
604 // that looks and acts just like the requested variable. When the value is
605 // defined later, all uses of the placeholder variable are replaced with the
608 static Value *getVal(const Type *Ty, const ValID &ID) {
609 if (Ty == Type::LabelTy) {
610 GenerateError("Cannot use a basic block here");
614 // See if the value has already been defined.
615 Value *V = getExistingVal(Ty, ID);
617 if (TriggerError) return 0;
619 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
620 GenerateError("Invalid use of a composite type");
624 // If we reached here, we referenced either a symbol that we don't know about
625 // or an id number that hasn't been read yet. We may be referencing something
626 // forward, so just create an entry to be resolved later and get to it...
629 case ValID::GlobalName:
630 case ValID::GlobalID: {
631 const PointerType *PTy = dyn_cast<PointerType>(Ty);
633 GenerateError("Invalid type for reference to global" );
636 const Type* ElTy = PTy->getElementType();
637 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
638 V = new Function(FTy, GlobalValue::ExternalLinkage);
640 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
644 V = new Argument(Ty);
647 // Remember where this forward reference came from. FIXME, shouldn't we try
648 // to recycle these things??
649 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
652 if (inFunctionScope())
653 InsertValue(V, CurFun.LateResolveValues);
655 InsertValue(V, CurModule.LateResolveValues);
659 /// defineBBVal - This is a definition of a new basic block with the specified
660 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
661 static BasicBlock *defineBBVal(const ValID &ID) {
662 assert(inFunctionScope() && "Can't get basic block at global scope!");
666 // First, see if this was forward referenced
668 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
669 if (BBI != CurFun.BBForwardRefs.end()) {
671 // The forward declaration could have been inserted anywhere in the
672 // function: insert it into the correct place now.
673 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
674 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
676 // We're about to erase the entry, save the key so we can clean it up.
677 ValID Tmp = BBI->first;
679 // Erase the forward ref from the map as its no longer "forward"
680 CurFun.BBForwardRefs.erase(ID);
682 // The key has been removed from the map but so we don't want to leave
683 // strdup'd memory around so destroy it too.
686 // If its a numbered definition, bump the number and set the BB value.
687 if (ID.Type == ValID::LocalID) {
688 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
696 // We haven't seen this BB before and its first mention is a definition.
697 // Just create it and return it.
698 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
699 BB = new BasicBlock(Name, CurFun.CurrentFunction);
700 if (ID.Type == ValID::LocalID) {
701 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
705 ID.destroy(); // Free strdup'd memory
709 /// getBBVal - get an existing BB value or create a forward reference for it.
711 static BasicBlock *getBBVal(const ValID &ID) {
712 assert(inFunctionScope() && "Can't get basic block at global scope!");
716 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
717 if (BBI != CurFun.BBForwardRefs.end()) {
719 } if (ID.Type == ValID::LocalName) {
720 std::string Name = ID.getName();
721 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
723 if (N->getType()->getTypeID() == Type::LabelTyID)
724 BB = cast<BasicBlock>(N);
726 GenerateError("Reference to label '" + Name + "' is actually of type '"+
727 N->getType()->getDescription() + "'");
728 } else if (ID.Type == ValID::LocalID) {
729 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
730 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
731 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
733 GenerateError("Reference to label '%" + utostr(ID.Num) +
734 "' is actually of type '"+
735 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
738 GenerateError("Illegal label reference " + ID.getName());
742 // If its already been defined, return it now.
744 ID.destroy(); // Free strdup'd memory.
748 // Otherwise, this block has not been seen before, create it.
750 if (ID.Type == ValID::LocalName)
752 BB = new BasicBlock(Name, CurFun.CurrentFunction);
754 // Insert it in the forward refs map.
755 CurFun.BBForwardRefs[ID] = BB;
761 //===----------------------------------------------------------------------===//
762 // Code to handle forward references in instructions
763 //===----------------------------------------------------------------------===//
765 // This code handles the late binding needed with statements that reference
766 // values not defined yet... for example, a forward branch, or the PHI node for
769 // This keeps a table (CurFun.LateResolveValues) of all such forward references
770 // and back patchs after we are done.
773 // ResolveDefinitions - If we could not resolve some defs at parsing
774 // time (forward branches, phi functions for loops, etc...) resolve the
778 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
779 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
780 while (!LateResolvers.empty()) {
781 Value *V = LateResolvers.back();
782 LateResolvers.pop_back();
784 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
785 CurModule.PlaceHolderInfo.find(V);
786 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
788 ValID &DID = PHI->second.first;
790 Value *TheRealValue = getExistingVal(V->getType(), DID);
794 V->replaceAllUsesWith(TheRealValue);
796 CurModule.PlaceHolderInfo.erase(PHI);
797 } else if (FutureLateResolvers) {
798 // Functions have their unresolved items forwarded to the module late
800 InsertValue(V, *FutureLateResolvers);
802 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
803 GenerateError("Reference to an invalid definition: '" +DID.getName()+
804 "' of type '" + V->getType()->getDescription() + "'",
808 GenerateError("Reference to an invalid definition: #" +
809 itostr(DID.Num) + " of type '" +
810 V->getType()->getDescription() + "'",
816 LateResolvers.clear();
819 // ResolveTypeTo - A brand new type was just declared. This means that (if
820 // name is not null) things referencing Name can be resolved. Otherwise, things
821 // refering to the number can be resolved. Do this now.
823 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
826 D = ValID::createLocalName(*Name);
828 D = ValID::createLocalID(CurModule.Types.size());
830 std::map<ValID, PATypeHolder>::iterator I =
831 CurModule.LateResolveTypes.find(D);
832 if (I != CurModule.LateResolveTypes.end()) {
833 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
834 CurModule.LateResolveTypes.erase(I);
838 // setValueName - Set the specified value to the name given. The name may be
839 // null potentially, in which case this is a noop. The string passed in is
840 // assumed to be a malloc'd string buffer, and is free'd by this function.
842 static void setValueName(Value *V, std::string *NameStr) {
843 if (!NameStr) return;
844 std::string Name(*NameStr); // Copy string
845 delete NameStr; // Free old string
847 if (V->getType() == Type::VoidTy) {
848 GenerateError("Can't assign name '" + Name+"' to value with void type");
852 assert(inFunctionScope() && "Must be in function scope!");
853 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
854 if (ST.lookup(Name)) {
855 GenerateError("Redefinition of value '" + Name + "' of type '" +
856 V->getType()->getDescription() + "'");
864 /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
865 /// this is a declaration, otherwise it is a definition.
866 static GlobalVariable *
867 ParseGlobalVariable(std::string *NameStr,
868 GlobalValue::LinkageTypes Linkage,
869 GlobalValue::VisibilityTypes Visibility,
870 bool isConstantGlobal, const Type *Ty,
871 Constant *Initializer, bool IsThreadLocal) {
872 if (isa<FunctionType>(Ty)) {
873 GenerateError("Cannot declare global vars of function type");
877 const PointerType *PTy = PointerType::get(Ty);
881 Name = *NameStr; // Copy string
882 delete NameStr; // Free old string
885 // See if this global value was forward referenced. If so, recycle the
889 ID = ValID::createGlobalName(Name);
891 ID = ValID::createGlobalID(CurModule.Values.size());
894 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
895 // Move the global to the end of the list, from whereever it was
896 // previously inserted.
897 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
898 CurModule.CurrentModule->getGlobalList().remove(GV);
899 CurModule.CurrentModule->getGlobalList().push_back(GV);
900 GV->setInitializer(Initializer);
901 GV->setLinkage(Linkage);
902 GV->setVisibility(Visibility);
903 GV->setConstant(isConstantGlobal);
904 GV->setThreadLocal(IsThreadLocal);
905 InsertValue(GV, CurModule.Values);
909 // If this global has a name
911 // if the global we're parsing has an initializer (is a definition) and
912 // has external linkage.
913 if (Initializer && Linkage != GlobalValue::InternalLinkage)
914 // If there is already a global with external linkage with this name
915 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
916 // If we allow this GVar to get created, it will be renamed in the
917 // symbol table because it conflicts with an existing GVar. We can't
918 // allow redefinition of GVars whose linking indicates that their name
919 // must stay the same. Issue the error.
920 GenerateError("Redefinition of global variable named '" + Name +
921 "' of type '" + Ty->getDescription() + "'");
926 // Otherwise there is no existing GV to use, create one now.
928 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
929 CurModule.CurrentModule, IsThreadLocal);
930 GV->setVisibility(Visibility);
931 InsertValue(GV, CurModule.Values);
935 // setTypeName - Set the specified type to the name given. The name may be
936 // null potentially, in which case this is a noop. The string passed in is
937 // assumed to be a malloc'd string buffer, and is freed by this function.
939 // This function returns true if the type has already been defined, but is
940 // allowed to be redefined in the specified context. If the name is a new name
941 // for the type plane, it is inserted and false is returned.
942 static bool setTypeName(const Type *T, std::string *NameStr) {
943 assert(!inFunctionScope() && "Can't give types function-local names!");
944 if (NameStr == 0) return false;
946 std::string Name(*NameStr); // Copy string
947 delete NameStr; // Free old string
949 // We don't allow assigning names to void type
950 if (T == Type::VoidTy) {
951 GenerateError("Can't assign name '" + Name + "' to the void type");
955 // Set the type name, checking for conflicts as we do so.
956 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
958 if (AlreadyExists) { // Inserting a name that is already defined???
959 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
960 assert(Existing && "Conflict but no matching type?!");
962 // There is only one case where this is allowed: when we are refining an
963 // opaque type. In this case, Existing will be an opaque type.
964 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
965 // We ARE replacing an opaque type!
966 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
970 // Otherwise, this is an attempt to redefine a type. That's okay if
971 // the redefinition is identical to the original. This will be so if
972 // Existing and T point to the same Type object. In this one case we
973 // allow the equivalent redefinition.
974 if (Existing == T) return true; // Yes, it's equal.
976 // Any other kind of (non-equivalent) redefinition is an error.
977 GenerateError("Redefinition of type named '" + Name + "' of type '" +
978 T->getDescription() + "'");
984 //===----------------------------------------------------------------------===//
985 // Code for handling upreferences in type names...
988 // TypeContains - Returns true if Ty directly contains E in it.
990 static bool TypeContains(const Type *Ty, const Type *E) {
991 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
992 E) != Ty->subtype_end();
997 // NestingLevel - The number of nesting levels that need to be popped before
998 // this type is resolved.
999 unsigned NestingLevel;
1001 // LastContainedTy - This is the type at the current binding level for the
1002 // type. Every time we reduce the nesting level, this gets updated.
1003 const Type *LastContainedTy;
1005 // UpRefTy - This is the actual opaque type that the upreference is
1006 // represented with.
1007 OpaqueType *UpRefTy;
1009 UpRefRecord(unsigned NL, OpaqueType *URTy)
1010 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1014 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1015 static std::vector<UpRefRecord> UpRefs;
1017 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1018 /// called. It loops through the UpRefs vector, which is a list of the
1019 /// currently active types. For each type, if the up reference is contained in
1020 /// the newly completed type, we decrement the level count. When the level
1021 /// count reaches zero, the upreferenced type is the type that is passed in:
1022 /// thus we can complete the cycle.
1024 static PATypeHolder HandleUpRefs(const Type *ty) {
1025 // If Ty isn't abstract, or if there are no up-references in it, then there is
1026 // nothing to resolve here.
1027 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1029 PATypeHolder Ty(ty);
1030 UR_OUT("Type '" << Ty->getDescription() <<
1031 "' newly formed. Resolving upreferences.\n" <<
1032 UpRefs.size() << " upreferences active!\n");
1034 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1035 // to zero), we resolve them all together before we resolve them to Ty. At
1036 // the end of the loop, if there is anything to resolve to Ty, it will be in
1038 OpaqueType *TypeToResolve = 0;
1040 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1041 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1042 << UpRefs[i].second->getDescription() << ") = "
1043 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1044 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1045 // Decrement level of upreference
1046 unsigned Level = --UpRefs[i].NestingLevel;
1047 UpRefs[i].LastContainedTy = Ty;
1048 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1049 if (Level == 0) { // Upreference should be resolved!
1050 if (!TypeToResolve) {
1051 TypeToResolve = UpRefs[i].UpRefTy;
1053 UR_OUT(" * Resolving upreference for "
1054 << UpRefs[i].second->getDescription() << "\n";
1055 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1056 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1057 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1058 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1060 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1061 --i; // Do not skip the next element...
1066 if (TypeToResolve) {
1067 UR_OUT(" * Resolving upreference for "
1068 << UpRefs[i].second->getDescription() << "\n";
1069 std::string OldName = TypeToResolve->getDescription());
1070 TypeToResolve->refineAbstractTypeTo(Ty);
1076 //===----------------------------------------------------------------------===//
1077 // RunVMAsmParser - Define an interface to this parser
1078 //===----------------------------------------------------------------------===//
1080 static Module* RunParser(Module * M);
1082 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1085 CurFilename = Filename;
1086 return RunParser(new Module(CurFilename));
1089 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1090 set_scan_string(AsmString);
1092 CurFilename = "from_memory";
1094 return RunParser(new Module (CurFilename));
1096 return RunParser(M);
1101 #line 957 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
1103 llvm::Module *ModuleVal;
1104 llvm::Function *FunctionVal;
1105 llvm::BasicBlock *BasicBlockVal;
1106 llvm::TerminatorInst *TermInstVal;
1107 llvm::Instruction *InstVal;
1108 llvm::Constant *ConstVal;
1110 const llvm::Type *PrimType;
1111 std::list<llvm::PATypeHolder> *TypeList;
1112 llvm::PATypeHolder *TypeVal;
1113 llvm::Value *ValueVal;
1114 std::vector<llvm::Value*> *ValueList;
1115 llvm::ArgListType *ArgList;
1116 llvm::TypeWithAttrs TypeWithAttrs;
1117 llvm::TypeWithAttrsList *TypeWithAttrsList;
1118 llvm::ValueRefList *ValueRefList;
1120 // Represent the RHS of PHI node
1121 std::list<std::pair<llvm::Value*,
1122 llvm::BasicBlock*> > *PHIList;
1123 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1124 std::vector<llvm::Constant*> *ConstVector;
1126 llvm::GlobalValue::LinkageTypes Linkage;
1127 llvm::GlobalValue::VisibilityTypes Visibility;
1128 uint16_t ParamAttrs;
1129 llvm::APInt *APIntVal;
1137 std::string *StrVal; // This memory must be deleted
1138 llvm::ValID ValIDVal;
1140 llvm::Instruction::BinaryOps BinaryOpVal;
1141 llvm::Instruction::TermOps TermOpVal;
1142 llvm::Instruction::MemoryOps MemOpVal;
1143 llvm::Instruction::CastOps CastOpVal;
1144 llvm::Instruction::OtherOps OtherOpVal;
1145 llvm::ICmpInst::Predicate IPredicate;
1146 llvm::FCmpInst::Predicate FPredicate;
1159 #define YYFLAG -32768
1160 #define YYNTBASE 160
1162 #define YYTRANSLATE(x) ((unsigned)(x) <= 399 ? yytranslate[x] : 241)
1164 static const short yytranslate[] = { 0,
1165 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1167 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1168 2, 2, 2, 2, 2, 2, 2, 2, 2, 150,
1169 151, 148, 2, 147, 2, 2, 2, 2, 2, 2,
1170 2, 2, 2, 2, 2, 2, 2, 2, 2, 155,
1171 146, 156, 2, 2, 2, 2, 2, 2, 2, 2,
1172 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1174 152, 149, 154, 2, 2, 2, 2, 2, 159, 2,
1175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1176 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1177 2, 2, 157, 2, 158, 2, 2, 2, 2, 2,
1178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1190 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1191 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1192 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1193 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1194 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1195 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1196 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1197 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1198 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1199 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1200 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1201 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1202 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1203 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1204 137, 138, 139, 140, 141, 142, 143, 144, 145
1208 static const short yyprhs[] = { 0,
1209 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1210 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1211 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1212 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1213 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1214 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1215 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1216 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1217 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1218 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1219 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1220 215, 216, 219, 221, 223, 225, 227, 228, 231, 232,
1221 235, 236, 240, 243, 244, 246, 247, 251, 253, 256,
1222 258, 260, 262, 264, 266, 268, 270, 272, 274, 277,
1223 279, 282, 288, 294, 300, 306, 310, 313, 319, 324,
1224 327, 329, 331, 333, 337, 339, 343, 345, 346, 348,
1225 352, 357, 361, 365, 370, 375, 379, 386, 392, 395,
1226 398, 401, 404, 407, 410, 413, 416, 419, 422, 425,
1227 428, 435, 441, 450, 457, 464, 472, 480, 487, 496,
1228 505, 509, 511, 513, 515, 517, 518, 521, 528, 530,
1229 531, 533, 536, 537, 541, 542, 546, 550, 554, 558,
1230 559, 567, 568, 577, 578, 587, 593, 596, 600, 602,
1231 606, 610, 614, 618, 620, 621, 627, 631, 633, 637,
1232 639, 640, 650, 652, 654, 659, 661, 663, 666, 670,
1233 671, 673, 675, 677, 679, 681, 683, 685, 687, 689,
1234 693, 695, 701, 703, 705, 707, 709, 711, 713, 716,
1235 719, 722, 726, 729, 730, 732, 735, 738, 742, 752,
1236 762, 771, 786, 788, 790, 797, 803, 806, 813, 821,
1237 825, 831, 832, 833, 837, 840, 842, 848, 854, 861,
1238 868, 873, 880, 885, 890, 897, 904, 907, 916, 918,
1239 920, 921, 925, 932, 936, 943, 946, 952, 960
1242 static const short yyrhs[] = { 73,
1243 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1244 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1245 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1246 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1247 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1248 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1249 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1250 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1251 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1252 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1253 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1254 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1255 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1256 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1257 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1258 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1259 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1260 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1261 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1262 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1263 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1264 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1265 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1266 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1267 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1268 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1269 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1270 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1271 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1272 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1273 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1274 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1275 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1276 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1277 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1278 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1279 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1280 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1281 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1282 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1283 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1284 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1285 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1286 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1287 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1288 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1289 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1290 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1291 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1292 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1293 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1294 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1295 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1296 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1297 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1298 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1299 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1300 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1301 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1302 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1303 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1304 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1305 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1306 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1307 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1308 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1309 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1310 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1311 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1312 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1313 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1314 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1315 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1316 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1317 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1318 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1319 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1320 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1321 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1322 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1323 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1324 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
1325 191, 226, 181, 0, 235, 147, 191, 226, 181, 0,
1326 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1327 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1328 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1329 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1330 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1331 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1332 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1333 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1334 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1335 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1336 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1337 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1338 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1345 static const short yyrline[] = { 0,
1346 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1117,
1347 1117, 1117, 1117, 1117, 1117, 1118, 1118, 1118, 1118, 1118,
1348 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1122, 1122, 1123,
1349 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1130, 1130, 1131,
1350 1131, 1132, 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1136,
1351 1136, 1137, 1138, 1143, 1144, 1144, 1144, 1144, 1144, 1146,
1352 1146, 1146, 1147, 1147, 1151, 1155, 1160, 1160, 1162, 1163,
1353 1168, 1174, 1175, 1176, 1177, 1178, 1182, 1183, 1184, 1188,
1354 1189, 1190, 1191, 1195, 1196, 1197, 1201, 1202, 1203, 1204,
1355 1205, 1209, 1210, 1211, 1214, 1214, 1215, 1216, 1217, 1218,
1356 1219, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235,
1357 1238, 1239, 1244, 1245, 1246, 1247, 1250, 1251, 1258, 1258,
1358 1265, 1265, 1274, 1282, 1282, 1288, 1288, 1290, 1295, 1308,
1359 1308, 1308, 1308, 1308, 1308, 1308, 1311, 1315, 1319, 1326,
1360 1331, 1339, 1369, 1400, 1405, 1417, 1427, 1431, 1441, 1448,
1361 1455, 1462, 1467, 1472, 1479, 1480, 1487, 1494, 1502, 1508,
1362 1520, 1548, 1564, 1591, 1619, 1645, 1665, 1691, 1711, 1723,
1363 1730, 1796, 1806, 1816, 1822, 1832, 1838, 1848, 1853, 1858,
1364 1866, 1878, 1900, 1908, 1914, 1925, 1930, 1935, 1941, 1947,
1365 1956, 1960, 1968, 1968, 1971, 1971, 1974, 1985, 2006, 2011,
1366 2019, 2020, 2024, 2024, 2028, 2028, 2031, 2034, 2058, 2069,
1367 2076, 2079, 2085, 2088, 2095, 2099, 2118, 2121, 2127, 2137,
1368 2141, 2146, 2148, 2153, 2158, 2167, 2177, 2188, 2192, 2201,
1369 2210, 2215, 2336, 2336, 2338, 2347, 2347, 2349, 2354, 2366,
1370 2370, 2375, 2379, 2383, 2387, 2391, 2395, 2399, 2403, 2407,
1371 2432, 2436, 2446, 2450, 2454, 2459, 2466, 2466, 2472, 2481,
1372 2485, 2494, 2503, 2512, 2516, 2523, 2527, 2531, 2536, 2546,
1373 2565, 2574, 2654, 2658, 2665, 2676, 2689, 2699, 2710, 2720,
1374 2729, 2738, 2741, 2742, 2749, 2753, 2758, 2779, 2796, 2810,
1375 2824, 2836, 2844, 2851, 2857, 2863, 2869, 2884, 2969, 2974,
1376 2978, 2985, 2992, 3000, 3007, 3015, 3023, 3037, 3054
1381 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1383 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1384 "EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1385 "VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1386 "LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1387 "ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1388 "GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1389 "NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1390 "EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1391 "TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1392 "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1393 "UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1394 "FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1395 "SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1396 "UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1397 "ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1398 "INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1399 "SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1400 "BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1401 "')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1402 "CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1403 "OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1404 "GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1405 "AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1406 "OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1407 "PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1408 "ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1409 "Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1410 "LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1411 "FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1412 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1413 "BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","IndexList","OptTailCall",
1414 "InstVal","OptVolatile","MemoryInst", NULL
1418 static const short yyr1[] = { 0,
1419 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1420 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1421 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1422 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1423 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1424 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1425 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1426 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1427 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1428 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1429 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1430 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1431 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1432 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1433 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1434 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1435 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1436 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1437 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1438 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1439 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1440 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1441 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1442 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1443 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1444 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1445 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1446 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
1447 235, 235, 236, 236, 237, 237, 238, 238, 238, 238,
1448 238, 238, 238, 238, 238, 238, 238, 238, 238, 239,
1449 239, 240, 240, 240, 240, 240, 240, 240, 240
1452 static const short yyr2[] = { 0,
1453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1454 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1455 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1458 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1459 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1460 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1461 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1462 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1463 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1464 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1465 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1466 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1467 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1468 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1469 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1472 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1473 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1474 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1475 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1476 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1477 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1478 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1479 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1480 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
1481 5, 0, 0, 3, 2, 1, 5, 5, 6, 6,
1482 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
1483 0, 3, 6, 3, 6, 2, 5, 7, 4
1486 static const short yydefact[] = { 70,
1487 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1488 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1489 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1490 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1491 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1492 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1493 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1494 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1495 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1496 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1497 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1498 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
1499 98, 99, 100, 0, 239, 0, 301, 263, 0, 222,
1500 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1501 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1502 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
1503 0, 233, 234, 235, 300, 286, 0, 0, 0, 0,
1504 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1505 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1506 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1507 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
1508 0, 0, 0, 0, 0, 262, 95, 277, 0, 299,
1509 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1510 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1511 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1512 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
1513 126, 0, 285, 267, 0, 266, 0, 0, 54, 0,
1514 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1515 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1516 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
1517 121, 306, 0, 0, 297, 0, 0, 0, 0, 0,
1518 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1519 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1520 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1521 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1522 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1523 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
1524 259, 0, 268, 0, 0, 0, 0, 0, 302, 0,
1525 304, 283, 0, 0, 0, 0, 0, 0, 0, 0,
1526 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
1527 213, 215, 0, 0, 0, 283, 0, 0, 0, 0,
1528 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1529 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
1530 0, 0, 0, 0, 0, 0, 0, 0, 0, 309,
1531 0, 0, 0, 293, 294, 0, 0, 0, 0, 291,
1532 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1533 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
1534 64, 0, 117, 0, 250, 0, 0, 282, 0, 0,
1535 121, 122, 121, 0, 0, 0, 0, 0, 0, 287,
1536 288, 282, 0, 307, 0, 198, 0, 0, 182, 0,
1537 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
1538 111, 124, 0, 0, 0, 0, 0, 289, 290, 303,
1539 305, 284, 0, 0, 292, 295, 296, 0, 121, 0,
1540 0, 0, 188, 0, 0, 184, 185, 181, 64, 125,
1541 119, 252, 0, 0, 111, 0, 117, 278, 0, 117,
1542 308, 186, 187, 0, 0, 0, 226, 0, 232, 0,
1543 271, 0, 0, 280, 0, 0, 279, 298, 183, 189,
1544 190, 120, 269, 0, 270, 0, 111, 0, 0, 0,
1545 281, 0, 0, 0, 0, 276, 0, 0, 275, 0,
1549 static const short yydefgoto[] = { 256,
1550 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1551 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
1552 222, 400, 329, 559, 379, 423, 541, 356, 424, 78,
1553 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
1554 85, 149, 592, 16, 17, 19, 18, 261, 334, 335,
1555 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1556 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
1557 216, 563, 128, 305, 517, 440, 217, 218, 219, 220
1560 static const short yypact[] = { 42,
1561 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -21, -131, 60,
1562 -93, 105, -22, 182,-32768, 525,-32768, 46, 168, -12,
1563 19,-32768, 1, 152,-32768, 1277,-32768,-32768,-32768,-32768,
1564 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 90, 90,
1565 100,-32768,-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768,
1566 90, 186,-32768, 12, 187, 201, 209,-32768,-32768,-32768,
1567 -32768,-32768, 93,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1568 -32768, 252, 254, 2, 907,-32768,-32768,-32768, 13,-32768,
1569 225, 225, 150,-32768, 76, 116, 116,-32768,-32768, 108,
1570 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -79, 1027,-32768,
1571 111, 114, 947, 93,-32768, 13, -104,-32768, 1027, 76,
1572 76,-32768,-32768, 1067,-32768,-32768, 1299, 266,-32768,-32768,
1573 -32768,-32768,-32768, 1330,-32768, -16, 1572,-32768, 256,-32768,
1574 -32768, 13,-32768, 139, 144, 1370, 1370, 132, -95, 1370,
1575 -32768, 145, 1299, 1370, 93, 147, 13, 311,-32768, 43,
1576 290, 293, 298, 299, 302, 247, 303, 724,-32768,-32768,
1577 35,-32768,-32768,-32768,-32768,-32768, 258, 1450, 70, 305,
1578 116,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1579 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 405,
1580 1370, 1370, 1370, 1370,-32768,-32768,-32768,-32768,-32768,-32768,
1581 -32768,-32768,-32768,-32768,-32768,-32768, 1370, 1370, 1370, 1370,
1582 1370, 1370, 1370, 1370, 1370,-32768, 116,-32768, 34,-32768,
1583 -32768, 131, 1107,-32768, 6, -46,-32768, 164, 13,-32768,
1584 -32768, 13, 1067,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1585 -32768,-32768,-32768,-32768, 317, 405, 173, 178, 179, 189,
1586 192, 1179, 1481, 987, 314, 193, 197, 198,-32768,-32768,
1587 202, 203,-32768, 93, 565,-32768, 699, 699,-32768, 699,
1588 1330,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1589 -32768, 1370,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1590 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1370, 113,
1591 137,-32768, 565, -10, 205, 207, 208, 210, 218, 219,
1592 565, 565, 330, 1330, 1370, 1370,-32768,-32768,-32768,-32768,
1593 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 106,-32768,
1594 -32768,-32768, 106, 202, 202, 331, 220, 221, 1299, 1299,
1595 1299, 1299, 1299,-32768,-32768, -41, 1005, -61,-32768, -91,
1596 -32768, 1299, 1299, 1299, -13,-32768, 1219,-32768,-32768,-32768,
1597 -32768,-32768,-32768,-32768,-32768, 313, 1299,-32768,-32768,-32768,
1598 -32768, 226,-32768, 227, 699, 565, 565, 23,-32768, 24,
1599 -32768,-32768, 699, 223, 1370, 1370, 1370, 1370, 1370, 232,
1600 233, 1370, 699, 565, 234,-32768,-32768,-32768,-32768,-32768,
1601 -32768,-32768, 1370, 1299, 1299,-32768, 235, 236, 237, 239,
1602 1299,-32768, 231, 724, -76,-32768,-32768, 241, 242, 352,
1603 369, 388,-32768, 202,-32768, 13, 246, 243,-32768, 374,
1604 -59, 380, 385, 253, 257, 270, 699, 414, 699, 272,
1605 273, 699, 278, 13,-32768, 280, 282, 699, 699, 13,
1606 283, 287, 1370, -112, 288, 289, -33, 1299, 1299, 1299,
1607 1299,-32768,-32768, 294, 1299, 1299, 1370,-32768,-32768,-32768,
1608 79, 1259,-32768, 292,-32768, 699, 699, 1370, 699, 699,
1609 287,-32768, 287, 1370, 699, 307, 1370, 1370, 1370,-32768,
1610 -32768, 1370, 392,-32768, 565,-32768, 1299, 1299,-32768, 308,
1611 295, 309, 310,-32768, 301, 315, 7,-32768,-32768,-32768,
1612 13, 10, 427, 318, 306, 565, 52,-32768,-32768,-32768,
1613 -32768,-32768, 316, 699,-32768,-32768,-32768, 71, 287, 322,
1614 325, 1299,-32768, 1299, 1299,-32768,-32768,-32768, 79,-32768,
1615 407,-32768, 444, -4,-32768, 1370,-32768,-32768, 323,-32768,
1616 -32768,-32768,-32768, 327, 328, 329,-32768, 464,-32768, 699,
1617 -32768, 859, -3, 131, 565, -14,-32768, 106,-32768,-32768,
1618 -32768,-32768,-32768, 334,-32768, 859,-32768, 452, 465, 336,
1619 131, 699, 699, 468, 416,-32768, 699, 471,-32768, 699,
1620 -32768, 490, 491,-32768
1623 static const short yypgoto[] = { 365,
1624 366, 367, 255, 251, -168,-32768, 0, -40, 408, 14,
1625 -32768,-32768,-32768,-32768, 40,-32768,-32768,-32768, -158,-32768,
1626 -406,-32768, -226,-32768, -290, 3,-32768, -317,-32768,-32768,
1627 -25, 296, -119,-32768, 409, 413, -60, -155, -231, 166,
1628 119, 284,-32768,-32768, 504,-32768,-32768,-32768,-32768,-32768,
1629 -32768,-32768,-32768,-32768,-32768,-32768, 435,-32768,-32768,-32768,
1630 -32768,-32768,-32768, -525, -139, 47, -183,-32768, 474,-32768,
1631 -32768,-32768,-32768,-32768, 37, 124,-32768,-32768,-32768,-32768
1638 static const short yytable[] = { 11,
1639 79, 270, 259, 333, 161, 102, 269, 269, 234, 302,
1640 381, 162, 271, 13, 23, 11, 401, 402, 260, 471,
1641 421, 348, 350, 578, 306, 307, 308, 309, 310, 13,
1642 20, 313, 88, 437, 439, 108, 574, 109, 496, 422,
1643 91, -200, 140, 421, 21, -54, -54, -54, -54, 106,
1644 580, 140, 25, 141, 2, 411, 159, 4, 314, -66,
1645 1, 2, 228, 3, 4, 5, 417, 129, 235, 236,
1646 411, 6, 7, 132, 130, 438, 438, 106, 81, 82,
1647 267, 464, 231, 132, 86, 411, 268, 411, 147, 11,
1648 87, 43, 8, 44, 416, 9, 475, 1, 147, 10,
1649 3, 108, 5, 109, 539, 411, 470, 115, 116, 331,
1650 225, 226, 412, 484, 229, 415, 24, 499, 232, 396,
1651 397, 398, 26, 27, 399, 370, 1, 370, 370, 3,
1652 370, 5, 395, 55, 83, 431, 84, 108, 564, 109,
1653 163, 383, 265, 396, 397, 398, 315, 316, 399, 561,
1654 575, 375, 57, 108, 108, 109, 109, 538, 103, 330,
1655 108, 494, 109, 370, 56, 300, 301, 265, 303, 92,
1656 581, 370, 370, 59, 262, 118, 119, 120, 121, 122,
1657 123, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1658 520, 112, 521, 113, 393, 317, 318, 132, 546, 110,
1659 111, 443, 547, 445, 446, 447, 88, 147, 95, 47,
1660 48, 49, 319, 320, 50, 321, 322, 546, 323, 324,
1661 325, 550, 96, 28, 29, 30, 31, 32, 33, 34,
1662 97, 35, 36, 37, 38, 370, 370, 370, 551, 396,
1663 397, 398, 99, 370, 399, 147, 512, 317, 318, 237,
1664 238, 239, 240, 370, 370, 100, 376, 101, 259, 378,
1665 108, 84, 109, 136, 319, 320, 137, 321, 322, 160,
1666 323, 324, 325, 377, 260, 143, 144, 221, 406, 407,
1667 408, 409, 410, 380, 108, 223, 109, 227, 147, 394,
1668 265, 418, 419, 420, 224, 230, 233, 370, -55, 370,
1669 522, -56, 370, 525, 526, 527, -59, -58, 370, 370,
1670 -57, 241, 263, 372, 373, 269, 374, 61, 62, 332,
1671 566, 414, 339, 568, 36, 37, 38, 340, 341, 1,
1672 2, 426, 3, 4, 5, 351, 370, 370, 342, 370,
1673 370, 343, 352, 455, 456, 370, 353, 354, 355, 382,
1674 462, 384, 357, 385, 386, 370, 387, 390, 391, 265,
1675 444, 265, 265, 265, 388, 389, 450, 392, 403, 404,
1676 405, 429, 432, 433, 442, 562, 370, 454, 448, 449,
1677 453, 458, 459, 460, 370, 461, 463, 465, 466, 467,
1678 468, 469, 472, 473, 576, 474, 476, 500, 501, 502,
1679 503, 477, 478, 479, 505, 506, 272, 273, 274, 275,
1680 276, 277, 278, 279, 280, 281, 480, 482, 484, 485,
1681 370, 434, 435, 436, 487, 370, 488, 495, 489, 441,
1682 283, 284, 492, 493, 497, 498, 530, 531, 513, 451,
1683 452, 507, 370, 370, 438, 533, 511, 370, 542, 504,
1684 370, 536, 516, 524, 532, 534, 535, 544, 265, 558,
1685 560, 265, 265, 265, 543, 537, 516, 572, 582, 548,
1686 508, 554, 552, 555, 556, 553, 567, 569, 570, 571,
1687 579, 583, 584, 481, 587, 483, 588, 590, 486, 593,
1688 594, 213, 214, 215, 490, 491, 338, 127, 557, 337,
1689 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1690 295, 296, 297, 298, 540, 139, 336, 142, 328, 42,
1691 565, 126, 514, 515, -199, 518, 519, 94, 528, 457,
1692 0, 523, 0, 0, 0, 0, 0, 0, 508, 0,
1693 0, 529, -66, 1, 2, 0, 3, 4, 5, 0,
1694 0, 0, 0, 0, 6, 7, 0, 0, 0, 0,
1695 0, 0, 545, 0, 0, 0, 0, 358, 359, 0,
1696 549, 61, 62, 360, 0, 8, 0, 0, 9, 0,
1697 0, 0, 10, 1, 2, 0, 3, 4, 5, 361,
1698 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
1699 0, 0, 0, 0, 364, 365, 573, 0, 0, 0,
1700 0, 577, 0, 0, 0, 0, 0, 0, 0, 0,
1701 0, 366, 0, 0, 0, 0, 0, 0, 585, 586,
1702 0, 0, 0, 589, 0, 0, 591, 174, 175, 176,
1703 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
1704 187, 188, 245, 246, 0, 0, 0, 0, 0, 0,
1705 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1706 0, 0, 0, 0, 0, 0, 0, 0, 0, 247,
1707 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
1708 205, 206, 0, 248, 0, 249, 250, 251, 0, 0,
1709 0, 358, 359, 0, 0, 61, 62, 360, 0, 0,
1710 0, 0, 108, 0, 109, 0, 0, 1, 2, 367,
1711 3, 4, 5, 361, 362, 363, 0, 0, 0, 0,
1712 61, 62, 0, 0, 0, 0, 0, 0, 364, 365,
1713 0, 0, 1, 2, 0, 3, 4, 5, 242, 0,
1714 0, 0, 0, 0, 0, 366, 0, 0, 0, 0,
1715 0, 0, 0, 243, 244, 0, 0, 0, 0, 0,
1716 0, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1717 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1718 0, 0, 0, 0, 0, 0, 174, 175, 176, 177,
1719 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1720 188, 245, 246, 247, 195, 196, 197, 198, 199, 200,
1721 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1722 250, 251, 0, 0, 0, 0, 0, 0, 247, 195,
1723 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1724 206, 0, 248, 367, 249, 250, 251, 0, 0, 0,
1725 0, 358, 359, 0, 0, 0, 0, 360, 0, 0,
1726 0, 108, 0, 109, 0, 252, 0, 0, 253, 0,
1727 254, 0, 255, 361, 362, 363, 0, 0, 0, 0,
1728 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
1729 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1730 0, 0, 0, 61, 62, 366, 104, 64, 65, 66,
1731 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1732 5, 174, 175, 176, 177, 178, 179, 180, 181, 182,
1733 183, 184, 185, 186, 187, 188, 245, 246, 0, 0,
1734 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1735 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1736 5, 0, 0, 247, 195, 196, 197, 198, 199, 200,
1737 201, 202, 203, 204, 205, 206, 0, 248, 0, 249,
1738 250, 251, 0, 61, 62, 71, 104, 150, 151, 152,
1739 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
1740 5, 61, 62, 367, 104, 150, 151, 152, 153, 154,
1741 155, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1742 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1743 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1744 5, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1745 0, 74, 0, 75, 105, 131, 0, 0, 0, 0,
1746 0, 0, 0, 61, 62, 71, 145, 64, 65, 66,
1747 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1748 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1749 0, 74, 0, 75, 138, 0, 0, 0, 0, 0,
1750 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1751 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
1752 5, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1753 0, 74, 0, 75, 349, 327, 0, 0, 0, 0,
1754 0, 0, 0, 72, 0, 71, 73, 0, 0, 74,
1755 0, 75, 413, 0, 0, 0, 0, 0, 0, 0,
1756 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1757 0, 74, 0, 75, 0, 61, 62, 146, 104, 150,
1758 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1759 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1760 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1761 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1762 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1763 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
1764 0, 0, 0, 0, 0, 72, 0, 425, 73, 0,
1765 0, 74, 0, 75, 0, 61, 62, 71, 104, 64,
1766 65, 66, 67, 68, 69, 70, 0, 1, 2, 0,
1767 3, 4, 5, 61, 62, 0, 63, 64, 65, 66,
1768 67, 68, 69, 70, 0, 1, 2, 510, 3, 4,
1769 5, 0, 0, 0, 0, 61, 62, 71, 104, 150,
1770 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1771 3, 4, 5, 0, 0, 71, 0, 72, 0, 0,
1772 73, 0, 344, 74, 0, 75, 61, 62, 0, 145,
1773 64, 65, 66, 67, 68, 69, 70, 71, 1, 2,
1774 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1775 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1776 73, 0, 0, 74, 0, 75, 61, 62, 71, 104,
1777 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1778 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
1779 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1780 73, 0, 0, 74, 0, 75, 0, 0, 71, 0,
1781 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1782 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
1783 0, 0, 0, 0, 0, 0, 0, 72, 0, 0,
1784 73, 0, 0, 74, 0, 75, 61, 62, 0, 264,
1785 64, 65, 66, 67, 68, 69, 70, 0, 1, 2,
1786 0, 3, 4, 5, 0, 0, 0, 0, 72, 0,
1787 0, 73, 0, 0, 74, 0, 75, 61, 62, 0,
1788 104, 150, 151, 152, 153, 154, 155, 70, 71, 1,
1789 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
1790 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1791 0, 73, 0, 0, 74, 0, 75, 0, 0, 71,
1792 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1793 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1794 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1795 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1796 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1797 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1798 0, 0, 0, 0, 0, 0, 0, 0, 72, 0,
1799 0, 73, 0, 0, 74, 0, 75, 165, 0, 0,
1800 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1801 0, 0, 0, 0, 0, 0, 166, 167, 0, 72,
1802 0, 0, 73, 0, 0, 74, 0, 347, 168, 169,
1803 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
1804 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
1805 190, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1807 0, 191, 192, 193, 0, 0, 194, 195, 196, 197,
1808 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
1809 208, 209, 210, 211, 212
1812 static const short yycheck[] = { 0,
1813 26, 170, 158, 230, 124, 4, 11, 11, 148, 193,
1814 301, 28, 171, 0, 146, 16, 334, 335, 158, 426,
1815 34, 253, 254, 38, 208, 209, 210, 211, 212, 16,
1816 52, 215, 21, 11, 11, 148, 562, 150, 151, 53,
1817 29, 0, 147, 34, 66, 3, 4, 5, 6, 75,
1818 576, 147, 146, 158, 20, 147, 117, 23, 217, 18,
1819 19, 20, 158, 22, 23, 24, 158, 147, 26, 27,
1820 147, 30, 31, 99, 154, 53, 53, 103, 39, 40,
1821 11, 158, 143, 109, 45, 147, 17, 147, 114, 90,
1822 51, 46, 51, 48, 156, 54, 156, 19, 124, 58,
1823 22, 148, 24, 150, 511, 147, 424, 32, 33, 156,
1824 136, 137, 154, 147, 140, 347, 57, 151, 144, 134,
1825 135, 136, 18, 146, 139, 265, 19, 267, 268, 22,
1826 270, 24, 316, 146, 35, 367, 37, 148, 545, 150,
1827 157, 152, 168, 134, 135, 136, 113, 114, 139, 154,
1828 154, 271, 152, 148, 148, 150, 150, 151, 157, 154,
1829 148, 452, 150, 303, 146, 191, 192, 193, 194, 158,
1830 577, 311, 312, 22, 161, 60, 61, 62, 63, 64,
1831 65, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1832 481, 42, 483, 44, 314, 117, 118, 223, 147, 81,
1833 82, 385, 151, 387, 388, 389, 21, 233, 22, 42,
1834 43, 44, 134, 135, 47, 137, 138, 147, 140, 141,
1835 142, 151, 22, 42, 43, 44, 45, 46, 47, 48,
1836 22, 50, 143, 144, 145, 375, 376, 377, 529, 134,
1837 135, 136, 150, 383, 139, 271, 473, 117, 118, 3,
1838 4, 5, 6, 393, 394, 4, 282, 4, 414, 147,
1839 148, 37, 150, 153, 134, 135, 153, 137, 138, 4,
1840 140, 141, 142, 299, 414, 110, 111, 22, 339, 340,
1841 341, 342, 343, 147, 148, 147, 150, 156, 314, 315,
1842 316, 352, 353, 354, 151, 151, 150, 437, 9, 439,
1843 484, 9, 442, 487, 488, 489, 9, 9, 448, 449,
1844 9, 9, 55, 267, 268, 11, 270, 7, 8, 156,
1845 547, 347, 150, 550, 143, 144, 145, 150, 150, 19,
1846 20, 357, 22, 23, 24, 22, 476, 477, 150, 479,
1847 480, 150, 150, 404, 405, 485, 150, 150, 147, 303,
1848 411, 147, 150, 147, 147, 495, 147, 311, 312, 385,
1849 386, 387, 388, 389, 147, 147, 392, 38, 38, 150,
1850 150, 59, 147, 147, 152, 544, 516, 403, 147, 147,
1851 147, 147, 147, 147, 524, 147, 156, 147, 147, 38,
1852 22, 4, 147, 151, 563, 22, 17, 458, 459, 460,
1853 461, 17, 150, 147, 465, 466, 90, 91, 92, 93,
1854 94, 95, 96, 97, 98, 99, 147, 4, 147, 147,
1855 560, 375, 376, 377, 147, 565, 147, 453, 147, 383,
1856 26, 27, 150, 147, 147, 147, 497, 498, 147, 393,
1857 394, 467, 582, 583, 53, 151, 472, 587, 22, 156,
1858 590, 151, 478, 147, 147, 147, 147, 152, 484, 53,
1859 17, 487, 488, 489, 147, 151, 492, 4, 17, 154,
1860 471, 532, 151, 534, 535, 151, 154, 151, 151, 151,
1861 147, 17, 147, 437, 17, 439, 71, 17, 442, 0,
1862 0, 127, 127, 127, 448, 449, 246, 90, 539, 245,
1863 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
1864 106, 107, 108, 109, 512, 103, 233, 109, 223, 16,
1865 546, 87, 476, 477, 0, 479, 480, 54, 492, 406,
1866 -1, 485, -1, -1, -1, -1, -1, -1, 539, -1,
1867 -1, 495, 18, 19, 20, -1, 22, 23, 24, -1,
1868 -1, -1, -1, -1, 30, 31, -1, -1, -1, -1,
1869 -1, -1, 516, -1, -1, -1, -1, 3, 4, -1,
1870 524, 7, 8, 9, -1, 51, -1, -1, 54, -1,
1871 -1, -1, 58, 19, 20, -1, 22, 23, 24, 25,
1872 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
1873 -1, -1, -1, -1, 40, 41, 560, -1, -1, -1,
1874 -1, 565, -1, -1, -1, -1, -1, -1, -1, -1,
1875 -1, 57, -1, -1, -1, -1, -1, -1, 582, 583,
1876 -1, -1, -1, 587, -1, -1, 590, 73, 74, 75,
1877 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1878 86, 87, 88, 89, -1, -1, -1, -1, -1, -1,
1879 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1880 -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
1881 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1882 126, 127, -1, 129, -1, 131, 132, 133, -1, -1,
1883 -1, 3, 4, -1, -1, 7, 8, 9, -1, -1,
1884 -1, -1, 148, -1, 150, -1, -1, 19, 20, 155,
1885 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
1886 7, 8, -1, -1, -1, -1, -1, -1, 40, 41,
1887 -1, -1, 19, 20, -1, 22, 23, 24, 25, -1,
1888 -1, -1, -1, -1, -1, 57, -1, -1, -1, -1,
1889 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
1890 -1, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1891 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1892 -1, -1, -1, -1, -1, -1, 73, 74, 75, 76,
1893 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1894 87, 88, 89, 115, 116, 117, 118, 119, 120, 121,
1895 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1896 132, 133, -1, -1, -1, -1, -1, -1, 115, 116,
1897 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1898 127, -1, 129, 155, 131, 132, 133, -1, -1, -1,
1899 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
1900 -1, 148, -1, 150, -1, 152, -1, -1, 155, -1,
1901 157, -1, 159, 25, 26, 27, -1, -1, -1, -1,
1902 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
1903 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1904 -1, -1, -1, 7, 8, 57, 10, 11, 12, 13,
1905 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1906 24, 73, 74, 75, 76, 77, 78, 79, 80, 81,
1907 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
1908 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1909 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1910 24, -1, -1, 115, 116, 117, 118, 119, 120, 121,
1911 122, 123, 124, 125, 126, 127, -1, 129, -1, 131,
1912 132, 133, -1, 7, 8, 49, 10, 11, 12, 13,
1913 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1914 24, 7, 8, 155, 10, 11, 12, 13, 14, 15,
1915 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1916 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1917 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1918 24, -1, -1, 49, -1, 149, -1, -1, 152, -1,
1919 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1920 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1921 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1922 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1923 -1, 155, -1, 157, 158, -1, -1, -1, -1, -1,
1924 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1925 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1926 24, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1927 -1, 155, -1, 157, 158, 39, -1, -1, -1, -1,
1928 -1, -1, -1, 149, -1, 49, 152, -1, -1, 155,
1929 -1, 157, 158, -1, -1, -1, -1, -1, -1, -1,
1930 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1931 -1, 155, -1, 157, -1, 7, 8, 121, 10, 11,
1932 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1933 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1934 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1935 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1936 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1937 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
1938 -1, -1, -1, -1, -1, 149, -1, 39, 152, -1,
1939 -1, 155, -1, 157, -1, 7, 8, 49, 10, 11,
1940 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1941 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
1942 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
1943 24, -1, -1, -1, -1, 7, 8, 49, 10, 11,
1944 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1945 22, 23, 24, -1, -1, 49, -1, 149, -1, -1,
1946 152, -1, 154, 155, -1, 157, 7, 8, -1, 10,
1947 11, 12, 13, 14, 15, 16, 17, 49, 19, 20,
1948 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1949 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1950 152, -1, -1, 155, -1, 157, 7, 8, 49, 10,
1951 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1952 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
1953 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1954 152, -1, -1, 155, -1, 157, -1, -1, 49, -1,
1955 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1956 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
1957 -1, -1, -1, -1, -1, -1, -1, 149, -1, -1,
1958 152, -1, -1, 155, -1, 157, 7, 8, -1, 10,
1959 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
1960 -1, 22, 23, 24, -1, -1, -1, -1, 149, -1,
1961 -1, 152, -1, -1, 155, -1, 157, 7, 8, -1,
1962 10, 11, 12, 13, 14, 15, 16, 17, 49, 19,
1963 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
1964 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1965 -1, 152, -1, -1, 155, -1, 157, -1, -1, 49,
1966 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1967 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1968 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1969 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1970 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1971 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1972 -1, -1, -1, -1, -1, -1, -1, -1, 149, -1,
1973 -1, 152, -1, -1, 155, -1, 157, 36, -1, -1,
1974 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1975 -1, -1, -1, -1, -1, -1, 55, 56, -1, 149,
1976 -1, -1, 152, -1, -1, 155, -1, 157, 67, 68,
1977 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
1978 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1979 89, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1980 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1981 -1, 110, 111, 112, -1, -1, 115, 116, 117, 118,
1982 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
1983 129, 130, 131, 132, 133
1985 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1986 #line 3 "/usr/share/bison.simple"
1987 /* This file comes from bison-1.28. */
1989 /* Skeleton output parser for bison,
1990 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1992 This program is free software; you can redistribute it and/or modify
1993 it under the terms of the GNU General Public License as published by
1994 the Free Software Foundation; either version 2, or (at your option)
1997 This program is distributed in the hope that it will be useful,
1998 but WITHOUT ANY WARRANTY; without even the implied warranty of
1999 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2000 GNU General Public License for more details.
2002 You should have received a copy of the GNU General Public License
2003 along with this program; if not, write to the Free Software
2004 Foundation, Inc., 59 Temple Place - Suite 330,
2005 Boston, MA 02111-1307, USA. */
2007 /* As a special exception, when this file is copied by Bison into a
2008 Bison output file, you may use that output file without restriction.
2009 This special exception was added by the Free Software Foundation
2010 in version 1.24 of Bison. */
2012 /* This is the parser code that is written into each bison parser
2013 when the %semantic_parser declaration is not specified in the grammar.
2014 It was written by Richard Stallman by simplifying the hairy parser
2015 used when %semantic_parser is specified. */
2017 #ifndef YYSTACK_USE_ALLOCA
2019 #define YYSTACK_USE_ALLOCA
2020 #else /* alloca not defined */
2022 #define YYSTACK_USE_ALLOCA
2023 #define alloca __builtin_alloca
2024 #else /* not GNU C. */
2025 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2026 #define YYSTACK_USE_ALLOCA
2028 #else /* not sparc */
2029 /* We think this test detects Watcom and Microsoft C. */
2030 /* This used to test MSDOS, but that is a bad idea
2031 since that symbol is in the user namespace. */
2032 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2033 #if 0 /* No need for malloc.h, which pollutes the namespace;
2034 instead, just don't use alloca. */
2037 #else /* not MSDOS, or __TURBOC__ */
2039 /* I don't know what this was needed for, but it pollutes the namespace.
2040 So I turned it off. rms, 2 May 1997. */
2041 /* #include <malloc.h> */
2043 #define YYSTACK_USE_ALLOCA
2044 #else /* not MSDOS, or __TURBOC__, or _AIX */
2046 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2047 and on HPUX 10. Eventually we can turn this on. */
2048 #define YYSTACK_USE_ALLOCA
2049 #define alloca __builtin_alloca
2052 #endif /* not _AIX */
2053 #endif /* not MSDOS, or __TURBOC__ */
2054 #endif /* not sparc */
2055 #endif /* not GNU C */
2056 #endif /* alloca not defined */
2057 #endif /* YYSTACK_USE_ALLOCA not defined */
2059 #ifdef YYSTACK_USE_ALLOCA
2060 #define YYSTACK_ALLOC alloca
2062 #define YYSTACK_ALLOC malloc
2065 /* Note: there must be only one dollar sign in this file.
2066 It is replaced by the list of actions, each action
2067 as one case of the switch. */
2069 #define yyerrok (yyerrstatus = 0)
2070 #define yyclearin (yychar = YYEMPTY)
2073 #define YYACCEPT goto yyacceptlab
2074 #define YYABORT goto yyabortlab
2075 #define YYERROR goto yyerrlab1
2076 /* Like YYERROR except do call yyerror.
2077 This remains here temporarily to ease the
2078 transition to the new meaning of YYERROR, for GCC.
2079 Once GCC version 2 has supplanted version 1, this can go. */
2080 #define YYFAIL goto yyerrlab
2081 #define YYRECOVERING() (!!yyerrstatus)
2082 #define YYBACKUP(token, value) \
2084 if (yychar == YYEMPTY && yylen == 1) \
2085 { yychar = (token), yylval = (value); \
2086 yychar1 = YYTRANSLATE (yychar); \
2091 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2095 #define YYERRCODE 256
2098 #define YYLEX yylex()
2104 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2106 #define YYLEX yylex(&yylval, &yylloc)
2108 #else /* not YYLSP_NEEDED */
2110 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2112 #define YYLEX yylex(&yylval)
2114 #endif /* not YYLSP_NEEDED */
2117 /* If nonreentrant, generate the variables here */
2121 int yychar; /* the lookahead symbol */
2122 YYSTYPE yylval; /* the semantic value of the */
2123 /* lookahead symbol */
2126 YYLTYPE yylloc; /* location data for the lookahead */
2130 int yynerrs; /* number of parse errors so far */
2131 #endif /* not YYPURE */
2134 int yydebug; /* nonzero means print parse trace */
2135 /* Since this is uninitialized, it does not stop multiple parsers
2139 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2142 #define YYINITDEPTH 200
2145 /* YYMAXDEPTH is the maximum size the stacks can grow to
2146 (effective only if the built-in stack extension method is used). */
2153 #define YYMAXDEPTH 10000
2156 /* Define __yy_memcpy. Note that the size argument
2157 should be passed with type unsigned int, because that is what the non-GCC
2158 definitions require. With GCC, __builtin_memcpy takes an arg
2159 of type size_t, but it can handle unsigned int. */
2161 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2162 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2163 #else /* not GNU C or C++ */
2166 /* This is the most reliable way to avoid incompatibilities
2167 in available built-in functions on various systems. */
2169 __yy_memcpy (to, from, count)
2174 register char *f = from;
2175 register char *t = to;
2176 register int i = count;
2182 #else /* __cplusplus */
2184 /* This is the most reliable way to avoid incompatibilities
2185 in available built-in functions on various systems. */
2187 __yy_memcpy (char *to, char *from, unsigned int count)
2189 register char *t = to;
2190 register char *f = from;
2191 register int i = count;
2200 #line 217 "/usr/share/bison.simple"
2202 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2203 into yyparse. The argument should have type void *.
2204 It should actually point to an object.
2205 Grammar actions can access the variable by casting it
2206 to the proper pointer type. */
2208 #ifdef YYPARSE_PARAM
2210 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2211 #define YYPARSE_PARAM_DECL
2212 #else /* not __cplusplus */
2213 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2214 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2215 #endif /* not __cplusplus */
2216 #else /* not YYPARSE_PARAM */
2217 #define YYPARSE_PARAM_ARG
2218 #define YYPARSE_PARAM_DECL
2219 #endif /* not YYPARSE_PARAM */
2221 /* Prevent warning if -Wstrict-prototypes. */
2223 #ifdef YYPARSE_PARAM
2224 int yyparse (void *);
2231 yyparse(YYPARSE_PARAM_ARG)
2234 register int yystate;
2236 register short *yyssp;
2237 register YYSTYPE *yyvsp;
2238 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2239 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2241 short yyssa[YYINITDEPTH]; /* the state stack */
2242 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2244 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2245 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2248 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2249 YYLTYPE *yyls = yylsa;
2252 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2254 #define YYPOPSTACK (yyvsp--, yyssp--)
2257 int yystacksize = YYINITDEPTH;
2258 int yyfree_stacks = 0;
2269 YYSTYPE yyval; /* the variable used to return */
2270 /* semantic values from the action */
2277 fprintf(stderr, "Starting parse\n");
2283 yychar = YYEMPTY; /* Cause a token to be read. */
2285 /* Initialize stack pointers.
2286 Waste one element of value and location stack
2287 so that they stay on the same level as the state stack.
2288 The wasted elements are never initialized. */
2296 /* Push a new state, which is found in yystate . */
2297 /* In all cases, when you get here, the value and location stacks
2298 have just been pushed. so pushing a state here evens the stacks. */
2303 if (yyssp >= yyss + yystacksize - 1)
2305 /* Give user a chance to reallocate the stack */
2306 /* Use copies of these so that the &'s don't force the real ones into memory. */
2307 YYSTYPE *yyvs1 = yyvs;
2308 short *yyss1 = yyss;
2310 YYLTYPE *yyls1 = yyls;
2313 /* Get the current used size of the three stacks, in elements. */
2314 int size = yyssp - yyss + 1;
2317 /* Each stack pointer address is followed by the size of
2318 the data in use in that stack, in bytes. */
2320 /* This used to be a conditional around just the two extra args,
2321 but that might be undefined if yyoverflow is a macro. */
2322 yyoverflow("parser stack overflow",
2323 &yyss1, size * sizeof (*yyssp),
2324 &yyvs1, size * sizeof (*yyvsp),
2325 &yyls1, size * sizeof (*yylsp),
2328 yyoverflow("parser stack overflow",
2329 &yyss1, size * sizeof (*yyssp),
2330 &yyvs1, size * sizeof (*yyvsp),
2334 yyss = yyss1; yyvs = yyvs1;
2338 #else /* no yyoverflow */
2339 /* Extend the stack our own way. */
2340 if (yystacksize >= YYMAXDEPTH)
2342 yyerror("parser stack overflow");
2354 if (yystacksize > YYMAXDEPTH)
2355 yystacksize = YYMAXDEPTH;
2356 #ifndef YYSTACK_USE_ALLOCA
2359 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2360 __yy_memcpy ((char *)yyss, (char *)yyss1,
2361 size * (unsigned int) sizeof (*yyssp));
2362 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2363 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2364 size * (unsigned int) sizeof (*yyvsp));
2366 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2367 __yy_memcpy ((char *)yyls, (char *)yyls1,
2368 size * (unsigned int) sizeof (*yylsp));
2370 #endif /* no yyoverflow */
2372 yyssp = yyss + size - 1;
2373 yyvsp = yyvs + size - 1;
2375 yylsp = yyls + size - 1;
2380 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2383 if (yyssp >= yyss + yystacksize - 1)
2389 fprintf(stderr, "Entering state %d\n", yystate);
2395 /* Do appropriate processing given the current state. */
2396 /* Read a lookahead token if we need one and don't already have one. */
2399 /* First try to decide what to do without reference to lookahead token. */
2401 yyn = yypact[yystate];
2405 /* Not known => get a lookahead token if don't already have one. */
2407 /* yychar is either YYEMPTY or YYEOF
2408 or a valid token in external form. */
2410 if (yychar == YYEMPTY)
2414 fprintf(stderr, "Reading a token: ");
2419 /* Convert token to internal form (in yychar1) for indexing tables with */
2421 if (yychar <= 0) /* This means end of input. */
2424 yychar = YYEOF; /* Don't call YYLEX any more */
2428 fprintf(stderr, "Now at end of input.\n");
2433 yychar1 = YYTRANSLATE(yychar);
2438 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2439 /* Give the individual parser a way to print the precise meaning
2440 of a token, for further debugging info. */
2442 YYPRINT (stderr, yychar, yylval);
2444 fprintf (stderr, ")\n");
2450 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2455 /* yyn is what to do for this token type in this state.
2456 Negative => reduce, -yyn is rule number.
2457 Positive => shift, yyn is new state.
2458 New state is final state => don't bother to shift,
2459 just return success.
2460 0, or most negative number => error. */
2475 /* Shift the lookahead token. */
2479 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2482 /* Discard the token being shifted unless it is eof. */
2483 if (yychar != YYEOF)
2491 /* count tokens shifted since error; after three, turn off error status. */
2492 if (yyerrstatus) yyerrstatus--;
2497 /* Do the default action for the current state. */
2500 yyn = yydefact[yystate];
2504 /* Do a reduction. yyn is the number of a rule to reduce with. */
2508 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2515 fprintf (stderr, "Reducing via rule %d (line %d), ",
2518 /* Print the symbols being reduced, and their result. */
2519 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2520 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2521 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2529 #line 1122 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2530 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2533 #line 1122 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2534 { yyval.IPredicate = ICmpInst::ICMP_NE; ;
2537 #line 1123 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2538 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2541 #line 1123 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2542 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2545 #line 1124 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2546 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2549 #line 1124 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2550 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2553 #line 1125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2554 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2557 #line 1125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2558 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2561 #line 1126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2562 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2565 #line 1126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2566 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2569 #line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2570 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2573 #line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2574 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2577 #line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2578 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2581 #line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2582 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2585 #line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2586 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2589 #line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2590 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2593 #line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2594 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2597 #line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2598 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2601 #line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2602 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2605 #line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2606 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2609 #line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2610 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2613 #line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2614 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2617 #line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2618 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2621 #line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2622 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2625 #line 1137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2626 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2629 #line 1138 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2630 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2633 #line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2634 { yyval.StrVal = 0; ;
2637 #line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2639 yyval.StrVal = yyvsp[-1].StrVal;
2644 #line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2651 #line 1163 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2658 #line 1168 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2660 yyval.StrVal = yyvsp[-1].StrVal;
2665 #line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2666 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2669 #line 1175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2670 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2673 #line 1176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2674 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2677 #line 1177 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2678 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2681 #line 1178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2682 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2685 #line 1182 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2686 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2689 #line 1183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2690 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2693 #line 1184 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2694 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2697 #line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2698 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2701 #line 1189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2702 { yyval.Visibility = GlobalValue::DefaultVisibility; ;
2705 #line 1190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2706 { yyval.Visibility = GlobalValue::HiddenVisibility; ;
2709 #line 1191 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2710 { yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2713 #line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2714 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2717 #line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2718 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2721 #line 1197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2722 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2725 #line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2726 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2729 #line 1202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2730 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2733 #line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2734 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2737 #line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2738 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2741 #line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2742 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2745 #line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2746 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2749 #line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2750 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2753 #line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2754 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2757 #line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2758 { yyval.UIntVal = CallingConv::C; ;
2761 #line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2762 { yyval.UIntVal = CallingConv::C; ;
2765 #line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2766 { yyval.UIntVal = CallingConv::Fast; ;
2769 #line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2770 { yyval.UIntVal = CallingConv::Cold; ;
2773 #line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2774 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2777 #line 1219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2778 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2781 #line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2783 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2784 GEN_ERROR("Calling conv too large");
2785 yyval.UIntVal = yyvsp[0].UInt64Val;
2790 #line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2791 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2794 #line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2795 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2798 #line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2799 { yyval.ParamAttrs = ParamAttr::SExt; ;
2802 #line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2803 { yyval.ParamAttrs = ParamAttr::SExt; ;
2806 #line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2807 { yyval.ParamAttrs = ParamAttr::InReg; ;
2810 #line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2811 { yyval.ParamAttrs = ParamAttr::StructRet; ;
2814 #line 1233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2815 { yyval.ParamAttrs = ParamAttr::NoAlias; ;
2818 #line 1234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2819 { yyval.ParamAttrs = ParamAttr::ByVal; ;
2822 #line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2823 { yyval.ParamAttrs = ParamAttr::Nest; ;
2826 #line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2827 { yyval.ParamAttrs = ParamAttr::None; ;
2830 #line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2832 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2836 #line 1244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2837 { yyval.ParamAttrs = ParamAttr::NoReturn; ;
2840 #line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2841 { yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2844 #line 1246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2845 { yyval.ParamAttrs = ParamAttr::ZExt; ;
2848 #line 1247 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2849 { yyval.ParamAttrs = ParamAttr::SExt; ;
2852 #line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2853 { yyval.ParamAttrs = ParamAttr::None; ;
2856 #line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2858 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
2862 #line 1258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2863 { yyval.UIntVal = 0; ;
2866 #line 1259 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2868 yyval.UIntVal = yyvsp[0].UInt64Val;
2869 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2870 GEN_ERROR("Alignment must be a power of two");
2875 #line 1265 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2876 { yyval.UIntVal = 0; ;
2879 #line 1266 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2881 yyval.UIntVal = yyvsp[0].UInt64Val;
2882 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2883 GEN_ERROR("Alignment must be a power of two");
2888 #line 1274 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2890 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2891 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
2892 GEN_ERROR("Invalid character in section name");
2893 yyval.StrVal = yyvsp[0].StrVal;
2898 #line 1282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2899 { yyval.StrVal = 0; ;
2902 #line 1283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2903 { yyval.StrVal = yyvsp[0].StrVal; ;
2906 #line 1288 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2910 #line 1289 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2914 #line 1290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2916 CurGV->setSection(*yyvsp[0].StrVal);
2917 delete yyvsp[0].StrVal;
2922 #line 1295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2924 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2925 GEN_ERROR("Alignment must be a power of two");
2926 CurGV->setAlignment(yyvsp[0].UInt64Val);
2931 #line 1311 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2933 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2938 #line 1315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2940 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2945 #line 1319 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2947 if (*yyvsp[-1].TypeVal == Type::LabelTy)
2948 GEN_ERROR("Cannot form a pointer to a basic block");
2949 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2950 delete yyvsp[-1].TypeVal;
2955 #line 1326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2956 { // Named types are also simple types...
2957 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2959 yyval.TypeVal = new PATypeHolder(tmp);
2963 #line 1331 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2964 { // Type UpReference
2965 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
2966 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
2967 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
2968 yyval.TypeVal = new PATypeHolder(OT);
2969 UR_OUT("New Upreference!\n");
2974 #line 1339 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
2976 std::vector<const Type*> Params;
2977 ParamAttrsVector Attrs;
2978 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
2979 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
2983 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
2984 for (; I != E; ++I, ++index) {
2985 const Type *Ty = I->Ty->get();
2986 Params.push_back(Ty);
2987 if (Ty != Type::VoidTy)
2988 if (I->Attrs != ParamAttr::None) {
2989 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
2993 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2994 if (isVarArg) Params.pop_back();
2996 ParamAttrsList *ActualAttrs = 0;
2998 ActualAttrs = ParamAttrsList::get(Attrs);
2999 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3000 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3001 delete yyvsp[-4].TypeVal; // Delete the return type handle
3002 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3007 #line 1369 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3009 std::vector<const Type*> Params;
3010 ParamAttrsVector Attrs;
3011 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3012 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
3015 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
3017 for ( ; I != E; ++I, ++index) {
3018 const Type* Ty = I->Ty->get();
3019 Params.push_back(Ty);
3020 if (Ty != Type::VoidTy)
3021 if (I->Attrs != ParamAttr::None) {
3022 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3026 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3027 if (isVarArg) Params.pop_back();
3029 ParamAttrsList *ActualAttrs = 0;
3031 ActualAttrs = ParamAttrsList::get(Attrs);
3033 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3034 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3035 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
3040 #line 1400 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3041 { // Sized array type?
3042 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3043 delete yyvsp[-1].TypeVal;
3048 #line 1405 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3050 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3051 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
3052 GEN_ERROR("Unsigned result not equal to signed result");
3053 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3054 GEN_ERROR("Element type of a VectorType must be primitive");
3055 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
3056 GEN_ERROR("Vector length should be a power of 2");
3057 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3058 delete yyvsp[-1].TypeVal;
3063 #line 1417 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3064 { // Structure type?
3065 std::vector<const Type*> Elements;
3066 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3067 E = yyvsp[-1].TypeList->end(); I != E; ++I)
3068 Elements.push_back(*I);
3070 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3071 delete yyvsp[-1].TypeList;
3076 #line 1427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3077 { // Empty structure type?
3078 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3083 #line 1431 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3085 std::vector<const Type*> Elements;
3086 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3087 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3088 Elements.push_back(*I);
3090 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3091 delete yyvsp[-2].TypeList;
3096 #line 1441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3097 { // Empty structure type?
3098 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3103 #line 1448 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3105 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3106 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
3110 #line 1455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3112 if (!UpRefs.empty())
3113 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3114 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
3115 GEN_ERROR("LLVM functions cannot return aggregate types");
3116 yyval.TypeVal = yyvsp[0].TypeVal;
3120 #line 1462 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3122 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
3126 #line 1467 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3128 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3129 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
3134 #line 1472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3136 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
3141 #line 1480 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3143 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
3144 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3145 TWA.Ty = new PATypeHolder(Type::VoidTy);
3146 yyval.TypeWithAttrsList->push_back(TWA);
3151 #line 1487 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3153 yyval.TypeWithAttrsList = new TypeWithAttrsList;
3154 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3155 TWA.Ty = new PATypeHolder(Type::VoidTy);
3156 yyval.TypeWithAttrsList->push_back(TWA);
3161 #line 1494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3163 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3168 #line 1502 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3170 yyval.TypeList = new std::list<PATypeHolder>();
3171 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3172 delete yyvsp[0].TypeVal;
3177 #line 1508 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3179 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3180 delete yyvsp[0].TypeVal;
3185 #line 1520 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3186 { // Nonempty unsized arr
3187 if (!UpRefs.empty())
3188 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3189 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
3191 GEN_ERROR("Cannot make array constant with type: '" +
3192 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3193 const Type *ETy = ATy->getElementType();
3194 int NumElements = ATy->getNumElements();
3196 // Verify that we have the correct size...
3197 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3198 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3199 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3200 itostr(NumElements) + "");
3202 // Verify all elements are correct type!
3203 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3204 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3205 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3206 ETy->getDescription() +"' as required!\nIt is of type '"+
3207 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3210 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3211 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3216 #line 1548 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3218 if (!UpRefs.empty())
3219 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3220 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3222 GEN_ERROR("Cannot make array constant with type: '" +
3223 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3225 int NumElements = ATy->getNumElements();
3226 if (NumElements != -1 && NumElements != 0)
3227 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3228 " arguments, but has size of " + itostr(NumElements) +"");
3229 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3230 delete yyvsp[-2].TypeVal;
3235 #line 1564 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3237 if (!UpRefs.empty())
3238 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3239 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3241 GEN_ERROR("Cannot make array constant with type: '" +
3242 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3244 int NumElements = ATy->getNumElements();
3245 const Type *ETy = ATy->getElementType();
3246 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
3247 GEN_ERROR("Can't build string constant of size " +
3248 itostr((int)(yyvsp[0].StrVal->length())) +
3249 " when array has size " + itostr(NumElements) + "");
3250 std::vector<Constant*> Vals;
3251 if (ETy == Type::Int8Ty) {
3252 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3253 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
3255 delete yyvsp[0].StrVal;
3256 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3258 delete yyvsp[0].StrVal;
3259 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3260 delete yyvsp[-2].TypeVal;
3265 #line 1591 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3266 { // Nonempty unsized arr
3267 if (!UpRefs.empty())
3268 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3269 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
3271 GEN_ERROR("Cannot make packed constant with type: '" +
3272 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3273 const Type *ETy = PTy->getElementType();
3274 int NumElements = PTy->getNumElements();
3276 // Verify that we have the correct size...
3277 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3278 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3279 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3280 itostr(NumElements) + "");
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 GEN_ERROR("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.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3291 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3296 #line 1619 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3298 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3300 GEN_ERROR("Cannot make struct constant with type: '" +
3301 (*yyvsp[-3].TypeVal)->getDescription() + "'");
3303 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3304 GEN_ERROR("Illegal number of initializers for structure type");
3306 // Check to ensure that constants are compatible with the type initializer!
3307 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3308 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3309 GEN_ERROR("Expected type '" +
3310 STy->getElementType(i)->getDescription() +
3311 "' for element #" + utostr(i) +
3312 " of structure initializer");
3314 // Check to ensure that Type is not packed
3315 if (STy->isPacked())
3316 GEN_ERROR("Unpacked Initializer to vector type '" +
3317 STy->getDescription() + "'");
3319 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3320 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
3325 #line 1645 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3327 if (!UpRefs.empty())
3328 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3329 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3331 GEN_ERROR("Cannot make struct constant with type: '" +
3332 (*yyvsp[-2].TypeVal)->getDescription() + "'");
3334 if (STy->getNumContainedTypes() != 0)
3335 GEN_ERROR("Illegal number of initializers for structure type");
3337 // Check to ensure that Type is not packed
3338 if (STy->isPacked())
3339 GEN_ERROR("Unpacked Initializer to vector type '" +
3340 STy->getDescription() + "'");
3342 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3343 delete yyvsp[-2].TypeVal;
3348 #line 1665 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3350 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
3352 GEN_ERROR("Cannot make struct constant with type: '" +
3353 (*yyvsp[-5].TypeVal)->getDescription() + "'");
3355 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
3356 GEN_ERROR("Illegal number of initializers for structure type");
3358 // Check to ensure that constants are compatible with the type initializer!
3359 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3360 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
3361 GEN_ERROR("Expected type '" +
3362 STy->getElementType(i)->getDescription() +
3363 "' for element #" + utostr(i) +
3364 " of structure initializer");
3366 // Check to ensure that Type is packed
3367 if (!STy->isPacked())
3368 GEN_ERROR("Vector initializer to non-vector type '" +
3369 STy->getDescription() + "'");
3371 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3372 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
3377 #line 1691 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3379 if (!UpRefs.empty())
3380 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3381 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
3383 GEN_ERROR("Cannot make struct constant with type: '" +
3384 (*yyvsp[-4].TypeVal)->getDescription() + "'");
3386 if (STy->getNumContainedTypes() != 0)
3387 GEN_ERROR("Illegal number of initializers for structure type");
3389 // Check to ensure that Type is packed
3390 if (!STy->isPacked())
3391 GEN_ERROR("Vector initializer to non-vector type '" +
3392 STy->getDescription() + "'");
3394 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3395 delete yyvsp[-4].TypeVal;
3400 #line 1711 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3402 if (!UpRefs.empty())
3403 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3404 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3406 GEN_ERROR("Cannot make null pointer constant with type: '" +
3407 (*yyvsp[-1].TypeVal)->getDescription() + "'");
3409 yyval.ConstVal = ConstantPointerNull::get(PTy);
3410 delete yyvsp[-1].TypeVal;
3415 #line 1723 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3417 if (!UpRefs.empty())
3418 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3419 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3420 delete yyvsp[-1].TypeVal;
3425 #line 1730 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3427 if (!UpRefs.empty())
3428 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3429 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3431 GEN_ERROR("Global const reference must be a pointer type");
3433 // ConstExprs can exist in the body of a function, thus creating
3434 // GlobalValues whenever they refer to a variable. Because we are in
3435 // the context of a function, getExistingVal will search the functions
3436 // symbol table instead of the module symbol table for the global symbol,
3437 // which throws things all off. To get around this, we just tell
3438 // getExistingVal that we are at global scope here.
3440 Function *SavedCurFn = CurFun.CurrentFunction;
3441 CurFun.CurrentFunction = 0;
3443 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
3446 CurFun.CurrentFunction = SavedCurFn;
3448 // If this is an initializer for a constant pointer, which is referencing a
3449 // (currently) undefined variable, create a stub now that shall be replaced
3450 // in the future with the right type of variable.
3453 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3454 const PointerType *PT = cast<PointerType>(Ty);
3456 // First check to see if the forward references value is already created!
3457 PerModuleInfo::GlobalRefsType::iterator I =
3458 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
3460 if (I != CurModule.GlobalRefs.end()) {
3461 V = I->second; // Placeholder already exists, use it...
3462 yyvsp[0].ValIDVal.destroy();
3465 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3466 Name = yyvsp[0].ValIDVal.getName();
3467 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
3468 GEN_ERROR("Invalid reference to global");
3470 // Create the forward referenced global.
3472 if (const FunctionType *FTy =
3473 dyn_cast<FunctionType>(PT->getElementType())) {
3474 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3475 CurModule.CurrentModule);
3477 GV = new GlobalVariable(PT->getElementType(), false,
3478 GlobalValue::ExternalWeakLinkage, 0,
3479 Name, CurModule.CurrentModule);
3482 // Keep track of the fact that we have a forward ref to recycle it
3483 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
3488 yyval.ConstVal = cast<GlobalValue>(V);
3489 delete yyvsp[-1].TypeVal; // Free the type handle
3494 #line 1796 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3496 if (!UpRefs.empty())
3497 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3498 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3499 GEN_ERROR("Mismatched types for constant expression: " +
3500 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3501 yyval.ConstVal = yyvsp[0].ConstVal;
3502 delete yyvsp[-1].TypeVal;
3507 #line 1806 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3509 if (!UpRefs.empty())
3510 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3511 const Type *Ty = yyvsp[-1].TypeVal->get();
3512 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3513 GEN_ERROR("Cannot create a null initialized value of this type");
3514 yyval.ConstVal = Constant::getNullValue(Ty);
3515 delete yyvsp[-1].TypeVal;
3520 #line 1816 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3521 { // integral constants
3522 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3523 GEN_ERROR("Constant value doesn't fit in type");
3524 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
3529 #line 1822 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3530 { // arbitrary precision integer constants
3531 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3532 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3533 GEN_ERROR("Constant value does not fit in type");
3535 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3536 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3537 delete yyvsp[0].APIntVal;
3542 #line 1832 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3543 { // integral constants
3544 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3545 GEN_ERROR("Constant value doesn't fit in type");
3546 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
3551 #line 1838 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3552 { // arbitrary precision integer constants
3553 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3554 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
3555 GEN_ERROR("Constant value does not fit in type");
3557 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3558 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3559 delete yyvsp[0].APIntVal;
3564 #line 1848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3565 { // Boolean constants
3566 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3567 yyval.ConstVal = ConstantInt::getTrue();
3572 #line 1853 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3573 { // Boolean constants
3574 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3575 yyval.ConstVal = ConstantInt::getFalse();
3580 #line 1858 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3581 { // Float & Double constants
3582 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
3583 GEN_ERROR("Floating point constant invalid for type");
3584 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
3589 #line 1866 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3591 if (!UpRefs.empty())
3592 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3593 Constant *Val = yyvsp[-3].ConstVal;
3594 const Type *DestTy = yyvsp[-1].TypeVal->get();
3595 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3596 GEN_ERROR("invalid cast opcode for cast from '" +
3597 Val->getType()->getDescription() + "' to '" +
3598 DestTy->getDescription() + "'");
3599 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3600 delete yyvsp[-1].TypeVal;
3604 #line 1878 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3606 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3607 GEN_ERROR("GetElementPtr requires a pointer operand");
3610 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), &(*yyvsp[-1].ValueList)[0], yyvsp[-1].ValueList->size(),
3613 GEN_ERROR("Index list invalid for constant getelementptr");
3615 SmallVector<Constant*, 8> IdxVec;
3616 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3617 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3618 IdxVec.push_back(C);
3620 GEN_ERROR("Indices to constant getelementptr must be constants");
3622 delete yyvsp[-1].ValueList;
3624 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
3629 #line 1900 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3631 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
3632 GEN_ERROR("Select condition must be of boolean type");
3633 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3634 GEN_ERROR("Select operand types must match");
3635 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3640 #line 1908 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3642 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3643 GEN_ERROR("Binary operator types must match");
3645 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3649 #line 1914 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3651 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3652 GEN_ERROR("Logical operator types must match");
3653 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3654 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3655 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
3656 GEN_ERROR("Logical operator requires integral operands");
3658 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3663 #line 1925 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3665 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3666 GEN_ERROR("icmp operand types must match");
3667 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3671 #line 1930 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3673 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3674 GEN_ERROR("fcmp operand types must match");
3675 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3679 #line 1935 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3681 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3682 GEN_ERROR("Invalid extractelement operands");
3683 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3688 #line 1941 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3690 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3691 GEN_ERROR("Invalid insertelement operands");
3692 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3697 #line 1947 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3699 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3700 GEN_ERROR("Invalid shufflevector operands");
3701 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3706 #line 1956 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3708 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3713 #line 1960 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3715 yyval.ConstVector = new std::vector<Constant*>();
3716 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3721 #line 1968 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3722 { yyval.BoolVal = false; ;
3725 #line 1968 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3726 { yyval.BoolVal = true; ;
3729 #line 1971 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3730 { yyval.BoolVal = true; ;
3733 #line 1971 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3734 { yyval.BoolVal = false; ;
3737 #line 1974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3739 const Type* VTy = yyvsp[-1].TypeVal->get();
3740 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3741 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3743 GEN_ERROR("Aliases can be created only to global values");
3745 yyval.ConstVal = Aliasee;
3747 delete yyvsp[-1].TypeVal;
3751 #line 1985 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3753 Constant *Val = yyvsp[-3].ConstVal;
3754 const Type *DestTy = yyvsp[-1].TypeVal->get();
3755 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
3756 GEN_ERROR("invalid cast opcode for cast from '" +
3757 Val->getType()->getDescription() + "' to '" +
3758 DestTy->getDescription() + "'");
3760 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3762 delete yyvsp[-1].TypeVal;
3766 #line 2006 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3768 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3769 CurModule.ModuleDone();
3774 #line 2011 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3776 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
3777 CurModule.ModuleDone();
3782 #line 2024 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3783 { CurFun.isDeclare = false; ;
3786 #line 2024 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3788 CurFun.FunctionDone();
3793 #line 2028 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3794 { CurFun.isDeclare = true; ;
3797 #line 2028 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3803 #line 2031 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3809 #line 2034 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3811 if (!UpRefs.empty())
3812 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3813 // Eagerly resolve types. This is not an optimization, this is a
3814 // requirement that is due to the fact that we could have this:
3816 // %list = type { %list * }
3817 // %list = type { %list * } ; repeated type decl
3819 // If types are not resolved eagerly, then the two types will not be
3820 // determined to be the same type!
3822 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3824 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3826 // If this is a named type that is not a redefinition, add it to the slot
3828 CurModule.Types.push_back(*yyvsp[0].TypeVal);
3831 delete yyvsp[0].TypeVal;
3836 #line 2058 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3838 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
3840 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3842 // If this is a named type that is not a redefinition, add it to the slot
3844 CurModule.Types.push_back(yyvsp[0].PrimType);
3850 #line 2069 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3852 /* "Externally Visible" Linkage */
3853 if (yyvsp[0].ConstVal == 0)
3854 GEN_ERROR("Global value initializer is not a constant");
3855 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3856 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3861 #line 2076 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3867 #line 2080 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3869 if (yyvsp[0].ConstVal == 0)
3870 GEN_ERROR("Global value initializer is not a constant");
3871 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
3876 #line 2085 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3882 #line 2089 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3884 if (!UpRefs.empty())
3885 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3886 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
3888 delete yyvsp[0].TypeVal;
3892 #line 2095 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3899 #line 2099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3902 if (yyvsp[-4].StrVal) {
3903 Name = *yyvsp[-4].StrVal;
3904 delete yyvsp[-4].StrVal;
3907 GEN_ERROR("Alias name cannot be empty");
3909 Constant* Aliasee = yyvsp[0].ConstVal;
3911 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3913 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
3914 CurModule.CurrentModule);
3915 GA->setVisibility(yyvsp[-3].Visibility);
3916 InsertValue(GA, CurModule.Values);
3921 #line 2118 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3927 #line 2121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3933 #line 2127 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3935 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3936 if (AsmSoFar.empty())
3937 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
3939 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
3940 delete yyvsp[0].StrVal;
3945 #line 2137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3947 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
3948 delete yyvsp[0].StrVal;
3952 #line 2141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3954 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
3955 delete yyvsp[0].StrVal;
3959 #line 2148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3961 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3962 delete yyvsp[0].StrVal;
3967 #line 2153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3969 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
3970 delete yyvsp[0].StrVal;
3975 #line 2158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3981 #line 2167 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3983 if (!UpRefs.empty())
3984 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3985 if (*yyvsp[-2].TypeVal == Type::VoidTy)
3986 GEN_ERROR("void typed arguments are invalid");
3987 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
3988 yyval.ArgList = yyvsp[-4].ArgList;
3989 yyvsp[-4].ArgList->push_back(E);
3994 #line 2177 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3996 if (!UpRefs.empty())
3997 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3998 if (*yyvsp[-2].TypeVal == Type::VoidTy)
3999 GEN_ERROR("void typed arguments are invalid");
4000 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4001 yyval.ArgList = new ArgListType;
4002 yyval.ArgList->push_back(E);
4007 #line 2188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4009 yyval.ArgList = yyvsp[0].ArgList;
4014 #line 2192 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4016 yyval.ArgList = yyvsp[-2].ArgList;
4017 struct ArgListEntry E;
4018 E.Ty = new PATypeHolder(Type::VoidTy);
4020 E.Attrs = ParamAttr::None;
4021 yyval.ArgList->push_back(E);
4026 #line 2201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4028 yyval.ArgList = new ArgListType;
4029 struct ArgListEntry E;
4030 E.Ty = new PATypeHolder(Type::VoidTy);
4032 E.Attrs = ParamAttr::None;
4033 yyval.ArgList->push_back(E);
4038 #line 2210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4045 #line 2216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4047 std::string FunctionName(*yyvsp[-6].StrVal);
4048 delete yyvsp[-6].StrVal; // Free strdup'd memory!
4050 // Check the function result for abstractness if this is a define. We should
4051 // have no abstract types at this point
4052 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4053 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
4055 std::vector<const Type*> ParamTypeList;
4056 ParamAttrsVector Attrs;
4057 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4058 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
4059 Attrs.push_back(PAWI);
4061 if (yyvsp[-4].ArgList) { // If there are arguments...
4063 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
4064 const Type* Ty = I->Ty->get();
4065 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4066 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4067 ParamTypeList.push_back(Ty);
4068 if (Ty != Type::VoidTy)
4069 if (I->Attrs != ParamAttr::None) {
4070 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4071 Attrs.push_back(PAWI);
4076 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4077 if (isVarArg) ParamTypeList.pop_back();
4079 ParamAttrsList *PAL = 0;
4081 PAL = ParamAttrsList::get(Attrs);
4083 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
4084 const PointerType *PFT = PointerType::get(FT);
4085 delete yyvsp[-7].TypeVal;
4088 if (!FunctionName.empty()) {
4089 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4091 ID = ValID::createGlobalID(CurModule.Values.size());
4095 // See if this function was forward referenced. If so, recycle the object.
4096 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4097 // Move the function to the end of the list, from whereever it was
4098 // previously inserted.
4099 Fn = cast<Function>(FWRef);
4100 CurModule.CurrentModule->getFunctionList().remove(Fn);
4101 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4102 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4103 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4104 if (Fn->getFunctionType() != FT) {
4105 // The existing function doesn't have the same type. This is an overload
4107 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4108 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4109 // Neither the existing or the current function is a declaration and they
4110 // have the same name and same type. Clearly this is a redefinition.
4111 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4112 } if (Fn->isDeclaration()) {
4113 // Make sure to strip off any argument names so we can't get conflicts.
4114 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4118 } else { // Not already defined?
4119 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4120 CurModule.CurrentModule);
4122 InsertValue(Fn, CurModule.Values);
4125 CurFun.FunctionStart(Fn);
4127 if (CurFun.isDeclare) {
4128 // If we have declaration, always overwrite linkage. This will allow us to
4129 // correctly handle cases, when pointer to function is passed as argument to
4130 // another function.
4131 Fn->setLinkage(CurFun.Linkage);
4132 Fn->setVisibility(CurFun.Visibility);
4134 Fn->setCallingConv(yyvsp[-8].UIntVal);
4135 Fn->setAlignment(yyvsp[0].UIntVal);
4136 if (yyvsp[-1].StrVal) {
4137 Fn->setSection(*yyvsp[-1].StrVal);
4138 delete yyvsp[-1].StrVal;
4141 // Add all of the arguments we parsed to the function...
4142 if (yyvsp[-4].ArgList) { // Is null if empty...
4143 if (isVarArg) { // Nuke the last entry
4144 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
4145 "Not a varargs marker!");
4146 delete yyvsp[-4].ArgList->back().Ty;
4147 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
4149 Function::arg_iterator ArgIt = Fn->arg_begin();
4150 Function::arg_iterator ArgEnd = Fn->arg_end();
4152 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4153 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
4154 delete I->Ty; // Delete the typeholder...
4155 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4161 delete yyvsp[-4].ArgList; // We're now done with the argument list
4167 #line 2338 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4169 yyval.FunctionVal = CurFun.CurrentFunction;
4171 // Make sure that we keep track of the linkage type even if there was a
4172 // previous "declare".
4173 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4174 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
4178 #line 2349 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4180 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4185 #line 2354 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4187 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4188 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4189 yyval.FunctionVal = CurFun.CurrentFunction;
4190 CurFun.FunctionDone();
4195 #line 2366 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4197 yyval.BoolVal = false;
4202 #line 2370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4204 yyval.BoolVal = true;
4209 #line 2375 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4210 { // A reference to a direct constant
4211 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
4216 #line 2379 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4218 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
4223 #line 2383 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4224 { // Perhaps it's an FP constant?
4225 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
4230 #line 2387 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4232 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
4237 #line 2391 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4239 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
4244 #line 2395 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4246 yyval.ValIDVal = ValID::createNull();
4251 #line 2399 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4253 yyval.ValIDVal = ValID::createUndef();
4258 #line 2403 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4259 { // A vector zero constant.
4260 yyval.ValIDVal = ValID::createZeroInit();
4265 #line 2407 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4266 { // Nonempty unsized packed vector
4267 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4268 int NumElements = yyvsp[-1].ConstVector->size();
4270 VectorType* pt = VectorType::get(ETy, NumElements);
4271 PATypeHolder* PTy = new PATypeHolder(
4279 // Verify all elements are correct type!
4280 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4281 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
4282 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4283 ETy->getDescription() +"' as required!\nIt is of type '" +
4284 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
4287 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4288 delete PTy; delete yyvsp[-1].ConstVector;
4293 #line 2432 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4295 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
4300 #line 2436 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4302 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4303 delete yyvsp[-2].StrVal;
4304 delete yyvsp[0].StrVal;
4309 #line 2446 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4310 { // Is it an integer reference...?
4311 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
4316 #line 2450 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4318 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
4323 #line 2454 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4324 { // Is it a named reference...?
4325 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4326 delete yyvsp[0].StrVal;
4331 #line 2459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4332 { // Is it a named reference...?
4333 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4334 delete yyvsp[0].StrVal;
4339 #line 2472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4341 if (!UpRefs.empty())
4342 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4343 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4344 delete yyvsp[-1].TypeVal;
4349 #line 2481 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4351 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4356 #line 2485 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4357 { // Do not allow functions with 0 basic blocks
4358 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4363 #line 2494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4365 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
4367 InsertValue(yyvsp[0].TermInstVal);
4368 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4369 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
4374 #line 2503 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4376 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4377 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4378 if (CI2->getParent() == 0)
4379 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4380 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4381 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4386 #line 2512 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4387 { // Empty space between instruction lists
4388 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
4393 #line 2516 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4394 { // Labelled (named) basic block
4395 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4396 delete yyvsp[0].StrVal;
4402 #line 2523 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4403 { // Return with a result...
4404 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4409 #line 2527 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4410 { // Return with no result...
4411 yyval.TermInstVal = new ReturnInst();
4416 #line 2531 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4417 { // Unconditional Branch...
4418 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4420 yyval.TermInstVal = new BranchInst(tmpBB);
4424 #line 2536 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4426 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4427 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4429 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4431 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4433 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4437 #line 2546 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4439 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4441 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4443 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4444 yyval.TermInstVal = S;
4446 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4447 E = yyvsp[-1].JumpTable->end();
4448 for (; I != E; ++I) {
4449 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4450 S->addCase(CI, I->second);
4452 GEN_ERROR("Switch case is constant, but not a simple integer");
4454 delete yyvsp[-1].JumpTable;
4459 #line 2565 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4461 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4463 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4465 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4466 yyval.TermInstVal = S;
4471 #line 2575 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4474 // Handle the short syntax
4475 const PointerType *PFTy = 0;
4476 const FunctionType *Ty = 0;
4477 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
4478 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4479 // Pull out the types of all of the arguments...
4480 std::vector<const Type*> ParamTypes;
4481 ParamAttrsVector Attrs;
4482 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4483 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
4484 Attrs.push_back(PAWI);
4486 ValueRefList::iterator I = yyvsp[-8].ValueRefList->begin(), E = yyvsp[-8].ValueRefList->end();
4488 for (; I != E; ++I, ++index) {
4489 const Type *Ty = I->Val->getType();
4490 if (Ty == Type::VoidTy)
4491 GEN_ERROR("Short call syntax cannot be used with varargs");
4492 ParamTypes.push_back(Ty);
4493 if (I->Attrs != ParamAttr::None) {
4494 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4495 Attrs.push_back(PAWI);
4499 ParamAttrsList *PAL = 0;
4501 PAL = ParamAttrsList::get(Attrs);
4502 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
4503 PFTy = PointerType::get(Ty);
4506 delete yyvsp[-11].TypeVal;
4508 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
4510 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4512 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
4515 // Check the arguments
4517 if (yyvsp[-8].ValueRefList->empty()) { // Has no arguments?
4518 // Make sure no arguments is a good thing!
4519 if (Ty->getNumParams() != 0)
4520 GEN_ERROR("No arguments passed to a function that "
4521 "expects arguments");
4522 } else { // Has arguments?
4523 // Loop through FunctionType's arguments and ensure they are specified
4525 FunctionType::param_iterator I = Ty->param_begin();
4526 FunctionType::param_iterator E = Ty->param_end();
4527 ValueRefList::iterator ArgI = yyvsp[-8].ValueRefList->begin(), ArgE = yyvsp[-8].ValueRefList->end();
4529 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4530 if (ArgI->Val->getType() != *I)
4531 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4532 (*I)->getDescription() + "'");
4533 Args.push_back(ArgI->Val);
4536 if (Ty->isVarArg()) {
4538 for (; ArgI != ArgE; ++ArgI)
4539 Args.push_back(ArgI->Val); // push the remaining varargs
4540 } else if (I != E || ArgI != ArgE)
4541 GEN_ERROR("Invalid number of parameters detected");
4544 // Create the InvokeInst
4545 InvokeInst *II = new InvokeInst(V, Normal, Except, &Args[0], Args.size());
4546 II->setCallingConv(yyvsp[-12].UIntVal);
4547 yyval.TermInstVal = II;
4548 delete yyvsp[-8].ValueRefList;
4553 #line 2654 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4555 yyval.TermInstVal = new UnwindInst();
4560 #line 2658 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4562 yyval.TermInstVal = new UnreachableInst();
4567 #line 2665 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4569 yyval.JumpTable = yyvsp[-5].JumpTable;
4570 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4573 GEN_ERROR("May only switch on a constant pool value");
4575 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4577 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4581 #line 2676 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4583 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4584 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4588 GEN_ERROR("May only switch on a constant pool value");
4590 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4592 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4596 #line 2689 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4598 // Is this definition named?? if so, assign the name...
4599 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4601 InsertValue(yyvsp[0].InstVal);
4602 yyval.InstVal = yyvsp[0].InstVal;
4607 #line 2699 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4608 { // Used for PHI nodes
4609 if (!UpRefs.empty())
4610 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4611 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4612 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4614 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4616 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4617 delete yyvsp[-5].TypeVal;
4621 #line 2710 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4623 yyval.PHIList = yyvsp[-6].PHIList;
4624 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4626 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4628 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4632 #line 2720 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4634 if (!UpRefs.empty())
4635 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4636 // Used for call and invoke instructions
4637 yyval.ValueRefList = new ValueRefList();
4638 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4639 yyval.ValueRefList->push_back(E);
4640 delete yyvsp[-2].TypeVal;
4644 #line 2729 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4646 if (!UpRefs.empty())
4647 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4648 yyval.ValueRefList = yyvsp[-4].ValueRefList;
4649 ValueRefListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4650 yyval.ValueRefList->push_back(E);
4651 delete yyvsp[-2].TypeVal;
4656 #line 2738 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4657 { yyval.ValueRefList = new ValueRefList(); ;
4660 #line 2741 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4661 { yyval.ValueList = new std::vector<Value*>(); ;
4664 #line 2742 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4666 yyval.ValueList = yyvsp[-2].ValueList;
4667 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4672 #line 2749 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4674 yyval.BoolVal = true;
4679 #line 2753 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4681 yyval.BoolVal = false;
4686 #line 2758 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4688 if (!UpRefs.empty())
4689 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4690 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4691 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4693 "Arithmetic operator requires integer, FP, or packed operands");
4694 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4695 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4696 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4697 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4698 GEN_ERROR("Remainder not supported on vector types");
4699 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4701 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4703 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4704 if (yyval.InstVal == 0)
4705 GEN_ERROR("binary operator returned null");
4706 delete yyvsp[-3].TypeVal;
4710 #line 2779 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4712 if (!UpRefs.empty())
4713 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4714 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4715 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4716 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
4717 GEN_ERROR("Logical operator requires integral operands");
4719 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4721 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4723 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4724 if (yyval.InstVal == 0)
4725 GEN_ERROR("binary operator returned null");
4726 delete yyvsp[-3].TypeVal;
4730 #line 2796 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4732 if (!UpRefs.empty())
4733 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4734 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4735 GEN_ERROR("Vector types not supported by icmp instruction");
4736 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4738 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4740 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4741 if (yyval.InstVal == 0)
4742 GEN_ERROR("icmp operator returned null");
4743 delete yyvsp[-3].TypeVal;
4747 #line 2810 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4749 if (!UpRefs.empty())
4750 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4751 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
4752 GEN_ERROR("Vector types not supported by fcmp instruction");
4753 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4755 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4757 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4758 if (yyval.InstVal == 0)
4759 GEN_ERROR("fcmp operator returned null");
4760 delete yyvsp[-3].TypeVal;
4764 #line 2824 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4766 if (!UpRefs.empty())
4767 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4768 Value* Val = yyvsp[-2].ValueVal;
4769 const Type* DestTy = yyvsp[0].TypeVal->get();
4770 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
4771 GEN_ERROR("invalid cast opcode for cast from '" +
4772 Val->getType()->getDescription() + "' to '" +
4773 DestTy->getDescription() + "'");
4774 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4775 delete yyvsp[0].TypeVal;
4779 #line 2836 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4781 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
4782 GEN_ERROR("select condition must be boolean");
4783 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4784 GEN_ERROR("select value types should match");
4785 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4790 #line 2844 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4792 if (!UpRefs.empty())
4793 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4794 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4795 delete yyvsp[0].TypeVal;
4800 #line 2851 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4802 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4803 GEN_ERROR("Invalid extractelement operands");
4804 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4809 #line 2857 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4811 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4812 GEN_ERROR("Invalid insertelement operands");
4813 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4818 #line 2863 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4820 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4821 GEN_ERROR("Invalid shufflevector operands");
4822 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4827 #line 2869 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4829 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4830 if (!Ty->isFirstClassType())
4831 GEN_ERROR("PHI node operands must be of first class type");
4832 yyval.InstVal = new PHINode(Ty);
4833 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4834 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4835 if (yyvsp[0].PHIList->front().first->getType() != Ty)
4836 GEN_ERROR("All elements of a PHI node must be of the same type");
4837 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4838 yyvsp[0].PHIList->pop_front();
4840 delete yyvsp[0].PHIList; // Free the list...
4845 #line 2885 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4848 // Handle the short syntax
4849 const PointerType *PFTy = 0;
4850 const FunctionType *Ty = 0;
4851 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
4852 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4853 // Pull out the types of all of the arguments...
4854 std::vector<const Type*> ParamTypes;
4855 ParamAttrsVector Attrs;
4856 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4857 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
4858 Attrs.push_back(PAWI);
4861 ValueRefList::iterator I = yyvsp[-2].ValueRefList->begin(), E = yyvsp[-2].ValueRefList->end();
4862 for (; I != E; ++I, ++index) {
4863 const Type *Ty = I->Val->getType();
4864 if (Ty == Type::VoidTy)
4865 GEN_ERROR("Short call syntax cannot be used with varargs");
4866 ParamTypes.push_back(Ty);
4867 if (I->Attrs != ParamAttr::None) {
4868 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4869 Attrs.push_back(PAWI);
4873 ParamAttrsList *PAL = 0;
4875 PAL = ParamAttrsList::get(Attrs);
4877 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
4878 PFTy = PointerType::get(Ty);
4881 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
4884 // Check for call to invalid intrinsic to avoid crashing later.
4885 if (Function *theF = dyn_cast<Function>(V)) {
4886 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4887 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4888 !theF->getIntrinsicID(true))
4889 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4890 theF->getName() + "'");
4893 // Check the arguments
4895 if (yyvsp[-2].ValueRefList->empty()) { // Has no arguments?
4896 // Make sure no arguments is a good thing!
4897 if (Ty->getNumParams() != 0)
4898 GEN_ERROR("No arguments passed to a function that "
4899 "expects arguments");
4900 } else { // Has arguments?
4901 // Loop through FunctionType's arguments and ensure they are specified
4904 FunctionType::param_iterator I = Ty->param_begin();
4905 FunctionType::param_iterator E = Ty->param_end();
4906 ValueRefList::iterator ArgI = yyvsp[-2].ValueRefList->begin(), ArgE = yyvsp[-2].ValueRefList->end();
4908 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4909 if (ArgI->Val->getType() != *I)
4910 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4911 (*I)->getDescription() + "'");
4912 Args.push_back(ArgI->Val);
4914 if (Ty->isVarArg()) {
4916 for (; ArgI != ArgE; ++ArgI)
4917 Args.push_back(ArgI->Val); // push the remaining varargs
4918 } else if (I != E || ArgI != ArgE)
4919 GEN_ERROR("Invalid number of parameters detected");
4921 // Create the call node
4922 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
4923 CI->setTailCall(yyvsp[-7].BoolVal);
4924 CI->setCallingConv(yyvsp[-6].UIntVal);
4926 delete yyvsp[-2].ValueRefList;
4927 delete yyvsp[-5].TypeVal;
4932 #line 2969 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4934 yyval.InstVal = yyvsp[0].InstVal;
4939 #line 2974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4941 yyval.BoolVal = true;
4946 #line 2978 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4948 yyval.BoolVal = false;
4953 #line 2985 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4955 if (!UpRefs.empty())
4956 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4957 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4958 delete yyvsp[-1].TypeVal;
4963 #line 2992 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4965 if (!UpRefs.empty())
4966 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4967 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4969 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4970 delete yyvsp[-4].TypeVal;
4974 #line 3000 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4976 if (!UpRefs.empty())
4977 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4978 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4979 delete yyvsp[-1].TypeVal;
4984 #line 3007 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4986 if (!UpRefs.empty())
4987 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
4988 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4990 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4991 delete yyvsp[-4].TypeVal;
4995 #line 3015 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4997 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
4998 GEN_ERROR("Trying to free nonpointer type " +
4999 yyvsp[0].ValueVal->getType()->getDescription() + "");
5000 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
5005 #line 3023 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5007 if (!UpRefs.empty())
5008 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5009 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5010 GEN_ERROR("Can't load from nonpointer type: " +
5011 (*yyvsp[-2].TypeVal)->getDescription());
5012 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
5013 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5014 (*yyvsp[-2].TypeVal)->getDescription());
5015 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5017 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5018 delete yyvsp[-2].TypeVal;
5022 #line 3037 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5024 if (!UpRefs.empty())
5025 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5026 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
5028 GEN_ERROR("Can't store to a nonpointer type: " +
5029 (*yyvsp[-2].TypeVal)->getDescription());
5030 const Type *ElTy = PT->getElementType();
5031 if (ElTy != yyvsp[-4].ValueVal->getType())
5032 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
5033 "' into space of type '" + ElTy->getDescription() + "'");
5035 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5037 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5038 delete yyvsp[-2].TypeVal;
5042 #line 3054 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5044 if (!UpRefs.empty())
5045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5046 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
5047 GEN_ERROR("getelementptr insn requires pointer operand");
5049 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size(), true))
5050 GEN_ERROR("Invalid getelementptr indices for type '" +
5051 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5052 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
5054 yyval.InstVal = new GetElementPtrInst(tmpVal, &(*yyvsp[0].ValueList)[0], yyvsp[0].ValueList->size());
5055 delete yyvsp[-2].TypeVal;
5056 delete yyvsp[0].ValueList;
5060 /* the action file gets copied in in place of this dollarsign */
5061 #line 543 "/usr/share/bison.simple"
5072 short *ssp1 = yyss - 1;
5073 fprintf (stderr, "state stack now");
5074 while (ssp1 != yyssp)
5075 fprintf (stderr, " %d", *++ssp1);
5076 fprintf (stderr, "\n");
5086 yylsp->first_line = yylloc.first_line;
5087 yylsp->first_column = yylloc.first_column;
5088 yylsp->last_line = (yylsp-1)->last_line;
5089 yylsp->last_column = (yylsp-1)->last_column;
5094 yylsp->last_line = (yylsp+yylen-1)->last_line;
5095 yylsp->last_column = (yylsp+yylen-1)->last_column;
5099 /* Now "shift" the result of the reduction.
5100 Determine what state that goes to,
5101 based on the state we popped back to
5102 and the rule number reduced by. */
5106 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5107 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5108 yystate = yytable[yystate];
5110 yystate = yydefgoto[yyn - YYNTBASE];
5114 yyerrlab: /* here on detecting error */
5117 /* If not already recovering from an error, report this error. */
5121 #ifdef YYERROR_VERBOSE
5122 yyn = yypact[yystate];
5124 if (yyn > YYFLAG && yyn < YYLAST)
5131 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5132 for (x = (yyn < 0 ? -yyn : 0);
5133 x < (sizeof(yytname) / sizeof(char *)); x++)
5134 if (yycheck[x + yyn] == x)
5135 size += strlen(yytname[x]) + 15, count++;
5136 msg = (char *) malloc(size + 15);
5139 strcpy(msg, "parse error");
5144 for (x = (yyn < 0 ? -yyn : 0);
5145 x < (sizeof(yytname) / sizeof(char *)); x++)
5146 if (yycheck[x + yyn] == x)
5148 strcat(msg, count == 0 ? ", expecting `" : " or `");
5149 strcat(msg, yytname[x]);
5158 yyerror ("parse error; also virtual memory exceeded");
5161 #endif /* YYERROR_VERBOSE */
5162 yyerror("parse error");
5166 yyerrlab1: /* here on error raised explicitly by an action */
5168 if (yyerrstatus == 3)
5170 /* if just tried and failed to reuse lookahead token after an error, discard it. */
5172 /* return failure if at end of input */
5173 if (yychar == YYEOF)
5178 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5184 /* Else will try to reuse lookahead token
5185 after shifting the error token. */
5187 yyerrstatus = 3; /* Each real token shifted decrements this */
5191 yyerrdefault: /* current state does not do anything special for the error token. */
5194 /* This is wrong; only states that explicitly want error tokens
5195 should shift them. */
5196 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5197 if (yyn) goto yydefault;
5200 yyerrpop: /* pop the current state because it cannot handle the error token */
5202 if (yyssp == yyss) YYABORT;
5212 short *ssp1 = yyss - 1;
5213 fprintf (stderr, "Error: state stack now");
5214 while (ssp1 != yyssp)
5215 fprintf (stderr, " %d", *++ssp1);
5216 fprintf (stderr, "\n");
5222 yyn = yypact[yystate];
5227 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5246 fprintf(stderr, "Shifting error token, ");
5258 /* YYACCEPT comes here. */
5270 /* YYABORT comes here. */
5281 #line 3071 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5284 // common code from the two 'RunVMAsmParser' functions
5285 static Module* RunParser(Module * M) {
5287 llvmAsmlineno = 1; // Reset the current line number...
5288 CurModule.CurrentModule = M;
5293 // Check to make sure the parser succeeded
5296 delete ParserResult;
5300 // Emit an error if there are any unresolved types left.
5301 if (!CurModule.LateResolveTypes.empty()) {
5302 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5303 if (DID.Type == ValID::LocalName) {
5304 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5306 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5309 delete ParserResult;
5313 // Emit an error if there are any unresolved values left.
5314 if (!CurModule.LateResolveValues.empty()) {
5315 Value *V = CurModule.LateResolveValues.back();
5316 std::map<Value*, std::pair<ValID, int> >::iterator I =
5317 CurModule.PlaceHolderInfo.find(V);
5319 if (I != CurModule.PlaceHolderInfo.end()) {
5320 ValID &DID = I->second.first;
5321 if (DID.Type == ValID::LocalName) {
5322 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5324 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5327 delete ParserResult;
5332 // Check to make sure that parsing produced a result
5336 // Reset ParserResult variable while saving its value for the result.
5337 Module *Result = ParserResult;
5343 void llvm::GenerateError(const std::string &message, int LineNo) {
5344 if (LineNo == -1) LineNo = llvmAsmlineno;
5345 // TODO: column number in exception
5347 TheParseError->setError(CurFilename, message, LineNo);
5351 int yyerror(const char *ErrorMsg) {
5353 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5354 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5355 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5356 if (yychar != YYEMPTY && yychar != 0)
5357 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5359 GenerateError(errMsg);